sysfs, kernfs: add sysfs_dirent->s_attr.size
authorTejun Heo <tj@kernel.org>
Thu, 28 Nov 2013 19:54:22 +0000 (14:54 -0500)
committerPawel Osmialowski <p.osmialowsk@mcdsrvbld02.digital.local>
Fri, 27 Mar 2015 17:13:16 +0000 (18:13 +0100)
commit225228386ddd0c2151bcea5d92f16720c2442adb
tree3203ca830052d1d6786f780b8fa99a8fd00c61f6
parenta7e19b3130cc8547b8412c19dda7ef9cdf559830
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