Home | History | Annotate | Download | only in makefs
History log of /src/usr.sbin/makefs/walk.c
RevisionDateAuthorComments
 1.43  01-May-2025  andvar s/sollowed/followed/ in comment.
 1.42  30-Apr-2025  christos From FreeBSD D50078 by jrtc27:

Linux's struct stat does not have an st_flags member, but we still want
to be able to create FreeBSD disk images with non-zero st_flags. Add a
replacement member to struct fsinode to store it on Linux.
 1.41  18-Oct-2024  christos PR/58759: Kenichi Hashimoto: failed merge with extra-directory using -r option
 1.40  08-May-2024  christos Add an option to warn and error out for mtree missing entries.
 1.39  24-Apr-2024  rillig makefs: fix out-of-bounds fsnode count in fsnode_sort

Found by running './makefs img.dat cd9660'.

While here, apply more KNF.
 1.38  24-Apr-2024  christos use __func__
 1.37  24-Apr-2024  christos make a separate sorting function and KNF (thanks rillig)
 1.36  23-Apr-2024  christos pass lint, simplify
 1.35  23-Apr-2024  christos makefs: Fix symlink permission bits

Permission bits for symlinks are taken straight from `lstat()`. However, the
actual bits presented to the user are filesystem/kernel specific. For example,
Linux with ext2/3/4 will use 0777 for symlinks, whereas NetBSD/FFS will
show 0755. As far as `makefs` is in the loop, the target filesystem will likely
be FFS, so use 0755.
 1.34  23-Apr-2024  christos makefs: Sort directory contents by name (Jan-Benedict Glaw)

`makefs` inserts nodes into its internal data structures in the order as
returned by `readdir()` calls. As this is unpredictable, sort entries by
name before creating the target filesystem.

This is done by first converting the (per-directory) linked list into
a plain array, sort it, finally re-link the list. Special case for the
sorting function: The "." directory entry seems to be ment to be always
at the front, so always check that first.
 1.33  28-Dec-2023  tsutsui Use EXIT_SUCCESS and EXIT_FAILURE where appropriate per style guide.
 1.32  09-Apr-2022  riastradh makefs(8): Nix trailing whitespace.

Computed by machine, eyeballed by hand, so to speak.
 1.31  06-Apr-2022  wiz makefs: fix some typos
 1.30  03-Apr-2021  simonb Add a -L option to follow all symbolic links. Useful if you have symlinks
in a makefs directory tree but want to refer to the actual file.
 1.29  25-Nov-2015  christos Provide a -T option to set timestamps to a consistent value for MKREPRO
 1.28  03-Feb-2013  christos add a replace flag so we can overlay exiting files when we merge directories.
 1.27  28-Jan-2013  christos - use emalloc and friends
- kill a bunch of global variables, more work to be done here
- homogenize option parsing. more work for cd9660
- use the new options parsing code to print an fs-specific usage
 1.26  19-Apr-2012  christos branches: 1.26.2;
WARNS=5
 1.25  28-Jan-2012  christos Patch from Jung-uk Kim (jkim at FreeBSD dot org) to allow contents of multiple
directories to be merged to the current image.
 1.24  28-Dec-2008  christos branches: 1.24.8;
fix for 64 bit time_t and dev_t.
 1.23  10-Oct-2006  dbj implement -x by pruning fsnodes tree before building filesystem rather
than by skipping nodes while building filesystem
 1.22  10-Oct-2006  dbj add implementation of free_fsnodes() which unlinks a node
from the hierarchy and frees it and any of its children
use it to free memory before a normal exit, which helps diagnostics
 1.21  10-Oct-2006  dbj free specfile structure once it has been applied
 1.20  10-Oct-2006  dbj use new implementation of link_check which i
implemented for du.c revision 1.25 :

Use open address hashtable with multiplicative double hash probing
and exponential hashtable growth for tracking previously seen inodes.
This replaces the O(n^2) behavior of linkchk() with an implementation
that should be O(n*logn)
 1.19  01-Feb-2006  dyoung Stop duplicating the ISO9660 sources in sys/fs/cd9660/ for makefs(8).
 1.18  19-Aug-2005  christos 64 bit inode changes
 1.17  20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.16  31-May-2004  lukem Use uint64_t instead of uint32_t to store a host inode when checking
for duplicate inodes, as Cygwin's stat(2) has a 64 bit st_ino.
Fix from Ian Lance Taylor in private email.
 1.15  19-Sep-2003  itojun branches: 1.15.2;
realloc pedant
 1.14  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22366, verified by myself.
 1.13  09-May-2003  itojun just for safety - use sizeof
 1.12  29-Mar-2003  thorpej Add a -x option which causes makefs(8) to exclude any file system node
not explicitly listed in the specfile.
 1.11  27-Jan-2003  uwe s/ulong/unsigned long/. ulong is for SysV compatibility, there's no
point in using it in our code. This change makes makefs(8) compile on
host systems without ulong.
 1.10  19-Oct-2002  provos use readlink with bufsize - 1; approved thorpej.
 1.9  08-Feb-2002  lukem branches: 1.9.2;
If an entry is in the specfile but not in the underlying file system, and it's
marked "optional", don't add it. (e.g, don't create a zero-length file).
 1.8  31-Jan-2002  tv Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.7  23-Jan-2002  lukem Merge create_fsinode() into create_fsnode(), so that a newly created
fsnode always has a valid inode member. Problem noted by Artem Belevich.
 1.6  05-Dec-2001  lukem rework `fsnode' into two components; `fsnode' contains the name and tree
information and a link to the appropriate fsinode, and `fsinode' contains
the inode information and a reference count. multiple fsnodes may point
to the same fsinode. this replaces the 'dup' pointer in the previous code.
 1.5  02-Nov-2001  lukem tweak copyright
 1.4  29-Oct-2001  lukem cast time_t values to long if printing as %ld to appease the sparc64 port
 1.3  29-Oct-2001  lukem - apply_specdir(): when adding a new symlink from the specfile, do the assert
check on the correct node
- apply_specentry(): if this node is a duplicate of another, apply the
changes to the `master' entry instead of this one.
- fix inotype() to DTRT
- comment out some debugging info that is too verbose
 1.2  28-Oct-2001  lukem add __RCSID()
 1.1  26-Oct-2001  lukem branches: 1.1.1;
Initial revision
 1.1.1.1  26-Oct-2001  lukem makefs - create a file system image from a directory tree.
It doesn't need any special privileges or kernel devices.

Only ffs image creation is supported at this time, although makefs has been
designed to allow the addition of other file system formats by writing new
back-ends.

This program was designed & implemented by Luke Mewburn of Wasabi Systems.
 1.9.2.1  23-Jul-2004  tron Apply patch (request by dbj in ticket 1723):
Fix building the netbsd-1-6 branch under Darwin/MacOS.
 1.15.2.1  22-Jun-2004  tron Pull up revision 1.17 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.24.8.3  22-May-2014  yamt 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")
 1.24.8.2  23-May-2012  yamt sync with head.
 1.24.8.1  17-Apr-2012  yamt sync with head
 1.26.2.1  25-Feb-2013  tls resync with head

RSS XML Feed