public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Dave Reisner <d@falconindy.com>
Cc: util-linux@vger.kernel.org, Dave Reisner <dreisner@archlinux.org>
Subject: Re: [PATCH 2/2] libmount: don't treat "none" differently
Date: Fri, 2 Mar 2012 13:39:33 +0100	[thread overview]
Message-ID: <20120302123933.GF18642@x2.net.home> (raw)
In-Reply-To: <1330660020-32542-2-git-send-email-dreisner@archlinux.org>

On Thu, Mar 01, 2012 at 10:47:00PM -0500, Dave Reisner wrote:
> This causes more problems than it solves. In the latest edition:

 Yes, I agree. You're right that exceptions suck.

> Simply treat "none" like any other source when passed in.

 Yes,

> We still keep conventions to allow NULL as a valid source and
> replace it with "none".

 but I don't agree with this idea. The old code converted "none" to
 NULL, you want to convert NULL to "none". I think both is wrong.

 It would be better to keep the difference between "none" and NULL. 
 The NULL means that the source is not set, "none" means that the source
 is unnecessary. As you said 'treat "none" like any other source'.

> @@ -341,11 +337,9 @@ int mnt_fs_set_source(struct libmnt_fs *fs, const char *source)
>  
>  	if (!fs)
>  		return -EINVAL;
> -	if (source) {
> -		p = strdup(source);
> -		if (!p)
> -			return -ENOMEM;
> -	}
> +	p = strdup(source ? source : "none");
> +	if (!p)
> +		return -ENOMEM;

 IMHO better is:

    if (source) {
        p = strdup(source);
        if (!p)
            return -ENOMEM;
    }

 Dave, we have some regression test for libmount, try

   $ make -C libmount/src tests
   
   # cd tests
   # ./run.sh libmount
   # ./run.sh mount

 maybe we need more tests for the "none" stuff.

     Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2012-03-02 12:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02  3:46 [PATCH 1/2] mountpoint: account for error from in mnt_fs_get_target Dave Reisner
2012-03-02  3:47 ` [PATCH 2/2] libmount: don't treat "none" differently Dave Reisner
2012-03-02 12:39   ` Karel Zak [this message]
2012-03-02  8:58 ` [PATCH 1/2] mountpoint: account for error from in mnt_fs_get_target Karel Zak

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=20120302123933.GF18642@x2.net.home \
    --to=kzak@redhat.com \
    --cc=d@falconindy.com \
    --cc=dreisner@archlinux.org \
    --cc=util-linux@vger.kernel.org \
    /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