diff options
author | Damjan Marion <damarion@cisco.com> | 2023-08-07 01:07:09 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2023-08-07 18:00:10 +0000 |
commit | 40f481037ef98442b061e310a04ee5e110120f72 (patch) | |
tree | 20ecc6d1c7bcc701417b5bbbfd51cd2d1eadfa24 /src/vlib/linux/vmbus.c | |
parent | 993735913c6764d7a66c8fae4196a61206611186 (diff) |
vppinfra: add clib_file_get_resolved_basename
more generic version of clib_sysfs_link_to_name with support for
format strings...
Type: improvement
Change-Id: I0cb263748970378c661415196eb7e08450370677
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/linux/vmbus.c')
-rw-r--r-- | src/vlib/linux/vmbus.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/vlib/linux/vmbus.c b/src/vlib/linux/vmbus.c index aae11a1fefb..b0663819a45 100644 --- a/src/vlib/linux/vmbus.c +++ b/src/vlib/linux/vmbus.c @@ -253,16 +253,14 @@ vlib_vmbus_bind_to_uio (vlib_vmbus_addr_t * addr) static int uio_new_id_needed = 1; struct dirent *e; struct ifreq ifr; - u8 *s, *driver_name; + u8 *s = 0, *driver_name; DIR *dir; int fd; dev_dir_name = format (0, "%s/%U", sysfs_vmbus_dev_path, format_vlib_vmbus_addr, addr); - s = format (0, "%v/driver%c", dev_dir_name, 0); - driver_name = clib_sysfs_link_to_name ((char *) s); - vec_reset_length (s); + driver_name = clib_file_get_resolved_basename ("%v/driver", dev_dir_name); /* skip if not using the Linux kernel netvsc driver */ if (!driver_name || strcmp ("hv_netvsc", (char *) driver_name) != 0) |