From: Petr Uzel <petr.uzel@suse.cz>
To: "Voelker, Bernhard" <bernhard.voelker@siemens-enterprise.com>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: Re: [PATCH 2/2] blkid: introduce symbolic names for different blkid exit codes
Date: Wed, 16 May 2012 11:24:09 +0200 [thread overview]
Message-ID: <20120516092408.GA3670@foxbat.suse.cz> (raw)
In-Reply-To: <7856072A9D04C24B82DFE2B1112FE38A0F1E5D2336@MCHP058A.global-ad.net>
[-- Attachment #1: Type: text/plain, Size: 2400 bytes --]
On Wed, May 16, 2012 at 10:52:40AM +0200, Voelker, Bernhard wrote:
> Petr Uzel wrote:
>
> > #include "ismounted.h"
> >
> > -#define STRTOXX_EXIT_CODE 4 /* strtoxx_or_err() */
> > +#define STRTOXX_EXIT_CODE BLKID_EXIT_OTHER /* strtoxx_or_err() */
>
> STRTOXX_EXIT_CODE is not used in blkid.c. Remove it?
> ... or if it used in strutils.h, then this is not a nice interface.
Yep, it is used in strutils.h.
>
> > #include "strutils.h"
> > #include "closestream.h"
> > #include "ttyutils.h"
> > @@ -484,7 +488,7 @@ static int lowprobe_device(blkid_probe pr, const char *devname,
> > fd = open(devname, O_RDONLY);
> > if (fd < 0) {
> > fprintf(stderr, "error: %s: %m\n", devname);
> > - return 2;
> > + return BLKID_EXIT_NOTFOUND;
> > }
> > if (blkid_probe_set_device(pr, fd, offset, size))
> > goto done;
> > @@ -551,9 +555,9 @@ done:
> > close(fd);
> >
> > if (rc == -2)
> > - return 8; /* ambivalent probing result */
> > + return BLKID_EXIT_AMBIVAL; /* ambivalent probing result */
> > if (!nvals)
> > - return 2; /* nothing detected */
> > + return BLKID_EXIT_NOTFOUND; /* nothing detected */
> >
> > return 0; /* success */
> > }
>
> These are not exit() codes, but return codes.
Strictly speaking, yes. But the idea is that those codes are (or
rather should be) propagated as exit value anyways...
> That value doesn't seem
> to be of much interest anyway, because it's used only here in main()
> in a for-loop, forgetting the return value of the previous iteration:
>
> for (i = 0; i < numdev; i++)
> err = lowprobe_device(pr, devices[i], lowprobe, show,
> output_format,
> (blkid_loff_t) offset,
> (blkid_loff_t) size);
Hmm, the return value depends only on the last argument (device). I
don't think this is intentional. Karel?
# blkid -p /dev/sda /dev/sdb ; echo $?
/dev/sda: PTTYPE="gpt"
error: /dev/sdb: No such file or directory
2
# blkid -p /dev/sdb /dev/sda ; echo $?
error: /dev/sdb: No such file or directory
/dev/sda: PTTYPE="gpt"
0
>
> Have a nice day,
> Berny
Thanks,
Petr
--
Petr Uzel
IRC: ptr_uzl @ freenode
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2012-05-16 9:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-16 8:38 [PATCH 1/2] blkid: use symbolic exit code Petr Uzel
2012-05-16 8:38 ` [PATCH 2/2] blkid: introduce symbolic names for different blkid exit codes Petr Uzel
2012-05-16 8:52 ` Voelker, Bernhard
2012-05-16 9:24 ` Petr Uzel [this message]
2012-05-16 10:13 ` Karel Zak
2012-05-16 11:18 ` Voelker, Bernhard
2012-05-17 7:37 ` [PATCH] blkid: stop device probing if error is detected Petr Uzel
2012-05-23 7:46 ` Karel Zak
2012-05-23 7:46 ` [PATCH 2/2] blkid: introduce symbolic names for different blkid exit codes Karel Zak
2012-05-23 7:45 ` [PATCH 1/2] blkid: use symbolic exit code Karel Zak
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=20120516092408.GA3670@foxbat.suse.cz \
--to=petr.uzel@suse.cz \
--cc=bernhard.voelker@siemens-enterprise.com \
--cc=util-linux@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;
as well as URLs for NNTP newsgroup(s).