No permission inode operations (CKRM RCFS rewrite)
Move inode operations returning -EPERM/ENOENT to inode.c
Signed-off-by: Shailabh Nagar <[EMAIL PROTECTED]>
fs/rcfs/dir.c | 63 ------------------------------------------------
fs/rcfs/inode.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++
fs/rcfs/socket_fs.c | 9 ------
include/linux/rcfs.h | 13 ++++++++--
4 files changed, 77 insertions(+), 74 deletions(-)
Index: linux-2.6.12/fs/rcfs/dir.c
===================================================================
--- linux-2.6.12.orig/fs/rcfs/dir.c 2005-08-09 15:30:28.032639112 -0400
+++ linux-2.6.12/fs/rcfs/dir.c 2005-08-09 15:30:28.105628016 -0400
@@ -155,66 +155,3 @@ rcfs_rename(struct inode *old_dir, struc
return -EINVAL;
}
-int rcfs_create_noperm(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
-{
- return -EPERM;
-}
-
-int rcfs_symlink_noperm(struct inode *dir, struct dentry *dentry, const char *symname)
-{
- return -EPERM;
-}
-
-int rcfs_mkdir_noperm(struct inode *dir, struct dentry *dentry, int mode)
-{
- return -EPERM;
-}
-
-int rcfs_rmdir_noperm(struct inode *dir, struct dentry *dentry)
-{
- return -EPERM;
-}
-
-int rcfs_link_noperm(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
-{
- return -EPERM;
-}
-
-int rcfs_unlink_noperm(struct inode *dir, struct dentry *dentry)
-{
- return -EPERM;
-}
-
-int rcfs_mknod_noperm(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
-{
- return -EPERM;
-}
-
-int rcfs_rename_noperm(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry)
-{
- return -EPERM;
-}
-
-struct inode_operations rcfs_dir_inode_operations = {
- .create = rcfs_create_noperm,
- .lookup = simple_lookup,
- .link = rcfs_link_noperm,
- .unlink = rcfs_unlink,
- .symlink = rcfs_symlink_noperm,
- .mkdir = rcfs_mkdir,
- .rmdir = rcfs_rmdir,
- .mknod = rcfs_mknod_noperm,
- .rename = rcfs_rename,
-};
-
-struct inode_operations rcfs_rootdir_inode_operations = {
- .create = rcfs_create_noperm,
- .lookup = simple_lookup,
- .link = rcfs_link_noperm,
- .unlink = rcfs_unlink_noperm,
- .symlink = rcfs_symlink_noperm,
- .mkdir = rcfs_mkdir_noperm,
- .rmdir = rcfs_rmdir_noperm,
- .mknod = rcfs_mknod_noperm,
- .rename = rcfs_rename_noperm,
-};
Index: linux-2.6.12/fs/rcfs/inode.c
===================================================================
--- linux-2.6.12.orig/fs/rcfs/inode.c 2005-08-09 15:30:28.032639112 -0400
+++ linux-2.6.12/fs/rcfs/inode.c 2005-08-09 15:30:28.106627864 -0400
@@ -32,6 +32,72 @@
#include <linux/rcfs.h>
#include <asm/uaccess.h>
+
+/******************************
+ *
+ * Default inode ops
+ *
+ ******************************/
+
+
+int rcfs_create_noperm(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
+{
+ return -EPERM;
+}
+
+int rcfs_symlink_noperm(struct inode *dir, struct dentry *dentry, const char *symname)
+{
+ return -EPERM;
+}
+
+int rcfs_mkdir_noperm(struct inode *dir, struct dentry *dentry, int mode)
+{
+ return -EPERM;
+}
+
+int rcfs_rmdir_noperm(struct inode *dir, struct dentry *dentry)
+{
+ return -EPERM;
+}
+
+int rcfs_link_noperm(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
+{
+ return -EPERM;
+}
+
+int rcfs_unlink_noperm(struct inode *dir, struct dentry *dentry)
+{
+ return -EPERM;
+}
+
+int rcfs_mknod_noperm(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
+{
+ return -EPERM;
+}
+
+int rcfs_rename_noperm(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry)
+{
+ return -EPERM;
+}
+
+/* -ENOENT allows rm -rf to work even if control files present */
+int rcfs_unlink_noent(struct inode *dir, struct dentry *dentry)
+{
+ return -ENOENT;
+}
+
+struct inode_operations rcfs_dir_inode_ops_noperm = {
+ .create = rcfs_create_noperm,
+ .lookup = simple_lookup,
+ .link = rcfs_link_noperm,
+ .unlink = rcfs_unlink_noperm,
+ .symlink = rcfs_symlink_noperm,
+ .mkdir = rcfs_mkdir_noperm,
+ .rmdir = rcfs_rmdir_noperm,
+ .mknod = rcfs_mknod_noperm,
+ .rename = rcfs_rename_noperm,
+};
+
/*
* Address of variable used as flag to indicate a magic file,
* value unimportant
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:28.032639112 -0400
+++ linux-2.6.12/fs/rcfs/socket_fs.c 2005-08-09 15:30:28.106627864 -0400
@@ -21,15 +21,6 @@
#include <linux/rcfs.h>
#include <net/tcp.h>
-extern int rcfs_create_noperm(struct inode *, struct dentry *, int,
- struct nameidata *);
-extern int rcfs_symlink_noperm(struct inode *, struct dentry *, const char *);
-extern int rcfs_mkdir_noperm(struct inode *, struct dentry *, int);
-extern int rcfs_rmdir_noperm(struct inode *, struct dentry *);
-extern int rcfs_link_noperm(struct dentry *, struct inode *, struct dentry *);
-extern int rcfs_unlink_noperm(struct inode *, struct dentry *);
-extern int rcfs_mknod_noperm(struct inode *, struct dentry *, int mode, dev_t);
-
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 *,
Index: linux-2.6.12/include/linux/rcfs.h
===================================================================
--- linux-2.6.12.orig/include/linux/rcfs.h 2005-08-09 15:30:28.032639112 -0400
+++ linux-2.6.12/include/linux/rcfs.h 2005-08-09 15:30:28.107627712 -0400
@@ -68,8 +68,7 @@ int rcfs_clear_magic(struct dentry *);
extern struct super_operations rcfs_super_ops;
extern struct address_space_operations rcfs_aops;
-extern struct inode_operations rcfs_dir_inode_operations;
-extern struct inode_operations rcfs_rootdir_inode_operations;
+extern struct inode_operations rcfs_dir_inode_ops_noperm;
extern struct inode_operations rcfs_file_inode_operations;
extern struct file_operations shares_fileops;
@@ -88,6 +87,16 @@ int rcfs_rmroot(struct dentry *);
extern struct dentry *rcfs_rootde;
extern struct rbce_eng_callback rcfs_eng_callbacks;
+extern int rcfs_create_noperm(struct inode *, struct dentry *, int , struct nameidata *);
+extern int rcfs_symlink_noperm(struct inode *, struct dentry *, const char *);
+extern int rcfs_mkdir_noperm(struct inode *, struct dentry *, int );
+extern int rcfs_rmdir_noperm(struct inode *, struct dentry *);
+extern int rcfs_link_noperm(struct dentry *, struct inode *, struct dentry *);
+extern int rcfs_unlink_noperm(struct inode *, struct dentry *);
+extern int rcfs_mknod_noperm(struct inode *, struct dentry *, int, dev_t );
+extern int rcfs_rename_noperm(struct inode *, struct dentry *, struct inode *, struct dentry *);
+extern int rcfs_unlink_noent(struct inode *, struct dentry *);
+
static inline struct rcfs_inode_info *rcfs_get_inode_info(struct inode *inode)
{
return container_of(inode, struct rcfs_inode_info, vfs_inode);