+enum {
+ LAYOUT_INTENT_ACCESS = 0,
+ LAYOUT_INTENT_READ = 1,
+ LAYOUT_INTENT_WRITE = 2,
+ LAYOUT_INTENT_GLIMPSE = 3,
+ LAYOUT_INTENT_TRUNC = 4,
+ LAYOUT_INTENT_RELEASE = 5,
+ LAYOUT_INTENT_RESTORE = 6
+};
+
+/* enqueue layout lock with intent */
+struct layout_intent {
+ __u32 li_opc; /* intent operation for enqueue, read, write etc */
+ __u32 li_flags;
+ __u64 li_start;
+ __u64 li_end;
+};
+
+void lustre_swab_layout_intent(struct layout_intent *li);
+
+/**
+ * On the wire version of hsm_progress structure.
+ *
+ * Contains the userspace hsm_progress and some internal fields.
+ */
+struct hsm_progress_kernel {
+ /* Field taken from struct hsm_progress */
+ lustre_fid hpk_fid;
+ __u64 hpk_cookie;
+ struct hsm_extent hpk_extent;
+ __u16 hpk_flags;
+ __u16 hpk_errval; /* positive val */
+ __u32 hpk_padding1;
+ /* Additional fields */
+ __u64 hpk_data_version;
+ __u64 hpk_padding2;
+} __attribute__((packed));
+
+extern void lustre_swab_hsm_user_state(struct hsm_user_state *hus);
+extern void lustre_swab_hsm_current_action(struct hsm_current_action *action);
+extern void lustre_swab_hsm_progress_kernel(struct hsm_progress_kernel *hpk);
+extern void lustre_swab_hsm_user_state(struct hsm_user_state *hus);
+extern void lustre_swab_hsm_user_item(struct hsm_user_item *hui);
+extern void lustre_swab_hsm_request(struct hsm_request *hr);
+
+/**
+ * OUT_UPDATE RPC Format
+ *
+ * During the cross-ref operation, the Master MDT, which the client send the
+ * request to, will disassembly the operation into object updates, then OSP
+ * will send these updates to the remote MDT to be executed.
+ *
+ * An UPDATE_OBJ RPC does a list of updates. Each update belongs to an
+ * operation and does a type of modification to an object.
+ *
+ * Request Format
+ *
+ * update_buf
+ * update (1st)
+ * update (2nd)
+ * ...
+ * update (ub_count-th)
+ *
+ * ub_count must be less than or equal to UPDATE_PER_RPC_MAX.
+ *
+ * Reply Format
+ *
+ * update_reply
+ * rc [+ buffers] (1st)
+ * rc [+ buffers] (2st)
+ * ...
+ * rc [+ buffers] (nr_count-th)
+ *
+ * ur_count must be less than or equal to UPDATE_PER_RPC_MAX and should usually
+ * be equal to ub_count.
+ */
+
+/**
+ * Type of each update
+ */
+enum update_type {
+ OUT_CREATE = 1,
+ OUT_DESTROY = 2,
+ OUT_REF_ADD = 3,
+ OUT_REF_DEL = 4,
+ OUT_ATTR_SET = 5,
+ OUT_ATTR_GET = 6,
+ OUT_XATTR_SET = 7,
+ OUT_XATTR_GET = 8,
+ OUT_INDEX_LOOKUP = 9,
+ OUT_INDEX_INSERT = 10,
+ OUT_INDEX_DELETE = 11,
+ OUT_WRITE = 12,
+ OUT_LAST
+};
+
+enum update_flag {
+ UPDATE_FL_OST = 0x00000001, /* op from OST (not MDT) */
+ UPDATE_FL_SYNC = 0x00000002, /* commit before replying */
+ UPDATE_FL_COMMITTED = 0x00000004, /* op committed globally */
+ UPDATE_FL_NOLOG = 0x00000008 /* for idempotent updates */
+};
+
+struct object_update_param {
+ __u16 oup_len; /* length of this parameter */
+ __u16 oup_padding;
+ __u32 oup_padding2;
+ char oup_buf[0];
+};
+
+/* object update */
+struct object_update {
+ __u16 ou_type; /* enum update_type */
+ __u16 ou_params_count; /* update parameters count */
+ __u32 ou_master_index; /* master MDT/OST index */
+ __u32 ou_flags; /* enum update_flag */
+ __u32 ou_padding1; /* padding 1 */
+ __u64 ou_batchid; /* op transno on master */
+ struct lu_fid ou_fid; /* object to be updated */
+ struct object_update_param ou_params[0]; /* update params */
+};
+
+#define UPDATE_REQUEST_MAGIC_V1 0xBDDE0001
+#define UPDATE_REQUEST_MAGIC_V2 0xBDDE0002
+#define UPDATE_REQUEST_MAGIC UPDATE_REQUEST_MAGIC_V2
+/* Hold object_updates sending to the remote OUT in single RPC */
+struct object_update_request {
+ __u32 ourq_magic;
+ __u16 ourq_count; /* number of ourq_updates[] */
+ __u16 ourq_padding;
+ struct object_update ourq_updates[0];
+};
+
+void lustre_swab_object_update(struct object_update *ou);
+void lustre_swab_object_update_request(struct object_update_request *our);
+
+/* the result of object update */
+struct object_update_result {
+ __u32 our_rc;
+ __u16 our_datalen;
+ __u16 our_padding;
+ __u32 our_data[0];
+};
+
+#define UPDATE_REPLY_MAGIC_V1 0x00BD0001
+#define UPDATE_REPLY_MAGIC_V2 0x00BD0002
+#define UPDATE_REPLY_MAGIC UPDATE_REPLY_MAGIC_V2
+/* Hold object_update_results being replied from the remote OUT. */
+struct object_update_reply {
+ __u32 ourp_magic;
+ __u16 ourp_count;
+ __u16 ourp_padding;
+ __u16 ourp_lens[0];
+};
+
+void lustre_swab_object_update_result(struct object_update_result *our);
+void lustre_swab_object_update_reply(struct object_update_reply *our);
+
+/** layout swap request structure
+ * fid1 and fid2 are in mdt_body
+ */
+struct mdc_swap_layouts {
+ __u64 msl_flags;
+} __packed;
+
+void lustre_swab_swap_layouts(struct mdc_swap_layouts *msl);
+
+struct close_data {
+ struct lustre_handle cd_handle;
+ struct lu_fid cd_fid;
+ __u64 cd_data_version;
+ __u64 cd_reserved[8];
+};
+
+void lustre_swab_close_data(struct close_data *data);