Skip to contentSkip to conversation

(5/11) vg_read error returns, part 1

PATCH New Petr Rockai 2 participants 3 messages Oct 30, 2008 – Nov 24, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (5/11) vg_read error returns, part 1

Hi,

this patch is the first attempt at allowing vg_read* users to infer more information about the error, apart from "an error has happened and been reported to the user". This will be useful whenever the tools need to differentiate behaviour depending on the kind of error that has happened, as is the case in a few spots -- those can be found in the later patches, when this functionality is used. In this particular patch, it is used for FAILED_NOTFOUND.

Yours,
Petr.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-lvmlib-vg_read-errors.diff
Type: text/x-diff
Size: 14734 bytes
Desc: lvmlib-vg_read-errors.diff
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20081030/c82583f5/attachment.bin>
-------------- next part --------------

Signature · 6 lines
Peter Rockai | me()mornfall!net | prockai()redhat!com
 http://blog.mornfall.net | http://web.mornfall.net

"In My Egotistical Opinion, most people's C programs should be
 indented six feet downward and covered with dirt."
     -- Blair P. Houghton on the subject of C program indentation
#1 lore raw

PATCH 1/1 (5/11) vg_read error returns, part 1

Quoted 13 lines · Petr Rockai

diff -rN -p -u old-lvmlib-b/lib/metadata/metadata.c new-lvmlib-b/lib/metadata/metadata.c
--- old-lvmlib-b/lib/metadata/metadata.c 2008-10-30
18:17:02.505837415 +0100
+++ new-lvmlib-b/lib/metadata/metadata.c 2008-10-30
18:17:02.577837348 +0100

(quoted diff) +1 -1
@@ -2371,42 +2371,66 @@ int pv_analyze(struct cmd_context *cmd, 
  * 0 - fail
  * 1 - success
  */
-int vg_check_status(const struct volume_group *vg, uint32_t status)
+static int _vg_check_status(const struct volume_group *vg, uint32_t
 status)

Review int pv_analyze(struct cmd_context *cmd, · line 2384

Quoted 10 lines
(quoted diff) +2 -1
 {
+       uint32_t ret = 0;
        if ((status & CLUSTERED) &&
            (vg_is_clustered(vg)) && !locking_is_clustered() &&
            !lockingfailed()) {
                log_error("Skipping clustered volume group %s",
 vg->name);
-               return 0;
+               ret |= FAILED_CLUSTERED;
 

Need uint32_t for function return value consistency with internal variable. Probably want to move/fix the comment as well.

#2 lore raw

PATCH 1/1 (5/11) vg_read error returns, part 1

Quoted 8 lines · Dave Wysochanski
Quoted 8 lines
(quoted diff) +1 -1
-int vg_check_status(const struct volume_group *vg, uint32_t status)
+static int _vg_check_status(const struct volume_group *vg, uint32_t

status)
{

+       uint32_t ret = 0;
        if ((status & CLUSTERED) &&
            (vg_is_clustered(vg)) && !locking_is_clustered() &&
            !lockingfailed()) {
Quoted 8 lines

Review

Quoted 5 lines

log_error("Skipping clustered volume group %s",
vg->name);

(quoted diff) +1 -1
-               return 0;
+               ret |= FAILED_CLUSTERED;

Need uint32_t for function return value consistency with internal variable. Probably want to move/fix the comment as well.

Good catch, noting down.

Signature · 6 lines
Peter Rockai | me()mornfall!net | prockai()redhat!com
 http://blog.mornfall.net | http://web.mornfall.net

"In My Egotistical Opinion, most people's C programs should be
 indented six feet downward and covered with dirt."
     -- Blair P. Houghton on the subject of C program indentation