| 1 |
/* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "basic-forward.h" |
| 5 |
|
| 6 |
/* |
| 7 |
* Copyright © IBM Corp. 2003 |
| 8 |
*/ |
| 9 |
|
| 10 |
#define MAX_PATH_LEN 512 |
| 11 |
|
| 12 |
/* |
| 13 |
* MAX_ATTR_LEN: maximum length of the result of reading a sysfs |
| 14 |
* attribute. |
| 15 |
*/ |
| 16 |
#define MAX_ATTR_LEN 256 |
| 17 |
|
| 18 |
/* |
| 19 |
* MAX_SERIAL_LEN: the maximum length of the serial number, including |
| 20 |
* added prefixes such as vendor and product (model) strings. |
| 21 |
*/ |
| 22 |
#define MAX_SERIAL_LEN 512 |
| 23 |
|
| 24 |
/* |
| 25 |
* MAX_BUFFER_LEN: maximum buffer size and line length used while reading |
| 26 |
* the config file. |
| 27 |
*/ |
| 28 |
#define MAX_BUFFER_LEN 256 |
| 29 |
|
| 30 |
struct scsi_id_device { |
| 31 |
char vendor[9]; |
| 32 |
char model[17]; |
| 33 |
char revision[5]; |
| 34 |
char kernel[64]; |
| 35 |
char serial[MAX_SERIAL_LEN]; |
| 36 |
char serial_short[MAX_SERIAL_LEN]; |
| 37 |
unsigned type; |
| 38 |
int use_sg; |
| 39 |
|
| 40 |
/* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */ |
| 41 |
char unit_serial_number[MAX_SERIAL_LEN]; |
| 42 |
|
| 43 |
/* NULs if not set - otherwise hex encoding using lower-case e.g. '50014ee0016eb572' */ |
| 44 |
char wwn[17]; |
| 45 |
|
| 46 |
/* NULs if not set - otherwise hex encoding using lower-case e.g. '0xe00000d80000' */ |
| 47 |
char wwn_vendor_extension[17]; |
| 48 |
|
| 49 |
/* NULs if not set - otherwise decimal number */ |
| 50 |
char tgpt_group[8]; |
| 51 |
}; |
| 52 |
|
| 53 |
int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname); |
| 54 |
int scsi_get_serial(struct scsi_id_device *dev_scsi, const char *devname, |
| 55 |
int page_code, size_t len); |
| 56 |
|
| 57 |
/* |
| 58 |
* Page code values. |
| 59 |
*/ |
| 60 |
enum page_code { |
| 61 |
PAGE_83_PRE_SPC3 = -0x83, |
| 62 |
PAGE_UNSPECIFIED = 0x00, |
| 63 |
PAGE_80 = 0x80, |
| 64 |
PAGE_83 = 0x83, |
| 65 |
}; |