Home | History | Annotate | Download | only in libsa
History log of /src/sys/lib/libsa/ext2fs.c
RevisionDateAuthorComments
 1.34  29-Apr-2022  rin Re-introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize for some archs.

Should be useful for ancient archs, for which secsize is fixed.

Thanks christos@ for comment.
 1.33  27-Apr-2022  rin Revert previous at the moment.

This is wrong reasoning; 68020 and above (incl. 040 and 060) support
32-bit displacements for PC relative addressing (via "fully extension
addressing mode" with null index register).

I've still not figured out what goes wrong with amiga/boot(8) when
compiled without -l option for gas(1)...

On 2022/04/27 20:48, Rin Okuyama wrote:
> Module Name: src
> Committed By: rin
> Date: Wed Apr 27 11:48:26 UTC 2022
>
> Modified Files:
> src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c
>
> Log Message:
> Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
> used instead of secsize obtained by SAIOSECSIZE ioctl.
>
> This hack avoids divdi3 and friends from being linked, in order to
> support variable secsize.
>
> This is useful for amiga/boot(8); it is loaded by firmware into
> unpredictable address, and therefore all symbols should be
> addressable by PC relative mode with only 16-bit displacements.
>
> See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
> more details.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libsa/ext2fs.c
> cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libsa/minixfs3.c
> cvs rdiff -u -r1.83 -r1.84 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
 1.32  27-Apr-2022  rin Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize.

This is useful for amiga/boot(8); it is loaded by firmware into
unpredictable address, and therefore all symbols should be
addressable by PC relative mode with only 16-bit displacements.

See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
more details.
 1.31  24-Apr-2022  mlelstv Ask driver about sector size to support reading superblocks from fixed
byte offsets.
 1.30  19-Apr-2022  skrll Typo in comment. avoinds -> avoids
 1.29  24-Jan-2020  jakllsch Use dp->e2d_namlen rather than strlen(dp->e2d_name) in ext2fs_ls().

Prevents garbage beyond the end of the name from appearing on screen.
 1.28  24-Jun-2019  pgoyette branches: 1.28.4;
Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.
 1.27  05-Apr-2019  christos Go back ot using 0x%x instead of %#x because we don't always support the
format. See subr_prf.c
 1.26  31-Mar-2019  christos fix warnings, printf formats, etc.
 1.25  21-Aug-2016  christos branches: 1.25.16;
delete now unused function .
 1.24  04-Aug-2016  rjs Another header change.
 1.23  04-Aug-2016  nonaka Sync with sys/ufs/ext2fs/ext2fs_bswap.c.
 1.22  04-Aug-2016  nonaka pass EXT2_DINODE_SIZE(fs) as isize to e2fs_iload().
should fix build failure.
 1.21  03-Aug-2016  rjs Adjust for change to kernel ext2fs headers.
 1.20  20-Mar-2014  christos branches: 1.20.6; 1.20.10;
reduce size by 1K by sharing the ls code.
 1.19  20-Oct-2013  christos XXX: gcc initializations
 1.18  23-Jun-2013  dholland branches: 1.18.2;
Stick ffs_, ext2_, chfs_, filecore_, cd9660_, or mfs_ in front of
the following symbols so as to disambiguate fully. (Christos already
did the lfs ones.)

lblkno
lblktosize
lfragtosize
numfrags
blkroundup
fragroundup
 1.17  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.16  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.15  10-May-2013  tsutsui Wrap >80 char lines that overflowed on NDADDR -> EXT2FS_NDADDR changes.
 1.14  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.13  21-May-2012  dsl branches: 1.13.2;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.12  16-Jan-2012  christos branches: 1.12.2;
PR/45796: Evgeniy Ivanov minixfs3 support.
Split out fn_match since we have 3 copies now.
 1.11  25-Dec-2011  tsutsui Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.10  16-Jun-2011  joerg branches: 1.10.2; 1.10.6;
Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.
 1.9  02-Jan-2011  jakllsch branches: 1.9.6;
Zero the in-memory super block after allocation. It contains a pointer
that, if not properly initialized, could be improperly deallocated.
 1.8  19-Oct-2009  bouyer branches: 1.8.4;
Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !
 1.7  02-Mar-2009  tsutsui Use EXT2_DINODE_SIZE() to get offset of inode, not struct ext2fs_dinode array.
 1.6  01-Mar-2009  christos catch up with variable inode size.
 1.5  19-Nov-2008  ad branches: 1.5.4;
For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.4  02-Dec-2007  tsutsui branches: 1.4.2; 1.4.6; 1.4.8; 1.4.16; 1.4.22; 1.4.26; 1.4.32; 1.4.34; 1.4.36;
- also pass correct size on dealloc() of in-memory superblock data
- also call dealloc() for group descriptor blocks
 1.3  02-Dec-2007  tsutsui Allocate correct size for in-memory data struct m_ext2fs
(which is larger than SBSIZE).
 1.2  02-Dec-2007  tsutsui - fix description about index structure of an inode to match ext2fs_dinode
- put more byteswap ops on reading block numbers in indirect blocks
(XXX: untested on big endian machines)
 1.1  01-Dec-2007  tsutsui Add ext2fs support for libsa.

Mostly based on ufs.c, and some ext2fs specific stuff is pulled from
sys/ufs/ext2fs/ext2fs_bswap.c and sys/ufs/ext2fs/ext2fs_vfsops.c.

XXX1: Should we share ufs.c with #ifdef LIBSA_EXT2FS as ffs and lfs do?
XXX2: Maybe we should share ext2fs_bswap.c with kernel.
 1.4.36.1  16-Jan-2011  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1486):
