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. */
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,
113 struct vrequest treq;
114 register struct vcache *tvp=0;
115 struct proc *p=curproc;
118 cr=*p->p_cred->pc_ucred;
120 AFS_STATCNT(afs_root);
121 if (afs_globalVp && (afs_globalVp->states & CStatd)) {
126 afs_PutVCache(afs_globalVp);
130 if (!(error = afs_InitReq(&treq, &cr)) &&
131 !(error = afs_CheckInit())) {
132 tvp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
133 /* we really want this to stay around */
143 vn_lock(AFSTOV(tvp), LK_EXCLUSIVE | LK_RETRY, p);
147 tvp->v.v_flag |= VROOT;
150 afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *vpp,
151 ICL_TYPE_INT32, error);
157 afs_vget(mp, lfl, vp)
163 printf("vget called. help!\n");
164 if (vp->v_usecount < 0) {
165 vprint("bad usecount", vp);
168 error = vget(vp, lfl, curproc);
170 insmntque(vp, afs_globalVFS); /* take off free list */
174 int afs_statfs(struct mount *mp, struct statfs *abp, struct proc *p)
177 AFS_STATCNT(afs_statfs);
180 abp->f_type = MOUNT_AFS;
182 abp->f_bsize = mp->vfs_bsize;
183 abp->f_iosize = mp->vfs_bsize;
185 /* Fake a high number below to satisfy programs that use the statfs call
186 * to make sure that there's enough space in the device partition before
187 * storing something there.
189 abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
190 abp->f_ffree = 2000000;
192 abp->f_fsid.val[0] = mp->mnt_stat.f_fsid.val[0];
193 abp->f_fsid.val[1] = mp->mnt_stat.f_fsid.val[1];
194 if (abp != &mp->mnt_stat) {
195 abp->f_type = mp->mnt_vfc->vfc_typenum;
196 memcpy((caddr_t)&abp->f_mntonname[0], (caddr_t)mp->mnt_stat.f_mntonname, MNAMELEN);
197 memcpy((caddr_t)&abp->f_mntfromname[0], (caddr_t)mp->mnt_stat.f_mntfromname, MNAMELEN);
204 int afs_sync(mp, waitfor, cred, p)
218 int afs_init(struct vfsconf *vfc) {
222 struct vfsops afs_vfsops = {
232 #ifdef AFS_FBSD50_ENV
237 #ifdef AFS_FBSD50_ENV