[Fscat-commits] jlbec commits r69 - trunk

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Sep 4 12:02:18 PDT 2007


Author: jlbec
Date: 2007-09-04 12:02:17 -0700 (Tue, 04 Sep 2007)
New Revision: 69

Modified:
   trunk/Makefile
   trunk/configure.in
   trunk/ocfs2.c
Log:

Bring the ocfs2 driver up to date with the modern libocfs2.  This includes
directly naming the structures ("struct ocfs2_dinode" vs "ocfs2_dinode")
and expecting the includes to be installed (usually via the
ocfs2-tools-devel package.

Also, check for some caching functions.  The functions are recent enought
that we don't want to assume either way, we just want to use what is
available.



Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2007-09-04 19:00:03 UTC (rev 68)
+++ trunk/Makefile	2007-09-04 19:02:17 UTC (rev 69)
@@ -54,18 +54,8 @@
 
 DEFINES = -DVERSION=\"$(VERSION)\" $(DEFS)
 
-OCFS2_DEFINES = -DO2CB_FLAT_INCLUDES -DO2DLM_FLAT_INCLUDES -DOCFS2_FLAT_INCLUDES 
+OCFS2_LIBS = -locfs2 -lo2dlm -lo2cb
 
-OCFS2_INCLUDES =				\
-	-I$(OCFS2_TOOLS_PATH)/libo2cb/include	\
-	-I$(OCFS2_TOOLS_PATH)/libo2dlm/include	\
-	-I$(OCFS2_TOOLS_PATH)/libocfs2/include
-OCFS2_LIBS =				\
-	-L$(OCFS2_TOOLS_PATH)/libo2cb	\
-	-L$(OCFS2_TOOLS_PATH)/libo2dlm	\
-	-L$(OCFS2_TOOLS_PATH)/libocfs2	\
-	-locfs2 -lo2dlm -lo2cb
-
 EXT2_INCLUDES =
 EXT2_LIBS = -lext2fs
 
@@ -155,7 +145,6 @@
 dist-subdircreate:
 	$(TOPDIR)/mkinstalldirs $(DIST_DIR)/debian
 
-ocfs2_CPPFLAGS = $(OCFS2_DEFINES) $(OCFS2_INCLUDES)
 fscat_driver.ocfs2: $(FSCAT_DRIVER_OCFS2_OBJS) $(FSCAT_NATIVE_OBJS)
 	$(LINK) $(OCFS2_LIBS) $(COM_ERR_LIBS)
 

Modified: trunk/configure.in
===================================================================
--- trunk/configure.in	2007-09-04 19:00:03 UTC (rev 68)
+++ trunk/configure.in	2007-09-04 19:02:17 UTC (rev 69)
@@ -86,16 +86,12 @@
   AC_MSG_ERROR([Unable to find com_err headers]))
 AC_SUBST(COM_ERR_LIBS)
 
-AC_ARG_WITH([ocfs2-tools], [  --with-ocfs2-tools=PATH directory with compiled ocfs2-tools source], OCFS2_TOOLS_PATH=$withval, OCFS2_TOOLS_PATH="")
+dnl AC_ARG_WITH([ocfs2-tools], [  --with-ocfs2-tools=PATH directory with compiled ocfs2-tools source], OCFS2_TOOLS_PATH=$withval, OCFS2_TOOLS_PATH="")
 
-oldldflags="$LDFLAGS"
-oldcppflags="$CPPFLAGS"
 oldlibs="$LIBS"
-CPPFLAGS="$CPPFLAGS -DO2CB_FLAT_INCLUDES -DO2DLM_FLAT_INCLUDES -DOCFS2_FLAT_INCLUDES -I${OCFS2_TOOLS_PATH}/libocfs2/include -I${OCFS2_TOOLS_PATH}/libo2dlm/include -I${OCFS2_TOOLS_PATH}/libo2cb/include"
-LDFLAGS="$LDFLAGS -L${OCFS2_TOOLS_PATH}/libocfs2 -L${OCFS2_TOOLS_PATH}/libo2dlm -L${OCFS2_TOOLS_PATH}/libo2cb"
 LIBS="-locfs2 -lo2dlm -lo2cb ${COM_ERR_LIBS}"
 AC_MSG_CHECKING(for OCFS2 libraries)
