2 * (C) COPYRIGHT IBM CORPORATION 1987, 1988
3 * LICENSED MATERIALS - PROPERTY OF IBM
16 #include "../afs/param.h"
17 #include "../h/systm.h"
18 #include "../h/types.h"
19 #include "../h/errno.h"
20 #include "../h/stat.h"
21 #include "../h/user.h"
23 #include "../h/vattr.h"
24 #include "../h/file.h"
26 #include "../h/chownx.h"
27 #include "../h/systm.h"
28 #include "../h/access.h"
29 #include "../rpc/types.h"
30 #include "../afs/osi_vfs.h"
31 #include "../netinet/in.h"
32 #include "../h/mbuf.h"
33 #include "../rpc/types.h"
34 #include "../rpc/xdr.h"
35 #include "../h/vmuser.h"
36 #include "../h/syspest.h"
38 #include "../afs/stds.h"
39 #include "../afs/afs_osi.h"
40 #define RFTP_INTERNALS 1
41 #include "../afs/volerrors.h"
42 #include "../afsint/afsint.h"
43 #include "../afsint/vldbint.h"
44 #include "../afs/lock.h"
45 #include "../afs/exporter.h"
46 #include "../afs/afs.h"
47 #include "../afs/afs_stats.h"
49 /* In Aix one may specify an init routine routine which is called once during
50 * initialization of all gfs; one day we might need to actual do somehing here.
53 char *gfsp; /* this is really struct gfs *, but we do not use it */
55 extern int afs_gn_strategy();
56 #define AFS_VM_BUFS 50
58 /* For now nothing special is required during AFS initialization. */
59 AFS_STATCNT(afs_init);
61 (void) vm_mount(D_REMOTE, afs_gn_strategy, AFS_VM_BUFS);
66 /* Some extra handling is needed when calling the aix's version of the local
67 * RDWR module, particularly the usage of the uio structure to the lower
68 * routine. Note of significant importance to the AFS port is the offset
69 * in/out parameter, which in two cases returns a new value back. The cases
70 * are: (1) when it's a FIFO file (it's reset to zero) which we don't yet
71 * support in AFS and (2) in a regular case when we write
72 * (i.e. rw == UIO_WRITE) and are in appending mode (i.e. FAPPEND bit on)
73 * where offset is set to the file's size. None of these cases apply to us
74 * currently so no problems occur; caution if things change!
77 gop_rdwr(rw, vp, base, len, offset, segflg, unit, aresid)
84 int unit; /* Ignored */
86 struct uio uio_struct;
87 struct iovec uiovector;
90 AFS_STATCNT(gop_rdwr);
91 /* Set up the uio structure */
92 uiovector.iov_base = (caddr_t) base;
93 uiovector.iov_len = len;
95 uio_struct.uio_iov = &uiovector;
96 uio_struct.uio_iovcnt = 1;
97 uio_struct.uio_offset = *offset;
98 uio_struct.uio_segflg = AFS_UIOSYS;
99 uio_struct.uio_resid = len;
100 uio_struct.uio_fmode = (rw == UIO_READ ? FREAD : FWRITE);
102 code = VNOP_RDWR(vp, rw, (rw == UIO_READ ? FREAD : FWRITE), &uio_struct,
103 NULL, NULL, NULL, &afs_osi_cred);
104 *aresid = uio_struct.uio_resid;
109 /* Since in AIX a vnode is included in linked lists of its associated vfs and
110 * gnode we need to remove these links when removing an AFS vnode (part of the
111 * vcache entry). Note that since the accompanied gnode was alloced during
112 * vcache creation, we have to free it here too. We don't bother with the
113 * vnode itself since it's part of the vcache entry and it's handled fine by
116 * Note that there is a 1-1 mapping from AFS vnodes to gnodes, so there is
117 * no linked list of gnodes to remove this element from.
122 register struct vnode *tvp;
123 register struct vfs *vfsp = vp->v_vfsp;
125 /* Unlink the vnode from the list the vfs has hanging of it */
126 tvp = vfsp->vfs_vnodes;
128 vfsp->vfs_vnodes = vp->v_vfsnext;
129 if (vp->v_vfsnext != NULL)
130 vp->v_vfsnext->v_vfsprev = vp->v_vfsprev;
131 if (vp->v_vfsprev != NULL)
132 vp->v_vfsprev->v_vfsnext = vp->v_vfsnext;
135 /* Free the allocated gnode that was accompanying the vcache's vnode */
137 osi_FreeSmallSpace(vp->v_gnode);
145 * afs_suser() returns true if the caller is superuser, false otherwise.
147 * Note that it must NOT set errno.