small sysfs cleanups
PATCH 1/1 small sysfs cleanups
The patch below does the following cleanups for the sysfs code:
- remove the unused global function sysfs_mknod
- make some structs and functions static
Please check whether this patch is correct, or whether some of the things I made static should be used globally in the forseeable future.
diffstat output:
fs/sysfs/dir.c | 2 +- fs/sysfs/inode.c | 5 ----- fs/sysfs/mount.c | 2 +- fs/sysfs/symlink.c | 17 +++++++++-------- fs/sysfs/sysfs.h | 2 -- 5 files changed, 11 insertions(+), 17 deletions(-)
fs/sysfs/sysfs.h renamed from fs/sysfs/sysfs.h.old +0 -2
@@ -17,8 +17,6 @@extern const unsigned char *sysfs_get_name (struct sysfs_dirent *sd);extern void sysfs_drop_dentry (struct sysfs_dirent *sd,struct dentry *parent); -extern int sysfs_follow_link (struct dentry *,struct nameidata *); -extern void sysfs_put_link (struct dentry *,struct nameidata *);extern struct rw_semaphore sysfs_rename_sem;extern struct super_block * sysfs_sb;extern struct file_operations sysfs_dir_operations;
fs/sysfs/dir.c renamed from fs/sysfs/dir.c.old +1 -1
@@ -201,7 +201,7 @@return err; } -struct dentry *sysfs_lookup (struct inode *dir,struct dentry *dentry, +static struct dentry *sysfs_lookup (struct inode *dir,struct dentry *dentry,struct nameidata *nd) {struct sysfs_dirent * parent_sd = dentry->d_parent->d_fsdata;
fs/sysfs/inode.c renamed from fs/sysfs/inode.c.old +0 -5
@@ -76,11 +76,6 @@return error; } -int sysfs_mknod (struct inode *dir,struct dentry *dentry,int mode,dev_t dev) -{ -return sysfs_create (dentry, mode,NULL ); -} -struct dentry *sysfs_get_dentry (struct dentry * parent,const char * name) {struct qstr qstr;
fs/sysfs/mount.c renamed from fs/sysfs/mount.c.old +1 -1
@@ -22,7 +22,7 @@ .drop_inode = generic_delete_inode, }; -struct sysfs_dirent sysfs_root = { +static struct sysfs_dirent sysfs_root = { .s_sibling =LIST_HEAD_INIT (sysfs_root.s_sibling), .s_children =LIST_HEAD_INIT (sysfs_root.s_children), .s_element =NULL ,
fs/sysfs/symlink.c renamed from fs/sysfs/symlink.c.old +9 -8
@@ -9,12 +9,6 @@#include "sysfs.h" -struct inode_operations sysfs_symlink_inode_operations = { - .readlink = generic_readlink, - .follow_link = sysfs_follow_link, - .put_link = sysfs_put_link, -}; -static int object_depth (struct kobject * kobj) {struct kobject * p = kobj;
@@ -157,7 +151,7 @@ } -int sysfs_follow_link (struct dentry *dentry,struct nameidata *nd) +static int sysfs_follow_link (struct dentry *dentry,struct nameidata *nd) {int error = -ENOMEM ;unsigned long page =get_zeroed_page (GFP_KERNEL );
@@ -167,13 +161,20 @@return 0 ; } -void sysfs_put_link (struct dentry *dentry,struct nameidata *nd) +static void sysfs_put_link (struct dentry *dentry,struct nameidata *nd) {char *page =nd_get_link (nd);if (!IS_ERR (page))free_page ((unsigned long )page); } +struct inode_operations sysfs_symlink_inode_operations = { + .readlink = generic_readlink, + .follow_link = sysfs_follow_link, + .put_link = sysfs_put_link, +}; + +EXPORT_SYMBOL_GPL (sysfs_create_link);EXPORT_SYMBOL_GPL (sysfs_remove_link);
Quoted 2 lines · Adrian Bunk
The patch below does the following cleanups for the sysfs code:
- remove the unused global functionsysfs_mknod
It is not used as of now, but I am not sure if there are potential users been thought earlier.
Quoted 1 line
- make some structs and functions static
Looks good to me.
Thanks
Maneesh
Quoted 117 lines
Please check whether this patch is correct, or whether some of the things I made static should be used globally in the forseeable future.
diffstat output:
fs/sysfs/dir.c | 2 +- fs/sysfs/inode.c | 5 ----- fs/sysfs/mount.c | 2 +- fs/sysfs/symlink.c | 17 +++++++++-------- fs/sysfs/sysfs.h | 2 -- 5 files changed, 11 insertions(+), 17 deletions(-)Signed-off-by Adrian Bunk <[email protected]>fs/sysfs/sysfs.h renamed from fs/sysfs/sysfs.h.old +0
-2@@ -17,8 +17,6 @@extern const unsigned char *sysfs_get_name (struct sysfs_dirent *sd);extern void sysfs_drop_dentry (struct sysfs_dirent *sd,struct dentry *parent); -extern int sysfs_follow_link (struct dentry *,struct nameidata *); -extern void sysfs_put_link (struct dentry *,struct nameidata *);extern struct rw_semaphore sysfs_rename_sem;extern struct super_block * sysfs_sb;extern struct file_operations sysfs_dir_operations;fs/sysfs/dir.c renamed from fs/sysfs/dir.c.old +1
-1@@ -201,7 +201,7 @@return err; } -struct dentry *sysfs_lookup (struct inode *dir,struct dentry *dentry, +static struct dentry *sysfs_lookup (struct inode *dir,struct dentry *dentry,struct nameidata *nd) {struct sysfs_dirent * parent_sd = dentry->d_parent->d_fsdata;fs/sysfs/inode.c renamed from fs/sysfs/inode.c.old +0
-5@@ -76,11 +76,6 @@return error; } -int sysfs_mknod (struct inode *dir,struct dentry *dentry,int mode,dev_t dev) -{ -return sysfs_create (dentry, mode,NULL ); -} -struct dentry *sysfs_get_dentry (struct dentry * parent,const char * name) {struct qstr qstr;fs/sysfs/mount.c renamed from fs/sysfs/mount.c.old +1
-1@@ -22,7 +22,7 @@ .drop_inode = generic_delete_inode, }; -struct sysfs_dirent sysfs_root = { +static struct sysfs_dirent sysfs_root = { .s_sibling =LIST_HEAD_INIT (sysfs_root.s_sibling), .s_children =LIST_HEAD_INIT (sysfs_root.s_children), .s_element =NULL ,fs/sysfs/symlink.c renamed from fs/sysfs/symlink.c.old +9
-9@@ -9,12 +9,6 @@#include "sysfs.h" -struct inode_operations sysfs_symlink_inode_operations = { - .readlink = generic_readlink, - .follow_link = sysfs_follow_link, - .put_link = sysfs_put_link, -}; -static int object_depth (struct kobject * kobj) {struct kobject * p = kobj;@@ -157,7 +151,7 @@ } -int sysfs_follow_link (struct dentry *dentry,struct nameidata *nd) +static int sysfs_follow_link (struct dentry *dentry,struct nameidata *nd) {int error = -ENOMEM ;unsigned long page =get_zeroed_page (GFP_KERNEL );@@ -167,13 +161,20 @@return 0 ; } -void sysfs_put_link (struct dentry *dentry,struct nameidata *nd) +static void sysfs_put_link (struct dentry *dentry,struct nameidata *nd) {char *page =nd_get_link (nd);if (!IS_ERR (page))free_page ((unsigned long )page); } +struct inode_operations sysfs_symlink_inode_operations = { + .readlink = generic_readlink, + .follow_link = sysfs_follow_link, + .put_link = sysfs_put_link, +}; + +EXPORT_SYMBOL_GPL (sysfs_create_link);EXPORT_SYMBOL_GPL (sysfs_remove_link); -To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 6 lines
Maneesh Soni Linux Technology Center, IBM Austin email: [email protected] Phone: 1-512-838-1896 Fax: T/L : 6781896
Greg KH
AppliedQuoted 10 lines · Maneesh Soni
Quoted 2 lines · Adrian Bunk
The patch below does the following cleanups for the sysfs code:
- remove the unused global functionsysfs_mknodIt is not used as of now, but I am not sure if there are potential users been thought earlier.
Quoted 1 line
- make some structs and functions static
Looks good to me.
Applied, thanks.
greg k-h