History log of /freebsd-10-stable/sys/boot/common/ufsread.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 294997 28-Jan-2016 smh

MFC r281060, r294060, r294291, r294493, r294284:

MFC r281060:
Remove an unnecessary space in a printf call

MFC r294060:
Modularise EFI boot loader

MFC r294291 (by andrew):
Reset the filesystem cache

MFC r294493:
Fix EFI UFS caching

MFC r294284 (by emaste):
boot1: correct typo in error message

Sponsored by: Multiplay


# 294982 28-Jan-2016 smh

MFC r294059:

Ensure boot fsread correctly probes all partitions

Sponsored by: Multiplay


# 294981 28-Jan-2016 smh

MFC r281169, r293724, r293796, r294029, r294041, r294058

MFC r281169 (by andrew):
Make global variabled only used in this file static

MFC r294058:
Make common boot file_loadraw name parameter const

MFC r294041:
Remove unused reg param from fdt_fixup_memory

MFC r293724:
Enable warnings in EFI boot code

MFC r293796:
Fix typo in libefi.c

MFC r294029:
Only build EFI components on supported compilers

Sponsored by: Multiplay


# 294721 25-Jan-2016 smh

MFC r293461:

Remove hidden "Not ufs" printfs from boot code

Sponsored by: Multiplay


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 235988 25-May-2012 gleb

Use 32-bit ufs_ino_t instead of ino_t to keep boot2 small and prevent
unnecessary 64-bit math on 32-bit machines.

Sponsored by: Google Summer of Code 2011


# 233105 18-Mar-2012 marius

Declare some variables static in order to reduce the object size and
redo r232822 in a less hackish way. The latter now no longer breaks
compiling the x86 boot2 with clang.

MFC after: 1 week


# 232822 11-Mar-2012 marius

Fix a bug introduced in r223938; on big-endian machines coping a 32-bit
quantum bytewise to the address of a 64-bit variable results in writing
to the "wrong" 32-bit half so adjust the address accordingly. This fix
is implemented in a hackish way for two reasons:
o in order to be able to get it into 8.3 with zero impact on the little-
endian architectures where this bug has no effect and
o to avoid blowing the x86 boot2 out of the water again when compiling
it with clang, which all sane versions of this fix tested do.
This change fixes booting from UFS1 file systems on big-endian machines.

MFC after: 3 days


# 223938 11-Jul-2011 marius

Since r219452 the alignment of __dmadat has changed, revealing that fsread()
bogusly casts its contents around causing alignment faults on sparc64 and
most likely also on at least powerpc. Fix this by copying the contents
bytewise instead as partly already done here. Solving this the right way
costs some space, i.e. 148 bytes with GCC and 16 bytes with clang on x86
there are still some bytes left there though, and an acceptable hack which
tricks the compiler into only using a 2-byte alignment instead of the native
one when accessing the contents turned out to even take up more space that.


# 219452 10-Mar-2011 rdivacky

Some more shrinking.

o bunch of variables are turned into uint8_t

o initial setting of namep[] in lookup() is removed
as it's only overwritten a few lines down

o kname is explicitly initialized in main() as BSS
in boot2 is not zeroed

o the setting and reading of "fmt" in load() is removed

o buf in printf() is made static to save space

Reviewed by: jhb
Tested by: me and Fabian Keil <freebsd-listen fabiankeil de>


# 218716 15-Feb-2011 dim

In sys/boot/common/ufsread.c, use uint8_t instead of u_int8_t.

Submitted by: mdf


# 218713 15-Feb-2011 dim

Apply a few small optimizations to boot2's code, to make it shrink a
little further. This gets us further on the way to be able to build it
successfully with clang. Using in-tree gcc, this shrinks boot2.bin with
60 bytes, the in-tree clang shaves off 72 bytes, and ToT clang 84 bytes.

Submitted by: rdivacky
Reviewed by: imp


# 211747 24-Aug-2010 rpaulo

