svn commit: r212050 - head/cddl/contrib/opensolaris/cmd/zpool

Fabian Keil freebsd-listen at fabiankeil.de
Tue Aug 31 18:56:22 UTC 2010


Pawel Jakub Dawidek <pjd at FreeBSD.org> wrote:

> Author: pjd
> Date: Tue Aug 31 10:41:53 2010
> New Revision: 212050
> URL: http://svn.freebsd.org/changeset/base/212050
> 
> Log:
>   When upgrading a pool which contain root file system, give user a hint that
>   he should update boot code.
>   
>   MFC after:	2 weeks
> 
> Modified:
>   head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
> 
> Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
> ==============================================================================
> --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Tue Aug 31 09:38:43 2010	(r212049)
> +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Tue Aug 31 10:41:53 2010	(r212050)
> @@ -3333,12 +3333,39 @@ typedef struct upgrade_cbdata {
>  	int	cb_all;
>  	int	cb_first;
>  	int	cb_newer;
> +	char	cb_poolname[ZPOOL_MAXNAMELEN];
>  	int	cb_argc;
>  	uint64_t cb_version;
>  	char	**cb_argv;
>  } upgrade_cbdata_t;
>  
>  static int
> +is_root_pool(zpool_handle_t *zhp)
> +{
> +	static struct statfs sfs;
> +	static char *poolname = NULL;
> +	static boolean_t stated = B_FALSE;

Why are those variables static? They all seem to be (re)initialized
before first-use in the function.

> +	char *slash;
> +
> +	while (!stated) {
> +		stated = B_TRUE;
> +		if (statfs("/", &sfs) == -1) {
> +			(void) fprintf(stderr,
> +			    "Unable to stat root file system: %s.\n",
> +			    strerror(errno));
> +			break;
> +		}
> +		if (strcmp(sfs.f_fstypename, "zfs") != 0)
> +			break;
> +		poolname = sfs.f_mntfromname;
> +		if ((slash = strchr(poolname, '/')) != NULL)
> +			*slash = '\0';
> +		break;
> +	}
> +	return (poolname != NULL && strcmp(poolname, zpool_get_name(zhp)) == 0);
> +}

This while "loop" doesn't seem to loop at all, is this intended?

Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20100831/c81d386e/signature.pgp


More information about the svn-src-all mailing list