STABLE14-freebsd60-20050422

Preliminary FreeBSD 6.0 support.
Builds, but unlikely to work.


(cherry picked from commit 8e3f1f45b0615e38aa8b8171b2d99e0d2d72cc0a)
This commit is contained in:
Jim Rees 2005-04-24 21:10:27 +00:00 committed by Derrick Brashear
parent 7d0f234a39
commit 86ac107057
7 changed files with 358 additions and 32 deletions

View File

@ -66,12 +66,19 @@ extern struct simplelock afs_rxglobal_lock;
#define VN_RELE(vp) vrele(vp)
#define VN_HOLD(vp) VREF(vp)
#ifdef AFS_FBSD60_ENV
#undef IsAfsVnode
#define IsAfsVnode(v) ((v)->v_op == &afs_vnodeops)
extern struct vop_vector afs_vnodeops;
#endif
#if defined(AFS_FBSD50_ENV)
#define VT_AFS "afs"
#define VROOT VV_ROOT
#define v_flag v_vflag
#define osi_curcred() (curthread->td_ucred)
#define afs_suser(x) (!suser(curthread))
#define getpid() (curthread->td_proc->p_pid)
#define simple_lock(x) mtx_lock(x)
#define simple_unlock(x) mtx_unlock(x)
#define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
@ -86,7 +93,7 @@ extern struct lock afs_global_lock;
#define osi_curcred() (curproc->p_cred->pc_ucred)
#define afs_suser(x) (!suser(curproc))
#define getpid() curproc
#define getpid() (curproc->p_pid)
#define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
extern struct proc *afs_global_owner;

View File

