mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
udev: use encode_devnode_name() instead of udev_util_encode_string()
As udev_util_encode_string() is a simple wrapper of encode_devnode_name().
This commit is contained in:
parent
c8eaaf69ac
commit
2b0f5113b4
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user