Commit Graph

64 Commits

Author SHA1 Message Date
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
riz
6ad0ad89d6 Update TODO for resize_ffs(8), adding some stuff and removing some
ancient bits.
2010-12-01 17:39:54 +00:00
riz
6efa15a79a Do not look for a v1 file system at SBLOCK_UFS2, as this gets the wrong
superblock (first alternate) for a file system with 64k blocks.
Spotted by mhitch@.
2010-12-01 17:39:21 +00:00
riz
18174be827 Clean up this file:
- sync usage comment with current reality
- sort includes
- wrap lines
- use EXIT_FAILURE consistently
- make error messages consistent:  Cannot->Can't
- Remove "Old FFSv1 macros" in favor of system macros in ufs/ffs/fs.h .
  Leave dblksize() because it uses the on-disk dinode structure.

More cleanup is needed.
No functional changes intended.
2010-12-01 17:33:45 +00:00
riz
6f8b62aac7 Restore a couple of checks for updating the cg_old_ncyl value which
were commented out with XXX and a notation to "fix once fsck is fixed."
fsck seems to have been fixed for this particular issue sometime in the
7 years since the code was brought into the tree.

Update cg_old_niblk instead of cg_ni_blk, since this tool
currently supports ffsv1 only.

With these two changes, I can grow a file system and have the result
be clean according to fsck_ffs.  Shrinking still results in an unclean
file system.

OK mhitch@

While I'm here, fix a typo in an error message.
2010-11-29 19:54:10 +00:00
wiz
4958aa2ca5 Various improvements. 2010-10-31 11:39:46 +00:00
haad
1e89108160 Add resize_ffs tool to build, change default behaviour to grow filesystem
to device size. Add parameter -s to specify size if user want to shrink
filesystem.

Apply some KNF, remove dead unused code.

Oked by christos@.
2010-10-30 21:16:07 +00:00
lukem
10a1256f76 set WARNS=3 -- too many -Wsign-compare issues in the kernel ffs code 2009-04-26 05:57:48 +00:00
perry
8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00