[Ocfs2-tools-devel] [PATCH 1/4] includes: Rework the core filesystem includes.

Joel Becker Joel.Becker at oracle.com
Tue Jan 8 12:02:55 PST 2008


[ New version, forgot to add ocfs2_lockid.h to the DIST_FILES ]


>From 3bd7d88f66613e9f1f8246cd15d2bdfdd737f7e5 Mon Sep 17 00:00:00 2001
From: Joel Becker <joel.becker at oracle.com>
Date: Tue, 8 Jan 2008 11:19:49 -0800
Subject: [PATCH 1/4] includes: Rework the core filesystem includes.

This is the first step in reorganizing the spaghetti that is ocfs2-tools
headers.  This pass moves the core filesystem includes, such as
ocfs2_fs.h and kernel-list.h, into a $(TOPDIR)/include/ocfs2-kernel
directory.  This way, all programs in ocfs2-tools can just #include
<ocfs2-kernel/kernel-list.h> and -I$(TOPDIR)/include will take care of it.

Going forward, all public headers will live under $(TOPDIR)/include.

Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
 Makefile                                   |    2 +-
 debugfs.ocfs2/Makefile                     |    2 +-
 debugfs.ocfs2/include/main.h               |    5 +-
 debugfs.ocfs2/include/ocfs2_internals.h    |    4 +-
 extras/Makefile                            |    2 +-
 extras/compute_groups.c                    |    1 -
 fsck.ocfs2/Makefile                        |    2 +-
 fsck.ocfs2/journal.c                       |    1 -
 fswreck/Makefile                           |    2 +-
 fswreck/include/main.h                     |    2 -
 include/Makefile                           |    7 +
 include/ocfs2-kernel/Makefile              |   14 +
 include/ocfs2-kernel/kernel-list.h         |  116 ++++
 include/ocfs2-kernel/ocfs1_fs_compat.h     |  109 ++++
 include/ocfs2-kernel/ocfs2_fs.h            |  823 ++++++++++++++++++++++++++++
 include/ocfs2-kernel/ocfs2_lockid.h        |   73 +++
 include/ocfs2-kernel/sparse_endian_types.h |   13 +
 libo2cb/Makefile                           |    5 +-
 libo2cb/include/o2cb.h                     |    6 +-
 libo2cb/include/sparse_endian_types.h      |   13 -
 libo2dlm/Makefile                          |    6 +-
 libo2dlm/include/kernel-list.h             |  116 ----
 libo2dlm/include/o2dlm.h                   |    6 +-
 libocfs2/Makefile                          |    8 +-
 libocfs2/checkhb.c                         |    4 +-
 libocfs2/include/kernel-list.h             |  116 ----
 libocfs2/include/ocfs1_fs_compat.h         |  109 ----
 libocfs2/include/ocfs2.h                   |   11 +-
 libocfs2/include/ocfs2_fs.h                |  823 ----------------------------
 libocfs2/include/ocfs2_lockid.h            |   73 ---
 libocfs2/openfs.c                          |    2 +-
 listuuid/Makefile                          |    2 +-
 listuuid/listuuid.c                        |    6 +-
 mkfs.ocfs2/Makefile                        |    2 +-
 mkfs.ocfs2/check.c                         |    5 -
 mkfs.ocfs2/mkfs.h                          |    2 +-
 mount.ocfs2/Makefile                       |    2 +-
 mount.ocfs2/mount.ocfs2.h                  |    3 -
 mounted.ocfs2/Makefile                     |    2 +-
 mounted.ocfs2/mounted.c                    |    5 +-
 o2cb_ctl/Makefile                          |    2 +-
 ocfs2_hb_ctl/Makefile                      |    4 +-
 ocfs2_hb_ctl/ocfs2_hb_ctl.c                |    3 -
 ocfs2_hb_ctl/ocfs2_hb_ctl.h                |   38 --
 ocfs2cdsl/Makefile                         |    2 +-
 ocfs2console/ocfs2interface/Makefile       |    2 +
 sizetest/Makefile                          |    2 +-
 sizetest/sizetest.c                        |    1 -
 tunefs.ocfs2/Makefile                      |    2 +-
 tunefs.ocfs2/tunefs.h                      |    4 -
 vendor/common/ocfs2-tools.spec-generic.in  |    1 +
 51 files changed, 1200 insertions(+), 1366 deletions(-)
 create mode 100644 include/Makefile
 create mode 100644 include/ocfs2-kernel/Makefile
 create mode 100644 include/ocfs2-kernel/kernel-list.h
 create mode 100644 include/ocfs2-kernel/ocfs1_fs_compat.h
 create mode 100644 include/ocfs2-kernel/ocfs2_fs.h
 create mode 100644 include/ocfs2-kernel/ocfs2_lockid.h
 create mode 100644 include/ocfs2-kernel/sparse_endian_types.h
 delete mode 100644 libo2cb/include/sparse_endian_types.h
 delete mode 100644 libo2dlm/include/kernel-list.h
 delete mode 100644 libocfs2/include/kernel-list.h
 delete mode 100644 libocfs2/include/ocfs1_fs_compat.h
 delete mode 100644 libocfs2/include/ocfs2_fs.h
 delete mode 100644 libocfs2/include/ocfs2_lockid.h
 delete mode 100644 ocfs2_hb_ctl/ocfs2_hb_ctl.h

diff --git a/Makefile b/Makefile
index 0c467e1..19de606 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ CHKCONFIG_DEP = chkconfig
 COMPILE_PY = 1
 endif
 
-SUBDIRS = libo2dlm libo2cb libocfs2 fsck.ocfs2 mkfs.ocfs2 mounted.ocfs2 tunefs.ocfs2 debugfs.ocfs2 o2cb_ctl ocfs2_hb_ctl mount.ocfs2 ocfs2cdsl listuuid sizetest extras patches
+SUBDIRS = include libo2dlm libo2cb libocfs2 fsck.ocfs2 mkfs.ocfs2 mounted.ocfs2 tunefs.ocfs2 debugfs.ocfs2 o2cb_ctl ocfs2_hb_ctl mount.ocfs2 ocfs2cdsl listuuid sizetest extras patches
 
 ifdef BUILD_OCFS2CONSOLE
 SUBDIRS += ocfs2console
diff --git a/debugfs.ocfs2/Makefile b/debugfs.ocfs2/Makefile
index 3b7547f..c45bf7b 100644
--- a/debugfs.ocfs2/Makefile
+++ b/debugfs.ocfs2/Makefile
@@ -8,7 +8,7 @@ SBIN_PROGRAMS = debugfs.ocfs2
 DEFINES = -DG_DISABLE_DEPRECATED -DLINUX -DDEBUGOCFS -DDEBUG
 DEFINES += -DOCFS2_FLAT_INCLUDES -DVERSION=\"$(VERSION)\" -DO2DLM_FLAT_INCLUDES -DO2CB_FLAT_INCLUDES
 
-INCLUDES = -Iinclude -I$(TOPDIR)/libocfs2/include -I$(TOPDIR)/libo2dlm/include -I$(TOPDIR)/libo2cb/include
+INCLUDES = -I$(TOPDIR)/include -Iinclude -I$(TOPDIR)/libocfs2/include -I$(TOPDIR)/libo2dlm/include -I$(TOPDIR)/libo2cb/include
 INCLUDES += $(GLIB_CFLAGS)
 
 ifdef OCFS2_DEBUG
diff --git a/debugfs.ocfs2/include/main.h b/debugfs.ocfs2/include/main.h
index 257ef7b..b4ed99d 100644
--- a/debugfs.ocfs2/include/main.h
+++ b/debugfs.ocfs2/include/main.h
@@ -57,8 +57,7 @@
 #include <linux/types.h>
 
 #include "ocfs2.h"
