Skip to contentSkip to conversation

sysfs-iattr: add sysfs_setattr

PATCH New Maneesh Soni 1 participant 1 message May 31, 2005 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 sysfs-iattr: add sysfs_setattr

o This adds ->i_op->setattr VFS method for sysfs inodes. The changed attribues are saved in the persistent sysfs_dirent structure as a pointer to struct iattr. The struct iattr is allocated only for those sysfs_dirent's for which default attributes are getting changed. Thanks to Jon Smirl for this suggestion.

---

 linux-2.6.12-rc5-mm1-maneesh/fs/sysfs/dir.c        |    1 
 linux-2.6.12-rc5-mm1-maneesh/fs/sysfs/inode.c      |   65 +++++++++++++++++++++
 linux-2.6.12-rc5-mm1-maneesh/fs/sysfs/sysfs.h      |    2 
 linux-2.6.12-rc5-mm1-maneesh/include/linux/sysfs.h |    1 
 4 files changed, 69 insertions(+)
include/linux/sysfs.h renamed from include/linux/sysfs.h~sysfs-iattr-add-sysfs_setattr +1 -0
diff -puN include/linux/sysfs.h~sysfs-iattr-add-sysfs_setattr include/linux/sysfs.h
@@ -73,6 +73,7 @@ struct sysfs_dirent {
 	int			s_type;
 	umode_t			s_mode;
 	struct dentry		* s_dentry;
+	struct iattr		* s_iattr;
 };
 
 #define SYSFS_ROOT		0x0001
fs/sysfs/inode.c renamed from fs/sysfs/inode.c~sysfs-iattr-add-sysfs_setattr +65 -0

71 lines not on this page · raw message

fs/sysfs/dir.c renamed from fs/sysfs/dir.c~sysfs-iattr-add-sysfs_setattr +1 -0
diff -puN fs/sysfs/dir.c~sysfs-iattr-add-sysfs_setattr fs/sysfs/dir.c
@@ -234,6 +234,7 @@ static struct dentry * sysfs_lookup(stru
 
 struct inode_operations sysfs_dir_inode_operations = {
 	.lookup		= sysfs_lookup,
+	.setattr	= sysfs_setattr,
 };
 
 static void remove_dir(struct dentry * d)
fs/sysfs/sysfs.h renamed from fs/sysfs/sysfs.h~sysfs-iattr-add-sysfs_setattr +2 -0
diff -puN fs/sysfs/sysfs.h~sysfs-iattr-add-sysfs_setattr fs/sysfs/sysfs.h
@@ -16,6 +16,7 @@ extern void sysfs_remove_subdir(struct d
 
 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_setattr(struct dentry *dentry, struct iattr *iattr);
 
 extern struct rw_semaphore sysfs_rename_sem;
 extern struct super_block * sysfs_sb;
@@ -74,6 +75,7 @@ static inline void release_sysfs_dirent(
 		kobject_put(sl->target_kobj);
 		kfree(sl);
 	}
+	kfree(sd->s_iattr);
 	kmem_cache_free(sysfs_dir_cachep, sd);
 }
 

_

Signature · 17 lines
Maneesh Soni
Linux Technology Center, 
IBM India Software Labs,
Bangalore, India
email: [email protected]
Phone: 91-80-25044990


-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel