RE: [PATCH v4 2/3] usbip: vhci extension: modifications to userspace

2016-08-12 Thread fx IWATA NOBUO
> Please resend the patches you wish to have applied, in the order in which
> they need to be applied in.

OK.
I will resend them after fixing dynamically allocated sysfs attribute
checking error when CONFIG_DEBUG_LOCK_ALLOC is set.

Thank you,

n.iwata
//
> -Original Message-
> From: linux-usb-ow...@vger.kernel.org
> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Greg KH
> Sent: Thursday, August 11, 2016 4:56 PM
> To: fx IWATA NOBUO
> Cc: valentina.mane...@gmail.com; shuah...@samsung.com;
> linux-usb@vger.kernel.org; fx MICHIMURA TADAO
> Subject: Re: [PATCH v4 2/3] usbip: vhci extension: modifications to
> userspace
> 
> On Wed, Aug 10, 2016 at 07:25:09AM +, fx IWATA NOBUO wrote:
> > Dear Greg,
> >
> > I remembered the dependency.
> >
> > --- from the cover letter ---
> > 5. Dependencies
> >
> > This series depends on 'usbip: exporting devices' patch set because
> > this includes changes to application side daemon which introduced the
> > patch set.
> > ---
> >
> > I checked this patch set works well to the latest linux-next if it's
> > applied after exporting devices patch set.
> >
> > To change the dependency, ie. vhci extension patch set first, it takes
> > days.
> >
> > I responded to comments about exporting devices patch set today.
> >
> > Please, give me instruction.
> 
> Please resend the patches you wish to have applied, in the order in which
> they need to be applied in.
> 
> thanks,
> 
> greg k-h
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majord...@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 2/3] usbip: vhci extension: modifications to userspace

2016-08-11 Thread Greg KH
On Wed, Aug 10, 2016 at 07:25:09AM +, fx IWATA NOBUO wrote:
> Dear Greg,
> 
> I remembered the dependency.
> 
> --- from the cover letter ---
> 5. Dependencies
> 
> This series depends on 'usbip: exporting devices' patch set because this
> includes changes to application side daemon which introduced the patch
> set.
> ---
> 
> I checked this patch set works well to the latest linux-next if it's
> applied after exporting devices patch set.
> 
> To change the dependency, ie. vhci extension patch set first, it takes
> days.
> 
> I responded to comments about exporting devices patch set today.
> 
> Please, give me instruction.

Please resend the patches you wish to have applied, in the order in
which they need to be applied in.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v4 2/3] usbip: vhci extension: modifications to userspace

2016-08-10 Thread fx IWATA NOBUO
Dear Greg,

I remembered the dependency.

--- from the cover letter ---
5. Dependencies

This series depends on 'usbip: exporting devices' patch set because this
includes changes to application side daemon which introduced the patch
set.
---

I checked this patch set works well to the latest linux-next if it's
applied after exporting devices patch set.

To change the dependency, ie. vhci extension patch set first, it takes
days.

I responded to comments about exporting devices patch set today.

Please, give me instruction.

Best Regards,

n.iwata
//
> -Original Message-
> From: fx IWATA NOBUO
> Sent: Wednesday, August 10, 2016 9:36 AM
> To: 'Greg KH'
> Cc: valentina.mane...@gmail.com; shuah...@samsung.com;
> linux-usb@vger.kernel.org; fx MICHIMURA TADAO
> Subject: RE: [PATCH v4 2/3] usbip: vhci extension: modifications to
> userspace
> 
> > This patch does not apply to my tree, can you refresh the series and
> > resend it please?
> 
> Yes, I will send update.
> 
> Thank you,
> 
> n.iwata
> //
> > -Original Message-
> > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > Sent: Tuesday, August 09, 2016 11:21 PM
> > To: fx IWATA NOBUO
> > Cc: valentina.mane...@gmail.com; shuah...@samsung.com;
> > linux-usb@vger.kernel.org; fx MICHIMURA TADAO
> > Subject: Re: [PATCH v4 2/3] usbip: vhci extension: modifications to
> > userspace
> >
> > On Mon, Jun 13, 2016 at 11:33:41AM +0900, Nobuo Iwata wrote:
> > > Modification to the userspace tools including usbip/libsrc and
> > > usbip/src.
> > >
> > > Changed corresponding to new vhci_sysfs.c.
> > >
> > > nports in sysfs is used to get total number of ports.
> > >
> > > Old get_nports() ignores the last status line because
> > > udev_device_get_sysattr_value() drops last new line. New version
> > > uses nports attribute so it's doesn't have this problem.
> > >
> > > status[.N] in sysfs are used.
> > >
> > > parse_status() which reads all status lines is broken into open,
> > > close, read-line and parse-line. Parse-line is reused to find free
> > > port and get imported device.
> > >
> > > In daemon, status was loaded into memory by
> > > usbip_vhci_refresh_device_list() at receiving every request. The
> > > loaded status is used to find free port. It is changed to read
> > > status directly to find free port.
> > >
> > > Wording inconsistencies are fixed according to the rule below.
> > >
> > > rhport, HC_PORTS: ports within a controller (or root hub).
> > > port, nports: ports across the controllers.
> > >
> > > Signed-off-by: Nobuo Iwata <nobuo.iw...@fujixerox.co.jp>
> > > ---
> > >  tools/usb/usbip/libsrc/vhci_driver.c | 398
> > > +++  tools/usb/usbip/libsrc/vhci_driver.h |
> > 45 +--
> > >  tools/usb/usbip/src/usbip_attach.c   |   8 +-
> > >  tools/usb/usbip/src/usbip_port.c |  13 +-
> > >  tools/usb/usbip/src/usbipd_app.c |  49 ++--
> > >  5 files changed, 253 insertions(+), 260 deletions(-)
> >
> > This patch does not apply to my tree, can you refresh the series and
> > resend it please?
> >
> > thanks,
> >
> > greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v4 2/3] usbip: vhci extension: modifications to userspace