sbin/fsck_ext2fs/setup.c: revision 1.26
sbin/newfs_ext2fs/mke2fs.c: revision 1.10
sbin/newfs_ext2fs/mke2fs.c: revision 1.11
sbin/newfs_ext2fs/mke2fs.c: revision 1.12
sbin/fsck_ext2fs/inode.c: revision 1.24
sys/lib/libsa/ext2fs.c: revision 1.6
sbin/newfs_ext2fs/extern.h: revision 1.3
sbin/fsck_ext2fs/inode.c: revision 1.25
sys/lib/libsa/ext2fs.c: revision 1.7
sbin/fsck_ext2fs/inode.c: revision 1.26
sys/ufs/ext2fs/ext2fs_inode.c: revision 1.68
sbin/fsck_ext2fs/inode.c: revision 1.27
sbin/fsck_ext2fs/inode.c: revision 1.28
sys/ufs/ext2fs/ext2fs_dinode.h: revision 1.18
sys/ufs/ext2fs/ext2fs_dinode.h: revision 1.19
sbin/newfs_ext2fs/newfs_ext2fs.c: revision 1.5
sbin/newfs_ext2fs/newfs_ext2fs.8: revision 1.2
sbin/newfs_ext2fs/newfs_ext2fs.c: revision 1.6
sbin/newfs_ext2fs/newfs_ext2fs.8: revision 1.3
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.142
sbin/newfs_ext2fs/newfs_ext2fs.c: revision 1.7
sbin/newfs_ext2fs/newfs_ext2fs.8: revision 1.4
sbin/newfs_ext2fs/newfs_ext2fs.c: revision 1.8
PR/40936: Frederik Sausmikat: ext2fs: add support for inodes > 128 bytes
Support variable inode sizes.
catch up with variable inode size.
Don't use e2fs_inode_size in superblock on E2FS_REV0 file system.
- accept only EXT2_REV0_DINODE_SIZE inodesize on -O 0
- use inodesize to get offset of inode, not struct ext2fs_dinode array
Replace a magic number with a new EXT2_REV0_DINODE_SIZE macro.
Use EXT2_DINODE_SIZE() to get offset of inode, not struct ext2fs_dinode array.
Fix botched logic in inodesize check.
Use inodesize to get offset of inode in one more place.
- add a sanity check for e2fs_inode_size in readsb()
- use EXT2_DINODE_SIZE() rather than sizeof(struct ext2fs_dinode) or
struct ext2fs_dinode array/pointer to see e2fs_ipb and inode offsets
Sort options.
New sentence, new line.
Sort options in usage.
- unsigned -> unsigned int
- remove unnecessary casts from malloc(3) and free(3)
- fix a bogus indent
Use "size > INT32_MAX" rather than "size >= 0x80000000U" to check 2GB limit.
Add missed byteswap ops against ext2fs_dinode members.
Handle 32 bit uid field on E2FS_REV1.
 1.4.34.2  03-Mar-2009  skrll Sync with HEAD.
 1.4.34.1  19-Jan-2009  skrll Sync with HEAD.
 1.4.32.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.4.26.2  11-Mar-2010  yamt sync with head
 1.4.26.1  04-May-2009  yamt sync with head.
 1.4.22.1  17-Jan-2009  mjf Sync with HEAD.
 1.4.16.2  09-Jan-2008  matt sync with HEAD
 1.4.16.1  02-Dec-2007  matt file ext2fs.c was added on branch matt-armv6 on 2008-01-09 01:56:39 +0000
 1.4.8.2  08-Dec-2007  mjf Sync with HEAD.
 1.4.8.1  02-Dec-2007  mjf file ext2fs.c was added on branch mjf-devfs on 2007-12-08 18:20:52 +0000
 1.4.6.2  07-Dec-2007  yamt sync with head
 1.4.6.1  02-Dec-2007  yamt file ext2fs.c was added on branch yamt-lazymbuf on 2007-12-07 17:33:40 +0000
 1.4.2.2  03-Dec-2007  joerg Sync with HEAD.
 1.4.2.1  02-Dec-2007  joerg file ext2fs.c was added on branch jmcneill-pm on 2007-12-03 16:15:02 +0000
 1.5.4.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.4.1  05-Mar-2011  rmind sync with head
 1.9.6.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.6.2  02-Jun-2012  mrg sync to latest -current.
 1.10.6.1  18-Feb-2012  mrg merge to -current.
 1.10.2.4  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.10.2.3  23-Jan-2013  yamt sync with head
 1.10.2.2  23-May-2012  yamt sync with head.
 1.10.2.1  17-Apr-2012  yamt sync with head
 1.12.2.1  03-Jun-2012  jdc Pull up revisions:
