Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Mar 2014 22:39:22 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r263843 - user/marcel/mkimg
Message-ID:  <201403272239.s2RMdMTv017945@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Thu Mar 27 22:39:22 2014
New Revision: 263843
URL: http://svnweb.freebsd.org/changeset/base/263843

Log:
  Remove trksz, which was hardcoded to 1, and replace it by secs, which
  can be set on the command line.

Modified:
  user/marcel/mkimg/ebr.c

Modified: user/marcel/mkimg/ebr.c
==============================================================================
--- user/marcel/mkimg/ebr.c	Thu Mar 27 21:43:00 2014	(r263842)
+++ user/marcel/mkimg/ebr.c	Thu Mar 27 22:39:22 2014	(r263843)
@@ -68,7 +68,7 @@ ebr_write(int fd, lba_t imgsz __unused, 
 	u_char *ebr;
 	struct dos_partition *dp;
 	struct part *part, *next;
-	lba_t block, trksz;
+	lba_t block;
 	int error;
 
 	ebr = malloc(secsz);
@@ -78,27 +78,26 @@ ebr_write(int fd, lba_t imgsz __unused, 
 	le16enc(ebr + DOSMAGICOFFSET, DOSMAGIC);
 
 	error = 0;
-	trksz = 1;	/* Sectors/track */
 	STAILQ_FOREACH_SAFE(part, &partlist, link, next) {
-		block = part->block - trksz;
+		block = part->block - nsecs;
 		dp = (void *)(ebr + DOSPARTOFF);
-		ebr_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect, trksz);
+		ebr_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect, nsecs);
 		dp->dp_typ = ALIAS_TYPE2INT(part->type);
 		ebr_chs(&dp->dp_ecyl, &dp->dp_ehd, &dp->dp_esect,
 		    part->block + part->size - 1);
-		le32enc(&dp->dp_start, trksz);
+		le32enc(&dp->dp_start, nsecs);
 		le32enc(&dp->dp_size, part->size);
 
 		/* Add link entry */
 		if (next != NULL) {
 			dp++;
 			ebr_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect,
-			    next->block - trksz);
+			    next->block - nsecs);
 			dp->dp_typ = DOSPTYP_EXT;
 			ebr_chs(&dp->dp_ecyl, &dp->dp_ehd, &dp->dp_esect,
 			    next->block + next->size - 1);
-			le32enc(&dp->dp_start, next->block - trksz);
-			le32enc(&dp->dp_size, next->size + trksz);
+			le32enc(&dp->dp_start, next->block - nsecs);
+			le32enc(&dp->dp_size, next->size + nsecs);
 		}
 
 		error = mkimg_seek(fd, block);



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