Skip to contentSkip to conversation

main - device_id: ignore leading and trailing spaces for sys_wwid and sys_serial

PATCH David Teigland 1 participant 1 message Jun 15, 2023

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=228a8e8c1fd8e82a2e31a6060614dc3dd2f8bc51
Commit:        228a8e8c1fd8e82a2e31a6060614dc3dd2f8bc51
Parent:        f0b48a23d9d8b5d858be1772ea5c9083d235b3b3
Author:        David Teigland <[email protected]>
AuthorDate:    Thu Jun 15 13:58:48 2023 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Thu Jun 15 15:17:14 2023 -0500

device_id: ignore leading and trailing spaces for sys_wwid and sys_serial

Leading and trailing underscores are also ignored to handle device ids written by previous versions which replaced all spaces with underscores.

---
 lib/device/device.h               |   1 +
 lib/device/device_id.c            | 280 ++++++++++++++++++++++++--------------
 lib/device/parse_vpd.c            |  50 +++++++
 test/shell/devicesfile-vpd-ids.sh | 101 ++++++++++++--
 4 files changed, 313 insertions(+), 119 deletions(-)
lib/device/device.h +1 -0
index 446104218..84d87232b 100644
@@ -239,6 +239,7 @@ int dev_mpath_init(const char *config_wwids_file);
 void dev_mpath_exit(void);
 int parse_vpd_ids(const unsigned char *vpd_data, int vpd_datalen, struct dm_list *ids);
 int format_t10_id(const unsigned char *in, int in_bytes, unsigned char *out, int out_bytes);
+int format_general_id(const char *in, int in_bytes, unsigned char *out, int out_bytes);
 int parse_vpd_serial(const unsigned char *in, char *out, int outsize);
 
 /* dev_util */
lib/device/device_id.c +176 -104

418 lines not on this page · raw message

lib/device/parse_vpd.c +50 -0

57 lines not on this page · raw message

test/shell/devicesfile-vpd-ids.sh +86 -15

161 lines not on this page · raw message