-AC_LINK_IFELSE(AC_LANG_PROGRAM([[#include "ocfs2.h"]],
+AC_LINK_IFELSE(AC_LANG_PROGRAM([[#include <ocfs2/ocfs2.h>]],
 [[
 initialize_ocfs_error_table();
 initialize_o2dl_error_table();
@@ -109,10 +105,12 @@
   AC_MSG_RESULT(no)
   ENABLE_OCFS2=
 ])
-CPPFLAGS="$oldcppflags"
-LDFLAGS="$oldldflags"
+if test "x$ENABLE_OCFS2" = "xyes"; then
+    AC_CHECK_FUNCS([ocfs2_extent_map_init, io_init_cache])
+fi
+
 LIBS="$oldlibs"
-AC_SUBST(OCFS2_TOOLS_PATH)
+dnl AC_SUBST(OCFS2_TOOLS_PATH)
 AC_SUBST(ENABLE_OCFS2)
 
 AC_CHECK_LIB(ext2fs, ext2fs_open,

Modified: trunk/ocfs2.c
===================================================================
--- trunk/ocfs2.c	2007-09-04 19:00:03 UTC (rev 68)
+++ trunk/ocfs2.c	2007-09-04 19:02:17 UTC (rev 69)
@@ -35,7 +35,7 @@
 #include <inttypes.h>
 
 #include "native.h"
-#include "ocfs2.h"
+#include <ocfs2/ocfs2.h>
 
 #define PROGNAME "fscat_driver.ocfs2"
 
@@ -266,9 +266,10 @@
 	uint64_t offset = 0;
 	uint64_t i_size = ci->ci_inode->i_size;
 	int buf_len = (1024 * 1024);  /* 1MB is a nice buffer */
-	int count;
+	uint32_t count;
 	char *buf;
 
+#if HAVE_OCFS2_EXTENT_MAP_INIT
 	ret = ocfs2_extent_map_init(fs, ci);
 	if (ret) {
 		com_err(PROGNAME, ret,
@@ -276,6 +277,7 @@
 			ci->ci_blkno);
 		return -EIO;
 	}
+#endif
 
 	count = ocfs2_blocks_in_bytes(fs, buf_len);
 
@@ -319,9 +321,10 @@
 	uint64_t offset = 0;
 	uint64_t i_size = ci->ci_inode->i_size;
 	int buf_len = PATH_MAX;
-	int count;
+	uint32_t count;
 	char *buf;
 
+#if HAVE_OCFS2_EXTENT_MAP_INIT
 	ret = ocfs2_extent_map_init(fs, ci);
 	if (ret) {
 		com_err(PROGNAME, ret,
@@ -329,6 +332,7 @@
 			ci->ci_blkno);
 		return -EIO;
 	}
+#endif
 
 	count = ocfs2_blocks_in_bytes(fs, buf_len);
 
@@ -362,7 +366,7 @@
 		       ocfs2_cached_inode *ci)
 {
 	int rc = 0;
-	ocfs2_dinode *di = ci->ci_inode;
+	struct ocfs2_dinode *di = ci->ci_inode;
 
 	if (di->i_clusters) {
 		rc = dump_link(inode, fs, ci);
@@ -393,7 +397,7 @@
 	int mode;
 	errcode_t ret;
 	ocfs2_cached_inode *ci = NULL;
-	ocfs2_dinode *di;
+	struct ocfs2_dinode *di;
 
 	ret = ocfs2_read_cached_inode(fs, inode->i_ino, &ci);
 	if (ret) {
@@ -568,6 +572,17 @@
 		goto out;
 	}
 
+#if HAVE_IO_INIT_CACHE
+	ret = io_init_cache(fs->fs_io, 100);
+	if (ret) {
+		rc = -ENOMEM;
+		com_err(PROGNAME, ret,
+			"while initializing I/O cache");
+		ocfs2_close(fs);
+		goto out;
+	}
+#endif
+
 	switch (op) {
 		case OP_LIST:
 			rc = list_files(fs);




More information about the Fscat-commits mailing list