nfs_commonsubs.c (191783) | nfs_commonsubs.c (191990) |
---|---|
1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/fs/nfs/nfs_commonsubs.c 191783 2009-05-04 15:23:58Z rmacklem $"); | 35__FBSDID("$FreeBSD: head/sys/fs/nfs/nfs_commonsubs.c 191990 2009-05-11 15:33:26Z attilio $"); |
36 37/* 38 * These functions support the macros and help fiddle mbuf chains for 39 * the nfs op functions. They do things like create the rpc header and 40 * copy data between mbuf chains and uio lists. 41 */ 42#ifndef APPLEKEXT 43#include <fs/nfs/nfsport.h> --- 1397 unchanged lines hidden (view full) --- 1441 /* 1442 * ufs_quotactl() insists that the uid argument 1443 * equal p_ruid for non-root quota access, so 1444 * we'll just make sure that's the case. 1445 */ 1446 savuid = p->p_cred->p_ruid; 1447 p->p_cred->p_ruid = cred->cr_uid; 1448 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, | 36 37/* 38 * These functions support the macros and help fiddle mbuf chains for 39 * the nfs op functions. They do things like create the rpc header and 40 * copy data between mbuf chains and uio lists. 41 */ 42#ifndef APPLEKEXT 43#include <fs/nfs/nfsport.h> --- 1397 unchanged lines hidden (view full) --- 1441 /* 1442 * ufs_quotactl() insists that the uid argument 1443 * equal p_ruid for non-root quota access, so 1444 * we'll just make sure that's the case. 1445 */ 1446 savuid = p->p_cred->p_ruid; 1447 p->p_cred->p_ruid = cred->cr_uid; 1448 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, |
1449 USRQUOTA), cred->cr_uid, (caddr_t)&dqb, p)) | 1449 USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) |
1450 freenum = min(dqb.dqb_bhardlimit, freenum); 1451 p->p_cred->p_ruid = savuid; 1452#endif /* QUOTA */ 1453 uquad = (u_int64_t)freenum; 1454 NFSQUOTABLKTOBYTE(uquad, sbp->f_bsize); 1455 } 1456 if (compare && !(*retcmpp)) { 1457 if (uquad != fxdr_hyper(tl)) --- 12 unchanged lines hidden (view full) --- 1470 /* 1471 * ufs_quotactl() insists that the uid argument 1472 * equal p_ruid for non-root quota access, so 1473 * we'll just make sure that's the case. 1474 */ 1475 savuid = p->p_cred->p_ruid; 1476 p->p_cred->p_ruid = cred->cr_uid; 1477 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, | 1450 freenum = min(dqb.dqb_bhardlimit, freenum); 1451 p->p_cred->p_ruid = savuid; 1452#endif /* QUOTA */ 1453 uquad = (u_int64_t)freenum; 1454 NFSQUOTABLKTOBYTE(uquad, sbp->f_bsize); 1455 } 1456 if (compare && !(*retcmpp)) { 1457 if (uquad != fxdr_hyper(tl)) --- 12 unchanged lines hidden (view full) --- 1470 /* 1471 * ufs_quotactl() insists that the uid argument 1472 * equal p_ruid for non-root quota access, so 1473 * we'll just make sure that's the case. 1474 */ 1475 savuid = p->p_cred->p_ruid; 1476 p->p_cred->p_ruid = cred->cr_uid; 1477 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, |
1478 USRQUOTA), cred->cr_uid, (caddr_t)&dqb, p)) | 1478 USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) |
1479 freenum = min(dqb.dqb_bsoftlimit, freenum); 1480 p->p_cred->p_ruid = savuid; 1481#endif /* QUOTA */ 1482 uquad = (u_int64_t)freenum; 1483 NFSQUOTABLKTOBYTE(uquad, sbp->f_bsize); 1484 } 1485 if (compare && !(*retcmpp)) { 1486 if (uquad != fxdr_hyper(tl)) --- 9 unchanged lines hidden (view full) --- 1496 /* 1497 * ufs_quotactl() insists that the uid argument 1498 * equal p_ruid for non-root quota access, so 1499 * we'll just make sure that's the case. 1500 */ 1501 savuid = p->p_cred->p_ruid; 1502 p->p_cred->p_ruid = cred->cr_uid; 1503 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, | 1479 freenum = min(dqb.dqb_bsoftlimit, freenum); 1480 p->p_cred->p_ruid = savuid; 1481#endif /* QUOTA */ 1482 uquad = (u_int64_t)freenum; 1483 NFSQUOTABLKTOBYTE(uquad, sbp->f_bsize); 1484 } 1485 if (compare && !(*retcmpp)) { 1486 if (uquad != fxdr_hyper(tl)) --- 9 unchanged lines hidden (view full) --- 1496 /* 1497 * ufs_quotactl() insists that the uid argument 1498 * equal p_ruid for non-root quota access, so 1499 * we'll just make sure that's the case. 1500 */ 1501 savuid = p->p_cred->p_ruid; 1502 p->p_cred->p_ruid = cred->cr_uid; 1503 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, |
1504 USRQUOTA), cred->cr_uid, (caddr_t)&dqb, p)) | 1504 USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) |
1505 freenum = dqb.dqb_curblocks; 1506 p->p_cred->p_ruid = savuid; 1507#endif /* QUOTA */ 1508 uquad = (u_int64_t)freenum; 1509 NFSQUOTABLKTOBYTE(uquad, sbp->f_bsize); 1510 } 1511 if (compare && !(*retcmpp)) { 1512 if (uquad != fxdr_hyper(tl)) --- 425 unchanged lines hidden (view full) --- 1938 aclp = naclp; 1939 } 1940 nfsvno_getfs(&fsinf, isdgram); 1941#ifndef APPLE 1942 /* 1943 * Get the VFS_STATFS(), since some attributes need them. 1944 */ 1945 if (NFSISSETSTATFS_ATTRBIT(retbitp)) { | 1505 freenum = dqb.dqb_curblocks; 1506 p->p_cred->p_ruid = savuid; 1507#endif /* QUOTA */ 1508 uquad = (u_int64_t)freenum; 1509 NFSQUOTABLKTOBYTE(uquad, sbp->f_bsize); 1510 } 1511 if (compare && !(*retcmpp)) { 1512 if (uquad != fxdr_hyper(tl)) --- 425 unchanged lines hidden (view full) --- 1938 aclp = naclp; 1939 } 1940 nfsvno_getfs(&fsinf, isdgram); 1941#ifndef APPLE 1942 /* 1943 * Get the VFS_STATFS(), since some attributes need them. 1944 */ 1945 if (NFSISSETSTATFS_ATTRBIT(retbitp)) { |
1946 error = VFS_STATFS(vnode_mount(vp), &fs, p); | 1946 error = VFS_STATFS(vnode_mount(vp), &fs); |
1947 if (error != 0) { 1948 if (reterr) { 1949 nd->nd_repstat = NFSERR_ACCES; 1950 return (0); 1951 } 1952 NFSCLRSTATFS_ATTRBIT(retbitp); 1953 } 1954 } --- 178 unchanged lines hidden (view full) --- 2133 /* 2134 * ufs_quotactl() insists that the uid argument 2135 * equal p_ruid for non-root quota access, so 2136 * we'll just make sure that's the case. 2137 */ 2138 savuid = p->p_cred->p_ruid; 2139 p->p_cred->p_ruid = cred->cr_uid; 2140 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), | 1947 if (error != 0) { 1948 if (reterr) { 1949 nd->nd_repstat = NFSERR_ACCES; 1950 return (0); 1951 } 1952 NFSCLRSTATFS_ATTRBIT(retbitp); 1953 } 1954 } --- 178 unchanged lines hidden (view full) --- 2133 /* 2134 * ufs_quotactl() insists that the uid argument 2135 * equal p_ruid for non-root quota access, so 2136 * we'll just make sure that's the case. 2137 */ 2138 savuid = p->p_cred->p_ruid; 2139 p->p_cred->p_ruid = cred->cr_uid; 2140 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), |
2141 cred->cr_uid, (caddr_t)&dqb, p)) | 2141 cred->cr_uid, (caddr_t)&dqb)) |
2142 freenum = min(dqb.dqb_isoftlimit-dqb.dqb_curinodes, 2143 freenum); 2144 p->p_cred->p_ruid = savuid; 2145#endif /* QUOTA */ 2146 NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); 2147 *tl++ = 0; 2148 *tl = txdr_unsigned(freenum); 2149 retnum += NFSX_HYPER; --- 90 unchanged lines hidden (view full) --- 2240 /* 2241 * ufs_quotactl() insists that the uid argument 2242 * equal p_ruid for non-root quota access, so 2243 * we'll just make sure that's the case. 2244 */ 2245 savuid = p->p_cred->p_ruid; 2246 p->p_cred->p_ruid = cred->cr_uid; 2247 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), | 2142 freenum = min(dqb.dqb_isoftlimit-dqb.dqb_curinodes, 2143 freenum); 2144 p->p_cred->p_ruid = savuid; 2145#endif /* QUOTA */ 2146 NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); 2147 *tl++ = 0; 2148 *tl = txdr_unsigned(freenum); 2149 retnum += NFSX_HYPER; --- 90 unchanged lines hidden (view full) --- 2240 /* 2241 * ufs_quotactl() insists that the uid argument 2242 * equal p_ruid for non-root quota access, so 2243 * we'll just make sure that's the case. 2244 */ 2245 savuid = p->p_cred->p_ruid; 2246 p->p_cred->p_ruid = cred->cr_uid; 2247 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), |
2248 cred->cr_uid, (caddr_t)&dqb, p)) | 2248 cred->cr_uid, (caddr_t)&dqb)) |
2249 freenum = min(dqb.dqb_bhardlimit, freenum); 2250 p->p_cred->p_ruid = savuid; 2251#endif /* QUOTA */ 2252 NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); 2253 uquad = (u_int64_t)freenum; 2254 NFSQUOTABLKTOBYTE(uquad, fs.f_bsize); 2255 txdr_hyper(uquad, tl); 2256 retnum += NFSX_HYPER; --- 7 unchanged lines hidden (view full) --- 2264 /* 2265 * ufs_quotactl() insists that the uid argument 2266 * equal p_ruid for non-root quota access, so 2267 * we'll just make sure that's the case. 2268 */ 2269 savuid = p->p_cred->p_ruid; 2270 p->p_cred->p_ruid = cred->cr_uid; 2271 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), | 2249 freenum = min(dqb.dqb_bhardlimit, freenum); 2250 p->p_cred->p_ruid = savuid; 2251#endif /* QUOTA */ 2252 NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); 2253 uquad = (u_int64_t)freenum; 2254 NFSQUOTABLKTOBYTE(uquad, fs.f_bsize); 2255 txdr_hyper(uquad, tl); 2256 retnum += NFSX_HYPER; --- 7 unchanged lines hidden (view full) --- 2264 /* 2265 * ufs_quotactl() insists that the uid argument 2266 * equal p_ruid for non-root quota access, so 2267 * we'll just make sure that's the case. 2268 */ 2269 savuid = p->p_cred->p_ruid; 2270 p->p_cred->p_ruid = cred->cr_uid; 2271 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), |
2272 cred->cr_uid, (caddr_t)&dqb, p)) | 2272 cred->cr_uid, (caddr_t)&dqb)) |
2273 freenum = min(dqb.dqb_bsoftlimit, freenum); 2274 p->p_cred->p_ruid = savuid; 2275#endif /* QUOTA */ 2276 NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); 2277 uquad = (u_int64_t)freenum; 2278 NFSQUOTABLKTOBYTE(uquad, fs.f_bsize); 2279 txdr_hyper(uquad, tl); 2280 retnum += NFSX_HYPER; --- 4 unchanged lines hidden (view full) --- 2285 /* 2286 * ufs_quotactl() insists that the uid argument 2287 * equal p_ruid for non-root quota access, so 2288 * we'll just make sure that's the case. 2289 */ 2290 savuid = p->p_cred->p_ruid; 2291 p->p_cred->p_ruid = cred->cr_uid; 2292 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), | 2273 freenum = min(dqb.dqb_bsoftlimit, freenum); 2274 p->p_cred->p_ruid = savuid; 2275#endif /* QUOTA */ 2276 NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); 2277 uquad = (u_int64_t)freenum; 2278 NFSQUOTABLKTOBYTE(uquad, fs.f_bsize); 2279 txdr_hyper(uquad, tl); 2280 retnum += NFSX_HYPER; --- 4 unchanged lines hidden (view full) --- 2285 /* 2286 * ufs_quotactl() insists that the uid argument 2287 * equal p_ruid for non-root quota access, so 2288 * we'll just make sure that's the case. 2289 */ 2290 savuid = p->p_cred->p_ruid; 2291 p->p_cred->p_ruid = cred->cr_uid; 2292 if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), |
2293 cred->cr_uid, (caddr_t)&dqb, p)) | 2293 cred->cr_uid, (caddr_t)&dqb)) |
2294 freenum = dqb.dqb_curblocks; 2295 p->p_cred->p_ruid = savuid; 2296#endif /* QUOTA */ 2297 NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); 2298 uquad = (u_int64_t)freenum; 2299 NFSQUOTABLKTOBYTE(uquad, fs.f_bsize); 2300 txdr_hyper(uquad, tl); 2301 retnum += NFSX_HYPER; --- 1103 unchanged lines hidden --- | 2294 freenum = dqb.dqb_curblocks; 2295 p->p_cred->p_ruid = savuid; 2296#endif /* QUOTA */ 2297 NFSM_BUILD(tl, u_int32_t *, NFSX_HYPER); 2298 uquad = (u_int64_t)freenum; 2299 NFSQUOTABLKTOBYTE(uquad, fs.f_bsize); 2300 txdr_hyper(uquad, tl); 2301 retnum += NFSX_HYPER; --- 1103 unchanged lines hidden --- |