diff options
Diffstat (limited to 'drivers/target/target_core_stat.c')
-rw-r--r-- | drivers/target/target_core_stat.c | 918 |
1 files changed, 362 insertions, 556 deletions
diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c index 20ed5d2e151a..273c72b2b83d 100644 --- a/drivers/target/target_core_stat.c +++ b/drivers/target/target_core_stat.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <target/target_core_base.h> | 37 | #include <target/target_core_base.h> |
38 | #include <target/target_core_backend.h> | 38 | #include <target/target_core_backend.h> |
39 | #include <target/target_core_fabric.h> | 39 | #include <target/target_core_fabric.h> |
40 | #include <target/configfs_macros.h> | ||
41 | 40 | ||
42 | #include "target_core_internal.h" | 41 | #include "target_core_internal.h" |
43 | 42 | ||
@@ -55,75 +54,49 @@ | |||
55 | * SCSI Device Table | 54 | * SCSI Device Table |
56 | */ | 55 | */ |
57 | 56 | ||
58 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_dev, se_dev_stat_grps); | 57 | static struct se_device *to_stat_dev(struct config_item *item) |
59 | #define DEV_STAT_SCSI_DEV_ATTR(_name, _mode) \ | 58 | { |
60 | static struct target_stat_scsi_dev_attribute \ | 59 | struct se_dev_stat_grps *sgrps = container_of(to_config_group(item), |
61 | target_stat_scsi_dev_##_name = \ | 60 | struct se_dev_stat_grps, scsi_dev_group); |
62 | __CONFIGFS_EATTR(_name, _mode, \ | 61 | return container_of(sgrps, struct se_device, dev_stat_grps); |
63 | target_stat_scsi_dev_show_attr_##_name, \ | 62 | } |
64 | target_stat_scsi_dev_store_attr_##_name); | ||
65 | |||
66 | #define DEV_STAT_SCSI_DEV_ATTR_RO(_name) \ | ||
67 | static struct target_stat_scsi_dev_attribute \ | ||
68 | target_stat_scsi_dev_##_name = \ | ||
69 | __CONFIGFS_EATTR_RO(_name, \ | ||
70 | target_stat_scsi_dev_show_attr_##_name); | ||
71 | 63 | ||
72 | static ssize_t target_stat_scsi_dev_show_attr_inst( | 64 | static ssize_t target_stat_inst_show(struct config_item *item, char *page) |
73 | struct se_dev_stat_grps *sgrps, char *page) | ||
74 | { | 65 | { |
75 | struct se_device *dev = | 66 | struct se_hba *hba = to_stat_dev(item)->se_hba; |
76 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
77 | struct se_hba *hba = dev->se_hba; | ||
78 | 67 | ||
79 | return snprintf(page, PAGE_SIZE, "%u\n", hba->hba_index); | 68 | return snprintf(page, PAGE_SIZE, "%u\n", hba->hba_index); |
80 | } | 69 | } |
81 | DEV_STAT_SCSI_DEV_ATTR_RO(inst); | ||
82 | 70 | ||
83 | static ssize_t target_stat_scsi_dev_show_attr_indx( | 71 | static ssize_t target_stat_indx_show(struct config_item *item, char *page) |
84 | struct se_dev_stat_grps *sgrps, char *page) | ||
85 | { | 72 | { |
86 | struct se_device *dev = | 73 | return snprintf(page, PAGE_SIZE, "%u\n", to_stat_dev(item)->dev_index); |
87 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
88 | |||
89 | return snprintf(page, PAGE_SIZE, "%u\n", dev->dev_index); | ||
90 | } | 74 | } |
91 | DEV_STAT_SCSI_DEV_ATTR_RO(indx); | ||
92 | 75 | ||
93 | static ssize_t target_stat_scsi_dev_show_attr_role( | 76 | static ssize_t target_stat_role_show(struct config_item *item, char *page) |
94 | struct se_dev_stat_grps *sgrps, char *page) | ||
95 | { | 77 | { |
96 | return snprintf(page, PAGE_SIZE, "Target\n"); | 78 | return snprintf(page, PAGE_SIZE, "Target\n"); |
97 | } | 79 | } |
98 | DEV_STAT_SCSI_DEV_ATTR_RO(role); | ||
99 | 80 | ||
100 | static ssize_t target_stat_scsi_dev_show_attr_ports( | 81 | static ssize_t target_stat_ports_show(struct config_item *item, char *page) |
101 | struct se_dev_stat_grps *sgrps, char *page) | ||
102 | { | 82 | { |
103 | struct se_device *dev = | 83 | return snprintf(page, PAGE_SIZE, "%u\n", to_stat_dev(item)->export_count); |
104 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
105 | |||
106 | return snprintf(page, PAGE_SIZE, "%u\n", dev->export_count); | ||
107 | } | 84 | } |
108 | DEV_STAT_SCSI_DEV_ATTR_RO(ports); | ||
109 | 85 | ||
110 | CONFIGFS_EATTR_OPS(target_stat_scsi_dev, se_dev_stat_grps, scsi_dev_group); | 86 | CONFIGFS_ATTR_RO(target_stat_, inst); |
87 | CONFIGFS_ATTR_RO(target_stat_, indx); | ||
88 | CONFIGFS_ATTR_RO(target_stat_, role); | ||
89 | CONFIGFS_ATTR_RO(target_stat_, ports); | ||
111 | 90 | ||
112 | static struct configfs_attribute *target_stat_scsi_dev_attrs[] = { | 91 | static struct configfs_attribute *target_stat_scsi_dev_attrs[] = { |
113 | &target_stat_scsi_dev_inst.attr, | 92 | &target_stat_attr_inst, |
114 | &target_stat_scsi_dev_indx.attr, | 93 | &target_stat_attr_indx, |
115 | &target_stat_scsi_dev_role.attr, | 94 | &target_stat_attr_role, |
116 | &target_stat_scsi_dev_ports.attr, | 95 | &target_stat_attr_ports, |
117 | NULL, | 96 | NULL, |
118 | }; | 97 | }; |
119 | 98 | ||
120 | static struct configfs_item_operations target_stat_scsi_dev_attrib_ops = { | ||
121 | .show_attribute = target_stat_scsi_dev_attr_show, | ||
122 | .store_attribute = target_stat_scsi_dev_attr_store, | ||
123 | }; | ||
124 | |||
125 | static struct config_item_type target_stat_scsi_dev_cit = { | 99 | static struct config_item_type target_stat_scsi_dev_cit = { |
126 | .ct_item_ops = &target_stat_scsi_dev_attrib_ops, | ||
127 | .ct_attrs = target_stat_scsi_dev_attrs, | 100 | .ct_attrs = target_stat_scsi_dev_attrs, |
128 | .ct_owner = THIS_MODULE, | 101 | .ct_owner = THIS_MODULE, |
129 | }; | 102 | }; |
@@ -131,109 +104,78 @@ static struct config_item_type target_stat_scsi_dev_cit = { | |||
131 | /* | 104 | /* |
132 | * SCSI Target Device Table | 105 | * SCSI Target Device Table |
133 | */ | 106 | */ |
107 | static struct se_device *to_stat_tgt_dev(struct config_item *item) | ||
108 | { | ||
109 | struct se_dev_stat_grps *sgrps = container_of(to_config_group(item), | ||
110 | struct se_dev_stat_grps, scsi_tgt_dev_group); | ||
111 | return container_of(sgrps, struct se_device, dev_stat_grps); | ||
112 | } | ||
134 | 113 | ||
135 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_tgt_dev, se_dev_stat_grps); | 114 | static ssize_t target_stat_tgt_inst_show(struct config_item *item, char *page) |
136 | #define DEV_STAT_SCSI_TGT_DEV_ATTR(_name, _mode) \ | ||
137 | static struct target_stat_scsi_tgt_dev_attribute \ | ||
138 | target_stat_scsi_tgt_dev_##_name = \ | ||
139 | __CONFIGFS_EATTR(_name, _mode, \ | ||
140 | target_stat_scsi_tgt_dev_show_attr_##_name, \ | ||
141 | target_stat_scsi_tgt_dev_store_attr_##_name); | ||
142 | |||
143 | #define DEV_STAT_SCSI_TGT_DEV_ATTR_RO(_name) \ | ||
144 | static struct target_stat_scsi_tgt_dev_attribute \ | ||
145 | target_stat_scsi_tgt_dev_##_name = \ | ||
146 | __CONFIGFS_EATTR_RO(_name, \ | ||
147 | target_stat_scsi_tgt_dev_show_attr_##_name); | ||
148 | |||
149 | static ssize_t target_stat_scsi_tgt_dev_show_attr_inst( | ||
150 | struct se_dev_stat_grps *sgrps, char *page) | ||
151 | { | 115 | { |
152 | struct se_device *dev = | 116 | struct se_hba *hba = to_stat_tgt_dev(item)->se_hba; |
153 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
154 | struct se_hba *hba = dev->se_hba; | ||
155 | 117 | ||
156 | return snprintf(page, PAGE_SIZE, "%u\n", hba->hba_index); | 118 | return snprintf(page, PAGE_SIZE, "%u\n", hba->hba_index); |
157 | } | 119 | } |
158 | DEV_STAT_SCSI_TGT_DEV_ATTR_RO(inst); | ||
159 | 120 | ||
160 | static ssize_t target_stat_scsi_tgt_dev_show_attr_indx( | 121 | static ssize_t target_stat_tgt_indx_show(struct config_item *item, char *page) |
161 | struct se_dev_stat_grps *sgrps, char *page) | ||
162 | { | 122 | { |
163 | struct se_device *dev = | 123 | return snprintf(page, PAGE_SIZE, "%u\n", to_stat_tgt_dev(item)->dev_index); |
164 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
165 | |||
166 | return snprintf(page, PAGE_SIZE, "%u\n", dev->dev_index); | ||
167 | } | 124 | } |
168 | DEV_STAT_SCSI_TGT_DEV_ATTR_RO(indx); | ||
169 | 125 | ||
170 | static ssize_t target_stat_scsi_tgt_dev_show_attr_num_lus( | 126 | static ssize_t target_stat_tgt_num_lus_show(struct config_item *item, |
171 | struct se_dev_stat_grps *sgrps, char *page) | 127 | char *page) |
172 | { | 128 | { |
173 | return snprintf(page, PAGE_SIZE, "%u\n", LU_COUNT); | 129 | return snprintf(page, PAGE_SIZE, "%u\n", LU_COUNT); |
174 | } | 130 | } |
175 | DEV_STAT_SCSI_TGT_DEV_ATTR_RO(num_lus); | ||
176 | 131 | ||
177 | static ssize_t target_stat_scsi_tgt_dev_show_attr_status( | 132 | static ssize_t target_stat_tgt_status_show(struct config_item *item, |
178 | struct se_dev_stat_grps *sgrps, char *page) | 133 | char *page) |
179 | { | 134 | { |
180 | struct se_device *dev = | 135 | if (to_stat_tgt_dev(item)->export_count) |
181 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
182 | |||
183 | if (dev->export_count) | ||
184 | return snprintf(page, PAGE_SIZE, "activated"); | 136 | return snprintf(page, PAGE_SIZE, "activated"); |
185 | else | 137 | else |
186 | return snprintf(page, PAGE_SIZE, "deactivated"); | 138 | return snprintf(page, PAGE_SIZE, "deactivated"); |
187 | } | 139 | } |
188 | DEV_STAT_SCSI_TGT_DEV_ATTR_RO(status); | ||
189 | 140 | ||
190 | static ssize_t target_stat_scsi_tgt_dev_show_attr_non_access_lus( | 141 | static ssize_t target_stat_tgt_non_access_lus_show(struct config_item *item, |
191 | struct se_dev_stat_grps *sgrps, char *page) | 142 | char *page) |
192 | { | 143 | { |
193 | struct se_device *dev = | ||
194 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
195 | int non_accessible_lus; | 144 | int non_accessible_lus; |
196 | 145 | ||
197 | if (dev->export_count) | 146 | if (to_stat_tgt_dev(item)->export_count) |
198 | non_accessible_lus = 0; | 147 | non_accessible_lus = 0; |
199 | else | 148 | else |
200 | non_accessible_lus = 1; | 149 | non_accessible_lus = 1; |
201 | 150 | ||
202 | return snprintf(page, PAGE_SIZE, "%u\n", non_accessible_lus); | 151 | return snprintf(page, PAGE_SIZE, "%u\n", non_accessible_lus); |
203 | } | 152 | } |
204 | DEV_STAT_SCSI_TGT_DEV_ATTR_RO(non_access_lus); | ||
205 | 153 | ||
206 | static ssize_t target_stat_scsi_tgt_dev_show_attr_resets( | 154 | static ssize_t target_stat_tgt_resets_show(struct config_item *item, |
207 | struct se_dev_stat_grps *sgrps, char *page) | 155 | char *page) |
208 | { | 156 | { |
209 | struct se_device *dev = | ||
210 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
211 | |||
212 | return snprintf(page, PAGE_SIZE, "%lu\n", | 157 | return snprintf(page, PAGE_SIZE, "%lu\n", |
213 | atomic_long_read(&dev->num_resets)); | 158 | atomic_long_read(&to_stat_tgt_dev(item)->num_resets)); |
214 | } | 159 | } |
215 | DEV_STAT_SCSI_TGT_DEV_ATTR_RO(resets); | ||
216 | 160 | ||
217 | 161 | CONFIGFS_ATTR_RO(target_stat_tgt_, inst); | |
218 | CONFIGFS_EATTR_OPS(target_stat_scsi_tgt_dev, se_dev_stat_grps, scsi_tgt_dev_group); | 162 | CONFIGFS_ATTR_RO(target_stat_tgt_, indx); |
163 | CONFIGFS_ATTR_RO(target_stat_tgt_, num_lus); | ||
164 | CONFIGFS_ATTR_RO(target_stat_tgt_, status); | ||
165 | CONFIGFS_ATTR_RO(target_stat_tgt_, non_access_lus); | ||
166 | CONFIGFS_ATTR_RO(target_stat_tgt_, resets); | ||
219 | 167 | ||
220 | static struct configfs_attribute *target_stat_scsi_tgt_dev_attrs[] = { | 168 | static struct configfs_attribute *target_stat_scsi_tgt_dev_attrs[] = { |
221 | &target_stat_scsi_tgt_dev_inst.attr, | 169 | &target_stat_tgt_attr_inst, |
222 | &target_stat_scsi_tgt_dev_indx.attr, | 170 | &target_stat_tgt_attr_indx, |
223 | &target_stat_scsi_tgt_dev_num_lus.attr, | 171 | &target_stat_tgt_attr_num_lus, |
224 | &target_stat_scsi_tgt_dev_status.attr, | 172 | &target_stat_tgt_attr_status, |
225 | &target_stat_scsi_tgt_dev_non_access_lus.attr, | 173 | &target_stat_tgt_attr_non_access_lus, |
226 | &target_stat_scsi_tgt_dev_resets.attr, | 174 | &target_stat_tgt_attr_resets, |
227 | NULL, | 175 | NULL, |
228 | }; | 176 | }; |
229 | 177 | ||
230 | static struct configfs_item_operations target_stat_scsi_tgt_dev_attrib_ops = { | ||
231 | .show_attribute = target_stat_scsi_tgt_dev_attr_show, | ||
232 | .store_attribute = target_stat_scsi_tgt_dev_attr_store, | ||
233 | }; | ||
234 | |||
235 | static struct config_item_type target_stat_scsi_tgt_dev_cit = { | 178 | static struct config_item_type target_stat_scsi_tgt_dev_cit = { |
236 | .ct_item_ops = &target_stat_scsi_tgt_dev_attrib_ops, | ||
237 | .ct_attrs = target_stat_scsi_tgt_dev_attrs, | 179 | .ct_attrs = target_stat_scsi_tgt_dev_attrs, |
238 | .ct_owner = THIS_MODULE, | 180 | .ct_owner = THIS_MODULE, |
239 | }; | 181 | }; |
@@ -242,72 +184,50 @@ static struct config_item_type target_stat_scsi_tgt_dev_cit = { | |||
242 | * SCSI Logical Unit Table | 184 | * SCSI Logical Unit Table |
243 | */ | 185 | */ |
244 | 186 | ||
245 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_lu, se_dev_stat_grps); | 187 | static struct se_device *to_stat_lu_dev(struct config_item *item) |
246 | #define DEV_STAT_SCSI_LU_ATTR(_name, _mode) \ | 188 | { |
247 | static struct target_stat_scsi_lu_attribute target_stat_scsi_lu_##_name = \ | 189 | struct se_dev_stat_grps *sgrps = container_of(to_config_group(item), |
248 | __CONFIGFS_EATTR(_name, _mode, \ | 190 | struct se_dev_stat_grps, scsi_lu_group); |
249 | target_stat_scsi_lu_show_attr_##_name, \ | 191 | return container_of(sgrps, struct se_device, dev_stat_grps); |
250 | target_stat_scsi_lu_store_attr_##_name); | 192 | } |
251 | |||
252 | #define DEV_STAT_SCSI_LU_ATTR_RO(_name) \ | ||
253 | static struct target_stat_scsi_lu_attribute target_stat_scsi_lu_##_name = \ | ||
254 | __CONFIGFS_EATTR_RO(_name, \ | ||
255 | target_stat_scsi_lu_show_attr_##_name); | ||
256 | 193 | ||
257 | static ssize_t target_stat_scsi_lu_show_attr_inst( | 194 | static ssize_t target_stat_lu_inst_show(struct config_item *item, char *page) |
258 | struct se_dev_stat_grps *sgrps, char *page) | ||
259 | { | 195 | { |
260 | struct se_device *dev = | 196 | struct se_hba *hba = to_stat_lu_dev(item)->se_hba; |
261 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
262 | struct se_hba *hba = dev->se_hba; | ||
263 | 197 | ||
264 | return snprintf(page, PAGE_SIZE, "%u\n", hba->hba_index); | 198 | return snprintf(page, PAGE_SIZE, "%u\n", hba->hba_index); |
265 | } | 199 | } |
266 | DEV_STAT_SCSI_LU_ATTR_RO(inst); | ||
267 | 200 | ||
268 | static ssize_t target_stat_scsi_lu_show_attr_dev( | 201 | static ssize_t target_stat_lu_dev_show(struct config_item *item, char *page) |
269 | struct se_dev_stat_grps *sgrps, char *page) | ||
270 | { | 202 | { |
271 | struct se_device *dev = | 203 | return snprintf(page, PAGE_SIZE, "%u\n", |
272 | container_of(sgrps, struct se_device, dev_stat_grps); | 204 | to_stat_lu_dev(item)->dev_index); |
273 | |||
274 | return snprintf(page, PAGE_SIZE, "%u\n", dev->dev_index); | ||
275 | } | 205 | } |
276 | DEV_STAT_SCSI_LU_ATTR_RO(dev); | ||
277 | 206 | ||
278 | static ssize_t target_stat_scsi_lu_show_attr_indx( | 207 | static ssize_t target_stat_lu_indx_show(struct config_item *item, char *page) |
279 | struct se_dev_stat_grps *sgrps, char *page) | ||
280 | { | 208 | { |
281 | return snprintf(page, PAGE_SIZE, "%u\n", SCSI_LU_INDEX); | 209 | return snprintf(page, PAGE_SIZE, "%u\n", SCSI_LU_INDEX); |
282 | } | 210 | } |
283 | DEV_STAT_SCSI_LU_ATTR_RO(indx); | ||
284 | 211 | ||
285 | static ssize_t target_stat_scsi_lu_show_attr_lun( | 212 | static ssize_t target_stat_lu_lun_show(struct config_item *item, char *page) |
286 | struct se_dev_stat_grps *sgrps, char *page) | ||
287 | { | 213 | { |
288 | /* FIXME: scsiLuDefaultLun */ | 214 | /* FIXME: scsiLuDefaultLun */ |
289 | return snprintf(page, PAGE_SIZE, "%llu\n", (unsigned long long)0); | 215 | return snprintf(page, PAGE_SIZE, "%llu\n", (unsigned long long)0); |
290 | } | 216 | } |
291 | DEV_STAT_SCSI_LU_ATTR_RO(lun); | ||
292 | 217 | ||
293 | static ssize_t target_stat_scsi_lu_show_attr_lu_name( | 218 | static ssize_t target_stat_lu_lu_name_show(struct config_item *item, char *page) |
294 | struct se_dev_stat_grps *sgrps, char *page) | ||
295 | { | 219 | { |
296 | struct se_device *dev = | 220 | struct se_device *dev = to_stat_lu_dev(item); |
297 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
298 | 221 | ||
299 | /* scsiLuWwnName */ | 222 | /* scsiLuWwnName */ |
300 | return snprintf(page, PAGE_SIZE, "%s\n", | 223 | return snprintf(page, PAGE_SIZE, "%s\n", |
301 | (strlen(dev->t10_wwn.unit_serial)) ? | 224 | (strlen(dev->t10_wwn.unit_serial)) ? |
302 | dev->t10_wwn.unit_serial : "None"); | 225 | dev->t10_wwn.unit_serial : "None"); |
303 | } | 226 | } |
304 | DEV_STAT_SCSI_LU_ATTR_RO(lu_name); | ||
305 | 227 | ||
306 | static ssize_t target_stat_scsi_lu_show_attr_vend( | 228 | static ssize_t target_stat_lu_vend_show(struct config_item *item, char *page) |
307 | struct se_dev_stat_grps *sgrps, char *page) | ||
308 | { | 229 | { |
309 | struct se_device *dev = | 230 | struct se_device *dev = to_stat_lu_dev(item); |
310 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
311 | int i; | 231 | int i; |
312 | char str[sizeof(dev->t10_wwn.vendor)+1]; | 232 | char str[sizeof(dev->t10_wwn.vendor)+1]; |
313 | 233 | ||
@@ -318,13 +238,10 @@ static ssize_t target_stat_scsi_lu_show_attr_vend( | |||
318 | str[i] = '\0'; | 238 | str[i] = '\0'; |
319 | return snprintf(page, PAGE_SIZE, "%s\n", str); | 239 | return snprintf(page, PAGE_SIZE, "%s\n", str); |
320 | } | 240 | } |
321 | DEV_STAT_SCSI_LU_ATTR_RO(vend); | ||
322 | 241 | ||
323 | static ssize_t target_stat_scsi_lu_show_attr_prod( | 242 | static ssize_t target_stat_lu_prod_show(struct config_item *item, char *page) |
324 | struct se_dev_stat_grps *sgrps, char *page) | ||
325 | { | 243 | { |
326 | struct se_device *dev = | 244 | struct se_device *dev = to_stat_lu_dev(item); |
327 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
328 | int i; | 245 | int i; |
329 | char str[sizeof(dev->t10_wwn.model)+1]; | 246 | char str[sizeof(dev->t10_wwn.model)+1]; |
330 | 247 | ||
@@ -335,13 +252,10 @@ static ssize_t target_stat_scsi_lu_show_attr_prod( | |||
335 | str[i] = '\0'; | 252 | str[i] = '\0'; |
336 | return snprintf(page, PAGE_SIZE, "%s\n", str); | 253 | return snprintf(page, PAGE_SIZE, "%s\n", str); |
337 | } | 254 | } |
338 | DEV_STAT_SCSI_LU_ATTR_RO(prod); | ||
339 | 255 | ||
340 | static ssize_t target_stat_scsi_lu_show_attr_rev( | 256 | static ssize_t target_stat_lu_rev_show(struct config_item *item, char *page) |
341 | struct se_dev_stat_grps *sgrps, char *page) | ||
342 | { | 257 | { |
343 | struct se_device *dev = | 258 | struct se_device *dev = to_stat_lu_dev(item); |
344 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
345 | int i; | 259 | int i; |
346 | char str[sizeof(dev->t10_wwn.revision)+1]; | 260 | char str[sizeof(dev->t10_wwn.revision)+1]; |
347 | 261 | ||
@@ -352,146 +266,137 @@ static ssize_t target_stat_scsi_lu_show_attr_rev( | |||
352 | str[i] = '\0'; | 266 | str[i] = '\0'; |
353 | return snprintf(page, PAGE_SIZE, "%s\n", str); | 267 | return snprintf(page, PAGE_SIZE, "%s\n", str); |
354 | } | 268 | } |
355 | DEV_STAT_SCSI_LU_ATTR_RO(rev); | ||
356 | 269 | ||
357 | static ssize_t target_stat_scsi_lu_show_attr_dev_type( | 270 | static ssize_t target_stat_lu_dev_type_show(struct config_item *item, char *page) |
358 | struct se_dev_stat_grps *sgrps, char *page) | ||
359 | { | 271 | { |
360 | struct se_device *dev = | 272 | struct se_device *dev = to_stat_lu_dev(item); |
361 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
362 | 273 | ||
363 | /* scsiLuPeripheralType */ | 274 | /* scsiLuPeripheralType */ |
364 | return snprintf(page, PAGE_SIZE, "%u\n", | 275 | return snprintf(page, PAGE_SIZE, "%u\n", |
365 | dev->transport->get_device_type(dev)); | 276 | dev->transport->get_device_type(dev)); |
366 | } | 277 | } |
367 | DEV_STAT_SCSI_LU_ATTR_RO(dev_type); | ||
368 | 278 | ||
369 | static ssize_t target_stat_scsi_lu_show_attr_status( | 279 | static ssize_t target_stat_lu_status_show(struct config_item *item, char *page) |
370 | struct se_dev_stat_grps *sgrps, char *page) | ||
371 | { | 280 | { |
372 | struct se_device *dev = | 281 | struct se_device *dev = to_stat_lu_dev(item); |
373 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
374 | 282 | ||
375 | /* scsiLuStatus */ | 283 | /* scsiLuStatus */ |
376 | return snprintf(page, PAGE_SIZE, "%s\n", | 284 | return snprintf(page, PAGE_SIZE, "%s\n", |
377 | (dev->export_count) ? "available" : "notavailable"); | 285 | (dev->export_count) ? "available" : "notavailable"); |
378 | } | 286 | } |
379 | DEV_STAT_SCSI_LU_ATTR_RO(status); | ||
380 | 287 | ||
381 | static ssize_t target_stat_scsi_lu_show_attr_state_bit( | 288 | static ssize_t target_stat_lu_state_bit_show(struct config_item *item, |
382 | struct se_dev_stat_grps *sgrps, char *page) | 289 | char *page) |
383 | { | 290 | { |
384 | /* scsiLuState */ | 291 | /* scsiLuState */ |
385 | return snprintf(page, PAGE_SIZE, "exposed\n"); | 292 | return snprintf(page, PAGE_SIZE, "exposed\n"); |
386 | } | 293 | } |
387 | DEV_STAT_SCSI_LU_ATTR_RO(state_bit); | ||
388 | 294 | ||
389 | static ssize_t target_stat_scsi_lu_show_attr_num_cmds( | 295 | static ssize_t target_stat_lu_num_cmds_show(struct config_item *item, |
390 | struct se_dev_stat_grps *sgrps, char *page) | 296 | char *page) |
391 | { | 297 | { |
392 | struct se_device *dev = | 298 | struct se_device *dev = to_stat_lu_dev(item); |
393 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
394 | 299 | ||
395 | /* scsiLuNumCommands */ | 300 | /* scsiLuNumCommands */ |
396 | return snprintf(page, PAGE_SIZE, "%lu\n", | 301 | return snprintf(page, PAGE_SIZE, "%lu\n", |
397 | atomic_long_read(&dev->num_cmds)); | 302 | atomic_long_read(&dev->num_cmds)); |
398 | } | 303 | } |
399 | DEV_STAT_SCSI_LU_ATTR_RO(num_cmds); | ||
400 | 304 | ||
401 | static ssize_t target_stat_scsi_lu_show_attr_read_mbytes( | 305 | static ssize_t target_stat_lu_read_mbytes_show(struct config_item *item, |
402 | struct se_dev_stat_grps *sgrps, char *page) | 306 | char *page) |
403 | { | 307 | { |
404 | struct se_device *dev = | 308 | struct se_device *dev = to_stat_lu_dev(item); |
405 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
406 | 309 | ||
407 | /* scsiLuReadMegaBytes */ | 310 | /* scsiLuReadMegaBytes */ |
408 | return snprintf(page, PAGE_SIZE, "%lu\n", | 311 | return snprintf(page, PAGE_SIZE, "%lu\n", |
409 | atomic_long_read(&dev->read_bytes) >> 20); | 312 | atomic_long_read(&dev->read_bytes) >> 20); |
410 | } | 313 | } |
411 | DEV_STAT_SCSI_LU_ATTR_RO(read_mbytes); | ||
412 | 314 | ||
413 | static ssize_t target_stat_scsi_lu_show_attr_write_mbytes( | 315 | static ssize_t target_stat_lu_write_mbytes_show(struct config_item *item, |
414 | struct se_dev_stat_grps *sgrps, char *page) | 316 | char *page) |
415 | { | 317 | { |
416 | struct se_device *dev = | 318 | struct se_device *dev = to_stat_lu_dev(item); |
417 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
418 | 319 | ||
419 | /* scsiLuWrittenMegaBytes */ | 320 | /* scsiLuWrittenMegaBytes */ |
420 | return snprintf(page, PAGE_SIZE, "%lu\n", | 321 | return snprintf(page, PAGE_SIZE, "%lu\n", |
421 | atomic_long_read(&dev->write_bytes) >> 20); | 322 | atomic_long_read(&dev->write_bytes) >> 20); |
422 | } | 323 | } |
423 | DEV_STAT_SCSI_LU_ATTR_RO(write_mbytes); | ||
424 | 324 | ||
425 | static ssize_t target_stat_scsi_lu_show_attr_resets( | 325 | static ssize_t target_stat_lu_resets_show(struct config_item *item, char *page) |
426 | struct se_dev_stat_grps *sgrps, char *page) | ||
427 | { | 326 | { |
428 | struct se_device *dev = | 327 | struct se_device *dev = to_stat_lu_dev(item); |
429 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
430 | 328 | ||
431 | /* scsiLuInResets */ | 329 | /* scsiLuInResets */ |
432 | return snprintf(page, PAGE_SIZE, "%lu\n", atomic_long_read(&dev->num_resets)); | 330 | return snprintf(page, PAGE_SIZE, "%lu\n", |
331 | atomic_long_read(&dev->num_resets)); | ||
433 | } | 332 | } |
434 | DEV_STAT_SCSI_LU_ATTR_RO(resets); | ||
435 | 333 | ||
436 | static ssize_t target_stat_scsi_lu_show_attr_full_stat( | 334 | static ssize_t target_stat_lu_full_stat_show(struct config_item *item, |
437 | struct se_dev_stat_grps *sgrps, char *page) | 335 | char *page) |
438 | { | 336 | { |
439 | /* FIXME: scsiLuOutTaskSetFullStatus */ | 337 | /* FIXME: scsiLuOutTaskSetFullStatus */ |
440 | return snprintf(page, PAGE_SIZE, "%u\n", 0); | 338 | return snprintf(page, PAGE_SIZE, "%u\n", 0); |
441 | } | 339 | } |
442 | DEV_STAT_SCSI_LU_ATTR_RO(full_stat); | ||
443 | 340 | ||
444 | static ssize_t target_stat_scsi_lu_show_attr_hs_num_cmds( | 341 | static ssize_t target_stat_lu_hs_num_cmds_show(struct config_item *item, |
445 | struct se_dev_stat_grps *sgrps, char *page) | 342 | char *page) |
446 | { | 343 | { |
447 | /* FIXME: scsiLuHSInCommands */ | 344 | /* FIXME: scsiLuHSInCommands */ |
448 | return snprintf(page, PAGE_SIZE, "%u\n", 0); | 345 | return snprintf(page, PAGE_SIZE, "%u\n", 0); |
449 | } | 346 | } |
450 | DEV_STAT_SCSI_LU_ATTR_RO(hs_num_cmds); | ||
451 | 347 | ||
452 | static ssize_t target_stat_scsi_lu_show_attr_creation_time( | 348 | static ssize_t target_stat_lu_creation_time_show(struct config_item *item, |
453 | struct se_dev_stat_grps *sgrps, char *page) | 349 | char *page) |
454 | { | 350 | { |
455 | struct se_device *dev = | 351 | struct se_device *dev = to_stat_lu_dev(item); |
456 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
457 | 352 | ||
458 | /* scsiLuCreationTime */ | 353 | /* scsiLuCreationTime */ |
459 | return snprintf(page, PAGE_SIZE, "%u\n", (u32)(((u32)dev->creation_time - | 354 | return snprintf(page, PAGE_SIZE, "%u\n", (u32)(((u32)dev->creation_time - |
460 | INITIAL_JIFFIES) * 100 / HZ)); | 355 | INITIAL_JIFFIES) * 100 / HZ)); |
461 | } | 356 | } |
462 | DEV_STAT_SCSI_LU_ATTR_RO(creation_time); | ||
463 | 357 | ||
464 | CONFIGFS_EATTR_OPS(target_stat_scsi_lu, se_dev_stat_grps, scsi_lu_group); | 358 | CONFIGFS_ATTR_RO(target_stat_lu_, inst); |
359 | CONFIGFS_ATTR_RO(target_stat_lu_, dev); | ||
360 | CONFIGFS_ATTR_RO(target_stat_lu_, indx); | ||
361 | CONFIGFS_ATTR_RO(target_stat_lu_, lun); | ||
362 | CONFIGFS_ATTR_RO(target_stat_lu_, lu_name); | ||
363 | CONFIGFS_ATTR_RO(target_stat_lu_, vend); | ||
364 | CONFIGFS_ATTR_RO(target_stat_lu_, prod); | ||
365 | CONFIGFS_ATTR_RO(target_stat_lu_, rev); | ||
366 | CONFIGFS_ATTR_RO(target_stat_lu_, dev_type); | ||
367 | CONFIGFS_ATTR_RO(target_stat_lu_, status); | ||
368 | CONFIGFS_ATTR_RO(target_stat_lu_, state_bit); | ||
369 | CONFIGFS_ATTR_RO(target_stat_lu_, num_cmds); | ||
370 | CONFIGFS_ATTR_RO(target_stat_lu_, read_mbytes); | ||
371 | CONFIGFS_ATTR_RO(target_stat_lu_, write_mbytes); | ||
372 | CONFIGFS_ATTR_RO(target_stat_lu_, resets); | ||
373 | CONFIGFS_ATTR_RO(target_stat_lu_, full_stat); | ||
374 | CONFIGFS_ATTR_RO(target_stat_lu_, hs_num_cmds); | ||
375 | CONFIGFS_ATTR_RO(target_stat_lu_, creation_time); | ||
465 | 376 | ||
466 | static struct configfs_attribute *target_stat_scsi_lu_attrs[] = { | 377 | static struct configfs_attribute *target_stat_scsi_lu_attrs[] = { |
467 | &target_stat_scsi_lu_inst.attr, | 378 | &target_stat_lu_attr_inst, |
468 | &target_stat_scsi_lu_dev.attr, | 379 | &target_stat_lu_attr_dev, |
469 | &target_stat_scsi_lu_indx.attr, | 380 | &target_stat_lu_attr_indx, |
470 | &target_stat_scsi_lu_lun.attr, | 381 | &target_stat_lu_attr_lun, |
471 | &target_stat_scsi_lu_lu_name.attr, | 382 | &target_stat_lu_attr_lu_name, |
472 | &target_stat_scsi_lu_vend.attr, | 383 | &target_stat_lu_attr_vend, |
473 | &target_stat_scsi_lu_prod.attr, | 384 | &target_stat_lu_attr_prod, |
474 | &target_stat_scsi_lu_rev.attr, | 385 | &target_stat_lu_attr_rev, |
475 | &target_stat_scsi_lu_dev_type.attr, | 386 | &target_stat_lu_attr_dev_type, |
476 | &target_stat_scsi_lu_status.attr, | 387 | &target_stat_lu_attr_status, |
477 | &target_stat_scsi_lu_state_bit.attr, | 388 | &target_stat_lu_attr_state_bit, |
478 | &target_stat_scsi_lu_num_cmds.attr, | 389 | &target_stat_lu_attr_num_cmds, |
479 | &target_stat_scsi_lu_read_mbytes.attr, | 390 | &target_stat_lu_attr_read_mbytes, |
480 | &target_stat_scsi_lu_write_mbytes.attr, | 391 | &target_stat_lu_attr_write_mbytes, |
481 | &target_stat_scsi_lu_resets.attr, | 392 | &target_stat_lu_attr_resets, |
482 | &target_stat_scsi_lu_full_stat.attr, | 393 | &target_stat_lu_attr_full_stat, |
483 | &target_stat_scsi_lu_hs_num_cmds.attr, | 394 | &target_stat_lu_attr_hs_num_cmds, |
484 | &target_stat_scsi_lu_creation_time.attr, | 395 | &target_stat_lu_attr_creation_time, |
485 | NULL, | 396 | NULL, |
486 | }; | 397 | }; |
487 | 398 | ||
488 | static struct configfs_item_operations target_stat_scsi_lu_attrib_ops = { | ||
489 | .show_attribute = target_stat_scsi_lu_attr_show, | ||
490 | .store_attribute = target_stat_scsi_lu_attr_store, | ||
491 | }; | ||
492 | |||
493 | static struct config_item_type target_stat_scsi_lu_cit = { | 399 | static struct config_item_type target_stat_scsi_lu_cit = { |
494 | .ct_item_ops = &target_stat_scsi_lu_attrib_ops, | ||
495 | .ct_attrs = target_stat_scsi_lu_attrs, | 400 | .ct_attrs = target_stat_scsi_lu_attrs, |
496 | .ct_owner = THIS_MODULE, | 401 | .ct_owner = THIS_MODULE, |
497 | }; | 402 | }; |
@@ -521,24 +426,16 @@ void target_stat_setup_dev_default_groups(struct se_device *dev) | |||
521 | * SCSI Port Table | 426 | * SCSI Port Table |
522 | */ | 427 | */ |
523 | 428 | ||
524 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_port, se_port_stat_grps); | 429 | static struct se_lun *to_stat_port(struct config_item *item) |
525 | #define DEV_STAT_SCSI_PORT_ATTR(_name, _mode) \ | 430 | { |
526 | static struct target_stat_scsi_port_attribute \ | 431 | struct se_port_stat_grps *pgrps = container_of(to_config_group(item), |
527 | target_stat_scsi_port_##_name = \ | 432 | struct se_port_stat_grps, scsi_port_group); |
528 | __CONFIGFS_EATTR(_name, _mode, \ | 433 | return container_of(pgrps, struct se_lun, port_stat_grps); |
529 | target_stat_scsi_port_show_attr_##_name, \ | 434 | } |
530 | target_stat_scsi_port_store_attr_##_name); | ||
531 | |||
532 | #define DEV_STAT_SCSI_PORT_ATTR_RO(_name) \ | ||
533 | static struct target_stat_scsi_port_attribute \ | ||
534 | target_stat_scsi_port_##_name = \ | ||
535 | __CONFIGFS_EATTR_RO(_name, \ | ||
536 | target_stat_scsi_port_show_attr_##_name); | ||
537 | 435 | ||
538 | static ssize_t target_stat_scsi_port_show_attr_inst( | 436 | static ssize_t target_stat_port_inst_show(struct config_item *item, char *page) |
539 | struct se_port_stat_grps *pgrps, char *page) | ||
540 | { | 437 | { |
541 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 438 | struct se_lun *lun = to_stat_port(item); |
542 | struct se_device *dev; | 439 | struct se_device *dev; |
543 | ssize_t ret = -ENODEV; | 440 | ssize_t ret = -ENODEV; |
544 | 441 | ||
@@ -549,12 +446,10 @@ static ssize_t target_stat_scsi_port_show_attr_inst( | |||
549 | rcu_read_unlock(); | 446 | rcu_read_unlock(); |
550 | return ret; | 447 | return ret; |
551 | } | 448 | } |
552 | DEV_STAT_SCSI_PORT_ATTR_RO(inst); | ||
553 | 449 | ||
554 | static ssize_t target_stat_scsi_port_show_attr_dev( | 450 | static ssize_t target_stat_port_dev_show(struct config_item *item, char *page) |
555 | struct se_port_stat_grps *pgrps, char *page) | ||
556 | { | 451 | { |
557 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 452 | struct se_lun *lun = to_stat_port(item); |
558 | struct se_device *dev; | 453 | struct se_device *dev; |
559 | ssize_t ret = -ENODEV; | 454 | ssize_t ret = -ENODEV; |
560 | 455 | ||
@@ -565,12 +460,10 @@ static ssize_t target_stat_scsi_port_show_attr_dev( | |||
565 | rcu_read_unlock(); | 460 | rcu_read_unlock(); |
566 | return ret; | 461 | return ret; |
567 | } | 462 | } |
568 | DEV_STAT_SCSI_PORT_ATTR_RO(dev); | ||
569 | 463 | ||
570 | static ssize_t target_stat_scsi_port_show_attr_indx( | 464 | static ssize_t target_stat_port_indx_show(struct config_item *item, char *page) |
571 | struct se_port_stat_grps *pgrps, char *page) | ||
572 | { | 465 | { |
573 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 466 | struct se_lun *lun = to_stat_port(item); |
574 | struct se_device *dev; | 467 | struct se_device *dev; |
575 | ssize_t ret = -ENODEV; | 468 | ssize_t ret = -ENODEV; |
576 | 469 | ||
@@ -581,12 +474,10 @@ static ssize_t target_stat_scsi_port_show_attr_indx( | |||
581 | rcu_read_unlock(); | 474 | rcu_read_unlock(); |
582 | return ret; | 475 | return ret; |
583 | } | 476 | } |
584 | DEV_STAT_SCSI_PORT_ATTR_RO(indx); | ||
585 | 477 | ||
586 | static ssize_t target_stat_scsi_port_show_attr_role( | 478 | static ssize_t target_stat_port_role_show(struct config_item *item, char *page) |
587 | struct se_port_stat_grps *pgrps, char *page) | ||
588 | { | 479 | { |
589 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 480 | struct se_lun *lun = to_stat_port(item); |
590 | struct se_device *dev; | 481 | struct se_device *dev; |
591 | ssize_t ret = -ENODEV; | 482 | ssize_t ret = -ENODEV; |
592 | 483 | ||
@@ -597,12 +488,11 @@ static ssize_t target_stat_scsi_port_show_attr_role( | |||
597 | rcu_read_unlock(); | 488 | rcu_read_unlock(); |
598 | return ret; | 489 | return ret; |
599 | } | 490 | } |
600 | DEV_STAT_SCSI_PORT_ATTR_RO(role); | ||
601 | 491 | ||
602 | static ssize_t target_stat_scsi_port_show_attr_busy_count( | 492 | static ssize_t target_stat_port_busy_count_show(struct config_item *item, |
603 | struct se_port_stat_grps *pgrps, char *page) | 493 | char *page) |
604 | { | 494 | { |
605 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 495 | struct se_lun *lun = to_stat_port(item); |
606 | struct se_device *dev; | 496 | struct se_device *dev; |
607 | ssize_t ret = -ENODEV; | 497 | ssize_t ret = -ENODEV; |
608 | 498 | ||
@@ -615,26 +505,23 @@ static ssize_t target_stat_scsi_port_show_attr_busy_count( | |||
615 | rcu_read_unlock(); | 505 | rcu_read_unlock(); |
616 | return ret; | 506 | return ret; |
617 | } | 507 | } |
618 | DEV_STAT_SCSI_PORT_ATTR_RO(busy_count); | ||
619 | 508 | ||
620 | CONFIGFS_EATTR_OPS(target_stat_scsi_port, se_port_stat_grps, scsi_port_group); | 509 | CONFIGFS_ATTR_RO(target_stat_port_, inst); |
510 | CONFIGFS_ATTR_RO(target_stat_port_, dev); | ||
511 | CONFIGFS_ATTR_RO(target_stat_port_, indx); | ||
512 | CONFIGFS_ATTR_RO(target_stat_port_, role); | ||
513 | CONFIGFS_ATTR_RO(target_stat_port_, busy_count); | ||
621 | 514 | ||
622 | static struct configfs_attribute *target_stat_scsi_port_attrs[] = { | 515 | static struct configfs_attribute *target_stat_scsi_port_attrs[] = { |
623 | &target_stat_scsi_port_inst.attr, | 516 | &target_stat_port_attr_inst, |
624 | &target_stat_scsi_port_dev.attr, | 517 | &target_stat_port_attr_dev, |
625 | &target_stat_scsi_port_indx.attr, | 518 | &target_stat_port_attr_indx, |
626 | &target_stat_scsi_port_role.attr, | 519 | &target_stat_port_attr_role, |
627 | &target_stat_scsi_port_busy_count.attr, | 520 | &target_stat_port_attr_busy_count, |
628 | NULL, | 521 | NULL, |
629 | }; | 522 | }; |
630 | 523 | ||
631 | static struct configfs_item_operations target_stat_scsi_port_attrib_ops = { | ||
632 | .show_attribute = target_stat_scsi_port_attr_show, | ||
633 | .store_attribute = target_stat_scsi_port_attr_store, | ||
634 | }; | ||
635 | |||
636 | static struct config_item_type target_stat_scsi_port_cit = { | 524 | static struct config_item_type target_stat_scsi_port_cit = { |
637 | .ct_item_ops = &target_stat_scsi_port_attrib_ops, | ||
638 | .ct_attrs = target_stat_scsi_port_attrs, | 525 | .ct_attrs = target_stat_scsi_port_attrs, |
639 | .ct_owner = THIS_MODULE, | 526 | .ct_owner = THIS_MODULE, |
640 | }; | 527 | }; |
@@ -642,24 +529,17 @@ static struct config_item_type target_stat_scsi_port_cit = { | |||
642 | /* | 529 | /* |
643 | * SCSI Target Port Table | 530 | * SCSI Target Port Table |
644 | */ | 531 | */ |
645 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_tgt_port, se_port_stat_grps); | 532 | static struct se_lun *to_stat_tgt_port(struct config_item *item) |
646 | #define DEV_STAT_SCSI_TGT_PORT_ATTR(_name, _mode) \ | 533 | { |
647 | static struct target_stat_scsi_tgt_port_attribute \ | 534 | struct se_port_stat_grps *pgrps = container_of(to_config_group(item), |
648 | target_stat_scsi_tgt_port_##_name = \ | 535 | struct se_port_stat_grps, scsi_tgt_port_group); |
649 | __CONFIGFS_EATTR(_name, _mode, \ | 536 | return container_of(pgrps, struct se_lun, port_stat_grps); |
650 | target_stat_scsi_tgt_port_show_attr_##_name, \ | 537 | } |
651 | target_stat_scsi_tgt_port_store_attr_##_name); | 538 | |
652 | 539 | static ssize_t target_stat_tgt_port_inst_show(struct config_item *item, | |
653 | #define DEV_STAT_SCSI_TGT_PORT_ATTR_RO(_name) \ | 540 | char *page) |
654 | static struct target_stat_scsi_tgt_port_attribute \ | 541 | { |
655 | target_stat_scsi_tgt_port_##_name = \ | 542 | struct se_lun *lun = to_stat_tgt_port(item); |
656 | __CONFIGFS_EATTR_RO(_name, \ | ||
657 | target_stat_scsi_tgt_port_show_attr_##_name); | ||
658 | |||
659 | static ssize_t target_stat_scsi_tgt_port_show_attr_inst( | ||
660 | struct se_port_stat_grps *pgrps, char *page) | ||
661 | { | ||
662 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | ||
663 | struct se_device *dev; | 543 | struct se_device *dev; |
664 | ssize_t ret = -ENODEV; | 544 | ssize_t ret = -ENODEV; |
665 | 545 | ||
@@ -670,12 +550,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_inst( | |||
670 | rcu_read_unlock(); | 550 | rcu_read_unlock(); |
671 | return ret; | 551 | return ret; |
672 | } | 552 | } |
673 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(inst); | ||
674 | 553 | ||
675 | static ssize_t target_stat_scsi_tgt_port_show_attr_dev( | 554 | static ssize_t target_stat_tgt_port_dev_show(struct config_item *item, |
676 | struct se_port_stat_grps *pgrps, char *page) | 555 | char *page) |
677 | { | 556 | { |
678 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 557 | struct se_lun *lun = to_stat_tgt_port(item); |
679 | struct se_device *dev; | 558 | struct se_device *dev; |
680 | ssize_t ret = -ENODEV; | 559 | ssize_t ret = -ENODEV; |
681 | 560 | ||
@@ -686,12 +565,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_dev( | |||
686 | rcu_read_unlock(); | 565 | rcu_read_unlock(); |
687 | return ret; | 566 | return ret; |
688 | } | 567 | } |
689 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(dev); | ||
690 | 568 | ||
691 | static ssize_t target_stat_scsi_tgt_port_show_attr_indx( | 569 | static ssize_t target_stat_tgt_port_indx_show(struct config_item *item, |
692 | struct se_port_stat_grps *pgrps, char *page) | 570 | char *page) |
693 | { | 571 | { |
694 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 572 | struct se_lun *lun = to_stat_tgt_port(item); |
695 | struct se_device *dev; | 573 | struct se_device *dev; |
696 | ssize_t ret = -ENODEV; | 574 | ssize_t ret = -ENODEV; |
697 | 575 | ||
@@ -702,12 +580,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_indx( | |||
702 | rcu_read_unlock(); | 580 | rcu_read_unlock(); |
703 | return ret; | 581 | return ret; |
704 | } | 582 | } |
705 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(indx); | ||
706 | 583 | ||
707 | static ssize_t target_stat_scsi_tgt_port_show_attr_name( | 584 | static ssize_t target_stat_tgt_port_name_show(struct config_item *item, |
708 | struct se_port_stat_grps *pgrps, char *page) | 585 | char *page) |
709 | { | 586 | { |
710 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 587 | struct se_lun *lun = to_stat_tgt_port(item); |
711 | struct se_portal_group *tpg = lun->lun_tpg; | 588 | struct se_portal_group *tpg = lun->lun_tpg; |
712 | struct se_device *dev; | 589 | struct se_device *dev; |
713 | ssize_t ret = -ENODEV; | 590 | ssize_t ret = -ENODEV; |
@@ -721,12 +598,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_name( | |||
721 | rcu_read_unlock(); | 598 | rcu_read_unlock(); |
722 | return ret; | 599 | return ret; |
723 | } | 600 | } |
724 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(name); | ||
725 | 601 | ||
726 | static ssize_t target_stat_scsi_tgt_port_show_attr_port_index( | 602 | static ssize_t target_stat_tgt_port_port_index_show(struct config_item *item, |
727 | struct se_port_stat_grps *pgrps, char *page) | 603 | char *page) |
728 | { | 604 | { |
729 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 605 | struct se_lun *lun = to_stat_tgt_port(item); |
730 | struct se_portal_group *tpg = lun->lun_tpg; | 606 | struct se_portal_group *tpg = lun->lun_tpg; |
731 | struct se_device *dev; | 607 | struct se_device *dev; |
732 | ssize_t ret = -ENODEV; | 608 | ssize_t ret = -ENODEV; |
@@ -740,12 +616,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_port_index( | |||
740 | rcu_read_unlock(); | 616 | rcu_read_unlock(); |
741 | return ret; | 617 | return ret; |
742 | } | 618 | } |
743 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(port_index); | ||
744 | 619 | ||
745 | static ssize_t target_stat_scsi_tgt_port_show_attr_in_cmds( | 620 | static ssize_t target_stat_tgt_port_in_cmds_show(struct config_item *item, |
746 | struct se_port_stat_grps *pgrps, char *page) | 621 | char *page) |
747 | { | 622 | { |
748 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 623 | struct se_lun *lun = to_stat_tgt_port(item); |
749 | struct se_device *dev; | 624 | struct se_device *dev; |
750 | ssize_t ret = -ENODEV; | 625 | ssize_t ret = -ENODEV; |
751 | 626 | ||
@@ -757,12 +632,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_in_cmds( | |||
757 | rcu_read_unlock(); | 632 | rcu_read_unlock(); |
758 | return ret; | 633 | return ret; |
759 | } | 634 | } |
760 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(in_cmds); | ||
761 | 635 | ||
762 | static ssize_t target_stat_scsi_tgt_port_show_attr_write_mbytes( | 636 | static ssize_t target_stat_tgt_port_write_mbytes_show(struct config_item *item, |
763 | struct se_port_stat_grps *pgrps, char *page) | 637 | char *page) |
764 | { | 638 | { |
765 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 639 | struct se_lun *lun = to_stat_tgt_port(item); |
766 | struct se_device *dev; | 640 | struct se_device *dev; |
767 | ssize_t ret = -ENODEV; | 641 | ssize_t ret = -ENODEV; |
768 | 642 | ||
@@ -774,12 +648,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_write_mbytes( | |||
774 | rcu_read_unlock(); | 648 | rcu_read_unlock(); |
775 | return ret; | 649 | return ret; |
776 | } | 650 | } |
777 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(write_mbytes); | ||
778 | 651 | ||
779 | static ssize_t target_stat_scsi_tgt_port_show_attr_read_mbytes( | 652 | static ssize_t target_stat_tgt_port_read_mbytes_show(struct config_item *item, |
780 | struct se_port_stat_grps *pgrps, char *page) | 653 | char *page) |
781 | { | 654 | { |
782 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 655 | struct se_lun *lun = to_stat_tgt_port(item); |
783 | struct se_device *dev; | 656 | struct se_device *dev; |
784 | ssize_t ret = -ENODEV; | 657 | ssize_t ret = -ENODEV; |
785 | 658 | ||
@@ -791,12 +664,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_read_mbytes( | |||
791 | rcu_read_unlock(); | 664 | rcu_read_unlock(); |
792 | return ret; | 665 | return ret; |
793 | } | 666 | } |
794 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(read_mbytes); | ||
795 | 667 | ||
796 | static ssize_t target_stat_scsi_tgt_port_show_attr_hs_in_cmds( | 668 | static ssize_t target_stat_tgt_port_hs_in_cmds_show(struct config_item *item, |
797 | struct se_port_stat_grps *pgrps, char *page) | 669 | char *page) |
798 | { | 670 | { |
799 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 671 | struct se_lun *lun = to_stat_tgt_port(item); |
800 | struct se_device *dev; | 672 | struct se_device *dev; |
801 | ssize_t ret = -ENODEV; | 673 | ssize_t ret = -ENODEV; |
802 | 674 | ||
@@ -809,57 +681,49 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_hs_in_cmds( | |||
809 | rcu_read_unlock(); | 681 | rcu_read_unlock(); |
810 | return ret; | 682 | return ret; |
811 | } | 683 | } |
812 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(hs_in_cmds); | ||
813 | 684 | ||
814 | CONFIGFS_EATTR_OPS(target_stat_scsi_tgt_port, se_port_stat_grps, | 685 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, inst); |
815 | scsi_tgt_port_group); | 686 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, dev); |
687 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, indx); | ||
688 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, name); | ||
689 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, port_index); | ||
690 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, in_cmds); | ||
691 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, write_mbytes); | ||
692 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, read_mbytes); | ||
693 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, hs_in_cmds); | ||
816 | 694 | ||
817 | static struct configfs_attribute *target_stat_scsi_tgt_port_attrs[] = { | 695 | static struct configfs_attribute *target_stat_scsi_tgt_port_attrs[] = { |
818 | &target_stat_scsi_tgt_port_inst.attr, | 696 | &target_stat_tgt_port_attr_inst, |
819 | &target_stat_scsi_tgt_port_dev.attr, | 697 | &target_stat_tgt_port_attr_dev, |
820 | &target_stat_scsi_tgt_port_indx.attr, | 698 | &target_stat_tgt_port_attr_indx, |
821 | &target_stat_scsi_tgt_port_name.attr, | 699 | &target_stat_tgt_port_attr_name, |
822 | &target_stat_scsi_tgt_port_port_index.attr, | 700 | &target_stat_tgt_port_attr_port_index, |
823 | &target_stat_scsi_tgt_port_in_cmds.attr, | 701 | &target_stat_tgt_port_attr_in_cmds, |
824 | &target_stat_scsi_tgt_port_write_mbytes.attr, | 702 | &target_stat_tgt_port_attr_write_mbytes, |
825 | &target_stat_scsi_tgt_port_read_mbytes.attr, | 703 | &target_stat_tgt_port_attr_read_mbytes, |
826 | &target_stat_scsi_tgt_port_hs_in_cmds.attr, | 704 | &target_stat_tgt_port_attr_hs_in_cmds, |
827 | NULL, | 705 | NULL, |
828 | }; | 706 | }; |
829 | 707 | ||
830 | static struct configfs_item_operations target_stat_scsi_tgt_port_attrib_ops = { | ||
831 | .show_attribute = target_stat_scsi_tgt_port_attr_show, | ||
832 | .store_attribute = target_stat_scsi_tgt_port_attr_store, | ||
833 | }; | ||
834 | |||
835 | static struct config_item_type target_stat_scsi_tgt_port_cit = { | 708 | static struct config_item_type target_stat_scsi_tgt_port_cit = { |
836 | .ct_item_ops = &target_stat_scsi_tgt_port_attrib_ops, | ||
837 | .ct_attrs = target_stat_scsi_tgt_port_attrs, | 709 | .ct_attrs = target_stat_scsi_tgt_port_attrs, |
838 | .ct_owner = THIS_MODULE, | 710 | .ct_owner = THIS_MODULE, |
839 | }; | 711 | }; |
840 | 712 | ||
841 | /* | 713 | /* |
842 | * SCSI Transport Table | 714 | * SCSI Transport Table |
843 | o */ | 715 | */ |
844 | 716 | static struct se_lun *to_transport_stat(struct config_item *item) | |
845 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_transport, se_port_stat_grps); | 717 | { |
846 | #define DEV_STAT_SCSI_TRANSPORT_ATTR(_name, _mode) \ | 718 | struct se_port_stat_grps *pgrps = container_of(to_config_group(item), |
847 | static struct target_stat_scsi_transport_attribute \ | 719 | struct se_port_stat_grps, scsi_transport_group); |
848 | target_stat_scsi_transport_##_name = \ | 720 | return container_of(pgrps, struct se_lun, port_stat_grps); |
849 | __CONFIGFS_EATTR(_name, _mode, \ | 721 | } |
850 | target_stat_scsi_transport_show_attr_##_name, \ | 722 | |
851 | target_stat_scsi_transport_store_attr_##_name); | 723 | static ssize_t target_stat_transport_inst_show(struct config_item *item, |
852 | 724 | char *page) | |
853 | #define DEV_STAT_SCSI_TRANSPORT_ATTR_RO(_name) \ | 725 | { |
854 | static struct target_stat_scsi_transport_attribute \ | 726 | struct se_lun *lun = to_transport_stat(item); |
855 | target_stat_scsi_transport_##_name = \ | ||
856 | __CONFIGFS_EATTR_RO(_name, \ | ||
857 | target_stat_scsi_transport_show_attr_##_name); | ||
858 | |||
859 | static ssize_t target_stat_scsi_transport_show_attr_inst( | ||
860 | struct se_port_stat_grps *pgrps, char *page) | ||
861 | { | ||
862 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | ||
863 | struct se_device *dev; | 727 | struct se_device *dev; |
864 | ssize_t ret = -ENODEV; | 728 | ssize_t ret = -ENODEV; |
865 | 729 | ||
@@ -870,12 +734,11 @@ static ssize_t target_stat_scsi_transport_show_attr_inst( | |||
870 | rcu_read_unlock(); | 734 | rcu_read_unlock(); |
871 | return ret; | 735 | return ret; |
872 | } | 736 | } |
873 | DEV_STAT_SCSI_TRANSPORT_ATTR_RO(inst); | ||
874 | 737 | ||
875 | static ssize_t target_stat_scsi_transport_show_attr_device( | 738 | static ssize_t target_stat_transport_device_show(struct config_item *item, |
876 | struct se_port_stat_grps *pgrps, char *page) | 739 | char *page) |
877 | { | 740 | { |
878 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 741 | struct se_lun *lun = to_transport_stat(item); |
879 | struct se_device *dev; | 742 | struct se_device *dev; |
880 | struct se_portal_group *tpg = lun->lun_tpg; | 743 | struct se_portal_group *tpg = lun->lun_tpg; |
881 | ssize_t ret = -ENODEV; | 744 | ssize_t ret = -ENODEV; |
@@ -890,12 +753,11 @@ static ssize_t target_stat_scsi_transport_show_attr_device( | |||
890 | rcu_read_unlock(); | 753 | rcu_read_unlock(); |
891 | return ret; | 754 | return ret; |
892 | } | 755 | } |
893 | DEV_STAT_SCSI_TRANSPORT_ATTR_RO(device); | ||
894 | 756 | ||
895 | static ssize_t target_stat_scsi_transport_show_attr_indx( | 757 | static ssize_t target_stat_transport_indx_show(struct config_item *item, |
896 | struct se_port_stat_grps *pgrps, char *page) | 758 | char *page) |
897 | { | 759 | { |
898 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 760 | struct se_lun *lun = to_transport_stat(item); |
899 | struct se_device *dev; | 761 | struct se_device *dev; |
900 | struct se_portal_group *tpg = lun->lun_tpg; | 762 | struct se_portal_group *tpg = lun->lun_tpg; |
901 | ssize_t ret = -ENODEV; | 763 | ssize_t ret = -ENODEV; |
@@ -908,12 +770,11 @@ static ssize_t target_stat_scsi_transport_show_attr_indx( | |||
908 | rcu_read_unlock(); | 770 | rcu_read_unlock(); |
909 | return ret; | 771 | return ret; |
910 | } | 772 | } |
911 | DEV_STAT_SCSI_TRANSPORT_ATTR_RO(indx); | ||
912 | 773 | ||
913 | static ssize_t target_stat_scsi_transport_show_attr_dev_name( | 774 | static ssize_t target_stat_transport_dev_name_show(struct config_item *item, |
914 | struct se_port_stat_grps *pgrps, char *page) | 775 | char *page) |
915 | { | 776 | { |
916 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 777 | struct se_lun *lun = to_transport_stat(item); |
917 | struct se_device *dev; | 778 | struct se_device *dev; |
918 | struct se_portal_group *tpg = lun->lun_tpg; | 779 | struct se_portal_group *tpg = lun->lun_tpg; |
919 | struct t10_wwn *wwn; | 780 | struct t10_wwn *wwn; |
@@ -932,26 +793,21 @@ static ssize_t target_stat_scsi_transport_show_attr_dev_name( | |||
932 | rcu_read_unlock(); | 793 | rcu_read_unlock(); |
933 | return ret; | 794 | return ret; |
934 | } | 795 | } |
935 | DEV_STAT_SCSI_TRANSPORT_ATTR_RO(dev_name); | ||
936 | 796 | ||
937 | CONFIGFS_EATTR_OPS(target_stat_scsi_transport, se_port_stat_grps, | 797 | CONFIGFS_ATTR_RO(target_stat_transport_, inst); |
938 | scsi_transport_group); | 798 | CONFIGFS_ATTR_RO(target_stat_transport_, device); |
799 | CONFIGFS_ATTR_RO(target_stat_transport_, indx); | ||
800 | CONFIGFS_ATTR_RO(target_stat_transport_, dev_name); | ||
939 | 801 | ||
940 | static struct configfs_attribute *target_stat_scsi_transport_attrs[] = { | 802 | static struct configfs_attribute *target_stat_scsi_transport_attrs[] = { |
941 | &target_stat_scsi_transport_inst.attr, | 803 | &target_stat_transport_attr_inst, |
942 | &target_stat_scsi_transport_device.attr, | 804 | &target_stat_transport_attr_device, |
943 | &target_stat_scsi_transport_indx.attr, | 805 | &target_stat_transport_attr_indx, |
944 | &target_stat_scsi_transport_dev_name.attr, | 806 | &target_stat_transport_attr_dev_name, |
945 | NULL, | 807 | NULL, |
946 | }; | 808 | }; |
947 | 809 | ||
948 | static struct configfs_item_operations target_stat_scsi_transport_attrib_ops = { | ||
949 | .show_attribute = target_stat_scsi_transport_attr_show, | ||
950 | .store_attribute = target_stat_scsi_transport_attr_store, | ||
951 | }; | ||
952 | |||
953 | static struct config_item_type target_stat_scsi_transport_cit = { | 810 | static struct config_item_type target_stat_scsi_transport_cit = { |
954 | .ct_item_ops = &target_stat_scsi_transport_attrib_ops, | ||
955 | .ct_attrs = target_stat_scsi_transport_attrs, | 811 | .ct_attrs = target_stat_scsi_transport_attrs, |
956 | .ct_owner = THIS_MODULE, | 812 | .ct_owner = THIS_MODULE, |
957 | }; | 813 | }; |
@@ -981,25 +837,17 @@ void target_stat_setup_port_default_groups(struct se_lun *lun) | |||
981 | * SCSI Authorized Initiator Table | 837 | * SCSI Authorized Initiator Table |
982 | */ | 838 | */ |
983 | 839 | ||
984 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_auth_intr, se_ml_stat_grps); | 840 | static struct se_lun_acl *auth_to_lacl(struct config_item *item) |
985 | #define DEV_STAT_SCSI_AUTH_INTR_ATTR(_name, _mode) \ | 841 | { |
986 | static struct target_stat_scsi_auth_intr_attribute \ | 842 | struct se_ml_stat_grps *lgrps = container_of(to_config_group(item), |
987 | target_stat_scsi_auth_intr_##_name = \ | 843 | struct se_ml_stat_grps, scsi_auth_intr_group); |
988 | __CONFIGFS_EATTR(_name, _mode, \ | 844 | return container_of(lgrps, struct se_lun_acl, ml_stat_grps); |
989 | target_stat_scsi_auth_intr_show_attr_##_name, \ | 845 | } |
990 | target_stat_scsi_auth_intr_store_attr_##_name); | 846 | |
991 | 847 | static ssize_t target_stat_auth_inst_show(struct config_item *item, | |
992 | #define DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(_name) \ | 848 | char *page) |
993 | static struct target_stat_scsi_auth_intr_attribute \ | 849 | { |
994 | target_stat_scsi_auth_intr_##_name = \ | 850 | struct se_lun_acl *lacl = auth_to_lacl(item); |
995 | __CONFIGFS_EATTR_RO(_name, \ | ||
996 | target_stat_scsi_auth_intr_show_attr_##_name); | ||
997 | |||
998 | static ssize_t target_stat_scsi_auth_intr_show_attr_inst( | ||
999 | struct se_ml_stat_grps *lgrps, char *page) | ||
1000 | { | ||
1001 | struct se_lun_acl *lacl = container_of(lgrps, | ||
1002 | struct se_lun_acl, ml_stat_grps); | ||
1003 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 851 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1004 | struct se_dev_entry *deve; | 852 | struct se_dev_entry *deve; |
1005 | struct se_portal_group *tpg; | 853 | struct se_portal_group *tpg; |
@@ -1018,13 +866,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_inst( | |||
1018 | rcu_read_unlock(); | 866 | rcu_read_unlock(); |
1019 | return ret; | 867 | return ret; |
1020 | } | 868 | } |
1021 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(inst); | ||
1022 | 869 | ||
1023 | static ssize_t target_stat_scsi_auth_intr_show_attr_dev( | 870 | static ssize_t target_stat_auth_dev_show(struct config_item *item, |
1024 | struct se_ml_stat_grps *lgrps, char *page) | 871 | char *page) |
1025 | { | 872 | { |
1026 | struct se_lun_acl *lacl = container_of(lgrps, | 873 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1027 | struct se_lun_acl, ml_stat_grps); | ||
1028 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 874 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1029 | struct se_dev_entry *deve; | 875 | struct se_dev_entry *deve; |
1030 | struct se_lun *lun; | 876 | struct se_lun *lun; |
@@ -1042,13 +888,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_dev( | |||
1042 | rcu_read_unlock(); | 888 | rcu_read_unlock(); |
1043 | return ret; | 889 | return ret; |
1044 | } | 890 | } |
1045 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(dev); | ||
1046 | 891 | ||
1047 | static ssize_t target_stat_scsi_auth_intr_show_attr_port( | 892 | static ssize_t target_stat_auth_port_show(struct config_item *item, |
1048 | struct se_ml_stat_grps *lgrps, char *page) | 893 | char *page) |
1049 | { | 894 | { |
1050 | struct se_lun_acl *lacl = container_of(lgrps, | 895 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1051 | struct se_lun_acl, ml_stat_grps); | ||
1052 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 896 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1053 | struct se_dev_entry *deve; | 897 | struct se_dev_entry *deve; |
1054 | struct se_portal_group *tpg; | 898 | struct se_portal_group *tpg; |
@@ -1066,13 +910,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_port( | |||
1066 | rcu_read_unlock(); | 910 | rcu_read_unlock(); |
1067 | return ret; | 911 | return ret; |
1068 | } | 912 | } |
1069 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(port); | ||
1070 | 913 | ||
1071 | static ssize_t target_stat_scsi_auth_intr_show_attr_indx( | 914 | static ssize_t target_stat_auth_indx_show(struct config_item *item, |
1072 | struct se_ml_stat_grps *lgrps, char *page) | 915 | char *page) |
1073 | { | 916 | { |
1074 | struct se_lun_acl *lacl = container_of(lgrps, | 917 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1075 | struct se_lun_acl, ml_stat_grps); | ||
1076 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 918 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1077 | struct se_dev_entry *deve; | 919 | struct se_dev_entry *deve; |
1078 | ssize_t ret; | 920 | ssize_t ret; |
@@ -1088,13 +930,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_indx( | |||
1088 | rcu_read_unlock(); | 930 | rcu_read_unlock(); |
1089 | return ret; | 931 | return ret; |
1090 | } | 932 | } |
1091 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(indx); | ||
1092 | 933 | ||
1093 | static ssize_t target_stat_scsi_auth_intr_show_attr_dev_or_port( | 934 | static ssize_t target_stat_auth_dev_or_port_show(struct config_item *item, |
1094 | struct se_ml_stat_grps *lgrps, char *page) | 935 | char *page) |
1095 | { | 936 | { |
1096 | struct se_lun_acl *lacl = container_of(lgrps, | 937 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1097 | struct se_lun_acl, ml_stat_grps); | ||
1098 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 938 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1099 | struct se_dev_entry *deve; | 939 | struct se_dev_entry *deve; |
1100 | ssize_t ret; | 940 | ssize_t ret; |
@@ -1110,13 +950,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_dev_or_port( | |||
1110 | rcu_read_unlock(); | 950 | rcu_read_unlock(); |
1111 | return ret; | 951 | return ret; |
1112 | } | 952 | } |
1113 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(dev_or_port); | ||
1114 | 953 | ||
1115 | static ssize_t target_stat_scsi_auth_intr_show_attr_intr_name( | 954 | static ssize_t target_stat_auth_intr_name_show(struct config_item *item, |
1116 | struct se_ml_stat_grps *lgrps, char *page) | 955 | char *page) |
1117 | { | 956 | { |
1118 | struct se_lun_acl *lacl = container_of(lgrps, | 957 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1119 | struct se_lun_acl, ml_stat_grps); | ||
1120 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 958 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1121 | struct se_dev_entry *deve; | 959 | struct se_dev_entry *deve; |
1122 | ssize_t ret; | 960 | ssize_t ret; |
@@ -1132,13 +970,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_intr_name( | |||
1132 | rcu_read_unlock(); | 970 | rcu_read_unlock(); |
1133 | return ret; | 971 | return ret; |
1134 | } | 972 | } |
1135 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(intr_name); | ||
1136 | 973 | ||
1137 | static ssize_t target_stat_scsi_auth_intr_show_attr_map_indx( | 974 | static ssize_t target_stat_auth_map_indx_show(struct config_item *item, |
1138 | struct se_ml_stat_grps *lgrps, char *page) | 975 | char *page) |
1139 | { | 976 | { |
1140 | struct se_lun_acl *lacl = container_of(lgrps, | 977 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1141 | struct se_lun_acl, ml_stat_grps); | ||
1142 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 978 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1143 | struct se_dev_entry *deve; | 979 | struct se_dev_entry *deve; |
1144 | ssize_t ret; | 980 | ssize_t ret; |
@@ -1154,13 +990,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_map_indx( | |||
1154 | rcu_read_unlock(); | 990 | rcu_read_unlock(); |
1155 | return ret; | 991 | return ret; |
1156 | } | 992 | } |
1157 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(map_indx); | ||
1158 | 993 | ||
1159 | static ssize_t target_stat_scsi_auth_intr_show_attr_att_count( | 994 | static ssize_t target_stat_auth_att_count_show(struct config_item *item, |
1160 | struct se_ml_stat_grps *lgrps, char *page) | 995 | char *page) |
1161 | { | 996 | { |
1162 | struct se_lun_acl *lacl = container_of(lgrps, | 997 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1163 | struct se_lun_acl, ml_stat_grps); | ||
1164 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 998 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1165 | struct se_dev_entry *deve; | 999 | struct se_dev_entry *deve; |
1166 | ssize_t ret; | 1000 | ssize_t ret; |
@@ -1176,13 +1010,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_att_count( | |||
1176 | rcu_read_unlock(); | 1010 | rcu_read_unlock(); |
1177 | return ret; | 1011 | return ret; |
1178 | } | 1012 | } |
1179 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(att_count); | ||
1180 | 1013 | ||
1181 | static ssize_t target_stat_scsi_auth_intr_show_attr_num_cmds( | 1014 | static ssize_t target_stat_auth_num_cmds_show(struct config_item *item, |
1182 | struct se_ml_stat_grps *lgrps, char *page) | 1015 | char *page) |
1183 | { | 1016 | { |
1184 | struct se_lun_acl *lacl = container_of(lgrps, | 1017 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1185 | struct se_lun_acl, ml_stat_grps); | ||
1186 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1018 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1187 | struct se_dev_entry *deve; | 1019 | struct se_dev_entry *deve; |
1188 | ssize_t ret; | 1020 | ssize_t ret; |
@@ -1199,13 +1031,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_num_cmds( | |||
1199 | rcu_read_unlock(); | 1031 | rcu_read_unlock(); |
1200 | return ret; | 1032 | return ret; |
1201 | } | 1033 | } |
1202 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(num_cmds); | ||
1203 | 1034 | ||
1204 | static ssize_t target_stat_scsi_auth_intr_show_attr_read_mbytes( | 1035 | static ssize_t target_stat_auth_read_mbytes_show(struct config_item *item, |
1205 | struct se_ml_stat_grps *lgrps, char *page) | 1036 | char *page) |
1206 | { | 1037 | { |
1207 | struct se_lun_acl *lacl = container_of(lgrps, | 1038 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1208 | struct se_lun_acl, ml_stat_grps); | ||
1209 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1039 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1210 | struct se_dev_entry *deve; | 1040 | struct se_dev_entry *deve; |
1211 | ssize_t ret; | 1041 | ssize_t ret; |
@@ -1222,13 +1052,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_read_mbytes( | |||
1222 | rcu_read_unlock(); | 1052 | rcu_read_unlock(); |
1223 | return ret; | 1053 | return ret; |
1224 | } | 1054 | } |
1225 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(read_mbytes); | ||
1226 | 1055 | ||
1227 | static ssize_t target_stat_scsi_auth_intr_show_attr_write_mbytes( | 1056 | static ssize_t target_stat_auth_write_mbytes_show(struct config_item *item, |
1228 | struct se_ml_stat_grps *lgrps, char *page) | 1057 | char *page) |
1229 | { | 1058 | { |
1230 | struct se_lun_acl *lacl = container_of(lgrps, | 1059 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1231 | struct se_lun_acl, ml_stat_grps); | ||
1232 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1060 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1233 | struct se_dev_entry *deve; | 1061 | struct se_dev_entry *deve; |
1234 | ssize_t ret; | 1062 | ssize_t ret; |
@@ -1245,13 +1073,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_write_mbytes( | |||
1245 | rcu_read_unlock(); | 1073 | rcu_read_unlock(); |
1246 | return ret; | 1074 | return ret; |
1247 | } | 1075 | } |
1248 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(write_mbytes); | ||
1249 | 1076 | ||
1250 | static ssize_t target_stat_scsi_auth_intr_show_attr_hs_num_cmds( | 1077 | static ssize_t target_stat_auth_hs_num_cmds_show(struct config_item *item, |
1251 | struct se_ml_stat_grps *lgrps, char *page) | 1078 | char *page) |
1252 | { | 1079 | { |
1253 | struct se_lun_acl *lacl = container_of(lgrps, | 1080 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1254 | struct se_lun_acl, ml_stat_grps); | ||
1255 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1081 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1256 | struct se_dev_entry *deve; | 1082 | struct se_dev_entry *deve; |
1257 | ssize_t ret; | 1083 | ssize_t ret; |
@@ -1267,13 +1093,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_hs_num_cmds( | |||
1267 | rcu_read_unlock(); | 1093 | rcu_read_unlock(); |
1268 | return ret; | 1094 | return ret; |
1269 | } | 1095 | } |
1270 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(hs_num_cmds); | ||
1271 | 1096 | ||
1272 | static ssize_t target_stat_scsi_auth_intr_show_attr_creation_time( | 1097 | static ssize_t target_stat_auth_creation_time_show(struct config_item *item, |
1273 | struct se_ml_stat_grps *lgrps, char *page) | 1098 | char *page) |
1274 | { | 1099 | { |
1275 | struct se_lun_acl *lacl = container_of(lgrps, | 1100 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1276 | struct se_lun_acl, ml_stat_grps); | ||
1277 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1101 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1278 | struct se_dev_entry *deve; | 1102 | struct se_dev_entry *deve; |
1279 | ssize_t ret; | 1103 | ssize_t ret; |
@@ -1290,13 +1114,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_creation_time( | |||
1290 | rcu_read_unlock(); | 1114 | rcu_read_unlock(); |
1291 | return ret; | 1115 | return ret; |
1292 | } | 1116 | } |
1293 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(creation_time); | ||
1294 | 1117 | ||
1295 | static ssize_t target_stat_scsi_auth_intr_show_attr_row_status( | 1118 | static ssize_t target_stat_auth_row_status_show(struct config_item *item, |
1296 | struct se_ml_stat_grps *lgrps, char *page) | 1119 | char *page) |
1297 | { | 1120 | { |
1298 | struct se_lun_acl *lacl = container_of(lgrps, | 1121 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1299 | struct se_lun_acl, ml_stat_grps); | ||
1300 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1122 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1301 | struct se_dev_entry *deve; | 1123 | struct se_dev_entry *deve; |
1302 | ssize_t ret; | 1124 | ssize_t ret; |
@@ -1312,36 +1134,41 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_row_status( | |||
1312 | rcu_read_unlock(); | 1134 | rcu_read_unlock(); |
1313 | return ret; | 1135 | return ret; |
1314 | } | 1136 | } |
1315 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(row_status); | ||
1316 | 1137 | ||
1317 | CONFIGFS_EATTR_OPS(target_stat_scsi_auth_intr, se_ml_stat_grps, | 1138 | CONFIGFS_ATTR_RO(target_stat_auth_, inst); |
1318 | scsi_auth_intr_group); | 1139 | CONFIGFS_ATTR_RO(target_stat_auth_, dev); |
1140 | CONFIGFS_ATTR_RO(target_stat_auth_, port); | ||
1141 | CONFIGFS_ATTR_RO(target_stat_auth_, indx); | ||
1142 | CONFIGFS_ATTR_RO(target_stat_auth_, dev_or_port); | ||
1143 | CONFIGFS_ATTR_RO(target_stat_auth_, intr_name); | ||
1144 | CONFIGFS_ATTR_RO(target_stat_auth_, map_indx); | ||
1145 | CONFIGFS_ATTR_RO(target_stat_auth_, att_count); | ||
1146 | CONFIGFS_ATTR_RO(target_stat_auth_, num_cmds); | ||
1147 | CONFIGFS_ATTR_RO(target_stat_auth_, read_mbytes); | ||
1148 | CONFIGFS_ATTR_RO(target_stat_auth_, write_mbytes); | ||
1149 | CONFIGFS_ATTR_RO(target_stat_auth_, hs_num_cmds); | ||
1150 | CONFIGFS_ATTR_RO(target_stat_auth_, creation_time); | ||
1151 | CONFIGFS_ATTR_RO(target_stat_auth_, row_status); | ||
1319 | 1152 | ||
1320 | static struct configfs_attribute *target_stat_scsi_auth_intr_attrs[] = { | 1153 | static struct configfs_attribute *target_stat_scsi_auth_intr_attrs[] = { |
1321 | &target_stat_scsi_auth_intr_inst.attr, | 1154 | &target_stat_auth_attr_inst, |
1322 | &target_stat_scsi_auth_intr_dev.attr, | 1155 | &target_stat_auth_attr_dev, |
1323 | &target_stat_scsi_auth_intr_port.attr, | 1156 | &target_stat_auth_attr_port, |
1324 | &target_stat_scsi_auth_intr_indx.attr, | 1157 | &target_stat_auth_attr_indx, |
1325 | &target_stat_scsi_auth_intr_dev_or_port.attr, | 1158 | &target_stat_auth_attr_dev_or_port, |
1326 | &target_stat_scsi_auth_intr_intr_name.attr, | 1159 | &target_stat_auth_attr_intr_name, |
1327 | &target_stat_scsi_auth_intr_map_indx.attr, | 1160 | &target_stat_auth_attr_map_indx, |
1328 | &target_stat_scsi_auth_intr_att_count.attr, | 1161 | &target_stat_auth_attr_att_count, |
1329 | &target_stat_scsi_auth_intr_num_cmds.attr, | 1162 | &target_stat_auth_attr_num_cmds, |
1330 | &target_stat_scsi_auth_intr_read_mbytes.attr, | 1163 | &target_stat_auth_attr_read_mbytes, |
1331 | &target_stat_scsi_auth_intr_write_mbytes.attr, | 1164 | &target_stat_auth_attr_write_mbytes, |
1332 | &target_stat_scsi_auth_intr_hs_num_cmds.attr, | 1165 | &target_stat_auth_attr_hs_num_cmds, |
1333 | &target_stat_scsi_auth_intr_creation_time.attr, | 1166 | &target_stat_auth_attr_creation_time, |
1334 | &target_stat_scsi_auth_intr_row_status.attr, | 1167 | &target_stat_auth_attr_row_status, |
1335 | NULL, | 1168 | NULL, |
1336 | }; | 1169 | }; |
1337 | 1170 | ||
1338 | static struct configfs_item_operations target_stat_scsi_auth_intr_attrib_ops = { | ||
1339 | .show_attribute = target_stat_scsi_auth_intr_attr_show, | ||
1340 | .store_attribute = target_stat_scsi_auth_intr_attr_store, | ||
1341 | }; | ||
1342 | |||
1343 | static struct config_item_type target_stat_scsi_auth_intr_cit = { | 1171 | static struct config_item_type target_stat_scsi_auth_intr_cit = { |
1344 | .ct_item_ops = &target_stat_scsi_auth_intr_attrib_ops, | ||
1345 | .ct_attrs = target_stat_scsi_auth_intr_attrs, | 1172 | .ct_attrs = target_stat_scsi_auth_intr_attrs, |
1346 | .ct_owner = THIS_MODULE, | 1173 | .ct_owner = THIS_MODULE, |
1347 | }; | 1174 | }; |
@@ -1350,25 +1177,17 @@ static struct config_item_type target_stat_scsi_auth_intr_cit = { | |||
1350 | * SCSI Attached Initiator Port Table | 1177 | * SCSI Attached Initiator Port Table |
1351 | */ | 1178 | */ |
1352 | 1179 | ||
1353 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_att_intr_port, se_ml_stat_grps); | 1180 | static struct se_lun_acl *iport_to_lacl(struct config_item *item) |
1354 | #define DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR(_name, _mode) \ | 1181 | { |
1355 | static struct target_stat_scsi_att_intr_port_attribute \ | 1182 | struct se_ml_stat_grps *lgrps = container_of(to_config_group(item), |
1356 | target_stat_scsi_att_intr_port_##_name = \ | 1183 | struct se_ml_stat_grps, scsi_att_intr_port_group); |
1357 | __CONFIGFS_EATTR(_name, _mode, \ | 1184 | return container_of(lgrps, struct se_lun_acl, ml_stat_grps); |
1358 | target_stat_scsi_att_intr_port_show_attr_##_name, \ | 1185 | } |
1359 | target_stat_scsi_att_intr_port_store_attr_##_name); | 1186 | |
1360 | 1187 | static ssize_t target_stat_iport_inst_show(struct config_item *item, | |
1361 | #define DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(_name) \ | 1188 | char *page) |
1362 | static struct target_stat_scsi_att_intr_port_attribute \ | 1189 | { |
1363 | target_stat_scsi_att_intr_port_##_name = \ | 1190 | struct se_lun_acl *lacl = iport_to_lacl(item); |
1364 | __CONFIGFS_EATTR_RO(_name, \ | ||
1365 | target_stat_scsi_att_intr_port_show_attr_##_name); | ||
1366 | |||
1367 | static ssize_t target_stat_scsi_att_intr_port_show_attr_inst( | ||
1368 | struct se_ml_stat_grps *lgrps, char *page) | ||
1369 | { | ||
1370 | struct se_lun_acl *lacl = container_of(lgrps, | ||
1371 | struct se_lun_acl, ml_stat_grps); | ||
1372 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1191 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1373 | struct se_dev_entry *deve; | 1192 | struct se_dev_entry *deve; |
1374 | struct se_portal_group *tpg; | 1193 | struct se_portal_group *tpg; |
@@ -1387,13 +1206,11 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_inst( | |||
1387 | rcu_read_unlock(); | 1206 | rcu_read_unlock(); |
1388 | return ret; | 1207 | return ret; |
1389 | } | 1208 | } |
1390 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(inst); | ||
1391 | 1209 | ||
1392 | static ssize_t target_stat_scsi_att_intr_port_show_attr_dev( | 1210 | static ssize_t target_stat_iport_dev_show(struct config_item *item, |
1393 | struct se_ml_stat_grps *lgrps, char *page) | 1211 | char *page) |
1394 | { | 1212 | { |
1395 | struct se_lun_acl *lacl = container_of(lgrps, | 1213 | struct se_lun_acl *lacl = iport_to_lacl(item); |
1396 | struct se_lun_acl, ml_stat_grps); | ||
1397 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1214 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1398 | struct se_dev_entry *deve; | 1215 | struct se_dev_entry *deve; |
1399 | struct se_lun *lun; | 1216 | struct se_lun *lun; |
@@ -1411,13 +1228,11 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_dev( | |||
1411 | rcu_read_unlock(); | 1228 | rcu_read_unlock(); |
1412 | return ret; | 1229 | return ret; |
1413 | } | 1230 | } |
1414 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(dev); | ||
1415 | 1231 | ||
1416 | static ssize_t target_stat_scsi_att_intr_port_show_attr_port( | 1232 | static ssize_t target_stat_iport_port_show(struct config_item *item, |
1417 | struct se_ml_stat_grps *lgrps, char *page) | 1233 | char *page) |
1418 | { | 1234 | { |
1419 | struct se_lun_acl *lacl = container_of(lgrps, | 1235 | struct se_lun_acl *lacl = iport_to_lacl(item); |
1420 | struct se_lun_acl, ml_stat_grps); | ||
1421 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1236 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1422 | struct se_dev_entry *deve; | 1237 | struct se_dev_entry *deve; |
1423 | struct se_portal_group *tpg; | 1238 | struct se_portal_group *tpg; |
@@ -1435,13 +1250,11 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_port( | |||
1435 | rcu_read_unlock(); | 1250 | rcu_read_unlock(); |
1436 | return ret; | 1251 | return ret; |
1437 | } | 1252 | } |
1438 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(port); | ||
1439 | 1253 | ||
1440 | static ssize_t target_stat_scsi_att_intr_port_show_attr_indx( | 1254 | static ssize_t target_stat_iport_indx_show(struct config_item *item, |
1441 | struct se_ml_stat_grps *lgrps, char *page) | 1255 | char *page) |
1442 | { | 1256 | { |
1443 | struct se_lun_acl *lacl = container_of(lgrps, | 1257 | struct se_lun_acl *lacl = iport_to_lacl(item); |
1444 | struct se_lun_acl, ml_stat_grps); | ||
1445 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1258 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1446 | struct se_session *se_sess; | 1259 | struct se_session *se_sess; |
1447 | struct se_portal_group *tpg; | 1260 | struct se_portal_group *tpg; |
@@ -1461,13 +1274,11 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_indx( | |||
1461 | spin_unlock_irq(&nacl->nacl_sess_lock); | 1274 | spin_unlock_irq(&nacl->nacl_sess_lock); |
1462 | return ret; | 1275 | return ret; |
1463 | } | 1276 | } |
1464 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(indx); | ||
1465 | 1277 | ||
1466 | static ssize_t target_stat_scsi_att_intr_port_show_attr_port_auth_indx( | 1278 | static ssize_t target_stat_iport_port_auth_indx_show(struct config_item *item, |
1467 | struct se_ml_stat_grps *lgrps, char *page) | 1279 | char *page) |
1468 | { | 1280 | { |
1469 | struct se_lun_acl *lacl = container_of(lgrps, | 1281 | struct se_lun_acl *lacl = iport_to_lacl(item); |
1470 | struct se_lun_acl, ml_stat_grps); | ||
1471 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1282 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1472 | struct se_dev_entry *deve; | 1283 | struct se_dev_entry *deve; |
1473 | ssize_t ret; | 1284 | ssize_t ret; |
@@ -1483,13 +1294,11 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_port_auth_indx( | |||
1483 | rcu_read_unlock(); | 1294 | rcu_read_unlock(); |
1484 | return ret; | 1295 | return ret; |
1485 | } | 1296 | } |
1486 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(port_auth_indx); | ||
1487 | 1297 | ||
1488 | static ssize_t target_stat_scsi_att_intr_port_show_attr_port_ident( | 1298 | static ssize_t target_stat_iport_port_ident_show(struct config_item *item, |
1489 | struct se_ml_stat_grps *lgrps, char *page) | 1299 | char *page) |
1490 | { | 1300 | { |
1491 | struct se_lun_acl *lacl = container_of(lgrps, | 1301 | struct se_lun_acl *lacl = iport_to_lacl(item); |
1492 | struct se_lun_acl, ml_stat_grps); | ||
1493 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1302 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1494 | struct se_session *se_sess; | 1303 | struct se_session *se_sess; |
1495 | struct se_portal_group *tpg; | 1304 | struct se_portal_group *tpg; |
@@ -1513,28 +1322,25 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_port_ident( | |||
1513 | spin_unlock_irq(&nacl->nacl_sess_lock); | 1322 | spin_unlock_irq(&nacl->nacl_sess_lock); |
1514 | return ret; | 1323 | return ret; |
1515 | } | 1324 | } |
1516 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(port_ident); | ||
1517 | 1325 | ||
1518 | CONFIGFS_EATTR_OPS(target_stat_scsi_att_intr_port, se_ml_stat_grps, | 1326 | CONFIGFS_ATTR_RO(target_stat_iport_, inst); |
1519 | scsi_att_intr_port_group); | 1327 | CONFIGFS_ATTR_RO(target_stat_iport_, dev); |
1328 | CONFIGFS_ATTR_RO(target_stat_iport_, port); | ||
1329 | CONFIGFS_ATTR_RO(target_stat_iport_, indx); | ||
1330 | CONFIGFS_ATTR_RO(target_stat_iport_, port_auth_indx); | ||
1331 | CONFIGFS_ATTR_RO(target_stat_iport_, port_ident); | ||
1520 | 1332 | ||
1521 | static struct configfs_attribute *target_stat_scsi_ath_intr_port_attrs[] = { | 1333 | static struct configfs_attribute *target_stat_scsi_ath_intr_port_attrs[] = { |
1522 | &target_stat_scsi_att_intr_port_inst.attr, | 1334 | &target_stat_iport_attr_inst, |
1523 | &target_stat_scsi_att_intr_port_dev.attr, | 1335 | &target_stat_iport_attr_dev, |
1524 | &target_stat_scsi_att_intr_port_port.attr, | 1336 | &target_stat_iport_attr_port, |
1525 | &target_stat_scsi_att_intr_port_indx.attr, | 1337 | &target_stat_iport_attr_indx, |
1526 | &target_stat_scsi_att_intr_port_port_auth_indx.attr, | 1338 | &target_stat_iport_attr_port_auth_indx, |
1527 | &target_stat_scsi_att_intr_port_port_ident.attr, | 1339 | &target_stat_iport_attr_port_ident, |
1528 | NULL, | 1340 | NULL, |
1529 | }; | 1341 | }; |
1530 | 1342 | ||
1531 | static struct configfs_item_operations target_stat_scsi_att_intr_port_attrib_ops = { | ||
1532 | .show_attribute = target_stat_scsi_att_intr_port_attr_show, | ||
1533 | .store_attribute = target_stat_scsi_att_intr_port_attr_store, | ||
1534 | }; | ||
1535 | |||
1536 | static struct config_item_type target_stat_scsi_att_intr_port_cit = { | 1343 | static struct config_item_type target_stat_scsi_att_intr_port_cit = { |
1537 | .ct_item_ops = &target_stat_scsi_att_intr_port_attrib_ops, | ||
1538 | .ct_attrs = target_stat_scsi_ath_intr_port_attrs, | 1344 | .ct_attrs = target_stat_scsi_ath_intr_port_attrs, |
1539 | .ct_owner = THIS_MODULE, | 1345 | .ct_owner = THIS_MODULE, |
1540 | }; | 1346 | }; |