Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/chfs prepare for chfs's makefs



details:   https://anonhg.NetBSD.org/src/rev/6919612984ff
branches:  trunk
changeset: 778786:6919612984ff
user:      ttoth <ttoth%NetBSD.org@localhost>
date:      Fri Apr 13 14:50:35 2012 +0000

description:
prepare for chfs's makefs

diffstat:

 sys/ufs/chfs/chfs.h       |  16 ++++++++++++----
 sys/ufs/chfs/chfs_inode.h |  15 ++++++++++++---
 sys/ufs/chfs/chfs_vnode.c |  11 +----------
 sys/ufs/chfs/ebh.h        |  41 +++++++++++++++++++++++------------------
 4 files changed, 48 insertions(+), 35 deletions(-)

diffs (211 lines):

diff -r b5965484b9d0 -r 6919612984ff sys/ufs/chfs/chfs.h
--- a/sys/ufs/chfs/chfs.h       Fri Apr 13 14:42:18 2012 +0000
+++ b/sys/ufs/chfs/chfs.h       Fri Apr 13 14:50:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chfs.h,v 1.5 2012/04/12 15:31:01 ttoth Exp $   */
+/*     $NetBSD: chfs.h,v 1.6 2012/04/13 14:50:35 ttoth Exp $   */
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -38,6 +38,9 @@
 #ifndef __CHFS_H__
 #define __CHFS_H__
 
+
+#ifdef _KERNEL
+
 #if 0
 #define DBG_MSG
 #define DBG_MSG_GC
@@ -71,13 +74,19 @@
 TAILQ_HEAD(chfs_dirent_list, chfs_dirent);
 
 #include "chfs_pool.h"
+#endif /* _KERNEL */
+
 #include "ebh.h"
 #include "media.h"
 #include "chfs_inode.h"
 
+#define CHFS_PAD(x) (((x)+3)&~3)
+
+#ifdef _KERNEL
+
 #ifndef MOUNT_CHFS
 #define MOUNT_CHFS "chfs"
