aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/quot
Commit message (Collapse)AuthorAgeFilesLines
* quot: Improve manual pageDag-Erling Smørgrav2025-11-141-1/+20
| | | | | | | | | | * Rewrite the first paragraph to clarify that quot(8) only supports FFS. * Document which options can or cannot be combined with each other. MFC after: 1 week Reviewed by: ziaee Differential Revision: https://reviews.freebsd.org/D53727
* quot: Rewrite -n mode input parserDag-Erling Smørgrav2025-11-143-23/+46
| | | | | | | | | | | | The existing parser was needlessly complicated and wildly inconsistent in how it handled invalid input. Rewrite using getline() and treat invalid input consistently: silently ignore lines that don't begin with a number, and print a warning if the inode number is out of range. PR: 290992 MFC after: 1 week Reviewed by: obrien Differential Revision: https://reviews.freebsd.org/D53726
* quot: Make nusers unsignedDag-Erling Smørgrav2025-10-201-14/+13
| | | | | | Fixes: 195b00ec45e5 ("quot: Clean up") Reviewed by: rlibby Differential Revision: https://reviews.freebsd.org/D53224
* quot: Add testsDag-Erling Smørgrav2025-10-174-7/+124
| | | | | | | | | | | To facilitate the task, we change the comparison function so that users with equal filesystem usage are sorted by UID, and add an undocumented option that prevents quot from replacing numerical UIDs with names. We also switch from getfsfile(3) to getmntpoint(3) so the first line is identical regardless of whether we pass quot a mountpoint or a device. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D53133
* quot: Drop the -h optionDag-Erling Smørgrav2025-10-172-37/+5
| | | | | | | | | There was probably a time, more than 30 years ago, when the actual size of a file had to be calculated and this option saved time, but all it does today is give incorrect results for no benefit. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D53132
* quot: Drop the COMPAT versionDag-Erling Smørgrav2025-10-171-54/+0
| | | | | | | | We've had this code for 30 years, but there has never been a way to build it. We have no idea if it still works, or if it ever worked. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D53131
* quot: Clean upDag-Erling Smørgrav2025-10-173-130/+106
| | | | | | | | | | | | | | | | * Fix numerous style violations. * Modernize somewhat. * Don't bother examining errno after calling get_inode(), as it always exits on error. * Fix confusing wording in the manual page. The code remains somewhat idiosyncratic, e.g. in its insistance on counting down rather than up in simple for loops, but in the absence of comprehensive automated tests, the risk of introducing bugs exceeds the benefit of rewriting these into more idiomatic forms. Reviewed by: obiwac Differential Revision: https://reviews.freebsd.org/D53130
* quot: Fix benign buffer overflowDag-Erling Smørgrav2025-10-171-6/+2
| | | | | | | | | | | | | | | If it encounters an inode whose owner does not have a pw entry, quot allocates a 7-byte buffer (8 in practice, since that is the minimum allocation size) and uses it to store the numeric uid preceded by a hash character. This will overflow the allocated buffer if the UID exceeds 6 decimal digits. Avoid this by using asprintf() instead. While here, simplify the common case as well using strdup(). Reported by: Igor Gabriel Sousa e Souza <igor@bsdtrust.com> MFC after: 3 days Reviewed by: obiwac, emaste Differential Revision: https://reviews.freebsd.org/D53129
* Standardize the definition of a UFS dinode.Kirk McKusick2025-01-281-4/+0
| | | | | | | | | | | | | | | | Each program that operates on UFS on-disk inodes defines its own version of a dinode. They all (of necessity) define the same layout but use different names. This change adds a definition of a dinode (a union of a UFS1 on-disk inode and a UFS2 on-disk inode) as well as a dinodep (a union of a pointer to a UFS1 on-disk inode and a pointer to a UFS2 on-disk inode) in sys/ufs/ufs/dinode.h. It then deletes the definitions of dinode and dinodep in all the programs that operate on them and instead uses these standard definitions. No functional change intended. MFC-after: 1 week
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* quot: Use getopt(3) and show usage() if no argumentsRicardo Branco2024-02-032-31/+36
| | | | | | | | Also update the man page and usage to be a little more accurate with the -a flag. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/983
* usr.sbin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-1/+1
|
* Add a flags parameter to the ffs_sbget() function that reads UFS superblocks.Kirk McKusick2022-07-311-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than trying to shoehorn flags into the requested superblock address, create a separate flags parameter to the ffs_sbget() function in sys/ufs/ffs/ffs_subr.c. The ffs_sbget() function is used both in the kernel and in user-level utilities through export to the sbget() function in the libufs(3) library (see sbget(3) for details). The kernel uses ffs_sbget() when mounting UFS filesystems, in the glabel(8) and gjournal(8) GEOM utilities, and in the standalone library used when booting the system from a UFS root filesystem. The ffs_sbget() function reads the superblock located at the byte offset specified by its sblockloc parameter. The value UFS_STDSB may be specified for sblockloc to request that the standard location for the superblock be read. The two existing options are now flags: UFS_NOHASHFAIL will note if the check hash is wrong but will still return the superblock. This is used by the bootstrap code to give the system a chance to come up so that fsck can be run to correct the problem. UFS_NOMSG indicates that superblock inconsistency error messages should not be printed. It is used by programs like fsck that want to print their own error message and programs like glabel(8) that just want to know if a UFS filesystem exists on a partition. One additional flag is added: UFS_NOCSUM causes only the superblock itself to be returned, but does not read in any auxiliary data structures like the cylinder group summary information. It is used by clients like glabel(8) that just want to check for possible filesystem types. Using UFS_NOCSUM skips the superblock checks for csum data which allows superblocks that have corrupted csum data to be read and used. The validate_sblock() function checks that the superblock has not been corrupted in a way that can crash or hang the system. Unless the UFS_NOMSG flag is specified, it will print out any errors that it finds. Prior to this commit, validate_sblock() returned as soon as it found an inconsistency so would print at most one message. It now does all its checks so when UFS_NOMSG has not been specified will print out everything that it finds inconsistent. Sponsored by: The FreeBSD Foundation
* Move the pointers stored in the superblock into a separateKirk McKusick2020-06-191-0/+3
| | | | | | | | | | | | | | | | | fs_summary_info structure. This change was originally done by the CheriBSD project as they need larger pointers that do not fit in the existing superblock. This cleanup of the superblock eases the task of the commit that immediately follows this one. Suggested by: brooks Reviewed by: kib PR: 246983 Sponsored by: Netflix Notes: svn path=/head/; revision=362358
* Normally when an attempt is made to mount a UFS/FFS filesystem whoseKirk McKusick2018-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=341608
* Revert r313780 (UFS_ prefix)Ed Maste2018-03-171-14/+13
| | | | Notes: svn path=/head/; revision=331095
* Prefix UFS symbols with UFS_ to reduce namespace pollutionEd Maste2018-03-171-13/+14
| | | | | | | | | | | | | Followup to r313780. Also prefix ext2's and nandfs's versions with EXT2_ and NANDFS_. Reported by: kib Reviewed by: kib, mckusick Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D9623 Notes: svn path=/head/; revision=331083
* Refactoring of reading and writing of the UFS/FFS superblock.Kirk McKusick2018-01-262-26/+12
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=328426
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. 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. No functional change intended. Notes: svn path=/head/; revision=326276
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* prefix UFS symbols with UFS_ to reduce namespace pollutionEd Maste2017-02-151-3/+3
| | | | | | | | | | | | | | | | | | | | | Specifically: ROOTINO -> UFS_ROOTINO WINO -> UFS_WINO NXADDR -> UFS_NXADDR NDADDR -> UFS_NDADDR NIADDR -> UFS_NIADDR MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency) Also prefix ext2's and nandfs's NDADDR and NIADDR with EXT2_ and NANDFS_ Reviewed by: kib, mckusick Obtained from: NetBSD MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D9536 Notes: svn path=/head/; revision=313780
* quot: make use of our rounddown() macro when <sys/param.h> is available.Pedro F. Giffuni2016-05-021-2/+2
| | | | | | | No functional change. Notes: svn path=/head/; revision=298913
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * Sync from headSimon J. Gerraty2012-11-041-3/+3
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=242545
| * Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+19
| | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | Fix usr.bin/ and usr.sbin/ build with a 64-bit ino_t.Matthew D Fleming2012-09-271-3/+3
|/ | | | | | | Original code by: Gleb Kurtsou Notes: svn path=/head/; revision=241015
* The dump, fsck_ffs, fsdb, fsirand, newfs, makefs, and quot utilitiesKirk McKusick2011-01-241-1/+1
| | | | | | | | | | | | | | | | | include sys/time.h instead of time.h. This include is incorrect as per the manpages for the APIs and the POSIX definitions. This commit replaces sys/time.h where necessary with time.h. The commit also includes some minor style(9) header fixup in newfs. This commit is part of a larger effort by Garrett Cooper started in //depot/user/gcooper/posix-conformance-work/ -- to make FreeBSD more POSIX compliant. Submitted by: Garrett Cooper yanegomi at gmail dot com Notes: svn path=/head/; revision=217769
* Make `quot -a' work when we've got slashes in the device name.Ed Schouten2008-09-141-10/+2
| | | | | | | | | | | | | | | | A very long time ago we had raw device nodes. quot(8) was supposed to use these when running `quot -a'. For some reason the code got once changed to strip the device name until it reaches the last slash. This is not reliable, because this means /dev/mirror/foo will be stripped to /dev/foo. This bug also exists on RELENG_7 and RELENG_6, but I think I'll just merge them back somewhere after the upcoming releases. There's no rush. MFC after: 2 months Notes: svn path=/head/; revision=183018
* Drag this code kicking and screaming into the twenty-first century.Dag-Erling Smørgrav2008-07-021-75/+51
| | | | Notes: svn path=/head/; revision=180187
* o Check we have a non-NULL pointer to a super block before dereference it.Maxim Konovalov2006-09-301-1/+1
| | | | | | | | | PR: misc/103822 Submitted by: Dmitry Stefankov MFC after: 2 weeks Notes: svn path=/head/; revision=162831
* The quot command expected all inodes contents to be valid, howeverDavid Malone2006-02-251-3/+31
| | | | | | | | | | | | | | | | | | | | on UFS2 inodes are initialised as they are needed, rather than at newfs time. When quot encountered these inodes it could produce crazy results. Now, on UFS2 filesystems, quot's get_inode function will bzero unallicated inodes before passing them back to a caller. This is how UFS2 initialises new inodes, so this should work OK. Also, while I'm here, make quot exit with an error if it finds inodes of an unknown type. This should help catch future problems of this type. Reviewed by: iedowse MFC after: 1 week Notes: svn path=/head/; revision=156015
* Remove unused variables.Stefan Farfeleder2005-04-091-3/+1
| | | | Notes: svn path=/head/; revision=144841
* Sort sections.Ruslan Ermilov2005-01-181-7/+7
| | | | Notes: svn path=/head/; revision=140442
* Mechanically kill hard sentence breaks.Ruslan Ermilov2004-07-021-1/+2
| | | | Notes: svn path=/head/; revision=131500
* Use __FBSDID over rcsid[]. Protect copyright[] where needed.David E. O'Brien2003-05-031-4/+2
| | | | Notes: svn path=/head/; revision=114601
* Repair the UFS2 superblock location consistency check so that it succeedsTim J. Robbins2003-04-251-1/+1
| | | | | | | | | | on valid superblocks instead of issuing the error "not a BSD filesystem". fs_sblockloc is a byte offset, not a fragment number. This change makes quot work properly on UFS2 filesystems, which is important now that UFS2 is the default. Notes: svn path=/head/; revision=114009
* style.Makefile(5)David E. O'Brien2003-04-041-1/+2
| | | | Notes: svn path=/head/; revision=113091
* Remove contractions.Tom Rhodes2003-02-181-3/+3
| | | | | | | Use `Force' in place of `Cause' which sounds better. Notes: svn path=/head/; revision=111067
* Back out rev 1.19; getbsize(3)'s original interface has been restored.Mike Barcroft2002-12-301-1/+1
| | | | Notes: svn path=/head/; revision=108458
* Uniformly refer to a file system as "file system".Ruslan Ermilov2002-12-121-1/+1
| | | | | | | Approved by: re Notes: svn path=/head/; revision=107788
* another int * to size_t * change for getbsize() to make it compileAndrew Gallatin2002-10-241-1/+1
| | | | | | | on LP64 hosts Notes: svn path=/head/; revision=105883