From 471bd7b78bd56c580e91e00a0f656ca922ab3b3c Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Thu, 28 Nov 2013 14:54:22 -0500 Subject: 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 Signed-off-by: Greg Kroah-Hartman --- fs/sysfs/sysfs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/sysfs/sysfs.h') diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index c05e0ddd0268..d40e85e8c2ee 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h @@ -29,6 +29,7 @@ struct sysfs_elem_symlink { struct sysfs_elem_attr { const struct kernfs_ops *ops; struct sysfs_open_dirent *open; + loff_t size; }; struct sysfs_inode_attrs { -- cgit v1.2.3