Initial commit of the fsck_udf(8) utility that checks and repairs UDF

filesystems on optical media as well as on disc images, harddisc partitions
and wedges.
This commit is contained in:
reinoud 2022-04-06 13:35:50 +00:00
parent 8f4e1cd991
commit f41dcb03b1
3 changed files with 4606 additions and 0 deletions

23
sbin/fsck_udf/Makefile Normal file
View File

@ -0,0 +1,23 @@
# $NetBSD: Makefile,v 1.1 2022/04/06 13:35:50 reinoud Exp $
.include <bsd.own.mk>
PROG= fsck_udf
MAN= fsck_udf.8
SRCS= main.c udf_core.c \
udf_osta.c fattr.c fsutil.c
FSCK= ${NETBSDSRCDIR}/sbin/fsck
NEWFS= ${NETBSDSRCDIR}/sbin/newfs_udf
MOUNT= ${NETBSDSRCDIR}/sbin/mount
KUDF= ${NETBSDSRCDIR}/sys/fs/udf
CPPFLAGS+= -I${FSCK} -I${KUDF} -I${NEWFS} -I${NETBSDSRCDIR}/sys
.PATH: ${FSCK} ${NEWFS} ${MOUNT} ${KUDF}
DPADD+=${LIBUTIL}
LDADD+=-lutil -lprop
CWARNFLAGS.clang+= -Wno-error=address-of-packed-member
CWARNFLAGS.gcc+= ${GCC_NO_ADDR_OF_PACKED_MEMBER}
.include <bsd.prog.mk>

115
sbin/fsck_udf/fsck_udf.8 Normal file
View File

@ -0,0 +1,115 @@
.\" $NetBSD: fsck_udf.8,v 1.1 2022/04/06 13:35:50 reinoud Exp $
.\"
.\" Copyright (C) 2022 Reinoud Zandijk
.\" Based on fsck_msdos(8) by
.\" Copyright (C) 1995 Wolfgang Solfrank
.\" Copyright (c) 1995 Martin Husemann
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\"
.Dd February 6, 2022
.Dt FSCK_UDF 8
.Os
.Sh NAME
.Nm fsck_udf
.Nd Universal Disk Format filesystem consistency checker
.Sh SYNOPSIS
.Nm
.Fl p
.Op Fl fH
.Ar filesystem ...
.Nm
.Op Fl sSynfH
.Ar filesystem ...
.Sh DESCRIPTION
The
.Nm
utility verifies and repairs
.Tn Universal Disk Format
filesystems (more commonly known as
.Tn UDF
filesystems).
.Pp
The first form of
.Nm
preens the specified filesystems.
It is normally started by
.Xr fsck 8
run from
.Pa /etc/rc
during automatic reboot, when an UDF filesystem is detected.
When preening file systems,
.Nm
will fix common inconsistencies non-interactively.
If more serious problems are found,
.Nm
does not try to fix them, indicates that it was not
successful, and exits.
.Pp
The second form of
.Nm
checks the specified file systems and tries to repair all
detected inconsistencies, requesting confirmation before
making any changes.
.Pp
The options are as follows:
.Bl -tag -width XXXoptions
.It Fl f
Force detailed checking even when file system is marked closed.
.It Fl n
Causes
.Nm
to assume no as the answer to all operator
questions.
.It Fl p
Preen the specified filesystems.
.It Fl y
Causes
.Nm
to assume yes as the answer to all operator questions.
.It Fl s Ar session
Select session
.Ar session
to be checked on recordable media. This allows older sessions
of the file system on recordable media to be recovered.
.It Fl S
Causes
.Nm
to scan for older VAT tables on recordable media. This allows older snapshots
of the file system on recordable media to be recovered.
.It Fl H
Enables heuristic repair options repairing known corruptions in the wild
caused by bugs.
.El
.Sh SEE ALSO
.Xr fsck 8 ,
.Xr fsck_ffs 8 ,
.Xr mount_udf 8
.Sh HISTORY
A
.Nm
utility appeared in
.Nx 10.0 .
.Sh BUGS
.Nm
is still under construction. Not all possible reparations are implemented.

4468
sbin/fsck_udf/main.c Normal file

File diff suppressed because it is too large Load Diff