scsi_id.h revision ed142bdb68fdcd5ce591152ce0ec9d29898fbac4
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen/*
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen * Copyright (C) IBM Corp. 2003
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen *
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen * This program is free software: you can redistribute it and/or modify
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen * it under the terms of the GNU General Public License as published by
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen * the Free Software Foundation, either version 2 of the License, or
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen * (at your option) any later version.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen *
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen * This program is distributed in the hope that it will be useful,
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen * but WITHOUT ANY WARRANTY; without even the implied warranty of
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen * GNU General Public License for more details.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen *
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen * You should have received a copy of the GNU General Public License
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen * along with this program. If not, see <http://www.gnu.org/licenses/>.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen */
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen#define MAX_PATH_LEN 512
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen/*
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen * MAX_ATTR_LEN: maximum length of the result of reading a sysfs
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * attribute.
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#define MAX_ATTR_LEN 256
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering/*
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ceLennart Poettering * MAX_SERIAL_LEN: the maximum length of the serial number, including
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * added prefixes such as vendor and product (model) strings.
3ffd4af22052963e7a29431721ee204e634bea75Lennart Poettering */
a5a807e63a50314e190e9166d8a453cd8dd258e3Zbigniew Jędrzejewski-Szmek#define MAX_SERIAL_LEN 256
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering
c004493cdefc1f43a3956ca529e8070f8d70be56Lennart Poettering/*
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * MAX_BUFFER_LEN: maximum buffer size and line length used while reading
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering * the config file.
822db23cfa98a9fbc48f41e11caafb6f1017e052Lennart Poettering */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering#define MAX_BUFFER_LEN 256
3df3e884ae1237ef0d4d23b0e80f4ffda95ac135Ronny Chevalier
39d8db043b599a7382f94bfc904d5e108af438bdLennart Poetteringstruct scsi_id_device {
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering char vendor[9];
5f402ae84bbc08fe8de5682e371b3f66c387da52Daniel Mack char model[17];
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering char revision[5];
f8dc7e343d903f053070d01f3273db819deee951Lennart Poettering char type[33];
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering char kernel[64];
8b43440b7ef4b81c69c31de7ff820dc07a780254Lennart Poettering char serial[MAX_SERIAL_LEN];
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering char serial_short[MAX_SERIAL_LEN];
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering int use_sg;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering char unit_serial_number[MAX_SERIAL_LEN];
1c4baffc1895809bae9ac36b670af90a4cb9cd7dTom Gundersen
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* NULs if not set - otherwise hex encoding using lower-case e.g. '50014ee0016eb572' */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering char wwn[17];
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* NULs if not set - otherwise hex encoding using lower-case e.g. '0xe00000d80000' */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering char wwn_vendor_extension[17];
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* NULs if not set - otherwise decimal number */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering char tgpt_group[8];
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering};
1c4baffc1895809bae9ac36b670af90a4cb9cd7dTom Gundersen
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint scsi_get_serial(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering int page_code, int len);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/*
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * Page code values.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringenum page_code {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering PAGE_83_PRE_SPC3 = -0x83,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering PAGE_UNSPECIFIED = 0x00,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering PAGE_80 = 0x80,
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering PAGE_83 = 0x83,
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering};
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering