From: Zdenek Kabelac <zkabelac@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 02/19] Refactor pvstatus_disp to take pv argument and call common pv_attr function.
Date: Thu, 16 Sep 2010 10:44:57 +0200 [thread overview]
Message-ID: <4C91D909.6070909@redhat.com> (raw)
In-Reply-To: <1284564971-26060-3-git-send-email-dwysocha@redhat.com>
Dne 15.9.2010 17:35, Dave Wysochanski napsal(a):
>
> Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
> ---
> lib/metadata/metadata.c | 21 +++++++++++++++++++++
> lib/metadata/metadata.h | 1 +
> lib/report/columns.h | 2 +-
> lib/report/report.c | 17 +++--------------
> 4 files changed, 26 insertions(+), 15 deletions(-)
>
> diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
> index 094ffc1..86f07e7 100644
> --- a/lib/metadata/metadata.c
> +++ b/lib/metadata/metadata.c
> @@ -4598,6 +4598,27 @@ char *vg_attr(struct dm_pool *mem, const struct volume_group *vg)
> return repstr;
> }
>
> +char *pv_attr(struct dm_pool *mem, const struct physical_volume *pv)
> +{
> + char *repstr;
> +
> + if (!(repstr = dm_pool_zalloc(mem, 3))) {
> + log_error("dm_pool_alloc failed");
> + return NULL;
> + }
> +
> + if (pv->status & ALLOCATABLE_PV)
> + repstr[0] = 'a';
> + else
> + repstr[0] = '-';
> +
> + if (pv->status & EXPORTED_VG)
> + repstr[1] = 'x';
> + else
> + repstr[1] = '-';
> + return repstr;
when you are moving this code maybe again little shortening could be made:
c = (x) ? a : b;
Zdenek
next prev parent reply other threads:[~2010-09-16 8:44 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-15 15:35 [PATCH 00/19] Add lvm vg and pv properties for lvm2app Dave Wysochanski
2010-09-15 15:35 ` [PATCH 01/19] Add vg_attr() and lv_attr() functions Dave Wysochanski
2010-09-15 15:35 ` [PATCH 02/19] Refactor pvstatus_disp to take pv argument and call common pv_attr function Dave Wysochanski
2010-09-16 8:44 ` Zdenek Kabelac
2010-09-16 8:44 ` Zdenek Kabelac [this message]
2010-09-16 13:26 ` Dave Wysochanski
2010-09-15 15:35 ` [PATCH 03/19] Add id_format_and_copy() uuid function to allocate and format a uuid Dave Wysochanski
2010-09-15 15:35 ` [PATCH 04/19] Call id_format_and_copy from _uuid_disp Dave Wysochanski
2010-09-16 8:47 ` Zdenek Kabelac
2010-09-15 15:35 ` [PATCH 05/19] Add pv_uuid, vg_uuid, and lv_uuid, and call id_format_and_copy Dave Wysochanski
2010-09-15 15:35 ` [PATCH 06/19] Add tags_format_and_copy() common function to format tags strings Dave Wysochanski
2010-09-15 15:35 ` [PATCH 07/19] Add pv_tags, vg_tags, lv_tags functions that call tags_format_and_copy Dave Wysochanski
2010-09-15 15:36 ` [PATCH 08/19] Add GET_STR_PROPERTY_FN macro Dave Wysochanski
2010-09-15 15:36 ` [PATCH 09/19] Add 'get' functions for a few vg string fields, vg_name, vg_fmt, vg_sysid Dave Wysochanski
2010-09-15 15:36 ` [PATCH 10/19] Add vg_uuid, vg_attr, vg_tags 'get' functions Dave Wysochanski
2010-09-15 15:36 ` [PATCH 11/19] Add lvm_vg_get_property() generic vg property function Dave Wysochanski
2010-09-15 15:36 ` [PATCH 12/19] Add tests for lvm_vg_get_property() Dave Wysochanski
2010-09-15 15:36 ` [PATCH 13/19] Simplify logic to create 'attr' strings Dave Wysochanski
2010-09-15 15:36 ` [PATCH 14/19] Make generic GET_*_PROPERTY_FN macros and define secondary macro for vg, pv, lv Dave Wysochanski
2010-09-15 15:36 ` [PATCH 15/19] Add pv_mda_size, pv_mda_free, and pv_used functions Dave Wysochanski
2010-09-15 15:36 ` [PATCH 16/19] Add pv 'get' functions for all pv properties Dave Wysochanski
2010-09-15 15:36 ` [PATCH 17/19] Rename internal vg_get_property to more generic lvm_get_property Dave Wysochanski
2010-09-16 8:41 ` Zdenek Kabelac
2010-09-16 8:57 ` Zdenek Kabelac
2010-09-16 14:16 ` Dave Wysochanski
2010-09-20 16:49 ` Dave Wysochanski
2010-09-22 13:20 ` Zdenek Kabelac
2010-09-16 13:25 ` Dave Wysochanski
2010-09-15 15:36 ` [PATCH 18/19] Add lvm_pv_get_property() generic function to obtain value of any pv property Dave Wysochanski
2010-09-15 15:36 ` [PATCH 19/19] Add pv_get_property to interactive test 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=4C91D909.6070909@redhat.com \
--to=zkabelac@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.