mirror of
https://github.com/systemd/systemd.git
synced 2025-02-18 21:57:48 +03:00
tree-wide: Use devnum helpers in a few more places
This commit is contained in:
parent
18f806b8d9
commit
3a4e4fface
@ -6,6 +6,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "devnum-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "libudev-list-internal.h"
|
||||
#include "libudev-util.h"
|
||||
@ -128,7 +129,7 @@ static void test_device_devnum(struct udev *udev) {
|
||||
dev_t devnum = makedev(1, 3);
|
||||
_cleanup_(udev_device_unrefp) struct udev_device *device;
|
||||
|
||||
log_info("/* %s, device %u:%u */", __func__, major(devnum), minor(devnum));
|
||||
log_info("/* %s, device " DEVNUM_FORMAT_STR " */", __func__, DEVNUM_FORMAT_VAL(devnum));
|
||||
|
||||
device = udev_device_new_from_devnum(udev, 'c', devnum);
|
||||
if (device)
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "bus-internal.h"
|
||||
#include "bus-locator.h"
|
||||
#include "cgroup-setup.h"
|
||||
#include "devnum-util.h"
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
@ -278,7 +279,7 @@ static int get_seat_from_display(const char *display, const char **seat, uint32_
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (asprintf(&sys_path, "/sys/dev/char/%u:%u", major(display_ctty), minor(display_ctty)) < 0)
|
||||
if (asprintf(&sys_path, "/sys/dev/char/" DEVNUM_FORMAT_STR, DEVNUM_FORMAT_VAL(display_ctty)) < 0)
|
||||
return -ENOMEM;
|
||||
r = readlink_value(sys_path, &tty);
|
||||
if (r < 0)
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <unistd.h>
|
||||
#include <linux/watchdog.h>
|
||||
|
||||
#include "devnum-util.h"
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
@ -52,7 +53,7 @@ static int get_watchdog_sysfs_path(const char *filename, char **ret_path) {
|
||||
if (!S_ISCHR(st.st_mode))
|
||||
return -EBADF;
|
||||
|
||||
if (asprintf(ret_path, "/sys/dev/char/%u:%u/%s", major(st.st_rdev), minor(st.st_rdev), filename) < 0)
|
||||
if (asprintf(ret_path, "/sys/dev/char/"DEVNUM_FORMAT_STR"/%s", DEVNUM_FORMAT_VAL(st.st_rdev), filename) < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "devnum-util.h"
|
||||
#include "memory-util.h"
|
||||
#include "random-util.h"
|
||||
#include "scsi.h"
|
||||
@ -761,8 +762,7 @@ int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname) {
|
||||
err = 2;
|
||||
goto out;
|
||||
}
|
||||
sprintf(dev_scsi->kernel,"%u:%u", major(statbuf.st_rdev),
|
||||
minor(statbuf.st_rdev));
|
||||
format_devnum(statbuf.st_rdev, dev_scsi->kernel);
|
||||
|
||||
memzero(buf, SCSI_INQ_BUFF_LEN);
|
||||
err = scsi_inquiry(dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN);
|
||||
|
Loading…
x
Reference in New Issue
Block a user