Whamcloud - gitweb
1. Remove $platform/lustre_idl.h, move include/lustre_lib.h to
authorliangzhen <liangzhen>
Fri, 3 Mar 2006 05:50:25 +0000 (05:50 +0000)
committerliangzhen <liangzhen>
Fri, 3 Mar 2006 05:50:25 +0000 (05:50 +0000)
   include/lustre/lustre_idl.h. relevant change to lustre.spec.in
   and Makefile
2. Fix define of IOC for BSD.

43 files changed:
lustre/include/Makefile.am
lustre/include/darwin/lustre_idl.h [deleted file]
lustre/include/darwin/lustre_mds.h
lustre/include/darwin/lustre_types.h
lustre/include/liblustre.h
lustre/include/linux/Makefile.am
lustre/include/linux/lustre_idl.h [deleted file]
lustre/include/linux/lustre_lite.h
lustre/include/linux/lustre_types.h
lustre/include/lustre/Makefile.am
lustre/include/lustre/lustre_idl.h [new file with mode: 0644]
lustre/include/lustre_export.h
lustre/include/lustre_import.h
lustre/include/lustre_lib.h
lustre/include/lustre_log.h
lustre/include/lustre_mds.h
lustre/include/lustre_net.h
lustre/include/lustre_quota.h
lustre/include/obd.h
lustre/include/obd_class.h
lustre/llite/dcache.c
lustre/llite/dir.c
lustre/lov/lov_ea.c
lustre/lov/lov_log.c
lustre/lov/lov_obd.c
lustre/lov/lov_request.c
lustre/mdc/mdc_lib.c
lustre/mds/mds_join.c
lustre/mds/mds_lov.c
lustre/mds/mds_reint.c
lustre/mds/mds_xattr.c
lustre/obdclass/darwin/darwin-module.c
lustre/obdclass/linux/linux-obdo.c
lustre/obdclass/obdo.c
lustre/ptlrpc/lproc_ptlrpc.c
lustre/utils/lfs.c
lustre/utils/llog_reader.c
lustre/utils/lustre_cfg.c
lustre/utils/obdctl.h
lustre/utils/obdiolib.h
lustre/utils/wirecheck.c
lustre/utils/wirehdr.c
lustre/utils/wiretest.c

index 82850e4..15dfc44 100644 (file)
@@ -6,17 +6,11 @@
 
 SUBDIRS = linux lustre
 
-lustredir = $(includedir)
-
-if UTILS
-lustre_HEADERS = lustre_idl.h
-endif
-
-EXTRA_DIST = ioctl.h liblustre.h lprocfs_status.h lustre_cfg.h \
-            lustre_commit_confd.h lustre_debug.h lustre_dlm.h \
-            lustre_export.h lustre_fsfilt.h lustre_ha.h       \
-            lustre_handles.h lustre_idl.h lustre_import.h     \
-            lustre_lib.h lustre_lite.h lustre_log.h lustre_mds.h\
+EXTRA_DIST = ioctl.h liblustre.h lprocfs_status.h lustre_cfg.h         \
+            lustre_commit_confd.h lustre_debug.h lustre_dlm.h  \
+            lustre_export.h lustre_fsfilt.h lustre_ha.h        \
+            lustre_handles.h lustre_import.h lustre_lib.h      \
+            lustre_lite.h lustre_log.h lustre_mds.h            \
             lustre_net.h lustre_quota.h lustre_ucache.h lvfs.h \
             obd_cache.h obd_class.h obd_echo.h obd.h obd_lov.h \
             obd_ost.h obd_support.h lustre_ver.h
diff --git a/lustre/include/darwin/lustre_idl.h b/lustre/include/darwin/lustre_idl.h
deleted file mode 100644 (file)
index edbace7..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre 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 Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef _DARWIN_LUSTRE_IDL_H_
-#define _DARWIN_LUSTRE_IDL_H_
-
-#ifndef _LUSTRE_IDL_H_
-#error Do not #include this file directly. #include <lustre_idl.h> instead
-#endif
-
-#include <string.h>
-#include <libcfs/libcfs.h>
-#include <libcfs/list.h>
-
-#endif
index d6309f7..7fd8549 100644 (file)
  *   You should have received a copy of the GNU General Public License
  *   along with Lustre; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * MDS data structures.
- * See also lustre_idl.h for wire formats of requests.
- *
  */
 
 #ifndef _DARWIN_LUSTRE_MDS_H
index 548ab38..651cf2d 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _LUSTRE_DARWIN_TYPES_H
 #define _LUSTRE_DARWIN_TYPES_H
 
+#include <string.h>
 #include <libcfs/libcfs.h>
 
 #endif
index 7b4df89..b28eb28 100644 (file)
@@ -875,7 +875,7 @@ void posix_acl_release(struct posix_acl *acl)
 #endif
 
 #include <obd_support.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_lib.h>
 #include <lustre_import.h>
 #include <lustre_export.h>
index 3f5303e..1f6af34 100644 (file)
@@ -6,11 +6,11 @@
 linuxdir = $(includedir)/linux
 
 if UTILS
-linux_HEADERS = lustre_idl.h lustre_types.h lustre_user.h
+linux_HEADERS = lustre_types.h lustre_user.h
 endif
 
 EXTRA_DIST = lprocfs_status.h lustre_debug.h lustre_lib.h \
   lustre_dlm.h lustre_handles.h lustre_net.h obd_class.h obd_support.h  \
   lustre_log.h lustre_compat25.h lustre_fsfilt.h lustre_mds.h obd.h \
-  lvfs.h lvfs_linux.h lustre_lite.h  lustre_idl.h lustre_quota.h \
+  lvfs.h lvfs_linux.h lustre_lite.h  lustre_quota.h \
   lustre_disk.h lustre_user.h lustre_types.h
diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h
deleted file mode 100644 (file)
index 0e77cda..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *   This file is part of Lustre, http://www.lustre.org
- *
- * Lustre wire protocol definitions.
- *
- * All structs passing over the wire should be declared here (lov_mds_md
- * being the lone exception).  Structs must be properly aligned to put
- * 64-bit values on an 8-byte boundary.  Any structs being added here
- * must also be added to utils/wirecheck.c and "make newwiretest" run
- * to regenerate the utils/wiretest.c sources.  This allows us to verify
- * that wire structs have the proper alignment/size on all architectures.
- *
- * We assume all nodes are either little-endian or big-endian, and we
- * always send messages in the sender's native format.  The receiver
- * detects the message format by checking the 'magic' field of the message
- * (see lustre_msg_swabbed() below).
- *
- * Each wire type has corresponding 'lustre_swab_xxxtypexxx()' routines,
- * implemented either here, inline (trivial implementations) or in
- * ptlrpc/pack_generic.c.  These 'swabbers' convert the type from "other"
- * endian, in-place in the message buffer.
- *
- * A swabber takes a single pointer argument.  The caller must already have
- * verified that the length of the message buffer >= sizeof (type).
- *
- * For variable length types, a second 'lustre_swab_v_xxxtypexxx()' routine
- * may be defined that swabs just the variable part, after the caller has
- * verified that the message buffer is large enough.
- */
-
-#ifndef _LINUX_LUSTRE_IDL_H_
-#define _LINUX_LUSTRE_IDL_H_
-
-#ifndef _LUSTRE_IDL_H_
-#error Do not #include this file directly. #include <lustre_idl.h> instead
-#endif
-
-#ifdef HAVE_ASM_TYPES_H
-#include <asm/types.h>
-#else
-#include <lustre/types.h>
-#endif
-
-#ifdef __KERNEL__
-# include <linux/types.h>
-# include <linux/fs.h>    /* to check for FMODE_EXEC, dev_t, lest we redefine */
-#else
-#ifdef __CYGWIN__
-# include <sys/types.h>
-#elif defined(_AIX)
-# include <inttypes.h>
-#else
-# include <stdint.h>
-#endif
-#endif
-
-#endif
index e741b3d..17f4546 100644 (file)
@@ -69,7 +69,7 @@ enum {
 };
 
 #else
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #endif /* __KERNEL__ */
 
 #endif
index 5737ed9..8f724c8 100644 (file)
@@ -1,6 +1,23 @@
 #ifndef _LUSTRE_LINUX_TYPES_H
 #define _LUSTRE_LINUX_TYPES_H
 
+#ifdef HAVE_ASM_TYPES_H
+#include <asm/types.h>
+#endif
+
+#ifdef __KERNEL__
+# include <linux/types.h>
+# include <linux/fs.h>    /* to check for FMODE_EXEC, dev_t, lest we redefine */
+#else
+#ifdef __CYGWIN__
+# include <sys/types.h>
+#elif defined(_AIX)
+# include <inttypes.h>
+#else
+# include <stdint.h>
+#endif
+#endif
+
 #if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
      !defined(_EXT2_TYPES_H) && !defined(_I386_TYPES_H) && \
      !defined(_X86_64_TYPES_H))
index 1580bde..0acd90f 100644 (file)
@@ -4,7 +4,7 @@
 # See the file COPYING in this distribution
 
 if UTILS
-pkginclude_HEADERS = lustre_user.h liblustreapi.h types.h
+pkginclude_HEADERS = lustre_idl.h lustre_user.h liblustreapi.h types.h
 endif
 
