aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sysfs/file.c')
-rw-r--r--fs/sysfs/file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index cbebc335af8c..0b0cec8e9d8f 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -923,6 +923,7 @@ int sysfs_add_file_mode_ns(struct sysfs_dirent *dir_sd,
923 const struct kernfs_ops *ops; 923 const struct kernfs_ops *ops;
924 struct sysfs_addrm_cxt acxt; 924 struct sysfs_addrm_cxt acxt;
925 struct sysfs_dirent *sd; 925 struct sysfs_dirent *sd;
926 loff_t size;
926 int rc; 927 int rc;
927 928
928 if (type == SYSFS_KOBJ_ATTR) { 929 if (type == SYSFS_KOBJ_ATTR) {
@@ -943,6 +944,8 @@ int sysfs_add_file_mode_ns(struct sysfs_dirent *dir_sd,
943 ops = &sysfs_file_kfops_wo; 944 ops = &sysfs_file_kfops_wo;
944 else 945 else
945 ops = &sysfs_file_kfops_empty; 946 ops = &sysfs_file_kfops_empty;
947
948 size = PAGE_SIZE;
946 } else { 949 } else {
947 struct bin_attribute *battr = (void *)attr; 950 struct bin_attribute *battr = (void *)attr;
948 951
@@ -954,6 +957,8 @@ int sysfs_add_file_mode_ns(struct sysfs_dirent *dir_sd,
954 ops = &sysfs_bin_kfops_wo; 957 ops = &sysfs_bin_kfops_wo;
955 else 958 else
956 ops = &sysfs_file_kfops_empty; 959 ops = &sysfs_file_kfops_empty;
960
961 size = battr->size;
957 } 962 }
958 963
959 sd = sysfs_new_dirent(attr->name, mode, type); 964 sd = sysfs_new_dirent(attr->name, mode, type);
@@ -961,6 +966,7 @@ int sysfs_add_file_mode_ns(struct sysfs_dirent *dir_sd,
961 return -ENOMEM; 966 return -ENOMEM;
962 967
963 sd->s_attr.ops = ops; 968 sd->s_attr.ops = ops;
969 sd->s_attr.size = size;
964 sd->s_ns = ns; 970 sd->s_ns = ns;
965 sd->priv = (void *)attr; 971 sd->priv = (void *)attr;
966 sysfs_dirent_init_lockdep(sd); 972 sysfs_dirent_init_lockdep(sd);