2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
19 #include <afsconfig.h>
20 #include "afs/param.h"
35 #include "rpc/types.h"
37 #include "netinet/in.h"
39 #include "rpc/types.h"
42 #include "h/syspest.h"
45 #include "afs/afs_osi.h"
46 #define RFTP_INTERNALS 1
47 #include "afs/volerrors.h"
51 #include "afs/exporter.h"
53 #include "afs/afs_stats.h"
55 /* In Aix one may specify an init routine routine which is called once during
56 * initialization of all gfs; one day we might need to actual do somehing here.
59 char *gfsp; /* this is really struct gfs *, but we do not use it */
61 extern int afs_gn_strategy();
62 #define AFS_VM_BUFS 50
64 /* For now nothing special is required during AFS initialization. */
65 AFS_STATCNT(afs_init);
67 (void)vm_mount(D_REMOTE, afs_gn_strategy, AFS_VM_BUFS);
72 /* Some extra handling is needed when calling the aix's version of the local
73 * RDWR module, particularly the usage of the uio structure to the lower
74 * routine. Note of significant importance to the AFS port is the offset
75 * in/out parameter, which in two cases returns a new value back. The cases
76 * are: (1) when it's a FIFO file (it's reset to zero) which we don't yet
77 * support in AFS and (2) in a regular case when we write
78 * (i.e. rw == UIO_WRITE) and are in appending mode (i.e. FAPPEND bit on)
79 * where offset is set to the file's size. None of these cases apply to us
80 * currently so no problems occur; caution if things change!
83 gop_rdwr(rw, vp, base, len, offset, segflg, unit, aresid)
87 #ifdef AFS_64BIT_KERNEL
94 int unit; /* Ignored */
96 struct uio uio_struct;
97 struct iovec uiovector;
100 memset(&uio_struct, 0, sizeof(uio_struct));
101 memset(&uiovector, 0, sizeof(uiovector));
103 AFS_STATCNT(gop_rdwr);
104 /* Set up the uio structure */
105 uiovector.iov_base = (caddr_t) base;
106 uiovector.iov_len = len;
108 uio_struct.uio_iov = &uiovector;
109 uio_struct.uio_iovcnt = 1;
110 uio_struct.uio_offset = *offset;
111 uio_struct.uio_segflg = AFS_UIOSYS;
112 uio_struct.uio_resid = len;
113 uio_struct.uio_fmode = (rw == UIO_READ ? FREAD : FWRITE);
115 #ifdef AFS_64BIT_KERNEL
117 VNOP_RDWR(vp, rw, (int32long64_t) (rw == UIO_READ ? FREAD : FWRITE),
118 &uio_struct, (ext_t) 0, (caddr_t) 0, (struct vattr *)0,
122 VNOP_RDWR(vp, rw, (rw == UIO_READ ? FREAD : FWRITE), &uio_struct,
123 NULL, NULL, NULL, &afs_osi_cred);
125 *aresid = uio_struct.uio_resid;
130 /* Since in AIX a vnode is included in linked lists of its associated vfs and
131 * gnode we need to remove these links when removing an AFS vnode (part of the
132 * vcache entry). Note that since the accompanied gnode was alloced during
133 * vcache creation, we have to free it here too. We don't bother with the
134 * vnode itself since it's part of the vcache entry and it's handled fine by
137 * Note that there is a 1-1 mapping from AFS vnodes to gnodes, so there is
138 * no linked list of gnodes to remove this element from.
144 struct vfs *vfsp = vp->v_vfsp;
146 /* Unlink the vnode from the list the vfs has hanging of it */
147 tvp = vfsp->vfs_vnodes;
149 vfsp->vfs_vnodes = vp->v_vfsnext;
150 if (vp->v_vfsnext != NULL)
151 vp->v_vfsnext->v_vfsprev = vp->v_vfsprev;
152 if (vp->v_vfsprev != NULL)
153 vp->v_vfsprev->v_vfsnext = vp->v_vfsnext;
156 /* Free the allocated gnode that was accompanying the vcache's vnode */
158 osi_FreeSmallSpace(vp->v_gnode);
166 * afs_suser() returns true if the caller is superuser, false otherwise.
168 * Note that it must NOT set errno.
171 afs_suser(void *credp)