@ -79,6 +79,14 @@ afs_omount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp,
return 0;
}
#ifdef AFS_FBSD60_ENV
static int
afs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td)
{
return kernel_mount(ma, flags);
}
#endif
int
afs_unmount(struct mount *mp, int flags, THREAD_OR_PROC)
{
@ -211,7 +219,11 @@ afs_statfs(struct mount *mp, struct statfs *abp, THREAD_OR_PROC)
}
int
#ifdef AFS_FBSD60_ENV
afs_sync(struct mount *mp, int waitfor, struct thread *td)
#else
afs_sync(struct mount *mp, int waitfor, struct ucred *cred, THREAD_OR_PROC)
#endif
{
return 0;
}
@ -222,6 +234,19 @@ afs_init(struct vfsconf *vfc)
return 0;
}
#ifdef AFS_FBSD60_ENV
struct vfsops afs_vfsops = {
.vfs_init = afs_init,
.vfs_mount = afs_mount,
.vfs_cmount = afs_cmount,
.vfs_root = afs_root,
.vfs_statfs = afs_statfs,
.vfs_sync = afs_sync,
.vfs_uninit = vfs_stduninit,
.vfs_unmount = afs_unmount,
.vfs_sysctl = vfs_stdsysctl,
};
#else
struct vfsops afs_vfsops = {
#ifdef AFS_FBSD53_ENV
afs_mount,
@ -244,3 +269,4 @@ struct vfsops afs_vfsops = {
vfs_stdsysctl,
#endif
};
#endif

View File

@ -65,6 +65,73 @@ RCSID
#include <vm/vnode_pager.h>
extern int afs_pbuf_freecnt;
#ifdef AFS_FBSD60_ENV
static vop_access_t afs_vop_access;
static vop_advlock_t afs_vop_advlock;
static vop_close_t afs_vop_close;
static vop_create_t afs_vop_create;
static vop_fsync_t afs_vop_fsync;
static vop_getattr_t afs_vop_getattr;
static vop_getpages_t afs_vop_getpages;
static vop_inactive_t afs_vop_inactive;
static vop_ioctl_t afs_vop_ioctl;
static vop_link_t afs_vop_link;
static vop_lookup_t afs_vop_lookup;
static vop_mkdir_t afs_vop_mkdir;
static vop_mknod_t afs_vop_mknod;
static vop_open_t afs_vop_open;
static vop_pathconf_t afs_vop_pathconf;
static vop_poll_t afs_vop_poll;
static vop_print_t afs_vop_print;
static vop_putpages_t afs_vop_putpages;
static vop_read_t afs_vop_read;
static vop_readdir_t afs_vop_readdir;
static vop_readlink_t afs_vop_readlink;
static vop_reclaim_t afs_vop_reclaim;
static vop_remove_t afs_vop_remove;
static vop_rename_t afs_vop_rename;
static vop_rmdir_t afs_vop_rmdir;
static vop_setattr_t afs_vop_setattr;
static vop_strategy_t afs_vop_strategy;
static vop_symlink_t afs_vop_symlink;
static vop_write_t afs_vop_write;
struct vop_vector afs_vnodeops = {
.vop_default = &default_vnodeops,
.vop_access = afs_vop_access,
.vop_advlock = afs_vop_advlock,
.vop_close = afs_vop_close,
.vop_create = afs_vop_create,
.vop_fsync = afs_vop_fsync,
.vop_getattr = afs_vop_getattr,
.vop_getpages = afs_vop_getpages,
.vop_inactive = afs_vop_inactive,
.vop_ioctl = afs_vop_ioctl,
.vop_lease = VOP_NULL,
.vop_link = afs_vop_link,
.vop_lookup = afs_vop_lookup,
.vop_mkdir = afs_vop_mkdir,
.vop_mknod = afs_vop_mknod,
.vop_open = afs_vop_open,
.vop_pathconf = afs_vop_pathconf,
.vop_poll = afs_vop_poll,
.vop_print = afs_vop_print,
.vop_putpages = afs_vop_putpages,
.vop_read = afs_vop_read,
.vop_readdir = afs_vop_readdir,
.vop_readlink = afs_vop_readlink,
.vop_reclaim = afs_vop_reclaim,
.vop_remove = afs_vop_remove,
.vop_rename = afs_vop_rename,
.vop_rmdir = afs_vop_rmdir,
.vop_setattr = afs_vop_setattr,
.vop_strategy = afs_vop_strategy,
.vop_symlink = afs_vop_symlink,
.vop_write = afs_vop_write,
};
#else /* AFS_FBSD60_ENV */
int afs_vop_lookup(struct vop_lookup_args *);
int afs_vop_create(struct vop_create_args *);
int afs_vop_mknod(struct vop_mknod_args *);
@ -94,12 +161,9 @@ int afs_vop_readdir(struct vop_readdir_args *);
int afs_vop_readlink(struct vop_readlink_args *);
int afs_vop_inactive(struct vop_inactive_args *);
int afs_vop_reclaim(struct vop_reclaim_args *);
int afs_vop_lock(struct vop_lock_args *);
int afs_vop_unlock(struct vop_unlock_args *);
int afs_vop_bmap(struct vop_bmap_args *);
int afs_vop_strategy(struct vop_strategy_args *);
int afs_vop_print(struct vop_print_args *);
int afs_vop_islocked(struct vop_islocked_args *);
int afs_vop_advlock(struct vop_advlock_args *);
@ -153,6 +217,7 @@ struct vnodeopv_entry_desc afs_vnodeop_entries[] = {
};
struct vnodeopv_desc afs_vnodeop_opv_desc =
{ &afs_vnodeop_p, afs_vnodeop_entries };
#endif /* AFS_FBSD60_ENV */
#define GETNAME() \
struct componentname *cnp = ap->a_cnp; \
@ -882,10 +947,14 @@ afs_vop_fsync(ap)
AFS_GLOCK();
/*vflushbuf(vp, wait); */
#ifdef AFS_FBSD60_ENV
error = afs_fsync(VTOAFS(vp), ap->a_td->td_ucred);
#else
if (ap->a_cred)
error = afs_fsync(VTOAFS(vp), ap->a_cred);
else
error = afs_fsync(VTOAFS(vp), afs_osi_credp);
#endif
AFS_GUNLOCK();
return error;
}
@ -1286,9 +1355,14 @@ afs_vop_reclaim(struct vop_reclaim_args *ap)
*/
if (code)
printf("afs_vop_reclaim: afs_FlushVCache failed code %d\n", code);
#ifdef AFS_FBSD60_ENV
vnode_destroy_vobject(vp);
#endif
return 0;
}
#ifndef AFS_FBSD60_ENV
int
afs_vop_bmap(ap)
struct vop_bmap_args /* {
@ -1313,6 +1387,7 @@ afs_vop_bmap(ap)
return 0;
}
#endif
int
afs_vop_strategy(ap)

View File

@ -186,14 +186,20 @@ afs_ustrategy(abp)
code = afs_rdwr(VTOAFS(abp->b_vp), &tuio, UIO_WRITE, 0, credp);
#endif
}
#if !defined(AFS_AIX32_ENV) && !defined(AFS_SUN5_ENV)
#if defined(AFS_DUX40_ENV) || (defined (AFS_XBSD_ENV) && !defined (AFS_FBSD50_ENV))
#if defined(AFS_DUX40_ENV) || defined (AFS_XBSD_ENV)
if (code) {
abp->b_error = code;
#if !defined(AFS_FBSD50_ENV)
abp->b_flags |= B_ERROR;
#endif
}
#endif
#if defined(AFS_AIX32_ENV)
crfree(credp);
#elif defined(AFS_DUX40_ENV)
biodone(abp);
#if defined(AFS_DUX40_ENV)
if (code && !(abp->b_flags & B_READ)) {
/* prevent ubc from retrying writes */
AFS_GUNLOCK();
@ -201,16 +207,16 @@ afs_ustrategy(abp)
(vm_offset_t) dbtob(abp->b_blkno), PAGE_SIZE, B_INVAL);
AFS_GLOCK();
}
#endif
#elif defined(AFS_FBSD60_ENV)
(*abp->b_iodone)(abp);
#elif defined(AFS_FBSD50_ENV)
biodone(&abp->b_io);
#else /* AFS_DUX40_ENV */
#elif defined(AFS_XBSD_ENV)
biodone(abp);
#elif !defined(AFS_SUN5_ENV)
iodone(abp);
#endif /* AFS_DUX40_ENV */
#endif
#ifdef AFS_AIX32_ENV
crfree(credp);
#endif
afs_Trace3(afs_iclSetp, CM_TRACE_STRATEGYDONE, ICL_TYPE_POINTER, tvc,
ICL_TYPE_INT32, code, ICL_TYPE_LONG, tuio.afsio_resid);
return code;