Replace structure assignments with explicity memcpy calls. This allows
Clang to compile this file: it was using the builtin memcpy and we want
to use the memcpy defined in gptboot.c. (Clang can't compile boot2 yet).

Submitted by: Dimitry Andric <dimitry at andric.com>
Reviewed by: jhb


# 192972 28-May-2009 dfr

Some of the boot loader code only works on a ufs file system, but it
uses the generic struct dirent, which happens to look identical to UFS's
struct direct. If BSD ever changes dirent then this will be a problem.

Submitted by: matthew dot fleming at isilon dot com


# 179634 07-Jun-2008 kib

Fix the incorrect calculation of a block address within a single indirect
block.

PR: 108215
Submitted by: Yuichiro Goto, y7goto gmail com
MFC after: 2 weeks


# 173040 26-Oct-2007 jhb

Use the smaller cgbase() macro in ufsread.c if UFS_SMALL_CGBASE is
defined. This lets each boot program choose which version of cgbase() it
wants to use rather than forcing ufsread.c to have that knowledge.

MFC after: 1 week
Discussed with: imp


# 173024 26-Oct-2007 imp

The arm boot code uses this function as well. Redefining cgbase()
saves about 500 bytes in the boot code. While the AT91RM9200 has 12k
of space for the boot loader, which is more than i386's 8k, the code
generated by gcc is a bit bigger.

I've had this in p4 for about two years now.


# 172940 24-Oct-2007 jhb

First cut at support for booting a GPT labeled disk via the BIOS bootstrap
on i386 and amd64 machines. The overall process is that /boot/pmbr lives
in the PMBR (similar to /boot/mbr for MBR disks) and is responsible for
locating and loading /boot/gptboot. /boot/gptboot is similar to /boot/boot
except that it groks GPT rather than MBR + bsdlabel. Unlike /boot/boot,
/boot/gptboot lives in its own dedicated GPT partition with a new
"FreeBSD boot" type. This partition does not have a fixed size in that
/boot/pmbr will load the entire partition into the lower 640k. However,
it is limited in that it can only be 545k. That's still a lot better than
the current 7.5k limit for boot2 on MBR. gptboot mostly acts just like
boot2 in that it reads /boot.config and loads up /boot/loader. Some more
details:
- Include uuid_equal() and uuid_is_nil() in libstand.
- Add a new 'boot' command to gpt(8) which makes a GPT disk bootable using
/boot/pmbr and /boot/gptboot. Note that the disk must have some free
space for the boot partition.
- This required exposing the backend of the 'add' function as a
gpt_add_part() function to the rest of gpt(8). 'boot' uses this to
create a boot partition if needed.
- Don't cripple cgbase() in the UFS boot code for /boot/gptboot so that
it can handle a filesystem > 1.5 TB.
- /boot/gptboot has a simple loader (gptldr) that doesn't do any I/O
unlike boot1 since /boot/pmbr loads all of gptboot up front. The
C portion of gptboot (gptboot.c) has been repocopied from boot2.c.
The primary changes are to parse the GPT to find a root filesystem
and to use 64-bit disk addresses. Currently gptboot assumes that the
first UFS partition on the disk is the / filesystem, but this algorithm
will likely be improved in the future.
- Teach the biosdisk driver in /boot/loader to understand GPT tables.
GPT partitions are identified as 'disk0pX:' (e.g. disk0p2:) which is
similar to the /dev names the kernel uses (e.g. /dev/ad0p2).
- Add a new "freebsd-boot" alias to g_part() for the new boot UUID.

MFC after: 1 month
Discussed with: marcel (some things might still change, but am committing
what I have so far)


# 141060 30-Jan-2005 rwatson

Insert an explicit McAfee license, as we use a stock two-clause BSD
license rather than the slightly custom licence in ufsread.c.


# 131575 04-Jul-2004 stefanf

Consistently use __inline instead of __inline__ as the former is an empty macro
in <sys/cdefs.h> for compilers without support for inline.


# 119483 25-Aug-2003 obrien

Use __FBSDID().
Also some minor style cleanups.


# 111456 24-Feb-2003 obrien

Only apply rev 1.10 (which hacks around the i386 boot2 being too big for
both ufs1 and ufs2 support) on i386.


# 111410 24-Feb-2003 mckusick

Revert to old (broken for over 1.5Tb filesystems) version of cgbase
so that boot loader once again will fit.

Sponsored by: DARPA & NAI Labs.


# 107877 14-Dec-2002 phk

Restructure so we can compile UFS1_ONLY, UFS2_ONLY or UFS1_AND_UFS2
versions from the same basic function.


# 107294 27-Nov-2002 mckusick

Create a new 32-bit fs_flags word in the superblock. Add code to move
the old 8-bit fs_old_flags to the new location the first time that the
filesystem is mounted by a new kernel. One of the unused flags in
fs_old_flags is used to indicate that the flags have been moved.
Leave the fs_old_flags word intact so that it will work properly if
used on an old kernel.

Change the fs_sblockloc superblock location field to be in units
of bytes instead of in units of filesystem fragments. The old units
did not work properly when the fragment size exceeeded the superblock
size (8192). Update old fs_sblockloc values at the same time that
the flags are moved.

Suggested by: BOUWSMA Barry <freebsd-misuser@netscum.dyndns.dk>
Sponsored by: DARPA & NAI Labs.


# 104678 08-Oct-2002 phk

It seems that the only problem with UFS2 booting on i386 is the 64bit
divide/remainder calls. For reasons not resolved, compiling the
relevant routines from libkern into boot2 results in stack corruption.

Do the simple thing: Don't use 64bit divide/remainder operations.

Sponsored by: DARPA & NAI Labs


# 104612 07-Oct-2002 phk

Move the definition of UFS1_ONLY into the Makefiles where it belongs.

Sponsored by: DARPA & NAI Labs.


# 98593 21-Jun-2002 jake

Enable UFS1_AND_UFS2 support for sparc64 by default. Booting from ufs1 or
ufs2 filesystems seems to work fine.


# 98542 21-Jun-2002 mckusick

This commit adds basic support for the UFS2 filesystem. The UFS2
filesystem expands the inode to 256 bytes to make space for 64-bit
block pointers. It also adds a file-creation time field, an ability
to use jumbo blocks per inode to allow extent like pointer density,
and space for extended attributes (up to twice the filesystem block
size worth of attributes, e.g., on a 16K filesystem, there is space
for 32K of attributes). UFS2 fully supports and runs existing UFS1
filesystems. New filesystems built using newfs can be built in either
UFS1 or UFS2 format using the -O option. In this commit UFS1 is
the default format, so if you want to build UFS2 format filesystems,
you must specify -O 2. This default will be changed to UFS2 when
UFS2 proves itself to be stable. In this commit the boot code for
reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c)
as there is insufficient space in the boot block. Once the size of the
boot block is increased, this code can be defined.

Things to note: the definition of SBSIZE has changed to SBLOCKSIZE.
The header file <ufs/ufs/dinode.h> must be included before
<ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and
ufs_lbn_t.

Still TODO:
Verify that the first level bootstraps work for all the architectures.
Convert the utility ffsinfo to understand UFS2 and test growfs.
Add support for the extended attribute storage. Update soft updates
to ensure integrity of extended attribute storage. Switch the
current extended attribute interfaces to use the extended attribute
storage. Add the extent like functionality (framework is there,
but is currently never used).

Sponsored by: DARPA & NAI Labs.
Reviewed by: Poul-Henning Kamp <phk@freebsd.org>


# 97864 05-Jun-2002 phk

Make sparc64 share ufsread.c with i386.

Sponsored by: DARPA & NAI Labs.


# 97861 05-Jun-2002 phk

Indent this file more like style(9).

Sponsored by: DARPA & NAI Labs.


# 97860 05-Jun-2002 phk

Preparation for UFS2 commit:

Factor the ufs reading code out of the i386/boot2 loader so it can
be reused by for instance sparc64.

Sponsored by: DARPA and NAI Labs.