2d60b848 | 04-Jun-2022 |
Tomohiro Kusumi <tkusumi@netbsd.org> |
usr.sbin/makefs: Add HAMMER2 support
This commit adds HAMMER2 image creation support for makefs(8). It runs newfs_hammer2(8) and then sys/vfs/hammer2 logic in userspace to create HAMMER2 image from
usr.sbin/makefs: Add HAMMER2 support
This commit adds HAMMER2 image creation support for makefs(8). It runs newfs_hammer2(8) and then sys/vfs/hammer2 logic in userspace to create HAMMER2 image from a given directory.
This commit splits newfs_hammer2(8) into newfs and mkfs part simlarly to newfs_msdos(8), so that makefs(8) can use newfs functionality. The entire sys/vfs/hammer2 (with exception of unneeded hammer2_{bulkfree,ccms,iocom,ioctl,msgops,synchro}.[hc] and reusable hammer2_disk.h) is copied to usr.sbin/makefs with below modification. It intends to have minimum amount of diff against sys/vfs/hammer2.
* Header includes are modified so that it compiles in userspace. * VFS and other kernel functions are usually implemented as simple stub functions in hammer2_compat.h and hammer2_buf.c, but some are commented out. * Kernel functions such as kprintf, kmalloc, kprintf, kstrdup, etc are implemented using corresponding libc functions. * Lock primitives are basically NOP, and they (should) never block as makefs(8) is a single thread program. * struct vnode and struct buf (the ones defined locally in makefs(8), not sys/sys/*) have new struct members only used by HAMMER2 to emulate VFS behavior required by HAMMER2. * Since makefs(8) is write-only, VOP_{NRESOLVE,NCREATE,NMKDIR,NLINK, NSYMLINK,WRITE,STRATEGY} are implemented, but other VOPs just return EOPNOTSUPP. * VOP_{INACTIVE,RECLAIM} may be implemented and used in future to better emulate VFS behavior to address current limitation. * VOP_WRITE is modified to directly call VOP_STRATEGY function. * The XOP kernel thread is modified to act as a regular function called from VOPs, along with simplified admin code.
It currently has following limitations.
* multi-volumes is unsupported, simply due to makefs(8) only taking 1 image file path. * Not necessarily a limitation, but it only supports populating 1 PFS, which is "DATA" by default. Other PFSes if any won't have anything under the root PFS inode. * makefs(8) process gets killed by OOM for a directory with *extremely* large number of files, depending on available memory. This is due to the way it currently tries to flush all chains in a single VFS_SYNC. Supporting multiple VFS_SYNC calls by checking available memory along the way gives chance to free unused vnodes/inodes and chains. This may be implemented in future. This limitation is specific to HAMMER2, as all other makefs(8) filesystems are not CoW, meaning they allow in-place write based objects creation from a top directory to bottom whereas HAMMER2 flushes chains in bottom-up direction.
show more ...
|
7a1c99d3 | 19-Feb-2022 |
Aaron LI <aly@aaronly.me> |
lpr(1): Fix '-i' option with optional argument
lpr(1)'s '-i' option accepts an optional argument, but the implementation was incomplete. For example, 'lpr -i -#3' errors with: 'Bad argument to -i,
lpr(1): Fix '-i' option with optional argument
lpr(1)'s '-i' option accepts an optional argument, but the implementation was incomplete. For example, 'lpr -i -#3' errors with: 'Bad argument to -i, number expected'.
However, because the argument to '-i' option can have a leading white space (i.e., '-i 4'), we can't use getopt(3)'s new 'option::' feature here. Fix the code in another way inspired by dma(8) (see 'libexec/dma/dma.c').
In addition, update the usage text as well as the man page.
show more ...
|
bc425cd9 | 03-Nov-2021 |
Tomohiro Kusumi <tkusumi@netbsd.org> |
usr.sbin/fstyp: Fix intra-object buffer overread for labeled msdosfs volumes
Volume labels, like directory entries, are padded with spaces and so have no NUL terminator. Whilst the MIN for the dsize
usr.sbin/fstyp: Fix intra-object buffer overread for labeled msdosfs volumes
Volume labels, like directory entries, are padded with spaces and so have no NUL terminator. Whilst the MIN for the dsize argument to strlcpy ensures that the copy does not overflow the destination, strlcpy is defined to return the number of characters in the source string, regardless of the provided dsize, and so keeps reading until it finds a NUL, which likely exists somewhere within the following fields, but On CHERI with the subobject bounds enabled in the compiler this buffer overread will be detected and trap with a bounds violation.
taken from FreeBSD 34fb1c133c5b8616f14f1d740d99747b427f5571 63d24336fd1aad81a4bdefb11d8c487cee5f88a0
show more ...
|
32357d2a | 31-Oct-2021 |
Tomohiro Kusumi <tkusumi@netbsd.org> |
usr.sbin/makefs: Ignore the "tags" keyword in mtree manifests
An install using -DNO_ROOT emits mtree entries containing tags used by pkgbase. makefs(8) can safely ignore them, so do that rather tha
usr.sbin/makefs: Ignore the "tags" keyword in mtree manifests
An install using -DNO_ROOT emits mtree entries containing tags used by pkgbase. makefs(8) can safely ignore them, so do that rather than emitting a warning for each entry.
taken from FreeBSD ed42b22abc48ba53aaa38e1e64438b6d71e7e944
show more ...
|
2a7b2908 | 31-Oct-2021 |
Tomohiro Kusumi <tkusumi@netbsd.org> |
usr.sbin/makefs: fix use-after-free in read_mtree_keywords()
The st variable is used as a shortcut for &node->inode->st, but in one branch just before the exit we update node->inode without changing
usr.sbin/makefs: fix use-after-free in read_mtree_keywords()
The st variable is used as a shortcut for &node->inode->st, but in one branch just before the exit we update node->inode without changing st.
taken from FreeBSD 12ad8bdb34aa990bcc4f3faa92a6e0557385d2b2
show more ...
|
a318d7ce | 31-Oct-2021 |
Tomohiro Kusumi <tkusumi@netbsd.org> |
usr.sbin/makefs: Also set UFS di_birthtime when building on Linux
Since st_birthtime doesn't exists on Linux (unless you use statx(2)), we instead populate it with the st_ctime value.
taken from Fr
usr.sbin/makefs: Also set UFS di_birthtime when building on Linux
Since st_birthtime doesn't exists on Linux (unless you use statx(2)), we instead populate it with the st_ctime value.
taken from FreeBSD 1e9f67e2e4bcfb5aff72b184b5fce5f1faf3ca68
show more ...
|
58306fcd | 31-Oct-2021 |
Tomohiro Kusumi <tkusumi@netbsd.org> |
usr.sbin/makefs: Fix "time" mtree attribute handling
When processing mtree(5) MANIFEST files, makefs(8) previously threw an error if it encountered an entry whose "time" attribute contained a non-ze
usr.sbin/makefs: Fix "time" mtree attribute handling
When processing mtree(5) MANIFEST files, makefs(8) previously threw an error if it encountered an entry whose "time" attribute contained a non-zero subsecond component (e.g. time=1551620152.987220000).
Update the handling logic to properly assign the subsecond component if built with nanosecond support, or silently discard it otherwise.
Also, re-enable the time attribute for the kyua tests.
taken from FreeBSD 286258a9a0e39cfce79d3b072a665b88bfb422c7
show more ...
|