+/* SPDX-License-Identifier: GPL-2.0+ */
/*
* ata_id - reads product/serial number from ATA drives
*
- * Copyright (C) 2005-2008 Kay Sievers <kay@vrfy.org>
- * Copyright (C) 2009 Lennart Poettering <lennart@poettering.net>
- * Copyright (C) 2009-2010 David Zeuthen <zeuthen@gmail.com>
+ * Copyright © 2005-2008 Kay Sievers <kay@vrfy.org>
+ * Copyright © 2009-2010 David Zeuthen <zeuthen@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* device represented by @fd. If successful, then the result will be
* copied into @out_identify and @out_is_packet_device.
*
- * This routine is based on code from libatasmart, Copyright 2008
+ * This routine is based on code from libatasmart, Copyright © 2008
* Lennart Poettering, LGPL v2.1.
*
* Returns: 0 if the data was successfully obtained, otherwise
return ret;
}
-int main(int argc, char *argv[])
-{
- _cleanup_udev_unref_ struct udev *udev = NULL;
+int main(int argc, char *argv[]) {
+ _cleanup_(udev_unrefp) struct udev *udev = NULL;
struct hd_driveid id;
union {
uint8_t byte[512];
{}
};
+ log_set_target(LOG_TARGET_AUTO);
+ udev_parse_config();
log_parse_environment();
log_open();
*/
word = identify.wyde[76];
- if (word != 0x0000 && word != 0xffff) {
+ if (!IN_SET(word, 0x0000, 0xffff)) {
printf("ID_ATA_SATA=1\n");
/*
* If bit 2 of word 76 is set to one, then the device supports the Gen2
}
/* from Linux's include/linux/ata.h */
- if (identify.wyde[0] == 0x848a ||
- identify.wyde[0] == 0x844a ||
+ if (IN_SET(identify.wyde[0], 0x848a, 0x844a) ||
(identify.wyde[83] & 0xc004) == 0x4004)
printf("ID_ATA_CFA=1\n");
} else {