Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 May 2014 20:26:34 +0000 (UTC)
From:      John-Mark Gurney <jmg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266930 - head/usr.sbin/makefs/ffs
Message-ID:  <201405312026.s4VKQY4p008530@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmg
Date: Sat May 31 20:26:34 2014
New Revision: 266930
URL: http://svnweb.freebsd.org/changeset/base/266930

Log:
  convert to using the _daddr_t types like newfs was...
  
  Put the superblock in the correct possition for UFS2... There is a bug
  in FFS that if we don't put it here (for UFS2), it will forcefully
  relocate the superblock, and I believe cause data loss..
  
  I have a fix for that, but w/ how many releases are broken, we won't be
  able to switch to the better _FLOPPY (block 0) for this for a while..

Modified:
  head/usr.sbin/makefs/ffs/mkfs.c

Modified: head/usr.sbin/makefs/ffs/mkfs.c
==============================================================================
--- head/usr.sbin/makefs/ffs/mkfs.c	Sat May 31 16:22:58 2014	(r266929)
+++ head/usr.sbin/makefs/ffs/mkfs.c	Sat May 31 20:26:34 2014	(r266930)
@@ -253,10 +253,10 @@ ffs_mkfs(const char *fsys, const fsinfo_
 	if (Oflag <= 1) {
 		sblock.fs_magic = FS_UFS1_MAGIC;
 		sblock.fs_sblockloc = SBLOCK_UFS1;
-		sblock.fs_nindir = sblock.fs_bsize / sizeof(int32_t);
+		sblock.fs_nindir = sblock.fs_bsize / sizeof(ufs1_daddr_t);
 		sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs1_dinode);
 		sblock.fs_maxsymlinklen = ((NDADDR + NIADDR) *
-		    sizeof (int32_t));
+		    sizeof (ufs1_daddr_t));
 		sblock.fs_old_inodefmt = FS_44INODEFMT;
 		sblock.fs_old_cgoffset = 0;
 		sblock.fs_old_cgmask = 0xffffffff;
@@ -272,15 +272,11 @@ ffs_mkfs(const char *fsys, const fsinfo_
 		sblock.fs_old_nrpos = 1;
 	} else {
 		sblock.fs_magic = FS_UFS2_MAGIC;
-#if 0 /* XXX makefs is used for small filesystems. */
 		sblock.fs_sblockloc = SBLOCK_UFS2;
-#else
-		sblock.fs_sblockloc = SBLOCK_UFS1;
-#endif
-		sblock.fs_nindir = sblock.fs_bsize / sizeof(int64_t);
+		sblock.fs_nindir = sblock.fs_bsize / sizeof(ufs2_daddr_t);
 		sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs2_dinode);
 		sblock.fs_maxsymlinklen = ((NDADDR + NIADDR) *
-		    sizeof (int64_t));
+		    sizeof (ufs2_daddr_t));
 	}
 
 	sblock.fs_sblkno =



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