| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /******************************************************************************* |
|---|
| 2 | 3 | * Filename: target_core_stat.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 7 | 8 | * (c) Copyright 2006-2013 Datera, Inc. |
|---|
| 8 | 9 | * |
|---|
| 9 | 10 | * 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. |
|---|
| 24 | 11 | * |
|---|
| 25 | 12 | ******************************************************************************/ |
|---|
| 26 | 13 | |
|---|
| .. | .. |
|---|
| 246 | 233 | static ssize_t target_stat_lu_vend_show(struct config_item *item, char *page) |
|---|
| 247 | 234 | { |
|---|
| 248 | 235 | struct se_device *dev = to_stat_lu_dev(item); |
|---|
| 249 | | - int i; |
|---|
| 250 | | - char str[sizeof(dev->t10_wwn.vendor)+1]; |
|---|
| 251 | 236 | |
|---|
| 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); |
|---|
| 258 | 239 | } |
|---|
| 259 | 240 | |
|---|
| 260 | 241 | static ssize_t target_stat_lu_prod_show(struct config_item *item, char *page) |
|---|
| 261 | 242 | { |
|---|
| 262 | 243 | struct se_device *dev = to_stat_lu_dev(item); |
|---|
| 263 | | - int i; |
|---|
| 264 | | - char str[sizeof(dev->t10_wwn.model)+1]; |
|---|
| 265 | 244 | |
|---|
| 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); |
|---|
| 272 | 247 | } |
|---|
| 273 | 248 | |
|---|
| 274 | 249 | static ssize_t target_stat_lu_rev_show(struct config_item *item, char *page) |
|---|
| 275 | 250 | { |
|---|
| 276 | 251 | struct se_device *dev = to_stat_lu_dev(item); |
|---|
| 277 | | - int i; |
|---|
| 278 | | - char str[sizeof(dev->t10_wwn.revision)+1]; |
|---|
| 279 | 252 | |
|---|
| 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); |
|---|
| 286 | 255 | } |
|---|
| 287 | 256 | |
|---|
| 288 | 257 | static ssize_t target_stat_lu_dev_type_show(struct config_item *item, char *page) |
|---|
| .. | .. |
|---|
| 612 | 581 | dev = rcu_dereference(lun->lun_se_dev); |
|---|
| 613 | 582 | if (dev) |
|---|
| 614 | 583 | ret = snprintf(page, PAGE_SIZE, "%sPort#%u\n", |
|---|
| 615 | | - tpg->se_tpg_tfo->get_fabric_name(), |
|---|
| 584 | + tpg->se_tpg_tfo->fabric_name, |
|---|
| 616 | 585 | lun->lun_rtpi); |
|---|
| 617 | 586 | rcu_read_unlock(); |
|---|
| 618 | 587 | return ret; |
|---|
| .. | .. |
|---|
| 767 | 736 | if (dev) { |
|---|
| 768 | 737 | /* scsiTransportType */ |
|---|
| 769 | 738 | ret = snprintf(page, PAGE_SIZE, "scsiTransport%s\n", |
|---|
| 770 | | - tpg->se_tpg_tfo->get_fabric_name()); |
|---|
| 739 | + tpg->se_tpg_tfo->fabric_name); |
|---|
| 771 | 740 | } |
|---|
| 772 | 741 | rcu_read_unlock(); |
|---|
| 773 | 742 | return ret; |
|---|