Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Dec 2008 08:14:52 -0800
From:      "Paul Saab" <ps@mu.org>
To:        "Luigi Rizzo" <luigi@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r185990 - head/sbin/newfs
Message-ID:  <5c0ff6a70812120814t2c184ec1jc05953a3db9ed319@mail.gmail.com>
In-Reply-To: <200812121556.mBCFucKf001837@svn.freebsd.org>
References:  <200812121556.mBCFucKf001837@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This still will not work.  zfs can have arbitrary names.

On Fri, Dec 12, 2008 at 7:56 AM, Luigi Rizzo <luigi@freebsd.org> wrote:

> Author: luigi
> Date: Fri Dec 12 15:56:38 2008
> New Revision: 185990
> URL: http://svn.freebsd.org/changeset/base/185990
>
> Log:
>  Move the check for the ending char in the partition name where
>  it was before -- the check is only made when getdisklabel()
>  returns valid info.
>  On passing, use MAXPARTITIONS to identify the max partition number,
>  instead of the hardwired 'h'
>
>  MFC after:    4 weeks
>
> Modified:
>  head/sbin/newfs/newfs.c
>
> Modified: head/sbin/newfs/newfs.c
>
> ==============================================================================
> --- head/sbin/newfs/newfs.c     Fri Dec 12 14:57:25 2008        (r185989)
> +++ head/sbin/newfs/newfs.c     Fri Dec 12 15:56:38 2008        (r185990)
> @@ -354,11 +354,6 @@ main(int argc, char *argv[])
>                mediasize = st.st_size;
>                /* set fssize from the partition */
>        } else {
> -           part_name = special[strlen(special) - 1];
> -           if ((part_name < 'a' || part_name > 'h') &&
> !isdigit(part_name))
> -               errx(1, "%s: can't figure out file system partition",
> -                               special);
> -
>            if (sectorsize == 0)
>                if (ioctl(disk.d_fd, DIOCGSECTORSIZE, &sectorsize) == -1)
>                    sectorsize = 0;     /* back out on error for safety */
> @@ -368,6 +363,12 @@ main(int argc, char *argv[])
>        pp = NULL;
>        lp = getdisklabel(special);
>        if (lp != NULL) {
> +               if (!is_file) /* already set for files */
> +                       part_name = special[strlen(special) - 1];
> +               if ((part_name < 'a' || part_name - 'a' >= MAXPARTITIONS)
> &&
> +                               !isdigit(part_name))
> +                       errx(1, "%s: can't figure out file system
> partition",
> +                                       special);
>                cp = &part_name;
>                if (isdigit(*cp))
>                        pp = &lp->d_partitions[RAW_PART];
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5c0ff6a70812120814t2c184ec1jc05953a3db9ed319>