Commit Graph

64 Commits

Author SHA1 Message Date
dholland 4ce2ad59b6 Grr. The ATF quota tests demand failing silently in certain circumstances.
For netbsd-6 we will just have to go with the flow, as I'm not touching
anything outside edquota tonight.
2012-08-14 04:53:43 +00:00
dholland c9817be0c7 three more minor fixes. 2012-08-14 04:48:42 +00:00
dholland 40b0b3a839 Make editor-based edquota work again.
The format is somewhat different; I'm operating under the assumption
that nobody has automated editing scripts for the old format because
it's much easier just to use the command-line interface of
edquota. The new format is more scalable and more parseable.

Also, do a better job of diagnosing editing errors, and don't blindly
erase all quota information for the user being edited when a parse
error occurs after editing.
2012-08-14 03:55:48 +00:00
dholland b743f28223 Bail out early if none of the mounted volumes support quotas. Avoids a
null print in interactive use.
2012-08-13 23:08:58 +00:00
dholland e8ef0182c9 Minor cleanup: use bitfields instead of a flags word for private state
flags, remove now-unused qfname field.
2012-08-13 22:21:05 +00:00
christos 5727fadda2 use getfsspecname() 2012-04-07 04:52:20 +00:00
dholland 7da608ca9c Update dangling references to quotactl(2), mostly now libquota(3), and to
quotactl(8), mostly now quotarestore(8). ok riz@
2012-02-13 19:53:24 +00:00
dholland a577f74f5b libquota no longer requires libprop. Also remove some other no-longer-used
.PATH'd-in bits from repquota.
2012-02-01 17:53:01 +00:00
dholland 3e2a4d1109 Remove dependence on quotaprop.h, also quotautil.c (no longer used).
Like repquota, compile in the number of object types for now because
making it support an arbitrary number would take some hacking.
2012-01-30 19:19:20 +00:00
dholland 6a92ecbca0 Rely on libquota for fallback to direct access of old-style quota files.
Keep the code around in #if 0 blocks for now, just in case some of the
logic might turn out to be wanted in libquota.
2012-01-30 19:18:36 +00:00
dholland 9aec0f661d Remove references to -D option. 2012-01-30 19:17:29 +00:00
dholland eba182257f Don't use the old getvfsquota() here. 2012-01-30 19:16:36 +00:00
dholland f0f8fe3be2 Rename static inline "helper" functions:
ufsclass2qtype -> quota_idtype_to_ufs
   qtype2ufsclass -> quota_idtype_from_ufs

The reason for the direction of "ufs" changing is that the old names
were among the symbols using "ufs" to mean "fs-independent". So the
old names were for translating "ufsclass" (fs-independent quota id
type) to "qtype" (ufs-specific quota id type) and vice versa.

These functions are used in only two places, both of which are
inappropriate, so at some point they should probably be removed.
They're also identity transformations so not particularly helpful,
unless one were to make a careful and concerted effort to distinguish
the ufs quota code numbers from the fs-independent ones. This has not
been done and is probably impossible without support from a program
verifier, and maybe not even then.

They are static inline, so no compat concerns arise.

Also adjust the symbols they use to avoid <quota/quotaprop.h>.
2012-01-29 07:16:00 +00:00
dholland 7950da9e90 Change dqblk_to_quotaval() from quota1_subr.c to dqblk_to_quotavals(),
and pass in two single quotaval structs (for blocks and inodes)
instead of an array of (implicitly) QUOTA_NLIMITS quotaval structs
indexed by constants from quotaprop.h.

