Skip to contentSkip to conversation

sysfs permissions

PATCH Greg KH 1 participant 1 message Jun 1, 2005

lore
Share & tools
lore

Greg KH

author
#0 lore raw
Quoted 35 lines · Maneesh Soni

Hi

Following this post, are the three patches implementing setattr functionality for sysfs objects. This allows sysfs objects to get their default attributes like owner, group, permission modes modified. The changed attributes are saved in a struct iattr linked with struct sysfs_dirent for the corresponding object. This keeps the inode attributes saved even if inode/dentry is evacuated due to memory pressure or umount. The struct iattr is allocated only for those sysfs objects for which inode attributes are getting changed.

I did the following test for verifying the patchset

[root@llm01 ~]# ls -l /sys/class/net/dummy0/address
-r--r--r-- 1 root root 4096 May 31 10:32 /sys/class/net/dummy0/address [root@llm01 ~]# chmod +w /sys/class/net/dummy0/address [root@llm01 ~]# ls -l /sys/class/net/dummy0/address
-rw-r--r-- 1 root root 4096 May 31 10:32 /sys/class/net/dummy0/address [root@llm01 ~]#
[root@llm01 ~]# chown maneesh /sys/class/net/dummy0/address [root@llm01 ~]# ls -l /sys/class/net/dummy0/address
-rw-r--r-- 1 maneesh root 4096 May 31 10:32 /sys/class/net/dummy0/address [root@llm01 ~]#
[root@llm01 ~]# chgrp maneesh /sys/class/net/dummy0/address [root@llm01 ~]# ls -l /sys/class/net/dummy0/address
-rw-r--r-- 1 maneesh maneesh 4096 May 31 10:32 /sys/class/net/dummy0/address [root@llm01 ~]#
[root@llm01 ~]# umount /sys
[root@llm01 ~]# ls -l /sys/class/net/dummy0/address
ls: /sys/class/net/dummy0/address: No such file or directory [root@llm01 ~]#
[root@llm01 ~]# mount -t sysfs none /sys
[root@llm01 ~]# ls -l /sys/class/net/dummy0/address
-rw-r--r-- 1 maneesh maneesh 4096 May 31 10:32 /sys/class/net/dummy0/address

Quoted 1 line

Please review/test.

Nice, thanks a lot for doing this. I've added them to my tree and will test them out (should also show up in the next -mm release).

thanks again,

greg k-h

-------------------------------------------------------
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