The NetBSD Project

CVS log for src/sbin/resize_ffs/resize_ffs.c

[BACK] Up to [cvs.NetBSD.org] / src / sbin / resize_ffs

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.34 / (download) - annotate - [select for diffs], Tue Jan 22 09:39:13 2013 UTC (4 months ago) by dholland
Branch: MAIN
CVS Tags: yamt-pagecache-base8, tls-maxphys-nbase, tls-maxphys-base, agc-symver-base, agc-symver, HEAD
Changes since 1.33: +10 -10 lines
Diff to previous 1.33 (colored)

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.

Revision 1.33 / (download) - annotate - [select for diffs], Fri Apr 20 13:20:39 2012 UTC (13 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5
Branch point for: tls-maxphys
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)

fix cast in local macro

Revision 1.32 / (download) - annotate - [select for diffs], Sat Aug 27 16:34:57 2011 UTC (20 months, 3 weeks ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Branch point for: yamt-pagecache
Changes since 1.31: +24 -36 lines
Diff to previous 1.31 (colored)

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)

Revision 1.31 / (download) - annotate - [select for diffs], Mon Aug 15 02:22:46 2011 UTC (21 months, 1 week ago) by dholland
Branch: MAIN
Changes since 1.30: +9 -7 lines
Diff to previous 1.30 (colored)

Fix another dodgy switch-jump.

Revision 1.30 / (download) - annotate - [select for diffs], Mon Aug 15 02:19:50 2011 UTC (21 months, 1 week ago) by dholland
Branch: MAIN
Changes since 1.29: +38 -32 lines
Diff to previous 1.29 (colored)

WARNS = 4

Revision 1.29 / (download) - annotate - [select for diffs], Mon Aug 15 00:30:25 2011 UTC (21 months, 1 week ago) by dholland
Branch: MAIN
Changes since 1.28: +3 -1 lines
Diff to previous 1.28 (colored)

Add missing __RCSID().

Revision 1.28 / (download) - annotate - [select for diffs], Mon Aug 15 00:27:50 2011 UTC (21 months, 1 week ago) by dholland
Branch: MAIN
Changes since 1.27: +23 -23 lines
Diff to previous 1.27 (colored)

Whitespace.

Revision 1.27 / (download) - annotate - [select for diffs], Mon Aug 15 00:26:16 2011 UTC (21 months, 1 week ago) by dholland
Branch: MAIN
Changes since 1.26: +5 -3 lines
Diff to previous 1.26 (colored)

Avoid switch-jumping into the middle of an if. Compiler output is unchanged.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Aug 15 00:24:19 2011 UTC (21 months, 1 week ago) by dholland
Branch: MAIN
Changes since 1.25: +12 -5 lines
Diff to previous 1.25 (colored)

Minor KNF.

Revision 1.25 / (download) - annotate - [select for diffs], Wed Jan 5 02:18:15 2011 UTC (2 years, 4 months ago) by riz
Branch: MAIN
CVS Tags: cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Changes since 1.24: +342 -172 lines
Diff to previous 1.24 (colored)

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.

Revision 1.24 / (download) - annotate - [select for diffs], Tue Dec 14 21:49:21 2010 UTC (2 years, 5 months ago) by wiz
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231
Changes since 1.23: +22 -22 lines
Diff to previous 1.23 (colored)

filesystem -> file system.

Revision 1.23 / (download) - annotate - [select for diffs], Tue Dec 14 20:45:22 2010 UTC (2 years, 5 months ago) by riz
Branch: MAIN
Changes since 1.22: +36 -12 lines
Diff to previous 1.22 (colored)

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.

Revision 1.22 / (download) - annotate - [select for diffs], Tue Dec 14 04:04:20 2010 UTC (2 years, 5 months ago) by riz
Branch: MAIN
Changes since 1.21: +1 -3 lines
Diff to previous 1.21 (colored)

Don't special-case v1 superblocks - especially with an incorrect
calculation.

Revision 1.21 / (download) - annotate - [select for diffs], Sun Dec 12 22:48:59 2010 UTC (2 years, 5 months ago) by riz
Branch: MAIN
Changes since 1.20: +1 -4 lines
Diff to previous 1.20 (colored)

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.

Revision 1.20 / (download) - annotate - [select for diffs], Sun Dec 12 19:53:23 2010 UTC (2 years, 5 months ago) by mhitch
Branch: MAIN
Changes since 1.19: +36 -9 lines
Diff to previous 1.19 (colored)

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.

Revision 1.19 / (download) - annotate - [select for diffs], Wed Dec 8 00:25:54 2010 UTC (2 years, 5 months ago) by riz
Branch: MAIN
Changes since 1.18: +11 -0 lines
Diff to previous 1.18 (colored)

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.

Revision 1.18 / (download) - annotate - [select for diffs], Tue Dec 7 23:29:55 2010 UTC (2 years, 5 months ago) by riz
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

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@

Revision 1.17 / (download) - annotate - [select for diffs], Thu Dec 2 22:00:27 2010 UTC (2 years, 5 months ago) by riz
Branch: MAIN
Changes since 1.16: +5 -3 lines
Diff to previous 1.16 (colored)

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.

