All of lore.kernel.org
 help / color / mirror / Atom feed
From: mwilck@suse.com
To: Christophe Varoqui <christophe.varoqui@opensvc.com>,
	Benjamin Marzinski <bmarzins@redhat.com>
Cc: dm-devel@redhat.com, Martin Wilck <mwilck@suse.com>
Subject: [dm-devel] [PATCH 02/14] libmultipath: remove sysfs_get_binary()
Date: Wed,  6 Jul 2022 16:38:10 +0200	[thread overview]
Message-ID: <20220706143822.30182-3-mwilck@suse.com> (raw)
In-Reply-To: <20220706143822.30182-1-mwilck@suse.com>

From: Martin Wilck <mwilck@suse.com>

This function adds no value on top of sysfs_bin_attr_get_value().
Remove it.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/discovery.c | 26 ++------------------------
 tests/test-lib.c         |  1 -
 2 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 0d8a558..7e09e4e 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -263,41 +263,19 @@ declare_sysfs_get_str(vendor);
 declare_sysfs_get_str(model);
 declare_sysfs_get_str(rev);
 
-static ssize_t
-sysfs_get_binary (struct udev_device * udev, const char *attrname,
-		  unsigned char *buff, size_t len)
-{
-	ssize_t attr_len;
-	const char * devname;
-
-	if (!udev) {
-		condlog(3, "No udev device given\n");
-		return -ENOSYS;
-	}
-
-	devname = udev_device_get_sysname(udev);
-	attr_len = sysfs_bin_attr_get_value(udev, attrname, buff, len);
-	if (attr_len < 0) {
-		condlog(3, "%s: attribute %s not found in sysfs",
-			devname, attrname);
-		return attr_len;
-	}
-	return attr_len;
-}
-
 ssize_t sysfs_get_vpd(struct udev_device * udev, unsigned char pg,
 		      unsigned char *buff, size_t len)
 {
 	char attrname[9];
 
 	snprintf(attrname, sizeof(attrname), "vpd_pg%02x", pg);
-	return sysfs_get_binary(udev, attrname, buff, len);
+	return sysfs_bin_attr_get_value(udev, attrname, buff, len);
 }
 
 ssize_t sysfs_get_inquiry(struct udev_device * udev,
 			  unsigned char *buff, size_t len)
 {
-	return sysfs_get_binary(udev, "inquiry", buff, len);
+	return sysfs_bin_attr_get_value(udev, "inquiry", buff, len);
 }
 
 int
diff --git a/tests/test-lib.c b/tests/test-lib.c
index 6dd3ee8..0bc49d5 100644
--- a/tests/test-lib.c
+++ b/tests/test-lib.c
@@ -334,7 +334,6 @@ void mock_pathinfo(int mask, const struct mocked_path *mp)
 	if (mask & DI_SERIAL) {
 		will_return(__wrap_udev_device_get_subsystem, "scsi");
 		will_return(__wrap_udev_device_get_sysname, hbtl);
-		will_return(__wrap_udev_device_get_sysname, hbtl);
 	}
 
 	if (mask & DI_WWID) {
-- 
2.36.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  parent reply	other threads:[~2022-07-06 14:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06 14:38 [dm-devel] [PATCH 00/14] multipath: fixes for sysfs accessors mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 01/14] libmultipath: alua: remove get_sysfs_pg83() mwilck
2022-07-06 14:38 ` mwilck [this message]
2022-07-06 14:38 ` [dm-devel] [PATCH 03/14] libmultipath: sysfs_bin_attr_get_value(): no error if buffer is filled mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 04/14] libmultipath: common code path for sysfs_attr_get_value() mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 05/14] libmultipath: sanitize error checking in sysfs accessors mwilck
2022-07-12 19:07   ` Benjamin Marzinski
2022-07-06 14:38 ` [dm-devel] [PATCH 06/14] libmultipath: get rid of PATH_SIZE mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 07/14] libmultipath: sysfs_attr_get_value(): don't return 0 if buffer too small mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 08/14] libmultipath: sysfs_attr_set_value(): don't return 0 on partial write mwilck
2022-07-12 19:10   ` Benjamin Marzinski
2022-07-06 14:38 ` [dm-devel] [PATCH 09/14] libmultipath: sysfs: cleanup file descriptors on pthread_cancel() mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 10/14] libmultipath, multipathd: log failure setting sysfs attributes mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 11/14] multipath tests: expect_condlog: skip depending on verbosity mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 12/14] multipath tests: __wrap_dlog: print log message mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 13/14] multipath tests: add sysfs test mwilck
2022-07-06 14:38 ` [dm-devel] [PATCH 14/14] libmultipath.version: bump version for sysfs accessors mwilck
2022-07-12 19:11 ` [dm-devel] [PATCH 00/14] multipath: fixes " Benjamin Marzinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220706143822.30182-3-mwilck@suse.com \
    --to=mwilck@suse.com \
    --cc=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.