Changeset View
Changeset View
Standalone View
Standalone View
head/sys/fs/nfs/nfs_commonsubs.c
Show First 20 Lines • Show All 1,897 Lines • ▼ Show 20 Lines | #ifdef QUOTA | ||||
/* | /* | ||||
* ufs_quotactl() insists that the uid argument | * ufs_quotactl() insists that the uid argument | ||||
* equal p_ruid for non-root quota access, so | * equal p_ruid for non-root quota access, so | ||||
* we'll just make sure that's the case. | * we'll just make sure that's the case. | ||||
*/ | */ | ||||
savuid = p->p_cred->p_ruid; | savuid = p->p_cred->p_ruid; | ||||
p->p_cred->p_ruid = cred->cr_uid; | p->p_cred->p_ruid = cred->cr_uid; | ||||
if (!VFS_QUOTACTL(vp->v_mount,QCMD(Q_GETQUOTA, | if (!VFS_QUOTACTL(vp->v_mount,QCMD(Q_GETQUOTA, | ||||
USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) | USRQUOTA), cred->cr_uid, &dqb)) | ||||
freenum = min(dqb.dqb_bhardlimit, freenum); | freenum = min(dqb.dqb_bhardlimit, freenum); | ||||
p->p_cred->p_ruid = savuid; | p->p_cred->p_ruid = savuid; | ||||
#endif /* QUOTA */ | #endif /* QUOTA */ | ||||
uquad = (u_int64_t)freenum; | uquad = (u_int64_t)freenum; | ||||
NFSQUOTABLKTOBYTE(uquad, sbp->f_bsize); | NFSQUOTABLKTOBYTE(uquad, sbp->f_bsize); | ||||
} | } | ||||
if (compare && !(*retcmpp)) { | if (compare && !(*retcmpp)) { | ||||
if (uquad != fxdr_hyper(tl)) | if (uquad != fxdr_hyper(tl)) | ||||
Show All 12 Lines | #ifdef QUOTA | ||||
/* | /* | ||||
* ufs_quotactl() insists that the uid argument | * ufs_quotactl() insists that the uid argument | ||||
* equal p_ruid for non-root quota access, so | * equal p_ruid for non-root quota access, so | ||||
* we'll just make sure that's the case. | * we'll just make sure that's the case. | ||||
*/ | */ | ||||
savuid = p->p_cred->p_ruid; | savuid = p->p_cred->p_ruid; | ||||
p->p_cred->p_ruid = cred->cr_uid; | p->p_cred->p_ruid = cred->cr_uid; | ||||
if (!VFS_QUOTACTL(vp->v_mount,QCMD(Q_GETQUOTA, | if (!VFS_QUOTACTL(vp->v_mount,QCMD(Q_GETQUOTA, | ||||
USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) | USRQUOTA), cred->cr_uid, &dqb)) | ||||
freenum = min(dqb.dqb_bsoftlimit, freenum); | freenum = min(dqb.dqb_bsoftlimit, freenum); | ||||
p->p_cred->p_ruid = savuid; | p->p_cred->p_ruid = savuid; | ||||
#endif /* QUOTA */ | #endif /* QUOTA */ | ||||
uquad = (u_int64_t)freenum; | uquad = (u_int64_t)freenum; | ||||
NFSQUOTABLKTOBYTE(uquad, sbp->f_bsize); | NFSQUOTABLKTOBYTE(uquad, sbp->f_bsize); | ||||
} | } | ||||
if (compare && !(*retcmpp)) { | if (compare && !(*retcmpp)) { | ||||
if (uquad != fxdr_hyper(tl)) | if (uquad != fxdr_hyper(tl)) | ||||
Show All 9 Lines | #ifdef QUOTA | ||||
/* | /* | ||||
* ufs_quotactl() insists that the uid argument | * ufs_quotactl() insists that the uid argument | ||||
* equal p_ruid for non-root quota access, so | * equal p_ruid for non-root quota access, so | ||||
* we'll just make sure that's the case. | * we'll just make sure that's the case. | ||||
*/ | */ | ||||
savuid = p->p_cred->p_ruid; | savuid = p->p_cred->p_ruid; | ||||
p->p_cred->p_ruid = cred->cr_uid; | p->p_cred->p_ruid = cred->cr_uid; | ||||
if (!VFS_QUOTACTL(vp->v_mount,QCMD(Q_GETQUOTA, | if (!VFS_QUOTACTL(vp->v_mount,QCMD(Q_GETQUOTA, | ||||
USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) | USRQUOTA), cred->cr_uid, &dqb)) | ||||
freenum = dqb.dqb_curblocks; | freenum = dqb.dqb_curblocks; | ||||
p->p_cred->p_ruid = savuid; | p->p_cred->p_ruid = savuid; | ||||
#endif /* QUOTA */ | #endif /* QUOTA */ | ||||
uquad = (u_int64_t)freenum; | uquad = (u_int64_t)freenum; | ||||
NFSQUOTABLKTOBYTE(uquad, sbp->f_bsize); | NFSQUOTABLKTOBYTE(uquad, sbp->f_bsize); | ||||
} | } | ||||
if (compare && !(*retcmpp)) { | if (compare && !(*retcmpp)) { | ||||
if (uquad != fxdr_hyper(tl)) | if (uquad != fxdr_hyper(tl)) | ||||
▲ Show 20 Lines • Show All 729 Lines • ▼ Show 20 Lines | #ifdef QUOTA | ||||
/* | /* | ||||
* ufs_quotactl() insists that the uid argument | * ufs_quotactl() insists that the uid argument | ||||
* equal p_ruid for non-root quota access, so | * equal p_ruid for non-root quota access, so | ||||
* we'll just make sure that's the case. | * we'll just make sure that's the case. | ||||
*/ | */ | ||||
savuid = p->p_cred->p_ruid; | savuid = p->p_cred->p_ruid; | ||||
p->p_cred->p_ruid = cred->cr_uid; | p->p_cred->p_ruid = cred->cr_uid; | ||||
if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA), | if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA), | ||||
cred->cr_uid, (caddr_t)&dqb)) | cred->cr_uid, &dqb)) | ||||
freenum = min(dqb.dqb_isoftlimit-dqb.dqb_curinodes, | freenum = min(dqb.dqb_isoftlimit-dqb.dqb_curinodes, | ||||
freenum); | freenum); | ||||
p->p_cred->p_ruid = savuid; | p->p_cred->p_ruid = savuid; | ||||
#endif /* QUOTA */ | #endif /* QUOTA */ | ||||
NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); | NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); | ||||
*tl++ = 0; | *tl++ = 0; | ||||
*tl = txdr_unsigned(freenum); | *tl = txdr_unsigned(freenum); | ||||
retnum += NFSX_HYPER; | retnum += NFSX_HYPER; | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | #ifdef QUOTA | ||||
/* | /* | ||||
* ufs_quotactl() insists that the uid argument | * ufs_quotactl() insists that the uid argument | ||||
* equal p_ruid for non-root quota access, so | * equal p_ruid for non-root quota access, so | ||||
* we'll just make sure that's the case. | * we'll just make sure that's the case. | ||||
*/ | */ | ||||
savuid = p->p_cred->p_ruid; | savuid = p->p_cred->p_ruid; | ||||
p->p_cred->p_ruid = cred->cr_uid; | p->p_cred->p_ruid = cred->cr_uid; | ||||
if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA), | if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA), | ||||
cred->cr_uid, (caddr_t)&dqb)) | cred->cr_uid, &dqb)) | ||||
freenum = min(dqb.dqb_bhardlimit, freenum); | freenum = min(dqb.dqb_bhardlimit, freenum); | ||||
p->p_cred->p_ruid = savuid; | p->p_cred->p_ruid = savuid; | ||||
#endif /* QUOTA */ | #endif /* QUOTA */ | ||||
NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); | NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); | ||||
uquad = (u_int64_t)freenum; | uquad = (u_int64_t)freenum; | ||||
NFSQUOTABLKTOBYTE(uquad, fs->f_bsize); | NFSQUOTABLKTOBYTE(uquad, fs->f_bsize); | ||||
txdr_hyper(uquad, tl); | txdr_hyper(uquad, tl); | ||||
retnum += NFSX_HYPER; | retnum += NFSX_HYPER; | ||||
break; | break; | ||||
case NFSATTRBIT_QUOTASOFT: | case NFSATTRBIT_QUOTASOFT: | ||||
if (priv_check_cred(cred, PRIV_VFS_EXCEEDQUOTA)) | if (priv_check_cred(cred, PRIV_VFS_EXCEEDQUOTA)) | ||||
freenum = fs->f_bfree; | freenum = fs->f_bfree; | ||||
else | else | ||||
freenum = fs->f_bavail; | freenum = fs->f_bavail; | ||||
#ifdef QUOTA | #ifdef QUOTA | ||||
/* | /* | ||||
* ufs_quotactl() insists that the uid argument | * ufs_quotactl() insists that the uid argument | ||||
* equal p_ruid for non-root quota access, so | * equal p_ruid for non-root quota access, so | ||||
* we'll just make sure that's the case. | * we'll just make sure that's the case. | ||||
*/ | */ | ||||
savuid = p->p_cred->p_ruid; | savuid = p->p_cred->p_ruid; | ||||
p->p_cred->p_ruid = cred->cr_uid; | p->p_cred->p_ruid = cred->cr_uid; | ||||
if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA), | if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA), | ||||
cred->cr_uid, (caddr_t)&dqb)) | cred->cr_uid, &dqb)) | ||||
freenum = min(dqb.dqb_bsoftlimit, freenum); | freenum = min(dqb.dqb_bsoftlimit, freenum); | ||||
p->p_cred->p_ruid = savuid; | p->p_cred->p_ruid = savuid; | ||||
#endif /* QUOTA */ | #endif /* QUOTA */ | ||||
NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); | NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); | ||||
uquad = (u_int64_t)freenum; | uquad = (u_int64_t)freenum; | ||||
NFSQUOTABLKTOBYTE(uquad, fs->f_bsize); | NFSQUOTABLKTOBYTE(uquad, fs->f_bsize); | ||||
txdr_hyper(uquad, tl); | txdr_hyper(uquad, tl); | ||||
retnum += NFSX_HYPER; | retnum += NFSX_HYPER; | ||||
break; | break; | ||||
case NFSATTRBIT_QUOTAUSED: | case NFSATTRBIT_QUOTAUSED: | ||||
freenum = 0; | freenum = 0; | ||||
#ifdef QUOTA | #ifdef QUOTA | ||||
/* | /* | ||||
* ufs_quotactl() insists that the uid argument | * ufs_quotactl() insists that the uid argument | ||||
* equal p_ruid for non-root quota access, so | * equal p_ruid for non-root quota access, so | ||||
* we'll just make sure that's the case. | * we'll just make sure that's the case. | ||||
*/ | */ | ||||
savuid = p->p_cred->p_ruid; | savuid = p->p_cred->p_ruid; | ||||
p->p_cred->p_ruid = cred->cr_uid; | p->p_cred->p_ruid = cred->cr_uid; | ||||
if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA), | if (!VFS_QUOTACTL(mp, QCMD(Q_GETQUOTA,USRQUOTA), | ||||
cred->cr_uid, (caddr_t)&dqb)) | cred->cr_uid, &dqb)) | ||||
freenum = dqb.dqb_curblocks; | freenum = dqb.dqb_curblocks; | ||||
p->p_cred->p_ruid = savuid; | p->p_cred->p_ruid = savuid; | ||||
#endif /* QUOTA */ | #endif /* QUOTA */ | ||||
NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); | NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); | ||||
uquad = (u_int64_t)freenum; | uquad = (u_int64_t)freenum; | ||||
NFSQUOTABLKTOBYTE(uquad, fs->f_bsize); | NFSQUOTABLKTOBYTE(uquad, fs->f_bsize); | ||||
txdr_hyper(uquad, tl); | txdr_hyper(uquad, tl); | ||||
retnum += NFSX_HYPER; | retnum += NFSX_HYPER; | ||||
▲ Show 20 Lines • Show All 2,033 Lines • Show Last 20 Lines |