Eliminate rename (CKRM RCFS rewrite)

Disallow any renaming of directories/files. It is not worthwhile to  add 
additional complexity to deal with cached names and the effects on rules defined 
in classification engines.

Signed-off-by: Shailabh Nagar <[EMAIL PROTECTED]>

 fs/rcfs/dir.c       |   11 -----------
 fs/rcfs/socket_fs.c |    8 +++-----
 2 files changed, 3 insertions(+), 16 deletions(-)

Index: linux-2.6.12/fs/rcfs/dir.c
===================================================================
--- linux-2.6.12.orig/fs/rcfs/dir.c	2005-08-09 15:30:34.788612048 -0400
+++ linux-2.6.12/fs/rcfs/dir.c	2005-08-09 15:30:34.861600952 -0400
@@ -127,14 +127,3 @@ int rcfs_unlink(struct inode *dir, struc
 	return -ENOENT;
 }
 
-/* rename is allowed on directories only */
-int
-rcfs_rename(struct inode *old_dir, struct dentry *old_dentry,
-	    struct inode *new_dir, struct dentry *new_dentry)
-{
-	if (S_ISDIR(old_dentry->d_inode->i_mode))
-		return simple_rename(old_dir, old_dentry, new_dir, new_dentry);
-	else
-		return -EINVAL;
-}
-
Index: linux-2.6.12/fs/rcfs/socket_fs.c
===================================================================
--- linux-2.6.12.orig/fs/rcfs/socket_fs.c	2005-08-09 15:30:34.788612048 -0400
+++ linux-2.6.12/fs/rcfs/socket_fs.c	2005-08-09 15:30:34.862600800 -0400
@@ -23,8 +23,6 @@
 
 extern int rcfs_rmdir(struct inode *, struct dentry *);
 extern int rcfs_unlink(struct inode *, struct dentry *);
-extern int rcfs_rename(struct inode *, struct dentry *, struct inode *,
-		       struct dentry *);
 
 extern int rcfs_create_coredir(struct inode *, struct dentry *);
 
@@ -230,7 +228,7 @@ struct inode_operations my_iops = {
 	.mkdir = rcfs_sock_mkdir,
 	.rmdir = rcfs_sock_rmdir,
 	.mknod = rcfs_mknod_noperm,
-	.rename = rcfs_rename,
+	.rename = rcfs_rename_noperm,
 };
 
 struct inode_operations class_iops = {
@@ -242,7 +240,7 @@ struct inode_operations class_iops = {
 	.mkdir = rcfs_mkdir_noperm,
 	.rmdir = rcfs_rmdir_noperm,
 	.mknod = rcfs_mknod_noperm,
-	.rename = rcfs_rename,
+	.rename = rcfs_rename_noperm,
 };
 
 struct inode_operations sub_iops = {
@@ -254,6 +252,6 @@ struct inode_operations sub_iops = {
 	.mkdir = rcfs_mkdir_noperm,
 	.rmdir = rcfs_rmdir_noperm,
 	.mknod = rcfs_mknod_noperm,
-	.rename = rcfs_rename,
+	.rename = rcfs_rename_noperm,
 };
 

Reply via email to