-#include "ocfs2_fs.h"
-#include "ocfs1_fs_compat.h"
+#include "ocfs2-kernel/ocfs1_fs_compat.h"
 
 enum {
 	CONFIG,
@@ -156,7 +155,7 @@ typedef struct _dbgfs_opts {
 
 /* remaining headers */
 #include <commands.h>
-#include <kernel-list.h>
+#include "ocfs2-kernel/kernel-list.h"
 #include <utils.h>
 #include <journal.h>
 #include <find_block_inode.h>
diff --git a/debugfs.ocfs2/include/ocfs2_internals.h b/debugfs.ocfs2/include/ocfs2_internals.h
index af233ef..87ea1aa 100644
--- a/debugfs.ocfs2/include/ocfs2_internals.h
+++ b/debugfs.ocfs2/include/ocfs2_internals.h
@@ -26,8 +26,8 @@
 #ifndef _OCFS2_INTERNALS_H_
 #define _OCFS2_INTERNALS_H_
 
-#include "sparse_endian_types.h"
-#include "ocfs2_lockid.h"
+#include "ocfs2-kernel/sparse_endian_types.h"
+#include "ocfs2-kernel/ocfs2_lockid.h"
 
 /*
  * Values taken from fs/ocfs2/dlm/dlmapi.h
diff --git a/extras/Makefile b/extras/Makefile
index e48d466..5a2675a 100644
--- a/extras/Makefile
+++ b/extras/Makefile
@@ -13,7 +13,7 @@ CFLAGS = $(OPTS) $(WARNINGS)
 
 UNINST_PROGRAMS = find_hardlinks find_dup_extents find_inode_paths set_random_bits decode_lockres encode_lockres mark_journal_dirty find_allocation_fragments compute_groups
 
-INCLUDES = -I../libocfs2/include -I$(TOPDIR)/libo2dlm/include -I$(TOPDIR)/libo2cb/include
+INCLUDES = -I$(TOPDIR)/include -I../libocfs2/include -I$(TOPDIR)/libo2dlm/include -I$(TOPDIR)/libo2cb/include
 
 OPTIMIZE = -O2
 
diff --git a/extras/compute_groups.c b/extras/compute_groups.c
index 197cf7f..5c9a66a 100644
--- a/extras/compute_groups.c
+++ b/extras/compute_groups.c
@@ -33,7 +33,6 @@
 #include <stdlib.h>
 
 #include "ocfs2.h"
-#include "ocfs2_fs.h"
 
 #define TWO_TERA	2199023255552LL
 
diff --git a/fsck.ocfs2/Makefile b/fsck.ocfs2/Makefile
index c44e7cf..a093bb4 100644
--- a/fsck.ocfs2/Makefile
+++ b/fsck.ocfs2/Makefile
@@ -5,7 +5,7 @@ include $(TOPDIR)/Preamble.make
 sbindir = $(root_sbindir)
 SBIN_PROGRAMS = fsck.ocfs2
 
-INCLUDES = -Iinclude -I$(TOPDIR)/libocfs2/include \
+INCLUDES = -I$(TOPDIR)/include -Iinclude -I$(TOPDIR)/libocfs2/include \
 	-I$(TOPDIR)/libo2dlm/include \
 	-I$(TOPDIR)/libo2cb/include
 LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
diff --git a/fsck.ocfs2/journal.c b/fsck.ocfs2/journal.c
index b865926..8ce8f9d 100644
--- a/fsck.ocfs2/journal.c
+++ b/fsck.ocfs2/journal.c
@@ -41,7 +41,6 @@
 #include <string.h>
 #include <inttypes.h>
 
-#include "byteorder.h"
 #include "fsck.h"
 #include "journal.h"
 #include "jbd.h"
diff --git a/fswreck/Makefile b/fswreck/Makefile
index ce8dd59..1a828a7 100644
--- a/fswreck/Makefile
+++ b/fswreck/Makefile
@@ -7,7 +7,7 @@ SBIN_PROGRAMS = fswreck
 DEFINES = -DG_DISABLE_DEPRECATED -DLINUX
 DEFINES += -DOCFS2_FLAT_INCLUDES -DO2DLM_FLAT_INCLUDES -DO2CB_FLAT_INCLUDES -DVERSION=\"$(VERSION)\"
 
-INCLUDES = -Iinclude -I$(TOPDIR)/libocfs2/include -I$(TOPDIR)/libo2dlm/include -I$(TOPDIR)/libo2cb/include
+INCLUDES = -I$(TOPDIR)/include -Iinclude -I$(TOPDIR)/libocfs2/include -I$(TOPDIR)/libo2dlm/include -I$(TOPDIR)/libo2cb/include
 INCLUDES += $(GLIB_CFLAGS)
 
 ifdef OCFS2_DEBUG
diff --git a/fswreck/include/main.h b/fswreck/include/main.h
index 13e3515..98bc2fb 100644
--- a/fswreck/include/main.h
+++ b/fswreck/include/main.h
@@ -52,8 +52,6 @@
 #include <linux/types.h>
 
 #include "ocfs2.h"
-#include "ocfs2_fs.h"
-#include "ocfs1_fs_compat.h"
 
 #define FSWRK_FATAL(fmt, arg...)	({ fprintf(stderr, "ERROR at %s, %d: " fmt ".  EXITING!!!\n", \
 						   __FILE__, __LINE__, ##arg);  \
diff --git a/include/Makefile b/include/Makefile
new file mode 100644
index 0000000..48a1d54
--- /dev/null
+++ b/include/Makefile
@@ -0,0 +1,7 @@
+TOPDIR = ..
+
+include $(TOPDIR)/Preamble.make
+
+SUBDIRS = ocfs2-kernel
+
+include $(TOPDIR)/Postamble.make
diff --git a/include/ocfs2-kernel/Makefile b/include/ocfs2-kernel/Makefile
new file mode 100644
index 0000000..e2aa47e
--- /dev/null
+++ b/include/ocfs2-kernel/Makefile
@@ -0,0 +1,14 @@
+TOPDIR = ../..
+
+include $(TOPDIR)/Preamble.make
+
+HEADERS_SUBDIR = ocfs2-kernel
+HEADERS =			\
+	kernel-list.h		\
+	ocfs1_fs_compat.h	\
+	ocfs2_fs.h		\
+	sparse_endian_types.h
+
+DIST_FILES = $(HEADERS)
+
+include $(TOPDIR)/Postamble.make
diff --git a/include/ocfs2-kernel/kernel-list.h b/include/ocfs2-kernel/kernel-list.h
new file mode 100644
index 0000000..a922d7a
--- /dev/null
+++ b/include/ocfs2-kernel/kernel-list.h
@@ -0,0 +1,116 @@
+#ifndef _LINUX_LIST_H
+#define _LINUX_LIST_H
+
+/*
+ * Simple doubly linked list implementation.
+ *
+ * Some of the internal functions ("__xxx") are useful when
+ * manipulating whole lists rather than single entries, as
+ * sometimes we already know the next/prev entries and we can
+ * generate better code by using them directly rather than
+ * using the generic single-entry routines.
+ */
+
+struct list_head {
+	struct list_head *next, *prev;
+};
+
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define LIST_HEAD(name) \
+	struct list_head name = { &name, &name }
+
+#define INIT_LIST_HEAD(ptr) do { \
+	(ptr)->next = (ptr); (ptr)->prev = (ptr); \
+} while (0)
+
+#if (!defined(__GNUC__) && !defined(__WATCOMC__))
+#define __inline__
+#endif
+
+/*
+ * Insert a new entry between two known consecutive entries. 
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static __inline__ void __list_add(struct list_head * new,
+	struct list_head * prev,
+	struct list_head * next)
+{
+	next->prev = new;
+	new->next = next;
+	new->prev = prev;
+	prev->next = new;
+}
+
+/*
+ * Insert a new entry after the specified head..
+ */
+static __inline__ void list_add(struct list_head *new, struct list_head *head)
+{
+	__list_add(new, head, head->next);
+}
+
+/*
+ * Insert a new entry at the tail
+ */
+static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
+{
+	__list_add(new, head->prev, head);
+}
+
+/*
+ * Delete a list entry by making the prev/next entries
+ * point to each other.
+ *
+ * This is only for internal list manipulation where we know
+ * the prev/next entries already!
+ */
+static __inline__ void __list_del(struct list_head * prev,
+				  struct list_head * next)
+{
+	next->prev = prev;
+	prev->next = next;
+}
+
+static __inline__ void list_del(struct list_head *entry)
+{
+	__list_del(entry->prev, entry->next);
+}
+
+static __inline__ int list_empty(struct list_head *head)
+{
+	return head->next == head;
+}
+
+/*
+ * Splice in "list" into "head"
+ */
+static __inline__ void list_splice(struct list_head *list, struct list_head *head)
+{
+	struct list_head *first = list->next;
+
+	if (first != list) {
+		struct list_head *last = list->prev;
+		struct list_head *at = head->next;
+
+		first->prev = head;
+		head->next = first;
+
+		last->next = at;
+		at->prev = last;
+	}
+}
+
+#define list_entry(ptr, type, member) \
+	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+
+#define list_for_each(pos, head) \
+        for (pos = (head)->next; pos != (head); pos = pos->next)
+
+#define list_for_each_safe(pos, n, head) \
+	        for (pos = (head)->next, n = pos->next; pos != (head); \
+		                     pos = n, n = pos->next)
+
+#endif
diff --git a/include/ocfs2-kernel/ocfs1_fs_compat.h b/include/ocfs2-kernel/ocfs1_fs_compat.h
new file mode 100644
index 0000000..0b499bc
--- /dev/null
+++ b/include/ocfs2-kernel/ocfs1_fs_compat.h
@@ -0,0 +1,109 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * ocfs1_fs_compat.h
+ *
+ * OCFS1 volume header definitions.  OCFS2 creates valid but unmountable
+ * OCFS1 volume headers on the first two sectors of an OCFS2 volume.
+ * This allows an OCFS1 volume to see the partition and cleanly fail to
+ * mount it.
+ *
+ * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License, version 2,  as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#ifndef _OCFS1_FS_COMPAT_H
+#define _OCFS1_FS_COMPAT_H
+
+#define OCFS1_MAX_VOL_SIGNATURE_LEN          128
+#define OCFS1_MAX_MOUNT_POINT_LEN            128
+#define OCFS1_MAX_VOL_ID_LENGTH               16
+#define OCFS1_MAX_VOL_LABEL_LEN               64
+#define OCFS1_MAX_CLUSTER_NAME_LEN            64
+
+#define OCFS1_MAJOR_VERSION              (2)
+#define OCFS1_MINOR_VERSION              (0)
+#define OCFS1_VOLUME_SIGNATURE		 "OracleCFS"
+
+/*
+ * OCFS1 superblock.  Lives at sector 0.
+ */
+struct ocfs1_vol_disk_hdr
+{
+/*00*/	__u32 minor_version;
+	__u32 major_version;
+/*08*/	__u8 signature[OCFS1_MAX_VOL_SIGNATURE_LEN];
+/*88*/	__u8 mount_point[OCFS1_MAX_MOUNT_POINT_LEN];
+/*108*/	__u64 serial_num;
+/*110*/	__u64 device_size;
+	__u64 start_off;
+/*120*/	__u64 bitmap_off;
+	__u64 publ_off;
+/*130*/	__u64 vote_off;
+	__u64 root_bitmap_off;
+/*140*/	__u64 data_start_off;
+	__u64 root_bitmap_size;
+/*150*/	__u64 root_off;
+	__u64 root_size;
+/*160*/	__u64 cluster_size;
+	__u64 num_nodes;
+/*170*/	__u64 num_clusters;
+	__u64 dir_node_size;
+/*180*/	__u64 file_node_size;
+	__u64 internal_off;
+/*190*/	__u64 node_cfg_off;
+	__u64 node_cfg_size;
+/*1A0*/	__u64 new_cfg_off;
+	__u32 prot_bits;
+	__s32 excl_mount;
+/*1B0*/
+};
+
+
+struct ocfs1_disk_lock
+{
+/*00*/	__u32 curr_master;
+	__u8 file_lock;
+	__u8 compat_pad[3];  /* Not in orignal definition.  Used to
+				make the already existing alignment
+				explicit */
+	__u64 last_write_time;
+/*10*/	__u64 last_read_time;
+	__u32 writer_node_num;
+	__u32 reader_node_num;
+/*20*/	__u64 oin_node_map;
+	__u64 dlock_seq_num;
+/*30*/
+};
+
+/*
+ * OCFS1 volume label.  Lives at sector 1.
+ */
+struct ocfs1_vol_label
+{
+/*00*/	struct ocfs1_disk_lock disk_lock;
+/*30*/	__u8 label[OCFS1_MAX_VOL_LABEL_LEN];
+/*70*/	__u16 label_len;
+/*72*/	__u8 vol_id[OCFS1_MAX_VOL_ID_LENGTH];
+/*82*/	__u16 vol_id_len;
+/*84*/	__u8 cluster_name[OCFS1_MAX_CLUSTER_NAME_LEN];
+/*A4*/	__u16 cluster_name_len;
+/*A6*/
+};
+
+
+#endif /* _OCFS1_FS_COMPAT_H */
+
diff --git a/include/ocfs2-kernel/ocfs2_fs.h b/include/ocfs2-kernel/ocfs2_fs.h
new file mode 100644
index 0000000..cfaf28f
--- /dev/null
+++ b/include/ocfs2-kernel/ocfs2_fs.h
@@ -0,0 +1,823 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * ocfs2_fs.h
+ *
+ * On-disk structures for OCFS2.
+ *
+ * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License, version 2,  as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#ifndef _OCFS2_FS_H
+#define _OCFS2_FS_H
+
+/* Version */
+#define OCFS2_MAJOR_REV_LEVEL		0
+#define OCFS2_MINOR_REV_LEVEL          	90
+
+/*
+ * An OCFS2 volume starts this way:
+ * Sector 0: Valid ocfs1_vol_disk_hdr that cleanly fails to mount OCFS.
+ * Sector 1: Valid ocfs1_vol_label that cleanly fails to mount OCFS.
+ * Block OCFS2_SUPER_BLOCK_BLKNO: OCFS2 superblock.
+ *
+ * All other structures are found from the superblock information.
+ *
+ * OCFS2_SUPER_BLOCK_BLKNO is in blocks, not sectors.  eg, for a
+ * blocksize of 2K, it is 4096 bytes into disk.
+ */
+#define OCFS2_SUPER_BLOCK_BLKNO		2
+
+/*
+ * Cluster size limits. The maximum is kept arbitrarily at 1 MB, and could
+ * grow if needed.
+ */
+#define OCFS2_MIN_CLUSTERSIZE		4096
+#define OCFS2_MAX_CLUSTERSIZE		1048576
+
+/*
+ * Blocks cannot be bigger than clusters, so the maximum blocksize is the
+ * minimum cluster size.
+ */
+#define OCFS2_MIN_BLOCKSIZE		512
+#define OCFS2_MAX_BLOCKSIZE		OCFS2_MIN_CLUSTERSIZE
+
+/* Filesystem magic number */
+#define OCFS2_SUPER_MAGIC		0x7461636f
+
+/* Object signatures */
+#define OCFS2_SUPER_BLOCK_SIGNATURE	"OCFSV2"
+#define OCFS2_INODE_SIGNATURE		"INODE01"
+#define OCFS2_EXTENT_BLOCK_SIGNATURE	"EXBLK01"
+#define OCFS2_GROUP_DESC_SIGNATURE      "GROUP01"
+
+/* Compatibility flags */
+#define OCFS2_HAS_COMPAT_FEATURE(sb,mask)			\
+	( OCFS2_SB(sb)->s_feature_compat & (mask) )
+#define OCFS2_HAS_RO_COMPAT_FEATURE(sb,mask)			\
+	( OCFS2_SB(sb)->s_feature_ro_compat & (mask) )
+#define OCFS2_HAS_INCOMPAT_FEATURE(sb,mask)			\
+	( OCFS2_SB(sb)->s_feature_incompat & (mask) )
+#define OCFS2_SET_COMPAT_FEATURE(sb,mask)			\
+	OCFS2_SB(sb)->s_feature_compat |= (mask)
+#define OCFS2_SET_RO_COMPAT_FEATURE(sb,mask)			\
+	OCFS2_SB(sb)->s_feature_ro_compat |= (mask)
+#define OCFS2_SET_INCOMPAT_FEATURE(sb,mask)			\
+	OCFS2_SB(sb)->s_feature_incompat |= (mask)
+#define OCFS2_CLEAR_COMPAT_FEATURE(sb,mask)			\
+	OCFS2_SB(sb)->s_feature_compat &= ~(mask)
+#define OCFS2_CLEAR_RO_COMPAT_FEATURE(sb,mask)			\
+	OCFS2_SB(sb)->s_feature_ro_compat &= ~(mask)
+#define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask)			\
+	OCFS2_SB(sb)->s_feature_incompat &= ~(mask)
+
+#define OCFS2_FEATURE_COMPAT_SUPP	OCFS2_FEATURE_COMPAT_BACKUP_SB
+#define OCFS2_FEATURE_INCOMPAT_SUPP	(OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT \
+					 | OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC)
+#define OCFS2_FEATURE_RO_COMPAT_SUPP	OCFS2_FEATURE_RO_COMPAT_UNWRITTEN
+
+/*
+ * Heartbeat-only devices are missing journals and other files.  The
+ * filesystem driver can't load them, but the library can.  Never put
+ * this in OCFS2_FEATURE_INCOMPAT_SUPP, *ever*.
+ */
+#define OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV	0x0002
+
+/*
+ * tunefs sets this incompat flag before starting the resize and clears it
+ * at the end. This flag protects users from inadvertently mounting the fs
+ * after an aborted run without fsck-ing.
+ */
+#define OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG    0x0004
+
+/* Used to denote a non-clustered volume */
+#define OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT	0x0008
+
+/* Support for sparse allocation in b-trees */
+#define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC	0x0010
+
+/*
+ * Tunefs sets this incompat flag before starting an operation which
+ * would require cleanup on abort. This is done to protect users from
+ * inadvertently mounting the fs after an aborted run without
+ * fsck-ing.
+ *
+ * s_tunefs_flags on the super block describes precisely which
+ * operations were in progress.
+ */
+#define OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG	0x0020
+
+/* Support for data packed into inode blocks */
+#define OCFS2_FEATURE_INCOMPAT_INLINE_DATA	0x0040
+
+/*
+ * backup superblock flag is used to indicate that this volume
+ * has backup superblocks.
+ */
+#define OCFS2_FEATURE_COMPAT_BACKUP_SB		0x0001
+
+/*
+ * Unwritten extents support.
+ */
+#define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN	0x0001
+
+/* The byte offset of the first backup block will be 1G.
+ * The following will be 4G, 16G, 64G, 256G and 1T.
+ */
+#define OCFS2_BACKUP_SB_START			1 << 30
+
+/* the max backup superblock nums */
+#define OCFS2_MAX_BACKUP_SUPERBLOCKS	6
+
+/*
+ * Flags on ocfs2_super_block.s_tunefs_flags
+ */
+#define OCFS2_TUNEFS_INPROG_REMOVE_SLOT		0x0001	/* Removing slots */
+
+/*
+ * Flags on ocfs2_dinode.i_flags
+ */
+#define OCFS2_VALID_FL		(0x00000001)	/* Inode is valid */
+#define OCFS2_UNUSED2_FL	(0x00000002)
+#define OCFS2_ORPHANED_FL	(0x00000004)	/* On the orphan list */
+#define OCFS2_UNUSED3_FL	(0x00000008)
+/* System inode flags */
+#define OCFS2_SYSTEM_FL		(0x00000010)	/* System inode */
+#define OCFS2_SUPER_BLOCK_FL	(0x00000020)	/* Super block */
+#define OCFS2_LOCAL_ALLOC_FL	(0x00000040)	/* Slot local alloc bitmap */
+#define OCFS2_BITMAP_FL		(0x00000080)	/* Allocation bitmap */
+#define OCFS2_JOURNAL_FL	(0x00000100)	/* Slot local journal */
+#define OCFS2_HEARTBEAT_FL	(0x00000200)	/* Heartbeat area */
+#define OCFS2_CHAIN_FL		(0x00000400)	/* Chain allocator */
+#define OCFS2_DEALLOC_FL	(0x00000800)	/* Truncate log */
+
+/*
+ * Flags on ocfs2_dinode.i_dyn_features
+ *
+ * These can change much more often than i_flags. When adding flags,
+ * keep in mind that i_dyn_features is only 16 bits wide.
+ */
+#define OCFS2_INLINE_DATA_FL	(0x0001)	/* Data stored in inode block */
+#define OCFS2_HAS_XATTR_FL	(0x0002)
+#define OCFS2_INLINE_XATTR_FL	(0x0004)
+#define OCFS2_INDEXED_DIR_FL	(0x0008)
+
+/* Inode attributes, keep in sync with EXT2 */
+#define OCFS2_SECRM_FL		(0x00000001)	/* Secure deletion */
+#define OCFS2_UNRM_FL		(0x00000002)	/* Undelete */
+#define OCFS2_COMPR_FL		(0x00000004)	/* Compress file */
+#define OCFS2_SYNC_FL		(0x00000008)	/* Synchronous updates */
+#define OCFS2_IMMUTABLE_FL	(0x00000010)	/* Immutable file */
+#define OCFS2_APPEND_FL		(0x00000020)	/* writes to file may only append */
+#define OCFS2_NODUMP_FL		(0x00000040)	/* do not dump file */
+#define OCFS2_NOATIME_FL	(0x00000080)	/* do not update atime */
+#define OCFS2_DIRSYNC_FL	(0x00010000)	/* dirsync behaviour (directories only) */
+
+#define OCFS2_FL_VISIBLE	(0x000100FF)	/* User visible flags */
+#define OCFS2_FL_MODIFIABLE	(0x000100FF)	/* User modifiable flags */
+
+/*
+ * Extent record flags (e_node.leaf.flags)
+ */
+#define OCFS2_EXT_UNWRITTEN	(0x01)	/* Extent is allocated but
+					 * unwritten */
+
+/*
+ * ioctl commands
+ */
+#define OCFS2_IOC_GETFLAGS	_IOR('f', 1, long)
+#define OCFS2_IOC_SETFLAGS	_IOW('f', 2, long)
+#define OCFS2_IOC32_GETFLAGS	_IOR('f', 1, int)
+#define OCFS2_IOC32_SETFLAGS	_IOW('f', 2, int)
+
+/*
+ * Space reservation / allocation / free ioctls and argument structure
+ * are designed to be compatible with XFS.
+ *
+ * ALLOCSP* and FREESP* are not and will never be supported, but are
+ * included here for completeness.
+ */
+struct ocfs2_space_resv {
+	__s16		l_type;
+	__s16		l_whence;
+	__s64		l_start;
+	__s64		l_len;		/* len == 0 means until end of file */
+	__s32		l_sysid;
+	__u32		l_pid;
+	__s32		l_pad[4];	/* reserve area			    */
+};
+
+#define OCFS2_IOC_ALLOCSP		_IOW ('X', 10, struct ocfs2_space_resv)
+#define OCFS2_IOC_FREESP		_IOW ('X', 11, struct ocfs2_space_resv)
+#define OCFS2_IOC_RESVSP		_IOW ('X', 40, struct ocfs2_space_resv)
+#define OCFS2_IOC_UNRESVSP	_IOW ('X', 41, struct ocfs2_space_resv)
+#define OCFS2_IOC_ALLOCSP64	_IOW ('X', 36, struct ocfs2_space_resv)
+#define OCFS2_IOC_FREESP64	_IOW ('X', 37, struct ocfs2_space_resv)
+#define OCFS2_IOC_RESVSP64	_IOW ('X', 42, struct ocfs2_space_resv)
+#define OCFS2_IOC_UNRESVSP64	_IOW ('X', 43, struct ocfs2_space_resv)
+
+/*
+ * Journal Flags (ocfs2_dinode.id1.journal1.i_flags)
+ */
+#define OCFS2_JOURNAL_DIRTY_FL	(0x00000001)	/* Journal needs recovery */
+
+/*
+ * superblock s_state flags
+ */
+#define OCFS2_ERROR_FS		(0x00000001)	/* FS saw errors */
+
+/* Limit of space in ocfs2_dir_entry */
+#define OCFS2_MAX_FILENAME_LEN		255
+
+/* Maximum slots on an ocfs2 file system */
+#define OCFS2_MAX_SLOTS			255
+
+/* Slot map indicator for an empty slot */
+#define OCFS2_INVALID_SLOT		-1
+
+#define OCFS2_VOL_UUID_LEN		16
+#define OCFS2_MAX_VOL_LABEL_LEN		64
+
+/* Journal limits (in bytes) */
+#define OCFS2_MIN_JOURNAL_SIZE		(4 * 1024 * 1024)
+
+struct ocfs2_system_inode_info {
+	char	*si_name;
+	int	si_iflags;
+	int	si_mode;
+};
+
+/* System file index */
+enum {
+	BAD_BLOCK_SYSTEM_INODE = 0,
+	GLOBAL_INODE_ALLOC_SYSTEM_INODE,
+	SLOT_MAP_SYSTEM_INODE,
+#define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE
+	HEARTBEAT_SYSTEM_INODE,
+	GLOBAL_BITMAP_SYSTEM_INODE,
+#define OCFS2_LAST_GLOBAL_SYSTEM_INODE GLOBAL_BITMAP_SYSTEM_INODE
+	ORPHAN_DIR_SYSTEM_INODE,
+	EXTENT_ALLOC_SYSTEM_INODE,
+	INODE_ALLOC_SYSTEM_INODE,
+	JOURNAL_SYSTEM_INODE,
+	LOCAL_ALLOC_SYSTEM_INODE,
+	TRUNCATE_LOG_SYSTEM_INODE,
+	NUM_SYSTEM_INODES
+};
+
+static struct ocfs2_system_inode_info ocfs2_system_inodes[NUM_SYSTEM_INODES] = {
+	/* Global system inodes (single copy) */
+	/* The first two are only used from userspace mfks/tunefs */
+	[BAD_BLOCK_SYSTEM_INODE]		= { "bad_blocks", 0, S_IFREG | 0644 },
+	[GLOBAL_INODE_ALLOC_SYSTEM_INODE] 	= { "global_inode_alloc", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
+
+	/* These are used by the running filesystem */
+	[SLOT_MAP_SYSTEM_INODE]			= { "slot_map", 0, S_IFREG | 0644 },
+	[HEARTBEAT_SYSTEM_INODE]		= { "heartbeat", OCFS2_HEARTBEAT_FL, S_IFREG | 0644 },
+	[GLOBAL_BITMAP_SYSTEM_INODE]		= { "global_bitmap", 0, S_IFREG | 0644 },
+
+	/* Slot-specific system inodes (one copy per slot) */
+	[ORPHAN_DIR_SYSTEM_INODE]		= { "orphan_dir:%04d", 0, S_IFDIR | 0755 },
+	[EXTENT_ALLOC_SYSTEM_INODE]		= { "extent_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
+	[INODE_ALLOC_SYSTEM_INODE]		= { "inode_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
+	[JOURNAL_SYSTEM_INODE]			= { "journal:%04d", OCFS2_JOURNAL_FL, S_IFREG | 0644 },
+	[LOCAL_ALLOC_SYSTEM_INODE]		= { "local_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_LOCAL_ALLOC_FL, S_IFREG | 0644 },
+	[TRUNCATE_LOG_SYSTEM_INODE]		= { "truncate_log:%04d", OCFS2_DEALLOC_FL, S_IFREG | 0644 }
+};
+
+/* Parameter passed from mount.ocfs2 to module */
+#define OCFS2_HB_NONE			"heartbeat=none"
+#define OCFS2_HB_LOCAL			"heartbeat=local"
+
+/*
+ * OCFS2 directory file types.  Only the low 3 bits are used.  The
+ * other bits are reserved for now.
+ */
+#define OCFS2_FT_UNKNOWN	0
+#define OCFS2_FT_REG_FILE	1
+#define OCFS2_FT_DIR		2
+#define OCFS2_FT_CHRDEV		3
+#define OCFS2_FT_BLKDEV		4
+#define OCFS2_FT_FIFO		5
+#define OCFS2_FT_SOCK		6
+#define OCFS2_FT_SYMLINK	7
+
+#define OCFS2_FT_MAX		8
+
+/*
+ * OCFS2_DIR_PAD defines the directory entries boundaries
+ *
+ * NOTE: It must be a multiple of 4
+ */
+#define OCFS2_DIR_PAD			4
+#define OCFS2_DIR_ROUND			(OCFS2_DIR_PAD - 1)
+#define OCFS2_DIR_MEMBER_LEN 		offsetof(struct ocfs2_dir_entry, name)
+#define OCFS2_DIR_REC_LEN(name_len)	(((name_len) + OCFS2_DIR_MEMBER_LEN + \
+                                          OCFS2_DIR_ROUND) & \
+					 ~OCFS2_DIR_ROUND)
+
+#define OCFS2_LINK_MAX		32000
+
+#define S_SHIFT			12
+static unsigned char ocfs2_type_by_mode[S_IFMT >> S_SHIFT] = {
+	[S_IFREG >> S_SHIFT]  = OCFS2_FT_REG_FILE,
+	[S_IFDIR >> S_SHIFT]  = OCFS2_FT_DIR,
+	[S_IFCHR >> S_SHIFT]  = OCFS2_FT_CHRDEV,
+	[S_IFBLK >> S_SHIFT]  = OCFS2_FT_BLKDEV,
+	[S_IFIFO >> S_SHIFT]  = OCFS2_FT_FIFO,
+	[S_IFSOCK >> S_SHIFT] = OCFS2_FT_SOCK,
+	[S_IFLNK >> S_SHIFT]  = OCFS2_FT_SYMLINK,
+};
+
+
+/*
+ * Convenience casts
+ */
+#define OCFS2_RAW_SB(dinode)		(&((dinode)->id2.i_super))
+
+/*
+ * On disk extent record for OCFS2
+ * It describes a range of clusters on disk.
+ *
+ * Length fields are divided into interior and leaf node versions.
+ * This leaves room for a flags field (OCFS2_EXT_*) in the leaf nodes.
+ */
+struct ocfs2_extent_rec {
+/*00*/	__le32 e_cpos;		/* Offset into the file, in clusters */
+	union {
+		__le32 e_int_clusters; /* Clusters covered by all children */
+		struct {
+			__le16 e_leaf_clusters; /* Clusters covered by this
+						   extent */
+			__u8 e_reserved1;
+			__u8 e_flags; /* Extent flags */
+		};
+	};
+	__le64 e_blkno;		/* Physical disk offset, in blocks */
+/*10*/
+};
+
+struct ocfs2_chain_rec {
+	__le32 c_free;	/* Number of free bits in this chain. */
+	__le32 c_total;	/* Number of total bits in this chain */
+	__le64 c_blkno;	/* Physical disk offset (blocks) of 1st group */
+};
+
+struct ocfs2_truncate_rec {
+	__le32 t_start;		/* 1st cluster in this log */
+	__le32 t_clusters;	/* Number of total clusters covered */
+};
+
+/*
+ * On disk extent list for OCFS2 (node in the tree).  Note that this
+ * is contained inside ocfs2_dinode or ocfs2_extent_block, so the
+ * offsets are relative to ocfs2_dinode.id2.i_list or
+ * ocfs2_extent_block.h_list, respectively.
+ */
+struct ocfs2_extent_list {
+/*00*/	__le16 l_tree_depth;		/* Extent tree depth from this
+					   point.  0 means data extents
+					   hang directly off this
+					   header (a leaf)
+					   NOTE: The high 8 bits cannot be
+					   used - tree_depth is never that big.
+					*/
+	__le16 l_count;			/* Number of extent records */
+	__le16 l_next_free_rec;		/* Next unused extent slot */
+	__le16 l_reserved1;
+	__le64 l_reserved2;		/* Pad to
+					   sizeof(ocfs2_extent_rec) */
+/*10*/	struct ocfs2_extent_rec l_recs[0];	/* Extent records */
+};
+
+/*
+ * On disk allocation chain list for OCFS2.  Note that this is
+ * contained inside ocfs2_dinode, so the offsets are relative to
+ * ocfs2_dinode.id2.i_chain.
+ */
+struct ocfs2_chain_list {
+/*00*/	__le16 cl_cpg;			/* Clusters per Block Group */
+	__le16 cl_bpc;			/* Bits per cluster */
+	__le16 cl_count;		/* Total chains in this list */
+	__le16 cl_next_free_rec;	/* Next unused chain slot */
+	__le64 cl_reserved1;
+/*10*/	struct ocfs2_chain_rec cl_recs[0];	/* Chain records */
+};
+
+/*
+ * On disk deallocation log for OCFS2.  Note that this is
+ * contained inside ocfs2_dinode, so the offsets are relative to
+ * ocfs2_dinode.id2.i_dealloc.
+ */
+struct ocfs2_truncate_log {
+/*00*/	__le16 tl_count;		/* Total records in this log */
+	__le16 tl_used;			/* Number of records in use */
+	__le32 tl_reserved1;
+/*08*/	struct ocfs2_truncate_rec tl_recs[0];	/* Truncate records */
+};
+
+/*
+ * On disk extent block (indirect block) for OCFS2
+ */
+struct ocfs2_extent_block
+{
+/*00*/	__u8 h_signature[8];		/* Signature for verification */
+	__le64 h_reserved1;
+/*10*/	__le16 h_suballoc_slot;		/* Slot suballocator this
+					   extent_header belongs to */
+	__le16 h_suballoc_bit;		/* Bit offset in suballocator
+					   block group */
+	__le32 h_fs_generation;		/* Must match super block */
+	__le64 h_blkno;			/* Offset on disk, in blocks */
+/*20*/	__le64 h_reserved3;
+	__le64 h_next_leaf_blk;		/* Offset on disk, in blocks,
+					   of next leaf header pointing
+					   to data */
+/*30*/	struct ocfs2_extent_list h_list;	/* Extent record list */
+/* Actual on-disk size is one block */
+};
+
+/*
+ * On disk superblock for OCFS2
+ * Note that it is contained inside an ocfs2_dinode, so all offsets
+ * are relative to the start of ocfs2_dinode.id2.
+ */
+struct ocfs2_super_block {
+/*00*/	__le16 s_major_rev_level;
+	__le16 s_minor_rev_level;
+	__le16 s_mnt_count;
+	__le16 s_max_mnt_count;
+	__le16 s_state;			/* File system state */
+	__le16 s_errors;			/* Behaviour when detecting errors */
+	__le32 s_checkinterval;		/* Max time between checks */
+/*10*/	__le64 s_lastcheck;		/* Time of last check */
+	__le32 s_creator_os;		/* OS */
+	__le32 s_feature_compat;		/* Compatible feature set */
+/*20*/	__le32 s_feature_incompat;	/* Incompatible feature set */
+	__le32 s_feature_ro_compat;	/* Readonly-compatible feature set */
+	__le64 s_root_blkno;		/* Offset, in blocks, of root directory
+					   dinode */
+/*30*/	__le64 s_system_dir_blkno;	/* Offset, in blocks, of system
+					   directory dinode */
+	__le32 s_blocksize_bits;		/* Blocksize for this fs */
+	__le32 s_clustersize_bits;	/* Clustersize for this fs */
+/*40*/	__le16 s_max_slots;		/* Max number of simultaneous mounts
+					   before tunefs required */
+	__le16 s_tunefs_flag;
+	__le32 s_reserved1;
+	__le64 s_first_cluster_group;	/* Block offset of 1st cluster
+					 * group header */
+/*50*/	__u8  s_label[OCFS2_MAX_VOL_LABEL_LEN];	/* Label for mounting, etc. */
+/*90*/	__u8  s_uuid[OCFS2_VOL_UUID_LEN];	/* 128-bit uuid */
+/*A0*/
+};
+
+/*
+ * Local allocation bitmap for OCFS2 slots
+ * Note that it exists inside an ocfs2_dinode, so all offsets are
+ * relative to the start of ocfs2_dinode.id2.
+ */
+struct ocfs2_local_alloc
+{
+/*00*/	__le32 la_bm_off;	/* Starting bit offset in main bitmap */
+	__le16 la_size;		/* Size of included bitmap, in bytes */
+	__le16 la_reserved1;
+	__le64 la_reserved2;
+/*10*/	__u8   la_bitmap[0];
+};
+
+/*
+ * Data-in-inode header. This is only used if i_dyn_features has
+ * OCFS2_INLINE_DATA_FL set.
+ */
+struct ocfs2_inline_data
+{
+/*00*/	__le16	id_count;	/* Number of bytes that can be used
+				 * for data, starting at id_data */
+	__le16	id_reserved0;
+	__le32	id_reserved1;
+	__u8	id_data[0];	/* Start of user data */
+};
+
+/*
+ * On disk inode for OCFS2
+ */
+struct ocfs2_dinode {
+/*00*/	__u8 i_signature[8];		/* Signature for validation */
+	__le32 i_generation;		/* Generation number */
+	__le16 i_suballoc_slot;		/* Slot suballocator this inode
+					   belongs to */
+	__le16 i_suballoc_bit;		/* Bit offset in suballocator
+					   block group */
+/*10*/	__le32 i_reserved0;
+	__le32 i_clusters;		/* Cluster count */
+	__le32 i_uid;			/* Owner UID */
+	__le32 i_gid;			/* Owning GID */
+/*20*/	__le64 i_size;			/* Size in bytes */
+	__le16 i_mode;			/* File mode */
+	__le16 i_links_count;		/* Links count */
+	__le32 i_flags;			/* File flags */
+/*30*/	__le64 i_atime;			/* Access time */
+	__le64 i_ctime;			/* Creation time */
+/*40*/	__le64 i_mtime;			/* Modification time */
+	__le64 i_dtime;			/* Deletion time */
+/*50*/	__le64 i_blkno;			/* Offset on disk, in blocks */
+	__le64 i_last_eb_blk;		/* Pointer to last extent
+					   block */
+/*60*/	__le32 i_fs_generation;		/* Generation per fs-instance */
+	__le32 i_atime_nsec;
+	__le32 i_ctime_nsec;
+	__le32 i_mtime_nsec;
+	__le32 i_attr;
+	__le16 i_orphaned_slot;		/* Only valid when OCFS2_ORPHANED_FL
+					   was set in i_flags */
+	__le16 i_dyn_features;
+/*70*/	__le64 i_reserved2[8];
+/*B8*/	union {
+		__le64 i_pad1;		/* Generic way to refer to this
+					   64bit union */
+		struct {
+			__le64 i_rdev;	/* Device number */
+		} dev1;
+		struct {		/* Info for bitmap system
+					   inodes */
+			__le32 i_used;	/* Bits (ie, clusters) used  */
+			__le32 i_total;	/* Total bits (clusters)
+					   available */
+		} bitmap1;
+		struct {		/* Info for journal system
+					   inodes */
+			__le32 ij_flags;	/* Mounted, version, etc. */
+			__le32 ij_pad;
+		} journal1;
+	} id1;				/* Inode type dependant 1 */
+/*C0*/	union {
+		struct ocfs2_super_block	i_super;
+		struct ocfs2_local_alloc	i_lab;
+		struct ocfs2_chain_list		i_chain;
+		struct ocfs2_extent_list	i_list;
+		struct ocfs2_truncate_log	i_dealloc;
+		struct ocfs2_inline_data	i_data;
+		__u8               		i_symlink[0];
+	} id2;
+/* Actual on-disk size is one block */
+};
+
+/*
+ * On-disk directory entry structure for OCFS2
+ *
+ * Packed as this structure could be accessed unaligned on 64-bit platforms
+ */
+struct ocfs2_dir_entry {
+/*00*/	__le64   inode;                  /* Inode number */
+	__le16   rec_len;                /* Directory entry length */
+	__u8    name_len;               /* Name length */
+	__u8    file_type;
+/*0C*/	char    name[OCFS2_MAX_FILENAME_LEN];   /* File name */
+/* Actual on-disk length specified by rec_len */
+} __attribute__ ((packed));
+
+/*
+ * On disk allocator group structure for OCFS2
+ */
+struct ocfs2_group_desc
+{
+/*00*/	__u8    bg_signature[8];        /* Signature for validation */
+	__le16   bg_size;                /* Size of included bitmap in
+					   bytes. */
+	__le16   bg_bits;                /* Bits represented by this
+					   group. */
+	__le16	bg_free_bits_count;     /* Free bits count */
+	__le16   bg_chain;               /* What chain I am in. */
+/*10*/	__le32   bg_generation;
+	__le32	bg_reserved1;
+	__le64   bg_next_group;          /* Next group in my list, in
+					   blocks */
+/*20*/	__le64   bg_parent_dinode;       /* dinode which owns me, in
+					   blocks */
+	__le64   bg_blkno;               /* Offset on disk, in blocks */
+/*30*/	__le64   bg_reserved2[2];
+/*40*/	__u8    bg_bitmap[0];
+};
+
+#ifdef __KERNEL__
+static inline int ocfs2_fast_symlink_chars(struct super_block *sb)
+{
+	return  sb->s_blocksize -
+		 offsetof(struct ocfs2_dinode, id2.i_symlink);
+}
+
+static inline int ocfs2_max_inline_data(struct super_block *sb)
+{
+	return sb->s_blocksize -
+		offsetof(struct ocfs2_dinode, id2.i_data.id_data);
+}
+
+static inline int ocfs2_extent_recs_per_inode(struct super_block *sb)
+{
+	int size;
+
+	size = sb->s_blocksize -
+		offsetof(struct ocfs2_dinode, id2.i_list.l_recs);
+
+	return size / sizeof(struct ocfs2_extent_rec);
+}
+
+static inline int ocfs2_chain_recs_per_inode(struct super_block *sb)
+{
+	int size;
+
+	size = sb->s_blocksize -
+		offsetof(struct ocfs2_dinode, id2.i_chain.cl_recs);
+
+	return size / sizeof(struct ocfs2_chain_rec);
+}
+
+static inline u16 ocfs2_extent_recs_per_eb(struct super_block *sb)
+{
+	int size;
+
+	size = sb->s_blocksize -
+		offsetof(struct ocfs2_extent_block, h_list.l_recs);
+
+	return size / sizeof(struct ocfs2_extent_rec);
+}
+
+static inline u16 ocfs2_local_alloc_size(struct super_block *sb)
+{
+	u16 size;
+
+	size = sb->s_blocksize -
+		offsetof(struct ocfs2_dinode, id2.i_lab.la_bitmap);
+
+	return size;
+}
+
+static inline int ocfs2_group_bitmap_size(struct super_block *sb)
+{
+	int size;
+
+	size = sb->s_blocksize -
+		offsetof(struct ocfs2_group_desc, bg_bitmap);
+
+	return size;
+}
+
+static inline int ocfs2_truncate_recs_per_inode(struct super_block *sb)
+{
+	int size;
+
+	size = sb->s_blocksize -
+		offsetof(struct ocfs2_dinode, id2.i_dealloc.tl_recs);
+
+	return size / sizeof(struct ocfs2_truncate_rec);
+}
+
+static inline u64 ocfs2_backup_super_blkno(struct super_block *sb, int index)
+{
+	u64 offset = OCFS2_BACKUP_SB_START;
+
+	if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) {
+		offset <<= (2 * index);
+		offset >>= sb->s_blocksize_bits;
+		return offset;
+	}
+
+	return 0;
+
+}
+#else
+static inline int ocfs2_fast_symlink_chars(int blocksize)
+{
+	return blocksize - offsetof(struct ocfs2_dinode, id2.i_symlink);
+}
+
+static inline int ocfs2_max_inline_data(int blocksize)
+{
+	return blocksize - offsetof(struct ocfs2_dinode, id2.i_data.id_data);
+}
+
+static inline int ocfs2_extent_recs_per_inode(int blocksize)
+{
+	int size;
+
+	size = blocksize -
+		offsetof(struct ocfs2_dinode, id2.i_list.l_recs);
+
+	return size / sizeof(struct ocfs2_extent_rec);
+}
+
+static inline int ocfs2_chain_recs_per_inode(int blocksize)
+{
+	int size;
+
+	size = blocksize -
+		offsetof(struct ocfs2_dinode, id2.i_chain.cl_recs);
+
+	return size / sizeof(struct ocfs2_chain_rec);
+}
+
+static inline int ocfs2_extent_recs_per_eb(int blocksize)
+{
+	int size;
+
+	size = blocksize -
+		offsetof(struct ocfs2_extent_block, h_list.l_recs);
+
+	return size / sizeof(struct ocfs2_extent_rec);
+}
+
+static inline int ocfs2_local_alloc_size(int blocksize)
+{
+	int size;
+
+	size = blocksize -
+		offsetof(struct ocfs2_dinode, id2.i_lab.la_bitmap);
+
+	return size;
+}
+
+static inline int ocfs2_group_bitmap_size(int blocksize)
+{
+	int size;
+
+	size = blocksize -
+		offsetof(struct ocfs2_group_desc, bg_bitmap);
+
+	return size;
+}
+
+static inline int ocfs2_truncate_recs_per_inode(int blocksize)
+{
+	int size;
+
+	size = blocksize -
+		offsetof(struct ocfs2_dinode, id2.i_dealloc.tl_recs);
+
+	return size / sizeof(struct ocfs2_truncate_rec);
+}
+
+static inline uint64_t ocfs2_backup_super_blkno(int blocksize, int index)
+{
+	uint64_t offset = OCFS2_BACKUP_SB_START;
+
+	if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) {
+		offset <<= (2 * index);
+		offset /= blocksize;
+		return offset;
+	}
+
+	return 0;
+}
+#endif  /* __KERNEL__ */
+
+
+static inline int ocfs2_system_inode_is_global(int type)
+{
+	return ((type >= 0) &&
+		(type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE));
+}
+
+static inline int ocfs2_sprintf_system_inode_name(char *buf, int len,
+						  int type, int slot)
+{
+	int chars;
+
+        /*
+         * Global system inodes can only have one copy.  Everything
+         * after OCFS2_LAST_GLOBAL_SYSTEM_INODE in the system inode
+         * list has a copy per slot.
+         */
+	if (type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE)
+		chars = snprintf(buf, len,
+				 ocfs2_system_inodes[type].si_name);
+	else
+		chars = snprintf(buf, len,
+				 ocfs2_system_inodes[type].si_name,
+				 slot);
+
+	return chars;
+}
+
+static inline void ocfs2_set_de_type(struct ocfs2_dir_entry *de,
+				    umode_t mode)
+{
+	de->file_type = ocfs2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
+}
+
+#endif  /* _OCFS2_FS_H */
+
diff --git a/include/ocfs2-kernel/ocfs2_lockid.h b/include/ocfs2-kernel/ocfs2_lockid.h
new file mode 100644
index 0000000..7dd9e1e
--- /dev/null
+++ b/include/ocfs2-kernel/ocfs2_lockid.h
@@ -0,0 +1,73 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * ocfs2_lockid.h
+ *
+ * Defines OCFS2 lockid bits.
+ *
+ * Copyright (C) 2002, 2005 Oracle.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#ifndef OCFS2_LOCKID_H
+#define OCFS2_LOCKID_H
+
+/* lock ids are made up in the following manner:
+ * name[0]     --> type
+ * name[1-6]   --> 6 pad characters, reserved for now
+ * name[7-22]  --> block number, expressed in hex as 16 chars
+ * name[23-30] --> i_generation, expressed in hex 8 chars
+ * name[31]    --> '\0' */
+#define OCFS2_LOCK_ID_MAX_LEN  32
+#define OCFS2_LOCK_ID_PAD "000000"
+
+enum ocfs2_lock_type {
+	OCFS2_LOCK_TYPE_META = 0,
+	OCFS2_LOCK_TYPE_DATA,
+	OCFS2_LOCK_TYPE_SUPER,
+	OCFS2_LOCK_TYPE_RENAME,
+	OCFS2_LOCK_TYPE_RW,
+	OCFS2_NUM_LOCK_TYPES
+};
+
+static inline char ocfs2_lock_type_char(enum ocfs2_lock_type type)
+{
+	char c;
+	switch (type) {
+		case OCFS2_LOCK_TYPE_META:
+			c = 'M';
+			break;
+		case OCFS2_LOCK_TYPE_DATA:
+			c = 'D';
+			break;
+		case OCFS2_LOCK_TYPE_SUPER:
+			c = 'S';
+			break;
+		case OCFS2_LOCK_TYPE_RENAME:
+			c = 'R';
+			break;
+		case OCFS2_LOCK_TYPE_RW:
+			c = 'W';
+			break;
+		default:
+			c = '\0';
+	}
+
+	return c;
+}
+
+#endif  /* OCFS2_LOCKID_H */
diff --git a/include/ocfs2-kernel/sparse_endian_types.h b/include/ocfs2-kernel/sparse_endian_types.h
new file mode 100644
index 0000000..e6f3b60
--- /dev/null
+++ b/include/ocfs2-kernel/sparse_endian_types.h
@@ -0,0 +1,13 @@
+#ifndef O2CB_SPARSE_ENDIAN_TYPES_H
+#define O2CB_SPARSE_ENDIAN_TYPES_H
+
+#include <linux/types.h>
+
+typedef __u16 __le16;
+typedef __u16 __be16;
+typedef __u32 __le32;
+typedef __u32 __be32;
+typedef __u64 __le64;
+typedef __u64 __be64;
+
+#endif /* O2CB_SPARSE_ENDIAN_TYPES_H */
diff --git a/libo2cb/Makefile b/libo2cb/Makefile
index b27f55c..37a965f 100644
--- a/libo2cb/Makefile
+++ b/libo2cb/Makefile
@@ -11,7 +11,7 @@ else
 OPTS += -O2
 endif
 
