diff options
author | ngie <ngie@FreeBSD.org> | 2015-11-09 09:28:34 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-11-09 09:28:34 +0000 |
commit | f1478935ff04599c9756ed48a9307dae01308f24 (patch) | |
tree | 46d8e83ecb70b120aa7a15b809a9b8f83a498fb1 /usr.sbin | |
parent | 5af653d140ca40d59833c8da1889f125eddb16e2 (diff) | |
download | FreeBSD-src-f1478935ff04599c9756ed48a9307dae01308f24.zip FreeBSD-src-f1478935ff04599c9756ed48a9307dae01308f24.tar.gz |
MFC r266930,r289225:
r266930 (by jmg):
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..
r289225 (by sbruno):
makefs(8) leaves sblock.fs_providersize uninitialized (zero) that can be easily
checked with dumpfs(8). This may lead to other problems, f.e. geom_label kernel
module sanity checks do not like zero fs_old_size value and skips such UFS1
file system while tasting (fs_old_size derives from sblock.fs_providersize).
PR: 203704
Submitted by: eugen@grosbein.net
Reviewed by: marcel
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/makefs/ffs/mkfs.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c index f99ecab..b1bdd09 100644 --- a/usr.sbin/makefs/ffs/mkfs.c +++ b/usr.sbin/makefs/ffs/mkfs.c @@ -248,15 +248,16 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts) exit(21); } sblock.fs_fsbtodb = ilog2(sblock.fs_fsize / sectorsize); - sblock.fs_size = fssize = dbtofsb(&sblock, fssize); + sblock.fs_size = sblock.fs_providersize = fssize = + dbtofsb(&sblock, fssize); 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 +273,11 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts) 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 = |