diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-12-14 08:59:37 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-12-15 18:23:13 +0100 |
commit | 2b0f5113b45d0514477beecd0b5d6e5e21d5777b (patch) | |
tree | dac582d13b1e9abe8703312525818696405f225e /src/udev | |
parent | udev: rename UTIL_LINE_SIZE -> UDEV_LINE_SIZE and friends (diff) | |
download | systemd-2b0f5113b45d0514477beecd0b5d6e5e21d5777b.tar.xz systemd-2b0f5113b45d0514477beecd0b5d6e5e21d5777b.zip |
udev: use encode_devnode_name() instead of udev_util_encode_string()
As udev_util_encode_string() is a simple wrapper of
encode_devnode_name().
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/ata_id/ata_id.c | 3 | ||||
-rw-r--r-- | src/udev/scsi_id/scsi_id.c | 5 | ||||
-rw-r--r-- | src/udev/udev-builtin-usb_id.c | 9 |
3 files changed, 10 insertions, 7 deletions
diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c index 9d22be81b2..0a7df45761 100644 --- a/src/udev/ata_id/ata_id.c +++ b/src/udev/ata_id/ata_id.c @@ -23,6 +23,7 @@ #include <sys/types.h> #include <unistd.h> +#include "device-nodes.h" #include "fd-util.h" #include "libudev-util.h" #include "log.h" @@ -483,7 +484,7 @@ int main(int argc, char *argv[]) { memcpy(model, id.model, 40); model[40] = '\0'; - udev_util_encode_string(model, model_enc, sizeof(model_enc)); + encode_devnode_name(model, model_enc, sizeof(model_enc)); udev_replace_whitespace((char *) id.model, model, 40); udev_replace_chars(model, NULL); udev_replace_whitespace((char *) id.serial_no, serial, 20); diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c index 5d61e38d5e..f5856f2293 100644 --- a/src/udev/scsi_id/scsi_id.c +++ b/src/udev/scsi_id/scsi_id.c @@ -18,6 +18,7 @@ #include "alloc-util.h" #include "build.h" +#include "device-nodes.h" #include "fd-util.h" #include "libudev-util.h" #include "scsi_id.h" @@ -453,8 +454,8 @@ static int set_inq_values(struct scsi_id_device *dev_scsi, const char *path) { if (retval) return retval; - udev_util_encode_string(dev_scsi->vendor, vendor_enc_str, sizeof(vendor_enc_str)); - udev_util_encode_string(dev_scsi->model, model_enc_str, sizeof(model_enc_str)); + encode_devnode_name(dev_scsi->vendor, vendor_enc_str, sizeof(vendor_enc_str)); + encode_devnode_name(dev_scsi->model, model_enc_str, sizeof(model_enc_str)); udev_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)-1); udev_replace_chars(vendor_str, NULL); diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c index 75915ab39c..c0558561dc 100644 --- a/src/udev/udev-builtin-usb_id.c +++ b/src/udev/udev-builtin-usb_id.c @@ -15,6 +15,7 @@ #include <unistd.h> #include "alloc-util.h" +#include "device-nodes.h" #include "device-util.h" #include "fd-util.h" #include "libudev-util.h" @@ -329,7 +330,7 @@ static int builtin_usb_id(sd_device *dev, int argc, char *argv[], bool test) { log_device_debug_errno(dev_scsi, r, "Failed to get SCSI vendor attribute: %m"); goto fallback; } - udev_util_encode_string(scsi_vendor, vendor_str_enc, sizeof(vendor_str_enc)); + encode_devnode_name(scsi_vendor, vendor_str_enc, sizeof(vendor_str_enc)); udev_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); udev_replace_chars(vendor_str, NULL); @@ -338,7 +339,7 @@ static int builtin_usb_id(sd_device *dev, int argc, char *argv[], bool test) { log_device_debug_errno(dev_scsi, r, "Failed to get SCSI model attribute: %m"); goto fallback; } - udev_util_encode_string(scsi_model, model_str_enc, sizeof(model_str_enc)); + encode_devnode_name(scsi_model, model_str_enc, sizeof(model_str_enc)); udev_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); udev_replace_chars(model_str, NULL); @@ -379,7 +380,7 @@ fallback: if (sd_device_get_sysattr_value(dev_usb, "manufacturer", &usb_vendor) < 0) usb_vendor = vendor_id; - udev_util_encode_string(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc)); + encode_devnode_name(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc)); udev_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); udev_replace_chars(vendor_str, NULL); } @@ -389,7 +390,7 @@ fallback: if (sd_device_get_sysattr_value(dev_usb, "product", &usb_model) < 0) usb_model = product_id; - udev_util_encode_string(usb_model, model_str_enc, sizeof(model_str_enc)); + encode_devnode_name(usb_model, model_str_enc, sizeof(model_str_enc)); udev_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); udev_replace_chars(model_str, NULL); } |