Move the code for iterating over the multiple RPC calls in a quota proplib XML packet to vfs_quotactl.c out of sys/ufs/ufs. Add a dummy extra arg to VFS_QUOTACTL for compile safety. Note: this change requires a kernel version bump.diff -r1.2 -r1.3 src/sys/kern/vfs_quotactl.c
(dholland)
--- src/sys/kern/vfs_quotactl.c 2012/01/29 06:29:05 1.2
+++ src/sys/kern/vfs_quotactl.c 2012/01/29 06:32:43 1.3
@@ -1,14 +1,51 @@ | @@ -1,14 +1,51 @@ | |||
1 | /* $NetBSD: vfs_quotactl.c,v 1.2 2012/01/29 06:29:05 dholland Exp $ */ | 1 | /* $NetBSD: vfs_quotactl.c,v 1.3 2012/01/29 06:32:43 dholland Exp $ */ | |
2 | ||||
3 | /* | |||
4 | * Copyright (c) 1991, 1993, 1994 | |||
5 | * The Regents of the University of California. All rights reserved. | |||
6 | * (c) UNIX System Laboratories, Inc. | |||
7 | * All or some portions of this file are derived from material licensed | |||
8 | * to the University of California by American Telephone and Telegraph | |||
9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |||
10 | * the permission of UNIX System Laboratories, Inc. | |||
11 | * | |||
12 | * Redistribution and use in source and binary forms, with or without | |||
13 | * modification, are permitted provided that the following conditions | |||
14 | * are met: | |||
15 | * 1. Redistributions of source code must retain the above copyright | |||
16 | * notice, this list of conditions and the following disclaimer. | |||
17 | * 2. Redistributions in binary form must reproduce the above copyright | |||
18 | * notice, this list of conditions and the following disclaimer in the | |||
19 | * documentation and/or other materials provided with the distribution. | |||
20 | * 3. Neither the name of the University nor the names of its contributors | |||
21 | * may be used to endorse or promote products derived from this software | |||
22 | * without specific prior written permission. | |||
23 | * | |||
24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |||
25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |||
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |||
30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |||
31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |||
32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |||
33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
34 | * SUCH DAMAGE. | |||
35 | * | |||
36 | * @(#)ufs_vfsops.c 8.8 (Berkeley) 5/20/95 | |||
37 | * From NetBSD: ufs_vfsops.c,v 1.42 2011/03/24 17:05:46 bouyer Exp | |||
38 | */ | |||
2 | 39 | |||
3 | /* | 40 | /* | |
4 | * Copyright (c) 1982, 1986, 1990, 1993, 1995 | 41 | * Copyright (c) 1982, 1986, 1990, 1993, 1995 | |
5 | * The Regents of the University of California. All rights reserved. | 42 | * The Regents of the University of California. All rights reserved. | |
6 | * | 43 | * | |
7 | * This code is derived from software contributed to Berkeley by | 44 | * This code is derived from software contributed to Berkeley by | |
8 | * Robert Elz at The University of Melbourne. | 45 | * Robert Elz at The University of Melbourne. | |
9 | * | 46 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 47 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 48 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 49 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 50 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 51 | * notice, this list of conditions and the following disclaimer. | |
@@ -22,26 +59,60 @@ | @@ -22,26 +59,60 @@ | |||
22 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 59 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 66 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 67 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
32 | * SUCH DAMAGE. | 69 | * SUCH DAMAGE. | |
33 | * | 70 | * | |
34 | * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 | 71 | * @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95 | |
35 | * From ufs_quota.c,v 1.70 2011/03/24 17:05:46 bouyer Exp | 72 | * From NetBSD: ufs_quota.c,v 1.70 2011/03/24 17:05:46 bouyer Exp | |
73 | */ | |||
74 | ||||
75 | /* | |||
76 | * Note that both of the copyrights above are moderately spurious; | |||
77 | * this code should almost certainly have the Copyright 2010 Manuel | |||
78 | * Bouyer notice and license found in e.g. sys/ufs/ufs/quota2_subr.c. | |||
79 | * However, they're what was on the files this code was sliced out of. | |||
36 | */ | 80 | */ | |
37 | 81 | |||
38 | #include <sys/cdefs.h> | 82 | #include <sys/cdefs.h> | |
39 | __KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.2 2012/01/29 06:29:05 dholland Exp $"); | 83 | __KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.3 2012/01/29 06:32:43 dholland Exp $"); | |
40 | 84 | |||
41 | #include <sys/mount.h> | 85 | #include <sys/mount.h> | |
86 | #include <quota/quotaprop.h> | |||
42 | 87 | |||
43 | int | 88 | int | |
44 | vfs_quotactl(struct mount *mp, prop_dictionary_t dict) | 89 | vfs_quotactl(struct mount *mp, prop_dictionary_t dict) | |
45 | { | 90 | { | |
46 | return VFS_QUOTACTL(mp, dict); | 91 | prop_dictionary_t cmddict; | |
92 | prop_array_t commands; | |||
93 | prop_object_iterator_t iter; | |||
94 | int error; | |||
95 | ||||
96 | error = quota_get_cmds(dict, &commands); | |||
97 | if (error) { | |||
98 | return error; | |||
99 | } | |||
100 | ||||
101 | iter = prop_array_iterator(commands); | |||
102 | if (iter == NULL) { | |||
103 | return ENOMEM; | |||
104 | } | |||
105 | ||||
106 | while ((cmddict = prop_object_iterator_next(iter)) != NULL) { | |||
107 | if (prop_object_type(cmddict) != PROP_TYPE_DICTIONARY) { | |||
108 | /* XXX shouldn't this be an error? */ | |||
109 | continue; | |||
110 | } | |||
111 | error = VFS_QUOTACTL(mp, cmddict, 0/*dummy*/); | |||
112 | if (error) { | |||
113 | break; | |||
114 | } | |||
115 | } | |||
116 | prop_object_iterator_release(iter); | |||
117 | return error; | |||
47 | } | 118 | } |
--- src/sys/kern/vfs_subr.c 2011/12/02 12:32:38 1.426
+++ src/sys/kern/vfs_subr.c 2012/01/29 06:32:43 1.427
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: vfs_subr.c,v 1.426 2011/12/02 12:32:38 yamt Exp $ */ | 1 | /* $NetBSD: vfs_subr.c,v 1.427 2012/01/29 06:32:43 dholland Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1997, 1998, 2004, 2005, 2007, 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 Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | |
9 | * NASA Ames Research Center, by Charles M. Hannum, and by Andrew Doran. | 9 | * NASA Ames Research Center, by Charles M. Hannum, and by Andrew Doran. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -57,27 +57,27 @@ | @@ -57,27 +57,27 @@ | |||
57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
64 | * SUCH DAMAGE. | 64 | * SUCH DAMAGE. | |
65 | * | 65 | * | |
66 | * @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94 | 66 | * @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94 | |
67 | */ | 67 | */ | |
68 | 68 | |||
69 | #include <sys/cdefs.h> | 69 | #include <sys/cdefs.h> | |
70 | __KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.426 2011/12/02 12:32:38 yamt Exp $"); | 70 | __KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.427 2012/01/29 06:32:43 dholland Exp $"); | |
71 | 71 | |||
72 | #include "opt_ddb.h" | 72 | #include "opt_ddb.h" | |
73 | #include "opt_compat_netbsd.h" | 73 | #include "opt_compat_netbsd.h" | |
74 | #include "opt_compat_43.h" | 74 | #include "opt_compat_43.h" | |
75 | 75 | |||
76 | #include <sys/param.h> | 76 | #include <sys/param.h> | |
77 | #include <sys/systm.h> | 77 | #include <sys/systm.h> | |
78 | #include <sys/conf.h> | 78 | #include <sys/conf.h> | |
79 | #include <sys/dirent.h> | 79 | #include <sys/dirent.h> | |
80 | #include <sys/filedesc.h> | 80 | #include <sys/filedesc.h> | |
81 | #include <sys/kernel.h> | 81 | #include <sys/kernel.h> | |
82 | #include <sys/mount.h> | 82 | #include <sys/mount.h> | |
83 | #include <sys/vnode.h> | 83 | #include <sys/vnode.h> | |
@@ -996,34 +996,34 @@ VFS_ROOT(struct mount *mp, struct vnode | @@ -996,34 +996,34 @@ VFS_ROOT(struct mount *mp, struct vnode | |||
996 | 996 | |||
997 | if ((mp->mnt_iflag & IMNT_MPSAFE) == 0) { | 997 | if ((mp->mnt_iflag & IMNT_MPSAFE) == 0) { | |
998 | KERNEL_LOCK(1, NULL); | 998 | KERNEL_LOCK(1, NULL); | |
999 | } | 999 | } | |
1000 | error = (*(mp->mnt_op->vfs_root))(mp, a); | 1000 | error = (*(mp->mnt_op->vfs_root))(mp, a); | |
1001 | if ((mp->mnt_iflag & IMNT_MPSAFE) == 0) { | 1001 | if ((mp->mnt_iflag & IMNT_MPSAFE) == 0) { | |
1002 | KERNEL_UNLOCK_ONE(NULL); | 1002 | KERNEL_UNLOCK_ONE(NULL); | |
1003 | } | 1003 | } | |
1004 | 1004 | |||
1005 | return error; | 1005 | return error; | |
1006 | } | 1006 | } | |
1007 | 1007 | |||
1008 | int | 1008 | int | |
1009 | VFS_QUOTACTL(struct mount *mp, prop_dictionary_t dict) | 1009 | VFS_QUOTACTL(struct mount *mp, prop_dictionary_t dict, int dummy) | |
1010 | { | 1010 | { | |
1011 | int error; | 1011 | int error; | |
1012 | 1012 | |||
1013 | if ((mp->mnt_iflag & IMNT_MPSAFE) == 0) { | 1013 | if ((mp->mnt_iflag & IMNT_MPSAFE) == 0) { | |
1014 | KERNEL_LOCK(1, NULL); | 1014 | KERNEL_LOCK(1, NULL); | |
1015 | } | 1015 | } | |
1016 | error = (*(mp->mnt_op->vfs_quotactl))(mp, dict); | 1016 | error = (*(mp->mnt_op->vfs_quotactl))(mp, dict, dummy); | |
1017 | if ((mp->mnt_iflag & IMNT_MPSAFE) == 0) { | 1017 | if ((mp->mnt_iflag & IMNT_MPSAFE) == 0) { | |
1018 | KERNEL_UNLOCK_ONE(NULL); | 1018 | KERNEL_UNLOCK_ONE(NULL); | |
1019 | } | 1019 | } | |
1020 | 1020 | |||
1021 | return error; | 1021 | return error; | |
1022 | } | 1022 | } | |
1023 | 1023 | |||
1024 | int | 1024 | int | |
1025 | VFS_STATVFS(struct mount *mp, struct statvfs *a) | 1025 | VFS_STATVFS(struct mount *mp, struct statvfs *a) | |
1026 | { | 1026 | { | |
1027 | int error; | 1027 | int error; | |
1028 | 1028 | |||
1029 | if ((mp->mnt_iflag & IMNT_MPSAFE) == 0) { | 1029 | if ((mp->mnt_iflag & IMNT_MPSAFE) == 0) { |
--- src/sys/miscfs/genfs/layer_extern.h 2011/07/11 08:27:38 1.29
+++ src/sys/miscfs/genfs/layer_extern.h 2012/01/29 06:32:44 1.30
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: layer_extern.h,v 1.29 2011/07/11 08:27:38 hannken Exp $ */ | 1 | /* $NetBSD: layer_extern.h,v 1.30 2012/01/29 06:32:44 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1999 National Aeronautics & Space Administration | 4 | * Copyright (c) 1999 National Aeronautics & Space Administration | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This software was written by William Studenmund of the | 7 | * This software was written by William Studenmund of the | |
8 | * Numerical Aerospace Simulation Facility, NASA Ames Research Center. | 8 | * Numerical Aerospace Simulation Facility, NASA Ames Research Center. | |
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. | |
@@ -78,27 +78,27 @@ void layerfs_init(void); | @@ -78,27 +78,27 @@ void layerfs_init(void); | |||
78 | void layerfs_done(void); | 78 | void layerfs_done(void); | |
79 | int layer_node_alloc(struct mount *, struct vnode *, struct vnode **); | 79 | int layer_node_alloc(struct mount *, struct vnode *, struct vnode **); | |
80 | int layer_node_create(struct mount *, struct vnode *, struct vnode **); | 80 | int layer_node_create(struct mount *, struct vnode *, struct vnode **); | |
81 | struct vnode *layer_node_find(struct mount *, struct vnode *); | 81 | struct vnode *layer_node_find(struct mount *, struct vnode *); | |
82 | 82 | |||
83 | #define LOG2_SIZEVNODE 7 /* log2(sizeof struct vnode) */ | 83 | #define LOG2_SIZEVNODE 7 /* log2(sizeof struct vnode) */ | |
84 | #define LAYER_NHASH(lmp, vp) \ | 84 | #define LAYER_NHASH(lmp, vp) \ | |
85 | (&((lmp)->layerm_node_hashtbl[(((u_long)vp)>>LOG2_SIZEVNODE) & \ | 85 | (&((lmp)->layerm_node_hashtbl[(((u_long)vp)>>LOG2_SIZEVNODE) & \ | |
86 | (lmp)->layerm_node_hash])) | 86 | (lmp)->layerm_node_hash])) | |
87 | 87 | |||
88 | /* VFS routines */ | 88 | /* VFS routines */ | |
89 | int layerfs_start(struct mount *, int); | 89 | int layerfs_start(struct mount *, int); | |
90 | int layerfs_root(struct mount *, struct vnode **); | 90 | int layerfs_root(struct mount *, struct vnode **); | |
91 | int layerfs_quotactl(struct mount *, prop_dictionary_t); | 91 | int layerfs_quotactl(struct mount *, prop_dictionary_t, int); | |
92 | int layerfs_statvfs(struct mount *, struct statvfs *); | 92 | int layerfs_statvfs(struct mount *, struct statvfs *); | |
93 | int layerfs_sync(struct mount *, int, struct kauth_cred *); | 93 | int layerfs_sync(struct mount *, int, struct kauth_cred *); | |
94 | int layerfs_vget(struct mount *, ino_t, struct vnode **); | 94 | int layerfs_vget(struct mount *, ino_t, struct vnode **); | |
95 | int layerfs_fhtovp(struct mount *, struct fid *, struct vnode **); | 95 | int layerfs_fhtovp(struct mount *, struct fid *, struct vnode **); | |
96 | int layerfs_vptofh(struct vnode *, struct fid *, size_t *); | 96 | int layerfs_vptofh(struct vnode *, struct fid *, size_t *); | |
97 | int layerfs_snapshot(struct mount *, struct vnode *, struct timespec *); | 97 | int layerfs_snapshot(struct mount *, struct vnode *, struct timespec *); | |
98 | int layerfs_renamelock_enter(struct mount *); | 98 | int layerfs_renamelock_enter(struct mount *); | |
99 | void layerfs_renamelock_exit(struct mount *); | 99 | void layerfs_renamelock_exit(struct mount *); | |
100 | 100 | |||
101 | /* VOP routines */ | 101 | /* VOP routines */ | |
102 | int layer_bypass(void *); | 102 | int layer_bypass(void *); | |
103 | int layer_getattr(void *); | 103 | int layer_getattr(void *); | |
104 | int layer_inactive(void *); | 104 | int layer_inactive(void *); |
--- src/sys/miscfs/genfs/layer_vfsops.c 2011/03/06 17:08:36 1.34
+++ src/sys/miscfs/genfs/layer_vfsops.c 2012/01/29 06:32:44 1.35
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: layer_vfsops.c,v 1.34 2011/03/06 17:08:36 bouyer Exp $ */ | 1 | /* $NetBSD: layer_vfsops.c,v 1.35 2012/01/29 06:32:44 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1999 National Aeronautics & Space Administration | 4 | * Copyright (c) 1999 National Aeronautics & Space Administration | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This software was written by William Studenmund of the | 7 | * This software was written by William Studenmund of the | |
8 | * Numerical Aerospace Simulation Facility, NASA Ames Research Center. | 8 | * Numerical Aerospace Simulation Facility, NASA Ames Research Center. | |
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. | |
@@ -64,27 +64,27 @@ | @@ -64,27 +64,27 @@ | |||
64 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 64 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
65 | * SUCH DAMAGE. | 65 | * SUCH DAMAGE. | |
66 | * | 66 | * | |
67 | * from: Id: lofs_vfsops.c,v 1.9 1992/05/30 10:26:24 jsp Exp | 67 | * from: Id: lofs_vfsops.c,v 1.9 1992/05/30 10:26:24 jsp Exp | |
68 | * from: @(#)lofs_vfsops.c 1.2 (Berkeley) 6/18/92 | 68 | * from: @(#)lofs_vfsops.c 1.2 (Berkeley) 6/18/92 | |
69 | * @(#)null_vfsops.c 8.7 (Berkeley) 5/14/95 | 69 | * @(#)null_vfsops.c 8.7 (Berkeley) 5/14/95 | |
70 | */ | 70 | */ | |
71 | 71 | |||
72 | /* | 72 | /* | |
73 | * Generic layer VFS operations. | 73 | * Generic layer VFS operations. | |
74 | */ | 74 | */ | |
75 | 75 | |||
76 | #include <sys/cdefs.h> | 76 | #include <sys/cdefs.h> | |
77 | __KERNEL_RCSID(0, "$NetBSD: layer_vfsops.c,v 1.34 2011/03/06 17:08:36 bouyer Exp $"); | 77 | __KERNEL_RCSID(0, "$NetBSD: layer_vfsops.c,v 1.35 2012/01/29 06:32:44 dholland Exp $"); | |
78 | 78 | |||
79 | #include <sys/param.h> | 79 | #include <sys/param.h> | |
80 | #include <sys/sysctl.h> | 80 | #include <sys/sysctl.h> | |
81 | #include <sys/systm.h> | 81 | #include <sys/systm.h> | |
82 | #include <sys/vnode.h> | 82 | #include <sys/vnode.h> | |
83 | #include <sys/mount.h> | 83 | #include <sys/mount.h> | |
84 | #include <sys/namei.h> | 84 | #include <sys/namei.h> | |
85 | #include <sys/malloc.h> | 85 | #include <sys/malloc.h> | |
86 | #include <sys/kauth.h> | 86 | #include <sys/kauth.h> | |
87 | #include <sys/module.h> | 87 | #include <sys/module.h> | |
88 | 88 | |||
89 | #include <miscfs/genfs/layer.h> | 89 | #include <miscfs/genfs/layer.h> | |
90 | #include <miscfs/genfs/layer_extern.h> | 90 | #include <miscfs/genfs/layer_extern.h> | |
@@ -131,30 +131,30 @@ layerfs_root(struct mount *mp, struct vn | @@ -131,30 +131,30 @@ layerfs_root(struct mount *mp, struct vn | |||
131 | *vpp = NULL; | 131 | *vpp = NULL; | |
132 | return EINVAL; | 132 | return EINVAL; | |
133 | } | 133 | } | |
134 | /* | 134 | /* | |
135 | * Return root vnode with locked and with a reference held. | 135 | * Return root vnode with locked and with a reference held. | |
136 | */ | 136 | */ | |
137 | vref(vp); | 137 | vref(vp); | |
138 | vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); | 138 | vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); | |
139 | *vpp = vp; | 139 | *vpp = vp; | |
140 | return 0; | 140 | return 0; | |
141 | } | 141 | } | |
142 | 142 | |||
143 | int | 143 | int | |
144 | layerfs_quotactl(struct mount *mp, prop_dictionary_t dict) | 144 | layerfs_quotactl(struct mount *mp, prop_dictionary_t dict, int dummy) | |
145 | { | 145 | { | |
146 | 146 | |||
147 | return VFS_QUOTACTL(MOUNTTOLAYERMOUNT(mp)->layerm_vfs, dict); | 147 | return VFS_QUOTACTL(MOUNTTOLAYERMOUNT(mp)->layerm_vfs, dict, dummy); | |
148 | } | 148 | } | |
149 | 149 | |||
150 | int | 150 | int | |
151 | layerfs_statvfs(struct mount *mp, struct statvfs *sbp) | 151 | layerfs_statvfs(struct mount *mp, struct statvfs *sbp) | |
152 | { | 152 | { | |
153 | struct statvfs *sbuf; | 153 | struct statvfs *sbuf; | |
154 | int error; | 154 | int error; | |
155 | 155 | |||
156 | sbuf = kmem_zalloc(sizeof(*sbuf), KM_SLEEP); | 156 | sbuf = kmem_zalloc(sizeof(*sbuf), KM_SLEEP); | |
157 | if (sbuf == NULL) { | 157 | if (sbuf == NULL) { | |
158 | return ENOMEM; | 158 | return ENOMEM; | |
159 | } | 159 | } | |
160 | error = VFS_STATVFS(MOUNTTOLAYERMOUNT(mp)->layerm_vfs, sbuf); | 160 | error = VFS_STATVFS(MOUNTTOLAYERMOUNT(mp)->layerm_vfs, sbuf); |
--- src/sys/sys/mount.h 2012/01/29 06:29:04 1.202
+++ src/sys/sys/mount.h 2012/01/29 06:32:43 1.203
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: mount.h,v 1.202 2012/01/29 06:29:04 dholland Exp $ */ | 1 | /* $NetBSD: mount.h,v 1.203 2012/01/29 06:32:43 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1989, 1991, 1993 | 4 | * Copyright (c) 1989, 1991, 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 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -198,27 +198,27 @@ struct nameidata; | @@ -198,27 +198,27 @@ struct nameidata; | |||
198 | 198 | |||
199 | /* | 199 | /* | |
200 | * Operations supported on mounted file system. | 200 | * Operations supported on mounted file system. | |
201 | */ | 201 | */ | |
202 | 202 | |||
203 | struct vfsops { | 203 | struct vfsops { | |
204 | const char *vfs_name; | 204 | const char *vfs_name; | |
205 | size_t vfs_min_mount_data; | 205 | size_t vfs_min_mount_data; | |
206 | int (*vfs_mount) (struct mount *, const char *, void *, | 206 | int (*vfs_mount) (struct mount *, const char *, void *, | |
207 | size_t *); | 207 | size_t *); | |
208 | int (*vfs_start) (struct mount *, int); | 208 | int (*vfs_start) (struct mount *, int); | |
209 | int (*vfs_unmount) (struct mount *, int); | 209 | int (*vfs_unmount) (struct mount *, int); | |
210 | int (*vfs_root) (struct mount *, struct vnode **); | 210 | int (*vfs_root) (struct mount *, struct vnode **); | |
211 | int (*vfs_quotactl) (struct mount *, prop_dictionary_t); | 211 | int (*vfs_quotactl) (struct mount *, prop_dictionary_t, int); | |
212 | int (*vfs_statvfs) (struct mount *, struct statvfs *); | 212 | int (*vfs_statvfs) (struct mount *, struct statvfs *); | |
213 | int (*vfs_sync) (struct mount *, int, struct kauth_cred *); | 213 | int (*vfs_sync) (struct mount *, int, struct kauth_cred *); | |
214 | int (*vfs_vget) (struct mount *, ino_t, struct vnode **); | 214 | int (*vfs_vget) (struct mount *, ino_t, struct vnode **); | |
215 | int (*vfs_fhtovp) (struct mount *, struct fid *, | 215 | int (*vfs_fhtovp) (struct mount *, struct fid *, | |
216 | struct vnode **); | 216 | struct vnode **); | |
217 | int (*vfs_vptofh) (struct vnode *, struct fid *, size_t *); | 217 | int (*vfs_vptofh) (struct vnode *, struct fid *, size_t *); | |
218 | void (*vfs_init) (void); | 218 | void (*vfs_init) (void); | |
219 | void (*vfs_reinit) (void); | 219 | void (*vfs_reinit) (void); | |
220 | void (*vfs_done) (void); | 220 | void (*vfs_done) (void); | |
221 | int (*vfs_mountroot)(void); | 221 | int (*vfs_mountroot)(void); | |
222 | int (*vfs_snapshot) (struct mount *, struct vnode *, | 222 | int (*vfs_snapshot) (struct mount *, struct vnode *, | |
223 | struct timespec *); | 223 | struct timespec *); | |
224 | int (*vfs_extattrctl) (struct mount *, int, | 224 | int (*vfs_extattrctl) (struct mount *, int, | |
@@ -233,27 +233,27 @@ struct vfsops { | @@ -233,27 +233,27 @@ struct vfsops { | |||
233 | }; | 233 | }; | |
234 | 234 | |||
235 | /* XXX vget is actually file system internal. */ | 235 | /* XXX vget is actually file system internal. */ | |
236 | #define VFS_VGET(MP, INO, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP) | 236 | #define VFS_VGET(MP, INO, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP) | |
237 | 237 | |||
238 | #define VFS_RENAMELOCK_ENTER(MP) (*(MP)->mnt_op->vfs_renamelock_enter)(MP) | 238 | #define VFS_RENAMELOCK_ENTER(MP) (*(MP)->mnt_op->vfs_renamelock_enter)(MP) | |
239 | #define VFS_RENAMELOCK_EXIT(MP) (*(MP)->mnt_op->vfs_renamelock_exit)(MP) | 239 | #define VFS_RENAMELOCK_EXIT(MP) (*(MP)->mnt_op->vfs_renamelock_exit)(MP) | |
240 | #define VFS_FSYNC(MP, VP, FLG) (*(MP)->mnt_op->vfs_fsync)(VP, FLG) | 240 | #define VFS_FSYNC(MP, VP, FLG) (*(MP)->mnt_op->vfs_fsync)(VP, FLG) | |
241 | 241 | |||
242 | int VFS_MOUNT(struct mount *, const char *, void *, size_t *); | 242 | int VFS_MOUNT(struct mount *, const char *, void *, size_t *); | |
243 | int VFS_START(struct mount *, int); | 243 | int VFS_START(struct mount *, int); | |
244 | int VFS_UNMOUNT(struct mount *, int); | 244 | int VFS_UNMOUNT(struct mount *, int); | |
245 | int VFS_ROOT(struct mount *, struct vnode **); | 245 | int VFS_ROOT(struct mount *, struct vnode **); | |
246 | int VFS_QUOTACTL(struct mount *, prop_dictionary_t); | 246 | int VFS_QUOTACTL(struct mount *, prop_dictionary_t, int); | |
247 | int VFS_STATVFS(struct mount *, struct statvfs *); | 247 | int VFS_STATVFS(struct mount *, struct statvfs *); | |
248 | int VFS_SYNC(struct mount *, int, struct kauth_cred *); | 248 | int VFS_SYNC(struct mount *, int, struct kauth_cred *); | |
249 | int VFS_FHTOVP(struct mount *, struct fid *, struct vnode **); | 249 | int VFS_FHTOVP(struct mount *, struct fid *, struct vnode **); | |
250 | int VFS_VPTOFH(struct vnode *, struct fid *, size_t *); | 250 | int VFS_VPTOFH(struct vnode *, struct fid *, size_t *); | |
251 | int VFS_SNAPSHOT(struct mount *, struct vnode *, struct timespec *); | 251 | int VFS_SNAPSHOT(struct mount *, struct vnode *, struct timespec *); | |
252 | int VFS_EXTATTRCTL(struct mount *, int, struct vnode *, int, const char *); | 252 | int VFS_EXTATTRCTL(struct mount *, int, struct vnode *, int, const char *); | |
253 | int VFS_SUSPENDCTL(struct mount *, int); | 253 | int VFS_SUSPENDCTL(struct mount *, int); | |
254 | 254 | |||
255 | #endif /* _KERNEL */ | 255 | #endif /* _KERNEL */ | |
256 | 256 | |||
257 | #ifdef _KERNEL | 257 | #ifdef _KERNEL | |
258 | #if __STDC__ | 258 | #if __STDC__ | |
259 | struct mbuf; | 259 | struct mbuf; |
--- src/sys/ufs/ufs/ufs_extern.h 2011/07/17 22:07:59 1.66
+++ src/sys/ufs/ufs/ufs_extern.h 2012/01/29 06:32:44 1.67
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ufs_extern.h,v 1.66 2011/07/17 22:07:59 dholland Exp $ */ | 1 | /* $NetBSD: ufs_extern.h,v 1.67 2012/01/29 06:32:44 dholland Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1991, 1993, 1994 | 4 | * Copyright (c) 1991, 1993, 1994 | |
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 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -153,27 +153,27 @@ int qsync(struct mount *); | @@ -153,27 +153,27 @@ int qsync(struct mount *); | |||
153 | 153 | |||
154 | /* ufs_quota1.c */ | 154 | /* ufs_quota1.c */ | |
155 | int quota1_umount(struct mount *, int); | 155 | int quota1_umount(struct mount *, int); | |
156 | 156 | |||
157 | /* ufs_quota2.c */ | 157 | /* ufs_quota2.c */ | |
158 | int quota2_umount(struct mount *, int); | 158 | int quota2_umount(struct mount *, int); | |
159 | 159 | |||
160 | /* ufs_vfsops.c */ | 160 | /* ufs_vfsops.c */ | |
161 | void ufs_init(void); | 161 | void ufs_init(void); | |
162 | void ufs_reinit(void); | 162 | void ufs_reinit(void); | |
163 | void ufs_done(void); | 163 | void ufs_done(void); | |
164 | int ufs_start(struct mount *, int); | 164 | int ufs_start(struct mount *, int); | |
165 | int ufs_root(struct mount *, struct vnode **); | 165 | int ufs_root(struct mount *, struct vnode **); | |
166 | int ufs_quotactl(struct mount *, prop_dictionary_t); | 166 | int ufs_quotactl(struct mount *, prop_dictionary_t, int); | |
167 | int ufs_fhtovp(struct mount *, struct ufid *, struct vnode **); | 167 | int ufs_fhtovp(struct mount *, struct ufid *, struct vnode **); | |
168 | 168 | |||
169 | /* ufs_vnops.c */ | 169 | /* ufs_vnops.c */ | |
170 | void ufs_vinit(struct mount *, int (**)(void *), | 170 | void ufs_vinit(struct mount *, int (**)(void *), | |
171 | int (**)(void *), struct vnode **); | 171 | int (**)(void *), struct vnode **); | |
172 | int ufs_makeinode(int, struct vnode *, const struct ufs_lookup_results *, | 172 | int ufs_makeinode(int, struct vnode *, const struct ufs_lookup_results *, | |
173 | struct vnode **, struct componentname *); | 173 | struct vnode **, struct componentname *); | |
174 | int ufs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t); | 174 | int ufs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t); | |
175 | void ufs_gop_markupdate(struct vnode *, int); | 175 | void ufs_gop_markupdate(struct vnode *, int); | |
176 | 176 | |||
177 | /* | 177 | /* | |
178 | * Snapshot function prototypes. | 178 | * Snapshot function prototypes. | |
179 | */ | 179 | */ |
--- src/sys/ufs/ufs/ufs_vfsops.c 2012/01/27 19:22:50 1.43
+++ src/sys/ufs/ufs/ufs_vfsops.c 2012/01/29 06:32:44 1.44
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ufs_vfsops.c,v 1.43 2012/01/27 19:22:50 para Exp $ */ | 1 | /* $NetBSD: ufs_vfsops.c,v 1.44 2012/01/29 06:32:44 dholland Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1991, 1993, 1994 | 4 | * Copyright (c) 1991, 1993, 1994 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * (c) UNIX System Laboratories, Inc. | 6 | * (c) UNIX System Laboratories, Inc. | |
7 | * All or some portions of this file are derived from material licensed | 7 | * All or some portions of this file are derived from material licensed | |
8 | * to the University of California by American Telephone and Telegraph | 8 | * to the University of California by American Telephone and Telegraph | |
9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | 9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
10 | * the permission of UNIX System Laboratories, Inc. | 10 | * the permission of UNIX System Laboratories, Inc. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -27,27 +27,27 @@ | @@ -27,27 +27,27 @@ | |||
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
34 | * SUCH DAMAGE. | 34 | * SUCH DAMAGE. | |
35 | * | 35 | * | |
36 | * @(#)ufs_vfsops.c 8.8 (Berkeley) 5/20/95 | 36 | * @(#)ufs_vfsops.c 8.8 (Berkeley) 5/20/95 | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | #include <sys/cdefs.h> | 39 | #include <sys/cdefs.h> | |
40 | __KERNEL_RCSID(0, "$NetBSD: ufs_vfsops.c,v 1.43 2012/01/27 19:22:50 para Exp $"); | 40 | __KERNEL_RCSID(0, "$NetBSD: ufs_vfsops.c,v 1.44 2012/01/29 06:32:44 dholland Exp $"); | |
41 | 41 | |||
42 | #if defined(_KERNEL_OPT) | 42 | #if defined(_KERNEL_OPT) | |
43 | #include "opt_ffs.h" | 43 | #include "opt_ffs.h" | |
44 | #include "opt_quota.h" | 44 | #include "opt_quota.h" | |
45 | #endif | 45 | #endif | |
46 | 46 | |||
47 | #include <sys/param.h> | 47 | #include <sys/param.h> | |
48 | #include <sys/mbuf.h> | 48 | #include <sys/mbuf.h> | |
49 | #include <sys/mount.h> | 49 | #include <sys/mount.h> | |
50 | #include <sys/proc.h> | 50 | #include <sys/proc.h> | |
51 | #include <sys/buf.h> | 51 | #include <sys/buf.h> | |
52 | #include <sys/vnode.h> | 52 | #include <sys/vnode.h> | |
53 | #include <sys/kmem.h> | 53 | #include <sys/kmem.h> | |
@@ -90,67 +90,51 @@ ufs_root(struct mount *mp, struct vnode | @@ -90,67 +90,51 @@ ufs_root(struct mount *mp, struct vnode | |||
90 | struct vnode *nvp; | 90 | struct vnode *nvp; | |
91 | int error; | 91 | int error; | |
92 | 92 | |||
93 | if ((error = VFS_VGET(mp, (ino_t)ROOTINO, &nvp)) != 0) | 93 | if ((error = VFS_VGET(mp, (ino_t)ROOTINO, &nvp)) != 0) | |
94 | return (error); | 94 | return (error); | |
95 | *vpp = nvp; | 95 | *vpp = nvp; | |
96 | return (0); | 96 | return (0); | |
97 | } | 97 | } | |
98 | 98 | |||
99 | /* | 99 | /* | |
100 | * Do operations associated with quotas | 100 | * Do operations associated with quotas | |
101 | */ | 101 | */ | |
102 | int | 102 | int | |
103 | ufs_quotactl(struct mount *mp, prop_dictionary_t dict) | 103 | ufs_quotactl(struct mount *mp, prop_dictionary_t cmddict, int dummy) | |
104 | { | 104 | { | |
105 | struct lwp *l = curlwp; | 105 | struct lwp *l = curlwp; | |
106 | 106 | |||
107 | #if !defined(QUOTA) && !defined(QUOTA2) | 107 | #if !defined(QUOTA) && !defined(QUOTA2) | |
108 | (void) mp; | 108 | (void) mp; | |
109 | (void) dict; | 109 | (void) cmddict; | |
110 | (void) dummy; | |||
110 | (void) l; | 111 | (void) l; | |
111 | return (EOPNOTSUPP); | 112 | return (EOPNOTSUPP); | |
112 | #else | 113 | #else | |
113 | int error; | 114 | int error; | |
114 | prop_dictionary_t cmddict; | 115 | ||
115 | prop_array_t commands; | 116 | KASSERT(prop_object_type(cmddict) == PROP_TYPE_DICTIONARY); | |
116 | prop_object_iterator_t iter; | |||
117 | 117 | |||
118 | /* Mark the mount busy, as we're passing it to kauth(9). */ | 118 | /* Mark the mount busy, as we're passing it to kauth(9). */ | |
119 | error = vfs_busy(mp, NULL); | 119 | error = vfs_busy(mp, NULL); | |
120 | if (error) | 120 | if (error) { | |
121 | return (error); | 121 | return (error); | |
122 | ||||
123 | error = quota_get_cmds(dict, &commands); | |||
124 | if (error) | |||
125 | goto out_vfs; | |||
126 | iter = prop_array_iterator(commands); | |||
127 | if (iter == NULL) { | |||
128 | error = ENOMEM; | |||
129 | goto out_vfs; | |||
130 | } | 122 | } | |
131 | ||||
132 | ||||
133 | mutex_enter(&mp->mnt_updating); | 123 | mutex_enter(&mp->mnt_updating); | |
134 | while ((cmddict = prop_object_iterator_next(iter)) != NULL) { | 124 | ||
135 | if (prop_object_type(cmddict) != PROP_TYPE_DICTIONARY) | 125 | error = quota_handle_cmd(mp, l, cmddict); | |
136 | continue; | 126 | ||
137 | error = quota_handle_cmd(mp, l, cmddict); | |||
138 | if (error) | |||
139 | break; | |||
140 | } | |||
141 | prop_object_iterator_release(iter); | |||
142 | mutex_exit(&mp->mnt_updating); | 127 | mutex_exit(&mp->mnt_updating); | |
143 | out_vfs: | |||
144 | vfs_unbusy(mp, false, NULL); | 128 | vfs_unbusy(mp, false, NULL); | |
145 | return (error); | 129 | return (error); | |
146 | #endif | 130 | #endif | |
147 | } | 131 | } | |
148 | 132 | |||
149 | #if 0 | 133 | #if 0 | |
150 | switch (cmd) { | 134 | switch (cmd) { | |
151 | case Q_SYNC: | 135 | case Q_SYNC: | |
152 | break; | 136 | break; | |
153 | 137 | |||
154 | case Q_GETQUOTA: | 138 | case Q_GETQUOTA: | |
155 | /* The user can always query about his own quota. */ | 139 | /* The user can always query about his own quota. */ | |
156 | if (uid == kauth_cred_getuid(l->l_cred)) | 140 | if (uid == kauth_cred_getuid(l->l_cred)) |