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_commonport.c 224086 2011-07-16 08:51:09Z zack $"); |
36 37/* 38 * Functions that need to be different for different versions of BSD 39 * kernel should be kept here, along with any global storage specific 40 * to this BSD variant. 41 */ 42#include <fs/nfs/nfsport.h> 43#include <sys/sysctl.h> --- 280 unchanged lines hidden (view full) --- 324 * Only happens if a _PC_xxx is added to the server, 325 * but this isn't updated. 326 */ 327 *retf = 0; 328 printf("nfsrvd pathconf flag=%d not supp\n", flag); 329 }; 330 error = 0; 331 } |
332 NFSEXITCODE(error); |
333 return (error); 334} 335 336/* Fake nfsrv_atroot. Just return 0 */ 337int 338nfsrv_atroot(struct vnode *vp, long *retp) 339{ 340 --- 82 unchanged lines hidden (view full) --- 423} 424 425static int 426nfssvc_nfscommon(struct thread *td, struct nfssvc_args *uap) 427{ 428 int error; 429 430 error = nfssvc_call(td, uap, td->td_ucred); |
431 NFSEXITCODE(error); |
432 return (error); 433} 434 435static int 436nfssvc_call(struct thread *p, struct nfssvc_args *uap, struct ucred *cred) 437{ 438 int error = EINVAL; 439 struct nfsd_idargs nid; 440 441 if (uap->flag & NFSSVC_IDNAME) { 442 error = copyin(uap->argp, (caddr_t)&nid, sizeof (nid)); 443 if (error) |
444 goto out; |
445 error = nfssvc_idname(&nid); |
446 goto out; |
447 } else if (uap->flag & NFSSVC_GETSTATS) { 448 error = copyout(&newnfsstats, 449 CAST_USER_ADDR_T(uap->argp), sizeof (newnfsstats)); 450 if (error == 0) { 451 if ((uap->flag & NFSSVC_ZEROCLTSTATS) != 0) { 452 newnfsstats.attrcache_hits = 0; 453 newnfsstats.attrcache_misses = 0; 454 newnfsstats.lookupcache_hits = 0; --- 45 unchanged lines hidden (view full) --- 500 newnfsstats.cllocallockowners = 0; 501 newnfsstats.cllocallocks = 0; 502 bzero(newnfsstats.srvrpccnt, 503 sizeof(newnfsstats.srvrpccnt)); 504 bzero(newnfsstats.cbrpccnt, 505 sizeof(newnfsstats.cbrpccnt)); 506 } 507 } |
508 goto out; |
509 } else if (uap->flag & NFSSVC_NFSUSERDPORT) { 510 u_short sockport; 511 512 error = copyin(uap->argp, (caddr_t)&sockport, 513 sizeof (u_short)); 514 if (!error) 515 error = nfsrv_nfsuserdport(sockport, p); 516 } else if (uap->flag & NFSSVC_NFSUSERDDELPORT) { 517 nfsrv_nfsuserddelport(); 518 error = 0; 519 } |
520 521out: 522 NFSEXITCODE(error); |
523 return (error); 524} 525 526/* 527 * called by all three modevent routines, so that it gets things 528 * initialized soon enough. 529 */ 530void --- 38 unchanged lines hidden (view full) --- 569nfscommon_modevent(module_t mod, int type, void *data) 570{ 571 int error = 0; 572 static int loaded = 0; 573 574 switch (type) { 575 case MOD_LOAD: 576 if (loaded) |
577 goto out; |
578 newnfs_portinit(); 579 mtx_init(&nfs_nameid_mutex, "nfs_nameid_mutex", NULL, MTX_DEF); 580 mtx_init(&nfs_sockl_mutex, "nfs_sockl_mutex", NULL, MTX_DEF); 581 mtx_init(&nfs_slock_mutex, "nfs_slock_mutex", NULL, MTX_DEF); 582 mtx_init(&nfs_req_mutex, "nfs_req_mutex", NULL, MTX_DEF); 583 mtx_init(&nfsrv_nfsuserdsock.nr_mtx, "nfsuserd", NULL, 584 MTX_DEF); 585 callout_init(&newnfsd_callout, CALLOUT_MPSAFE); --- 20 unchanged lines hidden (view full) --- 606 mtx_destroy(&nfs_req_mutex); 607 mtx_destroy(&nfsrv_nfsuserdsock.nr_mtx); 608 loaded = 0; 609 break; 610 default: 611 error = EOPNOTSUPP; 612 break; 613 } |
614 615out: 616 NFSEXITCODE(error); |
617 return error; 618} 619static moduledata_t nfscommon_mod = { 620 "nfscommon", 621 nfscommon_modevent, 622 NULL, 623}; 624DECLARE_MODULE(nfscommon, nfscommon_mod, SI_SUB_VFS, SI_ORDER_ANY); 625 626/* So that loader and kldload(2) can find us, wherever we are.. */ 627MODULE_VERSION(nfscommon, 1); 628MODULE_DEPEND(nfscommon, nfssvc, 1, 1, 1); 629MODULE_DEPEND(nfscommon, krpc, 1, 1, 1); 630 |