Sun Jan 29 07:16:01 2012 UTC ()
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>.


(dholland)
diff -r1.12 -r1.13 src/sys/compat/common/vfs_syscalls_50.c
diff -r1.28 -r1.29 src/sys/ufs/ufs/quota.h
diff -r1.42 -r1.43 src/usr.sbin/edquota/edquota.c

cvs diff -r1.12 -r1.13 src/sys/compat/common/vfs_syscalls_50.c (expand / switch to unified diff)

--- src/sys/compat/common/vfs_syscalls_50.c 2012/01/29 06:29:04 1.12
+++ src/sys/compat/common/vfs_syscalls_50.c 2012/01/29 07:16:00 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vfs_syscalls_50.c,v 1.12 2012/01/29 06:29:04 dholland Exp $ */ 1/* $NetBSD: vfs_syscalls_50.c,v 1.13 2012/01/29 07:16:00 dholland Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas. 8 * by Christos Zoulas.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
37 */ 37 */
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.12 2012/01/29 06:29:04 dholland Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.13 2012/01/29 07:16:00 dholland Exp $");
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/namei.h> 43#include <sys/namei.h>
44#include <sys/filedesc.h> 44#include <sys/filedesc.h>
45#include <sys/kernel.h> 45#include <sys/kernel.h>
46#include <sys/file.h> 46#include <sys/file.h>
47#include <sys/stat.h> 47#include <sys/stat.h>
48#include <sys/socketvar.h> 48#include <sys/socketvar.h>
49#include <sys/vnode.h> 49#include <sys/vnode.h>
50#include <sys/mount.h> 50#include <sys/mount.h>
51#include <sys/proc.h> 51#include <sys/proc.h>
52#include <sys/uio.h> 52#include <sys/uio.h>
@@ -328,26 +328,27 @@ compat_50_sys_quotactl(struct lwp *l, co @@ -328,26 +328,27 @@ compat_50_sys_quotactl(struct lwp *l, co
328 syscallarg(void *) arg;  328 syscallarg(void *) arg;
329 } */ 329 } */
330 struct mount *mp; 330 struct mount *mp;
331 int error; 331 int error;
332 uint8_t error8; 332 uint8_t error8;
333 struct vnode *vp; 333 struct vnode *vp;
334 int q1cmd = SCARG(uap, cmd); 334 int q1cmd = SCARG(uap, cmd);
335 prop_dictionary_t dict, data, cmd; 335 prop_dictionary_t dict, data, cmd;
336 prop_array_t cmds, datas; 336 prop_array_t cmds, datas;
337 char *bufpath; 337 char *bufpath;
338 struct dqblk dqblk; 338 struct dqblk dqblk;
339 struct quotaval qv[QUOTA_NLIMITS]; 339 struct quotaval qv[QUOTA_NLIMITS];
340 uint64_t *values[QUOTA_NLIMITS]; 340 uint64_t *values[QUOTA_NLIMITS];
 341 int idtype;
