From rene@tunix.nl  Fri Jun 25 10:33:03 2004
Return-Path: <rene@tunix.nl>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7EFAA16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jun 2004 10:33:03 +0000 (GMT)
Received: from bastix.tunix.nl (bastix.tunix.nl [193.79.201.39])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 9486143D2F
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jun 2004 10:33:02 +0000 (GMT)
	(envelope-from rene@tunix.nl)
Received: (from root@localhost) by bastix.tunix.nl (8.9.3c/8.6.12) id MAA90066 for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jun 2004 12:32:23 +0200 (CEST)
Received: by bastix.tunix.nl (TUNIX txp2/smap)
	for <FreeBSD-gnats-submit@freebsd.org> id sma089405; Fri, 25 Jun 04 12:31:25 +0200
Received: from upsilix.tunix.nl (upsilix.tunix.nl [172.16.2.22])
	by fix.tunix.nl (8.10.2+Sun/8.10.2) with ESMTP id i5PAVPo24648
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jun 2004 12:31:25 +0200 (MEST)
Received: from upsilix.tunix.nl (localhost.tunix.nl [127.0.0.1])
	by upsilix.tunix.nl (8.12.8p2/8.12.6) with ESMTP id i5PAVPD2063188
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jun 2004 12:31:25 +0200 (CEST)
	(envelope-from rene@upsilix.tunix.nl)
Received: (from rene@localhost)
	by upsilix.tunix.nl (8.12.8p2/8.12.6/Submit) id i5PANf2W063176;
	Fri, 25 Jun 2004 12:23:41 +0200 (CEST)
	(envelope-from rene)
Message-Id: <200406251023.i5PANf2W063176@upsilix.tunix.nl>
Date: Fri, 25 Jun 2004 12:23:41 +0200 (CEST)
From: Rene de Vries <rene@tunix.nl>
Reply-To: Rene de Vries <rene@tunix.nl>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: be able to create fdisk partions using similar syntax as disklabel/bsdlabel
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         68312
>Category:       bin
>Synopsis:       [patch] be able to create fdisk(8) partions using similar syntax as disklabel/bsdlabel
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 25 10:40:19 GMT 2004
>Closed-Date:    Mon Jun 15 07:18:29 UTC 2009
>Last-Modified:  Mon Jun 15 07:20:01 UTC 2009
>Originator:     Rene de Vries
>Release:        FreeBSD 4.8 i386
>Organization:
Tunix Internet Security & Training
>Environment:
System: FreeBSD upsilix.tunix.nl 4.8 FreeBSD 4.8-RELEASE-p16 #7: Wed Mar 3 15:00:31 CET 2004 rene@upsilix.tunix.nl:/usr/obj/usr/src/sys/UPSILIX i386

>Description:
	Added some cleverness to the 'p' command while parsing a 
	fdisk partition description file.
	Sizes can now also be given in '10M', '20G', etc and wildcards
	can be used to assume sensible defaults.

Example:

/tmp/fdisk.in:
	p 1 165 * 10G
	p 2 165 * 20G
	p 3 165 * *

fdisk -f /tmp/fdisk.in /dev/ad2

>How-To-Repeat:
>Fix:
Index: sbin/i386/fdisk/fdisk.c
===================================================================
RCS file: sbin/i386/fdisk/fdisk.c,v
retrieving revision 1.1.1.4
retrieving revision 1.2
diff -u -r1.1.1.4 -r1.2
--- sbin/i386/fdisk/fdisk.c	2002/08/28 08:57:58	1.1.1.4
+++ sbin/i386/fdisk/fdisk.c	2003/07/22 15:43:21	1.2
@@ -113,6 +113,7 @@
     struct arg {
 	char	argtype;
 	int	arg_val;
+	char	*arg_str;
     }			args[MAX_ARGS];
 } CMD;
 