-EXTRA_DIST = lustre_user.h liblustreapi.h types.h
+EXTRA_DIST = lustre_idl.h lustre_user.h liblustreapi.h types.h
diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h
new file mode 100644 (file)
index 0000000..cc1ed9a
--- /dev/null
@@ -0,0 +1,1250 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *   This file is part of Lustre, http://www.lustre.org
+ *
+ * Lustre wire protocol definitions.
+ *
+ * All structs passing over the wire should be declared here (lov_mds_md
+ * being the lone exception).  Structs must be properly aligned to put
+ * 64-bit values on an 8-byte boundary.  Any structs being added here
+ * must also be added to utils/wirecheck.c and "make newwiretest" run
+ * to regenerate the utils/wiretest.c sources.  This allows us to verify
+ * that wire structs have the proper alignment/size on all architectures.
+ *
+ * We assume all nodes are either little-endian or big-endian, and we
+ * always send messages in the sender's native format.  The receiver
+ * detects the message format by checking the 'magic' field of the message
+ * (see lustre_msg_swabbed() below).
+ *
+ * Each wire type has corresponding 'lustre_swab_xxxtypexxx()' routines,
+ * implemented either here, inline (trivial implementations) or in
+ * ptlrpc/pack_generic.c.  These 'swabbers' convert the type from "other"
+ * endian, in-place in the message buffer.
+ *
+ * A swabber takes a single pointer argument.  The caller must already have
+ * verified that the length of the message buffer >= sizeof (type).
+ *
+ * For variable length types, a second 'lustre_swab_v_xxxtypexxx()' routine
+ * may be defined that swabs just the variable part, after the caller has
+ * verified that the message buffer is large enough.
+ */
+
+#ifndef _LUSTRE_IDL_H_
+#define _LUSTRE_IDL_H_
+
+#if defined(__linux__)
+#include <linux/lustre_types.h>
+#elif defined(__APPLE__)
+#include <darwin/lustre_types.h>
+#elif defined(__WINNT__)
+#include <winnt/lustre_types.h>
+#else
+#error Unsupported operating system.
+#endif
+
+/* Defn's shared with user-space. */
+#include <lustre/lustre_user.h>
+
+/*
+ * this file contains all data structures used in Lustre interfaces:
+ * - obdo and obd_request records
+ * - mds_request records
+ * - ldlm data
+ * - ioctl's
+ */
+
+/*
+ *  GENERAL STUFF
+ */
+/* FOO_REQUEST_PORTAL is for incoming requests on the FOO
+ * FOO_REPLY_PORTAL   is for incoming replies on the FOO
+ * FOO_BULK_PORTAL    is for incoming bulk on the FOO
+ */
+
+#define CONNMGR_REQUEST_PORTAL          1
+#define CONNMGR_REPLY_PORTAL            2
+//#define OSC_REQUEST_PORTAL            3
+#define OSC_REPLY_PORTAL                4
+//#define OSC_BULK_PORTAL               5
+#define OST_IO_PORTAL                   6
+#define OST_CREATE_PORTAL               7
+#define OST_BULK_PORTAL                 8
+//#define MDC_REQUEST_PORTAL            9
+#define MDC_REPLY_PORTAL               10
+//#define MDC_BULK_PORTAL              11
+#define MDS_REQUEST_PORTAL             12
+//#define MDS_REPLY_PORTAL             13
+#define MDS_BULK_PORTAL                14
+#define LDLM_CB_REQUEST_PORTAL         15
+#define LDLM_CB_REPLY_PORTAL           16
+#define LDLM_CANCEL_REQUEST_PORTAL     17
+#define LDLM_CANCEL_REPLY_PORTAL       18
+//#define PTLBD_REQUEST_PORTAL           19
+//#define PTLBD_REPLY_PORTAL             20
+//#define PTLBD_BULK_PORTAL              21
+#define MDS_SETATTR_PORTAL             22
+#define MDS_READPAGE_PORTAL            23
+
+#define OST_REQUEST_PORTAL             28
+
+#define SVC_KILLED               1
+#define SVC_EVENT                2
+#define SVC_SIGNAL               4
+#define SVC_RUNNING              8
+#define SVC_STOPPING            16
+#define SVC_STOPPED             32
+
+/* packet types */
+#define PTL_RPC_MSG_REQUEST 4711
+#define PTL_RPC_MSG_ERR     4712
+#define PTL_RPC_MSG_REPLY   4713
+
+#define PTLRPC_MSG_MAGIC    0x0BD00BD0
+
+
+#define PTLRPC_MSG_VERSION  0x00000003
+#define LUSTRE_VERSION_MASK 0xffff0000
+#define LUSTRE_OBD_VERSION  0x00010000
+#define LUSTRE_MDS_VERSION  0x00020000
+#define LUSTRE_OST_VERSION  0x00030000
+#define LUSTRE_DLM_VERSION  0x00040000
+#define LUSTRE_LOG_VERSION  0x00050000
+
+struct lustre_handle {
+        __u64 cookie;
+};
+#define DEAD_HANDLE_MAGIC 0xdeadbeefcafebabeULL
+
+static inline int lustre_handle_is_used(struct lustre_handle *lh)
+{
+        return lh->cookie != 0ull;
+}
+
+static inline int lustre_handle_equal(struct lustre_handle *lh1,
+                                      struct lustre_handle *lh2)
+{
+        return lh1->cookie == lh2->cookie;
+}
+
+static inline void lustre_handle_copy(struct lustre_handle *tgt,
+                                      struct lustre_handle *src)
+{
+        tgt->cookie = src->cookie;
+}
+
+/* we depend on this structure to be 8-byte aligned */
+/* this type is only endian-adjusted in lustre_unpack_msg() */
+struct lustre_msg {
+        struct lustre_handle handle;
+        __u32 magic;
+        __u32 type;
+        __u32 version;
+        __u32 opc;
+        __u64 last_xid;
+        __u64 last_committed;
+        __u64 transno;
+        __u32 status;
+        __u32 flags;
+        __u32 conn_cnt;
+        __u32 bufcount;
+        __u32 buflens[0];
+};
+
+/* Flags that are operation-specific go in the top 16 bits. */
+#define MSG_OP_FLAG_MASK   0xffff0000
+#define MSG_OP_FLAG_SHIFT  16
+
+/* Flags that apply to all requests are in the bottom 16 bits */
+#define MSG_GEN_FLAG_MASK      0x0000ffff
+#define MSG_LAST_REPLAY        1
+#define MSG_RESENT             2
+#define MSG_REPLAY             4
+
+static inline int lustre_msg_get_flags(struct lustre_msg *msg)
+{
+        return (msg->flags & MSG_GEN_FLAG_MASK);
+}
+
+static inline void lustre_msg_add_flags(struct lustre_msg *msg, int flags)
+{
+        msg->flags |= MSG_GEN_FLAG_MASK & flags;
+}
+
+static inline void lustre_msg_set_flags(struct lustre_msg *msg, int flags)
+{
+        msg->flags &= ~MSG_GEN_FLAG_MASK;
+        lustre_msg_add_flags(msg, flags);
+}
+
+static inline void lustre_msg_clear_flags(struct lustre_msg *msg, int flags)
+{
+        msg->flags &= ~(MSG_GEN_FLAG_MASK & flags);
+}
+
+static inline int lustre_msg_get_op_flags(struct lustre_msg *msg)
+{
+        return (msg->flags >> MSG_OP_FLAG_SHIFT);
+}
+
+static inline void lustre_msg_add_op_flags(struct lustre_msg *msg, int flags)
+{
+        msg->flags |= ((flags & MSG_GEN_FLAG_MASK) << MSG_OP_FLAG_SHIFT);
+}
+
+static inline void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags)
+{
+        msg->flags &= ~MSG_OP_FLAG_MASK;
+        lustre_msg_add_op_flags(msg, flags);
+}
+
+/*
+ * Flags for all connect opcodes (MDS_CONNECT, OST_CONNECT)
+ */
+
+#define MSG_CONNECT_RECOVERING  0x1
+#define MSG_CONNECT_RECONNECT   0x2
+#define MSG_CONNECT_REPLAYABLE  0x4
+//#define MSG_CONNECT_PEER        0x8
+#define MSG_CONNECT_LIBCLIENT   0x10
+#define MSG_CONNECT_INITIAL     0x20
+#define MSG_CONNECT_ASYNC       0x40
+
+/* Connect flags */
+#define OBD_CONNECT_RDONLY       0x1ULL /* client allowed read-only access */
+#define OBD_CONNECT_INDEX        0x2ULL /* connect to specific LOV idx */
+#define OBD_CONNECT_GRANT        0x8ULL /* OSC acquires grant at connect */
+#define OBD_CONNECT_SRVLOCK     0x10ULL /* server takes locks for client */
+#define OBD_CONNECT_VERSION     0x20ULL /* Server supports versions in ocd */
+#define OBD_CONNECT_REQPORTAL   0x40ULL /* Separate portal for non-IO reqs */
+#define OBD_CONNECT_ACL         0x80ULL /* client using access control lists */
+#define OBD_CONNECT_XATTR      0x100ULL /* client using extended attributes*/
+#define OBD_CONNECT_CROW       0x200ULL /* MDS+OST do object create-on-write */
+#define OBD_CONNECT_TRUNCLOCK  0x400ULL /* server gets locks for punch b=9528 */
+#define OBD_CONNECT_TRANSNO    0x800ULL /* replay is sending initial transno */
+#define OBD_CONNECT_IBITS     0x1000ULL /* support for inodebits locks */
+#define OBD_CONNECT_JOIN      0x2000ULL /* files can be concatenated */
+/* also update obd_connect_names[] for lprocfs_rd_connect_flags() */
+
+#define MDS_CONNECT_SUPPORTED  (OBD_CONNECT_RDONLY | OBD_CONNECT_VERSION | \
+                                OBD_CONNECT_ACL | OBD_CONNECT_XATTR | \
+                                OBD_CONNECT_IBITS | OBD_CONNECT_JOIN)
+#define OST_CONNECT_SUPPORTED  (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
+                                OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
+                                OBD_CONNECT_TRUNCLOCK | OBD_CONNECT_INDEX)
+#define ECHO_CONNECT_SUPPORTED (0)
+
+#define OBD_OCD_VERSION(major,minor,patch,fix) (((major)<<24) + ((minor)<<16) +\
+                                                ((patch)<<8) + (fix))
+#define OBD_OCD_VERSION_MAJOR(version) ((int)((version)>>24)&255)
+#define OBD_OCD_VERSION_MINOR(version) ((int)((version)>>16)&255)
+#define OBD_OCD_VERSION_PATCH(version) ((int)((version)>>8)&255)
+#define OBD_OCD_VERSION_FIX(version)   ((int)(version)&255)
+
+/* This structure is used for both request and reply.
+ *
+ * If we eventually have separate connect data for different types, which we
+ * almost certainly will, then perhaps we stick a union in here. */
+struct obd_connect_data {
+        __u64 ocd_connect_flags;        /* OBD_CONNECT_* per above */
+        __u32 ocd_version;              /* lustre release version number */
+        __u32 ocd_grant;                /* initial cache grant amount (bytes) */
+        __u32 ocd_index;                /* LOV index to connect to */
+        __u32 ocd_unused;
+        __u64 ocd_ibits_known;          /* inode bits this client understands */
+        __u64 padding2;                 /* also fix lustre_swab_connect */
+        __u64 padding3;                 /* also fix lustre_swab_connect */
+        __u64 padding4;                 /* also fix lustre_swab_connect */
+        __u64 padding5;                 /* also fix lustre_swab_connect */
+        __u64 padding6;                 /* also fix lustre_swab_connect */
+};
+
+extern void lustre_swab_connect(struct obd_connect_data *ocd);
+
+/*
+ *   OST requests: OBDO & OBD request records
+ */
+
+/* opcodes */
+typedef enum {
+        OST_REPLY      =  0,       /* reply ? */
+        OST_GETATTR    =  1,
+        OST_SETATTR    =  2,
+        OST_READ       =  3,
+        OST_WRITE      =  4,
+        OST_CREATE     =  5,
+        OST_DESTROY    =  6,
+        OST_GET_INFO   =  7,
+        OST_CONNECT    =  8,
+        OST_DISCONNECT =  9,
+        OST_PUNCH      = 10,
+        OST_OPEN       = 11,
+        OST_CLOSE      = 12,
+        OST_STATFS     = 13,
+        OST_SAN_READ   = 14,
+        OST_SAN_WRITE  = 15,
+        OST_SYNC       = 16,
+        OST_SET_INFO   = 17,
+        OST_QUOTACHECK = 18,
+        OST_QUOTACTL   = 19,
+        OST_LAST_OPC
+} ost_cmd_t;
+#define OST_FIRST_OPC  OST_REPLY
+
+typedef uint64_t        obd_id;
+typedef uint64_t        obd_gr;
+typedef uint64_t        obd_time;
+typedef uint64_t        obd_size;
+typedef uint64_t        obd_off;
+typedef uint64_t        obd_blocks;
+typedef uint32_t        obd_blksize;
+typedef uint32_t        obd_mode;
+typedef uint32_t        obd_uid;
+typedef uint32_t        obd_gid;
+typedef uint32_t        obd_flag;
+typedef uint64_t        obd_valid;
+typedef uint32_t        obd_count;
+
+#define OBD_FL_INLINEDATA    (0x00000001)
+#define OBD_FL_OBDMDEXISTS   (0x00000002)
+#define OBD_FL_DELORPHAN     (0x00000004) /* if set in o_flags delete orphans */
+#define OBD_FL_NORPC         (0x00000008) /* set in o_flags do in OSC not OST */
+#define OBD_FL_IDONLY        (0x00000010) /* set in o_flags only adjust obj id*/
+#define OBD_FL_RECREATE_OBJS (0x00000020) /* recreate missing obj */
+#define OBD_FL_DEBUG_CHECK   (0x00000040) /* echo client/server debug check */
+#define OBD_FL_NO_USRQUOTA   (0x00000100) /* the object's owner is over quota */
+#define OBD_FL_NO_GRPQUOTA   (0x00000200) /* the object's group is over quota */
+#define OBD_FL_CREATE_CROW   (0x00000400) /* object should be create on write */
+
+/*
+ * set this to delegate DLM locking during obd_punch() to the OSTs. Only OSTs
+ * that declared OBD_CONNECT_TRUNCLOCK in their connect flags support this
+ * functionality.
+ */
+#define OBD_FL_TRUNCLOCK     (0x00000800)
+
+/* this should be not smaller than sizeof(struct lustre_handle) + sizeof(struct
+ * llog_cookie) + sizeof(ll_fid). Nevertheless struct ll_fid is not longer
+ * stored in o_inline, we keep this just for case. */
+#define OBD_INLINESZ    80
+
+/* Note: 64-bit types are 64-bit aligned in structure */
+struct obdo {
+        obd_valid               o_valid;        /* hot fields in this obdo */
+        obd_id                  o_id;
+        obd_gr                  o_gr;
+        obd_id                  o_fid;
+        obd_size                o_size;         /* o_size-o_blocks == ost_lvb */
+        obd_time                o_mtime;
+        obd_time                o_atime;
+        obd_time                o_ctime;
+        obd_blocks              o_blocks;       /* brw: cli sent cached bytes */
+        obd_size                o_grant;
+
+        /* 32-bit fields start here: keep an even number of them via padding */
+        obd_blksize             o_blksize;      /* optimal IO blocksize */
+        obd_mode                o_mode;         /* brw: cli sent cache remain */
+        obd_uid                 o_uid;
+        obd_gid                 o_gid;
+        obd_flag                o_flags;
+        obd_count               o_nlink;        /* brw: checksum */
+        obd_count               o_generation;
+        obd_count               o_misc;         /* brw: o_dropped */
+        __u32                   o_easize;       /* epoch in ost writes */
+        __u32                   o_mds;
+        __u32                   o_stripe_idx;   /* holds stripe idx */
+        __u32                   o_padding_1;
+        char                    o_inline[OBD_INLINESZ]; /* fid in ost writes */
+};
+
+#define o_dirty   o_blocks
+#define o_undirty o_mode
+#define o_dropped o_misc
+#define o_cksum   o_nlink
+
+extern void lustre_swab_obdo (struct obdo *o);
+
+
+#define LOV_MAGIC_V1      0x0BD10BD0
+#define LOV_MAGIC         LOV_MAGIC_V1
+#define LOV_MAGIC_JOIN    0x0BD20BD0
+
+#define LOV_PATTERN_RAID0 0x001   /* stripes are used round-robin */
+#define LOV_PATTERN_RAID1 0x002   /* stripes are mirrors of each other */
+#define LOV_PATTERN_FIRST 0x100   /* first stripe is not in round-robin */
+#define LOV_PATTERN_CMOBD 0x200
+
+#define lov_ost_data lov_ost_data_v1
+struct lov_ost_data_v1 {          /* per-stripe data structure (little-endian)*/
+        __u64 l_object_id;        /* OST object ID */
+        __u64 l_object_gr;        /* OST object group (creating MDS number) */
+        __u32 l_ost_gen;          /* generation of this l_ost_idx */
+        __u32 l_ost_idx;          /* OST index in LOV (lov_tgt_desc->tgts) */
+};
+
+#define lov_mds_md lov_mds_md_v1
+struct lov_mds_md_v1 {            /* LOV EA mds/wire data (little-endian) */
+        __u32 lmm_magic;          /* magic number = LOV_MAGIC_V1 */
+        __u32 lmm_pattern;        /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */
+        __u64 lmm_object_id;      /* LOV object ID */
+        __u64 lmm_object_gr;      /* LOV object group */
+        __u32 lmm_stripe_size;    /* size of stripe in bytes */
+        __u32 lmm_stripe_count;   /* num stripes in use for this object */
+        struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */
+};
+
+
+#define OBD_MD_FLID        (0x00000001ULL) /* object ID */
+#define OBD_MD_FLATIME     (0x00000002ULL) /* access time */
+#define OBD_MD_FLMTIME     (0x00000004ULL) /* data modification time */
+#define OBD_MD_FLCTIME     (0x00000008ULL) /* change time */
+#define OBD_MD_FLSIZE      (0x00000010ULL) /* size */
+#define OBD_MD_FLBLOCKS    (0x00000020ULL) /* allocated blocks count */
+#define OBD_MD_FLBLKSZ     (0x00000040ULL) /* block size */
+#define OBD_MD_FLMODE      (0x00000080ULL) /* access bits (mode & ~S_IFMT) */
+#define OBD_MD_FLTYPE      (0x00000100ULL) /* object type (mode & S_IFMT) */
+#define OBD_MD_FLUID       (0x00000200ULL) /* user ID */
+#define OBD_MD_FLGID       (0x00000400ULL) /* group ID */
+#define OBD_MD_FLFLAGS     (0x00000800ULL) /* flags word */
+#define OBD_MD_FLNLINK     (0x00002000ULL) /* link count */
+#define OBD_MD_FLGENER     (0x00004000ULL) /* generation number */
+#define OBD_MD_FLINLINE    (0x00008000ULL) /* inline data */
+#define OBD_MD_FLRDEV      (0x00010000ULL) /* device number */
+#define OBD_MD_FLEASIZE    (0x00020000ULL) /* extended attribute data */
+#define OBD_MD_LINKNAME    (0x00040000ULL) /* symbolic link target */
+#define OBD_MD_FLHANDLE    (0x00080000ULL) /* file handle */
+#define OBD_MD_FLCKSUM     (0x00100000ULL) /* bulk data checksum */
+#define OBD_MD_FLQOS       (0x00200000ULL) /* quality of service stats */
+#define OBD_MD_FLOSCOPQ    (0x00400000ULL) /* osc opaque data */
+#define OBD_MD_FLCOOKIE    (0x00800000ULL) /* log cancellation cookie */
+#define OBD_MD_FLGROUP     (0x01000000ULL) /* group */
+#define OBD_MD_FLFID       (0x02000000ULL) /* ->ost write inline fid */
+#define OBD_MD_FLEPOCH     (0x04000000ULL) /* ->ost write easize is epoch */
+#define OBD_MD_FLGRANT     (0x08000000ULL) /* ost preallocation space grant */
+#define OBD_MD_FLDIREA     (0x10000000ULL) /* dir's extended attribute data */
+#define OBD_MD_FLUSRQUOTA  (0x20000000ULL) /* over quota flags sent from ost */
+#define OBD_MD_FLGRPQUOTA  (0x40000000ULL) /* over quota flags sent from ost */
+#define OBD_MD_FLMODEASIZE (0x80000000ULL) /* EA size will be changed */
+
+#define OBD_MD_MDS         (0x0000000100000000ULL) /* where an inode lives on */
+#define OBD_MD_REINT       (0x0000000200000000ULL) /* reintegrate oa */
+
+#define OBD_MD_FLXATTR     (0x0000001000000000ULL) /* xattr */
+#define OBD_MD_FLXATTRLS   (0x0000002000000000ULL) /* xattr list */
+#define OBD_MD_FLXATTRRM   (0x0000004000000000ULL) /* xattr remove */
+#define OBD_MD_FLACL       (0x0000008000000000ULL) /* ACL */
+
+#define OBD_MD_FLGETATTR (OBD_MD_FLID    | OBD_MD_FLATIME | OBD_MD_FLMTIME | \
+                          OBD_MD_FLCTIME | OBD_MD_FLSIZE  | OBD_MD_FLBLKSZ | \
+                          OBD_MD_FLMODE  | OBD_MD_FLTYPE  | OBD_MD_FLUID   | \
+                          OBD_MD_FLGID   | OBD_MD_FLFLAGS | OBD_MD_FLNLINK | \
+                          OBD_MD_FLGENER | OBD_MD_FLRDEV  | OBD_MD_FLGROUP)
+
+static inline struct lustre_handle *obdo_handle(struct obdo *oa)
+{
+        return (struct lustre_handle *)oa->o_inline;
+}
+
+static inline struct llog_cookie *obdo_logcookie(struct obdo *oa)
+{
+        return (struct llog_cookie *)(oa->o_inline +
+                                      sizeof(struct lustre_handle));
+}
+/* don't forget obdo_fid which is way down at the bottom so it can
+ * come after the definition of llog_cookie */
+
+struct obd_statfs {
+        __u64           os_type;
+        __u64           os_blocks;
+        __u64           os_bfree;
+        __u64           os_bavail;
+        __u64           os_files;
+        __u64           os_ffree;
+        __u8            os_fsid[40];
+        __u32           os_bsize;
+        __u32           os_namelen;
+        __u64           os_maxbytes;
+        __u32           os_state;       /* positive error code on server */
+        __u32           os_spare1;
+        __u32           os_spare2;
+        __u32           os_spare3;
+        __u32           os_spare4;
+        __u32           os_spare5;
+        __u32           os_spare6;
+        __u32           os_spare7;
+        __u32           os_spare8;
+        __u32           os_spare9;
+};
+
+extern void lustre_swab_obd_statfs (struct obd_statfs *os);
+
+/* ost_body.data values for OST_BRW */
+
+#define OBD_BRW_READ            0x01
+#define OBD_BRW_WRITE           0x02
+#define OBD_BRW_RWMASK          (OBD_BRW_READ | OBD_BRW_WRITE)
+#define OBD_BRW_SYNC            0x08
+#define OBD_BRW_CHECK           0x10
+#define OBD_BRW_FROM_GRANT      0x20 /* the osc manages this under llite */
+#define OBD_BRW_GRANTED         0x40 /* the ost manages this */
+#define OBD_BRW_DROP            0x80 /* drop the page after IO */
+#define OBD_BRW_NOQUOTA        0x100
+#define OBD_BRW_SRVLOCK        0x200 /* Client holds no lock over this page */
+
+#define OBD_OBJECT_EOF 0xffffffffffffffffULL
+
+#define OST_MIN_PRECREATE 32
+#define OST_MAX_PRECREATE 20000
+
+struct obd_ioobj {
+        obd_id               ioo_id;
+        obd_gr               ioo_gr;
+        __u32                ioo_type;
+        __u32                ioo_bufcnt;
+};
+
+extern void lustre_swab_obd_ioobj (struct obd_ioobj *ioo);
+
+/* multiple of 8 bytes => can array */
+struct niobuf_remote {
+        __u64 offset;
+        __u32 len;
+        __u32 flags;
+};
+
+extern void lustre_swab_niobuf_remote (struct niobuf_remote *nbr);
+
+/* request structure for OST's */
+
+struct ost_body {
+        struct  obdo oa;
+};
+
+extern void lustre_swab_ost_body (struct ost_body *b);
+extern void lustre_swab_ost_last_id(obd_id *id);
+
+/* lock value block communicated between the filter and llite */
+
+struct ost_lvb {
+        __u64 lvb_size;
+        __u64 lvb_mtime;
+        __u64 lvb_atime;
+        __u64 lvb_ctime;
+        __u64 lvb_blocks;
+};
+
+extern void lustre_swab_ost_lvb(struct ost_lvb *);
+
+/*
+ *   MDS REQ RECORDS
+ */
+
+/* FIXME: this is different from HEAD, adjust it
+ * while merge GSS */
+#define MDS_REQ_REC_OFF                 0
+
+#define MDS_REQ_INTENT_LOCKREQ_OFF      0
+#define MDS_REQ_INTENT_IT_OFF           1
+#define MDS_REQ_INTENT_REC_OFF          2
+
+/* opcodes */
+typedef enum {
+        MDS_GETATTR      = 33,
+        MDS_GETATTR_NAME = 34,
+        MDS_CLOSE        = 35,
+        MDS_REINT        = 36,
+        MDS_READPAGE     = 37,
+        MDS_CONNECT      = 38,
+        MDS_DISCONNECT   = 39,
+        MDS_GETSTATUS    = 40,
+        MDS_STATFS       = 41,
+        MDS_PIN          = 42,
+        MDS_UNPIN        = 43,
+        MDS_SYNC         = 44,
+        MDS_DONE_WRITING = 45,
+        MDS_SET_INFO     = 46,
+        MDS_QUOTACHECK   = 47,
+        MDS_QUOTACTL     = 48,
+        MDS_GETXATTR     = 49,
+        MDS_SETXATTR     = 50,
+        MDS_LAST_OPC
+} mds_cmd_t;
+
+#define MDS_FIRST_OPC    MDS_GETATTR
+
+/*
+ * Do not exceed 63
+ */
+
+typedef enum {
+        REINT_SETATTR  = 1,
+        REINT_CREATE   = 2,
+        REINT_LINK     = 3,
+        REINT_UNLINK   = 4,
+        REINT_RENAME   = 5,
+        REINT_OPEN     = 6,
+//      REINT_CLOSE    = 7,
+//      REINT_WRITE    = 8,
+        REINT_MAX
+} mds_reint_t;
+
+/* the disposition of the intent outlines what was executed */
+#define DISP_IT_EXECD     0x01
+#define DISP_LOOKUP_EXECD 0x02
+#define DISP_LOOKUP_NEG   0x04
+#define DISP_LOOKUP_POS   0x08
+#define DISP_OPEN_CREATE  0x10
+#define DISP_OPEN_OPEN    0x20
+#define DISP_ENQ_COMPLETE 0x40
+
+/* INODE LOCK PARTS */
+#define MDS_INODELOCK_LOOKUP 0x000001       /* dentry, mode, owner, group */
+#define MDS_INODELOCK_UPDATE 0x000002       /* size, links, timestamps */
+#define MDS_INODELOCK_OPEN   0x000004       /* For opened files */
+
+/* Do not forget to increase MDS_INODELOCK_MAXSHIFT when adding new bits */
+#define MDS_INODELOCK_MAXSHIFT 2
+/* This FULL lock is useful to take on unlink sort of operations */
+#define MDS_INODELOCK_FULL ((1<<(MDS_INODELOCK_MAXSHIFT+1))-1)
+
+struct ll_fid {
+        __u64 id;         /* holds object id */
+        __u32 generation; /* holds object generation */
+
+        __u32 f_type;     /* holds object type or stripe idx when passing it to
+                           * OST for saving into EA. */
+};
+
+extern void lustre_swab_ll_fid (struct ll_fid *fid);
+
+#define MDS_STATUS_CONN 1
+#define MDS_STATUS_LOV 2
+
+struct mds_status_req {
+        __u32  flags;
+        __u32  repbuf;
+};
+
+extern void lustre_swab_mds_status_req (struct mds_status_req *r);
+
+#define MDS_BFLAG_UNCOMMITTED_WRITES   0x1
+
+struct mds_body {
+        struct ll_fid  fid1;
+        struct ll_fid  fid2;
+        struct lustre_handle handle;
+        __u64          valid;
+        __u64          size;   /* Offset, in the case of MDS_READPAGE */
+        __u64          mtime;
+        __u64          atime;
+        __u64          ctime;
+        __u64          blocks; /* XID, in the case of MDS_READPAGE */
+        __u64          io_epoch;
+        __u64          ino;
+        __u32          fsuid;
+        __u32          fsgid;
+        __u32          capability;
+        __u32          mode;
+        __u32          uid;
+        __u32          gid;
+        __u32          flags; /* from vfs for pin/unpin, MDS_BFLAG for close */
+        __u32          rdev;
+        __u32          nlink; /* #bytes to read in the case of MDS_READPAGE */
+        __u32          generation;
+        __u32          suppgid;
+        __u32          eadatasize;
+        __u32          aclsize;
+        __u32          max_mdsize;
+        __u32          max_cookiesize; /* also fix lustre_swab_mds_body */
+        __u32          padding_4; /* also fix lustre_swab_mds_body */
+};
+
+extern void lustre_swab_mds_body (struct mds_body *b);
+
+#define Q_QUOTACHECK    0x800100
+#define Q_INITQUOTA     0x800101        /* init slave limits */
+#define Q_GETOINFO      0x800102        /* get obd quota info */
+#define Q_GETOQUOTA     0x800103        /* get obd quotas */
+
+#define Q_TYPESET(oqc, type) \
+        ((oqc)->qc_type == type || (oqc)->qc_type == UGQUOTA)
+
+#define Q_GETOCMD(oqc) \
+        ((oqc)->qc_cmd == Q_GETOINFO || (oqc)->qc_cmd == Q_GETOQUOTA)
+
+struct obd_quotactl {
+        __u32                   qc_cmd;
+        __u32                   qc_type;
+        __u32                   qc_id;
+        __u32                   qc_stat;
+        struct obd_dqinfo       qc_dqinfo;
+        struct obd_dqblk        qc_dqblk;
+};
+
+extern void lustre_swab_obd_quotactl(struct obd_quotactl *q);
+
+struct mds_rec_setattr {
+        __u32           sa_opcode;
+        __u32           sa_fsuid;
+        __u32           sa_fsgid;
+        __u32           sa_cap;
+        __u32           sa_suppgid;
+        __u32           sa_mode;
+        struct ll_fid   sa_fid;
+        __u64           sa_valid;
+        __u64           sa_size;
+        __u64           sa_mtime;
+        __u64           sa_atime;
+        __u64           sa_ctime;
+        __u32           sa_uid;
+        __u32           sa_gid;
+        __u32           sa_attr_flags;
+        __u32           sa_padding; /* also fix lustre_swab_mds_rec_setattr */
+};
+
+/* Remove this once we declare it in include/linux/fs.h (v21 kernel patch?) */
+#ifndef ATTR_CTIME_SET
+#define ATTR_CTIME_SET 0x2000
+#endif
+
+extern void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa);
+
+#ifndef FMODE_READ
+#define FMODE_READ               00000001
+#define FMODE_WRITE              00000002
+#endif
+#ifndef FMODE_EXEC
+#define FMODE_EXEC               00000004
+#endif
+#define MDS_OPEN_CREAT           00000100
+#define MDS_OPEN_EXCL            00000200
+#define MDS_OPEN_TRUNC           00001000
+#define MDS_OPEN_APPEND          00002000
+#define MDS_OPEN_SYNC            00010000
+#define MDS_OPEN_DIRECTORY       00200000
+
+#define MDS_OPEN_DELAY_CREATE  0100000000 /* delay initial object create */
+#define MDS_OPEN_OWNEROVERRIDE 0200000000 /* NFSD rw-reopen ro file for owner */
+#define MDS_OPEN_JOIN_FILE     0400000000 /* open for join file*/
+#define MDS_OPEN_HAS_EA      010000000000 /* specify object create pattern */
+#define MDS_OPEN_HAS_OBJS    020000000000 /* Just set the EA the obj exist */
+
+struct mds_rec_create {
+        __u32           cr_opcode;
+        __u32           cr_fsuid;
+        __u32           cr_fsgid;
+        __u32           cr_cap;
+        __u32           cr_flags; /* for use with open */
+        __u32           cr_mode;
+        struct ll_fid   cr_fid;
+        struct ll_fid   cr_replayfid;
+        __u64           cr_time;
+        __u64           cr_rdev;
+        __u32           cr_suppgid;
+        __u32           cr_padding_1; /* also fix lustre_swab_mds_rec_create */
+        __u32           cr_padding_2; /* also fix lustre_swab_mds_rec_create */
+        __u32           cr_padding_3; /* also fix lustre_swab_mds_rec_create */
+        __u32           cr_padding_4; /* also fix lustre_swab_mds_rec_create */
+        __u32           cr_padding_5; /* also fix lustre_swab_mds_rec_create */
+};
+
+extern void lustre_swab_mds_rec_create (struct mds_rec_create *cr);
+
+struct mds_rec_join {
+        struct ll_fid  jr_fid;
+        __u64          jr_headsize;
+};
+
+extern void lustre_swab_mds_rec_join (struct mds_rec_join *jr);
+
+struct mds_rec_link {
+        __u32           lk_opcode;
+        __u32           lk_fsuid;
+        __u32           lk_fsgid;
+        __u32           lk_cap;
+        __u32           lk_suppgid1;
+        __u32           lk_suppgid2;
+        struct ll_fid   lk_fid1;
+        struct ll_fid   lk_fid2;
+        __u64           lk_time;
+        __u32           lk_padding_1;  /* also fix lustre_swab_mds_rec_link */
+        __u32           lk_padding_2;  /* also fix lustre_swab_mds_rec_link */
+        __u32           lk_padding_3;  /* also fix lustre_swab_mds_rec_link */
+        __u32           lk_padding_4;  /* also fix lustre_swab_mds_rec_link */
+};
+
+extern void lustre_swab_mds_rec_link (struct mds_rec_link *lk);
+
+struct mds_rec_unlink {
+        __u32           ul_opcode;
+        __u32           ul_fsuid;
+        __u32           ul_fsgid;
+        __u32           ul_cap;
+        __u32           ul_suppgid;
+        __u32           ul_mode;
+        struct ll_fid   ul_fid1;
+        struct ll_fid   ul_fid2;
+        __u64           ul_time;
+        __u32           ul_padding_1; /* also fix lustre_swab_mds_rec_unlink */
+        __u32           ul_padding_2; /* also fix lustre_swab_mds_rec_unlink */
+        __u32           ul_padding_3; /* also fix lustre_swab_mds_rec_unlink */
+        __u32           ul_padding_4; /* also fix lustre_swab_mds_rec_unlink */
+};
+
+extern void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul);
+
+struct mds_rec_rename {
+        __u32           rn_opcode;
+        __u32           rn_fsuid;
+        __u32           rn_fsgid;
+        __u32           rn_cap;
+        __u32           rn_suppgid1;
+        __u32           rn_suppgid2;
+        struct ll_fid   rn_fid1;
+        struct ll_fid   rn_fid2;
+        __u64           rn_time;
+        __u32           rn_padding_1; /* also fix lustre_swab_mds_rec_rename */
+        __u32           rn_padding_2; /* also fix lustre_swab_mds_rec_rename */
+        __u32           rn_padding_3; /* also fix lustre_swab_mds_rec_rename */
+        __u32           rn_padding_4; /* also fix lustre_swab_mds_rec_rename */
+};
+
+extern void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn);
+
+/*
+ *  LOV data structures
+ */
+
+#define LOV_MIN_STRIPE_SIZE 65536   /* maximum PAGE_SIZE (ia64), power of 2 */
+#define LOV_MAX_STRIPE_COUNT  160   /* until bug 4424 is fixed */
+
+#define LOV_MAX_UUID_BUFFER_SIZE  8192
+/* The size of the buffer the lov/mdc reserves for the
+ * array of UUIDs returned by the MDS.  With the current
+ * protocol, this will limit the max number of OSTs per LOV */
+
+#define LOV_DESC_MAGIC 0xB0CCDE5C
+
+struct lov_desc {
+        __u32 ld_tgt_count;                /* how many OBD's */
+        __u32 ld_active_tgt_count;         /* how many active */
+        __u32 ld_default_stripe_count;     /* how many objects are used */
+        __u32 ld_pattern;                  /* PATTERN_RAID0, PATTERN_RAID1 */
+        __u64 ld_default_stripe_size;      /* in bytes */
+        __u64 ld_default_stripe_offset;    /* in bytes */
+        __u32 ld_qos_threshold;            /* in MB */
+        __u32 ld_qos_maxage;               /* in second */
+        __u32 ld_padding_1;                /* also fix lustre_swab_lov_desc */
+        __u32 ld_padding_2;                /* also fix lustre_swab_lov_desc */
+        struct obd_uuid ld_uuid;
+};
+
+#define ld_magic ld_active_tgt_count       /* for swabbing from llogs */
+
+extern void lustre_swab_lov_desc (struct lov_desc *ld);
+
+/*
+ *   LDLM requests:
+ */
+/* opcodes -- MUST be distinct from OST/MDS opcodes */
+typedef enum {
+        LDLM_ENQUEUE     = 101,
+        LDLM_CONVERT     = 102,
+        LDLM_CANCEL      = 103,
+        LDLM_BL_CALLBACK = 104,
+        LDLM_CP_CALLBACK = 105,
+        LDLM_GL_CALLBACK = 106,
+        LDLM_LAST_OPC
+} ldlm_cmd_t;
+#define LDLM_FIRST_OPC LDLM_ENQUEUE
+
+#define RES_NAME_SIZE 4
+struct ldlm_res_id {
+        __u64 name[RES_NAME_SIZE];
+};
+
+extern void lustre_swab_ldlm_res_id (struct ldlm_res_id *id);
+
+/* lock types */
+typedef enum {
+        LCK_MINMODE = 0,
+        LCK_EX = 1,
+        LCK_PW = 2,
+        LCK_PR = 4,
+        LCK_CW = 8,
+        LCK_CR = 16,
+        LCK_NL = 32,
+        LCK_GROUP = 64,
+        LCK_MAXMODE
+} ldlm_mode_t;
+
+typedef enum {
+        LDLM_PLAIN     = 10,
+        LDLM_EXTENT    = 11,
+        LDLM_FLOCK     = 12,
+        LDLM_IBITS     = 13,
+        LDLM_MAX_TYPE
+} ldlm_type_t;
+
+#define LDLM_MIN_TYPE LDLM_PLAIN
+
+struct ldlm_extent {
+        __u64 start;
+        __u64 end;
+        __u64 gid;
+};
+
+struct ldlm_inodebits {
+        __u64 bits;
+};
+
+struct ldlm_flock {
+        __u64 start;
+        __u64 end;
+        __u64 blocking_export;  /* not actually used over the wire */
+        __u32 blocking_pid;     /* not actually used over the wire */
+        __u32 pid;
+};
+
+/* it's important that the fields of the ldlm_extent structure match
+ * the first fields of the ldlm_flock structure because there is only
+ * one ldlm_swab routine to process the ldlm_policy_data_t union. if
+ * this ever changes we will need to swab the union differently based
+ * on the resource type. */
+
+typedef union {
+        struct ldlm_extent l_extent;
+        struct ldlm_flock  l_flock;
+        struct ldlm_inodebits l_inodebits;
+} ldlm_policy_data_t;
+
+extern void lustre_swab_ldlm_policy_data (ldlm_policy_data_t *d);
+
+struct ldlm_intent {
+        __u64 opc;
+};
+
+extern void lustre_swab_ldlm_intent (struct ldlm_intent *i);
+
+struct ldlm_resource_desc {
+        ldlm_type_t lr_type;
+        __u32 lr_padding;       /* also fix lustre_swab_ldlm_resource_desc */
+        struct ldlm_res_id lr_name;
+};
+
+extern void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r);
+
+struct ldlm_lock_desc {
+        struct ldlm_resource_desc l_resource;
+        ldlm_mode_t l_req_mode;
+        ldlm_mode_t l_granted_mode;
+        ldlm_policy_data_t l_policy_data;
+};
+
+extern void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l);
+
+struct ldlm_request {
+        __u32 lock_flags;
+        __u32 lock_padding;     /* also fix lustre_swab_ldlm_request */
+        struct ldlm_lock_desc lock_desc;
+        struct lustre_handle lock_handle1;
+        struct lustre_handle lock_handle2;
+};
+
+extern void lustre_swab_ldlm_request (struct ldlm_request *rq);
+
+struct ldlm_reply {
+        __u32 lock_flags;
+        __u32 lock_padding;     /* also fix lustre_swab_ldlm_reply */
+        struct ldlm_lock_desc lock_desc;
+        struct lustre_handle lock_handle;
+        __u64  lock_policy_res1;
+        __u64  lock_policy_res2;
+};
+
+extern void lustre_swab_ldlm_reply (struct ldlm_reply *r);
+
+/*
+ * Opcodes for multiple servers.
+ */
+
+typedef enum {
+        OBD_PING = 400,
+        OBD_LOG_CANCEL,
+        OBD_QC_CALLBACK,
+        OBD_LAST_OPC
+} obd_cmd_t;
+#define OBD_FIRST_OPC OBD_PING
+
+/* catalog of log objects */
+
+/* Identifier for a single log object */
+struct llog_logid {
+        __u64                   lgl_oid;
+        __u64                   lgl_ogr;
+        __u32                   lgl_ogen;
+} __attribute__((packed));
+
+/* Records written to the CATALOGS list */
+#define CATLIST "CATALOGS"
+struct llog_catid {
+        struct llog_logid       lci_logid;
+        __u32                   lci_padding1;
+        __u32                   lci_padding2;
+        __u32                   lci_padding3;
+} __attribute__((packed));
+
+/*join file lov mds md*/
+struct lov_mds_md_join {
+        struct lov_mds_md lmmj_md;
+        /*join private info*/
+        struct llog_logid lmmj_array_id; /*array object id*/
+        __u32  lmmj_extent_count;        /*array extent count*/
+};
+
+/* Log data record types - there is no specific reason that these need to
+ * be related to the RPC opcodes, but no reason not to (may be handy later?)
+ */
+#define LLOG_OP_MAGIC 0x10600000
+#define LLOG_OP_MASK  0xfff00000
+
+typedef enum {
+        LLOG_PAD_MAGIC   = LLOG_OP_MAGIC | 0,
+        OST_SZ_REC       = LLOG_OP_MAGIC | (OST_SAN_WRITE << 8),
+        OST_RAID1_REC    = LLOG_OP_MAGIC | ((OST_SAN_WRITE + 1) << 8),
+        MDS_UNLINK_REC   = LLOG_OP_MAGIC | 0x10000 | (MDS_REINT << 8) | REINT_UNLINK,
+        MDS_SETATTR_REC  = LLOG_OP_MAGIC | 0x10000 | (MDS_REINT << 8) | REINT_SETATTR,
+        OBD_CFG_REC      = LLOG_OP_MAGIC | 0x20000,
+        PTL_CFG_REC      = LLOG_OP_MAGIC | 0x30000, /* obsolete */
+        LLOG_GEN_REC     = LLOG_OP_MAGIC | 0x40000,
+        LLOG_JOIN_REC    = LLOG_OP_MAGIC | 0x50000,
+        LLOG_HDR_MAGIC   = LLOG_OP_MAGIC | 0x45539,
+        LLOG_LOGID_MAGIC = LLOG_OP_MAGIC | 0x4553b,
+} llog_op_type;
+
+/*
+ * for now, continue to support old pad records which have 0 for their
+ * type but still need to be swabbed for their length
+ */
+#define LLOG_REC_HDR_NEEDS_SWABBING(r)                                  \
+        (((r)->lrh_type & __swab32(LLOG_OP_MASK)) ==                    \
+         __swab32(LLOG_OP_MAGIC) ||                                     \
+         (((r)->lrh_type == 0) && ((r)->lrh_len > LLOG_CHUNK_SIZE)))
+
+/* Log record header - stored in little endian order.
+ * Each record must start with this struct, end with a llog_rec_tail,
+ * and be a multiple of 256 bits in size.
+ */
+struct llog_rec_hdr {
+        __u32                   lrh_len;
+        __u32                   lrh_index;
+        __u32                   lrh_type;
+        __u32                   padding;
+};
+
+struct llog_rec_tail {
+        __u32 lrt_len;
+        __u32 lrt_index;
+};
+
+struct llog_logid_rec {
+        struct llog_rec_hdr     lid_hdr;
+        struct llog_logid       lid_id;
+        __u32                   padding1;
+        __u32                   padding2;
+        __u32                   padding3;
+        __u32                   padding4;
+        __u32                   padding5;
+        struct llog_rec_tail    lid_tail;
+} __attribute__((packed));
+
+/* MDS extent description
+ * It is for joined file extent info, each extent info for joined file
+ * just like (start, end, lmm).
+ */
+struct mds_extent_desc {
+        __u64                   med_start; /* extent start */
+        __u64                   med_len;   /* extent length */
+        struct lov_mds_md       med_lmm;   /* extent's lmm  */
+};
+/*Joined file array extent log record*/
+struct llog_array_rec {
+        struct llog_rec_hdr     lmr_hdr;
+        struct mds_extent_desc  lmr_med;
+        struct llog_rec_tail    lmr_tail;
+};
+
+struct llog_create_rec {
+        struct llog_rec_hdr     lcr_hdr;
+        struct ll_fid           lcr_fid;
+        obd_id                  lcr_oid;
+        obd_count               lcr_ogen;
+        __u32                   padding;
+        struct llog_rec_tail    lcr_tail;
+} __attribute__((packed));
+
+struct llog_orphan_rec {
+        struct llog_rec_hdr     lor_hdr;
+        obd_id                  lor_oid;
+        obd_count               lor_ogen;
+        __u32                   padding;
+        struct llog_rec_tail    lor_tail;
+} __attribute__((packed));
+
+struct llog_unlink_rec {
+        struct llog_rec_hdr     lur_hdr;
+        obd_id                  lur_oid;
+        obd_count               lur_ogen;
+        __u32                   padding;
+        struct llog_rec_tail    lur_tail;
+} __attribute__((packed));
+
+struct llog_setattr_rec {
+        struct llog_rec_hdr     lsr_hdr;
+        obd_id                  lsr_oid;
+        obd_count               lsr_ogen;
+        __u32                   lsr_uid;
+        __u32                   lsr_gid;
+        __u32                   padding;
+        struct llog_rec_tail    lsr_tail;
+} __attribute__((packed));
+
+struct llog_size_change_rec {
+        struct llog_rec_hdr     lsc_hdr;
+        struct ll_fid           lsc_fid;
+        __u32                   lsc_io_epoch;
+        __u32                   padding;
+        struct llog_rec_tail    lsc_tail;
+} __attribute__((packed));
+
+struct llog_gen {
+        __u64 mnt_cnt;
+        __u64 conn_cnt;
+} __attribute__((packed));
+
+struct llog_gen_rec {
+        struct llog_rec_hdr     lgr_hdr;
+        struct llog_gen         lgr_gen;
+        struct llog_rec_tail    lgr_tail;
+};
+/* On-disk header structure of each log object, stored in little endian order */
+#define LLOG_CHUNK_SIZE         8192
+#define LLOG_HEADER_SIZE        (96)
+#define LLOG_BITMAP_BYTES       (LLOG_CHUNK_SIZE - LLOG_HEADER_SIZE)
+
+#define LLOG_MIN_REC_SIZE       (24) /* round(llog_rec_hdr + llog_rec_tail) */
+
+/* flags for the logs */
+#define LLOG_F_ZAP_WHEN_EMPTY   0x1
+#define LLOG_F_IS_CAT           0x2
+#define LLOG_F_IS_PLAIN         0x4
+
+struct llog_log_hdr {
+        struct llog_rec_hdr     llh_hdr;
+        __u64                   llh_timestamp;
+        __u32                   llh_count;
+        __u32                   llh_bitmap_offset;
+        __u32                   llh_size;
+        __u32                   llh_flags;
+        __u32                   llh_cat_idx;
+        /* for a catalog the first plain slot is next to it */
+        struct obd_uuid         llh_tgtuuid;
+        __u32                   llh_reserved[LLOG_HEADER_SIZE/sizeof(__u32) - 23];
+        __u32                   llh_bitmap[LLOG_BITMAP_BYTES/sizeof(__u32)];
+        struct llog_rec_tail    llh_tail;
+} __attribute__((packed));
+
+#define LLOG_BITMAP_SIZE(llh)  ((llh->llh_hdr.lrh_len -         \
+                                 llh->llh_bitmap_offset -       \
+                                 sizeof(llh->llh_tail)) * 8)
+
+/* log cookies are used to reference a specific log file and a record therein */
+struct llog_cookie {
+        struct llog_logid       lgc_lgl;
+        __u32                   lgc_subsys;
+        __u32                   lgc_index;
+        __u32                   lgc_padding;
+} __attribute__((packed));
+
+/* llog protocol */
+enum llogd_rpc_ops {
+        LLOG_ORIGIN_HANDLE_CREATE       = 501,
+        LLOG_ORIGIN_HANDLE_NEXT_BLOCK   = 502,
+        LLOG_ORIGIN_HANDLE_READ_HEADER  = 503,
+        LLOG_ORIGIN_HANDLE_WRITE_REC    = 504,
+        LLOG_ORIGIN_HANDLE_CLOSE        = 505,
+        LLOG_ORIGIN_CONNECT             = 506,
+        LLOG_CATINFO                    = 507,  /* for lfs catinfo */
+        LLOG_ORIGIN_HANDLE_PREV_BLOCK   = 508,
+        LLOG_ORIGIN_HANDLE_DESTROY      = 509,  /* for destroy llog object*/
+};
+
+struct llogd_body {
+        struct llog_logid  lgd_logid;
+        __u32 lgd_ctxt_idx;
+        __u32 lgd_llh_flags;
+        __u32 lgd_index;
+        __u32 lgd_saved_index;
+        __u32 lgd_len;
+        __u64 lgd_cur_offset;
+} __attribute__((packed));
+
+struct llogd_conn_body {
+        struct llog_gen         lgdc_gen;
+        struct llog_logid       lgdc_logid;
+        __u32                   lgdc_ctxt_idx;
+} __attribute__((packed));
+
+struct lov_user_ost_data_join {   /* per-stripe data structure */
+        __u64 l_extent_start;     /* extent start*/
+        __u64 l_extent_end;       /* extent end*/
+        __u64 l_object_id;        /* OST object ID */
+        __u64 l_object_gr;        /* OST object group (creating MDS number) */
+        __u32 l_ost_gen;          /* generation of this OST index */
+        __u32 l_ost_idx;          /* OST index in LOV */
+} __attribute__((packed));
+
+struct lov_user_md_join {         /* LOV EA user data (host-endian) */
+        __u32 lmm_magic;          /* magic number = LOV_MAGIC_JOIN */
+        __u32 lmm_pattern;        /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */
+        __u64 lmm_object_id;      /* LOV object ID */
+        __u64 lmm_object_gr;      /* LOV object group */
+        __u32 lmm_stripe_size;    /* size of stripe in bytes */
+        __u32 lmm_stripe_count;   /* num stripes in use for this object */
+        __u32 lmm_extent_count;   /* extent count of lmm*/
+        __u64 lmm_tree_id;        /* mds tree object id */
+        __u64 lmm_tree_gen;       /* mds tree object gen */
+        struct llog_logid lmm_array_id; /* mds extent desc llog object id */
+        struct lov_user_ost_data_join lmm_objects[0]; /* per-stripe data */
+} __attribute__((packed));
+
+extern void lustre_swab_lov_user_md(struct lov_user_md *lum);
+extern void lustre_swab_lov_user_md_objects(struct lov_user_md *lum);
+extern void lustre_swab_lov_user_md_join(struct lov_user_md_join *lumj);
+
+/* llog_swab.c */
+extern void lustre_swab_llogd_body (struct llogd_body *d);
+extern void lustre_swab_llog_hdr (struct llog_log_hdr *h);
+extern void lustre_swab_llogd_conn_body (struct llogd_conn_body *d);
+extern void lustre_swab_llog_rec(struct llog_rec_hdr  *rec,
+                                 struct llog_rec_tail *tail);
+
+struct lustre_cfg;
+extern void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg);
+
+/* qutoa */
+struct qunit_data {
+        __u32 qd_id;    /* ID appiles to (uid, gid) */
+        __u32 qd_type;  /* Quota type (USRQUOTA, GRPQUOTA) */
+        __u32 qd_count; /* acquire/release count (bytes for block quota) */
+        __u32 qd_isblk; /* Block quota or file quota */
+};
+extern void lustre_swab_qdata(struct qunit_data *d);
+
+typedef enum {
+        QUOTA_DQACQ     = 601,
+        QUOTA_DQREL     = 602,
+} quota_cmd_t;
+
+#define JOIN_FILE_ALIGN 4096
+#endif
index 32f93ce..446f46a 100644 (file)
@@ -5,7 +5,7 @@
 #ifndef __EXPORT_H
 #define __EXPORT_H
 
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_dlm.h>
 
 struct mds_client_data;
