Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jun 2011 23:55:23 +0800 (CST)
From:      Tai-hwa Liang <avatar@mmlab.cse.yzu.edu.tw>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Stefan Farfeleder <stefanf@FreeBSD.org>, src-committers@FreeBSD.org
Subject:   Re: svn commit: r223138 - head/sys/ufs/ffs
Message-ID:  <1106162352252.45438@www.mmlab.cse.yzu.edu.tw>
In-Reply-To: <20110617000654.W1926@besplex.bde.org>
References:  <201106160526.p5G5Q3RX013915@svn.freebsd.org> <20110616065310.GA2542@mole.fafoe.narf.at> <20110616175314.R935@besplex.bde.org> <1106161923211.44181@www.mmlab.cse.yzu.edu.tw> <20110617000654.W1926@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 17 Jun 2011, Bruce Evans wrote:
> On Thu, 16 Jun 2011, Tai-hwa Liang wrote:
>> On Thu, 16 Jun 2011, Bruce Evans wrote:
>>> It might be a style bug (like typedefing a struct) to use enums for
>>> anything.  They are impossible to declare opaquely.
>>
>>  Does that mean we have to #include <sys/vnode.h> in userland 
>> makefs/ffs/ffs_bswap.c?
>
> It means that you should implement headers properly, so that they don't
> depend on other headers to begin with or grow dependencies on other
> headers.  Though the should-be-kernel-only header <sys/vnode.h> has some
> parts including `enum vtype' that have already escaped to userland, other
> headers shouldn't grow dependencies on these.

   How about wrapping offended sections with #ifdef _KERNEL? Should be less
intrusive IMHO:

Index: ffs_extern.h
===================================================================
--- ffs_extern.h	(revision 223146)
+++ ffs_extern.h	(working copy)
@@ -33,7 +33,6 @@
  #ifndef _UFS_FFS_EXTERN_H
  #define	_UFS_FFS_EXTERN_H

-enum vtype;
  struct buf;
  struct cg;
  struct fid;
@@ -57,8 +56,10 @@
  int	ffs_balloc_ufs2(struct vnode *a_vp, off_t a_startoffset, int a_size,
              struct ucred *a_cred, int a_flags, struct buf **a_bpp);
  int	ffs_blkatoff(struct vnode *, off_t, char **, struct buf **);
+#ifdef _KERNEL
  void	ffs_blkfree(struct ufsmount *, struct fs *, struct vnode *,
  	    ufs2_daddr_t, long, ino_t, enum vtype, struct workhead *);
+#endif /* _KERNEL */
  ufs2_daddr_t ffs_blkpref_ufs1(struct inode *, ufs_lbn_t, int, ufs1_daddr_t *);
  ufs2_daddr_t ffs_blkpref_ufs2(struct inode *, ufs_lbn_t, int, ufs2_daddr_t *);
  int	ffs_checkfreefile(struct fs *, struct vnode *, ino_t);
@@ -82,8 +83,10 @@
  	    ufs2_daddr_t, int, int, int, struct ucred *, struct buf **);
  int	ffs_sbupdate(struct ufsmount *, int, int);
  void	ffs_setblock(struct fs *, u_char *, ufs1_daddr_t);
+#ifdef _KERNEL
  int	ffs_snapblkfree(struct fs *, struct vnode *, ufs2_daddr_t, long, ino_t,
  	    enum vtype, struct workhead *);
+#endif /* _KERNEL */
  void	ffs_snapremove(struct vnode *vp);
  int	ffs_snapshot(struct mount *mp, char *snapfile);
  void	ffs_snapshot_mount(struct mount *mp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1106162352252.45438>