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


Revision 1.58 / (download) - annotate - [select for diffs], Sat Jan 7 19:41:30 2023 UTC (3 weeks, 5 days ago) by chs
Branch: MAIN
CVS Tags: HEAD
Changes since 1.57: +18 -17 lines
Diff to previous 1.57 (colored)

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.

Revision 1.57 / (download) - annotate - [select for diffs], Thu Nov 17 06:40:39 2022 UTC (2 months, 2 weeks ago) by chs
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10
Changes since 1.56: +4 -2 lines
Diff to previous 1.56 (colored)

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

Revision 1.56 / (download) - annotate - [select for diffs], Fri Apr 8 10:17:53 2022 UTC (9 months, 3 weeks ago) by andvar
Branch: MAIN
Changes since 1.55: +3 -3 lines
Diff to previous 1.55 (colored)

fix various typos, mainly in comments, but also log messages, docs, game text.

Revision 1.55 / (download) - annotate - [select for diffs], Sun May 24 14:41:26 2020 UTC (2 years, 8 months ago) by jmcneill
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.54: +14 -5 lines
Diff to previous 1.54 (colored)

Use getfsspecname and getrawdiskname so we can resize by NAME= label.

Revision 1.53.4.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:05:35 2019 UTC (3 years, 7 months ago) by christos
Branch: phil-wifi
Changes since 1.53: +3 -3 lines
Diff to previous 1.53 (colored) next main 1.54 (colored)

Sync with HEAD

Revision 1.54 / (download) - annotate - [select for diffs], Sun Apr 21 11:45:08 2019 UTC (3 years, 9 months ago) by maya
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, is-mlppp-base, is-mlppp
Changes since 1.53: +3 -3 lines
Diff to previous 1.53 (colored)

wether -> whether

Revision 1.47.6.1 / (download) - annotate - [select for diffs], Tue Oct 24 09:08:40 2017 UTC (5 years, 3 months ago) by snj
Branch: netbsd-8
CVS Tags: netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, matt-nb8-mediatek-base, matt-nb8-mediatek
Changes since 1.47: +44 -43 lines
Diff to previous 1.47 (colored) next main 1.48 (colored)

