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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to