Note: because this code is used by COMPAT_50 as well as ufs, this
change requires a kernel version bump. (The code is also used by
edquota, but via .PATH so it's not ABI-sensitive there.)
2012-01-29 06:23:20 +00:00
dholland 1d7acc6b80 "quotaclass" -> "idtype". After lengthy wrangling on the mailing lists
the best conclusion for naming was to give up on "classes" and "types"
and use "idtype" for users vs. groups and "objtype" for blocks vs. files.
2012-01-09 15:44:42 +00:00
dholland e5303f01df Use quota_put() and quota_delete() to update quotas instead of making
quota proplib RPCs.
2012-01-09 15:44:05 +00:00
dholland 51d1d7e7c4 Rename struct ufs_quota_entry -> struct quotaval. 2011-11-25 16:55:05 +00:00
dholland 78108b8ccc Split up excessively large main().
Fix -d behavior to match documentation.
2011-11-13 15:42:35 +00:00
dholland 26b9d6b1f1 Cleanup for edquota.
Factor out common malloc and linked list code. Distinguish lists of
quota info from single records.
2011-11-13 15:41:34 +00:00
jym afca4e3b49 Fix an implementation inconsistency with the prop_*_send_syscall() and
prop_*_recv_syscall() functions from proplib(3). They now share the
same logic as the one from prop_*_send_ioctl() functions:
- returns an int
- 0 indicates "no error", otherwise returns the error number (and
set errno)

Many consumers of the prop_*_{ioctl, syscall} expect errno to be set
on error and use err() to display the error message. As such, ensures that
errno gets set before returning from these functions.

prop_*_send_syscall() functions returned a boolean, and now return an int.
Fix all call sites to use the new paradigm (only quota2 is affected in src).

As the prop_*_{send,recv}_syscall() API appeared in -current and is only
used by the recent quota2 code, I am not bumping the lib. The API change
only affects the prop_*_send_syscall() function (recv_syscall()s were
already used correctly), so ensure you are not mixing "old" -current
quota binaries with a new proplib(3) (or the other way around). This
change will be announced via a HEADS-UP and UPDATING.

Does not affect the kernel part of proplib.

Document the correct API in prop_array(3) and prop_dictionary(3).

Thanks to Francois Tigeot for noticing the API inconsistency and
reporting it on tech-kern@.

ok bouyer@.
2011-09-30 22:08:18 +00:00
dholland 2a4f285a6d Minor cosmetic fixes, no semantic changes. (object file diffs have been
checked)
2011-07-10 07:54:49 +00:00
dholland edda69b9c3 tsort contents of file. 2011-07-10 07:31:48 +00:00
dholland a958ceefc8 use __dead 2011-07-10 07:19:24 +00:00
bouyer d9210c2405 Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
2011-03-24 17:05:39 +00:00
christos 3f339fb13b - KNF
- merge code
- fix error printing
- don't use static buffers
2011-03-06 22:33:55 +00:00
wiz ee43c34a26 Split "file system" like usual. Improve SYNOPSIS. Various other fixes. 2011-03-06 17:32:38 +00:00
bouyer 063f96f3c2 merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
2011-03-06 17:08:10 +00:00
lukem 9c1945664c Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 13:36:57 +00:00
xtraeme b2bb69490d WARNS=4 love. 2008-05-02 19:59:19 +00:00
jnemeth 62381dbddf Coverity CID 3785: calling fclose() twice on same file pointer
Coverity CID 3780: dereference of NULL pointer
Approved by: christos@
2006-05-26 13:21:47 +00:00
christos ae76bda7d7 Coverity CID 3227, 3226: Don't leak fd's 2006-05-23 01:23:49 +00:00
jmmv b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
agc 326b2259b7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22366, verified by myself.
2003-08-07 11:25:11 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
wiz 69ffc10a99 Switch soft and hard, per PR 20135. 2003-01-31 12:53:32 +00:00
jonb e2fdabc65c Fix the way $EDITOR is started so the variable can have flags in addition
to the name of the binary to run.
2002-12-05 22:54:45 +00:00
bouyer fecc966e36 Add new command-line flags, which ease edquota use in bach scripts:
- -f, which allows to restrict edquota to only one quota-enabled filesystem
- -s and -h, which allows to set soft and hard limits respectively, without
  the need to edit a file.
2002-12-04 21:01:13 +00:00
wiz 51d5c7d6bd Whitespace nit, sort sections. 2002-01-19 03:11:34 +00:00
simonb fd4ede242b Don't declare 'extern opt*' getopt variables. 2000-04-14 06:26:52 +00:00
mycroft f5d7100e26 Nuke `extern int errno;' in code we compile with -Wstrict-prototypes. We get
the correct definition from errno.h.
2000-01-21 17:08:33 +00:00
bouyer 7616130d51 Explicitely cast to (u_quad_t) calls to btodb() and dbtob() to avoid
int overflow. It's now possible to add/display quotas of more than
4G.
XXX I'm sure there is a PR open on this but I couln't find it with the
usual search engines. If someone knows it's number ...
1999-12-16 17:29:52 +00:00
simonb 299578ebd5 Spell "privilege" correctly (correct spelling from Jonathan Stone). 1999-08-16 02:59:22 +00:00
mrg eae61447e8 remove unused extern. 1998-03-30 03:33:05 +00:00
mrg 6b8ca7ecc6 fix compile warning on the sparc (erik fair). 1997-10-21 06:40:40 +00:00
lukem 699d25a64e WARNSify, deprecate bcmp/perror et al in favour of memcmp/err* et al 1997-10-17 02:25:02 +00:00
kleink 66105c37fc Lseek(2) usage cleanup: the use of L_SET/L_INCR/L_XTND is deprecated,
use SEEK_SET/SEEK_CUR/SEEK_END instead.
1997-08-25 19:31:43 +00:00
cgd c917dfb5b2 Fix broken uses of Dd. Both the mdoc and mdoc.samples pages agree:
.Dd is supposed to be invoked like:
	.Dd month day, year
e.g. ".Dd January 25, 1989", rather than:
	.Dd "month day, year"
which is what these pages did.
1997-05-29 01:48:05 +00:00
mikel 3190ec8ac6 prototype internal functions so this will build 1997-03-08 21:39:06 +00:00
mikel ba2d9f692b merge lite-2 changes.
also RCSid police, and add return types to all of the functions.
1997-03-08 08:01:26 +00:00
mark 1fe734c654 Use an integer instead of a char to store the getopt() return value in
order to work with compilers that default to unsigned chars.
Compare the getopt() return value with -1 instead of EOF.
1996-03-30 23:42:33 +00:00