mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuah Khan <shuahkh@osg.samsung.com>
To: valentina.manea.m@gmail.com, shuah@kernel.org,
	gregkh@linuxfoundation.org
Cc: Shuah Khan <shuahkh@osg.samsung.com>,
	yuyang.du@intel.com, k.opasiak@samsung.com,
	nobuo.iwata@fujixerox.co.jp, julien.boibessot@armadeus.com,
	jdieter@lesbg.com, peter.senna@gmail.com,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/3] More error codes for usbip request/reply messages
Date: Wed,  7 Mar 2018 13:42:23 -0700	[thread overview]
Message-ID: <cover.1520455010.git.shuahkh@osg.samsung.com> (raw)

Currently ST_OK and ST_NA are the only values defined to communicate
status of a request from a client. Client doesn't know what failed
and prints a cryptic error message that something failed.

This patch series adds more error codes to clearly indicate what failed.
For example, when client sends request to import a device that isn't
export-able, server can send a specific error code to the client.

The first patch moves existing error codes to a common library header
and adds more codes. It also adds an interface to map the code to a
string to print messages from tools.

The second patch changes the server/host to return the right codes
in reply messages when client request fails.

The third patch changes the clinet tools to recognize the new error
codes and print messages.

With this change the messages say why a request failed:
    
    - when a client requests a device that is already exported:
    
    usbip attach -r server_name -b 3-10.2
    usbip: error: Attach Request for 3-10.2 failed - Device busy (exported)
    
    - when a client requests a device that isn't exportable,
    
    usbip attach -r server_name -b 3-10.4
    usbip: error: Attach Request for 3-10.4 failed - Device not found

Shuah Khan (3):
  usbip: tools: add more error codes for usbip request/reply messages
  usbip: usbip_host_common: Use new error codes to return request status
  usbip: tools: change to use new error codes in server reply messages

 tools/usb/usbip/libsrc/usbip_common.c      | 23 +++++++++++++++++++++++
 tools/usb/usbip/libsrc/usbip_common.h      | 11 +++++++++++
 tools/usb/usbip/libsrc/usbip_host_common.c |  5 ++++-
 tools/usb/usbip/src/usbip_attach.c         | 11 +++++------
 tools/usb/usbip/src/usbip_list.c           |  6 ++++--
 tools/usb/usbip/src/usbip_network.c        |  6 +++++-
 tools/usb/usbip/src/usbip_network.h        |  6 ++----
 tools/usb/usbip/src/usbipd.c               | 18 +++++++++---------
 8 files changed, 63 insertions(+), 23 deletions(-)

-- 
2.14.1


             reply	other threads:[~2018-03-07 20:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 20:42 Shuah Khan [this message]
2018-03-07 20:42 ` [PATCH 1/3] usbip: tools: add more " Shuah Khan
2018-03-07 20:42 ` [PATCH 2/3] usbip: usbip_host_common: Use new error codes to return request status Shuah Khan
2018-03-07 20:42 ` [PATCH 3/3] usbip: tools: change to use new error codes in server reply messages Shuah Khan

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=cover.1520455010.git.shuahkh@osg.samsung.com \
    --to=shuahkh@osg.samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jdieter@lesbg.com \
    --cc=julien.boibessot@armadeus.com \
    --cc=k.opasiak@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nobuo.iwata@fujixerox.co.jp \
    --cc=peter.senna@gmail.com \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.com \
    --cc=yuyang.du@intel.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 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®