]> sourceware.org Git - lvm2.git/commitdiff
Rename fields in lvm_property_type.
authorDave Wysochanski <dwysocha@redhat.com>
Thu, 21 Oct 2010 14:49:43 +0000 (14:49 +0000)
committerDave Wysochanski <dwysocha@redhat.com>
Thu, 21 Oct 2010 14:49:43 +0000 (14:49 +0000)
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'.

lib/report/properties.c
lib/report/properties.h

index 587f11d6d5f86c2c005fcfdac186b03fea2cb862..8f9272c2fb14cd373c21b2ace12d86002d5de551 100644 (file)
@@ -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
index 7398f2ff8eb48b094f0f3d63237dec1f66e95649..db4ae516f8c133f3166850dd32b869bef2ac8a56 100644 (file)
 #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);
 };
This page took 0.043897 seconds and 5 git commands to generate.