All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Rockai <prockai@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 4/8] Rename fields in lvm_property_type.
Date: Wed, 20 Oct 2010 23:45:10 +0200	[thread overview]
Message-ID: <87wrpc8ro9.fsf@twilight.int.mornfall.net.> (raw)
In-Reply-To: <1287487975-26572-5-git-send-email-dwysocha@redhat.com> (Dave Wysochanski's message of "Tue, 19 Oct 2010 07:32:51 -0400")

Dave Wysochanski <dwysocha@redhat.com> writes:

> Based on review comments, rename a few fields in lvm_property_type.
> In particular, change 'is_writeable' to 'is_settable', which is
> more intuitive to the intent of the bitfield (a 'set' function
> exists for this field/property).  Also, remove the char array
> for 'id' - unnecessary as we can just use the string passed in
> to do the strcmp.  Finally rename the union members from n_val
> to 'integer' and 's_val' to 'string'.
>
> Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>

Looks good.

> diff --git a/lib/report/properties.c b/lib/report/properties.c
> index 587f11d..8f9272c 100644
> --- a/lib/report/properties.c
> +++ b/lib/report/properties.c
> @@ -25,7 +25,7 @@ static int _ ## NAME ## _get (const void *obj, struct lvm_property_type *prop) \
>  { \
>  	const struct TYPE *VAR = (const struct TYPE *)obj; \
>  \
> -	prop->v.n_val = VALUE; \
> +	prop->value.integer = VALUE; \
>  	return 1; \
>  }
>  #define GET_VG_NUM_PROPERTY_FN(NAME, VALUE) \
> @@ -40,7 +40,7 @@ static int _ ## NAME ## _get (const void *obj, struct lvm_property_type *prop) \
>  { \
>  	const struct TYPE *VAR = (const struct TYPE *)obj; \
>  \
> -	prop->v.s_val = (char *)VALUE;	\
> +	prop->value.string = (char *)VALUE;	\
>  	return 1; \
>  }
>  #define GET_VG_STR_PROPERTY_FN(NAME, VALUE) \
> @@ -226,12 +226,12 @@ GET_VG_NUM_PROPERTY_FN(vg_mda_copies, (vg_mda_copies(vg)))
>  
>  #define STR DM_REPORT_FIELD_TYPE_STRING
>  #define NUM DM_REPORT_FIELD_TYPE_NUMBER
> -#define FIELD(type, strct, sorttype, head, field, width, fn, id, desc, writeable) \
> -	{ type, #id, writeable, sorttype == STR, { .n_val = 0 }, _ ## id ## _get, _ ## id ## _set },
> +#define FIELD(type, strct, sorttype, head, field, width, fn, id, desc, settable) \
> +	{ type, #id, settable, sorttype == STR, { .integer = 0 }, _ ## id ## _get, _ ## id ## _set },
>  
>  struct lvm_property_type _properties[] = {
>  #include "columns.h"
> -	{ 0, "", 0, 0, { .n_val = 0 }, _not_implemented_get, _not_implemented_set },
> +	{ 0, "", 0, 0, { .integer = 0 }, _not_implemented_get, _not_implemented_set },
>  };
>  
>  #undef STR
> diff --git a/lib/report/properties.h b/lib/report/properties.h
> index 7398f2f..db4ae51 100644
> --- a/lib/report/properties.h
> +++ b/lib/report/properties.h
> @@ -19,17 +19,15 @@
>  #include "metadata.h"
>  #include "report.h"
>  
> -#define LVM_PROPERTY_NAME_LEN DM_REPORT_FIELD_TYPE_ID_LEN
> -
>  struct lvm_property_type {
>  	report_type_t type;
> -	char id[LVM_PROPERTY_NAME_LEN];
> -	unsigned is_writeable;
> -	unsigned is_string;
> +	const char *id;
> +	unsigned is_settable:1;
> +	unsigned is_string:1;
>  	union {
> -		char *s_val;
> -		uint64_t n_val;
> -	} v;
> +		char *string;
> +		uint64_t integer;
> +	} value;
>  	int (*get) (const void *obj, struct lvm_property_type *prop);
>  	int (*set) (void *obj, struct lvm_property_type *prop);
>  };



  reply	other threads:[~2010-10-20 21:45 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 [this message]
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
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 4/8] Rename fields in lvm_property_type 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=87wrpc8ro9.fsf@twilight.int.mornfall.net. \
    --to=prockai@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.