STABLE14-fbsd53-20041027

support for FreeBSD 5.3
builds and runs as well as it did on 5.2


(cherry picked from commit e751ec6a3683a175e1cdad910dd1311d61f632e1)
This commit is contained in:
Jim Rees 2004-11-09 17:11:34 +00:00 committed by Derrick Brashear
parent 94fc82a5df
commit 2ca944def6
2 changed files with 39 additions and 12 deletions

View File

@ -43,21 +43,25 @@ afs_module_handler(module_t mod, int what, void *arg)
case MOD_LOAD:
if (inited) {
printf("afs cannot be MOD_LOAD'd more than once\n");
error = -1;
error = EBUSY;
break;
}
if (sysent[AFS_SYSCALL].sy_call != nosys
&& sysent[AFS_SYSCALL].sy_call != lkmnosys) {
printf("AFS_SYSCALL in use. aborting\n");
error = -1;
error = EBUSY;
break;
}
memset(&afs_vfsconf, 0, sizeof(struct vfsconf));
#ifdef AFS_FBSD53_ENV
afs_vfsconf.vfc_version = VFS_VERSION;
#endif
strcpy(afs_vfsconf.vfc_name, "AFS");
afs_vfsconf.vfc_vfsops = &afs_vfsops;
afs_vfsconf.vfc_typenum = -1; /* set by vfs_register */
afs_vfsconf.vfc_flags = VFCF_NETWORK;
vfs_register(&afs_vfsconf); /* doesn't fail */
if ((error = vfs_register(&afs_vfsconf)) != 0)
break;
vfs_add_vnodeops(&afs_vnodeop_opv_desc);
osi_Init();
#if 0
@ -80,11 +84,10 @@ afs_module_handler(module_t mod, int what, void *arg)
break;
}
if (afs_globalVFS) {
error = -1;
error = EBUSY;
break;
}
if (vfs_unregister(&afs_vfsconf)) {
error = -1;
if ((error = vfs_unregister(&afs_vfsconf)) != 0) {
break;
}
vfs_rm_vnodeops(&afs_vnodeop_opv_desc);

View File

@ -12,8 +12,8 @@ RCSID
#include <sys/conf.h>
#include <sys/syscall.h>
struct vcache *afs_globalVp = 0;
struct mount *afs_globalVFS = 0;
struct vcache *afs_globalVp = NULL;
struct mount *afs_globalVFS = NULL;
int afs_pbuf_freecnt = -1;
#ifdef AFS_FBSD50_ENV
@ -29,9 +29,23 @@ afs_start(struct mount *mp, int flags, THREAD_OR_PROC)
return (0); /* nothing to do. ? */
}
#ifdef AFS_FBSD53_ENV
int
afs_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp,
afs_mount(struct mount *mp, struct thread *td)
{
int afs_omount(struct mount *mp, char *path, caddr_t data, struct thread *p);
return afs_omount(mp, NULL, NULL, td);
}
#endif
int
#ifdef AFS_FBSD53_ENV
afs_omount(struct mount *mp, char *path, caddr_t data, struct thread *p)
#else
afs_omount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp,
THREAD_OR_PROC)
#endif
{
/* ndp contains the mounted-from device. Just ignore it.
* we also don't care about our proc struct. */
@ -45,7 +59,7 @@ afs_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp,
if (afs_globalVFS) { /* Don't allow remounts. */
AFS_GUNLOCK();
return (EBUSY);
return EBUSY;
}
afs_globalVFS = mp;
@ -53,7 +67,8 @@ afs_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp,
vfs_getnewfsid(mp);
mp->mnt_stat.f_iosize = 8192;
(void)copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
if (path)
(void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
memset(mp->mnt_stat.f_mntonname + size, 0, MNAMELEN - size);
memset(mp->mnt_stat.f_mntfromname, 0, MNAMELEN);
strcpy(mp->mnt_stat.f_mntfromname, "AFS");
@ -89,13 +104,19 @@ afs_unmount(struct mount *mp, int flags, THREAD_OR_PROC)
}
int
#ifdef AFS_FBSD53_ENV
afs_root(struct mount *mp, struct vnode **vpp, struct thread *td)
#else
afs_root(struct mount *mp, struct vnode **vpp)
#endif
{
int error;
struct vrequest treq;
register struct vcache *tvp = 0;
#ifdef AFS_FBSD50_ENV
#ifndef AFS_FBSD53_ENV
struct thread *td = curthread;
#endif
struct ucred *cr = td->td_ucred;
#else
struct proc *p = curproc;
@ -202,7 +223,10 @@ afs_init(struct vfsconf *vfc)
}
struct vfsops afs_vfsops = {
#ifdef AFS_FBSD53_ENV
afs_mount,
#endif
afs_omount,
afs_start,
afs_unmount,
afs_root,
@ -217,6 +241,6 @@ struct vfsops afs_vfsops = {
vfs_stduninit,
vfs_stdextattrctl,
#ifdef AFS_FBSD50_ENV
NULL,
vfs_stdsysctl,
#endif
};