public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Alex Elder <aelder@sgi.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 4/6] xfsprogs: libxcmd: isolate strdup() calls to fs_table_insert()
Date: Thu, 6 Oct 2011 15:45:14 -0400	[thread overview]
Message-ID: <20111006194514.GB13434@infradead.org> (raw)
In-Reply-To: <0f871eebf39384818415253082320f860739f113.1317646036.git.aelder@sgi.com>

> @@ -95,21 +95,37 @@ fs_table_insert(
>  {
>  	dev_t		datadev, logdev, rtdev;
>  	struct fs_path	*tmp_fs_table;
> -
> -	if (!dir || !fsname)
> -		return EINVAL;
> +	int		error;
>  
>  	datadev = logdev = rtdev = 0;
> -	if (fs_device_number(dir, &datadev))
> -		return errno;
> -	if (fslog && fs_device_number(fslog, &logdev))
> -		return errno;
> -	if (fsrt && fs_device_number(fsrt, &rtdev))
> -		return errno;
> +	error = fs_device_number(dir, &datadev);
> +	if (error)
> +		goto out_nodev;
> +	if (fslog && (error = fs_device_number(fslog, &logdev)))
> +		goto out_nodev;
> +	if (fsrt && (error = fs_device_number(fsrt, &rtdev)))
> +		goto out_nodev;

If you touch these anyway please move assignments outside the
conditionals, e.g.

	 if (fslog) {
	 	error = fs_device_number(fslog, &logdev);
		if (error)
			goto out_nodev;
	}

> -	char		*dir = NULL, *fsname = NULL;
>  	int		error = 0;
>  
> -	if ((fs = fs_mount_point_from_path(udir)) != NULL) {
> -		dir = strdup(udir);
> -		fsname = strdup(fs->fs_name);
> -		if (dir && fsname)
> -			error = fs_table_insert(dir, prid,
> -					FS_PROJECT_PATH, fsname, NULL, NULL);
> -		else
> -			error = ENOMEM;
> +	if ((fs = fs_mount_point_from_path(dir)) != NULL) {

Same here.

Otherwise looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2011-10-06 19:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-03 12:49 [PATCH 0/6] xfsprogs: tolerate mount or project errors Alex Elder
2011-10-03 12:49 ` [PATCH 1/6] xfsprogs: libxcmd: rearrange some routines Alex Elder
2011-10-03 12:49   ` [PATCH 2/6] xfsprogs: libxcmd: avoid using strtok() Alex Elder
2011-10-05 21:58     ` Christoph Hellwig
2011-10-03 12:49   ` [PATCH 3/6] xfsprogs: libxcmd: encapsulate fs_table initialization Alex Elder
2011-10-06 19:42     ` Christoph Hellwig
2011-10-03 12:49   ` [PATCH 4/6] xfsprogs: libxcmd: isolate strdup() calls to fs_table_insert() Alex Elder
2011-10-06 19:45     ` Christoph Hellwig [this message]
2011-10-06 19:47       ` Alex Elder
2011-10-03 12:49   ` [PATCH 5/6] xfsprogs: libxcmd: avoid exiting when an error occurs Alex Elder
2011-10-06 19:45     ` Christoph Hellwig
2011-10-03 12:49   ` [PATCH 6/6] xfsprogs: libxcmd: ignore errors when initializing fs_table Alex Elder
2011-10-06 19:47     ` Christoph Hellwig
2011-10-03 13:32   ` [PATCH 1/6] xfsprogs: libxcmd: rearrange some routines Christoph Hellwig
2011-10-03 13:31 ` [PATCH 0/6] xfsprogs: tolerate mount or project errors Christoph Hellwig
2011-10-03 14:21   ` Alex Elder
2011-10-03 14:23     ` Christoph Hellwig

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=20111006194514.GB13434@infradead.org \
    --to=hch@infradead.org \
    --cc=aelder@sgi.com \
    --cc=xfs@oss.sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox