chiark / gitweb /
4536cfd4f2596f260aa277296837d68c5f6fa21d
[elogind.git] / extras / scsi_id / scsi_id.h
1 /*
2  * scsi_id.h
3  *
4  * General defines and such for scsi_id
5  *
6  * Copyright (C) IBM Corp. 2003
7  *
8  *      This program is free software; you can redistribute it and/or modify it
9  *      under the terms of the GNU General Public License as published by the
10  *      Free Software Foundation version 2 of the License.
11  */
12
13 #define MAX_PATH_LEN    512
14
15 /*
16  * MAX_ATTR_LEN: maximum length of the result of reading a sysfs
17  * attribute.
18  */
19 #define MAX_ATTR_LEN    256
20
21 /*
22  * MAX_SERIAL_LEN: the maximum length of the serial number, including
23  * added prefixes such as vendor and product (model) strings.
24  */
25 #define MAX_SERIAL_LEN  256
26
27 /*
28  * MAX_BUFFER_LEN: maximum buffer size and line length used while reading
29  * the config file.
30  */
31 #define MAX_BUFFER_LEN  256
32
33 struct scsi_id_device {
34         char vendor[9];
35         char model[17];
36         char revision[5];
37         char type[33];
38         char kernel[64];
39         char serial[MAX_SERIAL_LEN];
40         char serial_short[MAX_SERIAL_LEN];
41         int use_sg;
42
43         /* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */
44         char unit_serial_number[MAX_SERIAL_LEN];
45
46         /* NULs if not set - otherwise hex encoding using lower-case e.g. '50014ee0016eb572' */
47         char wwn[17];
48 };
49
50 extern int scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname);
51 extern int scsi_get_serial (struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname,
52                             int page_code, int len);
53
54 /*
55  * Page code values.
56  */
57 enum page_code {
58                 PAGE_83_PRE_SPC3 = -0x83,
59                 PAGE_UNSPECIFIED = 0x00,
60                 PAGE_80          = 0x80,
61                 PAGE_83          = 0x83,
62 };
63