341 342
342 values[QUOTA_LIMIT_BLOCK] = &qv[QUOTA_LIMIT_BLOCK].qv_hardlimit; 343 values[QUOTA_LIMIT_BLOCK] = &qv[QUOTA_LIMIT_BLOCK].qv_hardlimit;
343 values[QUOTA_LIMIT_FILE] = &qv[QUOTA_LIMIT_FILE].qv_hardlimit; 344 values[QUOTA_LIMIT_FILE] = &qv[QUOTA_LIMIT_FILE].qv_hardlimit;
344 345
345 error = namei_simple_user(SCARG(uap, path), 346 error = namei_simple_user(SCARG(uap, path),
346 NSM_FOLLOW_TRYEMULROOT, &vp); 347 NSM_FOLLOW_TRYEMULROOT, &vp);
347 if (error != 0) 348 if (error != 0)
348 return (error);  349 return (error);
349 error = ENOMEM; 350 error = ENOMEM;
350 mp = vp->v_mount; 351 mp = vp->v_mount;
351 if ((dict = quota_prop_create()) == NULL) 352 if ((dict = quota_prop_create()) == NULL)
352 goto out; 353 goto out;
353 if ((cmds = prop_array_create()) == NULL) 354 if ((cmds = prop_array_create()) == NULL)
@@ -366,36 +367,38 @@ compat_50_sys_quotactl(struct lwp *l, co @@ -366,36 +367,38 @@ compat_50_sys_quotactl(struct lwp *l, co
366 error = copyinstr(SCARG(uap, arg), bufpath, PATH_MAX, NULL); 367 error = copyinstr(SCARG(uap, arg), bufpath, PATH_MAX, NULL);
367 if (error != 0) { 368 if (error != 0) {
368 free(bufpath, M_TEMP); 369 free(bufpath, M_TEMP);
369 goto out_data; 370 goto out_data;
370 } 371 }
371 if (!prop_dictionary_set_cstring(data, "quotafile", bufpath)) 372 if (!prop_dictionary_set_cstring(data, "quotafile", bufpath))
372 error = ENOMEM; 373 error = ENOMEM;
373 free(bufpath, M_TEMP); 374 free(bufpath, M_TEMP);
374 if (error) 375 if (error)
375 goto out_data; 376 goto out_data;
376 error = ENOMEM; 377 error = ENOMEM;
377 if (!prop_array_add_and_rel(datas, data)) 378 if (!prop_array_add_and_rel(datas, data))
378 goto out_datas; 379 goto out_datas;
 380 idtype = quota_idtype_from_ufs(q1cmd & SUBCMDMASK);
379 if (!quota_prop_add_command(cmds, "quotaon", 381 if (!quota_prop_add_command(cmds, "quotaon",
380 ufs_quota_class_names[qtype2ufsclass(q1cmd & SUBCMDMASK)], 382 ufs_quota_class_names[idtype],
381 datas)) 383 datas))
382 goto out_cmds; 384 goto out_cmds;
383 goto do_quotaonoff; 385 goto do_quotaonoff;
384 386
385 case Q_QUOTAOFF: 387 case Q_QUOTAOFF:
386 error = ENOMEM; 388 error = ENOMEM;
 389 idtype = quota_idtype_from_ufs(q1cmd & SUBCMDMASK);
387 if (!quota_prop_add_command(cmds, "quotaoff", 390 if (!quota_prop_add_command(cmds, "quotaoff",
388 ufs_quota_class_names[qtype2ufsclass(q1cmd & SUBCMDMASK)], 391 ufs_quota_class_names[idtype],
389 datas)) 392 datas))
390 goto out_cmds; 393 goto out_cmds;
391do_quotaonoff: 394do_quotaonoff:
392 if (!prop_dictionary_set_and_rel(dict, "commands", cmds)) 395 if (!prop_dictionary_set_and_rel(dict, "commands", cmds))
393 goto out_dict; 396 goto out_dict;
394 error = vfs_quotactl(mp, dict); 397 error = vfs_quotactl(mp, dict);
395 if (error) 398 if (error)
396 goto out_dict; 399 goto out_dict;
397 if ((error = quota_get_cmds(dict, &cmds)) != 0) 400 if ((error = quota_get_cmds(dict, &cmds)) != 0)
398 goto out_dict; 401 goto out_dict;
399 cmd = prop_array_get(cmds, 0); 402 cmd = prop_array_get(cmds, 0);
400 if (cmd == NULL) { 403 if (cmd == NULL) {
401 error = EINVAL; 404 error = EINVAL;
@@ -407,28 +410,29 @@ do_quotaonoff: @@ -407,28 +410,29 @@ do_quotaonoff:
407 } 410 }
408 error = error8; 411 error = error8;
409 goto out_dict; 412 goto out_dict;
410 413
411 case Q_GETQUOTA: 414 case Q_GETQUOTA:
412 error = ENOMEM; 415 error = ENOMEM;
413 data = prop_dictionary_create(); 416 data = prop_dictionary_create();
414 if (data == NULL) 417 if (data == NULL)
415 goto out_datas; 418 goto out_datas;
416 if (!prop_dictionary_set_uint32(data, "id", SCARG(uap, uid))) 419 if (!prop_dictionary_set_uint32(data, "id", SCARG(uap, uid)))
417 goto out_data; 420 goto out_data;
418 if (!prop_array_add_and_rel(datas, data)) 421 if (!prop_array_add_and_rel(datas, data))
419 goto out_datas; 422 goto out_datas;
 423 idtype = quota_idtype_from_ufs(q1cmd & SUBCMDMASK);
420 if (!quota_prop_add_command(cmds, "get", 424 if (!quota_prop_add_command(cmds, "get",
421 ufs_quota_class_names[qtype2ufsclass(q1cmd & SUBCMDMASK)], 425 ufs_quota_class_names[idtype],
422 datas)) 426 datas))
423 goto out_cmds; 427 goto out_cmds;
424 if (!prop_dictionary_set_and_rel(dict, "commands", cmds)) 428 if (!prop_dictionary_set_and_rel(dict, "commands", cmds))
425 goto out_dict; 429 goto out_dict;
426 error = vfs_quotactl(mp, dict); 430 error = vfs_quotactl(mp, dict);
427 if (error) 431 if (error)
428 goto out_dict; 432 goto out_dict;
429 if ((error = quota_get_cmds(dict, &cmds)) != 0) 433 if ((error = quota_get_cmds(dict, &cmds)) != 0)
430 goto out_dict; 434 goto out_dict;
431 cmd = prop_array_get(cmds, 0); 435 cmd = prop_array_get(cmds, 0);
432 if (cmd == NULL) { 436 if (cmd == NULL) {
433 error = EINVAL; 437 error = EINVAL;
434 goto out_dict; 438 goto out_dict;
@@ -463,28 +467,29 @@ do_quotaonoff: @@ -463,28 +467,29 @@ do_quotaonoff:
463 if (error) 467 if (error)
464 goto out_datas; 468 goto out_datas;
465 dqblk_to_quotavals(&dqblk, &qv[QUOTA_LIMIT_BLOCK], 469 dqblk_to_quotavals(&dqblk, &qv[QUOTA_LIMIT_BLOCK],
466 &qv[QUOTA_LIMIT_FILE]); 470 &qv[QUOTA_LIMIT_FILE]);
467 471
468 error = ENOMEM; 472 error = ENOMEM;
469 data = quota64toprop(SCARG(uap, uid), 0, values, 473 data = quota64toprop(SCARG(uap, uid), 0, values,
470 ufs_quota_entry_names, UFS_QUOTA_NENTRIES, 474 ufs_quota_entry_names, UFS_QUOTA_NENTRIES,
471 ufs_quota_limit_names, QUOTA_NLIMITS); 475 ufs_quota_limit_names, QUOTA_NLIMITS);
472 if (data == NULL) 476 if (data == NULL)
473 goto out_data; 477 goto out_data;
474 if (!prop_array_add_and_rel(datas, data)) 478 if (!prop_array_add_and_rel(datas, data))
475 goto out_datas; 479 goto out_datas;
 480 idtype = quota_idtype_from_ufs(q1cmd & SUBCMDMASK);
476 if (!quota_prop_add_command(cmds, "set", 481 if (!quota_prop_add_command(cmds, "set",
477 ufs_quota_class_names[qtype2ufsclass(q1cmd & SUBCMDMASK)], 482 ufs_quota_class_names[idtype],
478 datas)) 483 datas))
479 goto out_cmds; 484 goto out_cmds;
480 if (!prop_dictionary_set_and_rel(dict, "commands", cmds)) 485 if (!prop_dictionary_set_and_rel(dict, "commands", cmds))
481 goto out_dict; 486 goto out_dict;
482 error = vfs_quotactl(mp, dict); 487 error = vfs_quotactl(mp, dict);
483 if (error) 488 if (error)
484 goto out_dict; 489 goto out_dict;
485 if ((error = quota_get_cmds(dict, &cmds)) != 0) 490 if ((error = quota_get_cmds(dict, &cmds)) != 0)
486 goto out_dict; 491 goto out_dict;
487 cmd = prop_array_get(cmds, 0); 492 cmd = prop_array_get(cmds, 0);
488 if (cmd == NULL) { 493 if (cmd == NULL) {
489 error = EINVAL; 494 error = EINVAL;
490 goto out_dict; 495 goto out_dict;
@@ -492,28 +497,29 @@ do_quotaonoff: @@ -492,28 +497,29 @@ do_quotaonoff:
492 if (!prop_dictionary_get_int8(cmd, "return", &error8)) { 497 if (!prop_dictionary_get_int8(cmd, "return", &error8)) {
493 error = EINVAL; 498 error = EINVAL;
494 goto out_dict; 499 goto out_dict;
495 } 500 }
496 error = error8; 501 error = error8;
497 goto out_dict; 502 goto out_dict;
498  503
499 case Q_SYNC: 504 case Q_SYNC:
500 /* 505 /*
501 * not supported but used only to see if quota is supported, 506 * not supported but used only to see if quota is supported,
502 * emulate with a "get version" 507 * emulate with a "get version"
503 */ 508 */
504 error = ENOMEM; 509 error = ENOMEM;
 510 idtype = quota_idtype_from_ufs(q1cmd & SUBCMDMASK);
505 if (!quota_prop_add_command(cmds, "get version", 511 if (!quota_prop_add_command(cmds, "get version",
506 ufs_quota_class_names[qtype2ufsclass(q1cmd & SUBCMDMASK)], 512 ufs_quota_class_names[idtype],
507 datas)) 513 datas))
508 goto out_cmds; 514 goto out_cmds;
509 if (!prop_dictionary_set_and_rel(dict, "commands", cmds)) 515 if (!prop_dictionary_set_and_rel(dict, "commands", cmds))
510 goto out_dict; 516 goto out_dict;
511 error = vfs_quotactl(mp, dict); 517 error = vfs_quotactl(mp, dict);
512 if (error) 518 if (error)
513 goto out_dict; 519 goto out_dict;
514 if ((error = quota_get_cmds(dict, &cmds)) != 0) 520 if ((error = quota_get_cmds(dict, &cmds)) != 0)
515 goto out_dict; 521 goto out_dict;
516 cmd = prop_array_get(cmds, 0); 522 cmd = prop_array_get(cmds, 0);
517 if (cmd == NULL) { 523 if (cmd == NULL) {
518 error = EINVAL; 524 error = EINVAL;
519 goto out_dict; 525 goto out_dict;

cvs diff -r1.28 -r1.29 src/sys/ufs/ufs/quota.h (expand / switch to unified diff)

--- src/sys/ufs/ufs/quota.h 2011/03/25 10:25:17 1.28
+++ src/sys/ufs/ufs/quota.h 2012/01/29 07:16:00 1.29
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: quota.h,v 1.28 2011/03/25 10:25:17 bouyer Exp $ */ 1/* $NetBSD: quota.h,v 1.29 2012/01/29 07:16:00 dholland Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1982, 1986, 1993 4 * Copyright (c) 1982, 1986, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Robert Elz at The University of Melbourne. 8 * Robert Elz at The University of Melbourne.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -45,48 +45,48 @@ @@ -45,48 +45,48 @@
45/* 45/*
46 * The following constants define the usage of the quota file array in the 46 * The following constants define the usage of the quota file array in the
47 * ufsmount structure and dquot array in the inode structure. The semantics 47 * ufsmount structure and dquot array in the inode structure. The semantics
48 * of the elements of these arrays are defined in the routine getinoquota; 48 * of the elements of these arrays are defined in the routine getinoquota;
49 * the remainder of the quota code treats them generically and need not be 49 * the remainder of the quota code treats them generically and need not be
50 * inspected when changing the size of the array. 50 * inspected when changing the size of the array.
51 */ 51 */
52#define MAXQUOTAS 2 52#define MAXQUOTAS 2
53#define USRQUOTA 0 /* element used for user quotas */ 53#define USRQUOTA 0 /* element used for user quotas */
54#define GRPQUOTA 1 /* element used for group quotas */ 54#define GRPQUOTA 1 /* element used for group quotas */
55 55
56 56
57#if !defined(HAVE_NBTOOL_CONFIG_H) 57#if !defined(HAVE_NBTOOL_CONFIG_H)
58#include <quota/quotaprop.h> 58#include <sys/quota.h>
59__inline static int __unused 59__inline static int __unused
60ufsclass2qtype(int class) 60quota_idtype_to_ufs(int idtype)
61{ 61{
62 switch(class) { 62 switch (idtype) {
63 case QUOTA_CLASS_USER: 63 case QUOTA_IDTYPE_USER:
64 return USRQUOTA; 64 return USRQUOTA;
65 case QUOTA_CLASS_GROUP: 65 case QUOTA_IDTYPE_GROUP:
66 return GRPQUOTA; 66 return GRPQUOTA;
67 default: 67 default:
68 return -1; 68 return -1;
69 } 69 }
70} 70}
71 71
72static __inline int __unused 72static __inline int __unused
73qtype2ufsclass(int type) 73quota_idtype_from_ufs(int ufstype)
74{ 74{
75 switch(type) { 75 switch (ufstype) {
76 case USRQUOTA: 76 case USRQUOTA:
77 return QUOTA_CLASS_USER; 77 return QUOTA_IDTYPE_USER;
78 case GRPQUOTA: 78 case GRPQUOTA:
79 return QUOTA_CLASS_GROUP; 79 return QUOTA_IDTYPE_GROUP;
80 default: 80 default:
81 return -1; 81 return -1;
82 } 82 }
83} 83}
84#endif /* !defined(HAVE_NBTOOL_CONFIG_H) */ 84#endif /* !defined(HAVE_NBTOOL_CONFIG_H) */
85 85
86#ifdef _KERNEL 86#ifdef _KERNEL
87 87
88#include <sys/cdefs.h> 88#include <sys/cdefs.h>
89 89
90__BEGIN_DECLS 90__BEGIN_DECLS
91void dqinit(void); 91void dqinit(void);
92void dqreinit(void); 92void dqreinit(void);

cvs diff -r1.42 -r1.43 src/usr.sbin/edquota/edquota.c (expand / switch to unified diff)

--- src/usr.sbin/edquota/edquota.c 2012/01/29 06:23:20 1.42
+++ src/usr.sbin/edquota/edquota.c 2012/01/29 07:16:00 1.43
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: edquota.c,v 1.42 2012/01/29 06:23:20 dholland Exp $ */ 1/* $NetBSD: edquota.c,v 1.43 2012/01/29 07:16:00 dholland Exp $ */
2/* 2/*
3 * Copyright (c) 1980, 1990, 1993 3 * Copyright (c) 1980, 1990, 1993
4 * The Regents of the University of California. All rights reserved. 4 * The Regents of the University of California. All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to Berkeley by 6 * This code is derived from software contributed to Berkeley by
7 * Robert Elz at The University of Melbourne. 7 * Robert Elz at The University of Melbourne.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -31,27 +31,27 @@ @@ -31,27 +31,27 @@
31 * SUCH DAMAGE. 31 * SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35#ifndef lint 35#ifndef lint
36__COPYRIGHT("@(#) Copyright (c) 1980, 1990, 1993\ 36__COPYRIGHT("@(#) Copyright (c) 1980, 1990, 1993\
37 The Regents of the University of California. All rights reserved."); 37 The Regents of the University of California. All rights reserved.");
38#endif /* not lint */ 38#endif /* not lint */
39 39
40#ifndef lint 40#ifndef lint
41#if 0 41#if 0
42static char sccsid[] = "from: @(#)edquota.c 8.3 (Berkeley) 4/27/95"; 42static char sccsid[] = "from: @(#)edquota.c 8.3 (Berkeley) 4/27/95";
43#else 43#else
44__RCSID("$NetBSD: edquota.c,v 1.42 2012/01/29 06:23:20 dholland Exp $"); 44__RCSID("$NetBSD: edquota.c,v 1.43 2012/01/29 07:16:00 dholland Exp $");
45#endif 45#endif
46#endif /* not lint */ 46#endif /* not lint */
47 47
48/* 48/*
49 * Disk quota editor. 49 * Disk quota editor.
50 */ 50 */
51#include <sys/param.h> 51#include <sys/param.h>
52#include <sys/stat.h> 52#include <sys/stat.h>
53#include <sys/file.h> 53#include <sys/file.h>
54#include <sys/wait.h> 54#include <sys/wait.h>
55#include <sys/queue.h> 55#include <sys/queue.h>
56#include <sys/types.h> 56#include <sys/types.h>
57#include <sys/statvfs.h> 57#include <sys/statvfs.h>
@@ -278,27 +278,27 @@ getprivs1(long id, int idtype, const cha @@ -278,27 +278,27 @@ getprivs1(long id, int idtype, const cha
278 278
279 setfsent(); 279 setfsent();
280 while ((fs = getfsent()) != NULL) { 280 while ((fs = getfsent()) != NULL) {
281 if (strcmp(fs->fs_vfstype, "ffs")) 281 if (strcmp(fs->fs_vfstype, "ffs"))
282 continue; 282 continue;
283 if (strcmp(fs->fs_spec, filesys) == 0 || 283 if (strcmp(fs->fs_spec, filesys) == 0 ||
284 strcmp(fs->fs_file, filesys) == 0) 284 strcmp(fs->fs_file, filesys) == 0)
285 break; 285 break;
286 } 286 }
287 if (fs == NULL) 287 if (fs == NULL)
288 return NULL; 288 return NULL;
289 289
290 if (!hasquota(qfpathname, sizeof(qfpathname), fs, 290 if (!hasquota(qfpathname, sizeof(qfpathname), fs,
291 ufsclass2qtype(idtype))) 291 quota_idtype_to_ufs(idtype)))
292 return NULL; 292 return NULL;
293 293
294 qup = quotause_create(); 294 qup = quotause_create();
295 strcpy(qup->fsname, fs->fs_file); 295 strcpy(qup->fsname, fs->fs_file);
296 if ((fd = open(qfpathname, O_RDONLY)) < 0) { 296 if ((fd = open(qfpathname, O_RDONLY)) < 0) {
297 fd = open(qfpathname, O_RDWR|O_CREAT, 0640); 297 fd = open(qfpathname, O_RDWR|O_CREAT, 0640);
298 if (fd < 0 && errno != ENOENT) { 298 if (fd < 0 && errno != ENOENT) {
299 warnx("open `%s'", qfpathname); 299 warnx("open `%s'", qfpathname);
300 quotause_destroy(qup); 300 quotause_destroy(qup);
301 return NULL; 301 return NULL;
302 } 302 }
303 warnx("Creating quota file %s", qfpathname); 303 warnx("Creating quota file %s", qfpathname);
304 sleep(3); 304 sleep(3);