Home | History | Annotate | Download | only in installboot
History log of /src/usr.sbin/installboot/ffs.c
RevisionDateAuthorComments
 1.33  17-Nov-2022  chs Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).
 1.32  23-Jun-2013  dholland fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)
 1.31  19-Jun-2013  dholland Rename ambiguous macros:
MAXDIRSIZE -> UFS_MAXDIRSIZE or LFS_MAXDIRSIZE
NINDIR -> FFS_NINDIR, EXT2_NINDIR, LFS_NINDIR, or MFS_NINDIR
INOPB -> FFS_INOPB, LFS_INOPB
INOPF -> FFS_INOPF, LFS_INOPF
blksize -> ffs_blksize, ext2_blksize, or lfs_blksize
sblksize -> ffs_blksize

These are not the only ambiguously defined filesystem macros, of
course, there's a pile more. I may not have found all the ambiguous
definitions of blksize(), too, as there are a lot of other things
called 'blksize' in the system.
 1.30  22-Jan-2013  dholland Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically:
ROOTINO -> UFS_ROOTINO
WINO -> UFS_WINO
NXADDR -> UFS_NXADDR
NDADDR -> UFS_NDADDR
NIADDR -> UFS_NIADDR
MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN
MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have
the same values in ext2fs and ffs.

No functional change intended.
 1.29  14-Jan-2010  tsutsui branches: 1.29.6; 1.29.12;
Remove if defined(__RCSID) around __RCSID() macro.
#include "nbtool_config.h" is enough for tools.
 1.28  07-Jan-2010  tsutsui Add a sectorsize parameter member in struct ib_params and use it
where sector size (disk block size) is required, instead of
DEV_BSIZE constant which means device I/O block size.

"Looks reasonable" from dholland@, and fixes tools installboot(8)
on Cygwin where DEV_BSIZE != 512 as mentioned in PR toolchain/42555.
 1.27  05-Apr-2009  lukem fix sign-compare issues
 1.26  12-Oct-2008  apb branches: 1.26.4;
Try to improve warning messages when stage2 bootstrap is not found
in the root of the file systrem in which the installation is being
performed.

Inspired by PR 39728 by der Mouse
 1.25  28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.24  30-Oct-2006  he branches: 1.24.16;
In order to avoid warnings (which is converted to error with -Werror)
about empty bodies in an if-statement, we need to make add some proprocessor
conditionals around these if statements. FFS byte-swapping is sometimes
compiled out of install-media versions of this program.
 1.23  23-Oct-2006  christos buf can never be NULL (jani at xeebioneurope dot de)
 1.22  22-Oct-2006  christos remove dead code.
 1.21  20-Sep-2006  bad Apply changes to ffs_find_disk_blocks_ufs1() from revision 1.19
to ffs_find_disk_blocks_ufs2() too. Except for data types the
code in the two functions is the same.

From the original commit message:
Add support for finding files on RAID partitions. This allows us to
add the block list of the 2nd stage boot loader to the 1st stage boot
loader when the partition is a RAID partition.

Briefly tested under 3.x/i386.
 1.20  20-Jun-2006  jdc Don't include <dev/raidframe/raidframevar.h> but define RF_PROTECTED_SECTORS
directly.

Including raidframevar.h needs several definitions adding to the compat
framework for the tools builds, which aren't needed here.

XXX It's probably sensible to split off the few defines from raidframevar.h
into a separate header file.
 1.19  20-Jun-2006  jdc Add support for finding files on RAID partitions. This allows us to
add the block list of the 2nd stage boot loader to the 1st stage boot
loader when the partition is a RAID partition. Tested on sparc.

Reviewed by gdt.
 1.18  18-Feb-2006  dsl Remove support for byteswapped file systems if NO_FFS_SWAP is defined.
For SAMLLPROG builds.
 1.17  23-Oct-2005  thorpej Use the real field name (d_fileno instead of d_ino).
 1.16  19-Aug-2005  christos 64 bit inode changes
 1.15  20-Jun-2004  jmc branches: 1.15.2;
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.14  21-Mar-2004  dsl branches: 1.14.2;
When searching for the superblock, don't pick an ffsv1 superblock from the
location where we expect to find an ffsv2 superblock.
It could be the first alternate for a ffsv1 filesystem with 64k blocks.
Fixes part of PR kern/24809
 1.13  06-Oct-2003  lukem spelo in comment
 1.12  30-May-2003  dsl Another mistake in the ufs2 code - a missing else.
 1.11  05-Apr-2003  he Fix two mistakes done in the UFS2 merge:
o Correct the order of arguments to ffs_read_disk_block; the second one
is blocknumber to read, not the size to be read. This would affect the
UFS2 code, and is thus not much excercised at the moment.
o The offsets in SBLOCKSEARCH are in bytes, but ffs_read_disk_block wants
its location in terms of DEV_BSIZE blocks. Fix this bug in ffs_match().
The latter together with the recent magic number fix to <ufs/ffs/fs.h>
fixes a cross build problem seen when doing a i386->sparc build.
 1.10  02-Apr-2003  he Add cats for printf %llu arguments, for the benefit of LP64 platforms.
 1.9  02-Apr-2003  he With the new UFS2 code, alternative places are searched for a super-block.