2016-08-09 Thread fx IWATA NOBUO
> This patch does not apply to my tree, can you refresh the series and resend
> it please?

Yes, I will send update.

Thank you,

n.iwata
//
> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Tuesday, August 09, 2016 11:21 PM
> To: fx IWATA NOBUO
> Cc: valentina.mane...@gmail.com; shuah...@samsung.com;
> linux-usb@vger.kernel.org; fx MICHIMURA TADAO
> Subject: Re: [PATCH v4 2/3] usbip: vhci extension: modifications to
> userspace
> 
> On Mon, Jun 13, 2016 at 11:33:41AM +0900, Nobuo Iwata wrote:
> > Modification to the userspace tools including usbip/libsrc and
> > usbip/src.
> >
> > Changed corresponding to new vhci_sysfs.c.
> >
> > nports in sysfs is used to get total number of ports.
> >
> > Old get_nports() ignores the last status line because
> > udev_device_get_sysattr_value() drops last new line. New version uses
> > nports attribute so it's doesn't have this problem.
> >
> > status[.N] in sysfs are used.
> >
> > parse_status() which reads all status lines is broken into open,
> > close, read-line and parse-line. Parse-line is reused to find free
> > port and get imported device.
> >
> > In daemon, status was loaded into memory by
> > usbip_vhci_refresh_device_list() at receiving every request. The
> > loaded status is used to find free port. It is changed to read status
> > directly to find free port.
> >
> > Wording inconsistencies are fixed according to the rule below.
> >
> > rhport, HC_PORTS: ports within a controller (or root hub).
> > port, nports: ports across the controllers.
> >
> > Signed-off-by: Nobuo Iwata <nobuo.iw...@fujixerox.co.jp>
> > ---
> >  tools/usb/usbip/libsrc/vhci_driver.c | 398
> > +++  tools/usb/usbip/libsrc/vhci_driver.h |
> 45 +--
> >  tools/usb/usbip/src/usbip_attach.c   |   8 +-
> >  tools/usb/usbip/src/usbip_port.c |  13 +-
> >  tools/usb/usbip/src/usbipd_app.c |  49 ++--
> >  5 files changed, 253 insertions(+), 260 deletions(-)
> 
> This patch does not apply to my tree, can you refresh the series and resend
> it please?
> 
> thanks,
> 
> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 2/3] usbip: vhci extension: modifications to userspace

2016-08-09 Thread Greg KH
On Mon, Jun 13, 2016 at 11:33:41AM +0900, Nobuo Iwata wrote:
> Modification to the userspace tools including usbip/libsrc and 
> usbip/src.
> 
> Changed corresponding to new vhci_sysfs.c.
> 
> nports in sysfs is used to get total number of ports. 
> 
> Old get_nports() ignores the last status line because 
> udev_device_get_sysattr_value() drops last new line. New version uses 
> nports attribute so it's doesn't have this problem.
> 
> status[.N] in sysfs are used.
> 
> parse_status() which reads all status lines is broken into open, close, 
> read-line and parse-line. Parse-line is reused to find free port and 
> get imported device.
> 
> In daemon, status was loaded into memory by 
> usbip_vhci_refresh_device_list() at receiving every request. The loaded 
> status is used to find free port. It is changed to read status directly 
> to find free port.
> 
> Wording inconsistencies are fixed according to the rule below.
> 
> rhport, HC_PORTS: ports within a controller (or root hub).
> port, nports: ports across the controllers.
> 
> Signed-off-by: Nobuo Iwata 
> ---
>  tools/usb/usbip/libsrc/vhci_driver.c | 398 +++
>  tools/usb/usbip/libsrc/vhci_driver.h |  45 +--
>  tools/usb/usbip/src/usbip_attach.c   |   8 +-
>  tools/usb/usbip/src/usbip_port.c |  13 +-
>  tools/usb/usbip/src/usbipd_app.c |  49 ++--
>  5 files changed, 253 insertions(+), 260 deletions(-)

This patch does not apply to my tree, can you refresh the series and
resend it please?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 2/3] usbip: vhci extension: modifications to userspace