-INCLUDES = -Iinclude
+INCLUDES = -I$(TOPDIR)/include -Iinclude
 
 LIBRARIES = libo2cb.a
 
@@ -45,8 +45,7 @@ HFILES =				\
 	include/ocfs2_heartbeat.h	\
 	include/o2cb_abi.h		\
 	include/o2cb_crc32.h		\
-	include/o2cb.h			\
-	include/sparse_endian_types.h
+	include/o2cb.h
 
 HFILES_GEN =		\
 	include/o2cb_err.h
diff --git a/libo2cb/include/o2cb.h b/libo2cb/include/o2cb.h
index 7239f83..aabef61 100644
--- a/libo2cb/include/o2cb.h
+++ b/libo2cb/include/o2cb.h
@@ -41,9 +41,9 @@
 
 #include <et/com_err.h>
 
-#if O2CB_FLAT_INCLUDES
+#include <ocfs2-kernel/sparse_endian_types.h>
 
-#include "sparse_endian_types.h"
+#if O2CB_FLAT_INCLUDES
 
 #include "o2cb_err.h"
 
@@ -52,8 +52,6 @@
 
 #else
 
-#include <o2cb/sparse_endian_types.h>
-
 #include <o2cb/o2cb_err.h>
 
 #include <o2cb/ocfs2_nodemanager.h>
