From: Zdenek Kabelac <zkabelac@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 2/4] Add lvseg 'get' functions.
Date: Wed, 20 Oct 2010 13:53:19 +0200 [thread overview]
Message-ID: <4CBED82F.7020702@redhat.com> (raw)
In-Reply-To: <1287494696-18310-3-git-send-email-dwysocha@redhat.com>
Dne 19.10.2010 15:24, Dave Wysochanski napsal(a):
>
> Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
> diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
> index b7a8700..eca046f 100644
> --- a/lib/metadata/lv.c
> +++ b/lib/metadata/lv.c
> @@ -20,6 +20,41 @@
> #include "segtype.h"
> #include "str_list.h"
>
> +char *lvseg_tags_dup(const struct lv_segment *seg)
> +{
> + return tags_format_and_copy(seg->lv->vg->vgmem, &seg->tags);
> +}
> +
> +char *lvseg_segtype_dup(const struct lv_segment *seg)
> +{
> + if (seg->area_count == 1) {
> + return (char *)"linear";
NACK!
> + }
> +
> + return dm_pool_strdup(seg->lv->vg->vgmem, seg->segtype->ops->name(seg));
> +}
> +
> +uint64_t lvseg_chunksize(const struct lv_segment *seg)
> +{
> + uint64_t size;
> +
> + if (lv_is_cow(seg->lv))
> + size = (uint64_t) find_cow(seg->lv)->chunk_size;
> + else
> + size = UINT64_C(0);
if (lv_is_cow())
return ...
return 0;
> diff --git a/lib/report/report.c b/lib/report/report.c
> index dbeef21..c7f141f 100644
> --- a/lib/report/report.c
> +++ b/lib/report/report.c
> @@ -279,12 +279,9 @@ static int _segtype_disp(struct dm_report *rh __attribute__((unused)),
> {
> const struct lv_segment *seg = (const struct lv_segment *) data;
>
> - if (seg->area_count == 1) {
> - dm_report_field_set_value(field, "linear", NULL);
> - return 1;
> - }
> -
> - dm_report_field_set_value(field, seg->segtype->ops->name(seg), NULL);
> + char *name;
> + name = lvseg_segtype_dup(seg);
> + dm_report_field_set_value(field, name, NULL);
> return 1;
> }
I really think this API is wrong somewhere - there is way too many duplication
- this isn't going to be very efficient....
I do like the beauty of const strings....
Zdenek
next prev parent reply other threads:[~2010-10-20 11:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-19 13:24 [PATCH 00/04] Add lvm lvseg properties for lvm2app Dave Wysochanski
2010-10-19 13:24 ` [PATCH 1/4] Add lvseg_t to lvm2app and lvm_lv_list_lvsegs() Dave Wysochanski
2010-10-19 13:24 ` [PATCH 2/4] Add lvseg 'get' functions Dave Wysochanski
2010-10-20 11:53 ` Zdenek Kabelac [this message]
2010-10-21 16:36 ` Petr Rockai
2010-10-19 13:24 ` [PATCH 3/4] Add lvm_lvseg_get_property() function Dave Wysochanski
2010-10-20 11:47 ` Zdenek Kabelac
2010-10-19 13:24 ` [PATCH 4/4] Update tests for lvseg apis Dave Wysochanski
2010-10-20 12:08 ` Zdenek Kabelac
2010-10-21 16:38 ` Petr Rockai
2010-10-22 8:26 ` Zdenek Kabelac
2010-10-22 8:59 ` Petr Rockai
2010-10-24 16:24 ` Zdenek Kabelac
2010-10-24 21:06 ` Petr Rockai
2010-10-25 13:27 ` Zdenek Kabelac
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=4CBED82F.7020702@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.