-#endif
+#endif /* MOUNT_CHFS */
 
 enum {
        VNO_STATE_UNCHECKED,    /* CRC checks not yet done */
@@ -97,8 +106,6 @@
 #define MAX_DIRTY_TO_CLEAN 255
 #define VERY_DIRTY(chmp, size) ((size) >= (((chmp)->chm_ebh)->eb_size / 2))
 
-#define CHFS_PAD(x) (((x)+3)&~3)
-
 enum {
        CHFS_NODE_OK = 0,
        CHFS_NODE_BADMAGIC,
@@ -764,4 +771,5 @@
 #define IMPLIES(a, b) (!(a) || (b))
 #define IFF(a, b) (IMPLIES(a, b) && IMPLIES(b, a))
 
+#endif /* _KERNEL */
 #endif /* __CHFS_H__ */
diff -r b5965484b9d0 -r 6919612984ff sys/ufs/chfs/chfs_inode.h
--- a/sys/ufs/chfs/chfs_inode.h Fri Apr 13 14:42:18 2012 +0000
+++ b/sys/ufs/chfs/chfs_inode.h Fri Apr 13 14:50:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chfs_inode.h,v 1.3 2012/04/12 15:31:01 ttoth Exp $     */
+/*     $NetBSD: chfs_inode.h,v 1.4 2012/04/13 14:50:35 ttoth Exp $     */
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -35,10 +35,12 @@
 #ifndef __CHFS_INODE_H__
 #define __CHFS_INODE_H__
 
+#ifdef _KERNEL
 #include <sys/vnode.h>
 #include <sys/stat.h>
 #include <ufs/ufs/ufsmount.h>
 #include <miscfs/genfs/genfs_node.h>
+#endif /* _KERNEL */
 
 #define CHFS_ROOTINO 2
 
@@ -59,11 +61,17 @@
 #define CHTTOVT(ch_type)       ch_type
 #define VTTOCHT(v_type)                v_type
 
-extern const enum chtype iftocht_tab[16];
+/* vtype replaced with chtype, these are only for compatibility */
+static const enum chtype iftocht_tab[16] = {
+       CHT_BLANK, CHT_FIFO, CHT_CHR, CHT_BLANK,
+       CHT_DIR, CHT_BLANK, CHT_BLK, CHT_BLANK,
+       CHT_REG, CHT_BLANK, CHT_LNK, CHT_BLANK,
+       CHT_SOCK, CHT_BLANK, CHT_BLANK, CHT_BAD,
+};
 
 #define        IFTOCHT(mode)   (iftocht_tab[((mode) & S_IFMT) >> 12])
 
-
+#ifdef _KERNEL
 struct chfs_inode
 {
        struct genfs_node       gnode;
@@ -159,4 +167,5 @@
 #define        IFSOCK          0140000         /* UNIX domain socket. */
 #define        IFWHT           0160000         /* Whiteout. */
 
+#endif /* _KERNEL */
 #endif /* __CHFS_INODE_H__ */
diff -r b5965484b9d0 -r 6919612984ff sys/ufs/chfs/chfs_vnode.c
--- a/sys/ufs/chfs/chfs_vnode.c Fri Apr 13 14:42:18 2012 +0000
+++ b/sys/ufs/chfs/chfs_vnode.c Fri Apr 13 14:50:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chfs_vnode.c,v 1.4 2012/04/12 15:31:01 ttoth Exp $     */
+/*     $NetBSD: chfs_vnode.c,v 1.5 2012/04/13 14:50:35 ttoth Exp $     */
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -42,15 +42,6 @@
 
 #include <miscfs/genfs/genfs.h>
 
-/* vtype replaced with chtype, these are only for compatibility */
-const enum chtype iftocht_tab[16] = {
-       CHT_BLANK, CHT_FIFO, CHT_CHR, CHT_BLANK,
-       CHT_DIR, CHT_BLANK, CHT_BLK, CHT_BLANK,
-       CHT_REG, CHT_BLANK, CHT_LNK, CHT_BLANK,
-       CHT_SOCK, CHT_BLANK, CHT_BLANK, CHT_BAD,
-};
-
-
 struct vnode *
 chfs_vnode_lookup(struct chfs_mount *chmp, ino_t vno)
 {
diff -r b5965484b9d0 -r 6919612984ff sys/ufs/chfs/ebh.h
--- a/sys/ufs/chfs/ebh.h        Fri Apr 13 14:42:18 2012 +0000
+++ b/sys/ufs/chfs/ebh.h        Fri Apr 13 14:50:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebh.h,v 1.1 2011/11/24 15:51:32 ahoka Exp $    */
+/*     $NetBSD: ebh.h,v 1.2 2012/04/13 14:50:35 ttoth Exp $    */
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -42,6 +42,7 @@
 #ifndef EBH_H_
 #define EBH_H_
 
+#ifdef _KERNEL
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/cdefs.h>
@@ -57,10 +58,27 @@
 #include <sys/kthread.h>
 
 #include <dev/flash/flash.h>
-#include <ufs/chfs/ebh_media.h>
-#include <ufs/chfs/debug.h>
-#include <ufs/chfs/ebh_misc.h>
+#include "debug.h"
+#include "ebh_misc.h"
+#endif /* _KERNEL */
+
+#include "ebh_media.h"
 
+/**
+ * struct  chfs_eb_hdr - in-memory representation of eraseblock headers
+ * @ec_hdr: erase counter header ob eraseblock
+ * @u.nor_hdr: eraseblock header on NOR flash
+ * @u.nand_hdr: eraseblock header on NAND flash
+ */
+struct  chfs_eb_hdr {
+       struct chfs_eb_ec_hdr ec_hdr;
+       union {
+               struct chfs_nor_eb_hdr  nor_hdr;
+               struct chfs_nand_eb_hdr nand_hdr;
+       } u;
+};
+
+#ifdef _KERNEL
 /* Maximum retries when getting new PEB before exit with failure */
 #define CHFS_MAX_GET_PEB_RETRIES 2
 
@@ -134,7 +152,6 @@
 RB_HEAD(scan_leb_used_rbtree, chfs_scan_leb);
 
 
-
 /**
  * struct chfs_scan_info - chfs scanning information
  * @corrupted: queue of corrupted physical eraseblocks
@@ -181,19 +198,6 @@
 RB_HEAD(peb_free_rbtree, chfs_peb);
 RB_HEAD(peb_in_use_rbtree, chfs_peb);
 
-/**
- * struct  chfs_eb_hdr - in-memory representation of eraseblock headers
- * @ec_hdr: erase counter header ob eraseblock
- * @u.nor_hdr: eraseblock header on NOR flash
- * @u.nand_hdr: eraseblock header on NAND flash
- */
-struct  chfs_eb_hdr {
-       struct chfs_eb_ec_hdr ec_hdr;
-       union {
-               struct chfs_nor_eb_hdr  nor_hdr;
-               struct chfs_nand_eb_hdr nand_hdr;
-       } u;
-};
 
 /*
  * struct chfs_ebh_ops - collection of operations which
@@ -314,5 +318,6 @@
 int ebh_change_leb(struct chfs_ebh *ebh, int lnr, char *buf,
     size_t len, size_t *retlen);
 
+#endif /* _KERNEL */
 
 #endif /* EBH_H_ */



Home | Main Index | Thread Index | Old Index