Commit graph

166 commits

Author SHA1 Message Date
Chia-Jung Chang 304f52ad1b
df(1): Fix grammar
Event:		Advance UNIX programming course (Fall'23) at NTHU
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1027
2024-02-13 18:31:05 +08:00
Pin-Yi Kuo e3d3e1ff7e df(1): fix a typo
On the manpage of df(1), "according" is mistyped into "acccording"

Event: Advanced UNIX Programming Course (Fall'23) at NTHU.
Signed-off-by: Pin-Yi Kuo <kuokuoyiyi@gapp.nthu.edu.tw>
Reviewed by: imp, zlei, Mina Galić
Pull Request: https://github.com/freebsd/freebsd-src/pull/944
2023-12-26 10:05:29 -07:00
Warner Losh 0b8224d1cc Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh 90aea514c6 bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:28 -07:00
Warner Losh b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Simon J. Gerraty d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
Stefan Eßer c33db74b53 fs/msdosfs: add tracking of free root directory entries
This update implements tallying of free directory entries during
create, delete,	or rename operations on FAT12 and FAT16 file systems.

Prior to this change, the total number of root directory entries
was reported as number of inodes, but 0 as the number of free
inodes, causing system health monitoring software to warn about
a suspected disk full issue.

The FAT12 and FAT16 file systems provide a limited number of
root directory entries, e.g. 512 on typical hard disk formats.
The valid range of values is 1 to 65535, but the msdosfs code
will effectively round up "odd" values to the next multiple of 16
(e.g. 513 would allow for 528 root directory entries).

This update implements tracking of directory entries during create,
delete, or rename operations, with initial values determined by
scanning the directory when the file system is mounted.

Total and free directory entries are reported in the f_files and
f_ffree elements of struct statfs, despite differences in semantics
of these values:

- There is no limit on the number of files and directories that can
  be created on a FAT file system. Only the root directory of FAT12
  and FAT16 file systems is limited, any number of files can still be
  created in sub-directories, even when 0 free "inodes" are reported.

- A single file can require 1 to 21 directory entries, depending on
  the character set, structure, and length of the name. The DOS 8.3
  style file name takes up 1 entry, and if the name does not comply
  with the syntax of a DOS 8.3 file name, 1 additional entry is used
  for each 13 characters of the file name. Since all these entries
  have to be contiguous, it is possible that a file or directory with
  a long name can not be created, despite a sufficient total number of
  free directory entries.

- Renaming a file can require more directory entries than currently
  allocated to store its long name, which may prevent an in-place
  update of the name if more entries are needed. This may cause a
  rename operation to fail if no contiguous range of free entries for
  the new name can be found.

- The volume label is stored in a directory entry. An empty FAT file
  system with a volume label will therefore show 1 used "inode" in
  df.

- The perceentage of free inodes shown in df or monitoring tools does
  only represent the state of the root directory of a FAT12 or FAT16
  file system. Neither does a reported value of 0% free inodes does
  prevent files from being created in sub-directories, nor does a
  value of 50% free inodes guarantee that even a single file with
  a "long" name can be created in the root directory (if every other
  directory entry is occupied and there are no 2 contiguous entries).

The statfs(2) and df(1) man pages have been updated with a notice
regarding the possibly different semantics of values reported as
total and free inodes for non-Unix file systems.

PR:		270053
Reported by:	Ben Woods <woodsb02@freebsd.org>
Approved by:	mckusick
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D38987
2023-03-29 08:46:01 +02:00
Dag-Erling Smørgrav c968598479 df: Return non-zero status on write failure.
While here, complete the libxo conversion and switch return value to standard constants.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential revision: https://reviews.freebsd.org/D38097
2023-01-17 16:25:28 +01:00
Baptiste Daroussin 2eee44bd5e df: do not report a 100% full inode usage on fs without inodes
Before:
devfs    2        2         0   100%       0          0  100%   /dev

After:
devfs    2        2         0   100%       0          0     -   /dev

The previous behaviour was confusing for end users and many monitoring tools

Note the linux df tools is also using the same syntax '-' for such filesystem

MFC After:		2 weeks
Reviewed by:		manu, emaste, imp
Differential Revision:	https://reviews.freebsd.org/D34515
2022-03-11 08:49:44 +01:00
Stefan Eßer f0fd4a32c4 bin/df: allow -t option to be used together with -l
The df command provides a -l option to exclude all non-local file
systems and a -t option with a (positive or negative) list of file
system types to display.

This commit adds support for a combination of -l and -t. If both are
specified, the parameter list of the -t option is applied on top of
the selection of öocal file systems (independently of the order of
the -l and -t options).

E.g., "df -t noprocfs,sysfs -l" will select all local file systems
except those of type procfs and sysfs.

PR:		260921
Approved by:	imp
Relnotes:	yes
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D33748
2022-02-10 21:09:34 +01:00
Mateusz Guzik 570b31f610 df: remove the unused fstype var
Found with cc --analyze

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-07-20 19:00:50 +02:00
Mateusz Piotrowski a0e85d0eb5 Remove the unnecessary space before the colon
MFC after:	3 days
2021-01-20 09:46:15 +01:00
Mark Johnston 1740c2dbb6 df: Remove support for mounting devices
This was marked deprecated in r329092, over two and a half years ago.
This functionality is also buggy per PR 237368.

PR:		237368
Reviewed by:	brooks, cem, emaste, imp
Differential Revision:	https://reviews.freebsd.org/D27197
2020-11-13 16:47:42 +00:00
Fernando Apesteguía ad3d2e7e4a df(1): Add EXAMPLES section to man page
* Add EXAMPLES section with four simple examples.
* Simplify -H flag description. This makes easy to see the difference between
  this flag and -h
* While here, fix .Tn deprecated macro.

Approved by:	manpages (bcr@)
Differential Revision:	https://reviews.freebsd.org/D26662
2020-10-05 13:39:37 +00:00
Brooks Davis e3e9432478 Add a deprecation warning when using the feature which mounts devices
to see how much space it on them.

Adjust MOUNT_CHAR_DEVS to allow the free space of already mounted
devices to be displayed and report an appropriate error if the
device isn't mounted.

Reviewed by:	cem
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8801
2018-02-10 00:22:25 +00:00
Pedro F. Giffuni 8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Bryan Drewery ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Kyle Evans d0bc27e435 df(1): Add --si as an alias for -H
Reviewed by:	cem (earlier version), emaste
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D11749
2017-08-09 01:24:52 +00:00
Phil Shafer dfde8e4b54 Use {T:Capacity} for header so html output looks tidy
Submitted by:	phil
Approved by:	sjg
2017-06-13 05:38:40 +00:00
Enji Cooper caf42d8126 bin: 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:31:08 +00:00
Warner Losh fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Brooks Davis facc3cb0ff Use nmount(2) rather than the obsolete mount(2).
Reviewed by:	cem
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8513
2016-12-14 21:30:44 +00:00
Brooks Davis 9dad1250d7 Mount filesystems without executable permissions since they should never
be used.

Reviewed by:	cem
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8513
2016-12-14 21:13:10 +00:00
Brooks Davis 176d3efd2b Put the undocumented df feature of mounting filesystems from device nodes
under an ifdef.  Leave enabled.

Reviewed by:	cem
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8513
2016-12-14 21:11:42 +00:00
Conrad Meyer 246ef54f15 df(1): Allow duplicate -l flags gracefully
Rather than producing a misleading error message when duplicate -l flags are
provided to df(1), simply ignore extra flags and proceed as if only one was
specified.  This seems most reasonable given the usage for -l:

     -l      Only display information about locally-mounted file systems.

l and t flags still conflict, as before.

PR:		208169
Reported by:	by at reorigin.com
Reviewed by:	allanjude
2016-08-31 18:10:41 +00:00
Glen Barber ac2875fa16 Explicitly add unmarked bin/ binaries to the runtime package.
Note: tcsh(1) has a MK_TCSH=no test, so this should be a separate
package, which requires pre-install/post-install scripts, to be
added later.

Sponsored by:	The FreeBSD Foundation
2016-02-09 16:58:50 +00:00
Craig Rodrigues 06691045ba Add more text to explain --libxo flag. 2015-12-01 19:18:53 +00:00
Xin LI d518359452 Use exit() instead of return in main().
MFC after:	2 weeks
2015-08-28 00:44:58 +00:00
Simon J. Gerraty ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty 44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty 98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Baptiste Daroussin 12cd1730ee Convert bin/ to LIBADD, reduce overlinking allow to build all components as
static
2014-11-25 11:15:40 +00:00
Simon J. Gerraty 488c975a1f Updated/new dependencies 2014-11-19 07:10:38 +00:00
Simon J. Gerraty 9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Marcel Moolenaar 6fea8dc88f Document that df(1) supports libxo(3). 2014-11-07 03:07:10 +00:00
Marcel Moolenaar b6ff8745aa Convert to use libxo.
Obtained from:  Phil Shafer <phil@juniper.net>
Sponsored by:   Juniper Networks, Inc.
2014-11-07 03:03:25 +00:00
Simon J. Gerraty fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty 76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty 3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Warren Block 3a97f8af0d -h and -H options backwards in manual page.
PR:		bin/183681 docs/183681
Submitted by:	Robin Hahling <robin.hahling@gw-computing.net>
MFC after:	3 days
2014-01-16 17:06:02 +00:00
Christian Brueffer b5a8b741f7 Clean up a spurious "." in SEE ALSO.
MFC after:	3 days
2013-10-28 23:02:12 +00:00
Simon J. Gerraty d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Greg Lehey c9e571fe9d Complete revision 243104. 2013-05-17 03:52:20 +00:00
Ulrich Spörlein e83643f4f6 Don't appease clang static analyzer after all and roll back
the free(3) of mntbuf ... again. There's no point in doing
useless extra work when we're about to exit.

See also r240565.

Not reading file history:	uqs
2013-04-26 12:27:30 +00:00
Ulrich Spörlein 11ed25f278 bin/df: Fix unitialized use in prtstat
While here:
- use NULL in the context of pointers
- use memset instead of bzero throughout the file
- free memory to appease clang static analyzer

Found by:	Coverity Scan (the UNINIT one)
2013-04-20 12:41:05 +00:00
Simon J. Gerraty 7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00