2016-06-12 Thread Nobuo Iwata
Modification to the userspace tools including usbip/libsrc and 
usbip/src.

Changed corresponding to new vhci_sysfs.c.

nports in sysfs is used to get total number of ports. 

Old get_nports() ignores the last status line because 
udev_device_get_sysattr_value() drops last new line. New version uses 
nports attribute so it's doesn't have this problem.

status[.N] in sysfs are used.

parse_status() which reads all status lines is broken into open, close, 
read-line and parse-line. Parse-line is reused to find free port and 
get imported device.

In daemon, status was loaded into memory by 
usbip_vhci_refresh_device_list() at receiving every request. The loaded 
status is used to find free port. It is changed to read status directly 
to find free port.

Wording inconsistencies are fixed according to the rule below.

rhport, HC_PORTS: ports within a controller (or root hub).
port, nports: ports across the controllers.

Signed-off-by: Nobuo Iwata 
---
 tools/usb/usbip/libsrc/vhci_driver.c | 398 +++
 tools/usb/usbip/libsrc/vhci_driver.h |  45 +--
 tools/usb/usbip/src/usbip_attach.c   |   8 +-
 tools/usb/usbip/src/usbip_port.c |  13 +-
 tools/usb/usbip/src/usbipd_app.c |  49 ++--
 5 files changed, 253 insertions(+), 260 deletions(-)

diff --git a/tools/usb/usbip/libsrc/vhci_driver.c 
b/tools/usb/usbip/libsrc/vhci_driver.c
index 50c723d..4d1b986 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -15,11 +15,24 @@
 #undef  PROGNAME
 #define PROGNAME "libusbip"
 
-struct usbip_vhci_driver *vhci_driver;
-struct udev *udev_context;
+static struct udev_device *vhci_hc_device;
+static struct udev *udev_context;
+static int vhci_nports;
 
-static struct usbip_imported_device *
-imported_device_init(struct usbip_imported_device *idev, char *busid)
+struct usbip_vhci_device {
+   int port;
+   uint32_t status;
+
+   uint32_t devid;
+
+   uint8_t busnum;
+   uint8_t devnum;
+
+   /* usbip_class_device list */
+   struct usbip_usb_device udev;
+};
+
+static int imported_device_init(struct usbip_vhci_device *vdev, char *busid)
 {
struct udev_device *sudev;
 
@@ -27,132 +40,131 @@ imported_device_init(struct usbip_imported_device *idev, 
char *busid)
   "usb", busid);
if (!sudev) {
dbg("udev_device_new_from_subsystem_sysname failed: %s", busid);
-   goto err;
+   return -1;
}
-   read_usb_device(sudev, >udev);
+   read_usb_device(sudev, >udev);
udev_device_unref(sudev);
 
-   return idev;
-
-err:
-   return NULL;
+   return 0;
 }
 
+struct status_context {
+   int controller;
+   const char *c;
+};
 
+#define OPEN_MODE_FIRST  0
+#define OPEN_MODE_REOPEN 1
 
-static int parse_status(const char *value)
-{
-   int ret = 0;
-   char *c;
+static int open_hc_device(int mode);
 
+#define MAX_STATUS_NAME 16
 
-   for (int i = 0; i < vhci_driver->nports; i++)
-   memset(_driver->idev[i], 0, sizeof(vhci_driver->idev[i]));
+static int open_status(struct status_context *ctx, int mode)
+{
+   char name[MAX_STATUS_NAME+1];
 
+   if (mode == OPEN_MODE_FIRST)
+   ctx->controller = 0;
+   else
+   (ctx->controller)++;
 
-   /* skip a header line */
-   c = strchr(value, '\n');
-   if (!c)
+   if (open_hc_device(OPEN_MODE_REOPEN))
return -1;
-   c++;
-
-   while (*c != '\0') {
-   int port, status, speed, devid;
-   unsigned long socket;
-   char lbusid[SYSFS_BUS_ID_SIZE];
-
-   ret = sscanf(c, "%d %d %d %x %lx %31s\n",
-   , , ,
-   , , lbusid);
-
-   if (ret < 5) {
-   dbg("sscanf failed: %d", ret);
-   BUG();
-   }
 
-   dbg("port %d status %d speed %d devid %x",
-   port, status, speed, devid);
-   dbg("socket %lx lbusid %s", socket, lbusid);
+   if (ctx->controller == 0)
+   strcpy(name, "status");
+   else
+   snprintf(name, MAX_STATUS_NAME + 1,
+   "status.%d", ctx->controller);
+   ctx->c = udev_device_get_sysattr_value(vhci_hc_device, name);
+   if (ctx->c == NULL)
+   return -1;
 
+   return 0;
+}
 
-   /* if a device is connected, look at it */
-   {
-   struct usbip_imported_device *idev = 
_driver->idev[port];
+static void close_status(struct status_context *ctx)
+{
+   ctx->c = NULL;
+}
 
-   idev->port  = port;
-   idev->status= status;
+static int next_status_line(struct status_context *ctx)
+{
+   const char *c = ctx->c;
 
-