2 * Copyright (C) IBM Corp. 2003
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #define MAX_PATH_LEN 512
23 * MAX_ATTR_LEN: maximum length of the result of reading a sysfs
26 #define MAX_ATTR_LEN 256
29 * MAX_SERIAL_LEN: the maximum length of the serial number, including
30 * added prefixes such as vendor and product (model) strings.
32 #define MAX_SERIAL_LEN 256
35 * MAX_BUFFER_LEN: maximum buffer size and line length used while reading
38 #define MAX_BUFFER_LEN 256
40 struct scsi_id_device {
46 char serial[MAX_SERIAL_LEN];
47 char serial_short[MAX_SERIAL_LEN];
50 /* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */
51 char unit_serial_number[MAX_SERIAL_LEN];
53 /* NULs if not set - otherwise hex encoding using lower-case e.g. '50014ee0016eb572' */
56 /* NULs if not set - otherwise hex encoding using lower-case e.g. '0xe00000d80000' */
57 char wwn_vendor_extension[17];
59 /* NULs if not set - otherwise decimal number */
63 int scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname);
64 int scsi_get_serial(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname,
65 int page_code, int len);
71 PAGE_83_PRE_SPC3 = -0x83,
72 PAGE_UNSPECIFIED = 0x00,