[Ocfs2-tools-devel] [PATCH 4/4] includes: Move public ocfs2 headers
to the new location.
Joel Becker
joel.becker at oracle.com
Tue Jan 8 11:40:42 PST 2008
The public headers for libocfs2 now live at $(TOPDIR)/include/ocfs2.
All programs have been modified to explicitly include <ocfs2/ocfs2.h>.
This removes the need for specifying a separate include path for ocfs2,
as well as the OCFS2_FLAT_INCLUDES define.
In addition, the private libocfs2 headers have been moved directly into
the libocfs2 directly, so that they are easier to manage with the
libocfs2 sources.
Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
debugfs.ocfs2/Makefile | 4 +-
debugfs.ocfs2/commands.c | 4 +-
debugfs.ocfs2/dump.c | 4 +-
debugfs.ocfs2/dump_fs_locks.c | 2 +-
debugfs.ocfs2/find_block_inode.c | 2 +-
debugfs.ocfs2/find_inode_paths.c | 2 +-
debugfs.ocfs2/include/journal.h | 2 -
debugfs.ocfs2/include/main.h | 2 +-
debugfs.ocfs2/journal.c | 2 +-
debugfs.ocfs2/main.c | 2 +-
debugfs.ocfs2/utils.c | 4 +-
extras/Makefile | 4 +-
extras/compute_groups.c | 2 +-
extras/find_allocation_fragments.c | 4 +-
extras/find_dup_extents.c | 2 +-
extras/find_hardlinks.c | 2 +-
extras/find_inode_paths.c | 2 +-
extras/mark_journal_dirty.c | 3 +-
extras/set_random_bits.c | 2 +-
fsck.ocfs2/Makefile | 3 +-
fsck.ocfs2/dirblocks.c | 2 +-
fsck.ocfs2/dirparents.c | 2 +-
fsck.ocfs2/extent.c | 2 +-
fsck.ocfs2/fsck.c | 2 +-
fsck.ocfs2/icount.c | 2 +-
fsck.ocfs2/include/dirblocks.h | 3 +-
fsck.ocfs2/include/dirparents.h | 2 +
fsck.ocfs2/include/icount.h | 3 +-
fsck.ocfs2/include/strings.h | 3 +-
fsck.ocfs2/journal.c | 5 +-
fsck.ocfs2/pass0.c | 4 +-
fsck.ocfs2/pass1.c | 4 +-
fsck.ocfs2/pass2.c | 2 +-
fsck.ocfs2/pass3.c | 2 +-
fsck.ocfs2/pass4.c | 2 +-
fsck.ocfs2/problem.c | 2 +-
fsck.ocfs2/strings.c | 2 +-
fsck.ocfs2/util.c | 2 +-
fswreck/Makefile | 4 +-
fswreck/chain.c | 2 +-
fswreck/corrupt.c | 2 +-
fswreck/dir.c | 2 +-
fswreck/extent.c | 2 +-
fswreck/group.c | 2 +-
fswreck/include/main.h | 2 +-
fswreck/inode.c | 2 +-
fswreck/local_alloc.c | 2 +-
fswreck/main.c | 2 +-
fswreck/special.c | 2 +-
fswreck/symlink.c | 2 +-
fswreck/truncate_log.c | 2 +-
include/Makefile | 2 +-
include/ocfs2/.gitignore | 5 +
include/ocfs2/Makefile | 27 +
include/ocfs2/bitops.h | 42 ++
include/ocfs2/byteorder.h | 122 ++++
include/ocfs2/feature_string.h | 59 ++
include/ocfs2/jbd.h | 124 +++++
include/ocfs2/kernel-rbtree.h | 141 +++++
include/ocfs2/ocfs2.h | 844 ++++++++++++++++++++++++++++
libo2cb/Makefile | 2 +-
libocfs2/Makefile | 36 +-
libocfs2/alloc.c | 2 +-
libocfs2/backup_super.c | 2 +-
libocfs2/bitmap.c | 5 +-
libocfs2/bitmap.h | 139 +++++
libocfs2/bitops.c | 2 +-
libocfs2/cached_inode.c | 2 +-
libocfs2/chain.c | 4 +-
libocfs2/chainalloc.c | 5 +-
libocfs2/checkhb.c | 3 +-
libocfs2/closefs.c | 2 +-
libocfs2/dir_iterate.c | 2 +-
libocfs2/dir_iterate.h | 51 ++
libocfs2/dir_scan.c | 2 +-
libocfs2/dir_util.h | 45 ++
libocfs2/dirblock.c | 3 +-
libocfs2/dlm.c | 2 +-
libocfs2/dlm.h | 46 ++
libocfs2/expanddir.c | 2 +-
libocfs2/extend_file.c | 2 +-
libocfs2/extent_map.c | 2 +-
libocfs2/extent_map.h | 45 ++
libocfs2/extents.c | 3 +-
libocfs2/feature_string.c | 2 +-
libocfs2/fileio.c | 2 +-
libocfs2/freefs.c | 2 +-
libocfs2/getsectsize.c | 2 +-
libocfs2/getsize.c | 2 +-
libocfs2/heartbeat.c | 3 +-
libocfs2/include/.gitignore | 5 -
libocfs2/include/bitmap.h | 139 -----
libocfs2/include/bitops.h | 42 --
libocfs2/include/byteorder.h | 122 ----
libocfs2/include/dir_iterate.h | 51 --
libocfs2/include/dir_util.h | 45 --
libocfs2/include/dlm.h | 46 --
libocfs2/include/extent_map.h | 45 --
libocfs2/include/feature_string.h | 59 --
libocfs2/include/jbd.h | 124 -----
libocfs2/include/kernel-rbtree.h | 141 -----
libocfs2/include/ocfs2.h | 855 -----------------------------
libocfs2/inode.c | 3 +-
libocfs2/inode_scan.c | 2 +-
libocfs2/ismounted.c | 2 +-
libocfs2/kernel-rbtree.c | 2 +-
libocfs2/link.c | 2 +-
libocfs2/lockid.c | 2 +-
libocfs2/lookup.c | 2 +-
libocfs2/memory.c | 2 +-
libocfs2/mkjournal.c | 4 +-
libocfs2/namei.c | 2 +-
libocfs2/newdir.c | 2 +-
libocfs2/openfs.c | 4 +-
libocfs2/slot_map.c | 3 +-
libocfs2/sysfile.c | 2 +-
libocfs2/truncate.c | 2 +-
libocfs2/unix_io.c | 4 +-
libocfs2/unlink.c | 2 +-
listuuid/Makefile | 4 +-
listuuid/listuuid.c | 4 +-
mkfs.ocfs2/Makefile | 5 +-
mkfs.ocfs2/mkfs.h | 12 +-
mount.ocfs2/Makefile | 4 +-
mount.ocfs2/mount.ocfs2.h | 5 +-
mounted.ocfs2/Makefile | 4 +-
mounted.ocfs2/mounted.c | 3 +-
o2cb_ctl/Makefile | 2 +-
ocfs2_hb_ctl/Makefile | 4 +-
ocfs2_hb_ctl/ocfs2_hb_ctl.c | 2 +-
ocfs2cdsl/Makefile | 4 +-
ocfs2cdsl/ocfs2cdsl.c | 2 +-
ocfs2console/ocfs2interface/Makefile | 5 +-
ocfs2console/ocfs2interface/ocfs2module.c | 2 +-
ocfs2console/ocfs2interface/ocfsplist.c | 2 +-
sizetest/Makefile | 4 +-
sizetest/sizetest.c | 2 +-
tunefs.ocfs2/Makefile | 4 +-
tunefs.ocfs2/features.c | 2 +-
tunefs.ocfs2/remove_slot.c | 2 -
tunefs.ocfs2/sparse_file.c | 2 +-
tunefs.ocfs2/tunefs.c | 2 +-
tunefs.ocfs2/tunefs.h | 6 +-
143 files changed, 1855 insertions(+), 1865 deletions(-)
create mode 100644 include/ocfs2/.gitignore
create mode 100644 include/ocfs2/Makefile
create mode 100644 include/ocfs2/bitops.h
create mode 100644 include/ocfs2/byteorder.h
create mode 100644 include/ocfs2/feature_string.h
create mode 100644 include/ocfs2/jbd.h
create mode 100644 include/ocfs2/kernel-rbtree.h
create mode 100644 include/ocfs2/ocfs2.h
create mode 100644 libocfs2/bitmap.h
create mode 100644 libocfs2/dir_iterate.h
create mode 100644 libocfs2/dir_util.h
create mode 100644 libocfs2/dlm.h
create mode 100644 libocfs2/extent_map.h
delete mode 100644 libocfs2/include/.gitignore
delete mode 100644 libocfs2/include/bitmap.h
delete mode 100644 libocfs2/include/bitops.h
delete mode 100644 libocfs2/include/byteorder.h
delete mode 100644 libocfs2/include/dir_iterate.h
delete mode 100644 libocfs2/include/dir_util.h
delete mode 100644 libocfs2/include/dlm.h
delete mode 100644 libocfs2/include/extent_map.h
delete mode 100644 libocfs2/include/feature_string.h
delete mode 100644 libocfs2/include/jbd.h
delete mode 100644 libocfs2/include/kernel-rbtree.h
delete mode 100644 libocfs2/include/ocfs2.h
diff --git a/debugfs.ocfs2/Makefile b/debugfs.ocfs2/Makefile
index 78ef6e5..10782ef 100644
--- a/debugfs.ocfs2/Makefile
+++ b/debugfs.ocfs2/Makefile
@@ -6,9 +6,9 @@ sbindir = $(root_sbindir)
SBIN_PROGRAMS = debugfs.ocfs2
DEFINES = -DG_DISABLE_DEPRECATED -DLINUX -DDEBUGOCFS -DDEBUG
-DEFINES += -DOCFS2_FLAT_INCLUDES -DVERSION=\"$(VERSION)\"
+DEFINES += -DVERSION=\"$(VERSION)\"
-INCLUDES = -I$(TOPDIR)/include -Iinclude -I$(TOPDIR)/libocfs2/include
+INCLUDES = -I$(TOPDIR)/include -Iinclude
INCLUDES += $(GLIB_CFLAGS)
ifdef OCFS2_DEBUG
diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
index 5bad208..ed93759 100644
--- a/debugfs.ocfs2/commands.c
+++ b/debugfs.ocfs2/commands.c
@@ -23,7 +23,9 @@
* Authors: Sunil Mushran, Manish Singh
*/
-#include <main.h>
+#include "main.h"
+#include "ocfs2/byteorder.h"
+
#define SYSTEM_FILE_NAME_MAX 40
#define MAX_BLOCKS 50
diff --git a/debugfs.ocfs2/dump.c b/debugfs.ocfs2/dump.c
index 49547f6..91c34d3 100644
--- a/debugfs.ocfs2/dump.c
+++ b/debugfs.ocfs2/dump.c
@@ -23,9 +23,11 @@
* Authors: Sunil Mushran
*/
-#include <main.h>
#include <stdint.h>
+#include "main.h"
+#include "ocfs2/byteorder.h"
+
extern dbgfs_gbls gbls;
/*
diff --git a/debugfs.ocfs2/dump_fs_locks.c b/debugfs.ocfs2/dump_fs_locks.c
index 047fb1f..74423eb 100644
--- a/debugfs.ocfs2/dump_fs_locks.c
+++ b/debugfs.ocfs2/dump_fs_locks.c
@@ -38,7 +38,7 @@
#include <stdio.h>
#include "main.h"
-#include "byteorder.h"
+#include "ocfs2/byteorder.h"
#include "ocfs2_internals.h"
static char *level_str(int level)
diff --git a/debugfs.ocfs2/find_block_inode.c b/debugfs.ocfs2/find_block_inode.c
index 121887c..1a708a8 100644
--- a/debugfs.ocfs2/find_block_inode.c
+++ b/debugfs.ocfs2/find_block_inode.c
@@ -23,7 +23,7 @@
*
*/
-#include <main.h>
+#include "main.h"
extern dbgfs_gbls gbls;
diff --git a/debugfs.ocfs2/find_inode_paths.c b/debugfs.ocfs2/find_inode_paths.c
index 9e85a35..e2d0e7d 100644
--- a/debugfs.ocfs2/find_inode_paths.c
+++ b/debugfs.ocfs2/find_inode_paths.c
@@ -25,7 +25,7 @@
* Copyright (C) 1993, 1994, 1994, 1995, 1996, 1997 Theodore Ts'o.
*/
-#include <main.h>
+#include "main.h"
struct walk_path {
char *argv0;
diff --git a/debugfs.ocfs2/include/journal.h b/debugfs.ocfs2/include/journal.h
index b69e7ea..3825bbe 100644
--- a/debugfs.ocfs2/include/journal.h
+++ b/debugfs.ocfs2/include/journal.h
@@ -26,8 +26,6 @@
#ifndef _JOURNAL_H_
#define _JOURNAL_H_
-#include <jbd.h>
-
errcode_t read_journal(ocfs2_filesys *fs, uint64_t blkno, FILE *out);
int detect_block (char *buf);
diff --git a/debugfs.ocfs2/include/main.h b/debugfs.ocfs2/include/main.h
index b4ed99d..f0e0c2b 100644
--- a/debugfs.ocfs2/include/main.h
+++ b/debugfs.ocfs2/include/main.h
@@ -56,7 +56,7 @@
#include <linux/types.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "ocfs2-kernel/ocfs1_fs_compat.h"
enum {
diff --git a/debugfs.ocfs2/journal.c b/debugfs.ocfs2/journal.c
index d692554..5f02e2a 100644
--- a/debugfs.ocfs2/journal.c
+++ b/debugfs.ocfs2/journal.c
@@ -23,7 +23,7 @@
* Authors: Sunil Mushran, Mark Fasheh
*/
-#include <main.h>
+#include "main.h"
extern dbgfs_gbls gbls;
diff --git a/debugfs.ocfs2/main.c b/debugfs.ocfs2/main.c
index 1f646c3..30846fe 100644
--- a/debugfs.ocfs2/main.c
+++ b/debugfs.ocfs2/main.c
@@ -23,7 +23,7 @@
* Authors: Sunil Mushran, Manish Singh
*/
-#include <main.h>
+#include "main.h"
#include <sys/types.h>
#include <dirent.h>
diff --git a/debugfs.ocfs2/utils.c b/debugfs.ocfs2/utils.c
index 7d91bb4..a980362 100644
--- a/debugfs.ocfs2/utils.c
+++ b/debugfs.ocfs2/utils.c
@@ -23,8 +23,8 @@
* Authors: Sunil Mushran
*/
-#include <main.h>
-#include <bitops.h>
+#include "main.h"
+#include "ocfs2/bitops.h"
extern dbgfs_gbls gbls;
diff --git a/extras/Makefile b/extras/Makefile
index dab57b4..bbdd813 100644
--- a/extras/Makefile
+++ b/extras/Makefile
@@ -13,12 +13,10 @@ 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$(TOPDIR)/include -I../libocfs2/include
+INCLUDES = -I$(TOPDIR)/include
OPTIMIZE = -O2
-DEFINES += -DOCFS2_FLAT_INCLUDES
-
CFLAGS += $(OPTIMIZE)
FIND_HARDLINKS_CFILES = find_hardlinks.c
diff --git a/extras/compute_groups.c b/extras/compute_groups.c
index 5c9a66a..e56fc33 100644
--- a/extras/compute_groups.c
+++ b/extras/compute_groups.c
@@ -32,7 +32,7 @@
#include <inttypes.h>
#include <stdlib.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#define TWO_TERA 2199023255552LL
diff --git a/extras/find_allocation_fragments.c b/extras/find_allocation_fragments.c
index d5ae360..439a8e7 100644
--- a/extras/find_allocation_fragments.c
+++ b/extras/find_allocation_fragments.c
@@ -33,8 +33,8 @@
#include <string.h>
#include <inttypes.h>
-#include "ocfs2.h"
-#include "bitops.h"
+#include "ocfs2/ocfs2.h"
+#include "ocfs2/bitops.h"
struct fragment {
uint64_t f_group_blkno;
diff --git a/extras/find_dup_extents.c b/extras/find_dup_extents.c
index dc887ad..1ce0f11 100644
--- a/extras/find_dup_extents.c
+++ b/extras/find_dup_extents.c
@@ -34,7 +34,7 @@
#include <string.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
static void print_usage(void)
{
diff --git a/extras/find_hardlinks.c b/extras/find_hardlinks.c
index 492763e..cef0c90 100644
--- a/extras/find_hardlinks.c
+++ b/extras/find_hardlinks.c
@@ -35,7 +35,7 @@
#include <getopt.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
static void print_usage(void)
{
diff --git a/extras/find_inode_paths.c b/extras/find_inode_paths.c
index 5d0b66f..ea8942a 100644
--- a/extras/find_inode_paths.c
+++ b/extras/find_inode_paths.c
@@ -36,7 +36,7 @@
#include <getopt.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
static void print_usage(void)
{
diff --git a/extras/mark_journal_dirty.c b/extras/mark_journal_dirty.c
index c287abb..18ab63a 100644
--- a/extras/mark_journal_dirty.c
+++ b/extras/mark_journal_dirty.c
@@ -32,7 +32,8 @@
#include <getopt.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/byteorder.h"
+#include "ocfs2/ocfs2.h"
static int debug = 0;
diff --git a/extras/set_random_bits.c b/extras/set_random_bits.c
index 23c1813..96de5e8 100644
--- a/extras/set_random_bits.c
+++ b/extras/set_random_bits.c
@@ -34,7 +34,7 @@
#include <inttypes.h>
#include <string.h>
#include <stdint.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
static uint64_t read_number(const char *num)
{
diff --git a/fsck.ocfs2/Makefile b/fsck.ocfs2/Makefile
index 9feac20..fe34e37 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 = -I$(TOPDIR)/include -Iinclude -I$(TOPDIR)/libocfs2/include
+INCLUDES = -I$(TOPDIR)/include -Iinclude
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm
@@ -26,7 +26,6 @@ endif
CFLAGS := $(OPTS) -Wall -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations
-DEFINES = -DOCFS2_FLAT_INCLUDES
CFILES = fsck.c \
dirblocks.c \
diff --git a/fsck.ocfs2/dirblocks.c b/fsck.ocfs2/dirblocks.c
index 4173682..afabc11 100644
--- a/fsck.ocfs2/dirblocks.c
+++ b/fsck.ocfs2/dirblocks.c
@@ -28,7 +28,7 @@
#include <stdarg.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "fsck.h"
#include "dirblocks.h"
diff --git a/fsck.ocfs2/dirparents.c b/fsck.ocfs2/dirparents.c
index e319f3c..694e30c 100644
--- a/fsck.ocfs2/dirparents.c
+++ b/fsck.ocfs2/dirparents.c
@@ -30,7 +30,7 @@
#include <string.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "fsck.h"
#include "dirparents.h"
diff --git a/fsck.ocfs2/extent.c b/fsck.ocfs2/extent.c
index ee79a1c..718719a 100644
--- a/fsck.ocfs2/extent.c
+++ b/fsck.ocfs2/extent.c
@@ -37,7 +37,7 @@
#include <string.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "extent.h"
#include "fsck.h"
diff --git a/fsck.ocfs2/fsck.c b/fsck.ocfs2/fsck.c
index e4c9105..c738c16 100644
--- a/fsck.ocfs2/fsck.c
+++ b/fsck.ocfs2/fsck.c
@@ -53,7 +53,7 @@
#include <string.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "fsck.h"
#include "icount.h"
diff --git a/fsck.ocfs2/icount.c b/fsck.ocfs2/icount.c
index 1d770b5..858063a 100644
--- a/fsck.ocfs2/icount.c
+++ b/fsck.ocfs2/icount.c
@@ -29,7 +29,7 @@
#include <stdarg.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "fsck.h"
#include "icount.h"
diff --git a/fsck.ocfs2/include/dirblocks.h b/fsck.ocfs2/include/dirblocks.h
index a3904ac..cdd9741 100644
--- a/fsck.ocfs2/include/dirblocks.h
+++ b/fsck.ocfs2/include/dirblocks.h
@@ -24,7 +24,8 @@
#ifndef __O2FSCK_DIRBLOCKS_H__
#define __O2FSCK_DIRBLOCKS_H__
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
+#include "ocfs2/kernel-rbtree.h"
typedef struct _o2fsck_dirblocks {
struct rb_root db_root;
diff --git a/fsck.ocfs2/include/dirparents.h b/fsck.ocfs2/include/dirparents.h
index fd796e9..8f85ca9 100644
--- a/fsck.ocfs2/include/dirparents.h
+++ b/fsck.ocfs2/include/dirparents.h
@@ -24,6 +24,8 @@
#ifndef __O2FSCK_DIRPARENTS_H__
#define __O2FSCK_DIRPARENTS_H__
+#include "ocfs2/kernel-rbtree.h"
+
typedef struct _o2fsck_dir_parent {
struct rb_node dp_node;
uint64_t dp_ino; /* The dir inode in question. */
diff --git a/fsck.ocfs2/include/icount.h b/fsck.ocfs2/include/icount.h
index 5a52ece..ae73e6e 100644
--- a/fsck.ocfs2/include/icount.h
+++ b/fsck.ocfs2/include/icount.h
@@ -24,7 +24,8 @@
#ifndef __O2FSCK_ICOUNT_H__
#define __O2FSCK_ICOUNT_H__
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
+#include "ocfs2/kernel-rbtree.h"
typedef struct _o2fsck_icount {
ocfs2_bitmap *ic_single_bm;
diff --git a/fsck.ocfs2/include/strings.h b/fsck.ocfs2/include/strings.h
index 2196dc5..22be678 100644
--- a/fsck.ocfs2/include/strings.h
+++ b/fsck.ocfs2/include/strings.h
@@ -24,7 +24,8 @@
#ifndef __O2FSCK_STRINGS_H__
#define __O2FSCK_STRINGS_H__
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
+#include "ocfs2/kernel-rbtree.h"
typedef struct _o2fsck_strings {
struct rb_root s_root;
diff --git a/fsck.ocfs2/journal.c b/fsck.ocfs2/journal.c
index 8ce8f9d..d9846ba 100644
--- a/fsck.ocfs2/journal.c
+++ b/fsck.ocfs2/journal.c
@@ -41,10 +41,11 @@
#include <string.h>
#include <inttypes.h>
+#include "ocfs2/byteorder.h"
+#include "ocfs2/ocfs2.h"
+
#include "fsck.h"
#include "journal.h"
-#include "jbd.h"
-#include "ocfs2.h"
#include "pass1.h"
#include "problem.h"
#include "util.h"
diff --git a/fsck.ocfs2/pass0.c b/fsck.ocfs2/pass0.c
index d53c76d..add7721 100644
--- a/fsck.ocfs2/pass0.c
+++ b/fsck.ocfs2/pass0.c
@@ -49,8 +49,8 @@
#include <inttypes.h>
#include <time.h>
-#include "ocfs2.h"
-#include "bitops.h"
+#include "ocfs2/ocfs2.h"
+#include "ocfs2/bitops.h"
#include "dirblocks.h"
#include "dirparents.h"
diff --git a/fsck.ocfs2/pass1.c b/fsck.ocfs2/pass1.c
index c5bbf5b..6e739ad 100644
--- a/fsck.ocfs2/pass1.c
+++ b/fsck.ocfs2/pass1.c
@@ -54,8 +54,8 @@
#include <inttypes.h>
#include <time.h>
-#include "ocfs2.h"
-#include "bitops.h"
+#include "ocfs2/ocfs2.h"
+#include "ocfs2/bitops.h"
#include "dirblocks.h"
#include "dirparents.h"
diff --git a/fsck.ocfs2/pass2.c b/fsck.ocfs2/pass2.c
index 2243807..ba357b4 100644
--- a/fsck.ocfs2/pass2.c
+++ b/fsck.ocfs2/pass2.c
@@ -35,7 +35,7 @@
#include <inttypes.h>
#include <time.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "dirparents.h"
#include "icount.h"
diff --git a/fsck.ocfs2/pass3.c b/fsck.ocfs2/pass3.c
index 488491f..f546a72 100644
--- a/fsck.ocfs2/pass3.c
+++ b/fsck.ocfs2/pass3.c
@@ -33,7 +33,7 @@
#include <string.h>
#include <limits.h>
-#include <ocfs2.h>
+#include "ocfs2/ocfs2.h"
#include "dirparents.h"
#include "fsck.h"
diff --git a/fsck.ocfs2/pass4.c b/fsck.ocfs2/pass4.c
index 64373e0..505ff70 100644
--- a/fsck.ocfs2/pass4.c
+++ b/fsck.ocfs2/pass4.c
@@ -29,7 +29,7 @@
#include <inttypes.h>
#include <limits.h>
-#include <ocfs2.h>
+#include "ocfs2/ocfs2.h"
#include "fsck.h"
#include "icount.h"
diff --git a/fsck.ocfs2/problem.c b/fsck.ocfs2/problem.c
index fd6b608..0052939 100644
--- a/fsck.ocfs2/problem.c
+++ b/fsck.ocfs2/problem.c
@@ -36,7 +36,7 @@
#include <ctype.h>
#include <signal.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "problem.h"
#include "util.h"
diff --git a/fsck.ocfs2/strings.c b/fsck.ocfs2/strings.c
index 508d5ad..77cef6b 100644
--- a/fsck.ocfs2/strings.c
+++ b/fsck.ocfs2/strings.c
@@ -28,7 +28,7 @@
#include <string.h>
#include <stdarg.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "fsck.h"
#include "strings.h"
diff --git a/fsck.ocfs2/util.c b/fsck.ocfs2/util.c
index 11d002c..ca22a85 100644
--- a/fsck.ocfs2/util.c
+++ b/fsck.ocfs2/util.c
@@ -27,7 +27,7 @@
*/
#include <inttypes.h>
#include <string.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "util.h"
diff --git a/fswreck/Makefile b/fswreck/Makefile
index c8da5a2..b7109b0 100644
--- a/fswreck/Makefile
+++ b/fswreck/Makefile
@@ -5,9 +5,9 @@ include $(TOPDIR)/Preamble.make
SBIN_PROGRAMS = fswreck
DEFINES = -DG_DISABLE_DEPRECATED -DLINUX
-DEFINES += -DOCFS2_FLAT_INCLUDES -DVERSION=\"$(VERSION)\"
+DEFINES += -DVERSION=\"$(VERSION)\"
-INCLUDES = -I$(TOPDIR)/include -Iinclude -I$(TOPDIR)/libocfs2/include
+INCLUDES = -I$(TOPDIR)/include -Iinclude
INCLUDES += $(GLIB_CFLAGS)
ifdef OCFS2_DEBUG
diff --git a/fswreck/chain.c b/fswreck/chain.c
index 6cb5d18..87993fa 100644
--- a/fswreck/chain.c
+++ b/fswreck/chain.c
@@ -22,7 +22,7 @@
*
*/
-#include <main.h>
+#include "main.h"
extern char *progname;
diff --git a/fswreck/corrupt.c b/fswreck/corrupt.c
index 3b2830f..59a3f81 100644
--- a/fswreck/corrupt.c
+++ b/fswreck/corrupt.c
@@ -22,7 +22,7 @@
*
*/
-#include <main.h>
+#include "main.h"
extern char *progname;
diff --git a/fswreck/dir.c b/fswreck/dir.c
index 4371601..0be4c70 100644
--- a/fswreck/dir.c
+++ b/fswreck/dir.c
@@ -39,7 +39,7 @@
*
*/
-#include <main.h>
+#include "main.h"
extern char *progname;
diff --git a/fswreck/extent.c b/fswreck/extent.c
index f75ef8a..3470b37 100644
--- a/fswreck/extent.c
+++ b/fswreck/extent.c
@@ -34,7 +34,7 @@
*/
#include <errno.h>
-#include <main.h>
+#include "main.h"
extern char *progname;
diff --git a/fswreck/group.c b/fswreck/group.c
index f22f013..0f758b6 100644
--- a/fswreck/group.c
+++ b/fswreck/group.c
@@ -33,7 +33,7 @@
* Group list error: GROUP_UNEXPECTED_DESC, GROUP_EXPECTED_DESC
*
*/
-#include <main.h>
+#include "main.h"
extern char *progname;
diff --git a/fswreck/include/main.h b/fswreck/include/main.h
index 98bc2fb..0649014 100644
--- a/fswreck/include/main.h
+++ b/fswreck/include/main.h
@@ -51,7 +51,7 @@
#include <linux/types.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#define FSWRK_FATAL(fmt, arg...) ({ fprintf(stderr, "ERROR at %s, %d: " fmt ". EXITING!!!\n", \
__FILE__, __LINE__, ##arg); \
diff --git a/fswreck/inode.c b/fswreck/inode.c
index 5a7505a..f823117 100644
--- a/fswreck/inode.c
+++ b/fswreck/inode.c
@@ -35,7 +35,7 @@
*
*/
-#include <main.h>
+#include "main.h"
extern char *progname;
diff --git a/fswreck/local_alloc.c b/fswreck/local_alloc.c
index e0a5977..2c70a0f 100644
--- a/fswreck/local_alloc.c
+++ b/fswreck/local_alloc.c
@@ -36,7 +36,7 @@
*
*/
-#include <main.h>
+#include "main.h"
extern char *progname;
diff --git a/fswreck/main.c b/fswreck/main.c
index 7fbe0d8..b8afe08 100644
--- a/fswreck/main.c
+++ b/fswreck/main.c
@@ -22,7 +22,7 @@
*
*/
-#include <main.h>
+#include "main.h"
char *progname = NULL;
diff --git a/fswreck/special.c b/fswreck/special.c
index 653a88e..58e059b 100644
--- a/fswreck/special.c
+++ b/fswreck/special.c
@@ -22,7 +22,7 @@
*
*/
-#include <main.h>
+#include "main.h"
extern char *progname;
diff --git a/fswreck/symlink.c b/fswreck/symlink.c
index e746374..ed8d975 100644
--- a/fswreck/symlink.c
+++ b/fswreck/symlink.c
@@ -28,7 +28,7 @@
*
*/
-#include <main.h>
+#include "main.h"
static char *dummy = "/dummy00/dummy00";
extern char *progname;
diff --git a/fswreck/truncate_log.c b/fswreck/truncate_log.c
index cd4012b..b757013 100644
--- a/fswreck/truncate_log.c
+++ b/fswreck/truncate_log.c
@@ -31,7 +31,7 @@
*
*/
-#include <main.h>
+#include "main.h"
extern char *progname;
diff --git a/include/Makefile b/include/Makefile
index 432cd0e..512d8cf 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -2,6 +2,6 @@ TOPDIR = ..
include $(TOPDIR)/Preamble.make
-SUBDIRS = ocfs2-kernel o2dlm o2cb
+SUBDIRS = ocfs2-kernel o2dlm o2cb ocfs2
include $(TOPDIR)/Postamble.make
diff --git a/include/ocfs2/.gitignore b/include/ocfs2/.gitignore
new file mode 100644
index 0000000..fb4e857
--- /dev/null
+++ b/include/ocfs2/.gitignore
@@ -0,0 +1,5 @@
+cscope*
+stamp-md5
+.*.sw?
+.*.cmd
+ocfs2_err.h
diff --git a/include/ocfs2/Makefile b/include/ocfs2/Makefile
new file mode 100644
index 0000000..59194e1
--- /dev/null
+++ b/include/ocfs2/Makefile
@@ -0,0 +1,27 @@
+TOPDIR = ../..
+
+include $(TOPDIR)/Preamble.make
+
+HFILES_GEN = ocfs2_err.h
+
+all: $(HFILES_GEN)
+
+HFILES = ocfs2.h jbd.h bitops.h byteorder.h kernel-rbtree.h
+
+HEADERS_SUBDIR = ocfs2
+HEADERS = $(HFILES) $(HFILES_GEN)
+
+ocfs2_err.h: $(TOPDIR)/libocfs2/ocfs2_err.h
+ cp $< $@
+
+$(TOPDIR)/libocfs2/ocfs2_err.h:
+ make -C $(TOPDIR)/libocfs2 ocfs2_err.h
+
+DIST_FILES = $(HFILES)
+
+CLEAN_RULES = clean-err
+
+clean-err:
+ rm -f ocfs2_err.h
+
+include $(TOPDIR)/Postamble.make
diff --git a/include/ocfs2/bitops.h b/include/ocfs2/bitops.h
new file mode 100644
index 0000000..a12fe6b
--- /dev/null
+++ b/include/ocfs2/bitops.h
@@ -0,0 +1,42 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * bitops.h
+ *
+ * Bitmap frobbing routines for the OCFS2 userspace library.
+ *
+ * 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, 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.
+ *
+ * Authors: Joel Becker
+ *
+ * This code is a port of e2fsprogs/lib/ext2fs/bitops.h
+ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
+ */
+
+#ifndef _BITOPS_H
+#define _BITOPS_H
+
+extern int ocfs2_set_bit(int nr,void * addr);
+extern int ocfs2_clear_bit(int nr, void * addr);
+extern int ocfs2_test_bit(int nr, const void * addr);
+
+extern int ocfs2_find_first_bit_set(void *addr, int size);
+extern int ocfs2_find_first_bit_clear(void *addr, int size);
+extern int ocfs2_find_next_bit_set(void *addr, int size, int offset);
+extern int ocfs2_find_next_bit_clear(void *addr, int size, int offset);
+
+#endif
diff --git a/include/ocfs2/byteorder.h b/include/ocfs2/byteorder.h
new file mode 100644
index 0000000..53d4140
--- /dev/null
+++ b/include/ocfs2/byteorder.h
@@ -0,0 +1,122 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * byteorder.h
+ *
+ * Byteswapping!
+ *
+ * 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, 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.
+ *
+ * Authors: Joel Becker
+ */
+
+#ifndef _BYTEORDER_H
+#define _BYTEORDER_H
+
+
+#include <endian.h>
+#include <byteswap.h>
+#include <stdint.h>
+
+/*
+ * All OCFS2 on-disk values are in little endian, except for jbd's journal
+ * fields which it takes care of itself.
+ */
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define cpu_is_little_endian 1
+# ifndef cpu_to_le16
+# define cpu_to_le16(x) ((uint16_t)(x))
+# endif
+# ifndef le16_to_cpu
+# define le16_to_cpu(x) ((uint16_t)(x))
+# endif
+# ifndef cpu_to_le32
+# define cpu_to_le32(x) ((uint32_t)(x))
+# endif
+# ifndef le32_to_cpu
+# define le32_to_cpu(x) ((uint32_t)(x))
+# endif
+# ifndef cpu_to_le64
+# define cpu_to_le64(x) ((uint64_t)(x))
+# endif
+# ifndef le64_to_cpu
+# define le64_to_cpu(x) ((uint64_t)(x))
+# endif
+# ifndef cpu_to_be16
+# define cpu_to_be16(x) ((uint16_t)bswap_16(x))
+# endif
+# ifndef be16_to_cpu
+# define be16_to_cpu(x) ((uint16_t)bswap_16(x))
+# endif
+# ifndef cpu_to_be32
+# define cpu_to_be32(x) ((uint32_t)bswap_32(x))
+# endif
+# ifndef be32_to_cpu
+# define be32_to_cpu(x) ((uint32_t)bswap_32(x))
+# endif
+# ifndef cpu_to_be64
+# define cpu_to_be64(x) ((uint64_t)bswap_64(x))
+# endif
+# ifndef be64_to_cpu
+# define be64_to_cpu(x) ((uint64_t)bswap_64(x))
+# endif
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define cpu_is_little_endian 0
+# ifndef cpu_to_le16
+# define cpu_to_le16(x) ((uint16_t)bswap_16(x))
+# endif
+# ifndef le16_to_cpu
+# define le16_to_cpu(x) ((uint16_t)bswap_16(x))
+# endif
+# ifndef cpu_to_le32
+# define cpu_to_le32(x) ((uint32_t)bswap_32(x))
+# endif
+# ifndef le32_to_cpu
+# define le32_to_cpu(x) ((uint32_t)bswap_32(x))
+# endif
+# ifndef cpu_to_le64
+# define cpu_to_le64(x) ((uint64_t)bswap_64(x))
+# endif
+# ifndef le64_to_cpu
+# define le64_to_cpu(x) ((uint64_t)bswap_64(x))
+# endif
+# ifndef cpu_to_be16
+# define cpu_to_be16(x) ((uint16_t)(x))
+# endif
+# ifndef be16_to_cpu
+# define be16_to_cpu(x) ((uint16_t)(x))
+# endif
+# ifndef cpu_to_be32
+# define cpu_to_be32(x) ((uint32_t)(x))
+# endif
+# ifndef be32_to_cpu
+# define be32_to_cpu(x) ((uint32_t)(x))
+# endif
+# ifndef cpu_to_be64
+# define cpu_to_be64(x) ((uint64_t)(x))
+# endif
+# ifndef be64_to_cpu
+# define be64_to_cpu(x) ((uint64_t)(x))
+# endif
+#else
+# error Invalid byte order __BYTE_ORDER
+#endif /* __BYTE_ORDER */
+
+#define cpu_is_big_endian (!cpu_is_little_endian)
+
+#endif /* _BYTEORDER_H */
diff --git a/include/ocfs2/feature_string.h b/include/ocfs2/feature_string.h
new file mode 100644
index 0000000..650dda8
--- /dev/null
+++ b/include/ocfs2/feature_string.h
@@ -0,0 +1,59 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * feature_strings.h
+ *
+ * Routines for analyzing a feature string.
+ *
+ * Copyright (C) 2007 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 __FEATURE_STRING_H
+#define __FEATURE_STRING_H
+
+#include <ocfs2/ocfs2.h>
+
+struct fs_feature_flags {
+ const char *ff_str;
+ /* this flag is the feature's own flag. */
+ fs_options ff_own_flags;
+ /*
+ * this flag includes the feature's own flag and
+ * all the other features' flag it depends on.
+ */
+ fs_options ff_flags;
+};
+
+enum feature_level_indexes {
+ FEATURE_LEVEL_DEFAULT = 0,
+ FEATURE_LEVEL_MAX_COMPAT,
+ FEATURE_LEVEL_MAX_FEATURES,
+};
+
+errcode_t parse_feature(const char *opts,
+ fs_options *feature_flags,
+ fs_options *reverse_flags);
+
+int parse_feature_level(const char *typestr,
+ enum feature_level_indexes *index);
+
+int merge_feature_flags_with_level(fs_options *dest,
+ int index,
+ fs_options *feature_set,
+ fs_options *reverse_set);
+#endif /* __FEATURE_STIRNG_H */
diff --git a/include/ocfs2/jbd.h b/include/ocfs2/jbd.h
new file mode 100644
index 0000000..29493fb
--- /dev/null
+++ b/include/ocfs2/jbd.h
@@ -0,0 +1,124 @@
+/*
+ * jbd.h
+ *
+ * header file extracted from linux/include/linux/jbd.h
+ *
+ * Originally written by Stephen C. Tweedie <sct at redhat.com>
+ *
+ * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
+ *
+ * This file is part of the Linux kernel and is made available under
+ * the terms of the GNU General Public License, version 2, or at your
+ * option, any later version, incorporated herein by reference.
+ *
+ * Definitions for transaction data structures for the buffer cache
+ * filesystem journaling support.
+ */
+
+#ifndef _JBD_H_
+#define _JBD_H_
+
+/*
+ * Internal structures used by the logging mechanism:
+ */
+
+#define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
+
+/*
+ * On-disk structures
+ */
+
+/*
+ * Descriptor block types:
+ */
+
+#define JFS_DESCRIPTOR_BLOCK 1
+#define JFS_COMMIT_BLOCK 2
+#define JFS_SUPERBLOCK_V1 3
+#define JFS_SUPERBLOCK_V2 4
+#define JFS_REVOKE_BLOCK 5
+
+/*
+ * Standard header for all descriptor blocks:
+ */
+typedef struct journal_header_s
+{
+ __u32 h_magic;
+ __u32 h_blocktype;
+ __u32 h_sequence;
+} journal_header_t;
+
+/*
+ * The block tag: used to describe a single buffer in the journal
+ */
+typedef struct journal_block_tag_s
+{
+ __u32 t_blocknr; /* The on-disk block number */
+ __u32 t_flags; /* See below */
+} journal_block_tag_t;
+
+/*
+ * The revoke descriptor: used on disk to describe a series of blocks to
+ * be revoked from the log
+ */
+typedef struct journal_revoke_header_s
+{
+ journal_header_t r_header;
+ int r_count; /* Count of bytes used in the block */
+} journal_revoke_header_t;
+
+/* Definitions for the journal tag flags word: */
+#define JFS_FLAG_ESCAPE 1 /* on-disk block is escaped */
+#define JFS_FLAG_SAME_UUID 2 /* block has same uuid as previous */
+#define JFS_FLAG_DELETED 4 /* block deleted by this transaction */
+#define JFS_FLAG_LAST_TAG 8 /* last tag in this descriptor block */
+
+/*
+ * The journal superblock. All fields are in big-endian byte order.
+ */
+typedef struct journal_superblock_s
+{
+/* 0x0000 */
+ journal_header_t s_header;
+
+/* 0x000C */
+ /* Static information describing the journal */
+ __u32 s_blocksize; /* journal device blocksize */
+ __u32 s_maxlen; /* total blocks in journal file */
+ __u32 s_first; /* first block of log information */
+
+/* 0x0018 */
+ /* Dynamic information describing the current state of the log */
+ __u32 s_sequence; /* first commit ID expected in log */
+ __u32 s_start; /* blocknr of start of log */
+
+/* 0x0020 */
+ /* Error value, as set by journal_abort(). */
+ __s32 s_errno;
+
+/* 0x0024 */
+ /* Remaining fields are only valid in a version-2 superblock */
+ __u32 s_feature_compat; /* compatible feature set */
+ __u32 s_feature_incompat; /* incompatible feature set */
+ __u32 s_feature_ro_compat; /* readonly-compatible feature set */
+/* 0x0030 */
+ __u8 s_uuid[16]; /* 128-bit uuid for journal */
+
+/* 0x0040 */
+ __u32 s_nr_users; /* Nr of filesystems sharing log */
+
+ __u32 s_dynsuper; /* Blocknr of dynamic superblock copy*/
+
+/* 0x0048 */
+ __u32 s_max_transaction; /* Limit of journal blocks per trans.*/
+ __u32 s_max_trans_data; /* Limit of data blocks per trans. */
+
+/* 0x0050 */
+ __u32 s_padding[44];
+
+/* 0x0100 */
+ __u8 s_users[16*48]; /* ids of all fs'es sharing the log */
+/* 0x0400 */
+} journal_superblock_t;
+
+#endif /* _JBD_H_ */
diff --git a/include/ocfs2/kernel-rbtree.h b/include/ocfs2/kernel-rbtree.h
new file mode 100644
index 0000000..4c0256e
--- /dev/null
+++ b/include/ocfs2/kernel-rbtree.h
@@ -0,0 +1,141 @@
+/*
+ Red Black Trees
+ (C) 1999 Andrea Arcangeli <andrea at suse.de>
+
+ 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 02111-1307 USA
+
+ rbtree.h
+
+ To use rbtrees you'll have to implement your own insert and search cores.
+ This will avoid us to use callbacks and to drop drammatically performances.
+ I know it's not the cleaner way, but in C (not in C++) to get
+ performances and genericity...
+
+ Some example of insert and search follows here. The search is a plain
+ normal search over an ordered tree. The insert instead must be implemented
+ int two steps: as first thing the code must insert the element in
+ order as a red leaf in the tree, then the support library function
+ rb_insert_color() must be called. Such function will do the
+ not trivial work to rebalance the rbtree if necessary.
+
+-----------------------------------------------------------------------
+static inline struct page * rb_search_page_cache(struct inode * inode,
+ unsigned long offset)
+{
+ struct rb_node * n = inode->i_rb_page_cache.rb_node;
+ struct page * page;
+
+ while (n)
+ {
+ page = rb_entry(n, struct page, rb_page_cache);
+
+ if (offset < page->offset)
+ n = n->rb_left;
+ else if (offset > page->offset)
+ n = n->rb_right;
+ else
+ return page;
+ }
+ return NULL;
+}
+
+static inline struct page * __rb_insert_page_cache(struct inode * inode,
+ unsigned long offset,
+ struct rb_node * node)
+{
+ struct rb_node ** p = &inode->i_rb_page_cache.rb_node;
+ struct rb_node * parent = NULL;
+ struct page * page;
+
+ while (*p)
+ {
+ parent = *p;
+ page = rb_entry(parent, struct page, rb_page_cache);
+
+ if (offset < page->offset)
+ p = &(*p)->rb_left;
+ else if (offset > page->offset)
+ p = &(*p)->rb_right;
+ else
+ return page;
+ }
+
+ rb_link_node(node, parent, p);
+
+ return NULL;
+}
+
+static inline struct page * rb_insert_page_cache(struct inode * inode,
+ unsigned long offset,
+ struct rb_node * node)
+{
+ struct page * ret;
+ if ((ret = __rb_insert_page_cache(inode, offset, node)))
+ goto out;
+ rb_insert_color(node, &inode->i_rb_page_cache);
+ out:
+ return ret;
+}
+-----------------------------------------------------------------------
+*/
+
+#ifndef _LINUX_RBTREE_H
+#define _LINUX_RBTREE_H
+
+#include <stdlib.h>
+
+struct rb_node
+{
+ struct rb_node *rb_parent;
+ int rb_color;
+#define RB_RED 0
+#define RB_BLACK 1
+ struct rb_node *rb_right;
+ struct rb_node *rb_left;
+};
+
+struct rb_root
+{
+ struct rb_node *rb_node;
+};
+
+#define RB_ROOT (struct rb_root) { NULL, }
+#define rb_entry(ptr, type, member) \
+ ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+
+extern void rb_insert_color(struct rb_node *, struct rb_root *);
+extern void rb_erase(struct rb_node *, struct rb_root *);
+
+/* Find logical next and previous nodes in a tree */
+extern struct rb_node *rb_next(struct rb_node *);
+extern struct rb_node *rb_prev(struct rb_node *);
+extern struct rb_node *rb_first(struct rb_root *);
+extern struct rb_node *rb_last(struct rb_root *);
+
+/* Fast replacement of a single node without remove/rebalance/add/rebalance */
+extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
+ struct rb_root *root);
+
+static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
+ struct rb_node ** rb_link)
+{
+ node->rb_parent = parent;
+ node->rb_color = RB_RED;
+ node->rb_left = node->rb_right = NULL;
+
+ *rb_link = node;
+}
+
+#endif /* _LINUX_RBTREE_H */
diff --git a/include/ocfs2/ocfs2.h b/include/ocfs2/ocfs2.h
new file mode 100644
index 0000000..390666d
--- /dev/null
+++ b/include/ocfs2/ocfs2.h
@@ -0,0 +1,844 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * ocfs2.h
+ *
+ * Filesystem object routines for the OCFS2 userspace library.
+ *
+ * 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, 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.
+ *
+ * Authors: Joel Becker
+ */
+
+#ifndef _FILESYS_H
+#define _FILESYS_H
+
+#ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE 600
+#endif
+#ifndef _LARGEFILE64_SOURCE
+# define _LARGEFILE64_SOURCE
+#endif
+
+#include <stdio.h>
+#include <stdint.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <string.h>
+#include <stddef.h>
+
+#include <limits.h>
+
+#include <linux/types.h>
+
+#include <et/com_err.h>
+
+#include <ocfs2-kernel/kernel-list.h>
+#include <ocfs2-kernel/ocfs2_fs.h>
+#include <o2dlm/o2dlm.h>
+#include <o2cb/o2cb.h>
+#include <ocfs2/ocfs2_err.h>
+#include <ocfs2/jbd.h>
+#include <ocfs2-kernel/ocfs2_lockid.h>
+
+#define OCFS2_LIB_FEATURE_INCOMPAT_SUPP (OCFS2_FEATURE_INCOMPAT_SUPP | \
+ OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV | \
+ OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG | \
+ OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT | \
+ OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG)
+
+#define OCFS2_LIB_FEATURE_RO_COMPAT_SUPP OCFS2_FEATURE_RO_COMPAT_SUPP
+
+#define OCFS2_LIB_FEATURE_COMPAT_SUPP OCFS2_FEATURE_COMPAT_SUPP
+
+#define OCFS2_LIB_ABORTED_TUNEFS_SUPP OCFS2_TUNEFS_INPROG_REMOVE_SLOT
+
+/*
+ * Printable strings for feature flags
+ * These MUST be kept in sync with the flags in ocfs2_fs.h, and MUST
+ * be named <flag>_STR.
+ */
+#define OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV_STR "Heartbeat"
+#define OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG_STR "AbortedResize"
+#define OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT_STR "Local"
+#define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC_STR "SparseAlloc"
+#define OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG_STR "TunefsAbort"
+#define OCFS2_FEATURE_COMPAT_BACKUP_SB_STR "BackupSuper"
+#define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN_STR "UnwrittenExtents"
+#define OCFS2_TUNEFS_INPROG_REMOVE_SLOT_STR "RemoveSlot"
+
+/* define OCFS2_SB for ocfs2-tools */
+#define OCFS2_SB(sb) (sb)
+
+/* Flags for the ocfs2_filesys structure */
+#define OCFS2_FLAG_RO 0x00
+#define OCFS2_FLAG_RW 0x01
+#define OCFS2_FLAG_CHANGED 0x02
+#define OCFS2_FLAG_DIRTY 0x04
+#define OCFS2_FLAG_SWAP_BYTES 0x08
+#define OCFS2_FLAG_BUFFERED 0x10
+#define OCFS2_FLAG_NO_REV_CHECK 0x20 /* Do not check the OCFS
+ vol_header structure
+ for revision info */
+#define OCFS2_FLAG_HEARTBEAT_DEV_OK 0x40
+#define OCFS2_FLAG_STRICT_COMPAT_CHECK 0x80
+
+/* Return flags for the directory iterator functions */
+#define OCFS2_DIRENT_CHANGED 0x01
+#define OCFS2_DIRENT_ABORT 0x02
+#define OCFS2_DIRENT_ERROR 0x04
+
+/* Directory iterator flags */
+#define OCFS2_DIRENT_FLAG_INCLUDE_EMPTY 0x01
+#define OCFS2_DIRENT_FLAG_INCLUDE_REMOVED 0x02
+#define OCFS2_DIRENT_FLAG_EXCLUDE_DOTS 0x04
+
+/* Return flags for the chain iterator functions */
+#define OCFS2_CHAIN_CHANGED 0x01
+#define OCFS2_CHAIN_ABORT 0x02
+#define OCFS2_CHAIN_ERROR 0x04
+
+/* Directory constants */
+#define OCFS2_DIRENT_DOT_FILE 1
+#define OCFS2_DIRENT_DOT_DOT_FILE 2
+#define OCFS2_DIRENT_OTHER_FILE 3
+#define OCFS2_DIRENT_DELETED_FILE 4
+
+/* Directory scan flags */
+#define OCFS2_DIR_SCAN_FLAG_EXCLUDE_DOTS 0x01
+
+/* Check if mounted flags */
+#define OCFS2_MF_MOUNTED 1
+#define OCFS2_MF_ISROOT 2
+#define OCFS2_MF_READONLY 4
+#define OCFS2_MF_SWAP 8
+#define OCFS2_MF_BUSY 16
+#define OCFS2_MF_MOUNTED_CLUSTER 32
+
+/* check_heartbeats progress states */
+#define OCFS2_CHB_START 1
+#define OCFS2_CHB_WAITING 2
+#define OCFS2_CHB_COMPLETE 3
+
+typedef void (*ocfs2_chb_notify)(int state, char *progress, void *data);
+
+typedef struct _ocfs2_filesys ocfs2_filesys;
+typedef struct _ocfs2_cached_inode ocfs2_cached_inode;
+typedef struct _io_channel io_channel;
+typedef struct _ocfs2_inode_scan ocfs2_inode_scan;
+typedef struct _ocfs2_dir_scan ocfs2_dir_scan;
+typedef struct _ocfs2_bitmap ocfs2_bitmap;
+typedef struct _ocfs2_devices ocfs2_devices;
+
+struct _ocfs2_filesys {
+ char *fs_devname;
+ uint32_t fs_flags;
+ io_channel *fs_io;
+ struct ocfs2_dinode *fs_super;
+ struct ocfs2_dinode *fs_orig_super;
+ unsigned int fs_blocksize;
+ unsigned int fs_clustersize;
+ uint32_t fs_clusters;
+ uint64_t fs_blocks;
+ uint32_t fs_umask;
+ uint64_t fs_root_blkno;
+ uint64_t fs_sysdir_blkno;
+ uint64_t fs_first_cg_blkno;
+ char uuid_str[OCFS2_VOL_UUID_LEN * 2 + 1];
+
+ /* Allocators */
+ ocfs2_cached_inode *fs_cluster_alloc;
+ ocfs2_cached_inode **fs_inode_allocs;
+ ocfs2_cached_inode *fs_system_inode_alloc;
+ ocfs2_cached_inode **fs_eb_allocs;
+ ocfs2_cached_inode *fs_system_eb_alloc;
+
+ struct o2dlm_ctxt *fs_dlm_ctxt;
+
+ /* Reserved for the use of the calling application. */
+ void *fs_private;
+};
+
+struct _ocfs2_cached_inode {
+ struct _ocfs2_filesys *ci_fs;
+ uint64_t ci_blkno;
+ struct ocfs2_dinode *ci_inode;
+ ocfs2_bitmap *ci_chains;
+};
+
+struct _ocfs2_devices {
+ struct list_head list;
+ char dev_name[100];
+ uint8_t label[64];
+ uint8_t uuid[16];
+ int mount_flags;
+ int fs_type; /* 0=unknown, 1=ocfs, 2=ocfs2 */
+ int hb_dev;
+ uint32_t maj_num; /* major number of the device */
+ uint32_t min_num; /* minor number of the device */
+ errcode_t errcode; /* error encountered reading device */
+ void *private;
+ uint16_t max_slots;
+ uint8_t *node_nums; /* list of mounted nodes */
+};
+
+typedef struct _fs_options fs_options;
+
+struct _fs_options {
+ uint32_t compat;
+ uint32_t incompat;
+ uint32_t ro_compat;
+};
+
+errcode_t ocfs2_malloc(unsigned long size, void *ptr);
+errcode_t ocfs2_malloc0(unsigned long size, void *ptr);
+errcode_t ocfs2_free(void *ptr);
+errcode_t ocfs2_realloc(unsigned long size, void *ptr);
+errcode_t ocfs2_realloc0(unsigned long size, void *ptr,
+ unsigned long old_size);
+errcode_t ocfs2_malloc_blocks(io_channel *channel, int num_blocks,
+ void *ptr);
+errcode_t ocfs2_malloc_block(io_channel *channel, void *ptr);
+
+errcode_t io_open(const char *name, int flags, io_channel **channel);
+errcode_t io_close(io_channel *channel);
+int io_get_error(io_channel *channel);
+errcode_t io_set_blksize(io_channel *channel, int blksize);
+int io_get_blksize(io_channel *channel);
+errcode_t io_read_block(io_channel *channel, int64_t blkno, int count,
+ char *data);
+errcode_t io_write_block(io_channel *channel, int64_t blkno, int count,
+ const char *data);
+errcode_t io_init_cache(io_channel *channel, size_t nr_blocks);
+errcode_t io_init_cache_size(io_channel *channel, size_t bytes);
+void io_destroy_cache(io_channel *channel);
+
+errcode_t ocfs2_read_super(ocfs2_filesys *fs, uint64_t superblock, char *sb);
+errcode_t ocfs2_write_super(ocfs2_filesys *fs);
+int ocfs2_mount_local(ocfs2_filesys *fs);
+errcode_t ocfs2_open(const char *name, int flags,
+ unsigned int superblock, unsigned int blksize,
+ ocfs2_filesys **ret_fs);
+errcode_t ocfs2_flush(ocfs2_filesys *fs);
+errcode_t ocfs2_close(ocfs2_filesys *fs);
+void ocfs2_freefs(ocfs2_filesys *fs);
+
+void ocfs2_swap_inode_from_cpu(struct ocfs2_dinode *di);
+void ocfs2_swap_inode_to_cpu(struct ocfs2_dinode *di);
+errcode_t ocfs2_read_inode(ocfs2_filesys *fs, uint64_t blkno,
+ char *inode_buf);
+errcode_t ocfs2_write_inode(ocfs2_filesys *fs, uint64_t blkno,
+ char *inode_buf);
+errcode_t ocfs2_check_directory(ocfs2_filesys *fs, uint64_t dir);
+
+errcode_t ocfs2_read_cached_inode(ocfs2_filesys *fs, uint64_t blkno,
+ ocfs2_cached_inode **ret_ci);
+errcode_t ocfs2_write_cached_inode(ocfs2_filesys *fs,
+ ocfs2_cached_inode *cinode);
+errcode_t ocfs2_free_cached_inode(ocfs2_filesys *fs,
+ ocfs2_cached_inode *cinode);
+
+void ocfs2_swap_extent_list_from_cpu(struct ocfs2_extent_list *el);
+void ocfs2_swap_extent_list_to_cpu(struct ocfs2_extent_list *el);
+errcode_t ocfs2_extent_map_get_blocks(ocfs2_cached_inode *cinode,
+ uint64_t v_blkno, int count,
+ uint64_t *p_blkno,
+ uint64_t *ret_count,
+ uint16_t *extent_flags);
+errcode_t ocfs2_get_clusters(ocfs2_cached_inode *cinode,
+ uint32_t v_cluster,
+ uint32_t *p_cluster,
+ uint32_t *num_clusters,
+ uint16_t *extent_flags);
+int ocfs2_find_leaf(ocfs2_filesys *fs, struct ocfs2_dinode *di,
+ uint32_t cpos, char **leaf_buf);
+int ocfs2_search_extent_list(struct ocfs2_extent_list *el, uint32_t v_cluster);
+void ocfs2_swap_journal_superblock(journal_superblock_t *jsb);
+errcode_t ocfs2_init_journal_superblock(ocfs2_filesys *fs, char *buf,
+ int buflen, uint32_t jrnl_size);
+errcode_t ocfs2_read_journal_superblock(ocfs2_filesys *fs, uint64_t blkno,
+ char *jsb_buf);
+errcode_t ocfs2_write_journal_superblock(ocfs2_filesys *fs, uint64_t blkno,
+ char *jsb_buf);
+errcode_t ocfs2_make_journal(ocfs2_filesys *fs, uint64_t blkno,
+ uint32_t clusters);
+
+errcode_t ocfs2_read_extent_block(ocfs2_filesys *fs, uint64_t blkno,
+ char *eb_buf);
+errcode_t ocfs2_read_extent_block_nocheck(ocfs2_filesys *fs, uint64_t blkno,
+ char *eb_buf);
+errcode_t ocfs2_write_extent_block(ocfs2_filesys *fs, uint64_t blkno,
+ char *eb_buf);
+errcode_t ocfs2_swap_dir_entries_from_cpu(void *buf, uint64_t bytes);
+errcode_t ocfs2_swap_dir_entries_to_cpu(void *buf, uint64_t bytes);
+errcode_t ocfs2_read_dir_block(ocfs2_filesys *fs, uint64_t block,
+ void *buf);
+errcode_t ocfs2_write_dir_block(ocfs2_filesys *fs, uint64_t block,
+ void *buf);
+
+errcode_t ocfs2_dir_iterate2(ocfs2_filesys *fs,
+ uint64_t dir,
+ int flags,
+ char *block_buf,
+ int (*func)(uint64_t dir,
+ int entry,
+ struct ocfs2_dir_entry *dirent,
+ int offset,
+ int blocksize,
+ char *buf,
+ void *priv_data),
+ void *priv_data);
+extern errcode_t ocfs2_dir_iterate(ocfs2_filesys *fs,
+ uint64_t dir,
+ int flags,
+ char *block_buf,
+ int (*func)(struct ocfs2_dir_entry *dirent,
+ int offset,
+ int blocksize,
+ char *buf,
+ void *priv_data),
+ void *priv_data);
+
+errcode_t ocfs2_lookup(ocfs2_filesys *fs, uint64_t dir,
+ const char *name, int namelen, char *buf,
+ uint64_t *inode);
+
+errcode_t ocfs2_lookup_system_inode(ocfs2_filesys *fs, int type,
+ int slot_num, uint64_t *blkno);
+
+errcode_t ocfs2_link(ocfs2_filesys *fs, uint64_t dir, const char *name,
+ uint64_t ino, int flags);
+
+errcode_t ocfs2_unlink(ocfs2_filesys *fs, uint64_t dir,
+ const char *name, uint64_t ino, int flags);
+
+errcode_t ocfs2_open_inode_scan(ocfs2_filesys *fs,
+ ocfs2_inode_scan **ret_scan);
+void ocfs2_close_inode_scan(ocfs2_inode_scan *scan);
+errcode_t ocfs2_get_next_inode(ocfs2_inode_scan *scan,
+ uint64_t *blkno, char *inode);
+
+errcode_t ocfs2_open_dir_scan(ocfs2_filesys *fs, uint64_t dir, int flags,
+ ocfs2_dir_scan **ret_scan);
+void ocfs2_close_dir_scan(ocfs2_dir_scan *scan);
+errcode_t ocfs2_get_next_dir_entry(ocfs2_dir_scan *scan,
+ struct ocfs2_dir_entry *dirent);
+
+errcode_t ocfs2_cluster_bitmap_new(ocfs2_filesys *fs,
+ const char *description,
+ ocfs2_bitmap **ret_bitmap);
+errcode_t ocfs2_block_bitmap_new(ocfs2_filesys *fs,
+ const char *description,
+ ocfs2_bitmap **ret_bitmap);
+void ocfs2_bitmap_free(ocfs2_bitmap *bitmap);
+errcode_t ocfs2_bitmap_set(ocfs2_bitmap *bitmap, uint64_t bitno,
+ int *oldval);
+errcode_t ocfs2_bitmap_clear(ocfs2_bitmap *bitmap, uint64_t bitno,
+ int *oldval);
+errcode_t ocfs2_bitmap_test(ocfs2_bitmap *bitmap, uint64_t bitno,
+ int *val);
+errcode_t ocfs2_bitmap_find_next_set(ocfs2_bitmap *bitmap,
+ uint64_t start, uint64_t *found);
+errcode_t ocfs2_bitmap_find_next_clear(ocfs2_bitmap *bitmap,
+ uint64_t start, uint64_t *found);
+errcode_t ocfs2_bitmap_read(ocfs2_bitmap *bitmap);
+errcode_t ocfs2_bitmap_write(ocfs2_bitmap *bitmap);
+uint64_t ocfs2_bitmap_get_set_bits(ocfs2_bitmap *bitmap);
+errcode_t ocfs2_bitmap_alloc_range(ocfs2_bitmap *bitmap, uint64_t min,
+ uint64_t len, uint64_t *first_bit,
+ uint64_t *bits_found);
+errcode_t ocfs2_bitmap_clear_range(ocfs2_bitmap *bitmap, uint64_t len,
+ uint64_t first_bit);
+
+errcode_t ocfs2_get_device_size(const char *file, int blocksize,
+ uint64_t *retblocks);
+
+errcode_t ocfs2_get_device_sectsize(const char *file, int *sectsize);
+
+errcode_t ocfs2_check_if_mounted(const char *file, int *mount_flags);
+errcode_t ocfs2_check_mount_point(const char *device, int *mount_flags,
+ char *mtpt, int mtlen);
+
+errcode_t ocfs2_read_whole_file(ocfs2_filesys *fs, uint64_t blkno,
+ char **buf, int *len);
+
+void ocfs2_swap_disk_heartbeat_block(struct o2hb_disk_heartbeat_block *hb);
+errcode_t ocfs2_check_heartbeat(char *device, int *mount_flags,
+ struct list_head *nodes_list);
+
+errcode_t ocfs2_check_heartbeats(struct list_head *dev_list, int ignore_local);
+
+errcode_t ocfs2_get_ocfs1_label(char *device, uint8_t *label, uint16_t label_len,
+ uint8_t *uuid, uint16_t uuid_len);
+
+void ocfs2_swap_group_desc(struct ocfs2_group_desc *gd);
+errcode_t ocfs2_read_group_desc(ocfs2_filesys *fs, uint64_t blkno,
+ char *gd_buf);
+
+errcode_t ocfs2_write_group_desc(ocfs2_filesys *fs, uint64_t blkno,
+ char *gd_buf);
+
+errcode_t ocfs2_chain_iterate(ocfs2_filesys *fs,
+ uint64_t blkno,
+ int (*func)(ocfs2_filesys *fs,
+ uint64_t gd_blkno,
+ int chain_num,
+ void *priv_data),
+ void *priv_data);
+
+errcode_t ocfs2_load_chain_allocator(ocfs2_filesys *fs,
+ ocfs2_cached_inode *cinode);
+errcode_t ocfs2_write_chain_allocator(ocfs2_filesys *fs,
+ ocfs2_cached_inode *cinode);
+errcode_t ocfs2_chain_alloc(ocfs2_filesys *fs,
+ ocfs2_cached_inode *cinode,
+ uint64_t *gd_blkno,
+ uint64_t *bitno);
+errcode_t ocfs2_chain_free(ocfs2_filesys *fs,
+ ocfs2_cached_inode *cinode,
+ uint64_t bitno);
+errcode_t ocfs2_chain_alloc_range(ocfs2_filesys *fs,
+ ocfs2_cached_inode *cinode,
+ uint64_t min,
+ uint64_t requested,
+ uint64_t *start_bit,
+ uint64_t *bits_found);
+errcode_t ocfs2_chain_free_range(ocfs2_filesys *fs,
+ ocfs2_cached_inode *cinode,
+ uint64_t len,
+ uint64_t start_bit);
+errcode_t ocfs2_chain_test(ocfs2_filesys *fs,
+ ocfs2_cached_inode *cinode,
+ uint64_t bitno,
+ int *oldval);
+errcode_t ocfs2_chain_force_val(ocfs2_filesys *fs,
+ ocfs2_cached_inode *cinode,
+ uint64_t blkno,
+ int newval,
+ int *oldval);
+errcode_t ocfs2_chain_add_group(ocfs2_filesys *fs,
+ ocfs2_cached_inode *cinode);
+
+errcode_t ocfs2_expand_dir(ocfs2_filesys *fs,
+ uint64_t dir,
+ uint64_t parent_dir);
+
+errcode_t ocfs2_test_inode_allocated(ocfs2_filesys *fs, uint64_t blkno,
+ int *is_allocated);
+void ocfs2_init_group_desc(ocfs2_filesys *fs,
+ struct ocfs2_group_desc *gd,
+ uint64_t blkno, uint32_t generation,
+ uint64_t parent_inode, uint16_t bits,
+ uint16_t chain);
+
+errcode_t ocfs2_new_dir_block(ocfs2_filesys *fs, uint64_t dir_ino,
+ uint64_t parent_ino, char **block);
+
+errcode_t ocfs2_insert_extent(ocfs2_filesys *fs, uint64_t ino, uint32_t cpos,
+ uint64_t c_blkno, uint32_t clusters,
+ uint16_t flag);
+
+errcode_t ocfs2_new_inode(ocfs2_filesys *fs, uint64_t *ino, int mode);
+errcode_t ocfs2_new_system_inode(ocfs2_filesys *fs, uint64_t *ino, int mode, int flags);
+errcode_t ocfs2_delete_inode(ocfs2_filesys *fs, uint64_t ino);
+errcode_t ocfs2_new_extent_block(ocfs2_filesys *fs, uint64_t *blkno);
+errcode_t ocfs2_delete_extent_block(ocfs2_filesys *fs, uint64_t blkno);
+/*
+ * Allocate the blocks and insert them to the file.
+ * only i_clusters of dinode will be updated accordingly, i_size not changed.
+ */
+errcode_t ocfs2_extend_allocation(ocfs2_filesys *fs, uint64_t ino,
+ uint32_t new_clusters);
+/* Extend the file to the new size. No clusters will be allocated. */
+errcode_t ocfs2_extend_file(ocfs2_filesys *fs, uint64_t ino, uint64_t new_size);
+
+int ocfs2_mark_extent_written(ocfs2_filesys *fs, struct ocfs2_dinode *di,
+ uint32_t cpos, uint32_t len, uint64_t p_blkno);
+/* Reserve spaces at "offset" with a "len" in the files. */
+errcode_t ocfs2_allocate_unwritten_extents(ocfs2_filesys *fs, uint64_t ino,
+ uint64_t offset, uint64_t len);
+
+errcode_t ocfs2_truncate(ocfs2_filesys *fs, uint64_t ino, uint64_t new_i_size);
+errcode_t ocfs2_zero_tail_and_truncate(ocfs2_filesys *fs,
+ ocfs2_cached_inode *ci,
+ uint64_t new_size,
+ uint32_t *new_clusters);
+errcode_t ocfs2_new_clusters(ocfs2_filesys *fs,
+ uint32_t min,
+ uint32_t requested,
+ uint64_t *start_blkno,
+ uint32_t *clusters_found);
+errcode_t ocfs2_free_clusters(ocfs2_filesys *fs,
+ uint32_t len,
+ uint64_t start_blkno);
+
+errcode_t ocfs2_lookup(ocfs2_filesys *fs, uint64_t dir, const char *name,
+ int namelen, char *buf, uint64_t *inode);
+
+errcode_t ocfs2_namei(ocfs2_filesys *fs, uint64_t root, uint64_t cwd,
+ const char *name, uint64_t *inode);
+
+errcode_t ocfs2_namei_follow(ocfs2_filesys *fs, uint64_t root, uint64_t cwd,
+ const char *name, uint64_t *inode);
+
+errcode_t ocfs2_follow_link(ocfs2_filesys *fs, uint64_t root, uint64_t cwd,
+ uint64_t inode, uint64_t *res_inode);
+
+errcode_t ocfs2_file_read(ocfs2_cached_inode *ci, void *buf, uint32_t count,
+ uint64_t offset, uint32_t *got);
+
+errcode_t ocfs2_file_write(ocfs2_cached_inode *ci, void *buf, uint32_t count,
+ uint64_t offset, uint32_t *wrote);
+
+errcode_t ocfs2_fill_heartbeat_desc(ocfs2_filesys *fs,
+ struct o2cb_region_desc *desc);
+
+errcode_t ocfs2_start_heartbeat(ocfs2_filesys *fs);
+
+errcode_t ocfs2_stop_heartbeat(ocfs2_filesys *fs);
+
+errcode_t ocfs2_lock_down_cluster(ocfs2_filesys *fs);
+
+errcode_t ocfs2_release_cluster(ocfs2_filesys *fs);
+
+errcode_t ocfs2_initialize_dlm(ocfs2_filesys *fs);
+
+errcode_t ocfs2_shutdown_dlm(ocfs2_filesys *fs);
+
+errcode_t ocfs2_super_lock(ocfs2_filesys *fs);
+
+errcode_t ocfs2_super_unlock(ocfs2_filesys *fs);
+
+errcode_t ocfs2_meta_lock(ocfs2_filesys *fs, ocfs2_cached_inode *inode,
+ enum o2dlm_lock_level level, int flags);
+
+errcode_t ocfs2_meta_unlock(ocfs2_filesys *fs, ocfs2_cached_inode *ci);
+
+void ocfs2_swap_slot_map(int16_t *map, loff_t num_slots);
+
+enum ocfs2_lock_type ocfs2_get_lock_type(char c);
+
+char *ocfs2_get_lock_type_string(enum ocfs2_lock_type type);
+
+errcode_t ocfs2_encode_lockres(enum ocfs2_lock_type type, uint64_t blkno,
+ uint32_t generation, char *lockres);
+
+errcode_t ocfs2_decode_lockres(char *lockres, int len, enum ocfs2_lock_type *type,
+ uint64_t *blkno, uint32_t *generation);
+
+/* write the superblock at the specific block. */
+errcode_t ocfs2_write_backup_super(ocfs2_filesys *fs, uint64_t blkno);
+
+/* Get the blkno according to the file system info.
+ * The unused ones, depending on the volume size, are zeroed.
+ * Return the length of the block array.
+ */
+int ocfs2_get_backup_super_offset(ocfs2_filesys *fs,
+ uint64_t *blocks, size_t len);
+
+/* This function will get the superblock pointed to by fs and copy it to
+ * the blocks. But first it will ensure all the appropriate clusters are free.
+ * If not, it will error out with ENOSPC. If free, it will set bits for all
+ * the clusters, zero the clusters and write the backup sb.
+ * In case of updating, it will override the backup blocks with the newest
+ * superblock information.
+ */
+errcode_t ocfs2_set_backup_super(ocfs2_filesys *fs,
+ uint64_t *blocks, size_t len);
+
+/* Refresh the backup superblock inoformation. */
+errcode_t ocfs2_refresh_backup_super(ocfs2_filesys *fs,
+ uint64_t *blocks, size_t len);
+
+errcode_t ocfs2_read_backup_super(ocfs2_filesys *fs, int backup, char *sbbuf);
+
+/* get the virtual offset of the last allocated cluster. */
+errcode_t ocfs2_get_last_cluster_offset(ocfs2_filesys *fs,
+ struct ocfs2_dinode *di,
+ uint32_t *v_cluster);
+/*
+ * ${foo}_to_${bar} is a floor function. blocks_to_clusters will
+ * returns the cluster that contains a block, not the number of clusters
+ * that hold a given number of blocks.
+ *
+ * ${foo}_in_${bar} is a ceiling function. clusters_in_blocks will give
+ * the number of clusters needed to hold a given number of blocks.
+ */
+
+static inline uint64_t ocfs2_clusters_to_blocks(ocfs2_filesys *fs,
+ uint32_t clusters)
+{
+ int c_to_b_bits =
+ OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits -
+ OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
+
+ return (uint64_t)clusters << c_to_b_bits;
+}
+
+static inline uint32_t ocfs2_blocks_to_clusters(ocfs2_filesys *fs,
+ uint64_t blocks)
+{
+ int b_to_c_bits =
+ OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits -
+ OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
+
+ return (uint32_t)(blocks >> b_to_c_bits);
+}
+
+static inline uint64_t ocfs2_blocks_in_bytes(ocfs2_filesys *fs, uint64_t bytes)
+{
+ uint64_t ret = bytes + fs->fs_blocksize - 1;
+
+ if (ret < bytes) /* deal with wrapping */
+ return UINT64_MAX;
+
+ return ret >> OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
+}
+
+static inline uint32_t ocfs2_clusters_in_blocks(ocfs2_filesys *fs,
+ uint64_t blocks)
+{
+ int c_to_b_bits = OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits -
+ OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
+ uint64_t ret = blocks + ((1 << c_to_b_bits) - 1);
+
+ if (ret < blocks) /* deal with wrapping */
+ ret = UINT64_MAX;
+
+ return (uint32_t)(ret >> c_to_b_bits);
+}
+
+/* given a cluster offset, calculate which block group it belongs to
+ * and return that block offset. */
+static inline uint64_t ocfs2_which_cluster_group(ocfs2_filesys *fs,
+ uint16_t cpg,
+ uint32_t cluster)
+{
+ struct ocfs2_super_block *sb = OCFS2_RAW_SB(fs->fs_super);
+ uint32_t group_no;
+
+ group_no = cluster / cpg;
+ if (!group_no)
+ return sb->s_first_cluster_group;
+ return ocfs2_clusters_to_blocks(fs, group_no * cpg);
+}
+
+static inline int ocfs2_block_out_of_range(ocfs2_filesys *fs, uint64_t block)
+{
+ return (block < OCFS2_SUPER_BLOCK_BLKNO) || (block > fs->fs_blocks);
+}
+
+struct ocfs2_cluster_group_sizes {
+ uint16_t cgs_cpg;
+ uint16_t cgs_tail_group_bits;
+ uint32_t cgs_cluster_groups;
+};
+static inline void ocfs2_calc_cluster_groups(uint64_t clusters,
+ uint64_t blocksize,
+ struct ocfs2_cluster_group_sizes *cgs)
+{
+ uint16_t max_bits = 8 * ocfs2_group_bitmap_size(blocksize);
+
+ cgs->cgs_cpg = max_bits;
+ if (max_bits > clusters)
+ cgs->cgs_cpg = clusters;
+
+ cgs->cgs_cluster_groups = (clusters + cgs->cgs_cpg - 1) /
+ cgs->cgs_cpg;
+
+ cgs->cgs_tail_group_bits = clusters % cgs->cgs_cpg;
+ if (cgs->cgs_tail_group_bits == 0)
+ cgs->cgs_tail_group_bits = cgs->cgs_cpg;
+}
+
+/*
+ * This is only valid for leaf nodes, which are the only ones that can
+ * have empty extents anyway.
+ */
+static inline int ocfs2_is_empty_extent(struct ocfs2_extent_rec *rec)
+{
+ return !rec->e_leaf_clusters;
+}
+
+/*
+ * Helper function to look at the # of clusters in an extent record.
+ */
+static inline uint32_t ocfs2_rec_clusters(uint16_t tree_depth,
+ struct ocfs2_extent_rec *rec)
+{
+ /*
+ * Cluster count in extent records is slightly different
+ * between interior nodes and leaf nodes. This is to support
+ * unwritten extents which need a flags field in leaf node
+ * records, thus shrinking the available space for a clusters
+ * field.
+ */
+ if (tree_depth)
+ return rec->e_int_clusters;
+ else
+ return rec->e_leaf_clusters;
+}
+
+static inline void ocfs2_set_rec_clusters(uint16_t tree_depth,
+ struct ocfs2_extent_rec *rec,
+ uint32_t clusters)
+{
+ if (tree_depth)
+ rec->e_int_clusters = clusters;
+ else
+ rec->e_leaf_clusters = clusters;
+}
+
+static inline int ocfs2_sparse_alloc(struct ocfs2_super_block *osb)
+{
+ if (osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC)
+ return 1;
+ return 0;
+}
+
+static inline int ocfs2_writes_unwritten_extents(struct ocfs2_super_block *osb)
+{
+ /*
+ * Support for sparse files is a pre-requisite
+ */
+ if (!ocfs2_sparse_alloc(osb))
+ return 0;
+
+ if (osb->s_feature_ro_compat & OCFS2_FEATURE_RO_COMPAT_UNWRITTEN)
+ return 1;
+ return 0;
+}
+
+/*
+ * shamelessly lifted from the kernel
+ *
+ * min()/max() macros that also do
+ * strict type-checking.. See the
+ * "unnecessary" pointer comparison.
+ */
+#define ocfs2_min(x,y) ({ \
+ const typeof(x) _x = (x); \
+ const typeof(y) _y = (y); \
+ (void) (&_x == &_y); \
+ _x < _y ? _x : _y; })
+
+#define ocfs2_max(x,y) ({ \
+ const typeof(x) _x = (x); \
+ const typeof(y) _y = (y); \
+ (void) (&_x == &_y); \
+ _x > _y ? _x : _y; })
+
+/* lifted from the kernel. include/linux/kernel.h */
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+/*
+ * DEPRECATED: Extent/block iterate functions.
+ *
+ * Do not use these for reading/writing regular files - they don't properly
+ * handle holes or inline data.
+ */
+
+/* Return flags for the extent iterator functions */
+#define OCFS2_EXTENT_CHANGED 0x01
+#define OCFS2_EXTENT_ABORT 0x02
+#define OCFS2_EXTENT_ERROR 0x04
+
+/*
+ * Extent iterate flags
+ *
+ * OCFS2_EXTENT_FLAG_APPEND indicates that the iterator function should
+ * be called on extents past the leaf next_free_rec. This is used by
+ * ocfs2_expand_dir() to add a new extent to a directory (via
+ * OCFS2_BLOCK_FLAG_APPEND and the block iteration functions).
+ *
+ * OCFS2_EXTENT_FLAG_DEPTH_TRAVERSE indicates that the iterator
+ * function for tree_depth > 0 records (ocfs2_extent_blocks, iow)
+ * should be called after all of the extents contained in the
+ * extent_block are processed. This is useful if you are going to be
+ * deallocating extents.
+ *
+ * OCFS2_EXTENT_FLAG_DATA_ONLY indicates that the iterator function
+ * should be called for data extents (depth == 0) only.
+ */
+#define OCFS2_EXTENT_FLAG_APPEND 0x01
+#define OCFS2_EXTENT_FLAG_DEPTH_TRAVERSE 0x02
+#define OCFS2_EXTENT_FLAG_DATA_ONLY 0x04
+
+
+/* Return flags for the block iterator functions */
+#define OCFS2_BLOCK_CHANGED 0x01
+#define OCFS2_BLOCK_ABORT 0x02
+#define OCFS2_BLOCK_ERROR 0x04
+
+/*
+ * Block iterate flags
+ *
+ * In OCFS2, block iteration runs through the blocks contained in an
+ * inode's data extents. As such, "DATA_ONLY" and "DEPTH_TRAVERSE"
+ * can't really apply.
+ *
+ * OCFS2_BLOCK_FLAG_APPEND is as OCFS2_EXTENT_FLAG_APPEND, except on a
+ * blocksize basis. This may mean that the underlying extent already
+ * contains the space for a new block, and i_size is updated
+ * accordingly.
+ */
+#define OCFS2_BLOCK_FLAG_APPEND 0x01
+
+errcode_t ocfs2_extent_iterate(ocfs2_filesys *fs,
+ uint64_t blkno,
+ int flags,
+ char *block_buf,
+ int (*func)(ocfs2_filesys *fs,
+ struct ocfs2_extent_rec *rec,
+ int tree_depth,
+ uint32_t ccount,
+ uint64_t ref_blkno,
+ int ref_recno,
+ void *priv_data),
+ void *priv_data);
+errcode_t ocfs2_extent_iterate_inode(ocfs2_filesys *fs,
+ struct ocfs2_dinode *inode,
+ int flags,
+ char *block_buf,
+ int (*func)(ocfs2_filesys *fs,
+ struct ocfs2_extent_rec *rec,
+ int tree_depth,
+ uint32_t ccount,
+ uint64_t ref_blkno,
+ int ref_recno,
+ void *priv_data),
+ void *priv_data);
+errcode_t ocfs2_block_iterate(ocfs2_filesys *fs,
+ uint64_t blkno,
+ int flags,
+ int (*func)(ocfs2_filesys *fs,
+ uint64_t blkno,
+ uint64_t bcount,
+ uint16_t ext_flags,
+ void *priv_data),
+ void *priv_data);
+errcode_t ocfs2_block_iterate_inode(ocfs2_filesys *fs,
+ struct ocfs2_dinode *inode,
+ int flags,
+ int (*func)(ocfs2_filesys *fs,
+ uint64_t blkno,
+ uint64_t bcount,
+ uint16_t ext_flags,
+ void *priv_data),
+ void *priv_data);
+
+#endif /* _FILESYS_H */
diff --git a/libo2cb/Makefile b/libo2cb/Makefile
index d666bb5..09edbdd 100644
--- a/libo2cb/Makefile
+++ b/libo2cb/Makefile
@@ -63,6 +63,6 @@ DIST_FILES = $(CFILES) $(HFILES) o2cb_err.et
CLEAN_RULES = clean-err
clean-err:
- rm -f o2cb_err.c o2cb_err.h include/o2cb_err.h
+ rm -f o2cb_err.c o2cb_err.h
include $(TOPDIR)/Postamble.make
diff --git a/libocfs2/Makefile b/libocfs2/Makefile
index eff1565..52461fb 100644
--- a/libocfs2/Makefile
+++ b/libocfs2/Makefile
@@ -11,7 +11,7 @@ else
OPTS += -O2
endif
-INCLUDES = -I$(TOPDIR)/include -Iinclude
+INCLUDES = -I$(TOPDIR)/include
LIBRARIES = libocfs2.a
@@ -22,7 +22,6 @@ LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
CFLAGS = $(OPTS) $(WARNINGS) -fPIC
-CPPFLAGS += -DOCFS2_FLAT_INCLUDES
ifneq ($(OCFS2_DEBUG_EXE),)
DEBUG_EXE_FILES = $(shell awk '/DEBUG_EXE/{if (k[FILENAME] == 0) {print FILENAME; k[FILENAME] = 1;}}' $(CFILES))
@@ -84,32 +83,20 @@ CFILES = \
backup_super.c \
feature_string.c
-HFILES = \
- include/bitmap.h \
- include/bitops.h \
- include/byteorder.h \
- include/dir_iterate.h \
- include/dir_util.h \
- include/extent_map.h \
- include/kernel-rbtree.h \
- include/jbd.h \
- include/ocfs2.h \
- include/feature_string.h
+HFILES = \
+ bitmap.h \
+ dir_iterate.h \
+ dir_util.h \
+ dlm.h \
+ extent_map.h
-HFILES_GEN = \
- include/ocfs2_err.h
-
-HEADERS_SUBDIR = ocfs2
-HEADERS = $(HFILES) $(HFILES_GEN)
+HFILES_GEN = ocfs2_err.h
OBJS = $(subst .c,.o,$(CFILES)) \
ocfs2_err.o
$(OBJS): $(HFILES_GEN)
-include/ocfs2_err.h: ocfs2_err.h
- cp $< $@
-
ocfs2_err.c ocfs2_err.h: ocfs2_err.et
compile_et ocfs2_err.et
@@ -120,14 +107,9 @@ libocfs2.a: $(OBJS)
DIST_FILES = $(CFILES) $(HFILES) ocfs2_err.et
-DIST_RULES = dist-subdircreate
-
-dist-subdircreate:
- $(TOPDIR)/mkinstalldirs $(DIST_DIR)/include
-
CLEAN_RULES = clean-err
clean-err:
- rm -f ocfs2_err.c ocfs2_err.h include/ocfs2_err.h
+ rm -f ocfs2_err.c ocfs2_err.h
include $(TOPDIR)/Postamble.make
diff --git a/libocfs2/alloc.c b/libocfs2/alloc.c
index 5207239..3e54629 100644
--- a/libocfs2/alloc.c
+++ b/libocfs2/alloc.c
@@ -29,7 +29,7 @@
#include <string.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
static errcode_t ocfs2_chain_alloc_with_io(ocfs2_filesys *fs,
ocfs2_cached_inode *cinode,
diff --git a/libocfs2/backup_super.c b/libocfs2/backup_super.c
index 6332d1f..c5bbdb2 100644
--- a/libocfs2/backup_super.c
+++ b/libocfs2/backup_super.c
@@ -24,7 +24,7 @@
*/
#include <errno.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
/* In case we don't have fs_blocksize, we will return
* byte offsets and let the caller calculate them by itself.
diff --git a/libocfs2/bitmap.c b/libocfs2/bitmap.c
index b60f20d..a5fe511 100644
--- a/libocfs2/bitmap.c
+++ b/libocfs2/bitmap.c
@@ -29,11 +29,10 @@
#include <limits.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
+#include "ocfs2/bitops.h"
-#include "bitops.h"
#include "bitmap.h"
-#include "kernel-rbtree.h"
/* The public API */
diff --git a/libocfs2/bitmap.h b/libocfs2/bitmap.h
new file mode 100644
index 0000000..cd1379a
--- /dev/null
+++ b/libocfs2/bitmap.h
@@ -0,0 +1,139 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * bitmap.h
+ *
+ * Structures for allocation bitmaps for the OCFS2 userspace library.
+ *
+ * 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, 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.
+ *
+ * Authors: Joel Becker
+ */
+
+#ifndef _BITMAP_H
+#define _BITMAP_H
+
+#include "ocfs2/kernel-rbtree.h"
+
+
+struct ocfs2_bitmap_region {
+ struct rb_node br_node;
+ uint64_t br_start_bit; /* Bit offset. */
+ int br_total_bits; /* set_bit() and friends can't
+ handle bitmaps larger than
+ int offsets */
+ size_t br_bytes;
+ int br_set_bits;
+ uint8_t *br_bitmap;
+ void *br_private;
+};
+
+struct ocfs2_bitmap_operations {
+ errcode_t (*set_bit)(ocfs2_bitmap *bitmap, uint64_t bit,
+ int *oldval);
+ errcode_t (*clear_bit)(ocfs2_bitmap *bitmap, uint64_t bit,
+ int *oldval);
+ errcode_t (*test_bit)(ocfs2_bitmap *bitmap, uint64_t bit,
+ int *val);
+ errcode_t (*find_next_set)(ocfs2_bitmap *bitmap,
+ uint64_t start,
+ uint64_t *found);
+ errcode_t (*find_next_clear)(ocfs2_bitmap *bitmap,
+ uint64_t start,
+ uint64_t *found);
+ int (*merge_region)(ocfs2_bitmap *bitmap,
+ struct ocfs2_bitmap_region *prev,
+ struct ocfs2_bitmap_region *next);
+ errcode_t (*read_bitmap)(ocfs2_bitmap *bitmap);
+ errcode_t (*write_bitmap)(ocfs2_bitmap *bitmap);
+ void (*destroy_notify)(ocfs2_bitmap *bitmap);
+ void (*bit_change_notify)(ocfs2_bitmap *bitmap,
+ struct ocfs2_bitmap_region *br,
+ uint64_t bitno,
+ int new_val);
+ errcode_t (*alloc_range)(ocfs2_bitmap *bitmap, uint64_t min_len,
+ uint64_t len, uint64_t *first_bit,
+ uint64_t *bits_found);
+ errcode_t (*clear_range)(ocfs2_bitmap *bitmap, uint64_t len,
+ uint64_t first_bit);
+};
+
+struct _ocfs2_bitmap {
+ ocfs2_filesys *b_fs;
+ uint64_t b_set_bits;
+ uint64_t b_total_bits;
+ char *b_description;
+ struct ocfs2_bitmap_operations *b_ops;
+ struct rb_root b_regions;
+ void *b_private;
+};
+
+
+errcode_t ocfs2_bitmap_new(ocfs2_filesys *fs,
+ uint64_t total_bits,
+ const char *description,
+ struct ocfs2_bitmap_operations *ops,
+ void *private_data,
+ ocfs2_bitmap **ret_bitmap);
+errcode_t ocfs2_bitmap_alloc_region(ocfs2_bitmap *bitmap,
+ uint64_t start_bit,
+ int total_bits,
+ struct ocfs2_bitmap_region **ret_br);
+void ocfs2_bitmap_free_region(struct ocfs2_bitmap_region *br);
+errcode_t ocfs2_bitmap_realloc_region(ocfs2_bitmap *bitmap,
+ struct ocfs2_bitmap_region *br,
+ int total_bits);
+errcode_t ocfs2_bitmap_insert_region(ocfs2_bitmap *bitmap,
+ struct ocfs2_bitmap_region *br);
+typedef errcode_t (*ocfs2_bitmap_foreach_func)(struct ocfs2_bitmap_region *br,
+ void *private_data);
+errcode_t ocfs2_bitmap_foreach_region(ocfs2_bitmap *bitmap,
+ ocfs2_bitmap_foreach_func func,
+ void *private_data);
+errcode_t ocfs2_bitmap_set_generic(ocfs2_bitmap *bitmap,
+ uint64_t bitno, int *oldval);
+errcode_t ocfs2_bitmap_clear_generic(ocfs2_bitmap *bitmap,
+ uint64_t bitno, int *oldval);
+errcode_t ocfs2_bitmap_test_generic(ocfs2_bitmap *bitmap,
+ uint64_t bitno, int *val);
+errcode_t ocfs2_bitmap_find_next_set_generic(ocfs2_bitmap *bitmap,
+ uint64_t start,
+ uint64_t *found);
+errcode_t ocfs2_bitmap_find_next_clear_generic(ocfs2_bitmap *bitmap,
+ uint64_t start,
+ uint64_t *found);
+errcode_t ocfs2_bitmap_alloc_range_generic(ocfs2_bitmap *bitmap,
+ uint64_t min_len,
+ uint64_t len,
+ uint64_t *first_bit,
+ uint64_t *bits_found);
+errcode_t ocfs2_bitmap_clear_range_generic(ocfs2_bitmap *bitmap,
+ uint64_t len,
+ uint64_t first_bit);
+errcode_t ocfs2_bitmap_set_holes(ocfs2_bitmap *bitmap,
+ uint64_t bitno, int *oldval);
+errcode_t ocfs2_bitmap_clear_holes(ocfs2_bitmap *bitmap,
+ uint64_t bitno, int *oldval);
+errcode_t ocfs2_bitmap_test_holes(ocfs2_bitmap *bitmap,
+ uint64_t bitno, int *val);
+errcode_t ocfs2_bitmap_find_next_set_holes(ocfs2_bitmap *bitmap,
+ uint64_t start,
+ uint64_t *found);
+errcode_t ocfs2_bitmap_find_next_clear_holes(ocfs2_bitmap *bitmap,
+ uint64_t start,
+ uint64_t *found);
+#endif /* _BITMAP_H */
diff --git a/libocfs2/bitops.c b/libocfs2/bitops.c
index f0c3d65..df9cb9a 100644
--- a/libocfs2/bitops.c
+++ b/libocfs2/bitops.c
@@ -30,7 +30,7 @@
#include <strings.h>
#include <sys/types.h>
-#include "bitops.h"
+#include "ocfs2/bitops.h"
/*
* For the benefit of those who are trying to port Linux to another
diff --git a/libocfs2/cached_inode.c b/libocfs2/cached_inode.c
index 11eb5f9..eedfd96 100644
--- a/libocfs2/cached_inode.c
+++ b/libocfs2/cached_inode.c
@@ -27,7 +27,7 @@
#include <string.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
errcode_t ocfs2_read_cached_inode(ocfs2_filesys *fs, uint64_t blkno,
ocfs2_cached_inode **ret_ci)
diff --git a/libocfs2/chain.c b/libocfs2/chain.c
index cf578f0..c860015 100644
--- a/libocfs2/chain.c
+++ b/libocfs2/chain.c
@@ -27,7 +27,9 @@
#include <string.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
+
+#include "ocfs2/byteorder.h"
void ocfs2_swap_group_desc(struct ocfs2_group_desc *gd)
{
diff --git a/libocfs2/chainalloc.c b/libocfs2/chainalloc.c
index 3b967b4..39170dd 100644
--- a/libocfs2/chainalloc.c
+++ b/libocfs2/chainalloc.c
@@ -29,11 +29,10 @@
#include <string.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "bitmap.h"
-#include "bitops.h"
-#include "kernel-rbtree.h"
+#include "ocfs2/bitops.h"
struct chainalloc_bitmap_private {
diff --git a/libocfs2/checkhb.c b/libocfs2/checkhb.c
index 688d905..f4ff19e 100644
--- a/libocfs2/checkhb.c
+++ b/libocfs2/checkhb.c
@@ -37,7 +37,8 @@
#include <signal.h>
-#include "ocfs2.h"
+#include "ocfs2/byteorder.h"
+#include "ocfs2/ocfs2.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/closefs.c b/libocfs2/closefs.c
index e5a713a..54411da 100644
--- a/libocfs2/closefs.c
+++ b/libocfs2/closefs.c
@@ -28,7 +28,7 @@
#define _XOPEN_SOURCE 600 /* Triggers XOPEN2K in features.h */
#define _LARGEFILE64_SOURCE
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
errcode_t ocfs2_flush(ocfs2_filesys *fs)
diff --git a/libocfs2/dir_iterate.c b/libocfs2/dir_iterate.c
index a156ed0..eda85fa 100644
--- a/libocfs2/dir_iterate.c
+++ b/libocfs2/dir_iterate.c
@@ -30,7 +30,7 @@
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "dir_iterate.h"
#include "dir_util.h"
diff --git a/libocfs2/dir_iterate.h b/libocfs2/dir_iterate.h
new file mode 100644
index 0000000..9ec11a3
--- /dev/null
+++ b/libocfs2/dir_iterate.h
@@ -0,0 +1,51 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * dir_iterate.h
+ *
+ * Structures for dir iteration for the OCFS2 userspace library.
+ *
+ * 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, 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.
+ *
+ * Authors: Joel Becker
+ */
+
+#ifndef _DIR_ITERATE_H
+#define _DIR_ITERATE_H
+
+struct dir_context {
+ uint64_t dir;
+ int flags;
+ char *buf;
+ int (*func)(uint64_t dir,
+ int entry,
+ struct ocfs2_dir_entry *dirent,
+ int offset,
+ int blocksize,
+ char *buf,
+ void *priv_data);
+ void *priv_data;
+ errcode_t errcode;
+};
+
+extern int ocfs2_process_dir_block(ocfs2_filesys *fs,
+ uint64_t blocknr,
+ uint64_t blockcnt,
+ uint16_t ext_flags,
+ void *priv_data);
+
+#endif /* _DIR_ITERATE_H */
diff --git a/libocfs2/dir_scan.c b/libocfs2/dir_scan.c
index bb31101..ea70671 100644
--- a/libocfs2/dir_scan.c
+++ b/libocfs2/dir_scan.c
@@ -28,7 +28,7 @@
#include <string.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "dir_util.h"
diff --git a/libocfs2/dir_util.h b/libocfs2/dir_util.h
new file mode 100644
index 0000000..eac668b
--- /dev/null
+++ b/libocfs2/dir_util.h
@@ -0,0 +1,45 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * dir_util.h
+ *
+ * Structures for dir iteration for the OCFS2 userspace library.
+ *
+ * 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, 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.
+ *
+ * Authors: Joel Becker
+ */
+
+#ifndef _DIR_UTIL_H
+#define _DIR_UTIL_H
+
+static inline int is_dots(const char *name, unsigned int len)
+{
+ if (len == 0)
+ return 0;
+
+ if (name[0] == '.') {
+ if (len == 1)
+ return 1;
+ if (len == 2 && name[1] == '.')
+ return 1;
+ }
+
+ return 0;
+}
+
+#endif /* _DIR_UTIL_H */
diff --git a/libocfs2/dirblock.c b/libocfs2/dirblock.c
index f7736d3..d8135fc 100644
--- a/libocfs2/dirblock.c
+++ b/libocfs2/dirblock.c
@@ -30,7 +30,8 @@
#include <string.h>
-#include "ocfs2.h"
+#include "ocfs2/byteorder.h"
+#include "ocfs2/ocfs2.h"
static void ocfs2_swap_dir_entry(struct ocfs2_dir_entry *dirent)
{
diff --git a/libocfs2/dlm.c b/libocfs2/dlm.c
index 710d406..7bb215c 100644
--- a/libocfs2/dlm.c
+++ b/libocfs2/dlm.c
@@ -26,7 +26,7 @@
#define _XOPEN_SOURCE 600 /* Triggers magic in features.h */
#define _LARGEFILE64_SOURCE
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#define DEFAULT_DLMFS_PATH "/dlm/"
diff --git a/libocfs2/dlm.h b/libocfs2/dlm.h
new file mode 100644
index 0000000..2db0e8a
--- /dev/null
+++ b/libocfs2/dlm.h
@@ -0,0 +1,46 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * dlm.h
+ *
+ * Interface the OCFS2 userspace library to the userspace DLM library
+ *
+ * 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, 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.
+ *
+ * Authors: Mark Fasheh
+ */
+
+#ifndef _DLM_H
+#define _DLM_H
+
+errcode_t ocfs2_lock_down_cluster(ocfs2_filesys *fs);
+errcode_t ocfs2_release_cluster(ocfs2_filesys *fs);
+
+errcode_t ocfs2_initialize_dlm(ocfs2_filesys *fs);
+errcode_t ocfs2_shutdown_dlm(ocfs2_filesys *fs);
+
+errcode_t ocfs2_super_lock(ocfs2_filesys *fs);
+errcode_t ocfs2_super_unlock(ocfs2_filesys *fs);
+
+errcode_t ocfs2_meta_lock(ocfs2_filesys *fs,
+ ocfs2_cached_inode *inode,
+ enum o2dlm_lock_level level,
+ int flags);
+errcode_t ocfs2_meta_unlock(ocfs2_filesys *fs,
+ ocfs2_cached_inode *ci);
+
+#endif /* _DLM_H */
diff --git a/libocfs2/expanddir.c b/libocfs2/expanddir.c
index 7ddab61..f6a5385 100644
--- a/libocfs2/expanddir.c
+++ b/libocfs2/expanddir.c
@@ -35,7 +35,7 @@
#include <unistd.h>
#endif
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
/*
* ocfs2_expand_dir()
diff --git a/libocfs2/extend_file.c b/libocfs2/extend_file.c
index 422fb42..0b7310f 100644
--- a/libocfs2/extend_file.c
+++ b/libocfs2/extend_file.c
@@ -33,7 +33,7 @@
#include <inttypes.h>
#include <errno.h>
#include <assert.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
/*
* Structures which describe a path through a btree, and functions to
diff --git a/libocfs2/extent_map.c b/libocfs2/extent_map.c
index a97902b..eb8595a 100644
--- a/libocfs2/extent_map.c
+++ b/libocfs2/extent_map.c
@@ -29,7 +29,7 @@
#include <inttypes.h>
#include <assert.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "extent_map.h"
diff --git a/libocfs2/extent_map.h b/libocfs2/extent_map.h
new file mode 100644
index 0000000..99f74de
--- /dev/null
+++ b/libocfs2/extent_map.h
@@ -0,0 +1,45 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * extent_map.h
+ *
+ * Internal extent map structures for the OCFS2 userspace library.
+ *
+ * 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, 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.
+ *
+ * Authors: Joel Becker
+ */
+
+#ifndef _EXTENT_MAP_H
+#define _EXTENT_MAP_H
+
+#include "ocfs2/kernel-rbtree.h"
+
+typedef struct _ocfs2_extent_map_entry ocfs2_extent_map_entry;
+
+struct _ocfs2_extent_map {
+ struct rb_root em_extents;
+ uint32_t em_clusters;
+};
+
+struct _ocfs2_extent_map_entry {
+ struct rb_node e_node;
+ int e_tree_depth;
+ struct ocfs2_extent_rec e_rec;
+};
+
+#endif /* _EXTENT_MAP_H */
diff --git a/libocfs2/extents.c b/libocfs2/extents.c
index 50f3b6e..d3f998a 100644
--- a/libocfs2/extents.c
+++ b/libocfs2/extents.c
@@ -32,7 +32,8 @@
#include <string.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/byteorder.h"
+#include "ocfs2/ocfs2.h"
static void ocfs2_swap_extent_list_primary(struct ocfs2_extent_list *el)
{
diff --git a/libocfs2/feature_string.c b/libocfs2/feature_string.c
index 40720b8..831edc1 100644
--- a/libocfs2/feature_string.c
+++ b/libocfs2/feature_string.c
@@ -22,7 +22,7 @@
* Boston, MA 021110-1307, USA.
*
*/
-#include <feature_string.h>
+#include "ocfs2/feature_string.h"
struct feature_level_translation {
const char *fl_str;
diff --git a/libocfs2/fileio.c b/libocfs2/fileio.c
index f35c8b6..3b8aa76 100644
--- a/libocfs2/fileio.c
+++ b/libocfs2/fileio.c
@@ -32,7 +32,7 @@
#include <limits.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
struct read_whole_context {
char *buf;
diff --git a/libocfs2/freefs.c b/libocfs2/freefs.c
index 6067b52..ab8a8ea 100644
--- a/libocfs2/freefs.c
+++ b/libocfs2/freefs.c
@@ -30,7 +30,7 @@
#include <stdlib.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
void ocfs2_freefs(ocfs2_filesys *fs)
diff --git a/libocfs2/getsectsize.c b/libocfs2/getsectsize.c
index 7bd1e2f..937baa6 100644
--- a/libocfs2/getsectsize.c
+++ b/libocfs2/getsectsize.c
@@ -37,7 +37,7 @@
#define BLKSSZGET _IO(0x12,104)/* get block device sector size */
#endif
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
/*
* Returns the number of blocks in a partition
diff --git a/libocfs2/getsize.c b/libocfs2/getsize.c
index 8ae8626..4176e4b 100644
--- a/libocfs2/getsize.c
+++ b/libocfs2/getsize.c
@@ -67,7 +67,7 @@
#define BLKGETSIZE DKIOCGETBLOCKCOUNT32
#endif /* APPLE_DARWIN */
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#if defined(__CYGWIN__) || defined (WIN32)
#include "windows.h"
diff --git a/libocfs2/heartbeat.c b/libocfs2/heartbeat.c
index 885712f..6adb6c6 100644
--- a/libocfs2/heartbeat.c
+++ b/libocfs2/heartbeat.c
@@ -28,7 +28,8 @@
#include <string.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/byteorder.h"
+#include "ocfs2/ocfs2.h"
void ocfs2_swap_disk_heartbeat_block(struct o2hb_disk_heartbeat_block *hb)
{
diff --git a/libocfs2/include/.gitignore b/libocfs2/include/.gitignore
deleted file mode 100644
index fb4e857..0000000
--- a/libocfs2/include/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-cscope*
-stamp-md5
-.*.sw?
-.*.cmd
-ocfs2_err.h
diff --git a/libocfs2/include/bitmap.h b/libocfs2/include/bitmap.h
deleted file mode 100644
index e144e74..0000000
--- a/libocfs2/include/bitmap.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * bitmap.h
- *
- * Structures for allocation bitmaps for the OCFS2 userspace library.
- *
- * 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, 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.
- *
- * Authors: Joel Becker
- */
-
-#ifndef _BITMAP_H
-#define _BITMAP_H
-
-#include "kernel-rbtree.h"
-
-
-struct ocfs2_bitmap_region {
- struct rb_node br_node;
- uint64_t br_start_bit; /* Bit offset. */
- int br_total_bits; /* set_bit() and friends can't
- handle bitmaps larger than
- int offsets */
- size_t br_bytes;
- int br_set_bits;
- uint8_t *br_bitmap;
- void *br_private;
-};
-
-struct ocfs2_bitmap_operations {
- errcode_t (*set_bit)(ocfs2_bitmap *bitmap, uint64_t bit,
- int *oldval);
- errcode_t (*clear_bit)(ocfs2_bitmap *bitmap, uint64_t bit,
- int *oldval);
- errcode_t (*test_bit)(ocfs2_bitmap *bitmap, uint64_t bit,
- int *val);
- errcode_t (*find_next_set)(ocfs2_bitmap *bitmap,
- uint64_t start,
- uint64_t *found);
- errcode_t (*find_next_clear)(ocfs2_bitmap *bitmap,
- uint64_t start,
- uint64_t *found);
- int (*merge_region)(ocfs2_bitmap *bitmap,
- struct ocfs2_bitmap_region *prev,
- struct ocfs2_bitmap_region *next);
- errcode_t (*read_bitmap)(ocfs2_bitmap *bitmap);
- errcode_t (*write_bitmap)(ocfs2_bitmap *bitmap);
- void (*destroy_notify)(ocfs2_bitmap *bitmap);
- void (*bit_change_notify)(ocfs2_bitmap *bitmap,
- struct ocfs2_bitmap_region *br,
- uint64_t bitno,
- int new_val);
- errcode_t (*alloc_range)(ocfs2_bitmap *bitmap, uint64_t min_len,
- uint64_t len, uint64_t *first_bit,
- uint64_t *bits_found);
- errcode_t (*clear_range)(ocfs2_bitmap *bitmap, uint64_t len,
- uint64_t first_bit);
-};
-
-struct _ocfs2_bitmap {
- ocfs2_filesys *b_fs;
- uint64_t b_set_bits;
- uint64_t b_total_bits;
- char *b_description;
- struct ocfs2_bitmap_operations *b_ops;
- struct rb_root b_regions;
- void *b_private;
-};
-
-
-errcode_t ocfs2_bitmap_new(ocfs2_filesys *fs,
- uint64_t total_bits,
- const char *description,
- struct ocfs2_bitmap_operations *ops,
- void *private_data,
- ocfs2_bitmap **ret_bitmap);
-errcode_t ocfs2_bitmap_alloc_region(ocfs2_bitmap *bitmap,
- uint64_t start_bit,
- int total_bits,
- struct ocfs2_bitmap_region **ret_br);
-void ocfs2_bitmap_free_region(struct ocfs2_bitmap_region *br);
-errcode_t ocfs2_bitmap_realloc_region(ocfs2_bitmap *bitmap,
- struct ocfs2_bitmap_region *br,
- int total_bits);
-errcode_t ocfs2_bitmap_insert_region(ocfs2_bitmap *bitmap,
- struct ocfs2_bitmap_region *br);
-typedef errcode_t (*ocfs2_bitmap_foreach_func)(struct ocfs2_bitmap_region *br,
- void *private_data);
-errcode_t ocfs2_bitmap_foreach_region(ocfs2_bitmap *bitmap,
- ocfs2_bitmap_foreach_func func,
- void *private_data);
-errcode_t ocfs2_bitmap_set_generic(ocfs2_bitmap *bitmap,
- uint64_t bitno, int *oldval);
-errcode_t ocfs2_bitmap_clear_generic(ocfs2_bitmap *bitmap,
- uint64_t bitno, int *oldval);
-errcode_t ocfs2_bitmap_test_generic(ocfs2_bitmap *bitmap,
- uint64_t bitno, int *val);
-errcode_t ocfs2_bitmap_find_next_set_generic(ocfs2_bitmap *bitmap,
- uint64_t start,
- uint64_t *found);
-errcode_t ocfs2_bitmap_find_next_clear_generic(ocfs2_bitmap *bitmap,
- uint64_t start,
- uint64_t *found);
-errcode_t ocfs2_bitmap_alloc_range_generic(ocfs2_bitmap *bitmap,
- uint64_t min_len,
- uint64_t len,
- uint64_t *first_bit,
- uint64_t *bits_found);
-errcode_t ocfs2_bitmap_clear_range_generic(ocfs2_bitmap *bitmap,
- uint64_t len,
- uint64_t first_bit);
-errcode_t ocfs2_bitmap_set_holes(ocfs2_bitmap *bitmap,
- uint64_t bitno, int *oldval);
-errcode_t ocfs2_bitmap_clear_holes(ocfs2_bitmap *bitmap,
- uint64_t bitno, int *oldval);
-errcode_t ocfs2_bitmap_test_holes(ocfs2_bitmap *bitmap,
- uint64_t bitno, int *val);
-errcode_t ocfs2_bitmap_find_next_set_holes(ocfs2_bitmap *bitmap,
- uint64_t start,
- uint64_t *found);
-errcode_t ocfs2_bitmap_find_next_clear_holes(ocfs2_bitmap *bitmap,
- uint64_t start,
- uint64_t *found);
-#endif /* _BITMAP_H */
diff --git a/libocfs2/include/bitops.h b/libocfs2/include/bitops.h
deleted file mode 100644
index a12fe6b..0000000
--- a/libocfs2/include/bitops.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * bitops.h
- *
- * Bitmap frobbing routines for the OCFS2 userspace library.
- *
- * 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, 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.
- *
- * Authors: Joel Becker
- *
- * This code is a port of e2fsprogs/lib/ext2fs/bitops.h
- * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
- */
-
-#ifndef _BITOPS_H
-#define _BITOPS_H
-
-extern int ocfs2_set_bit(int nr,void * addr);
-extern int ocfs2_clear_bit(int nr, void * addr);
-extern int ocfs2_test_bit(int nr, const void * addr);
-
-extern int ocfs2_find_first_bit_set(void *addr, int size);
-extern int ocfs2_find_first_bit_clear(void *addr, int size);
-extern int ocfs2_find_next_bit_set(void *addr, int size, int offset);
-extern int ocfs2_find_next_bit_clear(void *addr, int size, int offset);
-
-#endif
diff --git a/libocfs2/include/byteorder.h b/libocfs2/include/byteorder.h
deleted file mode 100644
index 53d4140..0000000
--- a/libocfs2/include/byteorder.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * byteorder.h
- *
- * Byteswapping!
- *
- * 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, 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.
- *
- * Authors: Joel Becker
- */
-
-#ifndef _BYTEORDER_H
-#define _BYTEORDER_H
-
-
-#include <endian.h>
-#include <byteswap.h>
-#include <stdint.h>
-
-/*
- * All OCFS2 on-disk values are in little endian, except for jbd's journal
- * fields which it takes care of itself.
- */
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define cpu_is_little_endian 1
-# ifndef cpu_to_le16
-# define cpu_to_le16(x) ((uint16_t)(x))
-# endif
-# ifndef le16_to_cpu
-# define le16_to_cpu(x) ((uint16_t)(x))
-# endif
-# ifndef cpu_to_le32
-# define cpu_to_le32(x) ((uint32_t)(x))
-# endif
-# ifndef le32_to_cpu
-# define le32_to_cpu(x) ((uint32_t)(x))
-# endif
-# ifndef cpu_to_le64
-# define cpu_to_le64(x) ((uint64_t)(x))
-# endif
-# ifndef le64_to_cpu
-# define le64_to_cpu(x) ((uint64_t)(x))
-# endif
-# ifndef cpu_to_be16
-# define cpu_to_be16(x) ((uint16_t)bswap_16(x))
-# endif
-# ifndef be16_to_cpu
-# define be16_to_cpu(x) ((uint16_t)bswap_16(x))
-# endif
-# ifndef cpu_to_be32
-# define cpu_to_be32(x) ((uint32_t)bswap_32(x))
-# endif
-# ifndef be32_to_cpu
-# define be32_to_cpu(x) ((uint32_t)bswap_32(x))
-# endif
-# ifndef cpu_to_be64
-# define cpu_to_be64(x) ((uint64_t)bswap_64(x))
-# endif
-# ifndef be64_to_cpu
-# define be64_to_cpu(x) ((uint64_t)bswap_64(x))
-# endif
-#elif __BYTE_ORDER == __BIG_ENDIAN
-#define cpu_is_little_endian 0
-# ifndef cpu_to_le16
-# define cpu_to_le16(x) ((uint16_t)bswap_16(x))
-# endif
-# ifndef le16_to_cpu
-# define le16_to_cpu(x) ((uint16_t)bswap_16(x))
-# endif
-# ifndef cpu_to_le32
-# define cpu_to_le32(x) ((uint32_t)bswap_32(x))
-# endif
-# ifndef le32_to_cpu
-# define le32_to_cpu(x) ((uint32_t)bswap_32(x))
-# endif
-# ifndef cpu_to_le64
-# define cpu_to_le64(x) ((uint64_t)bswap_64(x))
-# endif
-# ifndef le64_to_cpu
-# define le64_to_cpu(x) ((uint64_t)bswap_64(x))
-# endif
-# ifndef cpu_to_be16
-# define cpu_to_be16(x) ((uint16_t)(x))
-# endif
-# ifndef be16_to_cpu
-# define be16_to_cpu(x) ((uint16_t)(x))
-# endif
-# ifndef cpu_to_be32
-# define cpu_to_be32(x) ((uint32_t)(x))
-# endif
-# ifndef be32_to_cpu
-# define be32_to_cpu(x) ((uint32_t)(x))
-# endif
-# ifndef cpu_to_be64
-# define cpu_to_be64(x) ((uint64_t)(x))
-# endif
-# ifndef be64_to_cpu
-# define be64_to_cpu(x) ((uint64_t)(x))
-# endif
-#else
-# error Invalid byte order __BYTE_ORDER
-#endif /* __BYTE_ORDER */
-
-#define cpu_is_big_endian (!cpu_is_little_endian)
-
-#endif /* _BYTEORDER_H */
diff --git a/libocfs2/include/dir_iterate.h b/libocfs2/include/dir_iterate.h
deleted file mode 100644
index 9ec11a3..0000000
--- a/libocfs2/include/dir_iterate.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * dir_iterate.h
- *
- * Structures for dir iteration for the OCFS2 userspace library.
- *
- * 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, 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.
- *
- * Authors: Joel Becker
- */
-
-#ifndef _DIR_ITERATE_H
-#define _DIR_ITERATE_H
-
-struct dir_context {
- uint64_t dir;
- int flags;
- char *buf;
- int (*func)(uint64_t dir,
- int entry,
- struct ocfs2_dir_entry *dirent,
- int offset,
- int blocksize,
- char *buf,
- void *priv_data);
- void *priv_data;
- errcode_t errcode;
-};
-
-extern int ocfs2_process_dir_block(ocfs2_filesys *fs,
- uint64_t blocknr,
- uint64_t blockcnt,
- uint16_t ext_flags,
- void *priv_data);
-
-#endif /* _DIR_ITERATE_H */
diff --git a/libocfs2/include/dir_util.h b/libocfs2/include/dir_util.h
deleted file mode 100644
index eac668b..0000000
--- a/libocfs2/include/dir_util.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * dir_util.h
- *
- * Structures for dir iteration for the OCFS2 userspace library.
- *
- * 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, 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.
- *
- * Authors: Joel Becker
- */
-
-#ifndef _DIR_UTIL_H
-#define _DIR_UTIL_H
-
-static inline int is_dots(const char *name, unsigned int len)
-{
- if (len == 0)
- return 0;
-
- if (name[0] == '.') {
- if (len == 1)
- return 1;
- if (len == 2 && name[1] == '.')
- return 1;
- }
-
- return 0;
-}
-
-#endif /* _DIR_UTIL_H */
diff --git a/libocfs2/include/dlm.h b/libocfs2/include/dlm.h
deleted file mode 100644
index 2db0e8a..0000000
--- a/libocfs2/include/dlm.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * dlm.h
- *
- * Interface the OCFS2 userspace library to the userspace DLM library
- *
- * 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, 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.
- *
- * Authors: Mark Fasheh
- */
-
-#ifndef _DLM_H
-#define _DLM_H
-
-errcode_t ocfs2_lock_down_cluster(ocfs2_filesys *fs);
-errcode_t ocfs2_release_cluster(ocfs2_filesys *fs);
-
-errcode_t ocfs2_initialize_dlm(ocfs2_filesys *fs);
-errcode_t ocfs2_shutdown_dlm(ocfs2_filesys *fs);
-
-errcode_t ocfs2_super_lock(ocfs2_filesys *fs);
-errcode_t ocfs2_super_unlock(ocfs2_filesys *fs);
-
-errcode_t ocfs2_meta_lock(ocfs2_filesys *fs,
- ocfs2_cached_inode *inode,
- enum o2dlm_lock_level level,
- int flags);
-errcode_t ocfs2_meta_unlock(ocfs2_filesys *fs,
- ocfs2_cached_inode *ci);
-
-#endif /* _DLM_H */
diff --git a/libocfs2/include/extent_map.h b/libocfs2/include/extent_map.h
deleted file mode 100644
index 4c61c0d..0000000
--- a/libocfs2/include/extent_map.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * extent_map.h
- *
- * Internal extent map structures for the OCFS2 userspace library.
- *
- * 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, 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.
- *
- * Authors: Joel Becker
- */
-
-#ifndef _EXTENT_MAP_H
-#define _EXTENT_MAP_H
-
-#include "kernel-rbtree.h"
-
-typedef struct _ocfs2_extent_map_entry ocfs2_extent_map_entry;
-
-struct _ocfs2_extent_map {
- struct rb_root em_extents;
- uint32_t em_clusters;
-};
-
-struct _ocfs2_extent_map_entry {
- struct rb_node e_node;
- int e_tree_depth;
- struct ocfs2_extent_rec e_rec;
-};
-
-#endif /* _EXTENT_MAP_H */
diff --git a/libocfs2/include/feature_string.h b/libocfs2/include/feature_string.h
deleted file mode 100644
index 49156a7..0000000
--- a/libocfs2/include/feature_string.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * feature_strings.h
- *
- * Routines for analyzing a feature string.
- *
- * Copyright (C) 2007 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 __FEATURE_STRING_H
-#define __FEATURE_STRING_H
-
-#include <ocfs2.h>
-
-struct fs_feature_flags {
- const char *ff_str;
- /* this flag is the feature's own flag. */
- fs_options ff_own_flags;
- /*
- * this flag includes the feature's own flag and
- * all the other features' flag it depends on.
- */
- fs_options ff_flags;
-};
-
-enum feature_level_indexes {
- FEATURE_LEVEL_DEFAULT = 0,
- FEATURE_LEVEL_MAX_COMPAT,
- FEATURE_LEVEL_MAX_FEATURES,
-};
-
-errcode_t parse_feature(const char *opts,
- fs_options *feature_flags,
- fs_options *reverse_flags);
-
-int parse_feature_level(const char *typestr,
- enum feature_level_indexes *index);
-
-int merge_feature_flags_with_level(fs_options *dest,
- int index,
- fs_options *feature_set,
- fs_options *reverse_set);
-#endif /* __FEATURE_STIRNG_H */
diff --git a/libocfs2/include/jbd.h b/libocfs2/include/jbd.h
deleted file mode 100644
index 29493fb..0000000
--- a/libocfs2/include/jbd.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * jbd.h
- *
- * header file extracted from linux/include/linux/jbd.h
- *
- * Originally written by Stephen C. Tweedie <sct at redhat.com>
- *
- * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
- *
- * This file is part of the Linux kernel and is made available under
- * the terms of the GNU General Public License, version 2, or at your
- * option, any later version, incorporated herein by reference.
- *
- * Definitions for transaction data structures for the buffer cache
- * filesystem journaling support.
- */
-
-#ifndef _JBD_H_
-#define _JBD_H_
-
-/*
- * Internal structures used by the logging mechanism:
- */
-
-#define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
-
-/*
- * On-disk structures
- */
-
-/*
- * Descriptor block types:
- */
-
-#define JFS_DESCRIPTOR_BLOCK 1
-#define JFS_COMMIT_BLOCK 2
-#define JFS_SUPERBLOCK_V1 3
-#define JFS_SUPERBLOCK_V2 4
-#define JFS_REVOKE_BLOCK 5
-
-/*
- * Standard header for all descriptor blocks:
- */
-typedef struct journal_header_s
-{
- __u32 h_magic;
- __u32 h_blocktype;
- __u32 h_sequence;
-} journal_header_t;
-
-/*
- * The block tag: used to describe a single buffer in the journal
- */
-typedef struct journal_block_tag_s
-{
- __u32 t_blocknr; /* The on-disk block number */
- __u32 t_flags; /* See below */
-} journal_block_tag_t;
-
-/*
- * The revoke descriptor: used on disk to describe a series of blocks to
- * be revoked from the log
- */
-typedef struct journal_revoke_header_s
-{
- journal_header_t r_header;
- int r_count; /* Count of bytes used in the block */
-} journal_revoke_header_t;
-
-/* Definitions for the journal tag flags word: */
-#define JFS_FLAG_ESCAPE 1 /* on-disk block is escaped */
-#define JFS_FLAG_SAME_UUID 2 /* block has same uuid as previous */
-#define JFS_FLAG_DELETED 4 /* block deleted by this transaction */
-#define JFS_FLAG_LAST_TAG 8 /* last tag in this descriptor block */
-
-/*
- * The journal superblock. All fields are in big-endian byte order.
- */
-typedef struct journal_superblock_s
-{
-/* 0x0000 */
- journal_header_t s_header;
-
-/* 0x000C */
- /* Static information describing the journal */
- __u32 s_blocksize; /* journal device blocksize */
- __u32 s_maxlen; /* total blocks in journal file */
- __u32 s_first; /* first block of log information */
-
-/* 0x0018 */
- /* Dynamic information describing the current state of the log */
- __u32 s_sequence; /* first commit ID expected in log */
- __u32 s_start; /* blocknr of start of log */
-
-/* 0x0020 */
- /* Error value, as set by journal_abort(). */
- __s32 s_errno;
-
-/* 0x0024 */
- /* Remaining fields are only valid in a version-2 superblock */
- __u32 s_feature_compat; /* compatible feature set */
- __u32 s_feature_incompat; /* incompatible feature set */
- __u32 s_feature_ro_compat; /* readonly-compatible feature set */
-/* 0x0030 */
- __u8 s_uuid[16]; /* 128-bit uuid for journal */
-
-/* 0x0040 */
- __u32 s_nr_users; /* Nr of filesystems sharing log */
-
- __u32 s_dynsuper; /* Blocknr of dynamic superblock copy*/
-
-/* 0x0048 */
- __u32 s_max_transaction; /* Limit of journal blocks per trans.*/
- __u32 s_max_trans_data; /* Limit of data blocks per trans. */
-
-/* 0x0050 */
- __u32 s_padding[44];
-
-/* 0x0100 */
- __u8 s_users[16*48]; /* ids of all fs'es sharing the log */
-/* 0x0400 */
-} journal_superblock_t;
-
-#endif /* _JBD_H_ */
diff --git a/libocfs2/include/kernel-rbtree.h b/libocfs2/include/kernel-rbtree.h
deleted file mode 100644
index 4c0256e..0000000
--- a/libocfs2/include/kernel-rbtree.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- Red Black Trees
- (C) 1999 Andrea Arcangeli <andrea at suse.de>
-
- 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 02111-1307 USA
-
- rbtree.h
-
- To use rbtrees you'll have to implement your own insert and search cores.
- This will avoid us to use callbacks and to drop drammatically performances.
- I know it's not the cleaner way, but in C (not in C++) to get
- performances and genericity...
-
- Some example of insert and search follows here. The search is a plain
- normal search over an ordered tree. The insert instead must be implemented
- int two steps: as first thing the code must insert the element in
- order as a red leaf in the tree, then the support library function
- rb_insert_color() must be called. Such function will do the
- not trivial work to rebalance the rbtree if necessary.
-
------------------------------------------------------------------------
-static inline struct page * rb_search_page_cache(struct inode * inode,
- unsigned long offset)
-{
- struct rb_node * n = inode->i_rb_page_cache.rb_node;
- struct page * page;
-
- while (n)
- {
- page = rb_entry(n, struct page, rb_page_cache);
-
- if (offset < page->offset)
- n = n->rb_left;
- else if (offset > page->offset)
- n = n->rb_right;
- else
- return page;
- }
- return NULL;
-}
-
-static inline struct page * __rb_insert_page_cache(struct inode * inode,
- unsigned long offset,
- struct rb_node * node)
-{
- struct rb_node ** p = &inode->i_rb_page_cache.rb_node;
- struct rb_node * parent = NULL;
- struct page * page;
-
- while (*p)
- {
- parent = *p;
- page = rb_entry(parent, struct page, rb_page_cache);
-
- if (offset < page->offset)
- p = &(*p)->rb_left;
- else if (offset > page->offset)
- p = &(*p)->rb_right;
- else
- return page;
- }
-
- rb_link_node(node, parent, p);
-
- return NULL;
-}
-
-static inline struct page * rb_insert_page_cache(struct inode * inode,
- unsigned long offset,
- struct rb_node * node)
-{
- struct page * ret;
- if ((ret = __rb_insert_page_cache(inode, offset, node)))
- goto out;
- rb_insert_color(node, &inode->i_rb_page_cache);
- out:
- return ret;
-}
------------------------------------------------------------------------
-*/
-
-#ifndef _LINUX_RBTREE_H
-#define _LINUX_RBTREE_H
-
-#include <stdlib.h>
-
-struct rb_node
-{
- struct rb_node *rb_parent;
- int rb_color;
-#define RB_RED 0
-#define RB_BLACK 1
- struct rb_node *rb_right;
- struct rb_node *rb_left;
-};
-
-struct rb_root
-{
- struct rb_node *rb_node;
-};
-
-#define RB_ROOT (struct rb_root) { NULL, }
-#define rb_entry(ptr, type, member) \
- ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
-
-extern void rb_insert_color(struct rb_node *, struct rb_root *);
-extern void rb_erase(struct rb_node *, struct rb_root *);
-
-/* Find logical next and previous nodes in a tree */
-extern struct rb_node *rb_next(struct rb_node *);
-extern struct rb_node *rb_prev(struct rb_node *);
-extern struct rb_node *rb_first(struct rb_root *);
-extern struct rb_node *rb_last(struct rb_root *);
-
-/* Fast replacement of a single node without remove/rebalance/add/rebalance */
-extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
- struct rb_root *root);
-
-static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
- struct rb_node ** rb_link)
-{
- node->rb_parent = parent;
- node->rb_color = RB_RED;
- node->rb_left = node->rb_right = NULL;
-
- *rb_link = node;
-}
-
-#endif /* _LINUX_RBTREE_H */
diff --git a/libocfs2/include/ocfs2.h b/libocfs2/include/ocfs2.h
deleted file mode 100644
index f35f3ed..0000000
--- a/libocfs2/include/ocfs2.h
+++ /dev/null
@@ -1,855 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * ocfs2.h
- *
- * Filesystem object routines for the OCFS2 userspace library.
- *
- * 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, 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.
- *
- * Authors: Joel Becker
- */
-
-#ifndef _FILESYS_H
-#define _FILESYS_H
-
-#ifndef _XOPEN_SOURCE
-# define _XOPEN_SOURCE 600
-#endif
-#ifndef _LARGEFILE64_SOURCE
-# define _LARGEFILE64_SOURCE
-#endif
-
-#include <stdio.h>
-#include <stdint.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <string.h>
-#include <stddef.h>
-
-#include <limits.h>
-
-#include <linux/types.h>
-
-#include <et/com_err.h>
-
-#include "byteorder.h"
-
-#include <ocfs2-kernel/kernel-list.h>
-#include <ocfs2-kernel/ocfs2_fs.h>
-#include <o2dlm/o2dlm.h>
-#include <o2cb/o2cb.h>
-
-#if OCFS2_FLAT_INCLUDES
-#include "kernel-rbtree.h"
-#include "ocfs2_err.h"
-#include "jbd.h"
-#else
-#include <ocfs2/kernel-rbtree.h>
-#include <ocfs2/ocfs2_err.h>
-#include <ocfs2/jbd.h>
-#endif
-
-#include <ocfs2-kernel/ocfs2_lockid.h>
-
-#define OCFS2_LIB_FEATURE_INCOMPAT_SUPP (OCFS2_FEATURE_INCOMPAT_SUPP | \
- OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV | \
- OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG | \
- OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT | \
- OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG)
-
-#define OCFS2_LIB_FEATURE_RO_COMPAT_SUPP OCFS2_FEATURE_RO_COMPAT_SUPP
-
-#define OCFS2_LIB_FEATURE_COMPAT_SUPP OCFS2_FEATURE_COMPAT_SUPP
-
-#define OCFS2_LIB_ABORTED_TUNEFS_SUPP OCFS2_TUNEFS_INPROG_REMOVE_SLOT
-
-/*
- * Printable strings for feature flags
- * These MUST be kept in sync with the flags in ocfs2_fs.h, and MUST
- * be named <flag>_STR.
- */
-#define OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV_STR "Heartbeat"
-#define OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG_STR "AbortedResize"
-#define OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT_STR "Local"
-#define OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC_STR "SparseAlloc"
-#define OCFS2_FEATURE_INCOMPAT_TUNEFS_INPROG_STR "TunefsAbort"
-#define OCFS2_FEATURE_COMPAT_BACKUP_SB_STR "BackupSuper"
-#define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN_STR "UnwrittenExtents"
-#define OCFS2_TUNEFS_INPROG_REMOVE_SLOT_STR "RemoveSlot"
-
-/* define OCFS2_SB for ocfs2-tools */
-#define OCFS2_SB(sb) (sb)
-
-/* Flags for the ocfs2_filesys structure */
-#define OCFS2_FLAG_RO 0x00
-#define OCFS2_FLAG_RW 0x01
-#define OCFS2_FLAG_CHANGED 0x02
-#define OCFS2_FLAG_DIRTY 0x04
-#define OCFS2_FLAG_SWAP_BYTES 0x08
-#define OCFS2_FLAG_BUFFERED 0x10
-#define OCFS2_FLAG_NO_REV_CHECK 0x20 /* Do not check the OCFS
- vol_header structure
- for revision info */
-#define OCFS2_FLAG_HEARTBEAT_DEV_OK 0x40
-#define OCFS2_FLAG_STRICT_COMPAT_CHECK 0x80
-
-/* Return flags for the directory iterator functions */
-#define OCFS2_DIRENT_CHANGED 0x01
-#define OCFS2_DIRENT_ABORT 0x02
-#define OCFS2_DIRENT_ERROR 0x04
-
-/* Directory iterator flags */
-#define OCFS2_DIRENT_FLAG_INCLUDE_EMPTY 0x01
-#define OCFS2_DIRENT_FLAG_INCLUDE_REMOVED 0x02
-#define OCFS2_DIRENT_FLAG_EXCLUDE_DOTS 0x04
-
-/* Return flags for the chain iterator functions */
-#define OCFS2_CHAIN_CHANGED 0x01
-#define OCFS2_CHAIN_ABORT 0x02
-#define OCFS2_CHAIN_ERROR 0x04
-
-/* Directory constants */
-#define OCFS2_DIRENT_DOT_FILE 1
-#define OCFS2_DIRENT_DOT_DOT_FILE 2
-#define OCFS2_DIRENT_OTHER_FILE 3
-#define OCFS2_DIRENT_DELETED_FILE 4
-
-/* Directory scan flags */
-#define OCFS2_DIR_SCAN_FLAG_EXCLUDE_DOTS 0x01
-
-/* Check if mounted flags */
-#define OCFS2_MF_MOUNTED 1
-#define OCFS2_MF_ISROOT 2
-#define OCFS2_MF_READONLY 4
-#define OCFS2_MF_SWAP 8
-#define OCFS2_MF_BUSY 16
-#define OCFS2_MF_MOUNTED_CLUSTER 32
-
-/* check_heartbeats progress states */
-#define OCFS2_CHB_START 1
-#define OCFS2_CHB_WAITING 2
-#define OCFS2_CHB_COMPLETE 3
-
-typedef void (*ocfs2_chb_notify)(int state, char *progress, void *data);
-
-typedef struct _ocfs2_filesys ocfs2_filesys;
-typedef struct _ocfs2_cached_inode ocfs2_cached_inode;
-typedef struct _io_channel io_channel;
-typedef struct _ocfs2_inode_scan ocfs2_inode_scan;
-typedef struct _ocfs2_dir_scan ocfs2_dir_scan;
-typedef struct _ocfs2_bitmap ocfs2_bitmap;
-typedef struct _ocfs2_devices ocfs2_devices;
-
-struct _ocfs2_filesys {
- char *fs_devname;
- uint32_t fs_flags;
- io_channel *fs_io;
- struct ocfs2_dinode *fs_super;
- struct ocfs2_dinode *fs_orig_super;
- unsigned int fs_blocksize;
- unsigned int fs_clustersize;
- uint32_t fs_clusters;
- uint64_t fs_blocks;
- uint32_t fs_umask;
- uint64_t fs_root_blkno;
- uint64_t fs_sysdir_blkno;
- uint64_t fs_first_cg_blkno;
- char uuid_str[OCFS2_VOL_UUID_LEN * 2 + 1];
-
- /* Allocators */
- ocfs2_cached_inode *fs_cluster_alloc;
- ocfs2_cached_inode **fs_inode_allocs;
- ocfs2_cached_inode *fs_system_inode_alloc;
- ocfs2_cached_inode **fs_eb_allocs;
- ocfs2_cached_inode *fs_system_eb_alloc;
-
- struct o2dlm_ctxt *fs_dlm_ctxt;
-
- /* Reserved for the use of the calling application. */
- void *fs_private;
-};
-
-struct _ocfs2_cached_inode {
- struct _ocfs2_filesys *ci_fs;
- uint64_t ci_blkno;
- struct ocfs2_dinode *ci_inode;
- ocfs2_bitmap *ci_chains;
-};
-
-struct _ocfs2_devices {
- struct list_head list;
- char dev_name[100];
- uint8_t label[64];
- uint8_t uuid[16];
- int mount_flags;
- int fs_type; /* 0=unknown, 1=ocfs, 2=ocfs2 */
- int hb_dev;
- uint32_t maj_num; /* major number of the device */
- uint32_t min_num; /* minor number of the device */
- errcode_t errcode; /* error encountered reading device */
- void *private;
- uint16_t max_slots;
- uint8_t *node_nums; /* list of mounted nodes */
-};
-
-typedef struct _fs_options fs_options;
-
-struct _fs_options {
- uint32_t compat;
- uint32_t incompat;
- uint32_t ro_compat;
-};
-
-errcode_t ocfs2_malloc(unsigned long size, void *ptr);
-errcode_t ocfs2_malloc0(unsigned long size, void *ptr);
-errcode_t ocfs2_free(void *ptr);
-errcode_t ocfs2_realloc(unsigned long size, void *ptr);
-errcode_t ocfs2_realloc0(unsigned long size, void *ptr,
- unsigned long old_size);
-errcode_t ocfs2_malloc_blocks(io_channel *channel, int num_blocks,
- void *ptr);
-errcode_t ocfs2_malloc_block(io_channel *channel, void *ptr);
-
-errcode_t io_open(const char *name, int flags, io_channel **channel);
-errcode_t io_close(io_channel *channel);
-int io_get_error(io_channel *channel);
-errcode_t io_set_blksize(io_channel *channel, int blksize);
-int io_get_blksize(io_channel *channel);
-errcode_t io_read_block(io_channel *channel, int64_t blkno, int count,
- char *data);
-errcode_t io_write_block(io_channel *channel, int64_t blkno, int count,
- const char *data);
-errcode_t io_init_cache(io_channel *channel, size_t nr_blocks);
-errcode_t io_init_cache_size(io_channel *channel, size_t bytes);
-void io_destroy_cache(io_channel *channel);
-
-errcode_t ocfs2_read_super(ocfs2_filesys *fs, uint64_t superblock, char *sb);
-errcode_t ocfs2_write_super(ocfs2_filesys *fs);
-int ocfs2_mount_local(ocfs2_filesys *fs);
-errcode_t ocfs2_open(const char *name, int flags,
- unsigned int superblock, unsigned int blksize,
- ocfs2_filesys **ret_fs);
-errcode_t ocfs2_flush(ocfs2_filesys *fs);
-errcode_t ocfs2_close(ocfs2_filesys *fs);
-void ocfs2_freefs(ocfs2_filesys *fs);
-
-void ocfs2_swap_inode_from_cpu(struct ocfs2_dinode *di);
-void ocfs2_swap_inode_to_cpu(struct ocfs2_dinode *di);
-errcode_t ocfs2_read_inode(ocfs2_filesys *fs, uint64_t blkno,
- char *inode_buf);
-errcode_t ocfs2_write_inode(ocfs2_filesys *fs, uint64_t blkno,
- char *inode_buf);
-errcode_t ocfs2_check_directory(ocfs2_filesys *fs, uint64_t dir);
-
-errcode_t ocfs2_read_cached_inode(ocfs2_filesys *fs, uint64_t blkno,
- ocfs2_cached_inode **ret_ci);
-errcode_t ocfs2_write_cached_inode(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode);
-errcode_t ocfs2_free_cached_inode(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode);
-
-void ocfs2_swap_extent_list_from_cpu(struct ocfs2_extent_list *el);
-void ocfs2_swap_extent_list_to_cpu(struct ocfs2_extent_list *el);
-errcode_t ocfs2_extent_map_get_blocks(ocfs2_cached_inode *cinode,
- uint64_t v_blkno, int count,
- uint64_t *p_blkno,
- uint64_t *ret_count,
- uint16_t *extent_flags);
-errcode_t ocfs2_get_clusters(ocfs2_cached_inode *cinode,
- uint32_t v_cluster,
- uint32_t *p_cluster,
- uint32_t *num_clusters,
- uint16_t *extent_flags);
-int ocfs2_find_leaf(ocfs2_filesys *fs, struct ocfs2_dinode *di,
- uint32_t cpos, char **leaf_buf);
-int ocfs2_search_extent_list(struct ocfs2_extent_list *el, uint32_t v_cluster);
-void ocfs2_swap_journal_superblock(journal_superblock_t *jsb);
-errcode_t ocfs2_init_journal_superblock(ocfs2_filesys *fs, char *buf,
- int buflen, uint32_t jrnl_size);
-errcode_t ocfs2_read_journal_superblock(ocfs2_filesys *fs, uint64_t blkno,
- char *jsb_buf);
-errcode_t ocfs2_write_journal_superblock(ocfs2_filesys *fs, uint64_t blkno,
- char *jsb_buf);
-errcode_t ocfs2_make_journal(ocfs2_filesys *fs, uint64_t blkno,
- uint32_t clusters);
-
-errcode_t ocfs2_read_extent_block(ocfs2_filesys *fs, uint64_t blkno,
- char *eb_buf);
-errcode_t ocfs2_read_extent_block_nocheck(ocfs2_filesys *fs, uint64_t blkno,
- char *eb_buf);
-errcode_t ocfs2_write_extent_block(ocfs2_filesys *fs, uint64_t blkno,
- char *eb_buf);
-errcode_t ocfs2_swap_dir_entries_from_cpu(void *buf, uint64_t bytes);
-errcode_t ocfs2_swap_dir_entries_to_cpu(void *buf, uint64_t bytes);
-errcode_t ocfs2_read_dir_block(ocfs2_filesys *fs, uint64_t block,
- void *buf);
-errcode_t ocfs2_write_dir_block(ocfs2_filesys *fs, uint64_t block,
- void *buf);
-
-errcode_t ocfs2_dir_iterate2(ocfs2_filesys *fs,
- uint64_t dir,
- int flags,
- char *block_buf,
- int (*func)(uint64_t dir,
- int entry,
- struct ocfs2_dir_entry *dirent,
- int offset,
- int blocksize,
- char *buf,
- void *priv_data),
- void *priv_data);
-extern errcode_t ocfs2_dir_iterate(ocfs2_filesys *fs,
- uint64_t dir,
- int flags,
- char *block_buf,
- int (*func)(struct ocfs2_dir_entry *dirent,
- int offset,
- int blocksize,
- char *buf,
- void *priv_data),
- void *priv_data);
-
-errcode_t ocfs2_lookup(ocfs2_filesys *fs, uint64_t dir,
- const char *name, int namelen, char *buf,
- uint64_t *inode);
-
-errcode_t ocfs2_lookup_system_inode(ocfs2_filesys *fs, int type,
- int slot_num, uint64_t *blkno);
-
-errcode_t ocfs2_link(ocfs2_filesys *fs, uint64_t dir, const char *name,
- uint64_t ino, int flags);
-
-errcode_t ocfs2_unlink(ocfs2_filesys *fs, uint64_t dir,
- const char *name, uint64_t ino, int flags);
-
-errcode_t ocfs2_open_inode_scan(ocfs2_filesys *fs,
- ocfs2_inode_scan **ret_scan);
-void ocfs2_close_inode_scan(ocfs2_inode_scan *scan);
-errcode_t ocfs2_get_next_inode(ocfs2_inode_scan *scan,
- uint64_t *blkno, char *inode);
-
-errcode_t ocfs2_open_dir_scan(ocfs2_filesys *fs, uint64_t dir, int flags,
- ocfs2_dir_scan **ret_scan);
-void ocfs2_close_dir_scan(ocfs2_dir_scan *scan);
-errcode_t ocfs2_get_next_dir_entry(ocfs2_dir_scan *scan,
- struct ocfs2_dir_entry *dirent);
-
-errcode_t ocfs2_cluster_bitmap_new(ocfs2_filesys *fs,
- const char *description,
- ocfs2_bitmap **ret_bitmap);
-errcode_t ocfs2_block_bitmap_new(ocfs2_filesys *fs,
- const char *description,
- ocfs2_bitmap **ret_bitmap);
-void ocfs2_bitmap_free(ocfs2_bitmap *bitmap);
-errcode_t ocfs2_bitmap_set(ocfs2_bitmap *bitmap, uint64_t bitno,
- int *oldval);
-errcode_t ocfs2_bitmap_clear(ocfs2_bitmap *bitmap, uint64_t bitno,
- int *oldval);
-errcode_t ocfs2_bitmap_test(ocfs2_bitmap *bitmap, uint64_t bitno,
- int *val);
-errcode_t ocfs2_bitmap_find_next_set(ocfs2_bitmap *bitmap,
- uint64_t start, uint64_t *found);
-errcode_t ocfs2_bitmap_find_next_clear(ocfs2_bitmap *bitmap,
- uint64_t start, uint64_t *found);
-errcode_t ocfs2_bitmap_read(ocfs2_bitmap *bitmap);
-errcode_t ocfs2_bitmap_write(ocfs2_bitmap *bitmap);
-uint64_t ocfs2_bitmap_get_set_bits(ocfs2_bitmap *bitmap);
-errcode_t ocfs2_bitmap_alloc_range(ocfs2_bitmap *bitmap, uint64_t min,
- uint64_t len, uint64_t *first_bit,
- uint64_t *bits_found);
-errcode_t ocfs2_bitmap_clear_range(ocfs2_bitmap *bitmap, uint64_t len,
- uint64_t first_bit);
-
-errcode_t ocfs2_get_device_size(const char *file, int blocksize,
- uint64_t *retblocks);
-
-errcode_t ocfs2_get_device_sectsize(const char *file, int *sectsize);
-
-errcode_t ocfs2_check_if_mounted(const char *file, int *mount_flags);
-errcode_t ocfs2_check_mount_point(const char *device, int *mount_flags,
- char *mtpt, int mtlen);
-
-errcode_t ocfs2_read_whole_file(ocfs2_filesys *fs, uint64_t blkno,
- char **buf, int *len);
-
-void ocfs2_swap_disk_heartbeat_block(struct o2hb_disk_heartbeat_block *hb);
-errcode_t ocfs2_check_heartbeat(char *device, int *mount_flags,
- struct list_head *nodes_list);
-
-errcode_t ocfs2_check_heartbeats(struct list_head *dev_list, int ignore_local);
-
-errcode_t ocfs2_get_ocfs1_label(char *device, uint8_t *label, uint16_t label_len,
- uint8_t *uuid, uint16_t uuid_len);
-
-void ocfs2_swap_group_desc(struct ocfs2_group_desc *gd);
-errcode_t ocfs2_read_group_desc(ocfs2_filesys *fs, uint64_t blkno,
- char *gd_buf);
-
-errcode_t ocfs2_write_group_desc(ocfs2_filesys *fs, uint64_t blkno,
- char *gd_buf);
-
-errcode_t ocfs2_chain_iterate(ocfs2_filesys *fs,
- uint64_t blkno,
- int (*func)(ocfs2_filesys *fs,
- uint64_t gd_blkno,
- int chain_num,
- void *priv_data),
- void *priv_data);
-
-errcode_t ocfs2_load_chain_allocator(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode);
-errcode_t ocfs2_write_chain_allocator(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode);
-errcode_t ocfs2_chain_alloc(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode,
- uint64_t *gd_blkno,
- uint64_t *bitno);
-errcode_t ocfs2_chain_free(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode,
- uint64_t bitno);
-errcode_t ocfs2_chain_alloc_range(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode,
- uint64_t min,
- uint64_t requested,
- uint64_t *start_bit,
- uint64_t *bits_found);
-errcode_t ocfs2_chain_free_range(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode,
- uint64_t len,
- uint64_t start_bit);
-errcode_t ocfs2_chain_test(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode,
- uint64_t bitno,
- int *oldval);
-errcode_t ocfs2_chain_force_val(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode,
- uint64_t blkno,
- int newval,
- int *oldval);
-errcode_t ocfs2_chain_add_group(ocfs2_filesys *fs,
- ocfs2_cached_inode *cinode);
-
-errcode_t ocfs2_expand_dir(ocfs2_filesys *fs,
- uint64_t dir,
- uint64_t parent_dir);
-
-errcode_t ocfs2_test_inode_allocated(ocfs2_filesys *fs, uint64_t blkno,
- int *is_allocated);
-void ocfs2_init_group_desc(ocfs2_filesys *fs,
- struct ocfs2_group_desc *gd,
- uint64_t blkno, uint32_t generation,
- uint64_t parent_inode, uint16_t bits,
- uint16_t chain);
-
-errcode_t ocfs2_new_dir_block(ocfs2_filesys *fs, uint64_t dir_ino,
- uint64_t parent_ino, char **block);
-
-errcode_t ocfs2_insert_extent(ocfs2_filesys *fs, uint64_t ino, uint32_t cpos,
- uint64_t c_blkno, uint32_t clusters,
- uint16_t flag);
-
-errcode_t ocfs2_new_inode(ocfs2_filesys *fs, uint64_t *ino, int mode);
-errcode_t ocfs2_new_system_inode(ocfs2_filesys *fs, uint64_t *ino, int mode, int flags);
-errcode_t ocfs2_delete_inode(ocfs2_filesys *fs, uint64_t ino);
-errcode_t ocfs2_new_extent_block(ocfs2_filesys *fs, uint64_t *blkno);
-errcode_t ocfs2_delete_extent_block(ocfs2_filesys *fs, uint64_t blkno);
-/*
- * Allocate the blocks and insert them to the file.
- * only i_clusters of dinode will be updated accordingly, i_size not changed.
- */
-errcode_t ocfs2_extend_allocation(ocfs2_filesys *fs, uint64_t ino,
- uint32_t new_clusters);
-/* Extend the file to the new size. No clusters will be allocated. */
-errcode_t ocfs2_extend_file(ocfs2_filesys *fs, uint64_t ino, uint64_t new_size);
-
-int ocfs2_mark_extent_written(ocfs2_filesys *fs, struct ocfs2_dinode *di,
- uint32_t cpos, uint32_t len, uint64_t p_blkno);
-/* Reserve spaces at "offset" with a "len" in the files. */
-errcode_t ocfs2_allocate_unwritten_extents(ocfs2_filesys *fs, uint64_t ino,
- uint64_t offset, uint64_t len);
-
-errcode_t ocfs2_truncate(ocfs2_filesys *fs, uint64_t ino, uint64_t new_i_size);
-errcode_t ocfs2_zero_tail_and_truncate(ocfs2_filesys *fs,
- ocfs2_cached_inode *ci,
- uint64_t new_size,
- uint32_t *new_clusters);
-errcode_t ocfs2_new_clusters(ocfs2_filesys *fs,
- uint32_t min,
- uint32_t requested,
- uint64_t *start_blkno,
- uint32_t *clusters_found);
-errcode_t ocfs2_free_clusters(ocfs2_filesys *fs,
- uint32_t len,
- uint64_t start_blkno);
-
-errcode_t ocfs2_lookup(ocfs2_filesys *fs, uint64_t dir, const char *name,
- int namelen, char *buf, uint64_t *inode);
-
-errcode_t ocfs2_namei(ocfs2_filesys *fs, uint64_t root, uint64_t cwd,
- const char *name, uint64_t *inode);
-
-errcode_t ocfs2_namei_follow(ocfs2_filesys *fs, uint64_t root, uint64_t cwd,
- const char *name, uint64_t *inode);
-
-errcode_t ocfs2_follow_link(ocfs2_filesys *fs, uint64_t root, uint64_t cwd,
- uint64_t inode, uint64_t *res_inode);
-
-errcode_t ocfs2_file_read(ocfs2_cached_inode *ci, void *buf, uint32_t count,
- uint64_t offset, uint32_t *got);
-
-errcode_t ocfs2_file_write(ocfs2_cached_inode *ci, void *buf, uint32_t count,
- uint64_t offset, uint32_t *wrote);
-
-errcode_t ocfs2_fill_heartbeat_desc(ocfs2_filesys *fs,
- struct o2cb_region_desc *desc);
-
-errcode_t ocfs2_start_heartbeat(ocfs2_filesys *fs);
-
-errcode_t ocfs2_stop_heartbeat(ocfs2_filesys *fs);
-
-errcode_t ocfs2_lock_down_cluster(ocfs2_filesys *fs);
-
-errcode_t ocfs2_release_cluster(ocfs2_filesys *fs);
-
-errcode_t ocfs2_initialize_dlm(ocfs2_filesys *fs);
-
-errcode_t ocfs2_shutdown_dlm(ocfs2_filesys *fs);
-
-errcode_t ocfs2_super_lock(ocfs2_filesys *fs);
-
-errcode_t ocfs2_super_unlock(ocfs2_filesys *fs);
-
-errcode_t ocfs2_meta_lock(ocfs2_filesys *fs, ocfs2_cached_inode *inode,
- enum o2dlm_lock_level level, int flags);
-
-errcode_t ocfs2_meta_unlock(ocfs2_filesys *fs, ocfs2_cached_inode *ci);
-
-void ocfs2_swap_slot_map(int16_t *map, loff_t num_slots);
-
-enum ocfs2_lock_type ocfs2_get_lock_type(char c);
-
-char *ocfs2_get_lock_type_string(enum ocfs2_lock_type type);
-
-errcode_t ocfs2_encode_lockres(enum ocfs2_lock_type type, uint64_t blkno,
- uint32_t generation, char *lockres);
-
-errcode_t ocfs2_decode_lockres(char *lockres, int len, enum ocfs2_lock_type *type,
- uint64_t *blkno, uint32_t *generation);
-
-/* write the superblock at the specific block. */
-errcode_t ocfs2_write_backup_super(ocfs2_filesys *fs, uint64_t blkno);
-
-/* Get the blkno according to the file system info.
- * The unused ones, depending on the volume size, are zeroed.
- * Return the length of the block array.
- */
-int ocfs2_get_backup_super_offset(ocfs2_filesys *fs,
- uint64_t *blocks, size_t len);
-
-/* This function will get the superblock pointed to by fs and copy it to
- * the blocks. But first it will ensure all the appropriate clusters are free.
- * If not, it will error out with ENOSPC. If free, it will set bits for all
- * the clusters, zero the clusters and write the backup sb.
- * In case of updating, it will override the backup blocks with the newest
- * superblock information.
- */
-errcode_t ocfs2_set_backup_super(ocfs2_filesys *fs,
- uint64_t *blocks, size_t len);
-
-/* Refresh the backup superblock inoformation. */
-errcode_t ocfs2_refresh_backup_super(ocfs2_filesys *fs,
- uint64_t *blocks, size_t len);
-
-errcode_t ocfs2_read_backup_super(ocfs2_filesys *fs, int backup, char *sbbuf);
-
-/* get the virtual offset of the last allocated cluster. */
-errcode_t ocfs2_get_last_cluster_offset(ocfs2_filesys *fs,
- struct ocfs2_dinode *di,
- uint32_t *v_cluster);
-/*
- * ${foo}_to_${bar} is a floor function. blocks_to_clusters will
- * returns the cluster that contains a block, not the number of clusters
- * that hold a given number of blocks.
- *
- * ${foo}_in_${bar} is a ceiling function. clusters_in_blocks will give
- * the number of clusters needed to hold a given number of blocks.
- */
-
-static inline uint64_t ocfs2_clusters_to_blocks(ocfs2_filesys *fs,
- uint32_t clusters)
-{
- int c_to_b_bits =
- OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits -
- OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
-
- return (uint64_t)clusters << c_to_b_bits;
-}
-
-static inline uint32_t ocfs2_blocks_to_clusters(ocfs2_filesys *fs,
- uint64_t blocks)
-{
- int b_to_c_bits =
- OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits -
- OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
-
- return (uint32_t)(blocks >> b_to_c_bits);
-}
-
-static inline uint64_t ocfs2_blocks_in_bytes(ocfs2_filesys *fs, uint64_t bytes)
-{
- uint64_t ret = bytes + fs->fs_blocksize - 1;
-
- if (ret < bytes) /* deal with wrapping */
- return UINT64_MAX;
-
- return ret >> OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
-}
-
-static inline uint32_t ocfs2_clusters_in_blocks(ocfs2_filesys *fs,
- uint64_t blocks)
-{
- int c_to_b_bits = OCFS2_RAW_SB(fs->fs_super)->s_clustersize_bits -
- OCFS2_RAW_SB(fs->fs_super)->s_blocksize_bits;
- uint64_t ret = blocks + ((1 << c_to_b_bits) - 1);
-
- if (ret < blocks) /* deal with wrapping */
- ret = UINT64_MAX;
-
- return (uint32_t)(ret >> c_to_b_bits);
-}
-
-/* given a cluster offset, calculate which block group it belongs to
- * and return that block offset. */
-static inline uint64_t ocfs2_which_cluster_group(ocfs2_filesys *fs,
- uint16_t cpg,
- uint32_t cluster)
-{
- struct ocfs2_super_block *sb = OCFS2_RAW_SB(fs->fs_super);
- uint32_t group_no;
-
- group_no = cluster / cpg;
- if (!group_no)
- return sb->s_first_cluster_group;
- return ocfs2_clusters_to_blocks(fs, group_no * cpg);
-}
-
-static inline int ocfs2_block_out_of_range(ocfs2_filesys *fs, uint64_t block)
-{
- return (block < OCFS2_SUPER_BLOCK_BLKNO) || (block > fs->fs_blocks);
-}
-
-struct ocfs2_cluster_group_sizes {
- uint16_t cgs_cpg;
- uint16_t cgs_tail_group_bits;
- uint32_t cgs_cluster_groups;
-};
-static inline void ocfs2_calc_cluster_groups(uint64_t clusters,
- uint64_t blocksize,
- struct ocfs2_cluster_group_sizes *cgs)
-{
- uint16_t max_bits = 8 * ocfs2_group_bitmap_size(blocksize);
-
- cgs->cgs_cpg = max_bits;
- if (max_bits > clusters)
- cgs->cgs_cpg = clusters;
-
- cgs->cgs_cluster_groups = (clusters + cgs->cgs_cpg - 1) /
- cgs->cgs_cpg;
-
- cgs->cgs_tail_group_bits = clusters % cgs->cgs_cpg;
- if (cgs->cgs_tail_group_bits == 0)
- cgs->cgs_tail_group_bits = cgs->cgs_cpg;
-}
-
-/*
- * This is only valid for leaf nodes, which are the only ones that can
- * have empty extents anyway.
- */
-static inline int ocfs2_is_empty_extent(struct ocfs2_extent_rec *rec)
-{
- return !rec->e_leaf_clusters;
-}
-
-/*
- * Helper function to look at the # of clusters in an extent record.
- */
-static inline uint32_t ocfs2_rec_clusters(uint16_t tree_depth,
- struct ocfs2_extent_rec *rec)
-{
- /*
- * Cluster count in extent records is slightly different
- * between interior nodes and leaf nodes. This is to support
- * unwritten extents which need a flags field in leaf node
- * records, thus shrinking the available space for a clusters
- * field.
- */
- if (tree_depth)
- return rec->e_int_clusters;
- else
- return rec->e_leaf_clusters;
-}
-
-static inline void ocfs2_set_rec_clusters(uint16_t tree_depth,
- struct ocfs2_extent_rec *rec,
- uint32_t clusters)
-{
- if (tree_depth)
- rec->e_int_clusters = clusters;
- else
- rec->e_leaf_clusters = clusters;
-}
-
-static inline int ocfs2_sparse_alloc(struct ocfs2_super_block *osb)
-{
- if (osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC)
- return 1;
- return 0;
-}
-
-static inline int ocfs2_writes_unwritten_extents(struct ocfs2_super_block *osb)
-{
- /*
- * Support for sparse files is a pre-requisite
- */
- if (!ocfs2_sparse_alloc(osb))
- return 0;
-
- if (osb->s_feature_ro_compat & OCFS2_FEATURE_RO_COMPAT_UNWRITTEN)
- return 1;
- return 0;
-}
-
-/*
- * shamelessly lifted from the kernel
- *
- * min()/max() macros that also do
- * strict type-checking.. See the
- * "unnecessary" pointer comparison.
- */
-#define ocfs2_min(x,y) ({ \
- const typeof(x) _x = (x); \
- const typeof(y) _y = (y); \
- (void) (&_x == &_y); \
- _x < _y ? _x : _y; })
-
-#define ocfs2_max(x,y) ({ \
- const typeof(x) _x = (x); \
- const typeof(y) _y = (y); \
- (void) (&_x == &_y); \
- _x > _y ? _x : _y; })
-
-/* lifted from the kernel. include/linux/kernel.h */
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
-/*
- * DEPRECATED: Extent/block iterate functions.
- *
- * Do not use these for reading/writing regular files - they don't properly
- * handle holes or inline data.
- */
-
-/* Return flags for the extent iterator functions */
-#define OCFS2_EXTENT_CHANGED 0x01
-#define OCFS2_EXTENT_ABORT 0x02
-#define OCFS2_EXTENT_ERROR 0x04
-
-/*
- * Extent iterate flags
- *
- * OCFS2_EXTENT_FLAG_APPEND indicates that the iterator function should
- * be called on extents past the leaf next_free_rec. This is used by
- * ocfs2_expand_dir() to add a new extent to a directory (via
- * OCFS2_BLOCK_FLAG_APPEND and the block iteration functions).
- *
- * OCFS2_EXTENT_FLAG_DEPTH_TRAVERSE indicates that the iterator
- * function for tree_depth > 0 records (ocfs2_extent_blocks, iow)
- * should be called after all of the extents contained in the
- * extent_block are processed. This is useful if you are going to be
- * deallocating extents.
- *
- * OCFS2_EXTENT_FLAG_DATA_ONLY indicates that the iterator function
- * should be called for data extents (depth == 0) only.
- */
-#define OCFS2_EXTENT_FLAG_APPEND 0x01
-#define OCFS2_EXTENT_FLAG_DEPTH_TRAVERSE 0x02
-#define OCFS2_EXTENT_FLAG_DATA_ONLY 0x04
-
-
-/* Return flags for the block iterator functions */
-#define OCFS2_BLOCK_CHANGED 0x01
-#define OCFS2_BLOCK_ABORT 0x02
-#define OCFS2_BLOCK_ERROR 0x04
-
-/*
- * Block iterate flags
- *
- * In OCFS2, block iteration runs through the blocks contained in an
- * inode's data extents. As such, "DATA_ONLY" and "DEPTH_TRAVERSE"
- * can't really apply.
- *
- * OCFS2_BLOCK_FLAG_APPEND is as OCFS2_EXTENT_FLAG_APPEND, except on a
- * blocksize basis. This may mean that the underlying extent already
- * contains the space for a new block, and i_size is updated
- * accordingly.
- */
-#define OCFS2_BLOCK_FLAG_APPEND 0x01
-
-errcode_t ocfs2_extent_iterate(ocfs2_filesys *fs,
- uint64_t blkno,
- int flags,
- char *block_buf,
- int (*func)(ocfs2_filesys *fs,
- struct ocfs2_extent_rec *rec,
- int tree_depth,
- uint32_t ccount,
- uint64_t ref_blkno,
- int ref_recno,
- void *priv_data),
- void *priv_data);
-errcode_t ocfs2_extent_iterate_inode(ocfs2_filesys *fs,
- struct ocfs2_dinode *inode,
- int flags,
- char *block_buf,
- int (*func)(ocfs2_filesys *fs,
- struct ocfs2_extent_rec *rec,
- int tree_depth,
- uint32_t ccount,
- uint64_t ref_blkno,
- int ref_recno,
- void *priv_data),
- void *priv_data);
-errcode_t ocfs2_block_iterate(ocfs2_filesys *fs,
- uint64_t blkno,
- int flags,
- int (*func)(ocfs2_filesys *fs,
- uint64_t blkno,
- uint64_t bcount,
- uint16_t ext_flags,
- void *priv_data),
- void *priv_data);
-errcode_t ocfs2_block_iterate_inode(ocfs2_filesys *fs,
- struct ocfs2_dinode *inode,
- int flags,
- int (*func)(ocfs2_filesys *fs,
- uint64_t blkno,
- uint64_t bcount,
- uint16_t ext_flags,
- void *priv_data),
- void *priv_data);
-
-#endif /* _FILESYS_H */
diff --git a/libocfs2/inode.c b/libocfs2/inode.c
index dfb1e7e..3cc5815 100644
--- a/libocfs2/inode.c
+++ b/libocfs2/inode.c
@@ -31,7 +31,8 @@
#include <string.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/byteorder.h"
+#include "ocfs2/ocfs2.h"
errcode_t ocfs2_check_directory(ocfs2_filesys *fs, uint64_t dir)
diff --git a/libocfs2/inode_scan.c b/libocfs2/inode_scan.c
index 01eabcf..11ba848 100644
--- a/libocfs2/inode_scan.c
+++ b/libocfs2/inode_scan.c
@@ -33,7 +33,7 @@
#include <stdlib.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include "extent_map.h"
diff --git a/libocfs2/ismounted.c b/libocfs2/ismounted.c
index f4d79d2..c6ddf31 100644
--- a/libocfs2/ismounted.c
+++ b/libocfs2/ismounted.c
@@ -38,7 +38,7 @@
#include <string.h>
#include <sys/stat.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#ifdef HAVE_MNTENT_H
/*
diff --git a/libocfs2/kernel-rbtree.c b/libocfs2/kernel-rbtree.c
index 2226ecc..1c8f911 100644
--- a/libocfs2/kernel-rbtree.c
+++ b/libocfs2/kernel-rbtree.c
@@ -28,7 +28,7 @@
linux/lib/rbtree.c
*/
-#include "kernel-rbtree.h"
+#include "ocfs2/kernel-rbtree.h"
static void __rb_rotate_left(struct rb_node *node, struct rb_root *root)
{
diff --git a/libocfs2/link.c b/libocfs2/link.c
index 37211bd..fcfe56f 100644
--- a/libocfs2/link.c
+++ b/libocfs2/link.c
@@ -30,7 +30,7 @@
#include <string.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
struct link_struct {
diff --git a/libocfs2/lockid.c b/libocfs2/lockid.c
index b68f2ce..7046e51 100644
--- a/libocfs2/lockid.c
+++ b/libocfs2/lockid.c
@@ -22,7 +22,7 @@
* Boston, MA 021110-1307, USA.
*/
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include <string.h>
#include <inttypes.h>
diff --git a/libocfs2/lookup.c b/libocfs2/lookup.c
index f9d0d8e..374113c 100644
--- a/libocfs2/lookup.c
+++ b/libocfs2/lookup.c
@@ -31,7 +31,7 @@
#include <string.h>
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
struct lookup_struct {
diff --git a/libocfs2/memory.c b/libocfs2/memory.c
index bad8300..589e114 100644
--- a/libocfs2/memory.c
+++ b/libocfs2/memory.c
@@ -33,7 +33,7 @@
#include <stdlib.h>
#include <errno.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
errcode_t ocfs2_malloc(unsigned long size, void *ptr)
{
diff --git a/libocfs2/mkjournal.c b/libocfs2/mkjournal.c
index ccc939d..afb617c 100644
--- a/libocfs2/mkjournal.c
+++ b/libocfs2/mkjournal.c
@@ -31,8 +31,8 @@
#include <string.h>
#include <netinet/in.h>
-#include "ocfs2.h"
-#include "jbd.h"
+#include "ocfs2/byteorder.h"
+#include "ocfs2/ocfs2.h"
void ocfs2_swap_journal_superblock(journal_superblock_t *jsb)
{
diff --git a/libocfs2/namei.c b/libocfs2/namei.c
index 121ae7f..aa78937 100644
--- a/libocfs2/namei.c
+++ b/libocfs2/namei.c
@@ -34,7 +34,7 @@
#include <unistd.h>
#endif
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
static errcode_t open_namei(ocfs2_filesys *fs, uint64_t root, uint64_t base,
const char *pathname, size_t pathlen, int follow,
diff --git a/libocfs2/newdir.c b/libocfs2/newdir.c
index dcf7572..480ac80 100644
--- a/libocfs2/newdir.c
+++ b/libocfs2/newdir.c
@@ -34,7 +34,7 @@
#include <unistd.h>
#endif
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
/*
* Create new directory block
diff --git a/libocfs2/openfs.c b/libocfs2/openfs.c
index 2e6b625..f352add 100644
--- a/libocfs2/openfs.c
+++ b/libocfs2/openfs.c
@@ -36,8 +36,8 @@
# define ULLONG_MAX 18446744073709551615ULL
#endif
-#include "ocfs2.h"
-
+#include "ocfs2/byteorder.h"
+#include "ocfs2/ocfs2.h"
#include "ocfs2-kernel/ocfs1_fs_compat.h"
diff --git a/libocfs2/slot_map.c b/libocfs2/slot_map.c
index 349371b..616df50 100644
--- a/libocfs2/slot_map.c
+++ b/libocfs2/slot_map.c
@@ -21,7 +21,8 @@
#define _XOPEN_SOURCE 600 /* Triggers XOPEN2K in features.h */
#define _LARGEFILE64_SOURCE
-#include "ocfs2.h"
+#include "ocfs2/byteorder.h"
+#include "ocfs2/ocfs2.h"
void ocfs2_swap_slot_map(int16_t *map, loff_t num_slots)
{
diff --git a/libocfs2/sysfile.c b/libocfs2/sysfile.c
index 9be9d40..81ce020 100644
--- a/libocfs2/sysfile.c
+++ b/libocfs2/sysfile.c
@@ -27,7 +27,7 @@
#include <string.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
errcode_t ocfs2_lookup_system_inode(ocfs2_filesys *fs, int type,
int slot_num, uint64_t *blkno)
diff --git a/libocfs2/truncate.c b/libocfs2/truncate.c
index ae25dcd..bc70682 100644
--- a/libocfs2/truncate.c
+++ b/libocfs2/truncate.c
@@ -30,7 +30,7 @@
#include <unistd.h>
#endif
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
struct truncate_ctxt {
uint64_t new_size_in_clusters;
diff --git a/libocfs2/unix_io.c b/libocfs2/unix_io.c
index d453471..2ba51d4 100644
--- a/libocfs2/unix_io.c
+++ b/libocfs2/unix_io.c
@@ -43,7 +43,9 @@
#endif
#include <inttypes.h>
-#include "ocfs2.h"
+#include "ocfs2/kernel-rbtree.h"
+
+#include "ocfs2/ocfs2.h"
/*
diff --git a/libocfs2/unlink.c b/libocfs2/unlink.c
index e56cf2d..286ef59 100644
--- a/libocfs2/unlink.c
+++ b/libocfs2/unlink.c
@@ -31,7 +31,7 @@
#include <string.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
struct link_struct {
diff --git a/listuuid/Makefile b/listuuid/Makefile
index bcef721..78c9444 100644
--- a/listuuid/Makefile
+++ b/listuuid/Makefile
@@ -2,7 +2,7 @@ TOPDIR = ..
include $(TOPDIR)/Preamble.make
-INCLUDES = -I$(TOPDIR)/include -I$(TOPDIR)/libocfs2/include
+INCLUDES = -I$(TOPDIR)/include
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
@@ -22,8 +22,6 @@ endif
CFLAGS := $(OPTS) -Wall -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations
-DEFINES = -DOCFS2_FLAT_INCLUDES
-
UNINST_PROGRAMS = listuuid
CFILES = listuuid.c
diff --git a/listuuid/listuuid.c b/listuuid/listuuid.c
index 965a136..e1fb621 100644
--- a/listuuid/listuuid.c
+++ b/listuuid/listuuid.c
@@ -38,9 +38,7 @@
#include <uuid/uuid.h>
-#define OCFS2_FLAT_INCLUDES 1
-#include <ocfs2.h>
-
+#include "ocfs2/ocfs2.h"
#include "ocfs2-kernel/ocfs1_fs_compat.h"
char *device = NULL;
diff --git a/mkfs.ocfs2/Makefile b/mkfs.ocfs2/Makefile
index 4748818..00d9d22 100644
--- a/mkfs.ocfs2/Makefile
+++ b/mkfs.ocfs2/Makefile
@@ -16,7 +16,6 @@ CFLAGS = $(OPTS) $(WARNINGS)
sbindir = $(root_sbindir)
SBIN_PROGRAMS = mkfs.ocfs2
-LIBOCFS2_CFLAGS = -I$(TOPDIR)/libocfs2/include
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
@@ -26,8 +25,8 @@ LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm
LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
-INCLUDES = -I$(TOPDIR)/include $(LIBOCFS2_CFLAGS) -I.
-DEFINES = -DOCFS2_FLAT_INCLUDES -DVERSION=\"$(VERSION)\"
+INCLUDES = -I$(TOPDIR)/include -I.
+DEFINES = -DVERSION=\"$(VERSION)\"
CFILES = mkfs.c check.c
HFILES = mkfs.h
diff --git a/mkfs.ocfs2/mkfs.h b/mkfs.ocfs2/mkfs.h
index 9712575..2e7db4b 100644
--- a/mkfs.ocfs2/mkfs.h
+++ b/mkfs.ocfs2/mkfs.h
@@ -43,20 +43,14 @@
#include <uuid/uuid.h>
-#include "ocfs2.h"
-#include "bitops.h"
-
-/* jfs_compat.h defines these */
-#undef cpu_to_be32
-#undef be32_to_cpu
-
+#include "ocfs2/ocfs2.h"
+#include "ocfs2/bitops.h"
#include "ocfs2-kernel/ocfs1_fs_compat.h"
#include <signal.h>
#include <libgen.h>
-#include "jbd.h"
-#include <feature_string.h>
+#include "ocfs2/feature_string.h"
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
diff --git a/mount.ocfs2/Makefile b/mount.ocfs2/Makefile
index b1f8859..5f796c9 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 = -I$(TOPDIR)/include -I$(TOPDIR)/libocfs2/include
+INCLUDES = -I$(TOPDIR)/include
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm
@@ -22,7 +22,7 @@ endif
CFLAGS := $(OPTS) -Wall -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations
-DEFINES = -DOCFS2_FLAT_INCLUDES -DVERSION=\"$(VERSION)\"
+DEFINES = -DVERSION=\"$(VERSION)\"
CFILES = opts.c mount.ocfs2.c
CFILES += fstab.c mntent.c realpath.c sundries.c xmalloc.c
diff --git a/mount.ocfs2/mount.ocfs2.h b/mount.ocfs2/mount.ocfs2.h
index 9f586ac..91d97d0 100644
--- a/mount.ocfs2/mount.ocfs2.h
+++ b/mount.ocfs2/mount.ocfs2.h
@@ -48,7 +48,6 @@
#include "mount_constants.h"
#include "opts.h"
-#include <ocfs2.h>
-
-#include "bitops.h"
+#include "ocfs2/ocfs2.h"
+#include "ocfs2/bitops.h"
diff --git a/mounted.ocfs2/Makefile b/mounted.ocfs2/Makefile
index 890fbce..be10987 100644
--- a/mounted.ocfs2/Makefile
+++ b/mounted.ocfs2/Makefile
@@ -11,7 +11,7 @@ else
OPTS = -O2
endif
-CFLAGS = $(OPTS) $(WARNINGS) -DOCFS2_FLAT_INCLUDES
+CFLAGS = $(OPTS) $(WARNINGS)
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
@@ -25,7 +25,7 @@ LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
sbindir = $(root_sbindir)
SBIN_PROGRAMS = mounted.ocfs2
-INCLUDES = -I$(TOPDIR)/include -I$(TOPDIR)/libocfs2/include
+INCLUDES = -I$(TOPDIR)/include
CFILES = mounted.c
OBJS = $(subst .c,.o,$(CFILES))
diff --git a/mounted.ocfs2/mounted.c b/mounted.ocfs2/mounted.c
index 3d00071..87a4f98 100644
--- a/mounted.ocfs2/mounted.c
+++ b/mounted.ocfs2/mounted.c
@@ -37,8 +37,7 @@
#include <uuid/uuid.h>
#include "ocfs2-kernel/kernel-list.h"
-
-#include <ocfs2.h>
+#include "ocfs2/ocfs2.h"
static int quick_detect = 0;
static char *device = NULL;
diff --git a/o2cb_ctl/Makefile b/o2cb_ctl/Makefile
index 82be918..b6cd01b 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 = -I$(TOPDIR)/include -I$(TOPDIR)/libocfs2/include
+INCLUDES = -I$(TOPDIR)/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 5489c58..0b40a0f 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 = -I$(TOPDIR)/include -Iinclude -I$(TOPDIR)/libocfs2/include
+INCLUDES = -I$(TOPDIR)/include
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
LIBO2DLM_LIBS = -L$(TOPDIR)/libo2dlm -lo2dlm
@@ -26,7 +26,7 @@ endif
CFLAGS := $(OPTS) -Wall -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations
-DEFINES = -DOCFS2_FLAT_INCLUDES -DVERSION=\"$(VERSION)\"
+DEFINES = -DVERSION=\"$(VERSION)\"
CFILES = ocfs2_hb_ctl.c
diff --git a/ocfs2_hb_ctl/ocfs2_hb_ctl.c b/ocfs2_hb_ctl/ocfs2_hb_ctl.c
index 58a240c..6888aa1 100644
--- a/ocfs2_hb_ctl/ocfs2_hb_ctl.c
+++ b/ocfs2_hb_ctl/ocfs2_hb_ctl.c
@@ -40,7 +40,7 @@
#include <sys/stat.h>
#include <signal.h>
-#include <ocfs2.h>
+#include "ocfs2/ocfs2.h"
#define DEV_PREFIX "/dev/"
#define PROC_IDE_FORMAT "/proc/ide/%s/media"
diff --git a/ocfs2cdsl/Makefile b/ocfs2cdsl/Makefile
index ddb2874..e8125c7 100644
--- a/ocfs2cdsl/Makefile
+++ b/ocfs2cdsl/Makefile
@@ -8,7 +8,6 @@ ifdef OCFS2_DEBUG
OPTS = -g
endif
-LIBOCFS2_CFLAGS = -I$(TOPDIR)/libocfs2/include
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
@@ -24,10 +23,9 @@ sbindir = $(root_sbindir)
SBIN_PROGRAMS = ocfs2cdsl
DEFINES = -DVERSION=\"$(VERSION)\"
-DEFINES += -DOCFS2_FLAT_INCLUDES
DEFINES += -DG_DISABLE_DEPRECATED
-INCLUDES = -I$(TOPDIR)/include $(LIBOCFS2_CFLAGS) $(GLIB_CFLAGS)
+INCLUDES = -I$(TOPDIR)/include $(GLIB_CFLAGS)
OPTIMIZE = -O2
diff --git a/ocfs2cdsl/ocfs2cdsl.c b/ocfs2cdsl/ocfs2cdsl.c
index 6a78c77..33bc8e1 100644
--- a/ocfs2cdsl/ocfs2cdsl.c
+++ b/ocfs2cdsl/ocfs2cdsl.c
@@ -43,7 +43,7 @@
#include <glib.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#define CDSL_BASE ".cluster"
diff --git a/ocfs2console/ocfs2interface/Makefile b/ocfs2console/ocfs2interface/Makefile
index b418e3f..be16577 100644
--- a/ocfs2console/ocfs2interface/Makefile
+++ b/ocfs2console/ocfs2interface/Makefile
@@ -15,7 +15,6 @@ CFLAGS = $(OPTS) $(WARNINGS) -fPIC
PYMOD_CFLAGS = $(CFLAGS) -fno-strict-aliasing $(PYTHON_INCLUDES)
-LIBOCFS2_CFLAGS = -I$(TOPDIR)/libocfs2/include
LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
LIBOCFS2_DEPS = $(TOPDIR)/libocfs2/libocfs2.a
@@ -34,8 +33,6 @@ BLKID_CFLAGS = -I$(TOPDIR)/ocfs2console
BLKID_LIBS = -L$(TOPDIR)/ocfs2console/blkid -lblkid-internal $(UUID_LIBS)
endif
-OCFS2_CPPFLAGS = -DOCFS2_FLAT_INCLUDES $(LIBOCFS2_CFLAGS)
-
GLIB_CPPFLAGS = $(GLIB_CFLAGS) -DG_DISABLE_DEPRECATED
OPTIMIZE = -O2
@@ -46,7 +43,7 @@ PLIST_CBITS = ocfsplist.c
PLIST_CFILES = $(PLIST_CBITS) plistmodule.c
PLIST_HFILES = $(subst .c,.h,$(PLIST_CBITS))
-ocfsplist_CPPFLAGS = $(OCFS2_CPPFLAGS) $(GLIB_CPPFLAGS) $(BLKID_CFLAGS)
+ocfsplist_CPPFLAGS = $(GLIB_CPPFLAGS) $(BLKID_CFLAGS)
plistmodule_CPPFLAGS = $(GLIB_CPPFLAGS)
plistmodule_CFLAGS = $(PYMOD_CFLAGS)
diff --git a/ocfs2console/ocfs2interface/ocfs2module.c b/ocfs2console/ocfs2interface/ocfs2module.c
index d860cf0..9a4815c 100644
--- a/ocfs2console/ocfs2interface/ocfs2module.c
+++ b/ocfs2console/ocfs2interface/ocfs2module.c
@@ -30,7 +30,7 @@
#include <uuid/uuid.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#define Filesystem_Check(op) PyObject_TypeCheck(op, &Filesystem_Type)
diff --git a/ocfs2console/ocfs2interface/ocfsplist.c b/ocfs2console/ocfs2interface/ocfsplist.c
index f93f2b3..aab8d75 100644
--- a/ocfs2console/ocfs2interface/ocfsplist.c
+++ b/ocfs2console/ocfs2interface/ocfsplist.c
@@ -33,7 +33,7 @@
#include <glib.h>
-#include "ocfs2.h"
+#include "ocfs2/ocfs2.h"
#include <blkid/blkid.h>
diff --git a/sizetest/Makefile b/sizetest/Makefile
index ceacea3..23df530 100644
--- a/sizetest/Makefile
+++ b/sizetest/Makefile
@@ -15,8 +15,8 @@ CFLAGS = $(OPTS) $(WARNINGS)
UNINST_PROGRAMS = sizetest.ocfs2
-INCLUDES = -I$(TOPDIR)/include -I$(TOPDIR)/libocfs2/include
-DEFINES = -DOCFS2_FLAT_INCLUDES -DVERSION=\"$(VERSION)\"
+INCLUDES = -I$(TOPDIR)/include
+DEFINES = -DVERSION=\"$(VERSION)\"
CFILES = sizetest.c
OBJS = $(subst .c,.o,$(CFILES))
diff --git a/sizetest/sizetest.c b/sizetest/sizetest.c
index 4e43a9a..0b24031 100644
--- a/sizetest/sizetest.c
+++ b/sizetest/sizetest.c
@@ -24,7 +24,7 @@
*/
-#include <ocfs2.h>
+#include "ocfs2/ocfs2.h"
#undef offsetof
diff --git a/tunefs.ocfs2/Makefile b/tunefs.ocfs2/Makefile
index 55e653d..e062dfb 100644
--- a/tunefs.ocfs2/Makefile
+++ b/tunefs.ocfs2/Makefile
@@ -25,9 +25,9 @@ LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
sbindir = $(root_sbindir)
SBIN_PROGRAMS = tunefs.ocfs2
-INCLUDES = -I$(TOPDIR)/include -I$(TOPDIR)/libocfs2/include -I.
+INCLUDES = -I$(TOPDIR)/include -I.
INCLUDES += $(GLIB_CFLAGS)
-DEFINES = -DOCFS2_FLAT_INCLUDES -DVERSION=\"$(VERSION)\"
+DEFINES = -DVERSION=\"$(VERSION)\"
MANS = tunefs.ocfs2.8
diff --git a/tunefs.ocfs2/features.c b/tunefs.ocfs2/features.c
index 856e833..2208269 100644
--- a/tunefs.ocfs2/features.c
+++ b/tunefs.ocfs2/features.c
@@ -21,7 +21,7 @@
* Boston, MA 021110-1307, USA.
*
*/
-#include <ocfs2.h>
+#include <ocfs2/ocfs2.h>
#include <assert.h>
diff --git a/tunefs.ocfs2/remove_slot.c b/tunefs.ocfs2/remove_slot.c
index 1e4238a..ed4d460 100644
--- a/tunefs.ocfs2/remove_slot.c
+++ b/tunefs.ocfs2/remove_slot.c
@@ -23,8 +23,6 @@
*/
#include <inttypes.h>
-#include <bitops.h>
-#include <ocfs2.h>
#include <assert.h>
diff --git a/tunefs.ocfs2/sparse_file.c b/tunefs.ocfs2/sparse_file.c
index 07e593f..9b9e0d9 100644
--- a/tunefs.ocfs2/sparse_file.c
+++ b/tunefs.ocfs2/sparse_file.c
@@ -22,7 +22,7 @@
*
*/
-#include <kernel-rbtree.h>
+#include <ocfs2/kernel-rbtree.h>
#include <tunefs.h>
#include <assert.h>
diff --git a/tunefs.ocfs2/tunefs.c b/tunefs.ocfs2/tunefs.c
index fbcee4a..03976fe 100644
--- a/tunefs.ocfs2/tunefs.c
+++ b/tunefs.ocfs2/tunefs.c
@@ -24,7 +24,7 @@
*/
#include <tunefs.h>
-#include <feature_string.h>
+#include <ocfs2/feature_string.h>
ocfs2_tune_opts opts;
ocfs2_filesys *fs_gbl = NULL;
diff --git a/tunefs.ocfs2/tunefs.h b/tunefs.ocfs2/tunefs.h
index 3c110c6..4f523b7 100644
--- a/tunefs.ocfs2/tunefs.h
+++ b/tunefs.ocfs2/tunefs.h
@@ -48,10 +48,8 @@
#include <signal.h>
#include <uuid/uuid.h>
-#include <ocfs2.h>
-#include <bitops.h>
-
-#include <jbd.h>
+#include "ocfs2/ocfs2.h"
+#include "ocfs2/bitops.h"
#define SYSTEM_FILE_NAME_MAX 40
--
1.5.2.2
More information about the Ocfs2-tools-devel
mailing list