6 #include <afs/sysincludes.h> /* Standard vendor system headers */
7 #include <afsincludes.h> /* Afs-based standard headers */
8 #include <afs/afs_stats.h> /* statistics */
9 #include <sys/malloc.h>
10 #include <sys/namei.h>
12 #include <sys/syscall.h>
14 struct vcache *afs_globalVp = 0;
15 struct mount *afs_globalVFS = 0;
16 int afs_pbuf_freecnt = -1;
25 afs_fhtovp(mp, fhp, vpp)
44 afs_start(mp, flags, p)
49 afs_pbuf_freecnt = nswbuf / 2 + 1;
50 return (0); /* nothing to do. ? */
54 afs_mount(mp, path, data, ndp, p)
55 register struct mount *mp;
58 struct nameidata *ndp;
61 /* ndp contains the mounted-from device. Just ignore it.
62 * we also don't care about our proc struct. */
65 if (mp->mnt_flag & MNT_UPDATE)
69 AFS_STATCNT(afs_mount);
71 if (afs_globalVFS) { /* Don't allow remounts. */
79 mp->mnt_stat.f_iosize = 8192;
81 (void)copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
82 memset(mp->mnt_stat.f_mntonname + size, 0, MNAMELEN - size);
83 memset(mp->mnt_stat.f_mntfromname, 0, MNAMELEN);
84 strcpy(mp->mnt_stat.f_mntfromname, "AFS");
85 /* null terminated string "AFS" will fit, just leave it be. */
86 strcpy(mp->mnt_stat.f_fstypename, "afs");
88 (void)afs_statfs(mp, &mp->mnt_stat, p);
93 afs_unmount(mp, flags, p)
100 AFS_STATCNT(afs_unmount);
109 afs_root(struct mount *mp, struct vnode **vpp)
112 struct vrequest treq;
113 register struct vcache *tvp = 0;
114 #ifdef AFS_FBSD50_ENV
115 struct thread *td = curthread;
116 struct ucred cr = *td->td_ucred;
118 struct proc *p = curproc;
119 struct ucred cr = *p->p_cred->pc_ucred;
123 AFS_STATCNT(afs_root);
124 if (afs_globalVp && (afs_globalVp->states & CStatd)) {
129 afs_PutVCache(afs_globalVp);
133 if (!(error = afs_InitReq(&treq, &cr)) && !(error = afs_CheckInit())) {
134 tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
135 /* we really want this to stay around */
145 #ifdef AFS_FBSD50_ENV
146 vn_lock(AFSTOV(tvp), LK_EXCLUSIVE | LK_RETRY, td);
148 vn_lock(AFSTOV(tvp), LK_EXCLUSIVE | LK_RETRY, p);
153 tvp->v.v_flag |= VROOT;
156 afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *vpp,
157 ICL_TYPE_INT32, error);
163 afs_vget(mp, lfl, vp)
168 #ifdef AFS_FBSD50_ENV
173 printf("vget called. help!\n");
174 if (vp->v_usecount < 0) {
175 vprint("bad usecount", vp);
178 error = vget(vp, lfl, curthread);
179 error = vget(vp, lfl, curproc);
181 insmntque(vp, afs_globalVFS); /* take off free list */
187 afs_statfs(struct mount *mp, struct statfs *abp, struct proc *p)
190 AFS_STATCNT(afs_statfs);
193 abp->f_type = MOUNT_AFS;
195 abp->f_bsize = mp->vfs_bsize;
196 abp->f_iosize = mp->vfs_bsize;
198 /* Fake a high number below to satisfy programs that use the statfs call
199 * to make sure that there's enough space in the device partition before
200 * storing something there.
202 abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
203 abp->f_ffree = 2000000;
205 abp->f_fsid.val[0] = mp->mnt_stat.f_fsid.val[0];
206 abp->f_fsid.val[1] = mp->mnt_stat.f_fsid.val[1];
207 if (abp != &mp->mnt_stat) {
208 abp->f_type = mp->mnt_vfc->vfc_typenum;
209 memcpy((caddr_t) & abp->f_mntonname[0],
210 (caddr_t) mp->mnt_stat.f_mntonname, MNAMELEN);
211 memcpy((caddr_t) & abp->f_mntfromname[0],
212 (caddr_t) mp->mnt_stat.f_mntfromname, MNAMELEN);
220 afs_sync(mp, waitfor, cred, p)
237 afs_init(struct vfsconf *vfc)
242 struct vfsops afs_vfsops = {
252 #ifdef AFS_FBSD50_ENV
257 #ifdef AFS_FBSD50_ENV