mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Valentina Manea <valentina.manea.m@gmail.com>
To: gregkh@linuxfoundation.org
Cc: tobias.polzer@fau.de, dominik.paulus@fau.de,
	ly80toro@cip.cs.fau.de, shuah.kh@samsung.com,
	ihadzic@research.bell-labs.com, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, devel@driverdev.osuosl.org,
	firefly@lists.rosedu.org, andy.grover@gmail.com,
	Valentina Manea <valentina.manea.m@gmail.com>
Subject: [PATCH 07/18] staging: usbip: userspace: move sysfs_utils to libsrc
Date: Sat,  8 Mar 2014 14:53:25 +0200	[thread overview]
Message-ID: <1394283216-1277-8-git-send-email-valentina.manea.m@gmail.com> (raw)
In-Reply-To: <1394283216-1277-1-git-send-email-valentina.manea.m@gmail.com>

Since it offers a API to both usbip tools and libusbip,
it is more appropriate to be place in the library.

Signed-off-by: Valentina Manea <valentina.manea.m@gmail.com>
---
 drivers/staging/usbip/userspace/libsrc/Makefile.am |  3 ++-
 .../staging/usbip/userspace/libsrc/sysfs_utils.c   | 31 ++++++++++++++++++++++
 .../staging/usbip/userspace/libsrc/sysfs_utils.h   |  8 ++++++
 drivers/staging/usbip/userspace/src/Makefile.am    |  4 +--
 drivers/staging/usbip/userspace/src/sysfs_utils.c  | 31 ----------------------
 drivers/staging/usbip/userspace/src/sysfs_utils.h  |  8 ------
 6 files changed, 42 insertions(+), 43 deletions(-)
 create mode 100644 drivers/staging/usbip/userspace/libsrc/sysfs_utils.c
 create mode 100644 drivers/staging/usbip/userspace/libsrc/sysfs_utils.h
 delete mode 100644 drivers/staging/usbip/userspace/src/sysfs_utils.c
 delete mode 100644 drivers/staging/usbip/userspace/src/sysfs_utils.h

diff --git a/drivers/staging/usbip/userspace/libsrc/Makefile.am b/drivers/staging/usbip/userspace/libsrc/Makefile.am
index 4921189..7c8f8a4 100644
--- a/drivers/staging/usbip/userspace/libsrc/Makefile.am
+++ b/drivers/staging/usbip/userspace/libsrc/Makefile.am
@@ -4,4 +4,5 @@ libusbip_la_LDFLAGS  = -version-info @LIBUSBIP_VERSION@
 
 lib_LTLIBRARIES := libusbip.la
 libusbip_la_SOURCES := names.c names.h usbip_host_driver.c usbip_host_driver.h \
-		       usbip_common.c usbip_common.h vhci_driver.c vhci_driver.h
+		       usbip_common.c usbip_common.h vhci_driver.c vhci_driver.h \
+		       sysfs_utils.c sysfs_utils.h
diff --git a/drivers/staging/usbip/userspace/libsrc/sysfs_utils.c b/drivers/staging/usbip/userspace/libsrc/sysfs_utils.c
new file mode 100644
index 0000000..36ac88e
--- /dev/null
+++ b/drivers/staging/usbip/userspace/libsrc/sysfs_utils.c
@@ -0,0 +1,31 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include "sysfs_utils.h"
+#include "usbip_common.h"
+
+int write_sysfs_attribute(const char *attr_path, const char *new_value,
+			  size_t len)
+{
+	int fd;
+	int length;
+
+	fd = open(attr_path, O_WRONLY);
+	if (fd < 0) {
+		dbg("error opening attribute %s", attr_path);
+		return -1;
+	}
+
+	length = write(fd, new_value, len);
+	if (length < 0) {
+		dbg("error writing to attribute %s", attr_path);
+		close(fd);
+		return -1;
+	}
+
+	close(fd);
+
+	return 0;
+}
diff --git a/drivers/staging/usbip/userspace/libsrc/sysfs_utils.h b/drivers/staging/usbip/userspace/libsrc/sysfs_utils.h
new file mode 100644
index 0000000..32ac1d1
--- /dev/null
+++ b/drivers/staging/usbip/userspace/libsrc/sysfs_utils.h
@@ -0,0 +1,8 @@
+
+#ifndef __SYSFS_UTILS_H
+#define __SYSFS_UTILS_H
+
+int write_sysfs_attribute(const char *attr_path, const char *new_value,
+			  size_t len);
+
+#endif
diff --git a/drivers/staging/usbip/userspace/src/Makefile.am b/drivers/staging/usbip/userspace/src/Makefile.am
index 6c91bcb..e81a4eb 100644
--- a/drivers/staging/usbip/userspace/src/Makefile.am
+++ b/drivers/staging/usbip/userspace/src/Makefile.am
@@ -6,8 +6,6 @@ sbin_PROGRAMS := usbip usbipd
 
 usbip_SOURCES := usbip.h utils.h usbip.c utils.c usbip_network.c \
 		 usbip_attach.c usbip_detach.c usbip_list.c \