diff --git a/libo2cb/include/sparse_endian_types.h b/libo2cb/include/sparse_endian_types.h
deleted file mode 100644
index e6f3b60..0000000
--- a/libo2cb/include/sparse_endian_types.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef O2CB_SPARSE_ENDIAN_TYPES_H
-#define O2CB_SPARSE_ENDIAN_TYPES_H
-
-#include <linux/types.h>
-
-typedef __u16 __le16;
-typedef __u16 __be16;
-typedef __u32 __le32;
-typedef __u32 __be32;
-typedef __u64 __le64;
-typedef __u64 __be64;
-
-#endif /* O2CB_SPARSE_ENDIAN_TYPES_H */
diff --git a/libo2dlm/Makefile b/libo2dlm/Makefile
index bffaca9..5a439d1 100644
--- a/libo2dlm/Makefile
+++ b/libo2dlm/Makefile
@@ -11,7 +11,7 @@ else
 OPTS += -O2
 endif
 
-INCLUDES = -Iinclude
+INCLUDES = -I$(TOPDIR)/include -Iinclude
 
 LIBRARIES = libo2dlm.a
 
@@ -40,9 +40,7 @@ CFILES = o2dlm.c
 
 TESTING_CFILES = o2dlm_test.c
 
-HFILES = 			\
-	include/kernel-list.h	\
-	include/o2dlm.h 
+HFILES = include/o2dlm.h
 
 HFILES_GEN =			\
 	include/o2dlm_err.h