index 315dc01..1b9ece0 100644 (file)
@@ -6,7 +6,7 @@
 #define __IMPORT_H
 
 #include <lustre_handles.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 
 enum lustre_imp_state {
         LUSTRE_IMP_CLOSED     = 1,
index 13ceaef..c98cfc8 100644 (file)
@@ -26,7 +26,7 @@
 #define _LUSTRE_LIB_H
 
 #include <libcfs/kp30.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_cfg.h>
 #if defined(__linux__)
 #include <linux/lustre_lib.h>
@@ -398,7 +398,23 @@ static inline void obd_ioctl_freedata(char *buf, int len)
         return;
 }
 
-#define OBD_IOC_CREATE                 _IOR ('f', 101, OBD_IOC_DATA_TYPE)
+/*
+ * BSD ioctl description:
+ * #define IOC_V1       _IOR(g, n1, long)
+ * #define IOC_V2       _IOW(g, n2, long)
+ *
+ * ioctl(f, IOC_V1, arg);
+ * arg will be treated as a long value,
+ *
+ * ioctl(f, IOC_V2, arg)
+ * arg will be treated as a pointer, bsd will call
+ * copyin(buf, arg, sizeof(long))
+ *
+ * To make BSD ioctl handles argument correctly and simplely, 
+ * we change _IOR to _IOWR so BSD will copyin obd_ioctl_data 
+ * for us. Does this change affect Linux?  (XXX Liang)
+ */
+#define OBD_IOC_CREATE                 _IOWR('f', 101, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_DESTROY                _IOW ('f', 104, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_PREALLOCATE            _IOWR('f', 105, OBD_IOC_DATA_TYPE)
 
