All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
To: device-mapper development <dm-devel@redhat.com>,
	Alasdair Kergon <agk@redhat.com>
Subject: [PATCH] libdevmapper: (2/6) Fix trailing separator
Date: Wed, 18 Apr 2007 12:47:31 -0400	[thread overview]
Message-ID: <46264BA3.6090705@ce.jp.nec.com> (raw)
In-Reply-To: <46264A57.1020800@ce.jp.nec.com>

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

Hi,

This patch fixes dm_report_output() so that it can correctly check
the end of the row.

It uses list_end() but trailing fields may have HIDDEN flag and
not be printed.

For example,
# dmsetup info -c -o name -O minor VG0-lv0
Name
VG0-lv0
# dmsetup info -c -o name -O minor --noheadings VG0-lv0
VG0-lv0:
# dmsetup info -c -o name --noheadings VG0-lv0
VG0-lv0

The patch fixes it by inserting hidden fields at the head of the list.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America

[-- Attachment #2: libdm-report-fix-trailing-separator.patch --]
[-- Type: text/x-patch, Size: 989 bytes --]

Later, dm_report_output() loops through rh->field_props list
and checks the end of the list by list_end() whether to display the
separator or not.
The check doesn't work if hidden field is on the tail.

For example, try 'dmsetup info -c -o name -O minor' and
compare the results with and without '--noheadings'.

---
 lib/libdm-report.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Index: device-mapper.work/lib/libdm-report.c
===================================================================
--- device-mapper.work.orig/lib/libdm-report.c
+++ device-mapper.work/lib/libdm-report.c
@@ -315,7 +315,12 @@ static struct field_properties * _add_fi
 	/* Add additional flags */
 	fp->flags |= flags;
 
-	list_add(&rh->field_props, &fp->list);
+	/* Hidden field must come first, otherwise list_end() doesn't work
+	   as expected */
+	if (fp->flags & FLD_HIDDEN)
+		list_add_h(&rh->field_props, &fp->list);
+	else
+		list_add(&rh->field_props, &fp->list);
 	return fp;
 }
 

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



  parent reply	other threads:[~2007-04-18 16:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-18 16:41 [PATCH] libdevmapper: (0/6) Filtering feature in dm_report Jun'ichi Nomura
2007-04-18 16:47 ` [PATCH] libdevmapper: (1/6) Tidy up _field_match() and _key_match() Jun'ichi Nomura
2007-04-18 16:47 ` Jun'ichi Nomura [this message]
2007-04-18 16:47 ` [PATCH] libdevmapper: (3/6) Move lib/regex from LVM2 Jun'ichi Nomura
2007-04-18 19:23   ` [PATCH] LVM2: (1/2) Use dm_regex Jun'ichi Nomura
2007-04-18 16:47 ` [PATCH] libdevmapper: (4/6) Add filtering feature to dm_report Jun'ichi Nomura
2007-04-18 19:32   ` [PATCH] LVM2: (2/2) Use dm_report filter Jun'ichi Nomura
2007-04-18 16:47 ` [PATCH] libdevmapper: (5/6) Add '--filter' option to dmsetup Jun'ichi Nomura
2007-04-18 16:47 ` [PATCH] libdevmapper: (6/6) Add deps and treenode fields for dmsetup info -c Jun'ichi Nomura
2007-04-18 19:23 ` [PATCH] libdevmapper: (7/6) Add dm_report_get_report_types() Jun'ichi Nomura

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=46264BA3.6090705@ce.jp.nec.com \
    --to=j-nomura@ce.jp.nec.com \
    --cc=agk@redhat.com \
    --cc=dm-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.