View File

@ -814,7 +814,9 @@ restart:
struct vnode *vp;
AFS_GUNLOCK();
#ifdef AFS_FBSD50_ENV
#if defined(AFS_FBSD60_ENV)
if (getnewvnode(MOUNT_AFS, afs_globalVFS, &afs_vnodeops, &vp))
#elif defined(AFS_FBSD50_ENV)
if (getnewvnode(MOUNT_AFS, afs_globalVFS, afs_vnodeop_p, &vp))
#else
if (getnewvnode(VT_AFS, afs_globalVFS, afs_vnodeop_p, &vp))
@ -1707,11 +1709,6 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq,
return tvc;
}
#endif /* AFS_OSF_ENV */
#ifdef AFS_OBSD_ENV
VOP_LOCK(AFSTOV(tvc), LK_EXCLUSIVE | LK_RETRY, curproc);
uvm_vnp_uncache(AFSTOV(tvc));
VOP_UNLOCK(AFSTOV(tvc), 0, curproc);
#endif
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
/*
* XXX - I really don't like this. Should try to understand better.
@ -1725,19 +1722,10 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq,
* to vinvalbuf; otherwise, we leave it alone.
*/
{
struct vnode *vp;
struct vnode *vp = AFSTOV(tvc);
int iheldthelock;
vp = AFSTOV(tvc);
#ifdef AFS_FBSD50_ENV
iheldthelock = VOP_ISLOCKED(vp, curthread);
if (!iheldthelock)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
vinvalbuf(vp, V_SAVE, osi_curcred(), curthread, PINOD, 0);
if (!iheldthelock)
VOP_UNLOCK(vp, LK_EXCLUSIVE, curthread);
#else
#ifdef AFS_DARWIN_ENV
#if defined(AFS_DARWIN_ENV)
iheldthelock = VOP_ISLOCKED(vp);
if (!iheldthelock)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, current_proc());
@ -1751,14 +1739,34 @@ afs_GetVCache(register struct VenusFid *afid, struct vrequest *areq,
ObtainWriteLock(&tvc->lock, 954);
if (!iheldthelock)
VOP_UNLOCK(vp, LK_EXCLUSIVE, current_proc());
#else
#elif defined(AFS_FBSD60_ENV)
iheldthelock = VOP_ISLOCKED(vp, curthread);
if (!iheldthelock)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
vinvalbuf(vp, V_SAVE, curthread, PINOD, 0);
if (!iheldthelock)
VOP_UNLOCK(vp, LK_EXCLUSIVE, curthread);
#elif defined(AFS_FBSD50_ENV)
iheldthelock = VOP_ISLOCKED(vp, curthread);
if (!iheldthelock)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
vinvalbuf(vp, V_SAVE, osi_curcred(), curthread, PINOD, 0);
if (!iheldthelock)
VOP_UNLOCK(vp, LK_EXCLUSIVE, curthread);
#elif defined(AFS_FBSD40_ENV)
iheldthelock = VOP_ISLOCKED(vp, curproc);
if (!iheldthelock)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curproc);
vinvalbuf(vp, V_SAVE, osi_curcred(), curproc, PINOD, 0);
if (!iheldthelock)
VOP_UNLOCK(vp, LK_EXCLUSIVE, curproc);
#endif
#elif defined(AFS_OBSD_ENV)
iheldthelock = VOP_ISLOCKED(vp, curproc);
if (!iheldthelock)
VOP_LOCK(vp, LK_EXCLUSIVE | LK_RETRY, curproc);
uvm_vnp_uncache(vp);
if (!iheldthelock)
VOP_UNLOCK(vp, 0, curproc);
#endif
}
#endif

