Commit Graph

308 Commits

Author SHA1 Message Date
andvar acbd85c52c s/superbock/superblock/ in comment. 2024-05-10 20:36:34 +00:00
mrg dcc586893d if the window size works but is 0, assume it didn't work and use 80. 2024-02-22 02:11:29 +00:00
riastradh 1e73453c9d Revert "newfs(8): Ensure A divides S before aligned_alloc(A, S)."
C17 lifted this restriction.
2023-07-05 10:58:58 +00:00
riastradh 5ebd7a0afa newfs(8): Ensure A divides S before aligned_alloc(A, S).
Required by C11 Sec. 7.22.3.1 The aligned_alloc function, para. 2,
p. 348:

   The value of alignment shall be a valid alignment supported by the
   implementation and the value of size shall be an integral multiple
   of alignment.

XXX pullup-10
2023-07-04 20:40:34 +00:00
lukem f937c412f3 bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBER
Provide a single variable
	CC_WNO_ADDRESS_OF_PACKED_MEMBER
with options for both clang and gcc, to replace
	CLANG_NO_ADDR_OF_PACKED_MEMBER
	CC_NO_ADDR_OF_PACKED_MEMBER
	GCC_NO_ADDR_OF_PACKED_MEMBER

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 08:52:53 +00:00
chs f298a94b73 ufs: fixed signed/unsigned bugs affecting large file systems
Apply these commits from FreeBSD:

  commit e870d1e6f97cc73308c11c40684b775bcfa906a2
  Author: Kirk McKusick <mckusick@FreeBSD.org>
  Date:   Wed Feb 10 20:10:35 2010 +0000

    This fix corrects a problem in the file system that treats large
    inode numbers as negative rather than unsigned. For a default
    (16K block) file system, this bug began to show up at a file system
    size above about 16Tb.

    To fully handle this problem, newfs must be updated to ensure that
    it will never create a filesystem with more than 2^32 inodes. That
    patch will be forthcoming soon.

    Reported by: Scott Burns, John Kilburg, Bruce Evans
    Followup by: Jeff Roberson
    PR:          133980
    MFC after:   2 weeks

  commit 81479e688b0f643ffacd3f335b4b4bba460b769d
  Author: Kirk McKusick <mckusick@FreeBSD.org>
  Date:   Thu Feb 11 18:14:53 2010 +0000

    One last pass to get all the unsigned comparisons correct.


In additional to the changes from FreeBSD, this commit includes quite a few
related changes to appease -Wsign-compare.
2023-01-07 19:41:29 +00:00
chs 87ba0e2a31 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).
2022-11-17 06:40:38 +00:00
andvar f84252b461 fix various typos in comments and log messages. 2022-04-16 18:15:20 +00:00
msaitoh 988ab2c9fa s/sytem/system/ 2022-01-01 10:32:28 +00:00
mrg cb93b81028 add support for new GCC 9 warnings that may be too much to fix
right now.  new address-of-packed-member and format-overflow
warnings have new GCC_NO_ADDR_OF_PACKED_MEMBER amd
GCC_NO_FORMAT_OVERFLOW variables to remove these warnings.

apply to a bunch of the tree.  mostly, these are real bugs that
should be fixed, but in many cases, only by removing the 'packed'
attribute from some structure that doesn't really need it.  (i
looked at many different ones, and while perhaps 60-80% were
already properly aligned, it wasn't clear to me that the uses
were always coming from sane data vs network alignment, so it
doesn't seem safe to remove packed without careful research for
each affect struct.)  clang already warned (and was not erroring)
for many of these cases, but gcc picked up dozens more.
2020-09-06 07:20:26 +00:00
riastradh 25f11de3b9 mmap MAP_FAILED audit. 2020-08-20 15:54:11 +00:00
jdolecek 1ef16aec19 add NO_IOBUF_ALIGNED to not pull aligned_alloc() for really constrained
boot media
2020-04-18 12:54:38 +00:00
jdolecek 4a168442c5 align buffers used for I/O to DEV_BSIZE so it's executed more optimally
when run for xbd(4) device
2020-04-17 09:33:37 +00:00
maya 2c4214cba2 Omit mention of old vnd(4) bug, now resolved.
Via elge, thanks.
2019-04-13 19:29:27 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
rin ce7fa6f1d3 __empty -> __nothing 2017-02-08 18:05:25 +00:00
rin 47e6c13bb2 switch to __empty 2017-02-08 16:56:56 +00:00
rin ccc9d98e52 Add smaller versions of fsck_ffs(8) and newfs(8) for install media, where
support for Endian-Independent FFS and Apple UFS is disabled unless FFS_EI=1
and APPLE_UFS=1 are added to CRUNCHENV, respectively.

This reduces the size of ramdisk image for atari by over 15KB.

