patch-2.4.13 linux/fs/ufs/ialloc.c

Next file: linux/fs/ufs/inode.c
Previous file: linux/fs/ufs/dir.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.12/linux/fs/ufs/ialloc.c linux/fs/ufs/ialloc.c
@@ -143,7 +143,7 @@
  * For other inodes, search forward from the parent directory's block
  * group to find a free inode.
  */
-struct inode * ufs_new_inode (const struct inode * dir,	int mode, int * err )
+struct inode * ufs_new_inode (const struct inode * dir,	int mode)
 {
 	struct super_block * sb;
 	struct ufs_sb_private_info * uspi;
@@ -157,24 +157,18 @@
 	UFSD(("ENTER\n"))
 	
 	/* Cannot create files in a deleted directory */
-	if (!dir || !dir->i_nlink) {
-		*err = -EPERM;
-		return NULL;
-	}
+	if (!dir || !dir->i_nlink)
+		return ERR_PTR(-EPERM);
 	sb = dir->i_sb;
 	inode = new_inode(sb);
-	if (!inode) {
-		*err = -ENOMEM;
-		return NULL;
-	}
+	if (!inode)
+		return ERR_PTR(-ENOMEM);
 	swab = sb->u.ufs_sb.s_swab;
 	uspi = sb->u.ufs_sb.s_uspi;
 	usb1 = ubh_get_usb_first(USPI_UBH);
 
 	lock_super (sb);
 
-	*err = -ENOSPC;
-
 	/*
 	 * Try to place the inode in its parent directory
 	 */
@@ -262,7 +256,7 @@
 	if (dir->i_mode & S_ISGID) {
 		inode->i_gid = dir->i_gid;
 		if (S_ISDIR(mode))
-			mode |= S_ISGID;
+			inode->i_mode |= S_ISGID;
 	} else
 		inode->i_gid = current->fsgid;
 
@@ -283,12 +277,10 @@
 		inode->i_flags |= S_NOQUOTA;
 		inode->i_nlink = 0;
 		iput(inode);
-		*err = -EDQUOT;
-		return NULL;
+		return ERR_PTR(-EDQUOT);
 	}
 
 	UFSD(("allocating inode %lu\n", inode->i_ino))
-	*err = 0;
 	UFSD(("EXIT\n"))
 	return inode;
 
@@ -297,5 +289,5 @@
 	make_bad_inode(inode);
 	iput (inode);
 	UFSD(("EXIT (FAILED)\n"))
-	return NULL;
+	return ERR_PTR(-ENOSPC);
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)