All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Wysochanski <dwysocha@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH] (7/11) API improvements
Date: Sun, 23 Nov 2008 23:06:38 -0500	[thread overview]
Message-ID: <1227499598.6608.27.camel@localhost.localdomain> (raw)
In-Reply-To: <873aie3q69.fsf@eriador.mornfall.net>


On Thu, 2008-10-30 at 19:15 +0100, Petr Rockai wrote:
> +int vg_read_error(vg_t *vg) {
> +       if (!vg)
> +               return FAILED_ALLOCATION;
> +       if (vg->read_failed & EXISTENCE_CHECK)
> +               return vg->read_failed & ~(EXISTENCE_CHECK |
> FAILED_NOTFOUND);
> +       return vg->read_failed;
> +}
> +
> +/* Returns true if the volume group already exists. If unsure, it
> will return
> +   true (it might exist, but we are not sure, as the read failed for
> some
> +   other reason). */
> +
> +int vg_exists(vg_t *vg) {
> +       if (!vg)
> +               return 1;
> +       log_error("vg_exists: %d != %d?", vg->read_failed,
> FAILED_NOTFOUND | EXISTENCE_CHECK);
> +       if (vg->read_failed == (FAILED_NOTFOUND | EXISTENCE_CHECK))
> +               return 0;
> +       return 1;
> +}
> 

Although the comment explains the vg_exists() function may be just a
guess, it is misleading to have a function called "vg_exists()" that
takes a vg_t * and returns true of vg_t * is NULL.

Also from what I can tell, all places that call vg_exists() is preceeded
immediately by a call to vg_read_error() which does the same check.



  parent reply	other threads:[~2008-11-24  4:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-30 18:15 [PATCH] (7/11) API improvements Petr Rockai
2008-11-24  3:56 ` Dave Wysochanski
2008-11-24 15:53   ` Petr Rockai
2008-11-24  4:06 ` Dave Wysochanski [this message]
2008-11-24 15:56   ` Petr Rockai
2008-11-25 21:16     ` Dave Wysochanski

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=1227499598.6608.27.camel@localhost.localdomain \
    --to=dwysocha@redhat.com \
    --cc=lvm-devel@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.