This includes block #0. Therefore, allow read of block #0 in
ffs_read_disk_block(); change assert (blkno > 0) to (blkno >= 0).
 1.8  02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.7  24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.6  15-May-2002  lukem bootblock.h:
- unify sparc_bbinfo (1064 bytes, with 256 block entries)
and sun68k_bbinfo (296 byte, with 64 block entries)
into shared_bbinfo (512 bytes, with 118 block entries),
which will be also shared by future bbinfo-using platforms
(including macppc)
- add datestamp to *_BBINFO_MAGIC strings, to prevent installboot vs
bootxx version skew.
- add macppc support

*/bootxx.c:
- migrate to new shared_bbinfo structure

installboot:
- add macppc support (still needs applepartmap support and testing)
- improve and add some more warnings & errors to installboot
- implement shared_bbinfo_clearboot() and shared_bbinfo_setboot(), which
perform the majority of the work for bbinfo-using back-ends
(rather than replicating that across multiple back-ends).
 1.5  14-May-2002  lukem user visible stuff:
- add `-B s2bno', to provide the starting block for the secondary bootstrap.
intended for use on platforms where the blocks of the stage2 bootstrap
are hardcoded into the stage1 bootstrap (currently: sparc, sun2)
- don't support `-b s1bno' for sparc or sun2, since the primary is always
at a fixed location on the disk.
- if `filesystem' is a regular file, use fsync(2) instead of sync(2)

code changes:
- add hardcode_stage2(), which uses -B s2bno and the size of the
provided secondary bootstrap (as an actual file, not as part of the
`filesystem' argument) to provide a sequential list of blocks from s2bno,
each block being the appropriate file system size (from
params->fstype->blocksize)
- add blocksize and needswap run-time parameters to ib_fs
- in *_match(), set params->fstype->blocksize to the underlying block size
(8KB for raw), and params->fstype->needswap as appropriate
- rename IB_STARTBLOCK to IB_STAGE1START, and add IB_STAGE2START
- use hardcode_stage2() to implement raw_findstage2() and IB_STAGE2BLOCK
support for ffs_findstage2()
- improve some comments, add some prototypes, ...
 1.4  07-May-2002  pk Stop directory entry search if d_reclen == 0.
 1.3  02-May-2002  lukem tweak asserts
 1.2  30-Apr-2002  lukem add some more assert()s
 1.1  19-Apr-2002  lukem - Add code from Matt Fredette <fredette@theory.lcs.mit.edu> to implement
fstype checking, and back-end "ffs" support.
- Consistently use at least uint32_t for blocknumbers (vs. int / long / ...)
- Consistently use uintXX_t instead of u_intXX_t.
- Move various duplicated prototypes into "installboot.h"
 1.14.2.1  22-Jun-2004  tron Pull up revision 1.15 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.15.2.3  09-Nov-2006  tron Pull up following revision(s) (requested by bad in ticket #1524):
usr.sbin/installboot/ffs.c: revision 1.21
Apply changes to ffs_find_disk_blocks_ufs1() from revision 1.19
to ffs_find_disk_blocks_ufs2() too. Except for data types the
code in the two functions is the same.
From the original commit message:
Add support for finding files on RAID partitions. This allows us to
add the block list of the 2nd stage boot loader to the 1st stage boot
loader when the partition is a RAID partition.
Briefly tested under 3.x/i386.
 1.15.2.2  09-Nov-2006  tron Pull up following revision(s) (requested by bad in ticket #1524):
usr.sbin/installboot/ffs.c: revision 1.20
Don't include <dev/raidframe/raidframevar.h> but define RF_PROTECTED_SECTORS
directly.
Including raidframevar.h needs several definitions adding to the compat
framework for the tools builds, which aren't needed here.
XXX It's probably sensible to split off the few defines from raidframevar.h
into a separate header file.
 1.15.2.1  09-Nov-2006  tron Pull up following revision(s) (requested by bad in ticket #1524):
usr.sbin/installboot/installboot.8: revision 1.54 via patch
usr.sbin/installboot/installboot.h: revision 1.31
usr.sbin/installboot/fstypes.c: revision 1.9
usr.sbin/installboot/ffs.c: revision 1.19
Add support for finding files on RAID partitions. This allows us to
add the block list of the 2nd stage boot loader to the 1st stage boot
loader when the partition is a RAID partition. Tested on sparc.
Reviewed by gdt.
 1.24.16.1  18-May-2008  yamt sync with head.
 1.26.4.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.29.12.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.29.12.2  23-Jun-2013  tls resync from head
 1.29.12.1  25-Feb-2013  tls resync with head
 1.29.6.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.6.1  23-Jan-2013  yamt sync with head

RSS XML Feed