version 1.40, 2009/05/07 19:26:09 |
version 1.40.4.1, 2011/04/21 01:42:21 |
Line 62 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 62 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#ifdef UFS_DIRHASH |
#ifdef UFS_DIRHASH |
#include <ufs/ufs/dirhash.h> |
#include <ufs/ufs/dirhash.h> |
#endif |
#endif |
|
#include <quota/quotaprop.h> |
|
|
/* how many times ufs_init() was called */ |
/* how many times ufs_init() was called */ |
static int ufs_initcount = 0; |
static int ufs_initcount = 0; |
Line 99 ufs_root(struct mount *mp, struct vnode |
|
Line 100 ufs_root(struct mount *mp, struct vnode |
|
* Do operations associated with quotas |
* Do operations associated with quotas |
*/ |
*/ |
int |
int |
ufs_quotactl(struct mount *mp, int cmds, uid_t uid, void *arg) |
ufs_quotactl(struct mount *mp, prop_dictionary_t dict) |
{ |
{ |
struct lwp *l = curlwp; |
struct lwp *l = curlwp; |
|
|
#ifndef QUOTA |
#if !defined(QUOTA) && !defined(QUOTA2) |
(void) mp; |
(void) mp; |
(void) cmds; |
(void) dict; |
(void) uid; |
|
(void) arg; |
|
(void) l; |
(void) l; |
return (EOPNOTSUPP); |
return (EOPNOTSUPP); |
#else |
#else |
int cmd, type, error; |
int error; |
|
prop_dictionary_t cmddict; |
if (uid == -1) |
prop_array_t commands; |
uid = kauth_cred_getuid(l->l_cred); |
prop_object_iterator_t iter; |
cmd = cmds >> SUBCMDSHIFT; |
|
|
|
/* Mark the mount busy, as we're passing it to kauth(9). */ |
/* Mark the mount busy, as we're passing it to kauth(9). */ |
error = vfs_busy(mp, NULL); |
error = vfs_busy(mp, NULL); |
if (error) |
if (error) |
return (error); |
return (error); |
|
|
|
error = quota_get_cmds(dict, &commands); |
|
if (error) |
|
goto out_vfs; |
|
iter = prop_array_iterator(commands); |
|
if (iter == NULL) { |
|
error = ENOMEM; |
|
goto out_vfs; |
|
} |
|
|
|
|
|
mutex_enter(&mp->mnt_updating); |
|
while ((cmddict = prop_object_iterator_next(iter)) != NULL) { |
|
if (prop_object_type(cmddict) != PROP_TYPE_DICTIONARY) |
|
continue; |
|
error = quota_handle_cmd(mp, l, cmddict); |
|
if (error) |
|
break; |
|
} |
|
prop_object_iterator_release(iter); |
|
mutex_exit(&mp->mnt_updating); |
|
out_vfs: |
|
vfs_unbusy(mp, false, NULL); |
|
return (error); |
|
#endif |
|
} |
|
|
|
#if 0 |
switch (cmd) { |
switch (cmd) { |
case Q_SYNC: |
case Q_SYNC: |
break; |
break; |
Line 201 ufs_quotactl(struct mount *mp, int cmds, |
|
Line 226 ufs_quotactl(struct mount *mp, int cmds, |
|
vfs_unbusy(mp, false, NULL); |
vfs_unbusy(mp, false, NULL); |
return (error); |
return (error); |
#endif |
#endif |
} |
|
|
|
/* |
/* |
* This is the generic part of fhtovp called after the underlying |
* This is the generic part of fhtovp called after the underlying |
|
|
"ufsdir", NULL, IPL_NONE, NULL, NULL, NULL); |
"ufsdir", NULL, IPL_NONE, NULL, NULL, NULL); |
|
|
ufs_ihashinit(); |
ufs_ihashinit(); |
#ifdef QUOTA |
#if defined(QUOTA) || defined(QUOTA2) |
dqinit(); |
dqinit(); |
#endif |
#endif |
#ifdef UFS_DIRHASH |
#ifdef UFS_DIRHASH |
|
|
ufs_reinit(void) |
ufs_reinit(void) |
{ |
{ |
ufs_ihashreinit(); |
ufs_ihashreinit(); |
#ifdef QUOTA |
#if defined(QUOTA) || defined(QUOTA2) |
dqreinit(); |
dqreinit(); |
#endif |
#endif |
} |
} |
|
|
return; |
return; |
|
|
ufs_ihashdone(); |
ufs_ihashdone(); |
#ifdef QUOTA |
#if defined(QUOTA) || defined(QUOTA2) |
dqdone(); |
dqdone(); |
#endif |
#endif |
pool_cache_destroy(ufs_direct_cache); |
pool_cache_destroy(ufs_direct_cache); |