-		 usbip_bind.c usbip_unbind.c usbip_port.c \
-		 sysfs_utils.c
-
+		 usbip_bind.c usbip_unbind.c usbip_port.c
 
 usbipd_SOURCES := usbip_network.h usbipd.c usbip_network.c
diff --git a/drivers/staging/usbip/userspace/src/sysfs_utils.c b/drivers/staging/usbip/userspace/src/sysfs_utils.c
deleted file mode 100644
index 36ac88e..0000000
--- a/drivers/staging/usbip/userspace/src/sysfs_utils.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include "sysfs_utils.h"
-#include "usbip_common.h"
-
-int write_sysfs_attribute(const char *attr_path, const char *new_value,
-			  size_t len)
-{
-	int fd;
-	int length;
-
-	fd = open(attr_path, O_WRONLY);
-	if (fd < 0) {
-		dbg("error opening attribute %s", attr_path);
-		return -1;
-	}
-
-	length = write(fd, new_value, len);
-	if (length < 0) {
-		dbg("error writing to attribute %s", attr_path);
-		close(fd);
-		return -1;
-	}
-
-	close(fd);
-
-	return 0;
-}
diff --git a/drivers/staging/usbip/userspace/src/sysfs_utils.h b/drivers/staging/usbip/userspace/src/sysfs_utils.h
deleted file mode 100644
index 32ac1d1..0000000
--- a/drivers/staging/usbip/userspace/src/sysfs_utils.h
+++ /dev/null
@@ -1,8 +0,0 @@
-
-#ifndef __SYSFS_UTILS_H
-#define __SYSFS_UTILS_H
-
-int write_sysfs_attribute(const char *attr_path, const char *new_value,
-			  size_t len);
-
-#endif
-- 
1.8.1.2


  parent reply	other threads:[~2014-03-08 12:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-08 12:53 [PATCH 00/18] Resend of usbip-utils migration patches and various other fixes Valentina Manea
2014-03-08 12:53 ` [PATCH 01/18] staging: usbip: userspace: migrate usbip_bind to libudev Valentina Manea
2014-03-08 12:53 ` [PATCH 02/18] staging: usbip: userspace: remove useless libsysfs includes Valentina Manea
2014-03-08 12:53 ` [PATCH 03/18] staging: usbip: userspace: migrate usbip_unbind to libudev Valentina Manea
2014-03-08 12:53 ` [PATCH 04/18] staging: usbip: userspace: migrate usbip_list " Valentina Manea
2014-03-08 12:53 ` [PATCH 05/18] staging: usbip: userspace: re-add interface information listing Valentina Manea
2014-03-08 12:53 ` [PATCH 06/18] staging: usbip: userspace: add new list API Valentina Manea
2014-03-08 12:53 ` Valentina Manea [this message]
2014-03-08 12:53 ` [PATCH 08/18] staging: usbip: userspace: migrate usbip_host_driver to libudev Valentina Manea
2014-03-08 12:53 ` [PATCH 09/18] staging: usbip: userspace: remove class device infrastructure in vhci_driver Valentina Manea
2014-03-08 12:53 ` [PATCH 10/18] staging: usbip: userspace: migrate vhci_driver to libudev Valentina Manea
2014-03-08 12:53 ` [PATCH 11/18] staging: usbip: userspace: remove libsysfs flag and autoconf check Valentina Manea
2014-03-08 12:53 ` [PATCH 12/18] staging: usbip: userspace: update dependencies in README Valentina Manea
2014-03-08 12:53 ` [PATCH 13/18] staging: usbip: userspace: increase version to 2.0 Valentina Manea
2014-03-08 12:53 ` [PATCH 14/18] staging: usbip: let client choose device configuration Valentina Manea
2014-03-08 12:53 ` [PATCH 15/18] staging: usbip: trigger driver probing after unbinding from usbip-host Valentina Manea
2014-03-08 12:53 ` [PATCH 16/18] staging: usbip: claim ports used by shared devices Valentina Manea
2014-03-08 12:53 ` [PATCH 17/18] staging: usbip: userspace: don't throw error when trying to read configuration specific attributes Valentina Manea
2014-03-08 12:53 ` [PATCH 18/18] staging: usbip: userspace: add hwdata as optional dependency in README Valentina Manea
2014-03-09  6:50 ` [PATCH 00/18] Resend of usbip-utils migration patches and various other fixes Greg KH
2014-03-09 15:53   ` Valentina Manea
2014-03-09 16:58     ` Greg KH

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=1394283216-1277-8-git-send-email-valentina.manea.m@gmail.com \
    --to=valentina.manea.m@gmail.com \
    --cc=andy.grover@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dominik.paulus@fau.de \
    --cc=firefly@lists.rosedu.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ihadzic@research.bell-labs.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ly80toro@cip.cs.fau.de \
    --cc=shuah.kh@samsung.com \
    --cc=tobias.polzer@fau.de \
    /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®