From: matt mooney <mfm@muteddisk.com>
To: Greg Kroah-Hartman <greg@kroah.com>
Cc: Arjan Mels <arjan.mels@nxp.com>,
usbip-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH 3/6] staging: usbip: userspace: vhci_driver: parameterize path names
Date: Thu, 26 May 2011 06:17:10 -0700 [thread overview]
Message-ID: <e18fc63defbde358eb040d170f6739db0cec5726.1306414175.git.mfm@muteddisk.com> (raw)
In-Reply-To: <cover.1306414175.git.mfm@muteddisk.com>
Define a macro for the bus type and use libsysfs for class path.
Signed-off-by: matt mooney <mfm@muteddisk.com>
---
.../staging/usbip/userspace/libsrc/vhci_driver.c | 22 +++++++++++++++----
.../staging/usbip/userspace/libsrc/vhci_driver.h | 2 +-
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c
index 9296f96..f2030b1 100644
--- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c
+++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c
@@ -186,9 +186,20 @@ static int refresh_class_device_list(void)
int ret;
struct dlist *cname_list;
char *cname;
+ char sysfs_mntpath[SYSFS_PATH_MAX];
+ char class_path[SYSFS_PATH_MAX];
+
+ ret = sysfs_get_mnt_path(sysfs_mntpath, SYSFS_PATH_MAX);
+ if (ret < 0) {
+ err("sysfs must be mounted");
+ return -1;
+ }
+
+ snprintf(class_path, sizeof(class_path), "%s/%s", sysfs_mntpath,
+ SYSFS_CLASS_NAME);
/* search under /sys/class */
- cname_list = sysfs_open_directory_list("/sys/class");
+ cname_list = sysfs_open_directory_list(class_path);
if (!cname_list) {
err("open class directory");
return -1;
@@ -274,9 +285,9 @@ static int get_hc_busid(char *sysfs_mntpath, char *hc_busid)
int found = 0;
- snprintf(sdriver_path, SYSFS_PATH_MAX, "%s/%s/platform/%s/%s",
- sysfs_mntpath, SYSFS_BUS_NAME, SYSFS_DRIVERS_NAME,
- USBIP_VHCI_DRV_NAME);
+ snprintf(sdriver_path, SYSFS_PATH_MAX, "%s/%s/%s/%s/%s", sysfs_mntpath,
+ SYSFS_BUS_NAME, USBIP_VHCI_BUS_TYPE, SYSFS_DRIVERS_NAME,
+ USBIP_VHCI_DRV_NAME);
sdriver = sysfs_open_driver_path(sdriver_path);
if (!sdriver) {
@@ -333,7 +344,8 @@ int usbip_vhci_driver_open(void)
goto err;
/* will be freed in usbip_driver_close() */
- vhci_driver->hc_device = sysfs_open_device("platform", hc_busid);
+ vhci_driver->hc_device = sysfs_open_device(USBIP_VHCI_BUS_TYPE,
+ hc_busid);
if (!vhci_driver->hc_device) {
err("get sysfs vhci_driver");
goto err;
diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.h b/drivers/staging/usbip/userspace/libsrc/vhci_driver.h
index 3af41c5..3395586 100644
--- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.h
+++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.h
@@ -7,7 +7,7 @@
#include "usbip.h"
-
+#define USBIP_VHCI_BUS_TYPE "platform"
#define MAXNPORT 128
--
1.7.5.1
next prev parent reply other threads:[~2011-05-26 13:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-26 13:17 [PATCH 0/6] usbip: userspace improvements matt mooney
2011-05-26 13:17 ` [PATCH 1/6] staging: usbip: userspace: set kernel module names in one place matt mooney
2011-05-26 13:17 ` [PATCH 2/6] staging: usbip: userspace: change struct class_device to usbip_class_device matt mooney
2011-05-26 13:17 ` matt mooney [this message]
2011-05-26 13:17 ` [PATCH 4/6] staging: usbip: userspace tools v1.0.0 matt mooney
2011-05-26 13:17 ` [PATCH 5/6] staging: usbip: userspace: usbipd.c: add header into source file matt mooney
2011-05-26 13:17 ` [PATCH 6/6] staging: usbip: userspace: usbip_network: rename and cleanup function matt mooney
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=e18fc63defbde358eb040d170f6739db0cec5726.1306414175.git.mfm@muteddisk.com \
--to=mfm@muteddisk.com \
--cc=arjan.mels@nxp.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=usbip-devel@lists.sourceforge.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®