diff options
author | Martin Brandenburg <martin@omnibond.com> | 2016-08-15 15:01:30 -0400 |
---|---|---|
committer | Martin Brandenburg <martin@omnibond.com> | 2016-08-15 15:01:30 -0400 |
commit | 4a3436647ac5161a8a8e797f89c2f8f52b947d59 (patch) | |
tree | 52ccfed90e7beac58110a71bacadd876787df311 | |
parent | 7b0cae60ffa216cff3ba6bd5ac2c7be0ca2c1467 (diff) |
orangefs: remove duplicated sysfs_ops structures
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
-rw-r--r-- | fs/orangefs/orangefs-sysfs.c | 73 |
1 files changed, 15 insertions, 58 deletions
diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c index 2642cb2f26b2..a772d26ad9d9 100644 --- a/fs/orangefs/orangefs-sysfs.c +++ b/fs/orangefs/orangefs-sysfs.c | |||
@@ -155,19 +155,11 @@ static ssize_t orangefs_attr_show(struct kobject *kobj, | |||
155 | char *buf) | 155 | char *buf) |
156 | { | 156 | { |
157 | struct orangefs_attribute *attribute; | 157 | struct orangefs_attribute *attribute; |
158 | int rc; | ||
159 | 158 | ||
160 | attribute = container_of(attr, struct orangefs_attribute, attr); | 159 | attribute = container_of(attr, struct orangefs_attribute, attr); |
161 | 160 | if (!attribute->show) | |
162 | if (!attribute->show) { | 161 | return -EIO; |
163 | rc = -EIO; | 162 | return attribute->show(kobj, attribute, buf); |
164 | goto out; | ||
165 | } | ||
166 | |||
167 | rc = attribute->show(kobj, attribute, buf); | ||
168 | |||
169 | out: | ||
170 | return rc; | ||
171 | } | 163 | } |
172 | 164 | ||
173 | static ssize_t orangefs_attr_store(struct kobject *kobj, | 165 | static ssize_t orangefs_attr_store(struct kobject *kobj, |
@@ -176,22 +168,15 @@ static ssize_t orangefs_attr_store(struct kobject *kobj, | |||
176 | size_t len) | 168 | size_t len) |
177 | { | 169 | { |
178 | struct orangefs_attribute *attribute; | 170 | struct orangefs_attribute *attribute; |
179 | int rc; | ||
180 | 171 | ||
181 | gossip_debug(GOSSIP_SYSFS_DEBUG, | 172 | if (!strcmp(kobj->name, PC_KOBJ_ID) || |
182 | "orangefs_attr_store: start\n"); | 173 | !strcmp(kobj->name, STATS_KOBJ_ID)) |
174 | return -EPERM; | ||
183 | 175 | ||
184 | attribute = container_of(attr, struct orangefs_attribute, attr); | 176 | attribute = container_of(attr, struct orangefs_attribute, attr); |
185 | 177 | if (!attribute->store) | |
186 | if (!attribute->store) { | 178 | return -EIO; |
187 | rc = -EIO; | 179 | return attribute->store(kobj, attribute, buf, len); |
188 | goto out; | ||
189 | } | ||
190 | |||
191 | rc = attribute->store(kobj, attribute, buf, len); | ||
192 | |||
193 | out: | ||
194 | return rc; | ||
195 | } | 180 | } |
196 | 181 | ||
197 | static const struct sysfs_ops orangefs_sysfs_ops = { | 182 | static const struct sysfs_ops orangefs_sysfs_ops = { |
@@ -199,34 +184,6 @@ static const struct sysfs_ops orangefs_sysfs_ops = { | |||
199 | .store = orangefs_attr_store, | 184 | .store = orangefs_attr_store, |
200 | }; | 185 | }; |
201 | 186 | ||
202 | static const struct sysfs_ops acache_orangefs_sysfs_ops = { | ||
203 | .show = orangefs_attr_show, | ||
204 | .store = orangefs_attr_store, | ||
205 | }; | ||
206 | |||
207 | static const struct sysfs_ops capcache_orangefs_sysfs_ops = { | ||
208 | .show = orangefs_attr_show, | ||
209 | .store = orangefs_attr_store, | ||
210 | }; | ||
211 | |||
212 | static const struct sysfs_ops ccache_orangefs_sysfs_ops = { | ||
213 | .show = orangefs_attr_show, | ||
214 | .store = orangefs_attr_store, | ||
215 | }; | ||
216 | |||
217 | static const struct sysfs_ops ncache_orangefs_sysfs_ops = { | ||
218 | .show = orangefs_attr_show, | ||
219 | .store = orangefs_attr_store, | ||
220 | }; | ||
221 | |||
222 | static const struct sysfs_ops pc_orangefs_sysfs_ops = { | ||
223 | .show = orangefs_attr_show, | ||
224 | }; | ||
225 | |||
226 | static const struct sysfs_ops stats_orangefs_sysfs_ops = { | ||
227 | .show = orangefs_attr_show, | ||
228 | }; | ||
229 | |||
230 | static ssize_t sysfs_int_show(struct kobject *kobj, | 187 | static ssize_t sysfs_int_show(struct kobject *kobj, |
231 | struct orangefs_attribute *attr, char *buf) | 188 | struct orangefs_attribute *attr, char *buf) |
232 | { | 189 | { |
@@ -909,7 +866,7 @@ static struct attribute *acache_orangefs_default_attrs[] = { | |||
909 | }; | 866 | }; |
910 | 867 | ||
911 | static struct kobj_type acache_orangefs_ktype = { | 868 | static struct kobj_type acache_orangefs_ktype = { |
912 | .sysfs_ops = &acache_orangefs_sysfs_ops, | 869 | .sysfs_ops = &orangefs_sysfs_ops, |
913 | .default_attrs = acache_orangefs_default_attrs, | 870 | .default_attrs = acache_orangefs_default_attrs, |
914 | }; | 871 | }; |
915 | 872 | ||
@@ -946,7 +903,7 @@ static struct attribute *capcache_orangefs_default_attrs[] = { | |||
946 | }; | 903 | }; |
947 | 904 | ||
948 | static struct kobj_type capcache_orangefs_ktype = { | 905 | static struct kobj_type capcache_orangefs_ktype = { |
949 | .sysfs_ops = &capcache_orangefs_sysfs_ops, | 906 | .sysfs_ops = &orangefs_sysfs_ops, |
950 | .default_attrs = capcache_orangefs_default_attrs, | 907 | .default_attrs = capcache_orangefs_default_attrs, |
951 | }; | 908 | }; |
952 | 909 | ||
@@ -983,7 +940,7 @@ static struct attribute *ccache_orangefs_default_attrs[] = { | |||
983 | }; | 940 | }; |
984 | 941 | ||
985 | static struct kobj_type ccache_orangefs_ktype = { | 942 | static struct kobj_type ccache_orangefs_ktype = { |
986 | .sysfs_ops = &ccache_orangefs_sysfs_ops, | 943 | .sysfs_ops = &orangefs_sysfs_ops, |
987 | .default_attrs = ccache_orangefs_default_attrs, | 944 | .default_attrs = ccache_orangefs_default_attrs, |
988 | }; | 945 | }; |
989 | 946 | ||
@@ -1020,7 +977,7 @@ static struct attribute *ncache_orangefs_default_attrs[] = { | |||
1020 | }; | 977 | }; |
1021 | 978 | ||
1022 | static struct kobj_type ncache_orangefs_ktype = { | 979 | static struct kobj_type ncache_orangefs_ktype = { |
1023 | .sysfs_ops = &ncache_orangefs_sysfs_ops, | 980 | .sysfs_ops = &orangefs_sysfs_ops, |
1024 | .default_attrs = ncache_orangefs_default_attrs, | 981 | .default_attrs = ncache_orangefs_default_attrs, |
1025 | }; | 982 | }; |
1026 | 983 | ||
@@ -1050,7 +1007,7 @@ static struct attribute *pc_orangefs_default_attrs[] = { | |||
1050 | }; | 1007 | }; |
1051 | 1008 | ||
1052 | static struct kobj_type pc_orangefs_ktype = { | 1009 | static struct kobj_type pc_orangefs_ktype = { |
1053 | .sysfs_ops = &pc_orangefs_sysfs_ops, | 1010 | .sysfs_ops = &orangefs_sysfs_ops, |
1054 | .default_attrs = pc_orangefs_default_attrs, | 1011 | .default_attrs = pc_orangefs_default_attrs, |
1055 | }; | 1012 | }; |
1056 | 1013 | ||
@@ -1073,7 +1030,7 @@ static struct attribute *stats_orangefs_default_attrs[] = { | |||
1073 | }; | 1030 | }; |
1074 | 1031 | ||
1075 | static struct kobj_type stats_orangefs_ktype = { | 1032 | static struct kobj_type stats_orangefs_ktype = { |
1076 | .sysfs_ops = &stats_orangefs_sysfs_ops, | 1033 | .sysfs_ops = &orangefs_sysfs_ops, |
1077 | .default_attrs = stats_orangefs_default_attrs, | 1034 | .default_attrs = stats_orangefs_default_attrs, |
1078 | }; | 1035 | }; |
1079 | 1036 | ||