hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/target/target_core_stat.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*******************************************************************************
23 * Filename: target_core_stat.c
34 *
....@@ -7,20 +8,6 @@
78 * (c) Copyright 2006-2013 Datera, Inc.
89 *
910 * Nicholas A. Bellinger <nab@linux-iscsi.org>
10
- *
11
- * This program is free software; you can redistribute it and/or modify
12
- * it under the terms of the GNU General Public License as published by
13
- * the Free Software Foundation; either version 2 of the License, or
14
- * (at your option) any later version.
15
- *
16
- * This program is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU General Public License
22
- * along with this program; if not, write to the Free Software
23
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2411 *
2512 ******************************************************************************/
2613
....@@ -246,43 +233,25 @@
246233 static ssize_t target_stat_lu_vend_show(struct config_item *item, char *page)
247234 {
248235 struct se_device *dev = to_stat_lu_dev(item);
249
- int i;
250
- char str[sizeof(dev->t10_wwn.vendor)+1];
251236
252
- /* scsiLuVendorId */
253
- for (i = 0; i < sizeof(dev->t10_wwn.vendor); i++)
254
- str[i] = ISPRINT(dev->t10_wwn.vendor[i]) ?
255
- dev->t10_wwn.vendor[i] : ' ';
256
- str[i] = '\0';
257
- return snprintf(page, PAGE_SIZE, "%s\n", str);
237
+ return snprintf(page, PAGE_SIZE, "%-" __stringify(INQUIRY_VENDOR_LEN)
238
+ "s\n", dev->t10_wwn.vendor);
258239 }
259240
260241 static ssize_t target_stat_lu_prod_show(struct config_item *item, char *page)
261242 {
262243 struct se_device *dev = to_stat_lu_dev(item);
263
- int i;
264
- char str[sizeof(dev->t10_wwn.model)+1];
265244
266
- /* scsiLuProductId */
267
- for (i = 0; i < sizeof(dev->t10_wwn.model); i++)
268
- str[i] = ISPRINT(dev->t10_wwn.model[i]) ?
269
- dev->t10_wwn.model[i] : ' ';
270
- str[i] = '\0';
271
- return snprintf(page, PAGE_SIZE, "%s\n", str);
245
+ return snprintf(page, PAGE_SIZE, "%-" __stringify(INQUIRY_MODEL_LEN)
246
+ "s\n", dev->t10_wwn.model);
272247 }
273248
274249 static ssize_t target_stat_lu_rev_show(struct config_item *item, char *page)
275250 {
276251 struct se_device *dev = to_stat_lu_dev(item);
277
- int i;
278
- char str[sizeof(dev->t10_wwn.revision)+1];
279252
280
- /* scsiLuRevisionId */
281
- for (i = 0; i < sizeof(dev->t10_wwn.revision); i++)
282
- str[i] = ISPRINT(dev->t10_wwn.revision[i]) ?
283
- dev->t10_wwn.revision[i] : ' ';
284
- str[i] = '\0';
285
- return snprintf(page, PAGE_SIZE, "%s\n", str);
253
+ return snprintf(page, PAGE_SIZE, "%-" __stringify(INQUIRY_REVISION_LEN)
254
+ "s\n", dev->t10_wwn.revision);
286255 }
287256
288257 static ssize_t target_stat_lu_dev_type_show(struct config_item *item, char *page)
....@@ -612,7 +581,7 @@
612581 dev = rcu_dereference(lun->lun_se_dev);
613582 if (dev)
614583 ret = snprintf(page, PAGE_SIZE, "%sPort#%u\n",
615
- tpg->se_tpg_tfo->get_fabric_name(),
584
+ tpg->se_tpg_tfo->fabric_name,
616585 lun->lun_rtpi);
617586 rcu_read_unlock();
618587 return ret;
....@@ -767,7 +736,7 @@
767736 if (dev) {
768737 /* scsiTransportType */
769738 ret = snprintf(page, PAGE_SIZE, "scsiTransport%s\n",
770
- tpg->se_tpg_tfo->get_fabric_name());
739
+ tpg->se_tpg_tfo->fabric_name);
771740 }
772741 rcu_read_unlock();
773742 return ret;