diff --git a/libo2dlm/include/kernel-list.h b/libo2dlm/include/kernel-list.h
deleted file mode 100644
index a922d7a..0000000
--- a/libo2dlm/include/kernel-list.h
+++ /dev/null
@@ -1,116 +0,0 @@
-#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
-/*
- * Simple doubly linked list implementation.
- *
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole lists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
- */
-
-struct list_head {
-	struct list_head *next, *prev;
-};
-
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define LIST_HEAD(name) \
-	struct list_head name = { &name, &name }
-
-#define INIT_LIST_HEAD(ptr) do { \
-	(ptr)->next = (ptr); (ptr)->prev = (ptr); \
-} while (0)
-
-#if (!defined(__GNUC__) && !defined(__WATCOMC__))
-#define __inline__
-#endif
-
-/*
- * Insert a new entry between two known consecutive entries. 
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void __list_add(struct list_head * new,
-	struct list_head * prev,
-	struct list_head * next)
-{
-	next->prev = new;
-	new->next = next;
-	new->prev = prev;
-	prev->next = new;
-}
-
-/*
- * Insert a new entry after the specified head..
- */
-static __inline__ void list_add(struct list_head *new, struct list_head *head)
-{
-	__list_add(new, head, head->next);
-}
-
-/*
- * Insert a new entry at the tail
- */
-static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
-{
-	__list_add(new, head->prev, head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void __list_del(struct list_head * prev,
-				  struct list_head * next)
-{
-	next->prev = prev;
-	prev->next = next;
-}
-
-static __inline__ void list_del(struct list_head *entry)
-{
-	__list_del(entry->prev, entry->next);
-}
-
-static __inline__ int list_empty(struct list_head *head)
-{
-	return head->next == head;
-}
-
-/*
- * Splice in "list" into "head"
- */
-static __inline__ void list_splice(struct list_head *list, struct list_head *head)
-{
-	struct list_head *first = list->next;
-
-	if (first != list) {
-		struct list_head *last = list->prev;
-		struct list_head *at = head->next;
-
-		first->prev = head;
-		head->next = first;
-
-		last->next = at;
-		at->prev = last;
-	}
-}
-
-#define list_entry(ptr, type, member) \
-	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
-
-#define list_for_each(pos, head) \
-        for (pos = (head)->next; pos != (head); pos = pos->next)
-
-#define list_for_each_safe(pos, n, head) \
-	        for (pos = (head)->next, n = pos->next; pos != (head); \
-		                     pos = n, n = pos->next)
-
-#endif
diff --git a/libo2dlm/include/o2dlm.h b/libo2dlm/include/o2dlm.h
index 46b0ecb..1d44cbe 100644
--- a/libo2dlm/include/o2dlm.h
+++ b/libo2dlm/include/o2dlm.h
@@ -36,13 +36,11 @@
 
 #include <et/com_err.h>
 
-#if O2DLM_FLAT_INCLUDES
-#include "kernel-list.h"
+#include <ocfs2-kernel/kernel-list.h>
 
+#if O2DLM_FLAT_INCLUDES
 #include "o2dlm_err.h"
 #else
-#include <o2dlm/kernel-list.h>
-
 #include <o2dlm/o2dlm_err.h>
 #endif
 
diff --git a/libocfs2/Makefile b/libocfs2/Makefile
index 18d255b..adc5764 100644
--- a/libocfs2/Makefile
+++ b/libocfs2/Makefile
@@ -11,7 +11,7 @@ else
 OPTS += -O2
 endif
 
-INCLUDES = -Iinclude -I$(TOPDIR)/libo2dlm/include -I$(TOPDIR)/libo2cb/include
+INCLUDES = -I$(TOPDIR)/include -Iinclude -I$(TOPDIR)/libo2dlm/include -I$(TOPDIR)/libo2cb/include
 
 LIBRARIES = libocfs2.a
 
@@ -91,12 +91,8 @@ HFILES =				\
 	include/dir_iterate.h		\
 	include/dir_util.h		\
 	include/extent_map.h		\
-	include/jbd.h			\
-	include/kernel-list.h		\
 	include/kernel-rbtree.h		\
-	include/ocfs1_fs_compat.h	\
-	include/ocfs2_lockid.h		\
-	include/ocfs2_fs.h		\
+	include/jbd.h			\
 	include/ocfs2.h			\
 	include/feature_string.h
 
diff --git a/libocfs2/checkhb.c b/libocfs2/checkhb.c
index 8431a65..688d905 100644
--- a/libocfs2/checkhb.c
+++ b/libocfs2/checkhb.c
@@ -36,9 +36,9 @@
 #include <sys/stat.h>
 #include <signal.h>
 
+
 #include "ocfs2.h"
-#include "ocfs2_fs.h"
-#include "ocfs1_fs_compat.h"
+#include "ocfs2-kernel/ocfs1_fs_compat.h"
 
 static errcode_t ocfs2_read_slotmap (ocfs2_filesys *fs, uint8_t *node_nums)
 {
diff --git a/libocfs2/include/kernel-list.h b/libocfs2/include/kernel-list.h
deleted file mode 100644
index a922d7a..0000000
--- a/libocfs2/include/kernel-list.h
+++ /dev/null
@@ -1,116 +0,0 @@
-#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
-/*
- * Simple doubly linked list implementation.
- *
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole lists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
- */
-
-struct list_head {
-	struct list_head *next, *prev;
-};
-
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define LIST_HEAD(name) \
-	struct list_head name = { &name, &name }
-
-#define INIT_LIST_HEAD(ptr) do { \
-	(ptr)->next = (ptr); (ptr)->prev = (ptr); \
-} while (0)
-
-#if (!defined(__GNUC__) && !defined(__WATCOMC__))
-#define __inline__
-#endif
-
-/*
- * Insert a new entry between two known consecutive entries. 
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void __list_add(struct list_head * new,
-	struct list_head * prev,
-	struct list_head * next)
-{
-	next->prev = new;
-	new->next = next;
-	new->prev = prev;
-	prev->next = new;
-}
-
-/*
- * Insert a new entry after the specified head..
- */
-static __inline__ void list_add(struct list_head *new, struct list_head *head)
-{
-	__list_add(new, head, head->next);
-}
-
-/*
- * Insert a new entry at the tail
- */
-static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
-{
-	__list_add(new, head->prev, head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void __list_del(struct list_head * prev,
-				  struct list_head * next)
-{
-	next->prev = prev;
-	prev->next = next;
-}
-
-static __inline__ void list_del(struct list_head *entry)
-{
-	__list_del(entry->prev, entry->next);
-}
-
-static __inline__ int list_empty(struct list_head *head)
-{
-	return head->next == head;
-}
-
-/*
- * Splice in "list" into "head"
- */
-static __inline__ void list_splice(struct list_head *list, struct list_head *head)
-{
-	struct list_head *first = list->next;
-
-	if (first != list) {
-		struct list_head *last = list->prev;
-		struct list_head *at = head->next;
-
-		first->prev = head;
-		head->next = first;
-
-		last->next = at;
-		at->prev = last;
-	}
-}
-
-#define list_entry(ptr, type, member) \
-	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
-
-#define list_for_each(pos, head) \
-        for (pos = (head)->next; pos != (head); pos = pos->next)
-
-#define list_for_each_safe(pos, n, head) \
-	        for (pos = (head)->next, n = pos->next; pos != (head); \
-		                     pos = n, n = pos->next)
-
-#endif
diff --git a/libocfs2/include/ocfs1_fs_compat.h b/libocfs2/include/ocfs1_fs_compat.h
deleted file mode 100644
index 0b499bc..0000000
--- a/libocfs2/include/ocfs1_fs_compat.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * ocfs1_fs_compat.h
- *
- * OCFS1 volume header definitions.  OCFS2 creates valid but unmountable
- * OCFS1 volume headers on the first two sectors of an OCFS2 volume.
- * This allows an OCFS1 volume to see the partition and cleanly fail to
- * mount it.
- *
- * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License, version 2,  as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-#ifndef _OCFS1_FS_COMPAT_H
-#define _OCFS1_FS_COMPAT_H
-
-#define OCFS1_MAX_VOL_SIGNATURE_LEN          128
-#define OCFS1_MAX_MOUNT_POINT_LEN            128
-#define OCFS1_MAX_VOL_ID_LENGTH               16
-#define OCFS1_MAX_VOL_LABEL_LEN               64
-#define OCFS1_MAX_CLUSTER_NAME_LEN            64
-
-#define OCFS1_MAJOR_VERSION              (2)
-#define OCFS1_MINOR_VERSION              (0)
-#define OCFS1_VOLUME_SIGNATURE		 "OracleCFS"
-
-/*
- * OCFS1 superblock.  Lives at sector 0.
- */
-struct ocfs1_vol_disk_hdr
-{
-/*00*/	__u32 minor_version;
-	__u32 major_version;
-/*08*/	__u8 signature[OCFS1_MAX_VOL_SIGNATURE_LEN];
-/*88*/	__u8 mount_point[OCFS1_MAX_MOUNT_POINT_LEN];
-/*108*/	__u64 serial_num;
-/*110*/	__u64 device_size;
-	__u64 start_off;
-/*120*/	__u64 bitmap_off;
-	__u64 publ_off;
-/*130*/	__u64 vote_off;
-	__u64 root_bitmap_off;
-/*140*/	__u64 data_start_off;
-	__u64 root_bitmap_size;
-/*150*/	__u64 root_off;
-	__u64 root_size;
-/*160*/	__u64 cluster_size;
-	__u64 num_nodes;
-/*170*/	__u64 num_clusters;
-	__u64 dir_node_size;
-/*180*/	__u64 file_node_size;
-	__u64 internal_off;
-/*190*/	__u64 node_cfg_off;
-	__u64 node_cfg_size;
-/*1A0*/	__u64 new_cfg_off;
-	__u32 prot_bits;
-	__s32 excl_mount;
-/*1B0*/
-};
-
-
-struct ocfs1_disk_lock
-{
-/*00*/	__u32 curr_master;
-	__u8 file_lock;
-	__u8 compat_pad[3];  /* Not in orignal definition.  Used to
-				make the already existing alignment
-				explicit */
-	__u64 last_write_time;
-/*10*/	__u64 last_read_time;
-	__u32 writer_node_num;
-	__u32 reader_node_num;
-/*20*/	__u64 oin_node_map;
-	__u64 dlock_seq_num;
-/*30*/
-};
-
-/*
- * OCFS1 volume label.  Lives at sector 1.
- */
-struct ocfs1_vol_label
-{
-/*00*/	struct ocfs1_disk_lock disk_lock;
-/*30*/	__u8 label[OCFS1_MAX_VOL_LABEL_LEN];
-/*70*/	__u16 label_len;
-/*72*/	__u8 vol_id[OCFS1_MAX_VOL_ID_LENGTH];
-/*82*/	__u16 vol_id_len;
-/*84*/	__u8 cluster_name[OCFS1_MAX_CLUSTER_NAME_LEN];
-/*A4*/	__u16 cluster_name_len;
-/*A6*/
-};
-
-
-#endif /* _OCFS1_FS_COMPAT_H */
-
diff --git a/libocfs2/include/ocfs2.h b/libocfs2/include/ocfs2.h
index 35d40cc..25fcf08 100644
--- a/libocfs2/include/ocfs2.h
+++ b/libocfs2/include/ocfs2.h
@@ -49,29 +49,26 @@
 
 #include "byteorder.h"
 
+#include <ocfs2-kernel/kernel-list.h>
+#include <ocfs2-kernel/ocfs2_fs.h>
+
 #if OCFS2_FLAT_INCLUDES
 #include "o2dlm.h"
 #include "o2cb.h"
 
-#include "kernel-list.h"
 #include "kernel-rbtree.h"
-
 #include "ocfs2_err.h"
-#include "ocfs2_fs.h"
 #include "jbd.h"
 #else
 #include <o2dlm/o2dlm.h>
 #include <o2cb/o2cb.h>
 
-#include <ocfs2/kernel-list.h>
 #include <ocfs2/kernel-rbtree.h>
-
 #include <ocfs2/ocfs2_err.h>
-#include <ocfs2/ocfs2_fs.h>
 #include <ocfs2/jbd.h>
 #endif
 
-#include "ocfs2_lockid.h"
+#include <ocfs2-kernel/ocfs2_lockid.h>
 
 #define OCFS2_LIB_FEATURE_INCOMPAT_SUPP		(OCFS2_FEATURE_INCOMPAT_SUPP | \
 						 OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV | \
diff --git a/libocfs2/include/ocfs2_fs.h b/libocfs2/include/ocfs2_fs.h
deleted file mode 100644
index cfaf28f..0000000
--- a/libocfs2/include/ocfs2_fs.h
+++ /dev/null
@@ -1,823 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * ocfs2_fs.h
- *
- * On-disk structures for OCFS2.
- *
- * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License, version 2,  as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-#ifndef _OCFS2_FS_H
-#define _OCFS2_FS_H
-
-/* Version */
-#define OCFS2_MAJOR_REV_LEVEL		0
-#define OCFS2_MINOR_REV_LEVEL          	90
-
-/*
- * An OCFS2 volume starts this way:
- * Sector 0: Valid ocfs1_vol_disk_hdr that cleanly fails to mount OCFS.
- * Sector 1: Valid ocfs1_vol_label that cleanly fails to mount OCFS.
- * Block OCFS2_SUPER_BLOCK_BLKNO: OCFS2 superblock.
- *
- * All other structures are found from the superblock information.
- *
- * OCFS2_SUPER_BLOCK_BLKNO is in blocks, not sectors.  eg, for a
- * blocksize of 2K, it is 4096 bytes into disk.
- */
-#define OCFS2_SUPER_BLOCK_BLKNO		2
-
-/*
- * Cluster size limits. The maximum is kept arbitrarily at 1 MB, and could
- * grow if needed.
- */
-#define OCFS2_MIN_CLUSTERSIZE		4096
-#define OCFS2_MAX_CLUSTERSIZE		1048576
-
-/*
- * Blocks cannot be bigger than clusters, so the maximum blocksize is the
- * minimum cluster size.
- */
-#define OCFS2_MIN_BLOCKSIZE		512
-#define OCFS2_MAX_BLOCKSIZE		OCFS2_MIN_CLUSTERSIZE
-
-/* Filesystem magic number */
-#define OCFS2_SUPER_MAGIC		0x7461636f
-
-/* Object signatures */
-#define OCFS2_SUPER_BLOCK_SIGNATURE	"OCFSV2"
-#define OCFS2_INODE_SIGNATURE		"INODE01"
-#define OCFS2_EXTENT_BLOCK_SIGNATURE	"EXBLK01"
-#define OCFS2_GROUP_DESC_SIGNATURE      "GROUP01"
-
-/* Compatibility flags */
-#define OCFS2_HAS_COMPAT_FEATURE(sb,mask)			\
-	( OCFS2_SB(sb)->s_feature_compat & (mask) )
-#define OCFS2_HAS_RO_COMPAT_FEATURE(sb,mask)			\
-	( OCFS2_SB(sb)->s_feature_ro_compat & (mask) )
-#define OCFS2_HAS_INCOMPAT_FEATURE(sb,mask)			\
-	( OCFS2_SB(sb)->s_feature_incompat & (mask) )
-#define OCFS2_SET_COMPAT_FEATURE(sb,mask)			\
-	OCFS2_SB(sb)->s_feature_compat |= (mask)
-#define OCFS2_SET_RO_COMPAT_FEATURE(sb,mask)			\
-	OCFS2_SB(sb)->s_feature_ro_compat |= (mask)
-#define OCFS2_SET_INCOMPAT_FEATURE(sb,mask)			\
-	OCFS2_SB(sb)->s_feature_incompat |= (mask)
-#define OCFS2_CLEAR_COMPAT_FEATURE(sb,mask)			\
-	OCFS2_SB(sb)->s_feature_compat &= ~(mask)
-#define OCFS2_CLEAR_RO_COMPAT_FEATURE(sb,mask)			\
-	OCFS2_SB(sb)->s_feature_ro_compat &= ~(mask)
-#define OCFS2_CLEAR_INCOMPAT_FEATURE(sb,mask)			\
-	OCFS2_SB(sb)->s_feature_incompat &= ~(mask)
-
-#define OCFS2_FEATURE_COMPAT_SUPP	OCFS2_FEATURE_COMPAT_BACKUP_SB
-#define OCFS2_FEATURE_INCOMPAT_SUPP	(OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT \
-					 | OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC)
-#define OCFS2_FEATURE_RO_COMPAT_SUPP	OCFS2_FEATURE_RO_COMPAT_UNWRITTEN
-
-/*
- * Heartbeat-only devices are missing journals and other files.  The
- * filesystem driver can't load them, but the library can.  Never put
- * this in OCFS2_FEATURE_INCOMPAT_SUPP, *ever*.
- */
-#define OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV	0x0002
-
-/*
- * tunefs sets this incompat flag before starting the resize and clears it
- * at the end. This flag protects users from inadvertently mounting the fs
- * after an aborted run without fsck-ing.
- */
-#define OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG    0x0004
-
-/* Used to denote a non-clustered volume */
-#define OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT	0x0008
-
-/* Support for sparse allocation in b-trees */
-#define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC	0x0010
-
-/*
- * Tunefs sets this incompat flag before starting an operation which
- * would require cleanup on abort. This is done to protect users from
- * inadvertently mounting the fs after an aborted run without
- * fsck-ing.
- *
- * s_tunefs_flags on the super block describes precisely which
- * operations were in progress.
- */
-#define OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG	0x0020
-
-/* Support for data packed into inode blocks */
-#define OCFS2_FEATURE_INCOMPAT_INLINE_DATA	0x0040
-
-/*
- * backup superblock flag is used to indicate that this volume
- * has backup superblocks.
- */
-#define OCFS2_FEATURE_COMPAT_BACKUP_SB		0x0001
-
-/*
- * Unwritten extents support.
- */
-#define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN	0x0001
-
-/* The byte offset of the first backup block will be 1G.
- * The following will be 4G, 16G, 64G, 256G and 1T.
- */
-#define OCFS2_BACKUP_SB_START			1 << 30
-
-/* the max backup superblock nums */
-#define OCFS2_MAX_BACKUP_SUPERBLOCKS	6
-
-/*
- * Flags on ocfs2_super_block.s_tunefs_flags
- */
-#define OCFS2_TUNEFS_INPROG_REMOVE_SLOT		0x0001	/* Removing slots */
-
-/*
- * Flags on ocfs2_dinode.i_flags
- */
-#define OCFS2_VALID_FL		(0x00000001)	/* Inode is valid */
-#define OCFS2_UNUSED2_FL	(0x00000002)
-#define OCFS2_ORPHANED_FL	(0x00000004)	/* On the orphan list */
-#define OCFS2_UNUSED3_FL	(0x00000008)
-/* System inode flags */
-#define OCFS2_SYSTEM_FL		(0x00000010)	/* System inode */
-#define OCFS2_SUPER_BLOCK_FL	(0x00000020)	/* Super block */
-#define OCFS2_LOCAL_ALLOC_FL	(0x00000040)	/* Slot local alloc bitmap */
-#define OCFS2_BITMAP_FL		(0x00000080)	/* Allocation bitmap */
-#define OCFS2_JOURNAL_FL	(0x00000100)	/* Slot local journal */
-#define OCFS2_HEARTBEAT_FL	(0x00000200)	/* Heartbeat area */
-#define OCFS2_CHAIN_FL		(0x00000400)	/* Chain allocator */
-#define OCFS2_DEALLOC_FL	(0x00000800)	/* Truncate log */
-
-/*
- * Flags on ocfs2_dinode.i_dyn_features
- *
- * These can change much more often than i_flags. When adding flags,
- * keep in mind that i_dyn_features is only 16 bits wide.
- */
-#define OCFS2_INLINE_DATA_FL	(0x0001)	/* Data stored in inode block */
-#define OCFS2_HAS_XATTR_FL	(0x0002)
-#define OCFS2_INLINE_XATTR_FL	(0x0004)
-#define OCFS2_INDEXED_DIR_FL	(0x0008)
-
-/* Inode attributes, keep in sync with EXT2 */
-#define OCFS2_SECRM_FL		(0x00000001)	/* Secure deletion */
-#define OCFS2_UNRM_FL		(0x00000002)	/* Undelete */
-#define OCFS2_COMPR_FL		(0x00000004)	/* Compress file */
-#define OCFS2_SYNC_FL		(0x00000008)	/* Synchronous updates */
-#define OCFS2_IMMUTABLE_FL	(0x00000010)	/* Immutable file */
-#define OCFS2_APPEND_FL		(0x00000020)	/* writes to file may only append */
-#define OCFS2_NODUMP_FL		(0x00000040)	/* do not dump file */
-#define OCFS2_NOATIME_FL	(0x00000080)	/* do not update atime */
-#define OCFS2_DIRSYNC_FL	(0x00010000)	/* dirsync behaviour (directories only) */
-
-#define OCFS2_FL_VISIBLE	(0x000100FF)	/* User visible flags */
-#define OCFS2_FL_MODIFIABLE	(0x000100FF)	/* User modifiable flags */
-
-/*
- * Extent record flags (e_node.leaf.flags)
- */
-#define OCFS2_EXT_UNWRITTEN	(0x01)	/* Extent is allocated but
-					 * unwritten */
-
-/*
- * ioctl commands
- */
-#define OCFS2_IOC_GETFLAGS	_IOR('f', 1, long)
-#define OCFS2_IOC_SETFLAGS	_IOW('f', 2, long)
-#define OCFS2_IOC32_GETFLAGS	_IOR('f', 1, int)
-#define OCFS2_IOC32_SETFLAGS	_IOW('f', 2, int)
-
-/*
- * Space reservation / allocation / free ioctls and argument structure
- * are designed to be compatible with XFS.
- *
- * ALLOCSP* and FREESP* are not and will never be supported, but are
- * included here for completeness.
- */
-struct ocfs2_space_resv {
-	__s16		l_type;
-	__s16		l_whence;
-	__s64		l_start;
-	__s64		l_len;		/* len == 0 means until end of file */
-	__s32		l_sysid;
-	__u32		l_pid;
-	__s32		l_pad[4];	/* reserve area			    */
-};
-
-#define OCFS2_IOC_ALLOCSP		_IOW ('X', 10, struct ocfs2_space_resv)
-#define OCFS2_IOC_FREESP		_IOW ('X', 11, struct ocfs2_space_resv)
-#define OCFS2_IOC_RESVSP		_IOW ('X', 40, struct ocfs2_space_resv)
-#define OCFS2_IOC_UNRESVSP	_IOW ('X', 41, struct ocfs2_space_resv)
-#define OCFS2_IOC_ALLOCSP64	_IOW ('X', 36, struct ocfs2_space_resv)
-#define OCFS2_IOC_FREESP64	_IOW ('X', 37, struct ocfs2_space_resv)
-#define OCFS2_IOC_RESVSP64	_IOW ('X', 42, struct ocfs2_space_resv)
-#define OCFS2_IOC_UNRESVSP64	_IOW ('X', 43, struct ocfs2_space_resv)
-
-/*
- * Journal Flags (ocfs2_dinode.id1.journal1.i_flags)
- */
-#define OCFS2_JOURNAL_DIRTY_FL	(0x00000001)	/* Journal needs recovery */
-
-/*
- * superblock s_state flags
- */
-#define OCFS2_ERROR_FS		(0x00000001)	/* FS saw errors */
-
-/* Limit of space in ocfs2_dir_entry */
-#define OCFS2_MAX_FILENAME_LEN		255
-
-/* Maximum slots on an ocfs2 file system */
-#define OCFS2_MAX_SLOTS			255
-
-/* Slot map indicator for an empty slot */
-#define OCFS2_INVALID_SLOT		-1
-
-#define OCFS2_VOL_UUID_LEN		16
-#define OCFS2_MAX_VOL_LABEL_LEN		64
-
-/* Journal limits (in bytes) */
-#define OCFS2_MIN_JOURNAL_SIZE		(4 * 1024 * 1024)
-
-struct ocfs2_system_inode_info {
-	char	*si_name;
-	int	si_iflags;
-	int	si_mode;
-};
-
-/* System file index */
-enum {
-	BAD_BLOCK_SYSTEM_INODE = 0,
-	GLOBAL_INODE_ALLOC_SYSTEM_INODE,
-	SLOT_MAP_SYSTEM_INODE,
-#define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE
-	HEARTBEAT_SYSTEM_INODE,
-	GLOBAL_BITMAP_SYSTEM_INODE,
-#define OCFS2_LAST_GLOBAL_SYSTEM_INODE GLOBAL_BITMAP_SYSTEM_INODE
-	ORPHAN_DIR_SYSTEM_INODE,
-	EXTENT_ALLOC_SYSTEM_INODE,
-	INODE_ALLOC_SYSTEM_INODE,
-	JOURNAL_SYSTEM_INODE,
-	LOCAL_ALLOC_SYSTEM_INODE,
-	TRUNCATE_LOG_SYSTEM_INODE,
-	NUM_SYSTEM_INODES
-};
-
-static struct ocfs2_system_inode_info ocfs2_system_inodes[NUM_SYSTEM_INODES] = {
-	/* Global system inodes (single copy) */
-	/* The first two are only used from userspace mfks/tunefs */
-	[BAD_BLOCK_SYSTEM_INODE]		= { "bad_blocks", 0, S_IFREG | 0644 },
-	[GLOBAL_INODE_ALLOC_SYSTEM_INODE] 	= { "global_inode_alloc", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
-
-	/* These are used by the running filesystem */
-	[SLOT_MAP_SYSTEM_INODE]			= { "slot_map", 0, S_IFREG | 0644 },
-	[HEARTBEAT_SYSTEM_INODE]		= { "heartbeat", OCFS2_HEARTBEAT_FL, S_IFREG | 0644 },
-	[GLOBAL_BITMAP_SYSTEM_INODE]		= { "global_bitmap", 0, S_IFREG | 0644 },
-
-	/* Slot-specific system inodes (one copy per slot) */
-	[ORPHAN_DIR_SYSTEM_INODE]		= { "orphan_dir:%04d", 0, S_IFDIR | 0755 },
-	[EXTENT_ALLOC_SYSTEM_INODE]		= { "extent_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
-	[INODE_ALLOC_SYSTEM_INODE]		= { "inode_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
-	[JOURNAL_SYSTEM_INODE]			= { "journal:%04d", OCFS2_JOURNAL_FL, S_IFREG | 0644 },
-	[LOCAL_ALLOC_SYSTEM_INODE]		= { "local_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_LOCAL_ALLOC_FL, S_IFREG | 0644 },
-	[TRUNCATE_LOG_SYSTEM_INODE]		= { "truncate_log:%04d", OCFS2_DEALLOC_FL, S_IFREG | 0644 }
-};
-
-/* Parameter passed from mount.ocfs2 to module */
-#define OCFS2_HB_NONE			"heartbeat=none"
-#define OCFS2_HB_LOCAL			"heartbeat=local"
-
-/*
- * OCFS2 directory file types.  Only the low 3 bits are used.  The
- * other bits are reserved for now.
- */
-#define OCFS2_FT_UNKNOWN	0
-#define OCFS2_FT_REG_FILE	1
-#define OCFS2_FT_DIR		2
-#define OCFS2_FT_CHRDEV		3
-#define OCFS2_FT_BLKDEV		4
-#define OCFS2_FT_FIFO		5
-#define OCFS2_FT_SOCK		6
-#define OCFS2_FT_SYMLINK	7
-
-#define OCFS2_FT_MAX		8
-
-/*
- * OCFS2_DIR_PAD defines the directory entries boundaries
- *
- * NOTE: It must be a multiple of 4
- */
-#define OCFS2_DIR_PAD			4
-#define OCFS2_DIR_ROUND			(OCFS2_DIR_PAD - 1)
-#define OCFS2_DIR_MEMBER_LEN 		offsetof(struct ocfs2_dir_entry, name)
-#define OCFS2_DIR_REC_LEN(name_len)	(((name_len) + OCFS2_DIR_MEMBER_LEN + \
-                                          OCFS2_DIR_ROUND) & \
-					 ~OCFS2_DIR_ROUND)
-
-#define OCFS2_LINK_MAX		32000
-
-#define S_SHIFT			12
-static unsigned char ocfs2_type_by_mode[S_IFMT >> S_SHIFT] = {
-	[S_IFREG >> S_SHIFT]  = OCFS2_FT_REG_FILE,
-	[S_IFDIR >> S_SHIFT]  = OCFS2_FT_DIR,
-	[S_IFCHR >> S_SHIFT]  = OCFS2_FT_CHRDEV,
-	[S_IFBLK >> S_SHIFT]  = OCFS2_FT_BLKDEV,
-	[S_IFIFO >> S_SHIFT]  = OCFS2_FT_FIFO,
-	[S_IFSOCK >> S_SHIFT] = OCFS2_FT_SOCK,
-	[S_IFLNK >> S_SHIFT]  = OCFS2_FT_SYMLINK,
-};
-
-
-/*
- * Convenience casts
- */
-#define OCFS2_RAW_SB(dinode)		(&((dinode)->id2.i_super))
-
-/*
- * On disk extent record for OCFS2
- * It describes a range of clusters on disk.
- *
- * Length fields are divided into interior and leaf node versions.
- * This leaves room for a flags field (OCFS2_EXT_*) in the leaf nodes.
- */
-struct ocfs2_extent_rec {
-/*00*/	__le32 e_cpos;		/* Offset into the file, in clusters */
-	union {
-		__le32 e_int_clusters; /* Clusters covered by all children */
-		struct {
-			__le16 e_leaf_clusters; /* Clusters covered by this
-						   extent */
-			__u8 e_reserved1;
-			__u8 e_flags; /* Extent flags */
-		};
-	};
-	__le64 e_blkno;		/* Physical disk offset, in blocks */
-/*10*/
-};
-
-struct ocfs2_chain_rec {
-	__le32 c_free;	/* Number of free bits in this chain. */
-	__le32 c_total;	/* Number of total bits in this chain */
-	__le64 c_blkno;	/* Physical disk offset (blocks) of 1st group */
-};
-
-struct ocfs2_truncate_rec {
-	__le32 t_start;		/* 1st cluster in this log */
-	__le32 t_clusters;	/* Number of total clusters covered */
-};
-
-/*
- * On disk extent list for OCFS2 (node in the tree).  Note that this
- * is contained inside ocfs2_dinode or ocfs2_extent_block, so the
- * offsets are relative to ocfs2_dinode.id2.i_list or
- * ocfs2_extent_block.h_list, respectively.
- */
-struct ocfs2_extent_list {
-/*00*/	__le16 l_tree_depth;		/* Extent tree depth from this
-					   point.  0 means data extents
-					   hang directly off this
-					   header (a leaf)
-					   NOTE: The high 8 bits cannot be
-					   used - tree_depth is never that big.
-					*/
-	__le16 l_count;			/* Number of extent records */
-	__le16 l_next_free_rec;		/* Next unused extent slot */
-	__le16 l_reserved1;
-	__le64 l_reserved2;		/* Pad to
-					   sizeof(ocfs2_extent_rec) */
-/*10*/	struct ocfs2_extent_rec l_recs[0];	/* Extent records */
-};
-
-/*
- * On disk allocation chain list for OCFS2.  Note that this is
- * contained inside ocfs2_dinode, so the offsets are relative to
- * ocfs2_dinode.id2.i_chain.
- */
-struct ocfs2_chain_list {
-/*00*/	__le16 cl_cpg;			/* Clusters per Block Group */
-	__le16 cl_bpc;			/* Bits per cluster */
-	__le16 cl_count;		/* Total chains in this list */
-	__le16 cl_next_free_rec;	/* Next unused chain slot */
-	__le64 cl_reserved1;
-/*10*/	struct ocfs2_chain_rec cl_recs[0];	/* Chain records */
-};
-
-/*
- * On disk deallocation log for OCFS2.  Note that this is
- * contained inside ocfs2_dinode, so the offsets are relative to
- * ocfs2_dinode.id2.i_dealloc.
- */
-struct ocfs2_truncate_log {
-/*00*/	__le16 tl_count;		/* Total records in this log */
-	__le16 tl_used;			/* Number of records in use */
-	__le32 tl_reserved1;
-/*08*/	struct ocfs2_truncate_rec tl_recs[0];	/* Truncate records */
-};
-
-/*
- * On disk extent block (indirect block) for OCFS2
- */
-struct ocfs2_extent_block
-{
-/*00*/	__u8 h_signature[8];		/* Signature for verification */
-	__le64 h_reserved1;
-/*10*/	__le16 h_suballoc_slot;		/* Slot suballocator this
-					   extent_header belongs to */
-	__le16 h_suballoc_bit;		/* Bit offset in suballocator
-					   block group */
-	__le32 h_fs_generation;		/* Must match super block */
-	__le64 h_blkno;			/* Offset on disk, in blocks */
-/*20*/	__le64 h_reserved3;
-	__le64 h_next_leaf_blk;		/* Offset on disk, in blocks,
-					   of next leaf header pointing
-					   to data */
-/*30*/	struct ocfs2_extent_list h_list;	/* Extent record list */
-/* Actual on-disk size is one block */
-};
-
-/*
- * On disk superblock for OCFS2
- * Note that it is contained inside an ocfs2_dinode, so all offsets
- * are relative to the start of ocfs2_dinode.id2.
- */
-struct ocfs2_super_block {
-/*00*/	__le16 s_major_rev_level;
-	__le16 s_minor_rev_level;
-	__le16 s_mnt_count;
-	__le16 s_max_mnt_count;
-	__le16 s_state;			/* File system state */
-	__le16 s_errors;			/* Behaviour when detecting errors */
-	__le32 s_checkinterval;		/* Max time between checks */
-/*10*/	__le64 s_lastcheck;		/* Time of last check */
-	__le32 s_creator_os;		/* OS */
-	__le32 s_feature_compat;		/* Compatible feature set */
-/*20*/	__le32 s_feature_incompat;	/* Incompatible feature set */
-	__le32 s_feature_ro_compat;	/* Readonly-compatible feature set */
-	__le64 s_root_blkno;		/* Offset, in blocks, of root directory
-					   dinode */
-/*30*/	__le64 s_system_dir_blkno;	/* Offset, in blocks, of system
-					   directory dinode */
-	__le32 s_blocksize_bits;		/* Blocksize for this fs */
-	__le32 s_clustersize_bits;	/* Clustersize for this fs */
-/*40*/	__le16 s_max_slots;		/* Max number of simultaneous mounts
-					   before tunefs required */
-	__le16 s_tunefs_flag;
-	__le32 s_reserved1;
-	__le64 s_first_cluster_group;	/* Block offset of 1st cluster
-					 * group header */
-/*50*/	__u8  s_label[OCFS2_MAX_VOL_LABEL_LEN];	/* Label for mounting, etc. */
-/*90*/	__u8  s_uuid[OCFS2_VOL_UUID_LEN];	/* 128-bit uuid */
-/*A0*/
-};
-
-/*
- * Local allocation bitmap for OCFS2 slots
- * Note that it exists inside an ocfs2_dinode, so all offsets are
- * relative to the start of ocfs2_dinode.id2.
- */
-struct ocfs2_local_alloc
-{
-/*00*/	__le32 la_bm_off;	/* Starting bit offset in main bitmap */
-	__le16 la_size;		/* Size of included bitmap, in bytes */
-	__le16 la_reserved1;
-	__le64 la_reserved2;
-/*10*/	__u8   la_bitmap[0];
-};
-
-/*
- * Data-in-inode header. This is only used if i_dyn_features has
- * OCFS2_INLINE_DATA_FL set.
- */
-struct ocfs2_inline_data
-{
-/*00*/	__le16	id_count;	/* Number of bytes that can be used
-				 * for data, starting at id_data */
-	__le16	id_reserved0;
-	__le32	id_reserved1;
-	__u8	id_data[0];	/* Start of user data */
-};
-
-/*
- * On disk inode for OCFS2
- */
-struct ocfs2_dinode {
-/*00*/	__u8 i_signature[8];		/* Signature for validation */
-	__le32 i_generation;		/* Generation number */
-	__le16 i_suballoc_slot;		/* Slot suballocator this inode
-					   belongs to */
-	__le16 i_suballoc_bit;		/* Bit offset in suballocator
-					   block group */
-/*10*/	__le32 i_reserved0;
-	__le32 i_clusters;		/* Cluster count */
-	__le32 i_uid;			/* Owner UID */
-	__le32 i_gid;			/* Owning GID */
-/*20*/	__le64 i_size;			/* Size in bytes */
-	__le16 i_mode;			/* File mode */
-	__le16 i_links_count;		/* Links count */
-	__le32 i_flags;			/* File flags */
-/*30*/	__le64 i_atime;			/* Access time */
-	__le64 i_ctime;			/* Creation time */
-/*40*/	__le64 i_mtime;			/* Modification time */
-	__le64 i_dtime;			/* Deletion time */
-/*50*/	__le64 i_blkno;			/* Offset on disk, in blocks */
-	__le64 i_last_eb_blk;		/* Pointer to last extent
-					   block */
-/*60*/	__le32 i_fs_generation;		/* Generation per fs-instance */
-	__le32 i_atime_nsec;
-	__le32 i_ctime_nsec;
-	__le32 i_mtime_nsec;
-	__le32 i_attr;
-	__le16 i_orphaned_slot;		/* Only valid when OCFS2_ORPHANED_FL
-					   was set in i_flags */
-	__le16 i_dyn_features;
-/*70*/	__le64 i_reserved2[8];
-/*B8*/	union {
-		__le64 i_pad1;		/* Generic way to refer to this
-					   64bit union */
-		struct {
-			__le64 i_rdev;	/* Device number */
-		} dev1;
-		struct {		/* Info for bitmap system
-					   inodes */
-			__le32 i_used;	/* Bits (ie, clusters) used  */
-			__le32 i_total;	/* Total bits (clusters)
-					   available */
-		} bitmap1;
-		struct {		/* Info for journal system
-					   inodes */
-			__le32 ij_flags;	/* Mounted, version, etc. */
-			__le32 ij_pad;
-		} journal1;
-	} id1;				/* Inode type dependant 1 */
-/*C0*/	union {
-		struct ocfs2_super_block	i_super;
-		struct ocfs2_local_alloc	i_lab;
-		struct ocfs2_chain_list		i_chain;
-		struct ocfs2_extent_list	i_list;
-		struct ocfs2_truncate_log	i_dealloc;
-		struct ocfs2_inline_data	i_data;
-		__u8               		i_symlink[0];
-	} id2;
-/* Actual on-disk size is one block */
-};
-
-/*
- * On-disk directory entry structure for OCFS2
- *
- * Packed as this structure could be accessed unaligned on 64-bit platforms
- */
-struct ocfs2_dir_entry {
-/*00*/	__le64   inode;                  /* Inode number */
-	__le16   rec_len;                /* Directory entry length */
-	__u8    name_len;               /* Name length */
-	__u8    file_type;
-/*0C*/	char    name[OCFS2_MAX_FILENAME_LEN];   /* File name */
-/* Actual on-disk length specified by rec_len */
-} __attribute__ ((packed));
-
-/*
- * On disk allocator group structure for OCFS2
- */
-struct ocfs2_group_desc
-{
-/*00*/	__u8    bg_signature[8];        /* Signature for validation */
-	__le16   bg_size;                /* Size of included bitmap in
-					   bytes. */
-	__le16   bg_bits;                /* Bits represented by this
-					   group. */
-	__le16	bg_free_bits_count;     /* Free bits count */
-	__le16   bg_chain;               /* What chain I am in. */
-/*10*/	__le32   bg_generation;
-	__le32	bg_reserved1;
-	__le64   bg_next_group;          /* Next group in my list, in
-					   blocks */
-/*20*/	__le64   bg_parent_dinode;       /* dinode which owns me, in
-					   blocks */
-	__le64   bg_blkno;               /* Offset on disk, in blocks */
-/*30*/	__le64   bg_reserved2[2];
-/*40*/	__u8    bg_bitmap[0];
-};
-
-#ifdef __KERNEL__
-static inline int ocfs2_fast_symlink_chars(struct super_block *sb)
-{
-	return  sb->s_blocksize -
-		 offsetof(struct ocfs2_dinode, id2.i_symlink);
-}
-
-static inline int ocfs2_max_inline_data(struct super_block *sb)
-{
-	return sb->s_blocksize -
-		offsetof(struct ocfs2_dinode, id2.i_data.id_data);
-}
-
-static inline int ocfs2_extent_recs_per_inode(struct super_block *sb)
-{
-	int size;
-
-	size = sb->s_blocksize -
-		offsetof(struct ocfs2_dinode, id2.i_list.l_recs);
-
-	return size / sizeof(struct ocfs2_extent_rec);
-}
-
-static inline int ocfs2_chain_recs_per_inode(struct super_block *sb)
-{
-	int size;
-
-	size = sb->s_blocksize -
-		offsetof(struct ocfs2_dinode, id2.i_chain.cl_recs);
-
-	return size / sizeof(struct ocfs2_chain_rec);
-}
-
-static inline u16 ocfs2_extent_recs_per_eb(struct super_block *sb)
-{
-	int size;
-
-	size = sb->s_blocksize -
-		offsetof(struct ocfs2_extent_block, h_list.l_recs);
-
-	return size / sizeof(struct ocfs2_extent_rec);
-}
-
-static inline u16 ocfs2_local_alloc_size(struct super_block *sb)
-{
-	u16 size;
-
-	size = sb->s_blocksize -
-		offsetof(struct ocfs2_dinode, id2.i_lab.la_bitmap);
-
-	return size;
-}
-
-static inline int ocfs2_group_bitmap_size(struct super_block *sb)
-{
-	int size;
-
-	size = sb->s_blocksize -
-		offsetof(struct ocfs2_group_desc, bg_bitmap);
-
-	return size;
-}
-
-static inline int ocfs2_truncate_recs_per_inode(struct super_block *sb)
-{
-	int size;
-
-	size = sb->s_blocksize -
-		offsetof(struct ocfs2_dinode, id2.i_dealloc.tl_recs);
-
-	return size / sizeof(struct ocfs2_truncate_rec);
-}
-
-static inline u64 ocfs2_backup_super_blkno(struct super_block *sb, int index)
-{
-	u64 offset = OCFS2_BACKUP_SB_START;
-
-	if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) {
-		offset <<= (2 * index);
-		offset >>= sb->s_blocksize_bits;
-		return offset;
-	}
-
-	return 0;
-
-}
-#else
-static inline int ocfs2_fast_symlink_chars(int blocksize)
-{
-	return blocksize - offsetof(struct ocfs2_dinode, id2.i_symlink);
-}
-
-static inline int ocfs2_max_inline_data(int blocksize)
-{
-	return blocksize - offsetof(struct ocfs2_dinode, id2.i_data.id_data);
-}
-
-static inline int ocfs2_extent_recs_per_inode(int blocksize)
-{
-	int size;
-
-	size = blocksize -
-		offsetof(struct ocfs2_dinode, id2.i_list.l_recs);
-
-	return size / sizeof(struct ocfs2_extent_rec);
-}
-
-static inline int ocfs2_chain_recs_per_inode(int blocksize)
-{
-	int size;
-
-	size = blocksize -
-		offsetof(struct ocfs2_dinode, id2.i_chain.cl_recs);
-
-	return size / sizeof(struct ocfs2_chain_rec);
-}
-
-static inline int ocfs2_extent_recs_per_eb(int blocksize)
-{
-	int size;
-
-	size = blocksize -
-		offsetof(struct ocfs2_extent_block, h_list.l_recs);
-
-	return size / sizeof(struct ocfs2_extent_rec);
-}
-
-static inline int ocfs2_local_alloc_size(int blocksize)
-{
-	int size;
-
-	size = blocksize -
-		offsetof(struct ocfs2_dinode, id2.i_lab.la_bitmap);
-
-	return size;
-}
-
-static inline int ocfs2_group_bitmap_size(int blocksize)
-{
-	int size;
-
-	size = blocksize -
-		offsetof(struct ocfs2_group_desc, bg_bitmap);
-
-	return size;
-}
-
-static inline int ocfs2_truncate_recs_per_inode(int blocksize)
-{
-	int size;
-
-	size = blocksize -
-		offsetof(struct ocfs2_dinode, id2.i_dealloc.tl_recs);
-
-	return size / sizeof(struct ocfs2_truncate_rec);
-}
-
-static inline uint64_t ocfs2_backup_super_blkno(int blocksize, int index)
-{
-	uint64_t offset = OCFS2_BACKUP_SB_START;
-
-	if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) {
-		offset <<= (2 * index);
-		offset /= blocksize;
-		return offset;
-	}
-
-	return 0;
-}
-#endif  /* __KERNEL__ */
-
-
-static inline int ocfs2_system_inode_is_global(int type)
-{
-	return ((type >= 0) &&
-		(type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE));
-}
-
-static inline int ocfs2_sprintf_system_inode_name(char *buf, int len,
-						  int type, int slot)
-{
-	int chars;
-
-        /*
-         * Global system inodes can only have one copy.  Everything
-         * after OCFS2_LAST_GLOBAL_SYSTEM_INODE in the system inode
-         * list has a copy per slot.
-         */
-	if (type <= OCFS2_LAST_GLOBAL_SYSTEM_INODE)
-		chars = snprintf(buf, len,
-				 ocfs2_system_inodes[type].si_name);
-	else
-		chars = snprintf(buf, len,
-				 ocfs2_system_inodes[type].si_name,
-				 slot);
-
-	return chars;
-}
-
-static inline void ocfs2_set_de_type(struct ocfs2_dir_entry *de,
-				    umode_t mode)
-{
-	de->file_type = ocfs2_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
-}
-
-#endif  /* _OCFS2_FS_H */
-
diff --git a/libocfs2/include/ocfs2_lockid.h b/libocfs2/include/ocfs2_lockid.h
deleted file mode 100644
index 7dd9e1e..0000000
--- a/libocfs2/include/ocfs2_lockid.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * ocfs2_lockid.h
- *
- * Defines OCFS2 lockid bits.
- *
- * Copyright (C) 2002, 2005 Oracle.  All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-#ifndef OCFS2_LOCKID_H
-#define OCFS2_LOCKID_H
-
-/* lock ids are made up in the following manner:
- * name[0]     --> type
- * name[1-6]   --> 6 pad characters, reserved for now
- * name[7-22]  --> block number, expressed in hex as 16 chars
- * name[23-30] --> i_generation, expressed in hex 8 chars
- * name[31]    --> '\0' */
-#define OCFS2_LOCK_ID_MAX_LEN  32
-#define OCFS2_LOCK_ID_PAD "000000"
-
-enum ocfs2_lock_type {
-	OCFS2_LOCK_TYPE_META = 0,
-	OCFS2_LOCK_TYPE_DATA,
-	OCFS2_LOCK_TYPE_SUPER,
-	OCFS2_LOCK_TYPE_RENAME,
-	OCFS2_LOCK_TYPE_RW,
-	OCFS2_NUM_LOCK_TYPES
-};
-
-static inline char ocfs2_lock_type_char(enum ocfs2_lock_type type)
-{
-	char c;
-	switch (type) {
-		case OCFS2_LOCK_TYPE_META:
-			c = 'M';
-			break;
-		case OCFS2_LOCK_TYPE_DATA:
-			c = 'D';
-			break;
-		case OCFS2_LOCK_TYPE_SUPER:
-			c = 'S';
-			break;
-		case OCFS2_LOCK_TYPE_RENAME:
-			c = 'R';
-			break;
-		case OCFS2_LOCK_TYPE_RW:
-			c = 'W';
-			break;
-		default:
-			c = '\0';
-	}
-
-	return c;
-}
-
-#endif  /* OCFS2_LOCKID_H */
diff --git a/libocfs2/openfs.c b/libocfs2/openfs.c
index 1d7f50c..2e6b625 100644
--- a/libocfs2/openfs.c
+++ b/libocfs2/openfs.c
@@ -38,7 +38,7 @@
 
 #include "ocfs2.h"
 
-#include "ocfs1_fs_compat.h"
+#include "ocfs2-kernel/ocfs1_fs_compat.h"
 
 
 static errcode_t ocfs2_validate_ocfs1_header(ocfs2_filesys *fs)
diff --git a/listuuid/Makefile b/listuuid/Makefile
index 5abeb6c..fe2e633 100644
--- a/listuuid/Makefile
+++ b/listuuid/Makefile
@@ -2,7 +2,7 @@ TOPDIR = ..
 
 include $(TOPDIR)/Preamble.make
 
-INCLUDES = -Iinclude -I$(TOPDIR)/libocfs2/include \
+INCLUDES = -I$(TOPDIR)/include -Iinclude -I$(TOPDIR)/libocfs2/include \
 	    -I$(TOPDIR)/libocfs2cluster/include \
 		-I$(TOPDIR)/libo2dlm/include \
 		-I$(TOPDIR)/libo2cb/include
diff --git a/listuuid/listuuid.c b/listuuid/listuuid.c
index 3f35545..965a136 100644
--- a/listuuid/listuuid.c
+++ b/listuuid/listuuid.c
@@ -37,11 +37,11 @@
 
 #include <uuid/uuid.h>
 
+
 #define  OCFS2_FLAT_INCLUDES	1
 #include <ocfs2.h>
-#include <ocfs2_fs.h>
-#include <ocfs1_fs_compat.h>
-#include <kernel-list.h>
+
+#include "ocfs2-kernel/ocfs1_fs_compat.h"
 
 char *device = NULL;
 char *progname = NULL;
diff --git a/mkfs.ocfs2/Makefile b/mkfs.ocfs2/Makefile
index 0ef7808..03bdf61 100644
--- a/mkfs.ocfs2/Makefile
+++ b/mkfs.ocfs2/Makefile
@@ -28,7 +28,7 @@ LIBO2DLM_CFLAGS = -I$(TOPDIR)/libo2dlm/include
 LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm
 LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
 
-INCLUDES = $(LIBOCFS2_CFLAGS) $(LIBO2DLM_CFLAGS) $(LIBO2CB_CFLAGS) -I.
+INCLUDES = -I$(TOPDIR)/include $(LIBOCFS2_CFLAGS) $(LIBO2DLM_CFLAGS) $(LIBO2CB_CFLAGS) -I.
 DEFINES = -DOCFS2_FLAT_INCLUDES -DVERSION=\"$(VERSION)\" \
 	-DO2DLM_FLAT_INCLUDES -DO2CB_FLAT_INCLUDES
 
diff --git a/mkfs.ocfs2/check.c b/mkfs.ocfs2/check.c
index 0ab2226..128c807 100644
--- a/mkfs.ocfs2/check.c
+++ b/mkfs.ocfs2/check.c
@@ -25,11 +25,6 @@
 
 #include "mkfs.h"
 
-#include <ocfs2.h>
-#include <ocfs2_fs.h>
-#include <ocfs1_fs_compat.h>
-#include <kernel-list.h>
-
 int ocfs2_check_volume(State *s)
 {
 	ocfs2_filesys *fs = NULL;
diff --git a/mkfs.ocfs2/mkfs.h b/mkfs.ocfs2/mkfs.h
index 5cef74a..9712575 100644
--- a/mkfs.ocfs2/mkfs.h
+++ b/mkfs.ocfs2/mkfs.h
@@ -50,7 +50,7 @@
 #undef cpu_to_be32
 #undef be32_to_cpu
 
-#include "ocfs1_fs_compat.h"
+#include "ocfs2-kernel/ocfs1_fs_compat.h"
 
 #include <signal.h>
 #include <libgen.h>
diff --git a/mount.ocfs2/Makefile b/mount.ocfs2/Makefile
index f1cdd0a..86e5cdb 100644
--- a/mount.ocfs2/Makefile
+++ b/mount.ocfs2/Makefile
@@ -5,7 +5,7 @@ include $(TOPDIR)/Preamble.make
 sbindir = $(root_sbindir)
 SBIN_PROGRAMS = mount.ocfs2
 
-INCLUDES = -Iinclude -I$(TOPDIR)/libocfs2/include \
+INCLUDES = -I$(TOPDIR)/include -Iinclude -I$(TOPDIR)/libocfs2/include \
 	    -I$(TOPDIR)/libo2cb/include -I$(TOPDIR)/libo2dlm/include
 LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
 LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
diff --git a/mount.ocfs2/mount.ocfs2.h b/mount.ocfs2/mount.ocfs2.h
index 1de39fa..9f586ac 100644
--- a/mount.ocfs2/mount.ocfs2.h
+++ b/mount.ocfs2/mount.ocfs2.h
@@ -49,9 +49,6 @@
 #include "opts.h"
 
 #include <ocfs2.h>
-#include <ocfs2_fs.h>
-#include <ocfs1_fs_compat.h>
-#include <kernel-list.h>
 
 #include "bitops.h"
 
diff --git a/mounted.ocfs2/Makefile b/mounted.ocfs2/Makefile
index b765b13..863ceff 100644
--- a/mounted.ocfs2/Makefile
+++ b/mounted.ocfs2/Makefile
@@ -26,7 +26,7 @@ LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
 sbindir = $(root_sbindir)
 SBIN_PROGRAMS = mounted.ocfs2
 
-INCLUDES = -I$(TOPDIR)/libocfs2/include -I$(TOPDIR)/libo2dlm/include \
+INCLUDES = -I$(TOPDIR)/include -I$(TOPDIR)/libocfs2/include -I$(TOPDIR)/libo2dlm/include \
 	-I$(TOPDIR)/libo2cb/include
 
 CFILES = mounted.c
diff --git a/mounted.ocfs2/mounted.c b/mounted.ocfs2/mounted.c
index 270a06c..3d00071 100644
--- a/mounted.ocfs2/mounted.c
+++ b/mounted.ocfs2/mounted.c
@@ -36,10 +36,9 @@
 
 #include <uuid/uuid.h>
 
+#include "ocfs2-kernel/kernel-list.h"
+
 #include <ocfs2.h>
-#include <ocfs2_fs.h>
-#include <ocfs1_fs_compat.h>
-#include <kernel-list.h>
 
 static int quick_detect = 0;
 static char *device = NULL;
diff --git a/o2cb_ctl/Makefile b/o2cb_ctl/Makefile
index bea2d45..817548e 100644
--- a/o2cb_ctl/Makefile
+++ b/o2cb_ctl/Makefile
@@ -5,7 +5,7 @@ include $(TOPDIR)/Preamble.make
 sbindir = $(root_sbindir)
 SBIN_PROGRAMS = o2cb_ctl
 
-INCLUDES = -Iinclude -I$(TOPDIR)/libocfs2/include \
+INCLUDES = -I$(TOPDIR)/include -Iinclude -I$(TOPDIR)/libocfs2/include \
 	    -I$(TOPDIR)/libo2cb/include
 LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
 LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
diff --git a/ocfs2_hb_ctl/Makefile b/ocfs2_hb_ctl/Makefile
index 5b18b53..8b18e49 100644
--- a/ocfs2_hb_ctl/Makefile
+++ b/ocfs2_hb_ctl/Makefile
@@ -5,7 +5,7 @@ include $(TOPDIR)/Preamble.make
 sbindir = $(root_sbindir)
 SBIN_PROGRAMS = ocfs2_hb_ctl
 
-INCLUDES = -Iinclude -I$(TOPDIR)/libocfs2/include \
+INCLUDES = -I$(TOPDIR)/include -Iinclude -I$(TOPDIR)/libocfs2/include \
 	    -I$(TOPDIR)/libo2cb/include -I$(TOPDIR)/libo2dlm/include
 LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
 LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
@@ -32,7 +32,7 @@ DEFINES = -DOCFS2_FLAT_INCLUDES -DO2DLM_FLAT_INCLUDES \
 
 CFILES = ocfs2_hb_ctl.c
 
-HFILES = $(subst .c,.h,$(CFILES))
+HFILES =
 
 OBJS = $(subst .c,.o,$(CFILES))
 
diff --git a/ocfs2_hb_ctl/ocfs2_hb_ctl.c b/ocfs2_hb_ctl/ocfs2_hb_ctl.c
index c7b183a..58a240c 100644
--- a/ocfs2_hb_ctl/ocfs2_hb_ctl.c
+++ b/ocfs2_hb_ctl/ocfs2_hb_ctl.c
@@ -41,9 +41,6 @@
 #include <signal.h>
 
 #include <ocfs2.h>
-#include <ocfs2_fs.h>
-
-#include "o2cb.h"
 
 #define DEV_PREFIX      "/dev/"
 #define PROC_IDE_FORMAT "/proc/ide/%s/media"
diff --git a/ocfs2_hb_ctl/ocfs2_hb_ctl.h b/ocfs2_hb_ctl/ocfs2_hb_ctl.h
deleted file mode 100644
index a02e997..0000000
--- a/ocfs2_hb_ctl/ocfs2_hb_ctl.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * ocfs2_hb_ctl.h  Definitions, etc.
- *
- * Copyright (C) 2004 Oracle.  All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- *
- */
-
-#define _LARGEFILE64_SOURCE
-#define _GNU_SOURCE /* Because libc really doesn't want us using O_DIRECT? */
-
-#include <sys/types.h>
-#include <inttypes.h>
-
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include <ocfs2.h>
-#include <ocfs2_fs.h>
-#include <ocfs1_fs_compat.h>
diff --git a/ocfs2cdsl/Makefile b/ocfs2cdsl/Makefile
index 52eaa31..1ed8b95 100644
--- a/ocfs2cdsl/Makefile
+++ b/ocfs2cdsl/Makefile
@@ -29,7 +29,7 @@ DEFINES = -DVERSION=\"$(VERSION)\"
 DEFINES += -DOCFS2_FLAT_INCLUDES -DO2DLM_FLAT_INCLUDES -DO2CB_FLAT_INCLUDES
 DEFINES += -DG_DISABLE_DEPRECATED
 
-INCLUDES = $(LIBOCFS2_CFLAGS) $(LIBO2DLM_CFLAGS) $(LIBO2CB_CFLAGS) $(GLIB_CFLAGS)
+INCLUDES = -I$(TOPDIR)/include $(LIBOCFS2_CFLAGS) $(LIBO2DLM_CFLAGS) $(LIBO2CB_CFLAGS) $(GLIB_CFLAGS)
 
 OPTIMIZE = -O2
 
diff --git a/ocfs2console/ocfs2interface/Makefile b/ocfs2console/ocfs2interface/Makefile
index 172c511..b3a3598 100644
--- a/ocfs2console/ocfs2interface/Makefile
+++ b/ocfs2console/ocfs2interface/Makefile
@@ -9,6 +9,8 @@ OPTS = -g
 endif
 OPTS = -g
 
+INCLUDES = -I$(TOPDIR)/include
+
 CFLAGS = $(OPTS) $(WARNINGS) -fPIC
 
 PYMOD_CFLAGS = $(CFLAGS) -fno-strict-aliasing $(PYTHON_INCLUDES)
diff --git a/sizetest/Makefile b/sizetest/Makefile
index 55859f4..2c7bca3 100644
--- a/sizetest/Makefile
+++ b/sizetest/Makefile
@@ -15,7 +15,7 @@ CFLAGS = $(OPTS) $(WARNINGS)
 
 UNINST_PROGRAMS = sizetest.ocfs2
 
-INCLUDES = -I$(TOPDIR)/libocfs2/include -I$(TOPDIR)/libo2dlm/include -I$(TOPDIR)/libo2cb/include
+INCLUDES = -I$(TOPDIR)/include -I$(TOPDIR)/libocfs2/include -I$(TOPDIR)/libo2dlm/include -I$(TOPDIR)/libo2cb/include
 DEFINES = -DOCFS2_FLAT_INCLUDES -DVERSION=\"$(VERSION)\" -DO2DLM_FLAT_INCLUDES -DO2CB_FLAT_INCLUDES
 
 CFILES = sizetest.c
diff --git a/sizetest/sizetest.c b/sizetest/sizetest.c
index c0c079b..4e43a9a 100644
--- a/sizetest/sizetest.c
+++ b/sizetest/sizetest.c
@@ -25,7 +25,6 @@
 
 
 #include <ocfs2.h>
-#include <ocfs2_fs.h>
 
 
 #undef offsetof
diff --git a/tunefs.ocfs2/Makefile b/tunefs.ocfs2/Makefile
index e6b4427..acf6cea 100644
--- a/tunefs.ocfs2/Makefile
+++ b/tunefs.ocfs2/Makefile
@@ -25,7 +25,7 @@ LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
 sbindir = $(root_sbindir)
 SBIN_PROGRAMS = tunefs.ocfs2
 
-INCLUDES = -I$(TOPDIR)/libocfs2/include -I$(TOPDIR)/libo2dlm/include -I$(TOPDIR)/libo2cb/include -I.
+INCLUDES = -I$(TOPDIR)/include -I$(TOPDIR)/libocfs2/include -I$(TOPDIR)/libo2dlm/include -I$(TOPDIR)/libo2cb/include -I.
 INCLUDES += $(GLIB_CFLAGS)
 DEFINES = -DOCFS2_FLAT_INCLUDES -DVERSION=\"$(VERSION)\" -DO2DLM_FLAT_INCLUDES -DO2CB_FLAT_INCLUDES
 
diff --git a/tunefs.ocfs2/tunefs.h b/tunefs.ocfs2/tunefs.h
index 566d746..3c110c6 100644
--- a/tunefs.ocfs2/tunefs.h
+++ b/tunefs.ocfs2/tunefs.h
@@ -49,14 +49,10 @@
 #include <uuid/uuid.h>
 
 #include <ocfs2.h>
-#include <ocfs2_fs.h>
-#include <ocfs1_fs_compat.h>
 #include <bitops.h>
 
 #include <jbd.h>
 
-#include <kernel-list.h>
-
 #define SYSTEM_FILE_NAME_MAX   40
 
 #ifndef MIN
diff --git a/vendor/common/ocfs2-tools.spec-generic.in b/vendor/common/ocfs2-tools.spec-generic.in
index 6d98c84..01de00d 100644
--- a/vendor/common/ocfs2-tools.spec-generic.in
+++ b/vendor/common/ocfs2-tools.spec-generic.in
@@ -144,6 +144,7 @@ fi
 %defattr(-,root,root)
 %{brokenrhlibdir}/*.a
 %{brokenrhlibdir}/pkgconfig/*.pc
+%{_includedir}/ocfs2-kernel
 %{_includedir}/o2cb
 %{_includedir}/o2dlm
 %{_includedir}/ocfs2
-- 
1.5.2.2

-- 

Life's Little Instruction Book #337

	"Reread your favorite book."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list