Commit Graph

72 Commits

Author SHA1 Message Date
jmcneill 2cf653d8b7 Use getfsspecname and getrawdiskname so we can resize by NAME= label. 2020-05-24 14:41:26 +00:00
maya f93d65267a wether -> whether 2019-04-21 11:45:08 +00:00
mlelstv 9ffedbd04f Fix computation of left-over fragments also for ufs2.
Fixes PR 52600.
2017-10-09 05:24:26 +00:00
christos 7ebfc10b9a PR/52590: David H. Gutteridge: Minor documentation improvements 2017-10-01 22:59:19 +00:00
mlelstv fa4874d540 - More fixes to use 64bit offsets.
- Compute left-over fragments also for FFS2.
2017-10-01 07:18:39 +00:00
kre 9d73fa5606 Fix the syntax (pointed out by David H. Gutteridge on source-changes-d).
Fix the build...
2017-09-30 18:32:52 +00:00
riastradh 84bea879cb Use int64_t for loop index so we don't iterate forever/until trap. 2017-09-30 15:25:16 +00:00
sborrill 0e0ce305cc Fix the most obvious integer overflow errors which can lead to superblock
corruption. Thanks to riastradh@

For example:

# df /data
Filesystem    1K-blocks       Used      Avail %Cap Mounted on
/dev/ccd0d   -19974939099004 -19982708701532 -737868756431824584   0% /data

# dumpfs -s /dev/rccd0d
file system: /dev/rccd0d
format  FFSv2
endian  little-endian
location 65536  (-b 128)
magic   19540119        time    Thu Sep 28 13:18:10 2017
superblock location     65536   id      [ 595fa4a5 3363fe37 ]
cylgrp  dynamic inodes  FFSv2   sblock  FFSv2   fslevel 5
nbfree  242773148       ndir    211185  nifree  650798800       nffree
215448
ncg     13933   size    2647654400      blocks  -4993734774751
bsize   32768   shift   15      mask    0xffff8000
fsize   4096    shift   12      mask    0xfffff000
frag    8       shift   3       fsbtodb 3
bpg     23754   fpg     190032  ipg     46848
minfree 5%      optim   time    maxcontig 2     maxbpg  4096
symlinklen 120  contigsumsize 2
maxfilesize 0x000800800805ffff
nindir  4096    inopb   128
avgfilesize 16384       avgfpdir 64
sblkno  24      cblkno  32      iblkno  40      dblkno  2968
sbsize  4096    cgsize  32768
csaddr  35792   cssize  225280
cgrotor 0       fmod    0       ronly   0       clean   0x01
wapbl version 0x1       location 2      flags 0x0
wapbl loc0 6354693888   loc1 131072     loc2 512        loc3 3
flags   none
fsmnt   /data
volname         swuid   0
2017-09-28 17:07:20 +00:00
sevan 08e27e9733 Replace contractions. 2016-09-12 05:47:21 +00:00
dholland fbf3696950 Fix handling of ffsv2 inode initialization. Retires PR 51116. 2016-08-24 07:44:05 +00:00
christos c1673bd676 fix pasto 2016-03-17 01:41:54 +00:00
christos 9eac9537df Appease gcc-5 from phone@ 2016-03-17 00:54:53 +00:00
jmcneill d0b93bc844 if the -p flag is specified, display a progress bar while growing the file-system 2015-04-06 22:44:04 +00:00
mlelstv f3a445024e factor out geometry calculation and use this also in CheckOnly mode.
be a bit more verbose in Verbose mode.
2015-04-06 13:33:42 +00:00
mlelstv 4962b364b8 Handle case in grow() where last cylinder group is too small for ufs2.
Align with code in shrink().
2015-04-06 12:38:21 +00:00
wiz 5a1645e4da New sentence, new line. Sort option descriptions. 2015-03-29 19:42:15 +00:00
chopps ae3fcf098a - Add -c to check to see if grow/shrink is required
- Divide by DEV_BSIZE when returning size of file.
- Update manpage
2015-03-29 19:33:55 +00:00
riastradh 9ea98f4524 Use `!= -1' instead of `== 0' out of paranoia. 2015-03-28 17:25:33 +00:00
riastradh bb5cf371be Make get_dev_size work on regular files too. 2015-03-28 17:22:46 +00:00
riz 8dcf7f1af2 Add an item to the list (SIGINFO support). 2013-09-09 19:37:17 +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 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 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
christos 7c8eec143a fix cast in local macro 2012-04-20 13:20:39 +00:00
wiz f91d202feb Move a sentence to where it makes more sense. 2011-08-28 21:25:11 +00:00
wiz 6964284f70 New sentence, new line. 2011-08-28 17:15:16 +00:00
christos 17187885c3 PR/45301: Julian Fagir: make clear that the unit is sectors and fix a typo.
While there, use errx, and sizeof(*var) instead of sizeof(type)
2011-08-27 16:34:57 +00:00
dholland 64b8763551 Fix another dodgy switch-jump. 2011-08-15 02:22:46 +00:00
dholland 7a8d9bb430 WARNS = 4 2011-08-15 02:19:50 +00:00
dholland 66ed9af4d1 Add missing __RCSID(). 2011-08-15 00:30:25 +00:00
dholland fc91a8d8ae Whitespace. 2011-08-15 00:27:50 +00:00
dholland 2bf41d920c Avoid switch-jumping into the middle of an if. Compiler output is unchanged. 2011-08-15 00:26:16 +00:00
dholland 46eb69af0a Minor KNF. 2011-08-15 00:24:19 +00:00
riz d765f2d25b Add support for byteswapped file systems (big-endian on little-endian
host, and vice versa), to fix PR#44203.

