summaryrefslogtreecommitdiff
path: root/sys/lib/libsa/ufs.c
AgeCommit message (Collapse)Author
2022-12-01fix clang buildchristos
2022-11-17Restore backward compatibility of UFS2 with previous NetBSD releases bychs
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).
2022-04-29Re-introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE isrin
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.
2022-04-27Revert previous at the moment.rin
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.
2022-04-27Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE isrin
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.
2022-04-24Don't load filessytem module for filesystem that was found but isn't usedmlelstv
for booting.
2022-04-24Ask driver about sector size to support reading superblocks from fixedmlelstv
byte offsets.
2022-04-19Typo in comment. avoinds -> avoidsskrll
2021-05-27add bi-endian support to the libsa ufs reader and enable it in efiboot.mrg
ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap, and FS_MAGIC (moved from ufs.c #if segments.) these are used to call the right (32/64 bit) ffsv1/v2 version. ufs.c 'struct file' gains f_swapped member. accessors for d_magic, d_reclen, and d_ino are introduced (they need to be swapped.) sfter reading an inode from disk, read_inode() may call ufs_dinode_swap(). indirect block number and caches may be swapped. error handling in ffs_find_superblock() is cleaned up. (size is slightly reduced on some ports with this part.) defaults for new defines added to ufs.c. (XXX: we build ufs.c but i think all the consumers don't use it, and we can stop building it.) LFS support is not included. add a cut-down copy of ffs_bswap.c from the kernel. also enable bi-endian disklabel support in efiboot. most ports build and sizes compared for platforms that don't enable this code and all but one saw reduced code size. booted several platforms with new boot code.
2021-05-12push the FFSv1 superblock code into ffs_find_superblock() andmrg
hide all the ugliness in this function, out of ufs_open(). NFC, objects same size if not identical.
2020-12-19Fix previous; define missing lfs_version.rin
2020-12-19ufs_open(): Check fs->lfs_version ifdef LIBSA_*L*FS, not LIBSA_*F*FS.rin
This was harmless for FFS variants, that define LIBSA_FFSv[12], not LIBSA_FFS.
2019-04-02fix sign-compare and sign-passing errors.christos
2019-03-31fix warnings, printf formats, etc.christos
2015-09-01Add new accessors for the d_type and d_namlen fields of struct lfs_direct.dholland
Napalm the old byteswap access logic for these.
2015-09-01The ifile's inode number is constant. (it is always 1)dholland
Therefore, storing the value in the superblock and reading it out again is silly and offers the opportunity for it to become corrupted. So, don't do that (most of the code already didn't) and use the existing constant instead. Initialize new 32-bit superblocks with the value for the sake of old userland programs, but don't keep the value in the 64-bit superblock at all. (approved by Margo Seltzer)
2015-08-12Hack up dinode usage to be 64 vs. 32 as needed. Part 1.dholland
(This part changes the native lfs code; the ufs-derived code already has 64 vs. 32 logic, but as aspects of it are unsafe, and don't entirely interoperate cleanly with the lfs 64/32 stuff, pass 2 will be rehashing that.)
2015-08-12Add IFILE32 and IFILE64 structures for the on-disk ifile entries.dholland
Add and use accessors. There are also a bunch of places that cast and I hope I've found them all...
2015-08-02Add a (draft) 64-bit superblock. Make things build again.dholland
Add pieces of support for using both superblock types where convenient, and specifically to the superblock accessors, but don't actually enable it anywhere. First substantive step on PR 50000.
2015-07-28Move struct salfs back inside libsa now that lfs_accessors.h is separate.dholland
2015-07-28Add a new lfs header file: lfs_accessors.h.dholland
This contains all the accessor functions and macros out of lfs.h. Add an include of lfs_accessors.h after all uses of lfs.h... except for code that wants to define its own struct lfs-alike that the accessors are supposed to play along with. For these, set STRUCT_LFS and include lfs_accessors.h after the necessary structure has been defined, so that lfs_accessors.h can emit functions in terms of it.
2015-07-24Switch to accessor functions for elements of the LFS on-diskdholland
superblock. This will allow switching between 32/64 bit forms on the fly; it will also allow handling LFS_EI reasonably tidily. (That currently doesn't work on the superblock.) It also gets rid of cpp abuse in the form of fake structure member macros. Also, instead of doing sleep/wakeup on &lfs_avail and &lfs_nextseg inside the on-disk superblock, add extra elements to the in-memory struct lfs for this. (XXX: these should be changed to condvars, but not right now) XXX: this migrates a structure needed by the lfs code in libsa (struct salfs) into lfs.h, where it doesn't belong, but for the time being this is necessary in order to allow the accessors (and the various lfs macros and other goop that relies on them) to compile.
2015-07-24Rearrange the structures in the lfs bootbollocks slightly.dholland
This generates the same output (at least on amd64) but will be more robust until we're ready to deploy lfs64 bootblocks too. XXX: I don't think these actually work right now, and the logic for picking between v1 and v2 lfs formats (which is not related to ffsv1 vs. ffsv2) is definitely broken. But I haven't made it any worse.
2014-03-20reduce size by 1K by sharing the ls code.christos
2013-10-20XXX: gcc initializationschristos
2013-06-23Stick ffs_, ext2_, chfs_, filecore_, cd9660_, or mfs_ in front ofdholland
the following symbols so as to disambiguate fully. (Christos already did the lfs ones.) lblkno lblktosize lfragtosize numfrags blkroundup fragroundup
2013-06-23fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()dholland
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB() (Christos already did the lfs ones a few days back)
2013-06-19Rename ambiguous macros:dholland
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.
2013-06-09Stick UFS_ in front of these symbols:dholland
DIRBLKSIZ DIRECTSIZ DIRSIZ OLDDIRFMT NEWDIRFMT Part of PR 47909.
2013-01-22Stuff UFS_ in front of a few of ufs's symbols to reduce namespacedholland
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.
2012-05-21Remove the code that tries to load the "ffs" kernel module during boot.dsl
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).
2012-01-16PR/45796: Evgeniy Ivanov minixfs3 support.christos
Split out fn_match since we have 3 copies now.
2011-12-25Apply the following patch submitted by Evgeniy Ivanov:tsutsui
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
2011-06-16Add an optional MD calling convention flag for use in libsa when spacejoerg
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.
2008-11-19For the x86 boot loader, autoload a kernel module corresponding to thead
root file system type.
2008-01-02Merge vmlocking2 to head.ad
2007-12-01Use "uint" rather than "unsigned" without a type.tsutsui
2007-11-24style, indent, and ANSI-fy.isaki
2007-09-29When compiled with COMPAT_SOLARIS_UFS, always calculate fs_qbmask andmartin
fs_qfmask on the fly. This allows libsa to read newer Solaris ufs filesystems (which have a slightly incompatible superblock). Suggested by Antti Kantee when discussing PR kern/37000.
2006-05-11ssize_t -> size_t to match variable and functions.mrg
2006-01-25free -> deallocchristos
2006-01-18Define indp_t as signed int32_t, like ffsv1.c does.uwe
2005-12-11merge ktrace-lwp.christos
2005-08-1964 bit inode changes.christos
2005-02-26nuke trailing whitespaceperry
2004-03-20When searching for the superblock, check that the fs_sblockloc fielddsl
matches the location we read it from to ensure we don't have one of the alternate superblocks. Fixes part of PR kern/24809
2003-08-31Fix signed/unsigned warnings.fvdl
2003-08-27Use memset not bzero to help shrink alpha bootxx_lfsdsl
(sys/arch/alpha/stand/common/start.S also uses bzero, I don't know any alpha opcodes so cant change that one...)
2003-08-22Reduce memory footprint:dsl
- use file buffer for all block reads - only save a small amount of the indirect block list Allows i386 bootxx_ufs code to load /boot from a filesystem with 32k blocks while still fitting inside 64k of memory. Code size reduced as well (by ~1k on i386). It ought to be possible to use a buffer that is smaller than a filesystem block. This might be needed in order to boot from filesystems with larger block sizes.
2003-08-21Should call ufs_close() if it isn't being built in.elric