]> git.baikalelectronics.ru Git - kernel.git/commit
sysfs, kernfs: add sysfs_dirent->s_attr.size
authorTejun Heo <tj@kernel.org>
Thu, 28 Nov 2013 19:54:22 +0000 (14:54 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Nov 2013 01:35:05 +0000 (17:35 -0800)
commitc90df5a6f887d9e841bb5c8383e7324c38935269
tree20a7f9783fdd21f547fc75404b2cf702d8d4df27
parent159a32b540d676e7e97f23de2304d6e4e18b6aed
sysfs, kernfs: add sysfs_dirent->s_attr.size

sysfs sets the size of regular files unconditionally at PAGE_SIZE and
takes the size of bin files from bin_attribute.  The latter is a
pretty bad interface which forces bin_attribute users to create a
separate copy of bin_attribute for each instance of the file -
e.g. pci resource files.

Add sysfs_dirent->s_attr.size so that the size can be specified
separately.  This unifies inode init paths of ATTR and BIN_ATTR
identical and allows for generic size handling for kernfs.

Unfortunately, this grows the size of sysfs_dirent by sizeof(loff_t).

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/sysfs/file.c
fs/sysfs/inode.c
fs/sysfs/sysfs.h