Revision 1.16 / (download) - annotate - [select for diffs], Wed Dec 1 17:39:21 2010 UTC (2 years, 5 months ago) by riz
Branch: MAIN
Changes since 1.15: +3 -3 lines
Diff to previous 1.15 (colored)

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@.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Dec 1 17:33:45 2010 UTC (2 years, 5 months ago) by riz
Branch: MAIN
Changes since 1.14: +76 -71 lines
Diff to previous 1.14 (colored)

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.

Revision 1.14 / (download) - annotate - [select for diffs], Mon Nov 29 19:54:10 2010 UTC (2 years, 5 months ago) by riz
Branch: MAIN
Changes since 1.13: +9 -15 lines
Diff to previous 1.13 (colored)

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.

Revision 1.13 / (download) - annotate - [select for diffs], Sat Oct 30 21:16:07 2010 UTC (2 years, 6 months ago) by haad
Branch: MAIN
Changes since 1.12: +120 -43 lines
Diff to previous 1.12 (colored)

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@.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Dec 15 19:44:47 2007 UTC (5 years, 5 months ago) by perry
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, netbsd-5-base, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, mjf-devfs2-base, mjf-devfs2, mjf-devfs-base, matt-premerge-20091211, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2, matt-armv6-nbase, matt-armv6-base, keiichi-mipv6-base, keiichi-mipv6, jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend, hpcarm-cleanup-nbase, hpcarm-cleanup-base
Branch point for: netbsd-5
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

convert __attribute__s to applicable cdefs.h macros

Revision 1.11 / (download) - annotate - [select for diffs], Sat Dec 15 16:32:06 2007 UTC (5 years, 5 months ago) by perry
Branch: MAIN
Changes since 1.10: +2 -1 lines
Diff to previous 1.10 (colored)

include sys/cdefs.h so that __attribute__ can be fixed later

Revision 1.10 / (download) - annotate - [select for diffs], Sun Jul 8 16:54:40 2007 UTC (5 years, 10 months ago) by bouyer
Branch: MAIN
CVS Tags: matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, hpcarm-cleanup, cube-autoconf-base, cube-autoconf
Branch point for: mjf-devfs, matt-armv6
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

writeat() also expect offsets in DEV_BSIZE unit. This and the previous commit
should fix PR bin/35560. Thanks to Michael L. Hitch for pointing me at the
PR.

Revision 1.9 / (download) - annotate - [select for diffs], Thu Jul 5 21:38:20 2007 UTC (5 years, 10 months ago) by bouyer
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

readat() expects the offset in DEV_BSIZE units. This made resize_ffs find the
filesystem on a vnd partition for me. It did grow the filesystem, and after
a fsck -f on the partition to fix a few superblock inconsistencies, all
looks good.

Revision 1.8 / (download) - annotate - [select for diffs], Fri Jun 3 03:34:44 2005 UTC (7 years, 11 months ago) by snj
Branch: MAIN
CVS Tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, abandoned-netbsd-4-base, abandoned-netbsd-4
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

Fix a typo in a comment.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Mar 21 21:02:01 2004 UTC (9 years, 2 months ago) by dsl
Branch: MAIN
CVS Tags: netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3, netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-base, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2
Changes since 1.6: +5 -1 lines
Diff to previous 1.6 (colored)

Dunno why this code is playing 'hunt the superblock', but stop it
finding an ffsv1 sb at 64k.
Also stop it playing with fs that have 'FS_FLAGS_UPDATED' set.
It certainly doesn't act on that falg, and my guess is that it is
playing the pre-ffsv2 fs.
Fixes part of PR kern/24809

Revision 1.6 / (download) - annotate - [select for diffs], Mon Jan 5 23:23:33 2004 UTC (9 years, 4 months ago) by jmmv
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.

Revision 1.5 / (download) - annotate - [select for diffs], Sat Jul 26 19:46:34 2003 UTC (9 years, 10 months ago) by salo
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

netbsd.org->NetBSD.org

Revision 1.4 / (download) - annotate - [select for diffs], Thu Apr 3 14:55:16 2003 UTC (10 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.3: +129 -140 lines
Diff to previous 1.3 (colored)

make this compile again.

Revision 1.3 / (download) - annotate - [select for diffs], Mon Mar 10 09:23:50 2003 UTC (10 years, 2 months ago) by wiz
Branch: MAIN
Changes since 1.2: +4 -4 lines
Diff to previous 1.2 (colored)

Correct program name in comments.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Feb 21 23:55:38 2003 UTC (10 years, 3 months ago) by martin
Branch: MAIN
Changes since 1.1: +10 -11 lines
Diff to previous 1.1 (colored)

This program deals with on-disk structures.
s/daddr_t/int32_t/g for now (UFS2 will need other changes as well).

Revision 1.1 / (download) - annotate - [select for diffs], Fri Feb 21 04:08:55 2003 UTC (10 years, 3 months ago) by jtk
Branch: MAIN

Preliminary version of resize_ffs, based on der Mouse's fsresize tool.
I didn't have time to clean it up completely before my legal status
w.r.t. open source projects goes into limbo for a while.  Other
developers are encouraged to play with the tool and get it into
release-worthy shape.

TODO list (see TODO file)

* verify it builds on -current, put it into release lists/etc. and src/sbin/Makefile
  (built & tested on 1.6.1)
* make it ask questions before doing any work (confirm)
* create regression test suite (see discussions on tech-kern and
  developers) and fix any bugs
* verify conversion to ANSI C didn't break anything
* port to UFS2

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>