All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Wysochanski <dwysocha@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 5/8] Add lvm_vg_get_property() generic vg property function.
Date: Mon, 25 Oct 2010 09:55:05 -0400	[thread overview]
Message-ID: <1288014905.5029.1.camel@f12-work> (raw)
In-Reply-To: <87bp6j4x16.fsf@twilight.int.mornfall.net.>

On Sun, 2010-10-24 at 14:04 +0200, Petr Rockai wrote:
> Hi,
> 
> Dave Wysochanski <dwysocha@redhat.com> writes:
> >> A is_integer might be useful here, for symmetry. In the client code, it
> >> might not be obvious that !p.is_string means that it is an integer. It
> >> would also improve API extensibility for the future, may we ever run
> >> into a property that's neither string nor integer (although it won't
> >> help with ABI).
> >> 
> >
> > Ok, I've implemented this - easy.  But...
> > Now that I think about it, rather than a bitfield and 'is_string' and
> > 'is_integer", should we have a 'type' field and leave this an unsigned
> > (for example, #define LVM_PROPERTY_TYPE_NUM 1 and #define
> > LVM_PROPERTY_TYPE STR 2) or at least should we add padding to this
> > struct?  The struct might warrant a bit more thought, given how much
> > we've changed it recently, and given the ABI implications.
> 
> The advantage of the bitfield is that it is much more convenient to use
> (and the resulting code more concise and clearer). It also does not
> impose any ABI problems as long as you keep the items in the right
> order. What can be done to ensure forward compatibility is this:
> 
> uint32_t foo:1;
> uint32_t bar:1;
> uint32_t _padding:30;
> 
> And when you need a new flag, just reduce the padding by one and add
> your new flag between the existing flags and the padding.
> 

Exactly.  Will add this now.


> > As the code is, the client does not need to check lvm_errno() unless it
> > cares what went wrong.  In essence, v.is_valid "should =" !lvm_errno()
> > today, though there's no explicit assignment.  However, if we explicitly
> > assign v.is_valid = !lvm_errno(), then this assumes all error paths will
> > properly set lvm_errno().  Otherwise, we may end up telling the user the
> > value is valid when it may not be.  Now this case is clearly a bug but
> > keeping them separate avoids the potential bug.  It's fairly clear right
> > now that all error paths do properly set lvm_errno(), so this assignment
> > would be safe today.
> Ok.
> 
> Yours,
>    Petr.
> 
> --
> lvm-devel mailing list
> lvm-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/lvm-devel




  reply	other threads:[~2010-10-25 13:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-19 11:32 [PATCH 00/08] Add lvm lv properties for lvm2app, return struct Dave Wysochanski
2010-10-19 11:32 ` [PATCH 1/8] Refactor and add code for (lv) 'lv_name' get function Dave Wysochanski
2010-10-20 21:31   ` Petr Rockai
2010-10-19 11:32 ` [PATCH 2/8] Refactor and add code for (lv) 'lv_origin' " Dave Wysochanski
2010-10-20 21:41   ` Petr Rockai
2010-10-21 14:38     ` Dave Wysochanski
2010-10-19 11:32 ` [PATCH 3/8] Add lv_read_ahead and lv_kernel_read_ahead 'get' functions Dave Wysochanski
2010-10-20 21:43   ` Petr Rockai
2010-10-19 11:32 ` [PATCH 4/8] Rename fields in lvm_property_type Dave Wysochanski
2010-10-20 21:45   ` Petr Rockai
2010-10-19 11:32 ` [PATCH 5/8] Add lvm_vg_get_property() generic vg property function Dave Wysochanski
2010-10-20 21:51   ` Petr Rockai
2010-10-21 18:39     ` Dave Wysochanski
2010-10-24 12:04       ` Petr Rockai
2010-10-25 13:55         ` Dave Wysochanski [this message]
2010-10-19 11:32 ` [PATCH 6/8] Add lvm_pv_get_property() generic function to obtain value of any pv property Dave Wysochanski
2010-10-20 21:54   ` Petr Rockai
2010-10-19 11:32 ` [PATCH 7/8] Add lvm_lv_get_property() generic function to obtain value of any lv property Dave Wysochanski
2010-10-20 21:55   ` Petr Rockai
2010-10-19 11:32 ` [PATCH 8/8] Add interactive tests for lvm_{pv|vg|lv}_get_property() Dave Wysochanski
2010-10-20 21:57   ` Petr Rockai
  -- strict thread matches above, loose matches on Subject: below --
2010-10-19  4:02 [PATCH 00/08] Add lvm lv properties for lvm2app Dave Wysochanski
2010-10-19  4:02 ` [PATCH 5/8] Add lvm_vg_get_property() generic vg property function 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=1288014905.5029.1.camel@f12-work \
    --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.