public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: chrubis@suse.cz
To: Xing Gu <gux.fnst@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] lib/tst_mkfs.c: fix -f option for mkfs.btrfs
Date: Mon, 12 May 2014 15:27:54 +0200	[thread overview]
Message-ID: <20140512132754.GC4741@rei> (raw)
In-Reply-To: <1399874087-15967-1-git-send-email-gux.fnst@cn.fujitsu.com>

Hi!
> In the earlier version of btrfs-progs, mkfs.btrfs doesn't
> support -f option. So it should be judged in advance before
> the command is called.

What system is this? What version of btrfs-progs?
(ideally these details should be included in the commit message)

> Signed-off-by: Xing Gu <gux.fnst@cn.fujitsu.com>
> ---
>  lib/tst_mkfs.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/tst_mkfs.c b/lib/tst_mkfs.c
> index 7357cd9..92b4b54 100644
> --- a/lib/tst_mkfs.c
> +++ b/lib/tst_mkfs.c
> @@ -35,11 +35,19 @@ void tst_mkfs(void (cleanup_fn)(void), const char *dev,
>  	 * superblock on the device, which is the case here as we
>  	 * reuse one device for all tests.
>  	 */
> -	if (!strcmp(fs_type, "xfs") || !strcmp(fs_type, "btrfs")) {
> +	if (!strcmp(fs_type, "xfs")) {
>  		tst_resm(TINFO, "Appending '-f' flag to mkfs.%s", fs_type);
>  		argv[pos++] = "-f";
>  	}
>  
> +	if (!strcmp(fs_type, "btrfs")) {
> +		if (system("mkfs.btrfs 2>&1 | grep '\\-f ' >/dev/null") == 0) {


The system() and grep is a bit of a hack but I cannot find a better way
how to do this.

> +			tst_resm(TINFO, "Appending '-f' flag to mkfs.%s",
> +				fs_type);
> +			argv[pos++] = "-f";
> +		}
> +	}
> +
>  	if (fs_opts) {
>  		for (i = 0; fs_opts[i]; i++) {
>  			argv[pos++] = fs_opts[i];

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2014-05-12 13:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12  5:54 [LTP] [PATCH] lib/tst_mkfs.c: fix -f option for mkfs.btrfs Xing Gu
2014-05-12 13:27 ` chrubis [this message]
2014-05-13  3:37 ` [LTP] [PATCH v2] " Xing Gu
2014-05-13 11:33   ` chrubis

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=20140512132754.GC4741@rei \
    --to=chrubis@suse.cz \
    --cc=gux.fnst@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox