Commit Graph

55 Commits

Author SHA1 Message Date
Conrad Meyer
50c59bbb53 fstyp(8): Detect HFS+ / HFSX volumes 2019-12-23 05:43:01 +00:00
Conrad Meyer
ec80d2eedd fstyp(8): Use iconv(3) to convert NTFS vol labels correctly
Rather than hackily extracting only the ASCII subset of UTF-16LE, go ahead
and convert the label to the user's locale correctly.
2019-12-23 02:41:13 +00:00
Conrad Meyer
85b4c344c8 fstyp(8): Show exFAT volume labels with -l flag
exfat is fundamentally the same design as fat32.  The superblock differs
marginally, and there are some additional optional features irrelevant to
fstype(8); the structure of dirents has changed slightly to enable, among
other things, larger files; the directory entries are no longer DOS 8.3
ASCII or local 8-bit encoding, but instead explicitly UCS-2-LE.

(As a result, this change uses iconv to convert a found exfat volume label
to the user's locale.)

Locating the volume label is identical to FAT32: locate the root directory
and walk through dirents until you find a volume label.  Like FAT32, follow
the FAT chain between root directory clusters as necessary.

PR:		242225
Reported by:	Victor Sudakov <vas AT sibptus.ru>
2019-12-22 03:19:17 +00:00
Simon J. Gerraty
2c9a9dfc18 Update Makefile.depend files
Update a bunch of Makefile.depend files as
a result of adding Makefile.depend.options files

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22494
2019-12-11 17:37:53 +00:00
Simon J. Gerraty
5ab1c5846f Add Makefile.depend.options
Leaf directories that have dependencies impacted
by options need a Makefile.depend.options file
to avoid churn in Makefile.depend

DIRDEPS for cases such as OPENSSL, TCP_WRAPPERS etc
can be set in local.dirdeps-options.mk
which can add to those set in Makefile.depend.options

See share/mk/dirdeps-options.mk

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22469
2019-12-11 17:37:37 +00:00
Alan Somers
809a8352dd Drop "All rights reserved" from the files I own
Also, add SPDX tags where needed.

MFC after:	2 weeks
2019-03-11 22:23:56 +00:00
Kirk McKusick
fb14e73cb4 Normally when an attempt is made to mount a UFS/FFS filesystem whose
superblock has a check-hash error, an error message noting the
superblock check-hash failure is printed and the mount fails. The
administrator then runs fsck to repair the filesystem and when
successful, the filesystem can once again be mounted.

This approach fails if the filesystem in question is a root filesystem
from which you are trying to boot. Here, the loader fails when trying
to access the filesystem to get the kernel to boot. So it is necessary
to allow the loader to ignore the superblock check-hash error and make
a best effort to read the kernel. The filesystem may be suffiently
corrupted that the read attempt fails, but there is no harm in trying
since the loader makes no attempt to write to the filesystem.

Once the kernel is loaded and starts to run, it attempts to mount its
root filesystem. Once again, failure means that it breaks to its prompt
to ask where to get its root filesystem. Unless you have an alternate
root filesystem, you are stuck.

Since the root filesystem is initially mounted read-only, it is
safe to make an attempt to mount the root filesystem with the failed
superblock check-hash. Thus, when asked to mount a root filesystem
with a failed superblock check-hash, the kernel prints a warning
message that the root filesystem superblock check-hash needs repair,
but notes that it is ignoring the error and proceeding. It does
mark the filesystem as needing an fsck which prevents it from being
enabled for writing until fsck has been run on it. The net effect
is that the reboot fails to single user, but at least at that point
the administrator has the tools at hand to fix the problem.

Reported by:    Rick Macklem (rmacklem@)
Discussed with: Warner Losh (imp@)
Sponsored by:   Netflix
2018-12-06 00:09:39 +00:00
Alexander Motin
7fca1b93c4 Do not blindly include illumos kernel headers instead of user-space.
It is not needed now, and I doubt it much helped at all, creating more
confusions then good.
2018-08-02 18:55:55 +00:00
Mariusz Zaborski
1afab1fe21 Use capsicum helpers in fstype and ctld.
Reviewed by:	trasz
2018-07-15 17:21:19 +00:00
Xin LI
b6f7731dba Remove "All rights reserved" from my files.
See r333391 for the rationale.

MFC after:	1 week
2018-05-10 06:41:08 +00:00
Kirk McKusick
dffce2150e Refactoring of reading and writing of the UFS/FFS superblock.
Specifically reading is done if ffs_sbget() and writing is done
in ffs_sbput(). These functions are exported to libufs via the
sbget() and sbput() functions which then used in the various
filesystem utilities. This work is in preparation for adding
subperblock check hashes.

No functional change intended.

Reviewed by: kib
2018-01-26 00:58:32 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Enji Cooper
d511b20a69 Add HAS_TESTS to all Makefiles that are currently using the
`SUBDIR.${MK_TESTS}+= tests` idiom.

This is a follow up to r321912.
2017-08-02 08:50:42 +00:00
Enji Cooper
4b330699f8 Convert traditional ${MK_TESTS} conditional idiom for including test
directories to SUBDIR.${MK_TESTS} idiom

This is being done to pave the way for future work (and homogenity) in
^/projects/make-check-sandbox .

No functional change intended.

MFC after:	1 weeks
2017-08-02 08:35:51 +00:00
Andriy Gapon
d6609e6a12 fstyp: move sys/ include path after zfs include paths
The reason is that FreeBSD refcount.h shadows ZFS refcount.h and that
will lead to a build error after a planned import of the ARC buf data
scatter-ization.
It's possible that some day we will have an opposite problem where
a ZFS header would shadow an essential FreeBSD header.
So, we need to think about a better long term solution.

Discussed with:	allanjude
MFC after:	17 days
2017-06-20 16:45:48 +00:00
Edward Tomasz Napierala
56226f9c30 Make fstyp(8) recognize exFAT even without the -u option.
While it's not directly mountable with mount(8), it's something that's
mountable - differently from GELI or zpools.

MFC after:	2 weeks
2017-04-26 19:34:41 +00:00
Edward Tomasz Napierala
4bcdaf7651 Improve formatting.
MFC after:	2 weeks
2017-03-19 16:17:42 +00:00
Alan Somers
f5c4d58f4a Fix harmless mismerge from r286964
MFC after:	3 days
Sponsored by:	Spectra Logic Corp
2017-03-09 16:22:21 +00:00
Enji Cooper
64a0982bee usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible
This simplifies make logic/output

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-04 11:38:03 +00:00
Enji Cooper
0372faed69 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-01 04:00:17 +00:00
Conrad Meyer
4a6ace7328 Fix broken fstyp exfat testcase
Introduced in r312010.

It helps to read the documentation before trying to test something.
2017-01-14 01:08:04 +00:00
Conrad Meyer
b632b00087 fstyp.8: Move initial exFAT blurb to the -u section
Didn't notice the second list in r312003.

Reported by:	trasz@
2017-01-13 16:46:01 +00:00
Enji Cooper
ef7ff3e308 Use dfr-01-xfat.img.bz2, not dfr-01-xfat.dd.bz2 (the latter
case was the full disk image from the website, which was never
checked in to svn)

Regardless, the testcase still fails

PR:		214908
Sponsored by:	Dell EMC Isilon
2017-01-13 04:04:48 +00:00
Enji Cooper
6f81c4d9bb Add testcase for exFAT that currently fails
Disk image obtained from:
http://www.cfreds.nist.gov/dfr-images/dfr-01-xfat.dd.bz2 -- was ripped off the
first GPT partition and verified to be a FAT-like partition with file(1)/hexdump.

This testcase currently fails

PR:		214908
Sponsored by:	Dell EMC Isilon
2017-01-13 04:02:09 +00:00
Enji Cooper
cebf8a2ca7 Add license preamble for r286964; credit to asomers
While here, clean up trailing whitespace

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-01-13 03:42:51 +00:00
Conrad Meyer
e266075649 fstyp(8): Detect exFAT filesystems
Simply detect the exFAT filesystem name in the Volume Boot Record
(superblock).

PR:		214908
Reported by:	<vermaden at interia.pl>
2017-01-13 02:12:58 +00:00
Ruslan Bukin
f2567787aa fstyp tests comes with pre-created EL filesystems,
but fstyp cannot detect EL filesystem on EB machine,
so exclude test files from distribution and skip the
test.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-10-18 12:58:17 +00:00
Enji Cooper
430f7286a5 Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed
after r298107

Summary of changes:

- Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that
  namespacing is kept with FILES appropriately, and that this shouldn't need
  to be repeated if the namespace changes -- only the definition of PACKAGE
  needs to be changed
- Allow PACKAGE to be overridden by callers instead of forcing it to always be
  `tests`. In the event we get to the point where things can be split up
  enough in the base system, it would make more sense to group the tests
  with the blocks they're a part of, e.g. byacc with byacc-tests, etc
- Remove PACKAGE definitions where possible, i.e. where FILES wasn't used
  previously.
- Remove unnecessary TESTSPACKAGE definitions; this has been elided into
  bsd.tests.mk
- Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES;
  ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk.
- Fix installation of files under data/ subdirectories in lib/libc/tests/hash
  and lib/libc/tests/net/getaddrinfo
- Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup)

Document the proposed changes in share/examples/tests/tests/... via examples
so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of
replacing FILES. share/mk/bsd.README didn't seem like the appropriate method
of communicating that info.

MFC after: never probably
X-MFC with: r298107
PR: 209114
Relnotes: yes
Tested with: buildworld, installworld, checkworld; buildworld, packageworld
Sponsored by: EMC / Isilon Storage Division
2016-05-04 23:20:53 +00:00
Glen Barber
0edd2576c0 MFH
Sponsored by:	The FreeBSD Foundation
2016-04-16 02:32:12 +00:00
Marcelo Araujo
d11537c785 Use NULL instead of 0 for pointers.
The malloc will return a pointer to the allocated memory if successful,
otherwise a NULL pointer is returned.
2016-04-14 12:51:06 +00:00
Glen Barber
7d536dc855 MFH
Sponsored by:	The FreeBSD Foundation
2016-03-10 21:16:01 +00:00
Bryan Drewery
15c433351f DIRDEPS_BUILD: Connect MK_TESTS.
Sponsored by:	EMC / Isilon Storage Division
2016-03-09 22:46:01 +00:00
Glen Barber
52259a98ad MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 16:14:46 +00:00
Edward Tomasz Napierala
0fc124ccdd Fix .Xr - autofs(5) is section 5, not 8.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-02-28 10:40:09 +00:00
Glen Barber
43faedc133 First pass to fix the 'tests' packages.
Sponsored by:	The FreeBSD Foundation
2016-02-02 22:26:49 +00:00
Xin LI
ca001338d8 Eliminate unneeded includes.
Reviewed by:		allanjude
Differential Revision:	https://reviews.freebsd.org/D4716
2015-12-28 08:53:31 +00:00
Allan Jude
b5e81ea6b0 Fix includes in usr.sbin/fstyp/zfs.c
Approved by:	bapt (mentor)
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D4710
2015-12-26 19:48:36 +00:00
Bryan Drewery
eacae6dc66 Fix LDADD/DPADD that should be LIBADD.
Sponsored by:	EMC / Isilon Storage Division
2015-12-04 03:17:47 +00:00
Bryan Drewery
fea60e240e Convert to LIBADD
Sponsored by:	EMC / Isilon Storage Division
2015-12-03 21:16:52 +00:00
Bryan Drewery
b1f92fa229 META MODE: Update dependencies with 'the-lot' and add missing directories.
This is not properly respecting WITHOUT or ARCH dependencies in target/.
Doing so requires a massive effort to rework targets/ to do so.  A
better approach will be to either include the SUBDIR Makefiles directly
and map to DIRDEPS or just dynamically lookup the SUBDIR.  These lose
the benefit of having a userland/lib, userland/libexec, etc, though and
results in a massive package.  The current implementation of targets/ is
very unmaintainable.

