BSD 4_3_Reno release
[unix-history] / usr / src / sys / nfs / nfsm_subs.h
index 764c49c..d0edf1c 100644 (file)
@@ -5,19 +5,22 @@
  * This code is derived from software contributed to Berkeley by
  * Rick Macklem at The University of Guelph.
  *
  * This code is derived from software contributed to Berkeley by
  * Rick Macklem at The University of Guelph.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * Redistribution is only permitted until one year after the first shipment
+ * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
+ * binary forms are permitted provided that: (1) source distributions retain
+ * this entire copyright notice and comment, and (2) distributions including
+ * binaries display the following acknowledgement:  This product includes
+ * software developed by the University of California, Berkeley and its
+ * contributors'' in the documentation or other materials provided with the
+ * distribution and in all advertising materials mentioning features or use
+ * of this software.  Neither the name of the University nor the names of
+ * its contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  *
- *     @(#)nfsm_subs.h 7.6 (Berkeley) %G%
+ *     @(#)nfsm_subs.h 7.10 (Berkeley) 6/28/90
  */
 
 /*
  */
 
 /*
  * First define what the actual subs. return
  */
 extern struct mbuf *nfsm_reqh();
  * First define what the actual subs. return
  */
 extern struct mbuf *nfsm_reqh();
-extern struct vnode *nfs_fhtovp();
 
 
-/*
- * To try and deal with different variants of mbuf.h, I have used the
- * following defs. If M_HASCL is not defined in an older the 4.4bsd mbuf.h,
- * you will have to use a different ifdef
- */
-#ifdef M_HASCL
-#define        NFSMCLGET(m, w) MCLGET(m)
-#define        NFSMGETHDR(m)   MGET(m, M_WAIT, MT_DATA)
-#define        MHLEN           MLEN
-#define        NFSMINOFF(m) \
-               if (M_HASCL(m)) \
-                       (m)->m_off = ((int)MTOCL(m))-(int)(m); \
-               else \
-                       (m)->m_off = MMINOFF
-#define        NFSMADV(m, s)   (m)->m_off += (s)
-#define        NFSMSIZ(m)      ((M_HASCL(m))?MCLBYTES:MLEN)
-#define        m_nextpkt       m_act
-#define        NFSMCOPY(m, o, l, w)    m_copy((m), (o), (l))
-#else
 #define        M_HASCL(m)      ((m)->m_flags & M_EXT)
 #define        M_HASCL(m)      ((m)->m_flags & M_EXT)
-#define        NFSMCLGET       MCLGET
 #define        NFSMGETHDR(m) \
                MGETHDR(m, M_WAIT, MT_DATA); \
                (m)->m_pkthdr.len = 0; \
 #define        NFSMGETHDR(m) \
                MGETHDR(m, M_WAIT, MT_DATA); \
                (m)->m_pkthdr.len = 0; \
@@ -65,16 +47,6 @@ extern struct vnode *nfs_fhtovp();
 #define        NFSMADV(m, s)   (m)->m_data += (s)
 #define        NFSMSIZ(m)      ((M_HASCL(m))?MCLBYTES: \
                                (((m)->m_flags & M_PKTHDR)?MHLEN:MLEN))
 #define        NFSMADV(m, s)   (m)->m_data += (s)
 #define        NFSMSIZ(m)      ((M_HASCL(m))?MCLBYTES: \
                                (((m)->m_flags & M_PKTHDR)?MHLEN:MLEN))
-#define        NFSMCOPY        m_copym
-#endif
-
-#ifndef MCLBYTES
-#define        MCLBYTES        CLBYTES
-#endif
-
-#ifndef MT_CONTROL
-#define        MT_CONTROL      MT_RIGHTS
-#endif
 
 /*
  * Now for the macros that do the simple stuff and call the functions
 
 /*
  * Now for the macros that do the simple stuff and call the functions
@@ -209,8 +181,8 @@ extern struct vnode *nfs_fhtovp();
 
 #define nfsm_rndup(a)  (((a)+3)&(~0x3))
 
 
 #define nfsm_rndup(a)  (((a)+3)&(~0x3))
 
-#define        nfsm_request(v, t)      \
-               if (error = nfs_request((v), mreq, xid, 5*(t), \
+#define        nfsm_request(v, t, p, h)        \
+               if (error = nfs_request((v), mreq, xid, (t), (p), (h), \
                   (v)->v_mount, &mrep, &md, &dpos)) \
                        goto nfsmout
 
                   (v)->v_mount, &mrep, &md, &dpos)) \
                        goto nfsmout
 
@@ -231,12 +203,6 @@ extern struct vnode *nfs_fhtovp();
                        goto nfsmout; \
                }
 
                        goto nfsmout; \
                }
 
-#define        nfsm_srverr \
-               { \
-                       m_freem(mrep); \
-                       return(ENOBUFS); \
-               }
-
 #define        nfsm_srvdone \
                nfsmout: \
                return(error)
 #define        nfsm_srvdone \
                nfsmout: \
                return(error)
@@ -286,7 +252,7 @@ extern struct vnode *nfs_fhtovp();
 #define        nfsm_clget \
                if (bp >= be) { \
                        MGET(mp, M_WAIT, MT_DATA); \
 #define        nfsm_clget \
                if (bp >= be) { \
                        MGET(mp, M_WAIT, MT_DATA); \
-                       NFSMCLGET(mp, M_WAIT); \
+                       MCLGET(mp, M_WAIT); \
                        mp->m_len = NFSMSIZ(mp); \
                        if (mp3 == NULL) \
                                mp3 = mp2 = mp; \
                        mp->m_len = NFSMSIZ(mp); \
                        if (mp3 == NULL) \
                                mp3 = mp2 = mp; \
@@ -307,8 +273,11 @@ extern struct vnode *nfs_fhtovp();
        fp->fa_gid = txdr_unsigned(vap->va_gid); \
        fp->fa_size = txdr_unsigned(vap->va_size); \
        fp->fa_blocksize = txdr_unsigned(vap->va_blocksize); \
        fp->fa_gid = txdr_unsigned(vap->va_gid); \
        fp->fa_size = txdr_unsigned(vap->va_size); \
        fp->fa_blocksize = txdr_unsigned(vap->va_blocksize); \
-       fp->fa_rdev = txdr_unsigned(vap->va_rdev); \
-       fp->fa_blocks = txdr_unsigned(vap->va_bytes / vap->va_blocksize); \
+       if (vap->va_type == VFIFO) \
+               fp->fa_rdev = 0xffffffff; \
+       else \
+               fp->fa_rdev = txdr_unsigned(vap->va_rdev); \
+       fp->fa_blocks = txdr_unsigned(vap->va_bytes / NFS_FABLKSIZE); \
        fp->fa_fsid = txdr_unsigned(vap->va_fsid); \
        fp->fa_fileid = txdr_unsigned(vap->va_fileid); \
        fp->fa_atime.tv_sec = txdr_unsigned(vap->va_atime.tv_sec); \
        fp->fa_fsid = txdr_unsigned(vap->va_fsid); \
        fp->fa_fileid = txdr_unsigned(vap->va_fileid); \
        fp->fa_atime.tv_sec = txdr_unsigned(vap->va_atime.tv_sec); \