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;
24 afs_fhtovp(mp, fhp, vpp)
43 afs_start(mp, flags, p)
48 afs_pbuf_freecnt = nswbuf / 2 + 1;
49 return (0); /* nothing to do. ? */
53 afs_mount(mp, path, data, ndp, p)
54 register struct mount *mp;
57 struct nameidata *ndp;
60 /* ndp contains the mounted-from device. Just ignore it.
61 we also don't care about our proc struct. */
64 if (mp->mnt_flag & MNT_UPDATE)
68 AFS_STATCNT(afs_mount);
70 if (afs_globalVFS) { /* Don't allow remounts. */
78 mp->mnt_stat.f_iosize=8192;
80 (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN-1, &size);
81 memset(mp->mnt_stat.f_mntonname + size, 0, MNAMELEN - size);
82 memset(mp->mnt_stat.f_mntfromname, 0, MNAMELEN);
83 strcpy(mp->mnt_stat.f_mntfromname, "AFS");
84 /* null terminated string "AFS" will fit, just leave it be. */
85 strcpy(mp->mnt_stat.f_fstypename, "afs");
87 (void) afs_statfs(mp, &mp->mnt_stat, p);
92 afs_unmount(mp, flags, p)
99 AFS_STATCNT(afs_unmount);
108 afs_root(struct mount *mp,
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)) &&
134 !(error = afs_CheckInit())) {
135 tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
136 /* we really want this to stay around */
146 #ifdef AFS_FBSD50_ENV
147 vn_lock(AFSTOV(tvp), LK_EXCLUSIVE | LK_RETRY, td);
149 vn_lock(AFSTOV(tvp), LK_EXCLUSIVE | LK_RETRY, p);
154 tvp->v.v_flag |= VROOT;
157 afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *vpp,
158 ICL_TYPE_INT32, error);
164 afs_vget(mp, lfl, vp)
171 printf("vget called. help!\n");
172 if (vp->v_usecount < 0) {
173 vprint("bad usecount", vp);
176 #ifdef AFS_FBSD50_ENV
177 error = vget(vp, lfl, curthread);
179 error = vget(vp, lfl, curproc);
182 insmntque(vp, afs_globalVFS); /* take off free list */
186 int afs_statfs(struct mount *mp, struct statfs *abp, struct proc *p)
189 AFS_STATCNT(afs_statfs);
192 abp->f_type = MOUNT_AFS;
194 abp->f_bsize = mp->vfs_bsize;
195 abp->f_iosize = mp->vfs_bsize;
197 /* Fake a high number below to satisfy programs that use the statfs call
198 * to make sure that there's enough space in the device partition before
199 * storing something there.
201 abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
202 abp->f_ffree = 2000000;
204 abp->f_fsid.val[0] = mp->mnt_stat.f_fsid.val[0];
205 abp->f_fsid.val[1] = mp->mnt_stat.f_fsid.val[1];
206 if (abp != &mp->mnt_stat) {
207 abp->f_type = mp->mnt_vfc->vfc_typenum;
208 memcpy((caddr_t)&abp->f_mntonname[0], (caddr_t)mp->mnt_stat.f_mntonname, MNAMELEN);
209 memcpy((caddr_t)&abp->f_mntfromname[0], (caddr_t)mp->mnt_stat.f_mntfromname, MNAMELEN);
216 int afs_sync(mp, waitfor, cred, p)
230 int afs_init(struct vfsconf *vfc) {
234 struct vfsops afs_vfsops = {
244 #ifdef AFS_FBSD50_ENV
249 #ifdef AFS_FBSD50_ENV