Add support for growing (but not yet shrinking) UFS2 file systems.  Partially
addresses PR#44205.

While I'm here, reformat the code for closer adherence to KNF.

Fairly extensive testing was performed, using the shortly-to-be-committed
updated ATF tests.  Patch posted to tech-userlevel on 21 December 2010,
no comments.
2011-01-05 02:18:15 +00:00
riz 98ddf5ec73 Revert previous - inadvertant commit to wrong repository. 2010-12-20 00:49:23 +00:00
riz 3123e6a7e0 Pull in change from njoly@ in -current 2010-12-20 00:44:53 +00:00
njoly e7c4f98be6 Add missing .Os macro. 2010-12-19 23:22:46 +00:00
wiz c93380eba7 filesystem -> file system. 2010-12-14 21:49:21 +00:00
riz a3a3268f75 Be explicit about byteswapped and ffsv2 file systems being currently
unsupported, while catching up to some changes in my local tree which
will hopefully support them at some time in the future.

Also, change "device" variable to "special", to reflect the fact
that resize_ffs will work on a plain file.
2010-12-14 20:45:22 +00:00
riz 16963047ea Don't special-case v1 superblocks - especially with an incorrect
calculation.
2010-12-14 04:04:20 +00:00
riz d365bee0c8 Remove bogus check which is not actually testing anything useful,
and depending on file system data, can actually be a false error.

Fixes what I was actually testing for in bin/44209, though the
actual problem was not what I originally described.
2010-12-12 22:48:59 +00:00
mhitch a7e78491e5 Add support for old ffsv1 superblocks. After reading an old superblock,
copy appropriate data to where they are expected in the updated superblock.
When writing the updated superblock, move the updated values back to the
old ffsv1 superblock locations.  Also check for old superblock format when
updating the last cylinder group and adjust cg_old_ncyl appropriately.
Derived from how mksf sets them.  Should address PR bin/44209.
2010-12-12 19:53:23 +00:00
riz 6a4bbd2cea Remove accidentally-resurrected TODO item. 2010-12-08 15:23:53 +00:00
riz 8966eced0b If we're operating on a plain file instead of a device, ftruncate() it
to ensure it's been properly extended.  Clears up some problems at certain
blocksizes which showed up during creation of atf tests, which is done
using file-backed file systems.
2010-12-08 00:25:54 +00:00
riz 0b1ff958b5 As currently written, writeat() expects disk blocks, not fs blocks, so
when testing that the last sector of the new size is writeable, make
sure we're ACTUALLY writing in the new space, instead of possibly
overwriting something in the existing fs.

Discovered while writing tests - tests which uncovered file corruption at
certain block sizes.

XXX should rewrite writeat() to expect fs blocks instead of disk blocks.

OK mlelstv@
2010-12-07 23:29:55 +00:00
riz 3485b1dad5 Turns out, plain-file usage is already supported. *blush* 2010-12-03 05:23:34 +00:00
riz 4c7e04789a Knock one off the list. 2010-12-02 22:04:01 +00:00
riz 9f2c8ccc2b Use howmany() instead of "/" to calculate the number of cylinders for
the changed file system, so as to not drop a partial cylinder at the
end.  Fixes PR bin/44177.
2010-12-02 22:00:27 +00:00