The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/nfs4client/nfs4_vfs_subs.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* $FreeBSD$ */
    2 /* $Id: nfs4_vfs_subs.c,v 1.5 2003/11/05 14:59:00 rees Exp $ */
    3 
    4 /*-
    5  * copyright (c) 2003
    6  * the regents of the university of michigan
    7  * all rights reserved
    8  * 
    9  * permission is granted to use, copy, create derivative works and redistribute
   10  * this software and such derivative works for any purpose, so long as the name
   11  * of the university of michigan is not used in any advertising or publicity
   12  * pertaining to the use or distribution of this software without specific,
   13  * written prior authorization.  if the above copyright notice or any other
   14  * identification of the university of michigan is included in any copy of any
   15  * portion of this software, then the disclaimer below must also be included.
   16  * 
   17  * this software is provided as is, without representation from the university
   18  * of michigan as to its fitness for any purpose, and without warranty by the
   19  * university of michigan of any kind, either express or implied, including
   20  * without limitation the implied warranties of merchantability and fitness for
   21  * a particular purpose. the regents of the university of michigan shall not be
   22  * liable for any damages, including special, indirect, incidental, or
   23  * consequential damages, with respect to any claim arising out of or in
   24  * connection with the use of the software, even if it has been or is hereafter
   25  * advised of the possibility of such damages.
   26  */
   27 
   28 #include <sys/param.h>
   29 #include <sys/systm.h>
   30 #include <sys/kernel.h>
   31 #include <sys/limits.h>
   32 #include <sys/lock.h>
   33 #include <sys/malloc.h>
   34 #include <sys/mbuf.h>
   35 #include <sys/module.h>
   36 #include <sys/mount.h>
   37 #include <sys/proc.h>
   38 #include <sys/socket.h>
   39 #include <sys/socketvar.h>
   40 #include <sys/sockio.h>
   41 #include <sys/vnode.h>
   42 
   43 #include <vm/vm.h>
   44 #include <vm/vm_extern.h>
   45 #include <vm/uma.h>
   46 
   47 #include <net/if.h>
   48 #include <net/route.h>
   49 #include <netinet/in.h>
   50 
   51 #include <rpc/rpcclnt.h>
   52 
   53 #include <nfs/rpcv2.h>
   54 #include <nfs/nfsproto.h>
   55 #include <nfsclient/nfs.h>
   56 #include <nfsclient/nfsmount.h>
   57 #include <nfs/xdr_subs.h>
   58 #include <nfsclient/nfsm_subs.h>
   59 #include <nfsclient/nfsdiskless.h>
   60 
   61 /* NFSv4 */
   62 #include <nfs4client/nfs4.h>
   63 #include <nfs4client/nfs4m_subs.h>
   64 #include <nfs4client/nfs4_vfs.h>
   65 
   66 #include <nfsclient/nfsnode.h>
   67 
   68 void
   69 nfs4_vfsop_fsinfo(struct nfsv4_fattr *fap, struct nfsmount *nmp)
   70 {
   71         uint32_t max;
   72 
   73         if (fap->fa4_valid & FA4V_FSID) {
   74                 nmp->nm_fsid.val[0] = fap->fa4_fsid_major;
   75                 nmp->nm_fsid.val[1] = fap->fa4_fsid_minor;
   76         }
   77         if (fap->fa4_valid & FA4V_MAXREAD) {
   78                 max = fap->fa4_maxread;
   79                 if (max < nmp->nm_rsize) {
   80                         nmp->nm_rsize = max & ~(NFS_FABLKSIZE - 1);
   81                         if (nmp->nm_rsize == 0)
   82                                 nmp->nm_rsize = max;
   83                 }
   84                 if (max < nmp->nm_readdirsize) {
   85                         nmp->nm_readdirsize = max & ~(NFS_DIRBLKSIZ - 1);
   86                         if (nmp->nm_readdirsize == 0)
   87                                 nmp->nm_readdirsize = max;
   88                 }
   89         }
   90         if (fap->fa4_valid & FA4V_MAXWRITE) {
   91                 max = fap->fa4_maxwrite;
   92                 if (max < nmp->nm_wsize) {
   93                         nmp->nm_wsize = max & ~(NFS_FABLKSIZE - 1);
   94                         if (nmp->nm_wsize == 0)
   95                                 nmp->nm_wsize = max;
   96                 }
   97         }
   98         if (fap->fa4_valid & FA4V_LEASE_TIME)
   99                 nmp->nm_lease_time = fap->fa4_lease_time;
  100 
  101         /* nmp->nm_flag |= NFSMNT_GOTFSINFO; */
  102 }
  103 
  104 void
  105 nfs4_vfsop_statfs(struct nfsv4_fattr *fap, struct statfs *sbp, struct mount *mp)
  106 {
  107         struct nfsmount *nmp = VFSTONFS(mp);
  108 
  109         sbp->f_iosize = nfs_iosize(nmp);
  110         sbp->f_bsize = NFS_FABLKSIZE;
  111 
  112         if (fap->fa4_valid & FA4V_FSID) {
  113                 sbp->f_fsid.val[0] = fap->fa4_fsid_major;
  114                 sbp->f_fsid.val[1] = fap->fa4_fsid_minor;
  115         }
  116 
  117         sbp->f_ffree = fap->fa4_valid & FA4V_FFREE ? fap->fa4_ffree : 0;
  118         /* sbp->f_ftotal = fa->fa4_valid & FA4_FTOTAL ? fa->fa4_ftotal : 0; */
  119         sbp->f_bavail = fap->fa4_valid & FA4V_SAVAIL ?
  120             fap->fa4_savail / NFS_FABLKSIZE : 500000;
  121         sbp->f_bfree = fap->fa4_valid & FA4V_SFREE ?
  122             fap->fa4_sfree / NFS_FABLKSIZE : 500000;
  123         sbp->f_blocks = fap->fa4_valid & FA4V_STOTAL ?
  124             fap->fa4_stotal / NFS_FABLKSIZE : 1000000;
  125 }

Cache object: 4d089e2c4a48989a88bd18be474aa9b0


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.