View File

@ -174,6 +174,7 @@
#define SYS_NAME_ID_i386_fbsd_51 2106
#define SYS_NAME_ID_i386_fbsd_52 2107
#define SYS_NAME_ID_i386_fbsd_53 2108
#define SYS_NAME_ID_i386_fbsd_60 2112
#define SYS_NAME_ID_ia64_linux2 2200
#define SYS_NAME_ID_ia64_linux22 2201

View File

@ -0,0 +1,203 @@
#ifndef AFS_PARAM_H
#define AFS_PARAM_H
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
#ifndef IGNORE_STDS_H
#include <sys/param.h>
#endif
#define AFS_XBSD_ENV 1 /* {Free,Open,Net}BSD */
#define AFS_X86_XBSD_ENV 1
#define AFS_NAMEI_ENV 1 /* User space interface to file system */
#define AFS_64BIT_ENV 1
#define AFS_64BIT_CLIENT 1
#define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */
#define AFS_FBSD_ENV 1
#define AFS_FBSD40_ENV 1
#define AFS_FBSD42_ENV 1
#define AFS_FBSD43_ENV 1
#define AFS_FBSD44_ENV 1
#define AFS_FBSD45_ENV 1
#define AFS_FBSD46_ENV 1
#define AFS_FBSD47_ENV 1
#define AFS_FBSD50_ENV 1
#define AFS_FBSD51_ENV 1
#define AFS_FBSD52_ENV 1
#define AFS_FBSD53_ENV 1
#define AFS_FBSD60_ENV 1
#define AFS_X86_FBSD_ENV 1
#define AFS_X86_FBSD40_ENV 1
#define AFS_X86_FBSD42_ENV 1
#define AFS_X86_FBSD43_ENV 1
#define AFS_X86_FBSD46_ENV 1
#define AFS_X86_FBSD47_ENV 1
#define AFS_X86_FBSD50_ENV 1
#define AFS_X86_ENV 1
#define AFS_NONFSTRANS 1
#define FTRUNC O_TRUNC
#define IUPD 0x0010
#define IACC 0x0020
#define ICHG 0x0040
#define IMOD 0x0080
#define IN_LOCK(ip) lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
NULL, curproc)
#define IN_UNLOCK(ip) lockmgr(&ip->i_lock, LK_RELEASE, \
NULL, curproc)
#include <afs/afs_sysnames.h>
#define AFS_VM_RDWR_ENV 1
#define AFS_VFS_ENV 1
#define AFS_VFSINCL_ENV 1
#define AFS_GREEDY43_ENV 1
#define AFS_ENV 1
#define AFS_SYSCALL 339
#define AFS_MOUNT_AFS "afs"
#ifndef MOUNT_UFS
#define MOUNT_UFS "ufs"
#endif
#ifndef MOUNT_AFS
#define MOUNT_AFS AFS_MOUNT_AFS
#endif
#define SYS_NAME "i386_fbsd_60"
#define SYS_NAME_ID SYS_NAME_ID_i386_fbsd_60
#define AFS_HAVE_FFS 1 /* Use system's ffs. */
#define AFS_HAVE_STATVFS 0 /* System doesn't supports statvfs */
#define RXK_LISTENER_ENV 1
#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */
#define AFS_USE_GETTIMEOFDAY 1 /* use gettimeofday to implement rx clock */
#define AFSLITTLE_ENDIAN 1
/* Extra kernel definitions (from kdefs file) */
#ifdef _KERNEL
#define AFS_GLOBAL_SUNLOCK 1
#define AFS_VFS34 1 /* What is VFS34??? */
#define AFS_SHORTGID 0 /* are group id's short? */
#define afsio_iov uio_iov
#define afsio_iovcnt uio_iovcnt
#define afsio_offset uio_offset
#define afsio_seg uio_segflg
#define afsio_resid uio_resid
#define AFS_UIOSYS UIO_SYSSPACE
#define AFS_UIOUSER UIO_USERSPACE
#define AFS_CLBYTES CLBYTES
#define osi_GetTime(x) microtime(x)
#define AFS_KALLOC(x) osi_fbsd_alloc((x), 1)
#undef AFS_KALLOC_NOSLEEP
#define AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
#define AFS_KFREE(x,y) osi_fbsd_free((x))
#define v_count v_usecount
#define v_vfsp v_mount
#define vfs_bsize mnt_stat.f_bsize
#define vfs_fsid mnt_stat.f_fsid
#define va_nodeid va_fileid
#define vfs_vnodecovered mnt_vnodecovered
#define direct dirent
#define vnode_t struct vnode
#ifndef MUTEX_DEFAULT
#define MUTEX_DEFAULT 0
#endif /* MUTEX_DEFAULT */
#ifndef SSYS
#define SSYS 0x00002
#endif /* SSYS */
#define p_rcred p_ucred
#if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
enum vcexcl { NONEXCL, EXCL };
#ifdef KERNEL
#ifndef MIN
#define MIN(A,B) ((A) < (B) ? (A) : (B))
#endif
#ifndef MAX
#define MAX(A,B) ((A) > (B) ? (A) : (B))
#endif
#endif /* KERNEL */
#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
#endif /* _KERNEL */
#else /* !defined(UKERNEL) */
/* This section for user space compiles only */
#define UKERNEL 1 /* user space kernel */
#define AFS_ENV 1
#define AFS_VFSINCL_ENV 1
#define AFS_USR_FBSD40_ENV 1
#define AFS_USR_FBSD42_ENV 1
#define AFS_USR_FBSD43_ENV 1
#define AFS_USR_FBSD44_ENV 1
#define AFS_USR_FBSD45_ENV 1
#define AFS_USR_FBSD46_ENV 1
#define AFS_USR_FBSD47_ENV 1
#define AFS_USR_FBSD50_ENV 1
#define AFS_USR_FBSD51_ENV 1
#define AFS_USR_FBSD52_ENV 1
#define AFS_USR_FBSD53_ENV 1
#define AFS_USR_FBSD60_ENV 1
#define AFS_USR_FBSD_ENV 1
#define AFS_NONFSTRANS 1
#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */
#define AFS_SYSCALL 339
#define AFS_NAMEI_ENV 1 /* User space interface to file system */
#define AFS_64BIT_ENV 1
#define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */
#define AFS_USERSPACE_IP_ADDR 1
#define RXK_LISTENER_ENV 1
#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */
/* Machine / Operating system information */
#include <afs/afs_sysnames.h>
#define SYS_NAME "i386_fbsd_60"
#define SYS_NAME_ID SYS_NAME_ID_i386_fbsd_60
#define AFSLITTLE_ENDIAN 1
#define AFS_HAVE_FFS 1 /* Use system's ffs. */
#define AFS_HAVE_STATVFS 1 /* System doesn't support statvfs */
#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */
#define afsio_iov uio_iov
#define afsio_iovcnt uio_iovcnt
#define afsio_offset uio_offset
#define afsio_seg uio_segflg
#define afsio_fmode uio_fmode
#define afsio_resid uio_resid
#define AFS_UIOSYS 1
#define AFS_UIOUSER UIO_USERSPACE
#define AFS_CLBYTES MCLBYTES
#define AFS_MINCHANGE 2
#define VATTR_NULL usr_vattr_null
#define AFS_DIRENT
#ifndef CMSERVERPREF
#define CMSERVERPREF
#endif
#include <limits.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/mount.h>
#include <sys/fcntl.h>
#include <netinet/in.h>
#include <sys/uio.h>
#include <sys/socket.h>
#endif /* !defined(UKERNEL) */
#endif /* AFS_PARAM_H */