Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Stefan Behrens <sbehrens@giantdisaster.de>
To: Anand Jain <Anand.Jain@oracle.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: device delete to get errors from the kernel
Date: Fri, 26 Apr 2013 12:51:19 +0200	[thread overview]
Message-ID: <517A5C27.3090803@giantdisaster.de> (raw)
In-Reply-To: <517A4B44.5060608@oracle.com>

On Fri, 26 Apr 2013 17:39:16 +0800, Anand Jain wrote:
> 
>  As showed in the previous email in this thread, we need to get
>  the error string from the kernel to the cli to improve the
>  usability of the product.
>  As also said, I was looking at two way which I think we could
>  do this, here I take the 2nd approach which is to pass the error
>  string though the ioctl args. Which leads to change in the
>  ioctl-structure. But..
> 
>  This comes with a caveat that both btrfs-progs and btrfs-kernel
>  patch together either must be applied or removed.
> 
>   [PATCH] btrfs-progs: device delete to get errors from the kernel
>   [PATCH] btrfs: device delete to get errors from the kernel
> 
>  Which is not a developer/integrator friendly rule. If there
>  is anything I could do to help on this pls do let me know.
> 
>  There are quite a number of cli which needs passing of the
>  the error string from the kernel to cli. Which I plan to work
>  once we finalize the approach to address this issue.
> 
>  Thanks for your time to review this.

The regular procedure is to define an enumeration of numerical error
codes. And in user mode, somewhere in the btrfslib you add a function to
map the numerical error code to a string. I mean, you don't export a
string in first place, you export something numerical that allows
applications to evaluate the specific error code.

One use case where numerical error codes are better would be that a user
friendly GUI replaces the kernel developer assigned error strings with
friendly error strings for real human beings, maybe including advices,
how to avoid that error, how to go on.

About the issue you mentioned, that you need to change the kernel and
the user mode at the same time:
You can keep it compatible. Just do not delete the old kernel interface.
The user mode program could try the new interface first, and if it
fails, fall back to the old interface. You can use the same ioctl number
for both ways if you change the length of the ioctl parameter.


  parent reply	other threads:[~2013-04-26 10:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08  3:39 [bug] error communication from kernel to userland Anand Jain
2013-04-26  9:39 ` device delete to get errors from the kernel Anand Jain
2013-04-26  9:41   ` [PATCH] btrfs-progs: " Anand Jain
2013-04-26  9:41     ` [PATCH] btrfs: " Anand Jain
2013-04-29 19:12       ` Josef Bacik
2013-04-30  5:55         ` Anand Jain
2013-04-26 10:51   ` Stefan Behrens [this message]
2013-04-30  6:14     ` Anand Jain
2013-04-30 13:17   ` Anand Jain
2013-04-30 13:19     ` [PATCH v2] btrfs: " Anand Jain
2013-04-30 13:19       ` [PATCH v2] btrfs-progs: " Anand Jain
2013-05-17 10:53         ` [PATCH v3] " Anand Jain
2013-05-06 19:39       ` [PATCH v2] btrfs: " Josef Bacik
2013-05-17 10:52       ` [PATCH v3] " Anand Jain

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=517A5C27.3090803@giantdisaster.de \
    --to=sbehrens@giantdisaster.de \
    --cc=Anand.Jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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