Patches for FreeBSD -CURRENT

Andrea Campi andrea at webcom.it
Tue Dec 18 14:58:33 CET 2001


Guys? Is nobody interested? I really need to commit this since I will have less
time in the future to keep up with any conflicts which may arise...

Bye,
	Andrea

On Mon, Dec 10, 2001 at 06:54:51PM +0100, Andrea Campi wrote:
> Hi,
> 
> lately I've been working on getting Arla (xfs really) to work better on FreeBSD
> -CURRENT and to allow it to be compiled in the kernel instead of as a module.
> My goal is to have xfs committed to the FreeBSD repo, and hopefully merged to
> the 4.x branch, to make it easier to keep it up to date with FreeBSD evolution.
> 
> A few changes are needed before this can happen; I've summarized them in a
> single patch. I've sent this to Assar, who's accepted my patches before, but
> he's probably busy lately as he's not answered in 2 weeks. Would anybody care
> to review and hopefully commit?
> 
> This is a short description of my changes (I didn't review this text from the
> original mail to Assar):
> 
>  - xfs_message.c and xfs_node-bsd.c are needed on both -CURRENT and -STABLE
> after recent changes. Sorry I didn't protect them with a __FreeBSD_version
> check, but as you said, it's probably more important to have better support for
> recent versions. If any problem emerges we can always fix later.
> 
>  - In xfs_syscalls-common.c I sort of fixed an admittedly kludgy #ifdef which
> mandated defining HAVE_CONFIG_H. This way I can avoid this define. Also, I
> fixed compilation in the kernel (vs. module). Last, crcopy() changed semantics
> in recent -CURRENT. This breaks -STABLE, sorry but I thought of that only right
> now. Feel free to fix or I will do it later.
> 
>  - Most of the rest deals with compilation in the kernel.
> 
> You can see I renamed the module "arlaxfsdev" in DEV_MODULE (xfs_wrap-bsd.c). I
> did this in order to avoid future conflicts in case we import SGI XFS in the
> future; you might want to avoid that part for now.
> 
> If you agree to commit this, we will be able to import the required files only
> in contrib, as follows (pseudocode):
> 
> cd /u/arla/xfs/bsd
> cp xfs_deb.c xfs_message.c xfs_common.c xfs_wrap-bsd.c xfs_common-bsd.c xfs_dev-common.c xfs_dev-bsd.c xfs_syscalls-common.c xfs_syscalls-wrap-freebsd.c xfs_node-bsd.c xfs_vfsops-common.c xfs_vfsops-bsd.c xfs_vfsops-freebsd.c xfs_vnodeops-common.c xfs_vnodeops-bsd.c sys/contrib/dev/arlaxfs
> cp xfs/* sys/contrib/dev/arlaxfs/xfs
> cp /u/arla/xfs/include/xfs/* sys/contrib/dev/arlaxfs/xfs
> cp /u/arla/include/{afssysdefs.h,kafs.h} sys/contrib/dev/arlaxfs
> 
> xfs_config.h, xfs_vopdefs.h must be maintained by hand, for now I would import
> them in contrib.
> 
> I have reached the point where I can compile everything both in the kernel and
> as module, and kldload the module, with no error. I'm sure I still need to fix
> a few things but I need to commit things or I will lose too much time every time
> anything changes; having things in the repo will make for faster work.
> 
> Please give me feedback.
> 
> Bye,
> 	Andrea
> 
> -- 
>                        There's no place like ~
> 
> diff -urN xfs/bsd/xfs_dev-bsd.c xfs/bsd/xfs_dev-bsd.c
> --- xfs/bsd/xfs_dev-bsd.c	Mon Nov 26 14:45:32 2001
> +++ xfs/bsd/xfs_dev-bsd.c	Sat Nov 24 01:14:18 2001
> @@ -322,7 +322,7 @@
>      return xfs_uprintf_device();
>  }
>  
> -#if !defined(_LKM) && !defined(KLD_MODULE) && !defined(__APPLE__)
> +#if !defined(_LKM) && !defined(KLD_MODULE) && !defined(__APPLE__) && !defined(__FreeBSD__)
>  int
>  xfs_is_xfs_dev(dev_t dev)
>  {
> diff -urN xfs/bsd/xfs_message.c xfs/bsd/xfs_message.c
> --- xfs/bsd/xfs_message.c	Mon Nov 26 14:45:32 2001
> +++ xfs/bsd/xfs_message.c	Fri Nov 23 22:20:17 2001
> @@ -494,11 +494,11 @@
>  	/* XXX see comment in xfs_node_find */
>  	/* XXXSMP do gone[l] need to get mntvnode_slock ? */
>  
> -	for(vp = XFS_TO_VFS(&xfs[fd])->mnt_vnodelist.lh_first;
> +	for(vp = XFS_TO_VFS(&xfs[fd])->mnt_nvnodelist.tqh_first;
>  	    vp != NULL; 
>  	    vp = next) {
>  
> -	    next = vp->v_mntvnodes.le_next;
> +	    next = vp->v_nmntvnodes.tqe_next;
>  	    gc_vnode (vp, p);
>  	}
>      } else {
> diff -urN xfs/bsd/xfs_node-bsd.c xfs/bsd/xfs_node-bsd.c
> --- xfs/bsd/xfs_node-bsd.c	Mon Nov 26 14:45:32 2001
> +++ xfs/bsd/xfs_node-bsd.c	Fri Nov 23 22:22:41 2001
> @@ -280,7 +280,7 @@
>       *       on FreeBSD once.
>       */
>  
> -    LIST_FOREACH(t, &XFS_TO_VFS(xfsp)->mnt_vnodelist, v_mntvnodes) {
> +    TAILQ_FOREACH(t, &XFS_TO_VFS(xfsp)->mnt_nvnodelist, v_nmntvnodes) {
>  	xn = VNODE_TO_XNODE(t);
>  	if (xn && xfs_handle_eq(&xn->handle, handlep))
>  	    break;
> diff -urN xfs/bsd/xfs_syscalls-common.c xfs/bsd/xfs_syscalls-common.c
> --- xfs/bsd/xfs_syscalls-common.c	Mon Nov 26 14:45:32 2001
> +++ xfs/bsd/xfs_syscalls-common.c	Sat Nov 24 01:37:09 2001
> @@ -57,7 +57,7 @@
>   * XXX - horrible kludge. If we're built without HAVE_CONFIG_H we assume that
>   *       we're built inside the kernel on OpenBSD.
>   */
> -#ifdef HAVE_CONFIG_H
> +#if !defined(__OpenBSD__)
>  #include <kafs.h>
>  #else
>  #include <xfs/xfs_pioctl.h>
> @@ -67,9 +67,11 @@
>  
>  /*
>   * the syscall entry point
> + *
> + * FIXME for !LKM on FreeBSD
>   */
>  
> -#if defined(_LKM) || defined(KLD_MODULE) || defined(__osf__) || defined(__APPLE__)
> +#if defined(_LKM) || defined(KLD_MODULE) || defined(__osf__) || defined(__APPLE__) || defined(__FreeBSD__)
>  int
>  xfspioctl(d_thread_t *proc, void *varg, register_t *return_value)
>  #else
> @@ -77,7 +79,7 @@
>  sys_xfspioctl(d_thread_t *proc, void *varg, register_t *return_value)
>  #endif
>  {
> -#if defined(_LKM) || defined(KLD_MODULE) || defined(__osf__) || defined(__APPLE__)
> +#if defined(_LKM) || defined(KLD_MODULE) || defined(__osf__) || defined(__APPLE__) || defined(__FreeBSD__)
>      struct sys_pioctl_args *arg = (struct sys_pioctl_args *) varg;
>  #else
>      struct sys_xfspioctl_args *arg = (struct sys_xfspioctl_args *) varg;
> @@ -169,14 +171,14 @@
>  	if (cred->cr_ngroups + 2 >= NGROUPS)
>  	    return E2BIG;
>  
> -	cred = crcopy (cred);
> +	crcopy(cred, cred);
>  
>  	for (i = cred->cr_ngroups - 1; i > 0; i--) {
>  	    cred->cr_groups[i + 2] = cred->cr_groups[i];
>  	}
>  	cred->cr_ngroups += 2;
>      } else {
> -	cred = crcopy (cred);
> +	crcopy(cred, cred);
>      }
>      cred->cr_groups[1] = part1;
>      cred->cr_groups[2] = part2;
> diff -urN xfs/bsd/xfs_wrap-bsd.c xfs/bsd/xfs_wrap-bsd.c
> --- xfs/bsd/xfs_wrap-bsd.c	Mon Nov 26 14:45:32 2001
> +++ xfs/bsd/xfs_wrap-bsd.c	Sat Nov 24 02:13:03 2001
> @@ -173,7 +192,8 @@
>  
>  #ifdef DEV_MODULE
>  
> -DEV_MODULE(xfsdev, xfs_load, NULL);
> +DEV_MODULE(arlaxfsdev, xfs_load, NULL);
> +MODULE_VERSION(arlaxfsdev, 1);
>  
>  #else /* DEV_MODULE */
>  
> @@ -182,18 +202,15 @@
>  #endif /* DECLARE_MODULE */
>  
>  #else /* KLD_MODULE */
> +#if !defined(__FreeBSD__)
>  
>  /*
>   * An ordinary lkm-module
>   */
>  
> -#if defined(__FreeBSD__)
> -MOD_DEV(xfs,LM_DT_CHAR,-1,&xfs_dev);
> -#else
>  #if !defined(__APPLE__)
>  MOD_DEV("xfs_mod",LM_DT_CHAR,-1,&xfs_dev)
>  #endif
> -#endif
>  
>  /*
>   *
> @@ -294,6 +311,7 @@
>      return ret;
>  }
>  #endif
> -
> +
> +#endif
>  #endif /* KLD_MODULE */
> 
> --- xfs/include/xfs/xfs_message.h	Sun Oct 14 13:17:09 2001
> +++ xfs/include/xfs/xfs_message.h	Mon Nov 26 15:28:17 2001
> @@ -52,7 +52,11 @@
>  #error not a i386
>  #endif
>  #elif !defined(__LINUX__) && !defined(HAVE_GLIBC)
> +#if defined(__FreeBSD__)
> +#include <sys/types.h>
> +#else
>  #include <atypes.h>
> +#endif
>  #else
>  #include <linux/types.h>
>  #endif
> --- xfs/bsd/xfs/xfs_locl.h	Mon Nov 26 15:25:03 2001
> +++ xfs/bsd/xfs/xfs_locl.h	Fri Nov 23 22:14:03 2001
> @@ -211,6 +211,21 @@
>  void cache_purgevfs(struct mount *);
>  #endif
>  
> +#ifdef __FreeBSD_version
> +#if __FreeBSD_version < 400000
> +# error This version is unsupported
> +#elif __FreeBSD_version < 500023
> +typedef struct proc d_thread_t;
> +#elif __FreeBSD_version == 500023
> +#   define HAVE_FREEBSD_THREAD
> +typedef struct thread d_thread_t;
> +#elif __FreeBSD_version >= 500024
> +#   define HAVE_FREEBSD_THREAD
> +#endif
> +#else /* !__FreeBSD_version */
> +typedef struct proc d_thread_t;
> +#endif /* !__FreeBSD_version */
> +
>  #if defined(HAVE_FREEBSD_THREAD)
>  #define xfs_uio_to_thread(uiop) ((uiop)->uio_td)
>  #define xfs_cnp_to_thread(cnp) ((cnp)->cn_thread)
> @@ -241,21 +256,6 @@
>  typedef u_quad_t va_size_t;
>  
>  #endif /* !__osf__ */
> -
> -#ifdef __FreeBSD_version
> -#if __FreeBSD_version < 400000
> -# error This version is unsupported
> -#elif __FreeBSD_version < 500023
> -typedef struct proc d_thread_t;
> -#elif __FreeBSD_version == 500023
> -#   define HAVE_FREEBSD_THREAD
> -typedef struct thread d_thread_t;
> -#elif __FreeBSD_version >= 500024
> -#   define HAVE_FREEBSD_THREAD
> -#endif
> -#else /* !__FreeBSD_version */
> -typedef struct proc d_thread_t;
> -#endif /* !__FreeBSD_version */
>  
>  /*
>   * XXX
> 
> 
> ----- End forwarded message -----
> 
> -- 
>                        There's no place like ~

-- 
Failure is not an option. It comes bundled with your Microsoft product.





More information about the Arla-drinkers mailing list