Currently rescue/rescue and sys/modules are still not connected.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:23:19 +00:00
Enji Cooper
b2d48be1bc Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Divison
2015-10-12 08:16:03 +00:00
Xin LI
4b43341dea Eliminate unneeded copying of vdev data, goto, etc. and add a note
that checksum of vdev label should be checked (which is not done
currently).

No functional change.

While I'm there, raise WARNS to 2.

Reviewed by:	allanjude
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D3508
2015-09-17 20:55:47 +00:00
Alan Somers
d60f0f1c49 Add ATF functional tests for fstyp(8). No ZFS or GELI tests yet.
Reviewed by:	trasz, ngie
MFC after:	2 weeks
Sponsored by:	SpectraLogic
Differential Revision:	https://reviews.freebsd.org/D2801
2015-08-20 15:37:47 +00:00
Bjoern A. Zeeb
f2dedc73e0 Rather than hardcoding a string and limiting the comparison to these
characters use the defined constant so that in case of change this
would not break.

Reviewed by:		allanjude
Differential Revision:	https://reviews.freebsd.org/D3340
MFC after:		2 weeks
2015-08-10 10:29:32 +00:00
Edward Tomasz Napierala
f36b09c457 fstyp(8) ships with 10.2.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2015-07-18 12:03:51 +00:00
Allan Jude
f56cc610dc Remove excess copyright lines propogated by copy/paste
Approved by:	trasz
2015-07-12 19:16:19 +00:00
Allan Jude
69f172f27d Switch fstyp build to toggle ZFS support on WITHOUT_ZFS rather than WITHOUT_CDDL
PR:		200976
Approved by:	imp
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D2045
2015-06-23 16:34:43 +00:00
Allan Jude
e3ef9bb29e Fix the build for gcc by lowering the WARNS level
Approved by:	sbruno
X-MFC-With:	r284589
2015-06-20 15:03:02 +00:00
Allan Jude
398e498e49 Add the ability to detect ZFS and GELI encrypted file systems to fstyp(8)
Functionality is hidden behind the -u flag to avoid confusing automounters

PR:		200823
Reviewed by:	asomers, eadler, wblock (man page)
Approved by:	trasz
MFC after:	10 days
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D2045
2015-06-19 05:09:02 +00:00
Edward Tomasz Napierala
628b712826 Fix off-by-one error in fstyp(8) and geom_label(4) that made them use
a single space (" ") as a CD9660 label name when no label was present.
Similar problem was also present in msdosfs label recognition.

PR:		200828
Differential Revision:	https://reviews.freebsd.org/D2830
Reviewed by:	asomers@, emaste@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2015-06-18 21:55:55 +00:00