Thanks tsutsui and christos for their useful comments.
2017-02-08 16:11:39 +00:00
sevan 65286eb532 Memory File System support appeared in 4.4BSD, implemented as an extension to
newfs(8). So while newfs may have appeared in 4.2BSD, MFS support was later.
https://svnweb.freebsd.org/csrg/sbin/newfs/Makefile?r1=39047&r2=39051
Adjust HISTORY.
Bump date.
2016-09-12 04:50:48 +00:00
ryo ccc6dc924a no need to escape 2016-04-01 05:23:56 +00:00
christos 161a4d81ea PR/50910: David Binderman: Optimize memset. 2016-03-07 15:55:06 +00:00
dholland 60d995df79 Terminate expression with a semicolon, instead of accidentally
splicing to the next line with a comma. Noticed by Christos. Has no
actual effect, fortunately. (Compiler output is unchanged.)
2016-03-07 15:09:55 +00:00
mlelstv 1cd8415fdc Handle getfsspecname errors. 2015-07-25 10:37:22 +00:00
christos d3037dba83 fix error messages containing \n 2015-06-16 23:18:54 +00:00
christos c4603cb30b - use calloc to zero memory
- pass the proper buffer to mkdir
- fix for apple ufs
2015-04-29 01:49:25 +00:00
christos 4f6ce6a7d2 reduce bss usage 2015-04-28 15:15:53 +00:00
mlelstv ab9ddb6964 Support wedge names.
before:
    newfs dk1        - formats /dev/rdk1
    newfs rdk1       - cannot open /dev/rrdk1
    newfs /dev/dk1   - /dev/dk1 is a block-device, use raw device
    newfs /dev/rdk1  - formats /dev/rdk1

now:
    newfs dk1        - formats /dev/rdk1
    newfs rdk1       - cannot open /dev/rrdk1
    newfs /dev/dk1   - formats /dev/rdk1 (*)
    newfs /dev/rdk1  - formats /dev/rdk1
    newfs NAME=wedge - formats /dev/rdk1

(*) getfsspecname() returns the block device which must be translated.
    Passing a block device manually cannot be distinguished from this case.
2014-10-25 16:47:23 +00:00
martin 724e066fba Increase alignement of the global "buf" variable to cover all pointers it
is casted too. Fixes a crash on arm v5.
2014-04-26 14:15:08 +00:00
justin 802f624689 Iterate over fields of struct seperately to avoid warnings from pedantic compilers 2014-04-05 12:32:27 +00:00
dholland 75571afd93 Stick ffs_ in front of the following macros:
fragstoblks()
   blkstofrags()
   fragnum()
   blknum()

to finish the job of distinguishing them from the lfs versions, which
Christos renamed the other day.

I believe this is the last of the overtly ambiguous exported symbols
from ffs... or at least, the last of the ones that conflicted with lfs.
ffs still pollutes the C namespace very broadly (as does ufs) and this
needs quite a bit more cleanup.

XXX: boo on macros with lowercase names. But I'm not tackling that just yet.
2013-06-23 22:03:34 +00:00
dholland e1610ba4cb 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
2013-06-23 07:28:36 +00:00
dholland cc2e18968d Revert accidental commit of the change for PR 47911; got rolled into
other stuff by mistake.
2013-06-23 04:14:28 +00:00
dholland 2737439da3 fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)
2013-06-23 02:06:04 +00:00
dholland f1333577b5 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.
2013-06-19 17:51:25 +00:00
dholland 9daf003ef2 Stick UFS_ in front of these symbols:
DIRBLKSIZ
   DIRECTSIZ
   DIRSIZ
   OLDDIRFMT
   NEWDIRFMT

Part of PR 47909.

(two stragglers in this commit; oops)
2013-06-09 18:29:25 +00:00
mlelstv 9e59300471 For MFS, no longer use heuristic based on rlimit to determine mmap size.
This is no longer functional with current memory allocation routines.
2013-03-17 12:25:36 +00:00
dholland dcd34a91c5 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.
2013-01-22 09:39:11 +00:00
joerg e16a720f89 Don't depend on HAVE_GCC being always defined. 2012-08-10 12:20:10 +00:00
tsutsui c0aba6b3c5 Use 32KB/4KB for default block/fragment size on >= 128 GB partitions
for modern AFT disks.  No particular comments against PR install/46629.
2012-06-30 15:34:01 +00:00
wiz d2b212ea03 Remove unused variables.
From cppcheck via Henning Petersen in PR 46004.
2012-02-13 12:59:56 +00:00
tsutsui d42cbdf611 Explicitly zap possible Ext2fs magic leftover to prevent
kernel vfs_mountroot() and bootloaders from mis-recognizing
the newfs(8)'ed file system as still Ext2fs.

The problem is reported and the fix is tested by Frank Wille
on current-users@.  Also approved by releng.
2012-02-07 14:14:45 +00:00
joerg dbf6e7953c Avoid magic manipulation of the format string. 2011-08-25 16:17:58 +00:00
mrg 75e42fa7da remove most of the remaining HAVE_GCC tests that are always true in
the modern world.
2011-06-20 07:43:56 +00:00
dholland aae84c3a7c Improve documentation of FFS formats and format levels from PR 32100.
Prompted also by recent discussion on tech-kern. Bump date.
2011-05-14 19:46:10 +00:00
wiz d2eb4c303d New sentence, new line. 2011-03-06 17:20:28 +00:00
bouyer 063f96f3c2 merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
2011-03-06 17:08:10 +00:00
pooka e596efac61 Add -G to usage, omission pointed out by wiz. Also, make usage format
nicer on a 80col terminal.
2010-08-09 21:14:26 +00:00
wiz ed08a55d5a Sort option descriptions. 2010-08-09 20:23:20 +00:00
pooka f87f7774e0 Add -G, which turns consistency check errors in warnings. The
current testing purpose is to create a file system with
block size > MAXPHYS.

(the check doesn't make that much sense anyway in these days of
mobile file systems, since we're interested in MAXPHYS where we
attempt to mount the file system, not where we happen to create it)
2010-08-09 17:20:57 +00:00
wiz 1a64f4201c Call the file system "ext2" consistently. Suggested by tsutsui. 2010-02-21 13:26:45 +00:00