src/sys/arch/i386/stand/lib/exec.c revision 1.50
src/sys/arch/sandpoint/stand/altboot/main.c revision 1.21 via patch
src/sys/lib/libsa/ext2fs.c revision 1.13
src/sys/lib/libsa/ffsv1.c revision 1.6
src/sys/lib/libsa/ffsv2.c revision 1.6
src/sys/lib/libsa/globals.c revision 1.9
src/sys/lib/libsa/lfsv1.c revision 1.5
src/sys/lib/libsa/lfsv2.c revision 1.5
src/sys/lib/libsa/stand.h revision 1.76
src/sys/lib/libsa/ufs.c revision 1.58
(requested by dsl in ticket #279).

Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.13.2.4  03-Dec-2017  jdolecek update from HEAD
 1.13.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.2.2  23-Jun-2013  tls resync from head
 1.13.2.1  25-Feb-2013  tls resync with head
 1.18.2.1  18-May-2014  rmind sync with head
 1.20.10.1  06-Aug-2016  pgoyette Sync with HEAD
 1.20.6.1  05-Oct-2016  skrll Sync with HEAD
 1.25.16.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.25.16.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.25.16.1  10-Jun-2019  christos Sync with HEAD
 1.28.4.1  25-Jan-2020  ad Sync with head.

RSS XML Feed