@@ -422,7 +438,7 @@ static inline void obd_ioctl_freedata(char *buf, int len)
 #define OBD_IOC_BRW_WRITE              _IOWR('f', 126, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_NAME2DEV               _IOWR('f', 127, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_UUID2DEV               _IOWR('f', 130, OBD_IOC_DATA_TYPE)
-#define OBD_IOC_GETNAME                _IO('f', 131, OBD_IOC_DATA_TYPE)
+#define OBD_IOC_GETNAME                _IOWR('f', 131, OBD_IOC_DATA_TYPE)
 
 #define OBD_IOC_LOV_GET_CONFIG         _IOWR('f', 132, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_CLIENT_RECOVER         _IOW ('f', 133, OBD_IOC_DATA_TYPE)
@@ -582,10 +598,6 @@ struct l_wait_info {
 
 #define LWI_INTR(cb, data)  LWI_TIMEOUT_INTR(0, NULL, cb, data)
 
-#define LUSTRE_FATAL_SIGS (sigmask(SIGKILL) | sigmask(SIGINT) |                \
-                           sigmask(SIGTERM) | sigmask(SIGQUIT) |               \
-                           sigmask(SIGALRM))
-
 #ifdef __KERNEL__
 
 /*
index d305fb4..2bc951d 100644 (file)
@@ -47,7 +47,7 @@
 
 #include <obd.h>
 #include <obd_ost.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 
 #define LOG_NAME_LIMIT(logname, name)                   \
         snprintf(logname, sizeof(logname), "LOGS/%s", name)
index f7af585..6ea9a8d 100644 (file)
@@ -12,7 +12,7 @@
 
 #include <lustre_handles.h>
 #include <libcfs/kp30.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_lib.h>
 #include <lustre_dlm.h>
 #include <lustre_log.h>
index bacef95..7a9292e 100644 (file)
@@ -36,7 +36,7 @@
 #include <libcfs/kp30.h>
 // #include <obd.h>
 #include <lnet/lnet.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_ha.h>
 #include <lustre_import.h>
 #include <lprocfs_status.h>
index 7e2f3b3..6516fb9 100644 (file)
@@ -14,7 +14,7 @@
 #error Unsupported operating system.
 #endif
 
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_net.h>
 #include <lvfs.h>
 
index 012ce9f..be993d7 100644 (file)
@@ -28,7 +28,7 @@
 #define IOC_MDC_MAX_NR       50
 
 #include <lustre_lib.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_export.h>
 #include <lustre_quota.h>
 
index af2be21..87c5fd1 100644 (file)
@@ -28,7 +28,7 @@
 #include <lustre_net.h>
 #include <obd.h>
 #include <lustre_lib.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lprocfs_status.h>
 
 #if defined(__linux__)
index b8500d4..d35cef3 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <obd_support.h>
 #include <lustre_lite.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_dlm.h>
 #include <linux/lustre_version.h>
 
index f4cad51..6d391cc 100644 (file)
@@ -44,7 +44,7 @@
 #include <obd_support.h>
 #include <obd_class.h>
 #include <lustre_lib.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_lite.h>
 #include <lustre_dlm.h>
 #include "llite_internal.h"
index 89e8f14..de3dd8d 100755 (executable)
@@ -37,7 +37,7 @@
 
 #include <obd_class.h>
 #include <obd_lov.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_log.h>
 
 #include "lov_internal.h"
index 72703ef..23ccc08 100644 (file)
@@ -38,7 +38,7 @@
 #include <obd_support.h>
 #include <lustre_lib.h>
 #include <lustre_net.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_dlm.h>
 #include <lustre_mds.h>
 #include <obd_class.h>
index 313fbaa..9572772 100644 (file)
@@ -38,7 +38,7 @@
 #include <obd_support.h>
 #include <lustre_lib.h>
 #include <lustre_net.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_dlm.h>
 #include <lustre_mds.h>
 #include <lustre_debug.h>
index 291bad5..a3a4372 100644 (file)
@@ -35,7 +35,7 @@
 
 #include <obd_class.h>
 #include <obd_lov.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 
 #include "lov_internal.h"
 
index eb1f100..29be9d6 100644 (file)
@@ -27,7 +27,7 @@
 # include <fcntl.h>
 # include <liblustre.h>
 #endif
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_net.h>
 #include "mdc_internal.h"
 
index d39525e..7a39720 100644 (file)
@@ -34,7 +34,7 @@
 #include <obd_class.h>
 #include <obd.h>
 #include <lustre_lib.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_mds.h>
 #include <lustre_dlm.h>
 #include <lustre_log.h>
index 4aa04fd..7291581 100644 (file)
@@ -33,7 +33,7 @@
 
 #include <linux/module.h>
 #include <lustre_mds.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <obd_class.h>
 #include <obd_lov.h>
 #include <lustre_lib.h>
index 8cd37e8..e2f7286 100644 (file)
@@ -38,7 +38,7 @@
 #include <obd_class.h>
 #include <obd.h>
 #include <lustre_lib.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_mds.h>
 #include <lustre_dlm.h>
 #include <lustre_fsfilt.h>
index f35aacc..5c8de13 100644 (file)
@@ -35,7 +35,7 @@
 #include <obd_class.h>
 #include <obd.h>
 #include <lustre_lib.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_mds.h>
 #include <lustre_dlm.h>
 #include <lustre_fsfilt.h>
index 8b97261..287d942 100644 (file)
@@ -93,17 +93,20 @@ int obd_ioctl_popdata(void *arg, void *data, int len)
 {
        /* 
         * Xnu ioctl copyout(uaddr, arg, sizeof(struct obd_ioctl_data)),
-        * we have to copy out data by ourself only if 
-        * len > sizeof(struct obd_ioctl_data)
+        * we have to copyout data exceed sizeof(struct obd_ioctl_data)
+        * by ourself.
         */
        if (len <= sizeof(struct obd_ioctl_data)) {
                memcpy(arg, data, len);
                return 0;
        } else {
+               int err;
                struct obd_ioctl_data *u = (struct obd_ioctl_data *)arg;
                struct obd_ioctl_data *k = (struct obd_ioctl_data *)data;
-               return copy_to_user((void *)u->ioc_inlbuf1, &k->ioc_bulk[0],
+               err = copy_to_user((void *)u->ioc_inlbuf1, &k->ioc_bulk[0],
                                    len -((void *)&k->ioc_bulk[0] -(void *)k));
+               memcpy(arg, data, sizeof(struct obd_ioctl_data));
+               return err;
        }
 }
 /*
index 9eb10f8..f4e8fea 100644 (file)
@@ -37,7 +37,7 @@
 #else
 #include <linux/module.h>
 #include <obd_class.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #endif
 
 #ifdef __KERNEL__
index cc527d5..94e70bb 100644 (file)
@@ -36,7 +36,7 @@
 #include <liblustre.h>
 #else
 #include <obd_class.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #endif
 
 void obdo_cpy_md(struct obdo *dst, struct obdo *src, obd_flag valid)
index 71e7c6f..78712f2 100644 (file)
@@ -27,7 +27,7 @@
 #include <obd_support.h>
 #include <obd.h>
 #include <lprocfs_status.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_net.h>
 #include <obd_class.h>
 #include "ptlrpc_internal.h"
index 6c4e3f6..e349f89 100644 (file)
@@ -41,7 +41,7 @@
 #include <lnet/lnetctl.h>
 
 #include <liblustre.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre/liblustreapi.h>
 #include <lustre/lustre_user.h>
 
index 169dc8a..16ce965 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <time.h>
 #include <liblustre.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 
 int llog_pack_buffer(int fd, struct llog_log_hdr** llog_buf, struct llog_rec_hdr*** recs, int* recs_number);
 
index cb717b5..07df82b 100644 (file)
@@ -35,7 +35,7 @@
 #endif
 #include <lustre_lib.h>
 #include <lustre_cfg.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_dlm.h>
 #include <obd.h>          /* for struct lov_stripe_md */
 #include <obd_lov.h>
index ba74483..7a7d43c 100644 (file)
@@ -11,7 +11,7 @@
 #endif
 
 #include <lustre_lib.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_dlm.h>
 #include <lustre_cfg.h>
 
index 596ce42..8813de4 100644 (file)
@@ -12,7 +12,7 @@
 #include <sys/stat.h>
 
 #include <lustre_lib.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 #include <obd_class.h>
 
 struct obdio_conn {
index bb189c5..0ba4cd1 100644 (file)
@@ -6,7 +6,7 @@
 #include <sys/wait.h>
 #include <liblustre.h>
 #include <lustre_lib.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 
 #define BLANK_LINE()                                            \
 do {                                                            \
index 58c2fca..95de9db 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <liblustre.h>
 #include <lustre_lib.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 
 #undef LASSERT
 #undef LASSERTF
index 5149d7f..ee8d916 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <liblustre.h>
 #include <lustre_lib.h>
-#include <lustre_idl.h>
+#include <lustre/lustre_idl.h>
 
 #undef LASSERT
 #undef LASSERTF