Pull up following revision(s) (requested by sborrill in ticket #308):
	sbin/resize_ffs/resize_ffs.8: revision 1.18
	sbin/resize_ffs/resize_ffs.c: revision 1.48-1.53
Fix the most obvious integer overflow errors which can lead to superblock
corruption. Thanks to riastradh@
--
Use int64_t for loop index so we don't iterate forever/until trap.
--
Fix the syntax (pointed out by David H. Gutteridge on source-changes-d).
Fix the build...
--
- More fixes to use 64bit offsets.
- Compute left-over fragments also for FFS2.
--
PR/52590: David H. Gutteridge: Minor documentation improvements
--
Fix computation of left-over fragments also for ufs2.
Fixes PR 52600.

Revision 1.38.6.3 / (download) - annotate - [select for diffs], Mon Oct 23 19:24:37 2017 UTC (5 years, 3 months ago) by snj
Branch: netbsd-7
CVS Tags: netbsd-7-2-RELEASE
Changes since 1.38.6.2: +44 -43 lines
Diff to previous 1.38.6.2 (colored) to branchpoint 1.38 (colored) next main 1.39 (colored)

Pull up following revision(s) (requested by sborrill in ticket #1516):
	sbin/resize_ffs/resize_ffs.8: revision 1.18
	sbin/resize_ffs/resize_ffs.c: revision 1.48-1.53
Fix the most obvious integer overflow errors which can lead to superblock
corruption. Thanks to riastradh@
--
Use int64_t for loop index so we don't iterate forever/until trap.
--
Fix the syntax (pointed out by David H. Gutteridge on source-changes-d).
Fix the build...
--
- More fixes to use 64bit offsets.
- Compute left-over fragments also for FFS2.
--
PR/52590: David H. Gutteridge: Minor documentation improvements
--
Fix computation of left-over fragments also for ufs2.
Fixes PR 52600.

Revision 1.38.6.2.2.1 / (download) - annotate - [select for diffs], Mon Oct 23 19:24:34 2017 UTC (5 years, 3 months ago) by snj
Branch: netbsd-7-1
CVS Tags: netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE
Changes since 1.38.6.2: +44 -43 lines
Diff to previous 1.38.6.2 (colored) next main 1.38.6.3 (colored)

Pull up following revision(s) (requested by sborrill in ticket #1516):
	sbin/resize_ffs/resize_ffs.8: revision 1.18
	sbin/resize_ffs/resize_ffs.c: revision 1.48-1.53
Fix the most obvious integer overflow errors which can lead to superblock
corruption. Thanks to riastradh@
--
Use int64_t for loop index so we don't iterate forever/until trap.
--
Fix the syntax (pointed out by David H. Gutteridge on source-changes-d).
Fix the build...
--
- More fixes to use 64bit offsets.
- Compute left-over fragments also for FFS2.
--
PR/52590: David H. Gutteridge: Minor documentation improvements
--
Fix computation of left-over fragments also for ufs2.
Fixes PR 52600.

Revision 1.38.6.1.2.1 / (download) - annotate - [select for diffs], Mon Oct 23 19:24:33 2017 UTC (5 years, 3 months ago) by snj
Branch: netbsd-7-0
Changes since 1.38.6.1: +44 -43 lines
Diff to previous 1.38.6.1 (colored) next main 1.38.6.2 (colored)

Pull up following revision(s) (requested by sborrill in ticket #1516):
	sbin/resize_ffs/resize_ffs.8: revision 1.18
	sbin/resize_ffs/resize_ffs.c: revision 1.48-1.53
Fix the most obvious integer overflow errors which can lead to superblock
corruption. Thanks to riastradh@
--
Use int64_t for loop index so we don't iterate forever/until trap.
--
Fix the syntax (pointed out by David H. Gutteridge on source-changes-d).
Fix the build...
--
- More fixes to use 64bit offsets.
- Compute left-over fragments also for FFS2.
--
PR/52590: David H. Gutteridge: Minor documentation improvements
--
Fix computation of left-over fragments also for ufs2.
Fixes PR 52600.

Revision 1.53 / (download) - annotate - [select for diffs], Mon Oct 9 05:24:26 2017 UTC (5 years, 3 months ago) by mlelstv
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat
Branch point for: phil-wifi
Changes since 1.52: +6 -5 lines
Diff to previous 1.52 (colored)

Fix computation of left-over fragments also for ufs2.

Fixes PR 52600.

Revision 1.52 / (download) - annotate - [select for diffs], Sun Oct 1 22:59:19 2017 UTC (5 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.51: +3 -3 lines
Diff to previous 1.51 (colored)

PR/52590: David H. Gutteridge: Minor documentation improvements

Revision 1.51 / (download) - annotate - [select for diffs], Sun Oct 1 07:18:39 2017 UTC (5 years, 4 months ago) by mlelstv
Branch: MAIN
Changes since 1.50: +18 -21 lines
Diff to previous 1.50 (colored)

- More fixes to use 64bit offsets.
- Compute left-over fragments also for FFS2.

Revision 1.50 / (download) - annotate - [select for diffs], Sat Sep 30 18:32:52 2017 UTC (5 years, 4 months ago) by kre
Branch: MAIN
Changes since 1.49: +5 -3 lines
Diff to previous 1.49 (colored)


Fix the syntax (pointed out by David H. Gutteridge on source-changes-d).
Fix the build...

Revision 1.49 / (download) - annotate - [select for diffs], Sat Sep 30 15:25:16 2017 UTC (5 years, 4 months ago) by riastradh
Branch: MAIN
Changes since 1.48: +7 -6 lines
Diff to previous 1.48 (colored)

Use int64_t for loop index so we don't iterate forever/until trap.

Revision 1.48 / (download) - annotate - [select for diffs], Thu Sep 28 17:07:20 2017 UTC (5 years, 4 months ago) by sborrill
Branch: MAIN
Changes since 1.47: +15 -15 lines
Diff to previous 1.47 (colored)

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

Revision 1.38.6.1.4.1 / (download) - annotate - [select for diffs], Wed Jan 18 08:46:24 2017 UTC (6 years ago) by skrll
Branch: netbsd-7-nhusb
Changes since 1.38.6.1: +21 -8 lines
Diff to previous 1.38.6.1 (colored) next main 1.38.6.2 (colored)

Sync with netbsd-5

Revision 1.38.6.2 / (download) - annotate - [select for diffs], Sat Sep 10 06:36:37 2016 UTC (6 years, 4 months ago) by snj
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base-20170116, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1
Branch point for: netbsd-7-1
Changes since 1.38.6.1: +21 -8 lines
Diff to previous 1.38.6.1 (colored) to branchpoint 1.38 (colored)

Pull up following revision(s) (requested by dholland in ticket #1242):
	sbin/resize_ffs/resize_ffs.c: revision 1.47
Fix handling of ffsv2 inode initialization. Retires PR 51116.

Revision 1.47 / (download) - annotate - [select for diffs], Wed Aug 24 07:44:05 2016 UTC (6 years, 5 months ago) by dholland
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base, localcount-20160914, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: netbsd-8
Changes since 1.46: +21 -8 lines
Diff to previous 1.46 (colored)

Fix handling of ffsv2 inode initialization. Retires PR 51116.

Revision 1.46 / (download) - annotate - [select for diffs], Thu Mar 17 01:41:54 2016 UTC (6 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount
Changes since 1.45: +3 -3 lines
Diff to previous 1.45 (colored)

fix pasto

Revision 1.45 / (download) - annotate - [select for diffs], Thu Mar 17 00:54:53 2016 UTC (6 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.44: +41 -30 lines
Diff to previous 1.44 (colored)

Appease gcc-5 from phone@

Revision 1.38.6.1 / (download) - annotate - [select for diffs], Thu Aug 6 21:13:44 2015 UTC (7 years, 5 months ago) by snj
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE
Branch point for: netbsd-7-nhusb, netbsd-7-0
Changes since 1.38: +165 -67 lines
Diff to previous 1.38 (colored)

Pull up following revision(s) (requested by skrll in ticket #909):
	distrib/sets/lists/etc/mi: revision 1.237
	distrib/sets/lists/tests/mi: revision 1.613
	distrib/utils/embedded/conf/armv7.conf: revisions 1.1, 1.2
	distrib/utils/embedded/conf/beagleboard.conf: delete
	distrib/utils/embedded/conf/evbarm.conf: revisions 1.21, 1.22
	distrib/utils/embedded/conf/rpi.conf: revisions 1.28, 1.29
	distrib/utils/embedded/conf/rpi_inst.conf: revisions 1.7, 1.8
	distrib/utils/embedded/conf/usermode.conf: revision 1.5
	distrib/utils/embedded/conf/x86.conf: revision 1.5
	distrib/utils/embedded/files/resize_disklabel: revision 1.1
	distrib/utils/embedded/mkimage: revisions 1.49, 1.55-1.59
	etc/defaults/rc.conf: revision 1.133
	etc/etc.evbarm/Makefile.inc: revisions 1.72, 1.76
	etc/rc.d/Makefile: revision 1.93 via patch
	etc/rc.d/resize_root: revisions 1.1-1.3
	etc/rc.d/root: revision 1.5
	sbin/resize_ffs/Makefile: revision 1.5
	sbin/resize_ffs/resize_ffs.8: revisions 1.14-1.16
	sbin/resize_ffs/resize_ffs.c: revisions 1.39-1.44
	share/man/man5/rc.conf.5: revision 1.158, 1.159
	tests/sbin/resize_ffs/Makefile: revision 1.4
	tests/sbin/resize_ffs/common.sh: revision 1.14
	tests/sbin/resize_ffs/t_check.sh: revision 1.1
	tests/sbin/resize_ffs/t_grow.sh: revision 1.9
	tests/sbin/resize_ffs/t_grow_swapped.sh: revision 1.3
	tests/sbin/resize_ffs/t_shrink.sh: revision 1.8
	tests/sbin/resize_ffs/t_shrink_swapped.sh: revision 1.2
fix image building:
         - round up the total size of the disk image
         - fix fdisk offset for netbsd ffs images
--
Make get_dev_size work on regular files too.
--
Use `!= -1' instead of `== 0' out of paranoia.
--
- Add -c to check to see if grow/shrink is required
- Divide by DEV_BSIZE when returning size of file.
- Update manpage
--
New sentence, new line. Sort option descriptions.
--
Add resize_root boot operation. If resize_root=YES in rc.conf then
the system attempts to resize the root file system to fill it's
partition prior to mounting read-write. Useful for things like AMI
file system images. May eventually be used by arm images after
coming up with similar solution for increasing the parition size.
--
- Add new tests for -c check flag in resize_ffs
--
Bump date for previous.
it's -> its
--
Handle case in grow() where last cylinder group is too small for ufs2.
Align with code in shrink().
--
factor out geometry calculation and use this also in CheckOnly mode.
be a bit more verbose in Verbose mode.
--
Add support for auto-growing the root partition. Enable it for rpi.img.
--
initialize resize before pulling in board config
--
add KEYWORD: interactive, honour resize_root_flags and
resize_root_postcmd rc vars
--
if the -p flag is specified, display a progress bar while growing the
file-system
--
show resize_ffs progress bar when resizing root partition
--
fix typo in previous; pass -y unconditionally to resize_ffs, not -p
--
Rename beagleboard.img to armv7.img. The new image includes the same
kernels as beagleboard.img plus support for Raspberry Pi 2, ODROID-C1,
Cubieboard2, Cubietruck, Hummingbird A31, and Banana Pi.
--
Properly spell X' name. From X(7):
        The  X.Org  Foundation  requests  that the following names be
used when
        referring to this software:
                                           X
                                    X Window System
                                     X Version 11
                              X Window System, Version 11
                                          X11
--
Add some documentation:
Tell what this does, and what it expects from conf files
--
Cleanup: make_filesystems is not used any longer, purge remains
--
More cleanup:
Instead of first overwriting the *_evbarm functions with own code,
and then calling them from the regular functions, directly put the
code into the regular functions.
No more functions from evbarm.conf are used now.
Some variables are still used!
--
define TOOL_MKUBOOTIMAGE for mkimage
--
fix mkubootimage

Revision 1.44 / (download) - annotate - [select for diffs], Mon Apr 6 22:44:04 2015 UTC (7 years, 10 months ago) by jmcneill
Branch: MAIN
Changes since 1.43: +35 -4 lines
Diff to previous 1.43 (colored)

if the -p flag is specified, display a progress bar while growing the file-system

Revision 1.43 / (download) - annotate - [select for diffs], Mon Apr 6 13:33:42 2015 UTC (7 years, 10 months ago) by mlelstv
Branch: MAIN
Changes since 1.42: +106 -73 lines
Diff to previous 1.42 (colored)

factor out geometry calculation and use this also in CheckOnly mode.
be a bit more verbose in Verbose mode.

Revision 1.42 / (download) - annotate - [select for diffs], Mon Apr 6 12:38:21 2015 UTC (7 years, 10 months ago) by mlelstv
Branch: MAIN
Changes since 1.41: +14 -9 lines
Diff to previous 1.41 (colored)

Handle case in grow() where last cylinder group is too small for ufs2.
Align with code in shrink().

Revision 1.41 / (download) - annotate - [select for diffs], Sun Mar 29 19:33:55 2015 UTC (7 years, 10 months ago) by chopps
Branch: MAIN
Changes since 1.40: +34 -6 lines
Diff to previous 1.40 (colored)

- Add -c to check to see if grow/shrink is required
- Divide by DEV_BSIZE when returning size of file.
- Update manpage

Revision 1.40 / (download) - annotate - [select for diffs], Sat Mar 28 17:25:33 2015 UTC (7 years, 10 months ago) by riastradh
Branch: MAIN
Changes since 1.39: +5 -5 lines
Diff to previous 1.39 (colored)

Use `!= -1' instead of `== 0' out of paranoia.

Revision 1.39 / (download) - annotate - [select for diffs], Sat Mar 28 17:22:46 2015 UTC (7 years, 10 months ago) by riastradh
Branch: MAIN
Changes since 1.38: +9 -8 lines
Diff to previous 1.38 (colored)

Make get_dev_size work on regular files too.

Revision 1.33.2.3 / (download) - annotate - [select for diffs], Wed Aug 20 00:02:27 2014 UTC (8 years, 5 months ago) by tls
Branch: tls-maxphys
Changes since 1.33.2.2: +37 -37 lines
Diff to previous 1.33.2.2 (colored) to branchpoint 1.33 (colored) next main 1.34 (colored)

Rebase to HEAD as of a few days ago.

Revision 1.32.2.3 / (download) - annotate - [select for diffs], Thu May 22 11:37:31 2014 UTC (8 years, 8 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.32.2.2: +48 -48 lines
Diff to previous 1.32.2.2 (colored) to branchpoint 1.32 (colored) next main 1.33 (colored)

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.38 / (download) - annotate - [select for diffs], Sun Jun 23 22:03:34 2013 UTC (9 years, 7 months ago) by dholland
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-7-base, netbsd-7-0-RC2, netbsd-7-0-RC1
Branch point for: netbsd-7
Changes since 1.37: +5 -5 lines
Diff to previous 1.37 (colored)

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.

Revision 1.37 / (download) - annotate - [select for diffs], Sun Jun 23 07:28:36 2013 UTC (9 years, 7 months ago) by dholland
Branch: MAIN
Changes since 1.36: +8 -8 lines
Diff to previous 1.36 (colored)

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

Revision 1.33.2.2 / (download) - annotate - [select for diffs], Sun Jun 23 06:28:52 2013 UTC (9 years, 7 months ago) by tls
Branch: tls-maxphys
Changes since 1.33.2.1: +12 -12 lines
Diff to previous 1.33.2.1 (colored) to branchpoint 1.33 (colored)

resync from head

Revision 1.36 / (download) - annotate - [select for diffs], Sun Jun 23 02:06:05 2013 UTC (9 years, 7 months ago) by dholland
Branch: MAIN
Changes since 1.35: +30 -30 lines
Diff to previous 1.35 (colored)

fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)

Revision 1.35 / (download) - annotate - [select for diffs], Wed Jun 19 17:51:26 2013 UTC (9 years, 7 months ago) by dholland
Branch: MAIN
Changes since 1.34: +12 -12 lines
Diff to previous 1.34 (colored)

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.

Revision 1.33.2.1 / (download) - annotate - [select for diffs], Mon Feb 25 00:28:10 2013 UTC (9 years, 11 months ago) by tls
Branch: tls-maxphys
Changes since 1.33: +10 -10 lines
Diff to previous 1.33 (colored)

resync with head

Revision 1.32.2.2 / (download) - annotate - [select for diffs], Wed Jan 23 00:05:33 2013 UTC (10 years ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.32.2.1: +10 -10 lines
Diff to previous 1.32.2.1 (colored) to branchpoint 1.32 (colored)

sync with head

Revision 1.34 / (download) - annotate - [select for diffs], Tue Jan 22 09:39:13 2013 UTC (10 years ago) by dholland
Branch: MAIN
CVS Tags: yamt-pagecache-base8, agc-symver-base, agc-symver
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.32.2.1 / (download) - annotate - [select for diffs], Wed May 23 10:07:34 2012 UTC (10 years, 8 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)

sync with head.

Revision 1.33 / (download) - annotate - [select for diffs], Fri Apr 20 13:20:39 2012 UTC (10 years, 9 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.12.10.1 / (download) - annotate - [select for diffs], Fri Nov 18 22:35:45 2011 UTC (11 years, 2 months ago) by sborrill
Branch: netbsd-5
CVS Tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2
Changes since 1.12: +622 -310 lines
Diff to previous 1.12 (colored) next main 1.13 (colored)

Pull up the following revisions(s) (requested by riz in ticket #1690):
	distrib/sets/lists/base/mi			patch
	distrib/sets/lists/man/mi			patch
	sbin/Makefile					patch
	sbin/resize_ffs/Makefile			patch
	sbin/resize_ffs/TODO				patch
	sbin/resize_ffs/resize_ffs.8			patch
	sbin/resize_ffs/resize_ffs.c			patch

Fix resize_ffs(8) so that growing and shrinking all FFSv1
(including byteswapped) and growing FFSv2 file systems is supported.

Revision 1.32 / (download) - annotate - [select for diffs], Sat Aug 27 16:34:57 2011 UTC (11 years, 5 months 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-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, 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 (11 years, 5 months 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 (11 years, 5 months 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 (11 years, 5 months 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 (11 years, 5 months 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 (11 years, 5 months 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 (11 years, 5 months 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 (12 years, 1 month 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 (12 years, 1 month 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 (12 years, 1 month 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 (12 years, 1 month 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 (12 years, 1 month 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 (12 years, 1 month 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 (12 years, 1 month 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 (12 years, 1 month 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 (12 years, 2 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 (12 years, 2 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 (12 years, 2 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 (12 years, 2 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 (12 years, 3 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.10.4.1 / (download) - annotate - [select for diffs], Wed Jan 9 01:38:16 2008 UTC (15 years ago) by matt
Branch: matt-armv6
Changes since 1.10: +3 -2 lines
Diff to previous 1.10 (colored) next main 1.11 (colored)

sync with HEAD

Revision 1.10.6.1 / (download) - annotate - [select for diffs], Thu Dec 27 00:47:04 2007 UTC (15 years, 1 month ago) by mjf
Branch: mjf-devfs
Changes since 1.10: +3 -2 lines
Diff to previous 1.10 (colored) next main 1.11 (colored)

Sync with HEAD.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Dec 15 19:44:47 2007 UTC (15 years, 1 month 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-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, 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 (15 years, 1 month 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 (15 years, 7 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 (15 years, 7 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 (17 years, 8 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 (18 years, 10 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 (19 years, 1 month 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 (19 years, 6 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 (19 years, 10 months 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 (19 years, 11 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 (19 years, 11 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 (19 years, 11 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>