summaryrefslogtreecommitdiff
path: root/src/udev/ata_id
Commit message (Collapse)AuthorAgeFilesLines
* udev/ata_id: use unliagned helpersZbigniew Jędrzejewski-Szmek2023-03-161-5/+6
| | | | | | The array is a union, aligned as uint16_t, so we were accessing fields at offsets of two, so we didn't do actually do unaligned access. But let's make this explicit.
* udev: implement --version in all builtinsZbigniew Jędrzejewski-Szmek2023-03-161-3/+8
| | | | | | | | | | | | | | | | Those are separate binaries, and occasionally people will get a misplaced binary that doesn't match the rest of the installed system and be confused, so it good to be able to check the version. It is also nice to have the same interface in all binaries. Note that we usually use a separate 'enum ARG_VERSION = 0x100' for an option without a short name. We can use a less verbose approach of simply taking any unused letter, which works just as well and even the compiler would warn us if we tried to use the letter in another place. This way we avoid a few lines of boilerplate. The help texts are adjusted to have an empty line between the synopsis and option list, and no empty lines after the option list.
* udev/ata_id: stop using errno, fix logicZbigniew Jędrzejewski-Szmek2023-03-161-118/+95
| | | | | | | | | | The code was setting errno, which we don't do, and which is hard to get right… Rework the code to use the usual negative-errno convention and add some debug logging. disk_scsi_inquiry_command() was working partially by accident: the v3 fallback would enter the v4 check path, and pass it because the v4 data would still be initialized to 0.
* udev/ata_id: drop unused output parameterZbigniew Jędrzejewski-Szmek2023-03-161-22/+10
|
* udev/ata_id: convert to run()Zbigniew Jędrzejewski-Szmek2023-03-151-10/+9
|
* udev/ata_id: split out parse_argv()Zbigniew Jędrzejewski-Szmek2023-03-151-37/+44
| | | | Beef up syntax and error messages a bit.
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-1/+1
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* ata_id: Fixed getting Response Code from SCSI Sense Data (#24921)Aleksey Vasenev2022-10-061-3/+3
| | | | | | The Response Code is contained in the first byte of the SCSI Sense Data. Bit number 7 is reserved or has a different meaning for some Response Codes and is set to 1 for some drives.
* udev: always open with O_NOCTTYYu Watanabe2022-09-101-1/+1
| | | | | All files or device nodes opened here should not be console tty. Let's open it the flags for safety.
* tree-wide: "a" -> "an"Yu Watanabe2021-06-301-1/+1
|
* udev: drop unnecessary libudev-util.h inclusionsYu Watanabe2020-12-161-1/+0
|
* udev: use encode_devnode_name() instead of udev_util_encode_string()Yu Watanabe2020-12-161-1/+2
| | | | | As udev_util_encode_string() is a simple wrapper of encode_devnode_name().
* udev: move util_replace_chars() to udev-util.cYu Watanabe2020-12-161-3/+3
|
* udev: move util_replace_whitespace() to udev-util.cYu Watanabe2020-12-161-3/+3
|
* license: GPL-2.0+ -> GPL-2.0-or-laterYu Watanabe2020-11-091-1/+1
|
* Remove unneded {}sZbigniew Jędrzejewski-Szmek2020-04-131-4/+2
| | | | | | $ perl -i -0pe 's|\s+{\n([^\n]*;)\n\s+}\n|\n\1\n|gms' **/*.c Inspired by ea7cbf5bdd68d7861ebf1570c439e8bbabd83f6c.
* ata_id: Add support for host managed zone block devices (#14933)Ryan Attard2020-02-271-1/+1
| | | | If the peripheral device type is that of a host managed zone block device (0x14), the device supports the same identification mechanisms as conventional disks (0x00).
* udev: do not hardcode program nameDavid Tardon2019-10-111-2/+3
|
* ata_id: Add check for fixed format sense codes (#13654)Ryan Attard2019-10-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original revisions of the SAT (SCSI-ATA Translation) specification required that all sense data be reported in Descriptor Format (72h). Later revisions specifcally allow and account for sense data being reported in Fixed Format (70h). The current code checks for a Descriptor Format sense structure (0x72), then looks specifically at the first byte of the first descriptor for the ATA specific code 0x9, cross referencing it with the first byte which is just a length field 0x0c (as a sanity check). In the Fixed Format case(0x70), we can fall back to using the top-level SCSI Sense data for the Additional Sense code (0x0) and then the Additional Sense Code Qualifier (0x1d), That identifies that the sense data is of the format associated with: `ATA PASS THROUGH INFORMATION AVAILABLE`. This fallback mechanism retains support for SATLs compliant with ANSI INCITS 431-2007, and enables support for Fixed Format Sense data enabled by SATLs with later revisions. Glad to do so. This patch allows ata_id to export attributes correctly. I believe that any drive can potentially return information in this format on any SATL using the libata-scsi (the Linux builtin SATL), but in this particular case, it appears it is the SATL itself. Attaching the disk to the AHCI controller changes the behavior impacted here. (Not entirely surprisingly, SATLs are are pretty inconsistent). Test: This case specifically is an LSI SATL. I'll illustrate that without the patch, ata_id does not return any output for a valid SATA drive but after the patch does. 1. Verify the device is ATA, by looking at the vpd page specific to ATA drives ``` root@machine:~# sg_vpd -p ai /dev/sdn ATA information VPD page: SAT Vendor identification: LSI SAT Product identification: LSI SATL SAT Product revision level: 0008 Device signature indicates SATA transport ATA command IDENTIFY DEVICE response summary: model: HGST HUH728080ALE604 serial number: ZZZZH3VX firmware revision: A4GNW7J0 ``` 2. Look at what udev thinks of the disk, it says ID_BUS=scsi ATA information says ID_MODEL should be HGST_HUH728080ALE604 udev says it is HGST_HUH728080AL (Missing E604, 4 bytes), and no ATA attributes are populated. ``` root@machine:~# udevadm info -q all /dev/sdn P: /devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn N: sdn S: disk/by-id/scsi-35000cca23be1dc3c S: disk/by-id/wwn-0x5000cca23be1dc3c S: disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0 E: DEVLINKS=/dev/disk/by-id/wwn-0x5000cca23be1dc3c /dev/disk/by-id/scsi-35000cca23be1dc3c /dev/disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0 E: DEVNAME=/dev/sdn E: DEVPATH=/devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn E: DEVTYPE=disk E: ID_BUS=scsi E: ID_MODEL=HGST_HUH728080AL E: ID_MODEL_ENC=HGST\x20HUH728080AL E: ID_PATH=pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0 E: ID_PATH_TAG=pci-0000_05_00_0-sas-exp0x500605b0000272bf-phy11-lun-0 E: ID_REVISION=W7J0 E: ID_SCSI=1 E: ID_SCSI_SERIAL=ZZZZH3VX E: ID_SERIAL=35000cca23be1dc3c E: ID_SERIAL_SHORT=5000cca23be1dc3c E: ID_TYPE=disk E: ID_VENDOR=ATA E: ID_VENDOR_ENC=ATA\x20\x20\x20\x20\x20 E: ID_WWN=0x5000cca23be1dc3c E: ID_WWN_WITH_EXTENSION=0x5000cca23be1dc3c E: MAJOR=8 E: MINOR=208 E: SUBSYSTEM=block E: TAGS=:systemd: ``` 3. Run ata_id (unpatched) (Outputs nothing, RC=2) ``` root@machine:~# strace -e ioctl /lib/udev/ata_id /dev/sdn -x ioctl(3, SG_IO, {'Q', BSG_PROTOCOL_SCSI, BSG_SUB_PROTOCOL_SCSI_CMD, request[6]=[12, 00, 00, 00, 24, 00], request_tag=0, request_attr=0, request_priority=0, request_extra=0, max_response_len=32, dout_iovec_count=0, dout_xfer_len=0, din_iovec_count=0, din_xfer_len=36, timeout=30000, flags=0, usr_ptr=0, spare_in=0, dout[0]=NULL}) = -1 EINVAL (Invalid argument) ioctl(3, SG_IO, {'S', SG_DXFER_FROM_DEV, cmd[6]=[12, 00, 00, 00, 24, 00], mx_sb_len=32, iovec_count=0, dxfer_len=36, timeout=30000, flags=0, data[36]=[00, 00, 06, 12, 45, 00, 00, 02, 41, 54, 41, 20, 20, 20, 20, 20, 48, 47, 53, 54, 20, 48, 55, 48, 37, 32, 38, 30, 38, 30, 41, 4c, ...], status=00, masked_status=00, sb[0]=[], host_status=0, driver_status=0, resid=0, duration=1, info=0}) = 0 ioctl(3, SG_IO, {'Q', BSG_PROTOCOL_SCSI, BSG_SUB_PROTOCOL_SCSI_CMD, request[12]=[a1, 08, 2e, 00, 01, 00, 00, 00, 00, ec, 00, 00], request_tag=0, request_attr=0, request_priority=0, request_extra=0, max_response_len=32, dout_iovec_count=0, dout_xfer_len=0, din_iovec_count=0, din_xfer_len=512, timeout=30000, flags=0, usr_ptr=0, spare_in=0, dout[0]=NULL}) = -1 EINVAL (Invalid argument) ioctl(3, SG_IO, {'S', SG_DXFER_FROM_DEV, cmd[12]=[a1, 08, 2e, 00, 01, 00, 00, 00, 00, ec, 00, 00], mx_sb_len=32, iovec_count=0, dxfer_len=512, timeout=30000, flags=0, data[0]=[], status=02, masked_status=01, sb[18]=[70, 00, 01, 00, 00, 00, 00, 0a, 00, 00, 00, 00, 00, 1d, 00, 00, 00, 00], host_status=0, driver_status=0x8, resid=512, duration=0, info=0x1}) = 0 ioctl(3, HDIO_GET_IDENTITY, 0x7ffe408f7590) = -1 EINVAL (Invalid argument) +++ exited with 2 +++ ``` Sense buffers visible with the strace: `sb[18]=[70, 00, 01, 00, 00, 00, 00, 0a, 00, 00, 00, 00, 00, 1d, 00, 00, 00, 00]` is the important bit, see 70, 0a and 1d bytes 4. Run patched version: model is HGST_HUH728080ALE604 as expected, ATA attributes are correctly populated. ``` root@machine:~# ./ata_id /dev/sdn -x ID_ATA=1 ID_TYPE=disk ID_BUS=ata ID_MODEL=HGST_HUH728080ALE604 ID_MODEL_ENC=HGST\x20HUH728080ALE604\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 ID_REVISION=A4GNW7J0 ID_SERIAL=HGST_HUH728080ALE604_ZZZZH3VX ID_SERIAL_SHORT=ZZZZH3VX ID_ATA_WRITE_CACHE=1 ID_ATA_WRITE_CACHE_ENABLED=1 ID_ATA_FEATURE_SET_HPA=1 ID_ATA_FEATURE_SET_HPA_ENABLED=1 ID_ATA_FEATURE_SET_PM=1 ID_ATA_FEATURE_SET_PM_ENABLED=1 ID_ATA_FEATURE_SET_SECURITY=1 ID_ATA_FEATURE_SET_SECURITY_ENABLED=0 ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=66522 ID_ATA_FEATURE_SET_SMART=1 ID_ATA_FEATURE_SET_SMART_ENABLED=1 ID_ATA_FEATURE_SET_PUIS=1 ID_ATA_FEATURE_SET_PUIS_ENABLED=0 ID_ATA_FEATURE_SET_APM=1 ID_ATA_FEATURE_SET_APM_ENABLED=1 ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=254 ID_ATA_DOWNLOAD_MICROCODE=1 ID_ATA_SATA=1 ID_ATA_SATA_SIGNAL_RATE_GEN2=1 ID_ATA_SATA_SIGNAL_RATE_GEN1=1 ID_ATA_ROTATION_RATE_RPM=7200 ID_WWN=0x5000cca23be1dc3c ID_WWN_WITH_EXTENSION=0x5000cca23be1dc3c ``` 5. Drop it in place and verify: we see that ata_id does work. ``` root@hw1-b01left-2212a:~# udevadm test /block/sdn <truncated> GROUP 6 /lib/udev/rules.d/50-udev-default.rules:55 IMPORT 'ata_id --export /dev/sdn' /lib/udev/rules.d/60-persistent-storage.rules:33 starting 'ata_id --export /dev/sdn' 'ata_id --export /dev/sdn'(out) 'ID_ATA=1' 'ata_id --export /dev/sdn'(out) 'ID_TYPE=disk' 'ata_id --export /dev/sdn'(out) 'ID_BUS=ata' 'ata_id --export /dev/sdn'(out) 'ID_MODEL=HGST_HUH728080ALE604' 'ata_id --export /dev/sdn'(out) 'ID_MODEL_ENC=HGST\x20HUH728080ALE604\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20' 'ata_id --export /dev/sdn'(out) 'ID_REVISION=A4GNW7J0' 'ata_id --export /dev/sdn'(out) 'ID_SERIAL=HGST_HUH728080ALE604_ZZZZH3VX' 'ata_id --export /dev/sdn'(out) 'ID_SERIAL_SHORT=ZZZZH3VX' 'ata_id --export /dev/sdn'(out) 'ID_ATA_WRITE_CACHE=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_WRITE_CACHE_ENABLED=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_HPA=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_HPA_ENABLED=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_PM=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_PM_ENABLED=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_SECURITY=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_SECURITY_ENABLED=0' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=66522' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_SMART=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_SMART_ENABLED=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_PUIS=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_PUIS_ENABLED=0' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_APM=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_APM_ENABLED=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=254' 'ata_id --export /dev/sdn'(out) 'ID_ATA_DOWNLOAD_MICROCODE=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_SATA=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_SATA_SIGNAL_RATE_GEN2=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_SATA_SIGNAL_RATE_GEN1=1' 'ata_id --export /dev/sdn'(out) 'ID_ATA_ROTATION_RATE_RPM=7200' 'ata_id --export /dev/sdn'(out) 'ID_WWN=0x5000cca23be1dc3c' 'ata_id --export /dev/sdn'(out) 'ID_WWN_WITH_EXTENSION=0x5000cca23be1dc3c' Process 'ata_id --export /dev/sdn' succeeded. LINK 'disk/by-id/ata-HGST_HUH728080ALE604_ZZZZH3VX' /lib/udev/rules.d/60-persistent-storage.rules:47 IMPORT builtin 'path_id' /lib/udev/rules.d/60-persistent-storage.rules:65 LINK 'disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0' /lib/udev/rules.d/60-persistent-storage.rules:66 IMPORT builtin 'blkid' /lib/udev/rules.d/60-persistent-storage.rules:81 probe /dev/sdn raid offset=0 LINK 'disk/by-id/wwn-0x5000cca23be1dc3c' /lib/udev/rules.d/60-persistent-storage.rules:88 RUN '/usr/lib/python-dsnet-appliance/hotplug disk udev-disk-add' /etc/udev/rules.d/99-appliance-hotplug.rules:1 update old name, '/dev/disk/by-id/scsi-35000cca23be1dc3c' no longer belonging to '/devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn' no reference left, remove '/dev/disk/by-id/scsi-35000cca23be1dc3c' handling device node '/dev/sdn', devnum=b8:208, mode=0660, uid=0, gid=6 preserve permissions /dev/sdn, 060660, uid=0, gid=6 preserve already existing symlink '/dev/block/8:208' to '../sdn' creating link '/dev/disk/by-id/ata-HGST_HUH728080ALE604_ZZZZH3VX' to '/dev/sdn' creating symlink '/dev/disk/by-id/ata-HGST_HUH728080ALE604_ZZZZH3VX' to '../../sdn' found 'b8:208' claiming '/run/udev/links/\x2fdisk\x2fby-id\x2fwwn-0x5000cca23be1dc3c' creating link '/dev/disk/by-id/wwn-0x5000cca23be1dc3c' to '/dev/sdn' preserve already existing symlink '/dev/disk/by-id/wwn-0x5000cca23be1dc3c' to '../../sdn' found 'b8:208' claiming '/run/udev/links/\x2fdisk\x2fby-path\x2fpci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0' creating link '/dev/disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0' to '/dev/sdn' preserve already existing symlink '/dev/disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0' to '../../sdn' created db file '/run/udev/data/b8:208' for '/devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn' ACTION=add DEVLINKS=/dev/disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0 /dev/disk/by-id/ata-HGST_HUH728080ALE604_ZZZZH3VX /dev/disk/by-id/wwn-0x5000cca23be1dc3c DEVNAME=/dev/sdn DEVPATH=/devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn DEVTYPE=disk ID_ATA=1 ID_ATA_DOWNLOAD_MICROCODE=1 ID_ATA_FEATURE_SET_APM=1 ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=254 ID_ATA_FEATURE_SET_APM_ENABLED=1 ID_ATA_FEATURE_SET_HPA=1 ID_ATA_FEATURE_SET_HPA_ENABLED=1 ID_ATA_FEATURE_SET_PM=1 ID_ATA_FEATURE_SET_PM_ENABLED=1 ID_ATA_FEATURE_SET_PUIS=1 ID_ATA_FEATURE_SET_PUIS_ENABLED=0 ID_ATA_FEATURE_SET_SECURITY=1 ID_ATA_FEATURE_SET_SECURITY_ENABLED=0 ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=66522 ID_ATA_FEATURE_SET_SMART=1 ID_ATA_FEATURE_SET_SMART_ENABLED=1 ID_ATA_ROTATION_RATE_RPM=7200 ID_ATA_SATA=1 ID_ATA_SATA_SIGNAL_RATE_GEN1=1 ID_ATA_SATA_SIGNAL_RATE_GEN2=1 ID_ATA_WRITE_CACHE=1 ID_ATA_WRITE_CACHE_ENABLED=1 ID_BUS=ata ID_MODEL=HGST_HUH728080ALE604 ID_MODEL_ENC=HGST\x20HUH728080ALE604\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 ID_PATH=pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0 ID_PATH_TAG=pci-0000_05_00_0-sas-exp0x500605b0000272bf-phy11-lun-0 ID_REVISION=A4GNW7J0 ID_SERIAL=HGST_HUH728080ALE604_ZZZZH3VX ID_SERIAL_SHORT=ZZZZH3VX ID_TYPE=disk ID_WWN=0x5000cca23be1dc3c ID_WWN_WITH_EXTENSION=0x5000cca23be1dc3c MAJOR=8 MINOR=208 SUBSYSTEM=block TAGS=:systemd: USEC_INITIALIZED=6055690 run: '/usr/lib/python-dsnet-appliance/hotplug disk udev-disk-add' Unload module index Unloaded link configuration context. ``` 6. Query just to double check: (ID_BUS=ata, model correct, etc). ``` root@machine:~# udevadm info /dev/sdn P: /devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn N: sdn S: disk/by-id/ata-HGST_HUH728080ALE604_ZZZZH3VX S: disk/by-id/wwn-0x5000cca23be1dc3c S: disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0 E: DEVLINKS=/dev/disk/by-id/wwn-0x5000cca23be1dc3c /dev/disk/by-path/pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0 /dev/disk/by-id/ata-HGST_HUH728080ALE604_ZZZZH3VX E: DEVNAME=/dev/sdn E: DEVPATH=/devices/pci0000:00/0000:00:03.0/0000:05:00.0/host2/port-2:0/expander-2:0/port-2:0:11/end_device-2:0:11/target2:0:11/2:0:11:0/block/sdn E: DEVTYPE=disk E: ID_ATA=1 E: ID_ATA_DOWNLOAD_MICROCODE=1 E: ID_ATA_FEATURE_SET_APM=1 E: ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=254 E: ID_ATA_FEATURE_SET_APM_ENABLED=1 E: ID_ATA_FEATURE_SET_HPA=1 E: ID_ATA_FEATURE_SET_HPA_ENABLED=1 E: ID_ATA_FEATURE_SET_PM=1 E: ID_ATA_FEATURE_SET_PM_ENABLED=1 E: ID_ATA_FEATURE_SET_PUIS=1 E: ID_ATA_FEATURE_SET_PUIS_ENABLED=0 E: ID_ATA_FEATURE_SET_SECURITY=1 E: ID_ATA_FEATURE_SET_SECURITY_ENABLED=0 E: ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=66522 E: ID_ATA_FEATURE_SET_SMART=1 E: ID_ATA_FEATURE_SET_SMART_ENABLED=1 E: ID_ATA_ROTATION_RATE_RPM=7200 E: ID_ATA_SATA=1 E: ID_ATA_SATA_SIGNAL_RATE_GEN1=1 E: ID_ATA_SATA_SIGNAL_RATE_GEN2=1 E: ID_ATA_WRITE_CACHE=1 E: ID_ATA_WRITE_CACHE_ENABLED=1 E: ID_BUS=ata E: ID_MODEL=HGST_HUH728080ALE604 E: ID_MODEL_ENC=HGST\x20HUH728080ALE604\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 E: ID_PATH=pci-0000:05:00.0-sas-exp0x500605b0000272bf-phy11-lun-0 E: ID_PATH_TAG=pci-0000_05_00_0-sas-exp0x500605b0000272bf-phy11-lun-0 E: ID_REVISION=A4GNW7J0 E: ID_SERIAL=HGST_HUH728080ALE604_ZZZZH3VX E: ID_SERIAL_SHORT=ZZZZH3VX E: ID_TYPE=disk E: ID_WWN=0x5000cca23be1dc3c E: ID_WWN_WITH_EXTENSION=0x5000cca23be1dc3c E: MAJOR=8 E: MINOR=208 E: SUBSYSTEM=block E: TAGS=:systemd: E: USEC_INITIALIZED=6055690 ``` If I install the same disk into a machine using an ATA driver, this behavior changes: ``` root@machine2:~# sg_vpd -p ai /dev/sdb ATA information VPD page: SAT Vendor identification: linux SAT Product identification: libata SAT Product revision level: 3.00 Device signature indicates SATA transport ATA command IDENTIFY DEVICE response summary: model: HGST HUH728080ALE604 serial number: ZZZZH3VX firmware revision: A4GNW7J0 root@machine-2:~# /lib/udev/ata_id -x /dev/sdb ID_ATA=1 ID_TYPE=disk ID_BUS=ata ID_MODEL=HGST_HUH728080ALE604 ID_MODEL_ENC=HGST\x20HUH728080ALE604\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 ID_REVISION=A4GNW7J0 <truncated> ```
* tree-wide: replace explicit NULL checks with their shorter variantsFrantisek Sumsal2019-04-281-2/+2
| | | | Done by coccinelle/equals-null.cocci
* util: split out memcmp()/memset() related calls into memory-util.[ch]Lennart Poettering2019-03-131-1/+1
| | | | Just some source rearranging.
* libudev-list: move libudev-list related definitions to libudev-list-internal.hYu Watanabe2018-11-201-1/+2
| | | | | This also rename libudev-private.h to libudev-util.h, and cleanups several unnecessary headers from udev.h and libudev-util.h
* tree-wide: replace 'unsigned int' with 'unsigned'Yu Watanabe2018-10-191-5/+5
|
* udev/ata_id: coding style fixesYu Watanabe2018-09-101-26/+27
|
* udev/ata_id: drop unused udev structYu Watanabe2018-09-101-13/+3
|
* tree-wide: drop empty lines in commentsYu Watanabe2018-07-231-1/+0
|
* tree-wide: drop some leftover header for Lennart PoetteringZbigniew Jędrzejewski-Szmek2018-07-031-2/+1
| | | | Follow-up for 0c697941389b7379c4471bc0a067ede02814bc57.
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-1/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* Drop more license boilerplateZbigniew Jędrzejewski-Szmek2018-06-141-12/+0
| | | | | | | | $ git grep -e 'This program is free software' -l |grep -v LICENSE | \ xargs perl -i -0pe 's/ \* This program.*?for more details.\s*\*\n( \* You should have.*licenses.>.\n)?//gms' For some reason they were missed previously. All those files seem to have proper SDPX tags.
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-1/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: use proper unicode © instead of (C) where we canLennart Poettering2018-06-141-3/+3
| | | | | | Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
* tree-wide: drop redundant _cleanup_ macros (#8810)Lennart Poettering2018-04-251-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This drops a good number of type-specific _cleanup_ macros, and patches all users to just use the generic ones. In most recent code we abstained from defining type-specific macros, and this basically removes all those added already, with the exception of the really low-level ones. Having explicit macros for this is not too useful, as the expression without the extra macro is generally just 2ch wider. We should generally emphesize generic code, unless there are really good reasons for specific code, hence let's follow this in this case too. Note that _cleanup_free_ and similar really low-level, libc'ish, Linux API'ish macros continue to be defined, only the really high-level OO ones are dropped. From now on this should really be the rule: for really low-level stuff, such as memory allocation, fd handling and so one, go ahead and define explicit per-type macros, but for high-level, specific program code, just use the generic _cleanup_() macro directly, in order to keep things simple and as readable as possible for the uninitiated. Note that before this patch some of the APIs (notable libudev ones) were already used with the high-level macros at some places and with the generic _cleanup_ macro at others. With this patch we hence unify on the latter.
* Add SPDX license identifiers to source files under the GPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
|
* tree-wide: use IN_SET macro (#6977)Yu Watanabe2017-10-041-3/+2
|
* build-sys: drop automake supportZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | | v2: - also mention m4
* Rip out setting of the log level from udev_new and put it in a new functionZbigniew Jędrzejewski-Szmek2017-05-071-0/+2
| | | | | | | | This function is internal to systemd code, so external users of libudev will not see those log messages. I think this is better. If we want to allow that, the function could be put in libudev and exported. v2: check that the string is more than one char before stripping quotes
* tree-wide: group include of libudev.h with sd-*Thomas Hindoe Paaboel Andersen2015-11-171-1/+2
|
* tree-wide: sort includesThomas Hindoe Paaboel Andersen2015-11-161-2/+1
| | | | Sort the includes accoding to the new coding style.
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-0/+1
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-11/+12
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* udev: ata_id - ATA_ID_SATA_CAPABILITY == 76Kay Sievers2015-09-221-5/+5
|
* Fixup WWN bytes for big-endian systemsTom Lyon2015-09-211-0/+4
|
* tree-wide: replace while(1) by for(;;) everywhereLennart Poettering2015-09-091-1/+1
| | | | Another Coccinelle script.
* ata_id: remove unused union memberThomas Hindoe Paaboel Andersen2015-07-251-1/+0
| | | | The last use of octa was removed in 01f61d331bb5038f0c877ac03c54333328b6ea28
* ata_id: unreverse WWN identifierZbigniew Jędrzejewski-Szmek2015-07-221-2/+12
| | | | | | | An endianness conversion was lost in 6024a6e302bad6bcf073fa84a41a6123305dc845. Restore it. Now ata_id and scsi_id output match. https://bugzilla.redhat.com/show_bug.cgi?id=1227503
* ata_id: unbotch format specifierJan Engelhardt2015-06-241-2/+2
| | | | | | | | | Commit v218-247-g11c6f69 broke the output of the utility. "%1$" PRIu64 "x" expands to "%1$lux", essentially "%lux", which shows the problem. u and x cannot be combined, u wins as the type character, and x gets emitted verbatim to stdout. References: https://bugzilla.redhat.com/show_bug.cgi?id=1227503
* ata_id: drop spurious spaceLennart Poettering2015-05-181-1/+1
|
* ata_id: remove unused header filesRobert Milasan2015-02-111-4/+0
| | | | Signed-off-by: Robert Milasan <rmilasan@suse.com>
* udev: improve help/usage for some more programsRobert Milasan2015-01-011-2/+2
|