@@ -1013,6 +1014,10 @@
 	while (1)
 	{
 	    while (isspace(*cp)) ++cp;
+	    if (*cp == '\0')
+	    {
+		break;		/* eol */
+	    }
 	    if (*cp == '#')
 	    {
 		break;		/* found comment */
@@ -1021,16 +1026,21 @@
 	    {
 		command->args[command->n_args].argtype = *cp++;
 	    }
-	    if (!isdigit(*cp))
-	    {
-		break;		/* assume end of line */
-	    }
 	    end = NULL;
 	    command->args[command->n_args].arg_val = strtol(cp, &end, 0);
-	    if (cp == end)
+	    if ((cp == end) || (!isspace(*end) && (*end != '\0')))
 	    {
-		break;		/* couldn't parse number */
+		    char ch;
+		    end = cp;
+		    while (!isspace(*end) && *end != '\0') ++end;
+		    ch = *end; *end = '\0';
+		    command->args[command->n_args].arg_str = strdup(cp);
+		    *end = ch;
 	    }
+	    else
+	    {
+		    command->args[command->n_args].arg_str = NULL;
+	    }
 	    cp = end;
 	    command->n_args++;
 	}
@@ -1174,8 +1184,96 @@
 	partp = ((struct dos_partition *) &mboot.parts) + partition - 1;
 	bzero((char *)partp, sizeof (struct dos_partition));
 	partp->dp_typ = command->args[1].arg_val;
-	partp->dp_start = command->args[2].arg_val;
-	partp->dp_size = command->args[3].arg_val;
+	if (command->args[2].arg_str != NULL)
+	{
+		if (strcmp(command->args[2].arg_str, "*") == 0)
+		{
+			int i;
+			partp->dp_start = dos_sectors;
+			for (i = 1; i < partition; i++)
+			{
+    				struct dos_partition	*prev_partp;
+				prev_partp = ((struct dos_partition *) &mboot.parts) + i - 1;
+				if (prev_partp->dp_typ != 0)
+				{
+					partp->dp_start = prev_partp->dp_start + prev_partp->dp_size;
+				}
+			}
+			if (partp->dp_start % dos_sectors != 0)
+			{
+		    		prev_head_boundary = partp->dp_start / dos_sectors * dos_sectors;
+		    		partp->dp_start = prev_head_boundary + dos_sectors;
+			}
+		}
+		else
+		{
+			warnx("ERROR line %d: unexpected start: \'%s\'",
+					current_line_number, command->args[2].arg_str);
+			break;
+		}
+	}
+	else
+	{
+		partp->dp_start = command->args[2].arg_val;
+	}
+
+	if (command->args[3].arg_str != NULL)
+	{
+		if (strcmp(command->args[3].arg_str, "*") == 0)
+		{
+			partp->dp_size = 
+				((disksecs / dos_cylsecs) * dos_cylsecs) -
+				partp->dp_start;
+		}
+		else
+		{
+			char *end;
+			unsigned long val;
+			val = strtol(command->args[3].arg_str, &end, 0);
+			if (command->args[3].arg_str == end) {
+				warnx("ERROR line %d: unexpected size: \'%s\'",
+					current_line_number, command->args[3].arg_str);
+				break;
+			}
+			if (*end != '\0') {
+				if (*end == 'K') 
+				{
+					val *= (1024UL / secsize);
+				}
+				else if (*end == 'M')
+				{
+					val *= (unsigned long)(1024 * 1024 / secsize);
+				}
+				else if (*end == 'G')
+				{
+					val *= (unsigned long)(1024 * 1024 * 1024 / secsize);
+				}
+				else
+				{
+					warnx("ERROR line %d: unexpected modifier: %c (K/M/G)",
+							current_line_number, *end);
+					break;
+				}
+			} 
+			else
+			{
+				warnx("ERROR line %d: unexpected size: %s",
+					current_line_number, command->args[3].arg_str);
+				break;
+			}
+			partp->dp_size = val;
+		}
+		prev_cyl_boundary =
+		       	((partp->dp_start + partp->dp_size) / dos_cylsecs) * dos_cylsecs;
+		if (prev_cyl_boundary > partp->dp_start)
+		{
+			partp->dp_size = prev_cyl_boundary - partp->dp_start;
+		}
+	}
+	else
+	{
+		partp->dp_size = command->args[3].arg_val;
+	}
 	max_end = partp->dp_start + partp->dp_size;
 
 	if (partp->dp_typ == 0)
@@ -1189,6 +1287,15 @@
 	    bzero((char *)partp, sizeof (struct dos_partition));
 	    status = 1;
 	    break;
+	}
+
+	if (v_flag)
+	{
+		printf("p%d type=%d start=%lu size=%lu\n",
+				partition,
+				partp->dp_typ,
+				partp->dp_start,
+				partp->dp_size);
 	}
 
 	/*
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: brian 
State-Changed-When: Mon May 25 09:23:44 UTC 2009 
State-Changed-Why:  
Submitted to head - r192745 

http://www.freebsd.org/cgi/query-pr.cgi?pr=68312 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/68312: commit references a PR
Date: Mon, 25 May 2009 09:23:42 +0000 (UTC)

 Author: brian
 Date: Mon May 25 09:23:26 2009
 New Revision: 192745
 URL: http://svn.freebsd.org/changeset/base/192745
 
 Log:
   Enhance the 'p' command so that it understands size qualifiers (K/M/G) and
   so that it understands '*' as 'DTRT'.
   
   PR:		68312
   Submitted by:	Rene de Vries - rene at tunix dot nl (mostly)
   MFC after:	3 weeks
 
 Modified:
   head/sbin/fdisk/fdisk.8
   head/sbin/fdisk/fdisk.c
 
 Modified: head/sbin/fdisk/fdisk.8
 ==============================================================================
 --- head/sbin/fdisk/fdisk.8	Mon May 25 09:09:43 2009	(r192744)
 +++ head/sbin/fdisk/fdisk.8	Mon May 25 09:23:26 2009	(r192745)
 @@ -372,6 +372,31 @@ starting at sector
  for
  .Ar length
  sectors.
 +If the
 +.Ar start
 +or
 +.Ar length
 +is suffixed with a
 +.Em K ,
 +.Em M
 +or
 +.Em G ,
 +it is taken as a
 +.Em Kilobyte ,
 +.Em Megabyte
 +or
 +.Em Gigabyte
 +measurement respectively.
 +If the
 +.Ar start
 +is given as
 +.Qq *
 +it is set to the value of the previous partition end.
 +If the
 +.Ar length
 +is given as
 +.Qq *
 +the partition end is set to the end of the disk.
  .Pp
  Only those slices explicitly mentioned by these lines are modified;
  any slice not referenced by a
 @@ -421,6 +446,17 @@ for 2503871 sectors (note: these numbers
  downwards to correspond to head and cylinder boundaries):
  .Pp
  .Dl "p       1       165     1       2503871"
 +.Pp
 +Example: to set slices 1, 2 and 4 to
 +.Fx
 +slices, the first being 2 Gigabytes, the second being 10 Gigabytes and the
 +forth being the remainder of the disk (again, numbers will be rounded
 +appropriately):
 +.Pp
 +.Dl "p       1       165     63      2G"
 +.Dl "p       2       165     *       10G"
 +.Dl "p       3       0       0       0"
 +.Dl "p       4       165     *       *"
  .It Ic a Ar slice
  Make
  .Ar slice
 
 Modified: head/sbin/fdisk/fdisk.c
 ==============================================================================
 --- head/sbin/fdisk/fdisk.c	Mon May 25 09:09:43 2009	(r192744)
 +++ head/sbin/fdisk/fdisk.c	Mon May 25 09:23:26 2009	(r192745)
 @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
  
  int iotest;
  
 +#define NOSECTORS ((u_int32_t)-1)
  #define LBUF 100
  static char lbuf[LBUF];
  
 @@ -106,6 +107,7 @@ typedef struct cmd {
      struct arg {
  	char	argtype;
  	int	arg_val;
 +	char	*arg_str;
      }			args[MAX_ARGS];
  } CMD;
  
 @@ -970,16 +972,23 @@ parse_config_line(char *line, CMD *comma
  	 */
  	    while (1) {
  	    while (isspace(*cp)) ++cp;
 +	    if (*cp == '\0')
 +		break;		/* eol */
  	    if (*cp == '#')
  		break;		/* found comment */
  	    if (isalpha(*cp))
  		command->args[command->n_args].argtype = *cp++;
 -	    if (!isdigit(*cp))
 -		break;		/* assume end of line */
  	    end = NULL;
  	    command->args[command->n_args].arg_val = strtol(cp, &end, 0);
 -	    if (cp == end)
 -		break;		/* couldn't parse number */
 + 	    if (cp == end || (!isspace(*end) && *end != '\0')) {
 + 		char ch;
 + 		end = cp;
 + 		while (!isspace(*end) && *end != '\0') ++end;
 + 		ch = *end; *end = '\0';
 + 		command->args[command->n_args].arg_str = strdup(cp);
 + 		*end = ch;
 + 	    } else
 + 		command->args[command->n_args].arg_str = NULL;
  	    cp = end;
  	    command->n_args++;
  	}
 @@ -1078,6 +1087,33 @@ process_geometry(CMD *command)
      return (status);
  }
  
 +static u_int32_t
 +str2sectors(const char *str)
 +{
 +	char *end;
 +	unsigned long val;
 +
 +	val = strtoul(str, &end, 0);
 +	if (str == end || *end == '\0') {
 +		warnx("ERROR line %d: unexpected size: \'%s\'",
 +		    current_line_number, str);
 +		return NOSECTORS;
 +	}
 +
 +	if (*end == 'K') 
 +		val *= 1024UL / secsize;
 +	else if (*end == 'M')
 +		val *= 1024UL * 1024UL / secsize;
 +	else if (*end == 'G')
 +		val *= 1024UL * 1024UL * 1024UL / secsize;
 +	else {
 +		warnx("ERROR line %d: unexpected modifier: %c "
 +		    "(not K/M/G)", current_line_number, *end);
 +		return NOSECTORS;
 +	}
 +
 +	return val;
 +}
  
  static int
  process_partition(CMD *command)
 @@ -1103,8 +1139,48 @@ process_partition(CMD *command)
  	partp = &mboot.parts[partition - 1];
  	bzero(partp, sizeof (*partp));
  	partp->dp_typ = command->args[1].arg_val;
 -	partp->dp_start = command->args[2].arg_val;
 -	partp->dp_size = command->args[3].arg_val;
 +	if (command->args[2].arg_str != NULL) {
 +		if (strcmp(command->args[2].arg_str, "*") == 0) {
 +			int i;
 +			partp->dp_start = dos_sectors;
 +			for (i = 1; i < partition; i++) {
 +    				struct dos_partition *prev_partp;
 +				prev_partp = ((struct dos_partition *)
 +				    &mboot.parts) + i - 1;
 +				if (prev_partp->dp_typ != 0)
 +					partp->dp_start = prev_partp->dp_start +
 +					    prev_partp->dp_size;
 +			}
 +			if (partp->dp_start % dos_sectors != 0) {
 +		    		prev_head_boundary = partp->dp_start /
 +				    dos_sectors * dos_sectors;
 +		    		partp->dp_start = prev_head_boundary +
 +				    dos_sectors;
 +			}
 +		} else {
 +			partp->dp_start = str2sectors(command->args[2].arg_str);
 +			if (partp->dp_start == NOSECTORS)
 +				break;
 +		}
 +	} else
 +		partp->dp_start = command->args[2].arg_val;
 +
 +	if (command->args[3].arg_str != NULL) {
 +		if (strcmp(command->args[3].arg_str, "*") == 0)
 +			partp->dp_size = ((disksecs / dos_cylsecs) *
 +			    dos_cylsecs) - partp->dp_start;
 +		else {
 +			partp->dp_size = str2sectors(command->args[3].arg_str);
 +			if (partp->dp_size == NOSECTORS)
 +				break;
 +		}
 +		prev_cyl_boundary = ((partp->dp_start + partp->dp_size) /
 +		    dos_cylsecs) * dos_cylsecs;
 +		if (prev_cyl_boundary > partp->dp_start)
 +			partp->dp_size = prev_cyl_boundary - partp->dp_start;
 +	} else
 +		partp->dp_size = command->args[3].arg_val;
 +
  	max_end = partp->dp_start + partp->dp_size;
  
  	if (partp->dp_typ == 0) {
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: closed->patched 
State-Changed-By: brian 
State-Changed-When: Mon May 25 21:25:00 UTC 2009 
State-Changed-Why:  
I'll MFC the fix in 3 weeks 

http://www.freebsd.org/cgi/query-pr.cgi?pr=68312 
State-Changed-From-To: patched->closed 
State-Changed-By: brian 
State-Changed-When: Mon Jun 15 07:18:02 UTC 2009 
State-Changed-Why:  
Merged the fix into stable/7 - r194234 

http://www.freebsd.org/cgi/query-pr.cgi?pr=68312 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/68312: commit references a PR
Date: Mon, 15 Jun 2009 07:18:19 +0000 (UTC)

 Author: brian
 Date: Mon Jun 15 07:17:55 2009
 New Revision: 194234
 URL: http://svn.freebsd.org/changeset/base/194234
 
 Log:
   MFC: r192745: Enhance the 'p' command so that it understands size
   qualifiers (K/M/G) and so that it understands '*' as 'DTRT'.
   
   PR:		68312
 
 Modified:
   stable/7/sbin/fdisk/   (props changed)
   stable/7/sbin/fdisk/fdisk.8
   stable/7/sbin/fdisk/fdisk.c
 
 Modified: stable/7/sbin/fdisk/fdisk.8
 ==============================================================================
 --- stable/7/sbin/fdisk/fdisk.8	Mon Jun 15 04:31:34 2009	(r194233)
 +++ stable/7/sbin/fdisk/fdisk.8	Mon Jun 15 07:17:55 2009	(r194234)
 @@ -372,6 +372,31 @@ starting at sector
  for
  .Ar length
  sectors.
 +If the
 +.Ar start
 +or
 +.Ar length
 +is suffixed with a
 +.Em K ,
 +.Em M
 +or
 +.Em G ,
 +it is taken as a
 +.Em Kilobyte ,
 +.Em Megabyte
 +or
 +.Em Gigabyte
 +measurement respectively.
 +If the
 +.Ar start
 +is given as
 +.Qq *
 +it is set to the value of the previous partition end.
 +If the
 +.Ar length
 +is given as
 +.Qq *
 +the partition end is set to the end of the disk.
  .Pp
  Only those slices explicitly mentioned by these lines are modified;
  any slice not referenced by a
 @@ -421,6 +446,17 @@ for 2503871 sectors (note: these numbers
  downwards to correspond to head and cylinder boundaries):
  .Pp
  .Dl "p       1       165     1       2503871"
 +.Pp
 +Example: to set slices 1, 2 and 4 to
 +.Fx
 +slices, the first being 2 Gigabytes, the second being 10 Gigabytes and the
 +forth being the remainder of the disk (again, numbers will be rounded
 +appropriately):
 +.Pp
 +.Dl "p       1       165     63      2G"
 +.Dl "p       2       165     *       10G"
 +.Dl "p       3       0       0       0"
 +.Dl "p       4       165     *       *"
  .It Ic a Ar slice
  Make
  .Ar slice
 
 Modified: stable/7/sbin/fdisk/fdisk.c
 ==============================================================================
 --- stable/7/sbin/fdisk/fdisk.c	Mon Jun 15 04:31:34 2009	(r194233)
 +++ stable/7/sbin/fdisk/fdisk.c	Mon Jun 15 07:17:55 2009	(r194234)
 @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
  
  int iotest;
  
 +#define NOSECTORS ((u_int32_t)-1)
  #define LBUF 100
  static char lbuf[LBUF];
  
 @@ -107,6 +108,7 @@ typedef struct cmd {
      struct arg {
  	char	argtype;
  	int	arg_val;
 +	char	*arg_str;
      }			args[MAX_ARGS];
  } CMD;
  
 @@ -1001,16 +1003,23 @@ parse_config_line(char *line, CMD *comma
  	 */
  	    while (1) {
  	    while (isspace(*cp)) ++cp;
 +	    if (*cp == '\0')
 +		break;		/* eol */
  	    if (*cp == '#')
  		break;		/* found comment */
  	    if (isalpha(*cp))
  		command->args[command->n_args].argtype = *cp++;
 -	    if (!isdigit(*cp))
 -		break;		/* assume end of line */
  	    end = NULL;
  	    command->args[command->n_args].arg_val = strtol(cp, &end, 0);
 -	    if (cp == end)
 -		break;		/* couldn't parse number */
 + 	    if (cp == end || (!isspace(*end) && *end != '\0')) {
 + 		char ch;
 + 		end = cp;
 + 		while (!isspace(*end) && *end != '\0') ++end;
 + 		ch = *end; *end = '\0';
 + 		command->args[command->n_args].arg_str = strdup(cp);
 + 		*end = ch;
 + 	    } else
 + 		command->args[command->n_args].arg_str = NULL;
  	    cp = end;
  	    command->n_args++;
  	}
 @@ -1109,6 +1118,33 @@ process_geometry(CMD *command)
      return (status);
  }
  
 +static u_int32_t
 +str2sectors(const char *str)
 +{
 +	char *end;
 +	unsigned long val;
 +
 +	val = strtoul(str, &end, 0);
 +	if (str == end || *end == '\0') {
 +		warnx("ERROR line %d: unexpected size: \'%s\'",
 +		    current_line_number, str);
 +		return NOSECTORS;
 +	}
 +
 +	if (*end == 'K') 
 +		val *= 1024UL / secsize;
 +	else if (*end == 'M')
 +		val *= 1024UL * 1024UL / secsize;
 +	else if (*end == 'G')
 +		val *= 1024UL * 1024UL * 1024UL / secsize;
 +	else {
 +		warnx("ERROR line %d: unexpected modifier: %c "
 +		    "(not K/M/G)", current_line_number, *end);
 +		return NOSECTORS;
 +	}
 +
 +	return val;
 +}
  
  static int
  process_partition(CMD *command)
 @@ -1134,8 +1170,48 @@ process_partition(CMD *command)
  	partp = ((struct dos_partition *) &mboot.parts) + partition - 1;
  	bzero((char *)partp, sizeof (struct dos_partition));
  	partp->dp_typ = command->args[1].arg_val;
 -	partp->dp_start = command->args[2].arg_val;
 -	partp->dp_size = command->args[3].arg_val;
 +	if (command->args[2].arg_str != NULL) {
 +		if (strcmp(command->args[2].arg_str, "*") == 0) {
 +			int i;
 +			partp->dp_start = dos_sectors;
 +			for (i = 1; i < partition; i++) {
 +    				struct dos_partition *prev_partp;
 +				prev_partp = ((struct dos_partition *)
 +				    &mboot.parts) + i - 1;
 +				if (prev_partp->dp_typ != 0)
 +					partp->dp_start = prev_partp->dp_start +
 +					    prev_partp->dp_size;
 +			}
 +			if (partp->dp_start % dos_sectors != 0) {
 +		    		prev_head_boundary = partp->dp_start /
 +				    dos_sectors * dos_sectors;
 +		    		partp->dp_start = prev_head_boundary +
 +				    dos_sectors;
 +			}
 +		} else {
 +			partp->dp_start = str2sectors(command->args[2].arg_str);
 +			if (partp->dp_start == NOSECTORS)
 +				break;
 +		}
 +	} else
 +		partp->dp_start = command->args[2].arg_val;
 +
 +	if (command->args[3].arg_str != NULL) {
 +		if (strcmp(command->args[3].arg_str, "*") == 0)
 +			partp->dp_size = ((disksecs / dos_cylsecs) *
 +			    dos_cylsecs) - partp->dp_start;
 +		else {
 +			partp->dp_size = str2sectors(command->args[3].arg_str);
 +			if (partp->dp_size == NOSECTORS)
 +				break;
 +		}
 +		prev_cyl_boundary = ((partp->dp_start + partp->dp_size) /
 +		    dos_cylsecs) * dos_cylsecs;
 +		if (prev_cyl_boundary > partp->dp_start)
 +			partp->dp_size = prev_cyl_boundary - partp->dp_start;
 +	} else
 +		partp->dp_size = command->args[3].arg_val;
 +
  	max_end = partp->dp_start + partp->dp_size;
  
  		if (partp->dp_typ == 0) {
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
