From 069d7765898ef6f8d1334b23bf8ed9aee017b47a Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 18 Feb 2011 02:54:49 +0000 Subject: rpc/xdr: update .x files * now, 'rpcgen $filename-xdr.x' file will result in $filename-xdr.h Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 2153 (glusterfs3.x does not match "generated" source) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2153 --- rpc/xdr/src/cli1-xdr.x | 309 +++++++++++++++++++++ rpc/xdr/src/cli1.x | 309 --------------------- rpc/xdr/src/glusterd1-xdr.x | 113 ++++++++ rpc/xdr/src/glusterd1.x | 113 -------- rpc/xdr/src/glusterfs3-xdr.h | 240 +--------------- rpc/xdr/src/glusterfs3-xdr.x | 616 +++++++++++++++++++++++++++++++++++++++++ rpc/xdr/src/glusterfs3.h | 235 ++++++++++++++++ rpc/xdr/src/glusterfs3.x | 645 ------------------------------------------- rpc/xdr/src/portmap-xdr.x | 55 ++++ rpc/xdr/src/portmap.x | 45 --- 10 files changed, 1329 insertions(+), 1351 deletions(-) create mode 100644 rpc/xdr/src/cli1-xdr.x delete mode 100644 rpc/xdr/src/cli1.x create mode 100644 rpc/xdr/src/glusterd1-xdr.x delete mode 100644 rpc/xdr/src/glusterd1.x create mode 100644 rpc/xdr/src/glusterfs3-xdr.x delete mode 100644 rpc/xdr/src/glusterfs3.x create mode 100644 rpc/xdr/src/portmap-xdr.x delete mode 100644 rpc/xdr/src/portmap.x (limited to 'rpc/xdr/src') diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x new file mode 100644 index 00000000000..0e18c6ab922 --- /dev/null +++ b/rpc/xdr/src/cli1-xdr.x @@ -0,0 +1,309 @@ + enum gf1_cluster_type { + GF_CLUSTER_TYPE_NONE = 0, + GF_CLUSTER_TYPE_STRIPE, + GF_CLUSTER_TYPE_REPLICATE +} ; + + enum gf1_cli_replace_op { + GF_REPLACE_OP_NONE = 0, + GF_REPLACE_OP_START, + GF_REPLACE_OP_COMMIT, + GF_REPLACE_OP_PAUSE, + GF_REPLACE_OP_ABORT, + GF_REPLACE_OP_STATUS, + GF_REPLACE_OP_COMMIT_FORCE +} ; + +enum gf1_cli_friends_list { + GF_CLI_LIST_ALL = 1 +} ; + +enum gf1_cli_get_volume { + GF_CLI_GET_VOLUME_ALL = 1, + GF_CLI_GET_VOLUME, + GF_CLI_GET_NEXT_VOLUME +} ; + +enum gf1_cli_sync_volume { + GF_CLI_SYNC_ALL = 1 +} ; + +enum gf1_cli_op_flags { + GF_CLI_FLAG_OP_FORCE = 1 +}; + +enum gf1_cli_gsync_set { + GF_GSYNC_OPTION_TYPE_NONE, + GF_GSYNC_OPTION_TYPE_START, + GF_GSYNC_OPTION_TYPE_STOP, + GF_GSYNC_OPTION_TYPE_CONFIGURE, + GF_GSYNC_OPTION_TYPE_CONFIG_SET, + GF_GSYNC_OPTION_TYPE_CONFIG_DEL, + GF_GSYNC_OPTION_TYPE_CONFIG_GET, + GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL +}; + + struct gf1_cli_probe_req { + string hostname<>; + int port; +} ; + + struct gf1_cli_probe_rsp { + int op_ret; + int op_errno; + int port; + string hostname<>; +} ; + + struct gf1_cli_deprobe_req { + string hostname<>; + int port; +} ; + + struct gf1_cli_deprobe_rsp { + int op_ret; + int op_errno; + string hostname<>; +} ; + +struct gf1_cli_peer_list_req { + int flags; + opaque dict<>; +} ; + +struct gf1_cli_peer_list_rsp { + int op_ret; + int op_errno; + opaque friends<>; +} ; + +struct gf1_cli_get_vol_req { + int flags; + opaque dict<>; +} ; + +struct gf1_cli_get_vol_rsp { + int op_ret; + int op_errno; + opaque volumes<>; +} ; + + struct gf1_cli_create_vol_req { + string volname<>; + gf1_cluster_type type; + int count; + opaque bricks<>; +} ; + + struct gf1_cli_create_vol_rsp { + int op_ret; + int op_errno; + string volname<>; + string op_errstr<>; +} ; + + struct gf1_cli_delete_vol_req { + string volname<>; +} ; + + struct gf1_cli_delete_vol_rsp { + int op_ret; + int op_errno; + string volname<>; + string op_errstr<>; +} ; + + struct gf1_cli_start_vol_req { + string volname<>; + int flags; +} ; + + + struct gf1_cli_start_vol_rsp { + int op_ret; + int op_errno; + string volname<>; + string op_errstr<>; +} ; + + struct gf1_cli_stop_vol_req { + string volname<>; + int flags; +} ; + + + struct gf1_cli_stop_vol_rsp { + int op_ret; + int op_errno; + string volname<>; + string op_errstr<>; +} ; + + + struct gf1_cli_rename_vol_req { + string old_volname<>; + string new_volname<>; +} ; + + struct gf1_cli_rename_vol_rsp { + int op_ret; + int op_errno; + string volname<>; +} ; + + struct gf1_cli_defrag_vol_req { + int cmd; + string volname<>; +} ; + + struct gf1_cli_defrag_vol_rsp { + int op_ret; + int op_errno; + string volname<>; + unsigned hyper files; + unsigned hyper size; + unsigned hyper lookedup_files; +} ; + + struct gf1_cli_add_brick_req { + string volname<>; + int count; + opaque bricks<>; +} ; + + struct gf1_cli_add_brick_rsp { + int op_ret; + int op_errno; + string volname<>; + string op_errstr<>; +} ; + + struct gf1_cli_remove_brick_req { + string volname<>; + int count; + opaque bricks<>; +} ; + + + struct gf1_cli_remove_brick_rsp { + int op_ret; + int op_errno; + string volname<>; + string op_errstr<>; +} ; + + struct gf1_cli_replace_brick_req { + string volname<>; + gf1_cli_replace_op op; + opaque bricks<>; +} ; + + struct gf1_cli_replace_brick_rsp { + int op_ret; + int op_errno; + string op_errstr<>; + string volname<>; + string status<>; +} ; + +struct gf1_cli_reset_vol_req { + string volname<>; + opaque dict<>; +} ; + + + struct gf1_cli_reset_vol_rsp { + int op_ret; + int op_errno; + string volname<>; + string op_errstr<>; +} ; + + + +struct gf1_cli_set_vol_req { + string volname<>; + opaque dict<>; +} ; + + + struct gf1_cli_set_vol_rsp { + int op_ret; + int op_errno; + string volname<>; + string op_errstr<>; + opaque dict<>; +} ; + +struct gf1_cli_log_filename_req { + string volname<>; + string brick<>; + string path<>; +}; + +struct gf1_cli_log_filename_rsp { + int op_ret; + int op_errno; + string errstr<>; +}; + +struct gf1_cli_log_locate_req { + string volname<>; + string brick<>; +}; + +struct gf1_cli_sync_volume_req { + int flags; + string volname<>; + string hostname<>; +}; + +struct gf1_cli_log_locate_rsp { + int op_ret; + int op_errno; + string path<>; +}; + +struct gf1_cli_log_rotate_req { + string volname<>; + string brick<>; +}; + +struct gf1_cli_log_rotate_rsp { + int op_ret; + int op_errno; + string errstr<>; +}; + +struct gf1_cli_sync_volume_rsp { + int op_ret; + int op_errno; + string op_errstr<>; +}; + +struct gf1_cli_fsm_log_req { + string name<>; +}; + +struct gf1_cli_fsm_log_rsp { + int op_ret; + int op_errno; + string op_errstr<>; + opaque fsm_log<>; +}; + +struct gf1_cli_gsync_set_req { + opaque dict<>; +}; + +struct gf1_cli_gsync_set_rsp { + int op_ret; + int op_errno; + string op_errstr<>; + int type; + int config_type; + string op_name<>; + string master<>; + string slave<>; + string gsync_prefix<>; +}; diff --git a/rpc/xdr/src/cli1.x b/rpc/xdr/src/cli1.x deleted file mode 100644 index 0e18c6ab922..00000000000 --- a/rpc/xdr/src/cli1.x +++ /dev/null @@ -1,309 +0,0 @@ - enum gf1_cluster_type { - GF_CLUSTER_TYPE_NONE = 0, - GF_CLUSTER_TYPE_STRIPE, - GF_CLUSTER_TYPE_REPLICATE -} ; - - enum gf1_cli_replace_op { - GF_REPLACE_OP_NONE = 0, - GF_REPLACE_OP_START, - GF_REPLACE_OP_COMMIT, - GF_REPLACE_OP_PAUSE, - GF_REPLACE_OP_ABORT, - GF_REPLACE_OP_STATUS, - GF_REPLACE_OP_COMMIT_FORCE -} ; - -enum gf1_cli_friends_list { - GF_CLI_LIST_ALL = 1 -} ; - -enum gf1_cli_get_volume { - GF_CLI_GET_VOLUME_ALL = 1, - GF_CLI_GET_VOLUME, - GF_CLI_GET_NEXT_VOLUME -} ; - -enum gf1_cli_sync_volume { - GF_CLI_SYNC_ALL = 1 -} ; - -enum gf1_cli_op_flags { - GF_CLI_FLAG_OP_FORCE = 1 -}; - -enum gf1_cli_gsync_set { - GF_GSYNC_OPTION_TYPE_NONE, - GF_GSYNC_OPTION_TYPE_START, - GF_GSYNC_OPTION_TYPE_STOP, - GF_GSYNC_OPTION_TYPE_CONFIGURE, - GF_GSYNC_OPTION_TYPE_CONFIG_SET, - GF_GSYNC_OPTION_TYPE_CONFIG_DEL, - GF_GSYNC_OPTION_TYPE_CONFIG_GET, - GF_GSYNC_OPTION_TYPE_CONFIG_GET_ALL -}; - - struct gf1_cli_probe_req { - string hostname<>; - int port; -} ; - - struct gf1_cli_probe_rsp { - int op_ret; - int op_errno; - int port; - string hostname<>; -} ; - - struct gf1_cli_deprobe_req { - string hostname<>; - int port; -} ; - - struct gf1_cli_deprobe_rsp { - int op_ret; - int op_errno; - string hostname<>; -} ; - -struct gf1_cli_peer_list_req { - int flags; - opaque dict<>; -} ; - -struct gf1_cli_peer_list_rsp { - int op_ret; - int op_errno; - opaque friends<>; -} ; - -struct gf1_cli_get_vol_req { - int flags; - opaque dict<>; -} ; - -struct gf1_cli_get_vol_rsp { - int op_ret; - int op_errno; - opaque volumes<>; -} ; - - struct gf1_cli_create_vol_req { - string volname<>; - gf1_cluster_type type; - int count; - opaque bricks<>; -} ; - - struct gf1_cli_create_vol_rsp { - int op_ret; - int op_errno; - string volname<>; - string op_errstr<>; -} ; - - struct gf1_cli_delete_vol_req { - string volname<>; -} ; - - struct gf1_cli_delete_vol_rsp { - int op_ret; - int op_errno; - string volname<>; - string op_errstr<>; -} ; - - struct gf1_cli_start_vol_req { - string volname<>; - int flags; -} ; - - - struct gf1_cli_start_vol_rsp { - int op_ret; - int op_errno; - string volname<>; - string op_errstr<>; -} ; - - struct gf1_cli_stop_vol_req { - string volname<>; - int flags; -} ; - - - struct gf1_cli_stop_vol_rsp { - int op_ret; - int op_errno; - string volname<>; - string op_errstr<>; -} ; - - - struct gf1_cli_rename_vol_req { - string old_volname<>; - string new_volname<>; -} ; - - struct gf1_cli_rename_vol_rsp { - int op_ret; - int op_errno; - string volname<>; -} ; - - struct gf1_cli_defrag_vol_req { - int cmd; - string volname<>; -} ; - - struct gf1_cli_defrag_vol_rsp { - int op_ret; - int op_errno; - string volname<>; - unsigned hyper files; - unsigned hyper size; - unsigned hyper lookedup_files; -} ; - - struct gf1_cli_add_brick_req { - string volname<>; - int count; - opaque bricks<>; -} ; - - struct gf1_cli_add_brick_rsp { - int op_ret; - int op_errno; - string volname<>; - string op_errstr<>; -} ; - - struct gf1_cli_remove_brick_req { - string volname<>; - int count; - opaque bricks<>; -} ; - - - struct gf1_cli_remove_brick_rsp { - int op_ret; - int op_errno; - string volname<>; - string op_errstr<>; -} ; - - struct gf1_cli_replace_brick_req { - string volname<>; - gf1_cli_replace_op op; - opaque bricks<>; -} ; - - struct gf1_cli_replace_brick_rsp { - int op_ret; - int op_errno; - string op_errstr<>; - string volname<>; - string status<>; -} ; - -struct gf1_cli_reset_vol_req { - string volname<>; - opaque dict<>; -} ; - - - struct gf1_cli_reset_vol_rsp { - int op_ret; - int op_errno; - string volname<>; - string op_errstr<>; -} ; - - - -struct gf1_cli_set_vol_req { - string volname<>; - opaque dict<>; -} ; - - - struct gf1_cli_set_vol_rsp { - int op_ret; - int op_errno; - string volname<>; - string op_errstr<>; - opaque dict<>; -} ; - -struct gf1_cli_log_filename_req { - string volname<>; - string brick<>; - string path<>; -}; - -struct gf1_cli_log_filename_rsp { - int op_ret; - int op_errno; - string errstr<>; -}; - -struct gf1_cli_log_locate_req { - string volname<>; - string brick<>; -}; - -struct gf1_cli_sync_volume_req { - int flags; - string volname<>; - string hostname<>; -}; - -struct gf1_cli_log_locate_rsp { - int op_ret; - int op_errno; - string path<>; -}; - -struct gf1_cli_log_rotate_req { - string volname<>; - string brick<>; -}; - -struct gf1_cli_log_rotate_rsp { - int op_ret; - int op_errno; - string errstr<>; -}; - -struct gf1_cli_sync_volume_rsp { - int op_ret; - int op_errno; - string op_errstr<>; -}; - -struct gf1_cli_fsm_log_req { - string name<>; -}; - -struct gf1_cli_fsm_log_rsp { - int op_ret; - int op_errno; - string op_errstr<>; - opaque fsm_log<>; -}; - -struct gf1_cli_gsync_set_req { - opaque dict<>; -}; - -struct gf1_cli_gsync_set_rsp { - int op_ret; - int op_errno; - string op_errstr<>; - int type; - int config_type; - string op_name<>; - string master<>; - string slave<>; - string gsync_prefix<>; -}; diff --git a/rpc/xdr/src/glusterd1-xdr.x b/rpc/xdr/src/glusterd1-xdr.x new file mode 100644 index 00000000000..ff436729c28 --- /dev/null +++ b/rpc/xdr/src/glusterd1-xdr.x @@ -0,0 +1,113 @@ + enum glusterd_volume_status { + GLUSTERD_STATUS_NONE = 0, + GLUSTERD_STATUS_STARTED, + GLUSTERD_STATUS_STOPPED +} ; + + struct gd1_mgmt_probe_req { + unsigned char uuid[16]; + string hostname<>; + int port; +} ; + + struct gd1_mgmt_probe_rsp { + unsigned char uuid[16]; + string hostname<>; + int port; + int op_ret; + int op_errno; +} ; + +struct gd1_mgmt_friend_req { + unsigned char uuid[16]; + string hostname<>; + int port; + opaque vols<>; +} ; + +struct gd1_mgmt_friend_rsp { + unsigned char uuid[16]; + string hostname<>; + int op_ret; + int op_errno; + int port; +} ; + +struct gd1_mgmt_unfriend_req { + unsigned char uuid[16]; + string hostname<>; + int port; +} ; + +struct gd1_mgmt_unfriend_rsp { + unsigned char uuid[16]; + string hostname<>; + int op_ret; + int op_errno; + int port; +} ; + +struct gd1_mgmt_cluster_lock_req { + unsigned char uuid[16]; +} ; + +struct gd1_mgmt_cluster_lock_rsp { + unsigned char uuid[16]; + int op_ret; + int op_errno; +} ; + +struct gd1_mgmt_cluster_unlock_req { + unsigned char uuid[16]; +} ; + +struct gd1_mgmt_cluster_unlock_rsp { + unsigned char uuid[16]; + int op_ret; + int op_errno; +} ; + +struct gd1_mgmt_stage_op_req { + unsigned char uuid[16]; + int op; + opaque buf<>; +} ; + + +struct gd1_mgmt_stage_op_rsp { + unsigned char uuid[16]; + int op; + int op_ret; + int op_errno; + string op_errstr<>; + opaque dict<>; +} ; + +struct gd1_mgmt_commit_op_req { + unsigned char uuid[16]; + int op; + opaque buf<>; +} ; + + +struct gd1_mgmt_commit_op_rsp { + unsigned char uuid[16]; + int op; + int op_ret; + int op_errno; + opaque dict<>; + string op_errstr<>; +} ; + +struct gd1_mgmt_friend_update { + unsigned char uuid[16]; + opaque friends<>; + int port; +} ; + +struct gd1_mgmt_friend_update_rsp { + unsigned char uuid[16]; + int op; + int op_ret; + int op_errno; +} ; diff --git a/rpc/xdr/src/glusterd1.x b/rpc/xdr/src/glusterd1.x deleted file mode 100644 index ff436729c28..00000000000 --- a/rpc/xdr/src/glusterd1.x +++ /dev/null @@ -1,113 +0,0 @@ - enum glusterd_volume_status { - GLUSTERD_STATUS_NONE = 0, - GLUSTERD_STATUS_STARTED, - GLUSTERD_STATUS_STOPPED -} ; - - struct gd1_mgmt_probe_req { - unsigned char uuid[16]; - string hostname<>; - int port; -} ; - - struct gd1_mgmt_probe_rsp { - unsigned char uuid[16]; - string hostname<>; - int port; - int op_ret; - int op_errno; -} ; - -struct gd1_mgmt_friend_req { - unsigned char uuid[16]; - string hostname<>; - int port; - opaque vols<>; -} ; - -struct gd1_mgmt_friend_rsp { - unsigned char uuid[16]; - string hostname<>; - int op_ret; - int op_errno; - int port; -} ; - -struct gd1_mgmt_unfriend_req { - unsigned char uuid[16]; - string hostname<>; - int port; -} ; - -struct gd1_mgmt_unfriend_rsp { - unsigned char uuid[16]; - string hostname<>; - int op_ret; - int op_errno; - int port; -} ; - -struct gd1_mgmt_cluster_lock_req { - unsigned char uuid[16]; -} ; - -struct gd1_mgmt_cluster_lock_rsp { - unsigned char uuid[16]; - int op_ret; - int op_errno; -} ; - -struct gd1_mgmt_cluster_unlock_req { - unsigned char uuid[16]; -} ; - -struct gd1_mgmt_cluster_unlock_rsp { - unsigned char uuid[16]; - int op_ret; - int op_errno; -} ; - -struct gd1_mgmt_stage_op_req { - unsigned char uuid[16]; - int op; - opaque buf<>; -} ; - - -struct gd1_mgmt_stage_op_rsp { - unsigned char uuid[16]; - int op; - int op_ret; - int op_errno; - string op_errstr<>; - opaque dict<>; -} ; - -struct gd1_mgmt_commit_op_req { - unsigned char uuid[16]; - int op; - opaque buf<>; -} ; - - -struct gd1_mgmt_commit_op_rsp { - unsigned char uuid[16]; - int op; - int op_ret; - int op_errno; - opaque dict<>; - string op_errstr<>; -} ; - -struct gd1_mgmt_friend_update { - unsigned char uuid[16]; - opaque friends<>; - int port; -} ; - -struct gd1_mgmt_friend_update_rsp { - unsigned char uuid[16]; - int op; - int op_ret; - int op_errno; -} ; diff --git a/rpc/xdr/src/glusterfs3-xdr.h b/rpc/xdr/src/glusterfs3-xdr.h index 9f630c47599..4c57bfa409f 100644 --- a/rpc/xdr/src/glusterfs3-xdr.h +++ b/rpc/xdr/src/glusterfs3-xdr.h @@ -30,127 +30,12 @@ //#include #include "xdr-common.h" -#include "iatt.h" #ifdef __cplusplus extern "C" { #endif -#define GF_O_ACCMODE 003 -#define GF_O_RDONLY 00 -#define GF_O_WRONLY 01 -#define GF_O_RDWR 02 -#define GF_O_CREAT 0100 -#define GF_O_EXCL 0200 -#define GF_O_NOCTTY 0400 -#define GF_O_TRUNC 01000 -#define GF_O_APPEND 02000 -#define GF_O_NONBLOCK 04000 -#define GF_O_SYNC 010000 -#define GF_O_ASYNC 020000 - -#define GF_O_DIRECT 040000 -#define GF_O_DIRECTORY 0200000 -#define GF_O_NOFOLLOW 0400000 -#define GF_O_NOATIME 01000000 -#define GF_O_CLOEXEC 02000000 - -#define GF_O_LARGEFILE 0100000 - -#define XLATE_BIT(from, to, bit) do { \ - if (from & bit) \ - to = to | GF_##bit; \ - } while (0) - -#define UNXLATE_BIT(from, to, bit) do { \ - if (from & GF_##bit) \ - to = to | bit; \ - } while (0) - -#define XLATE_ACCESSMODE(from, to) do { \ - switch (from & O_ACCMODE) { \ - case O_RDONLY: to |= GF_O_RDONLY; \ - break; \ - case O_WRONLY: to |= GF_O_WRONLY; \ - break; \ - case O_RDWR: to |= GF_O_RDWR; \ - break; \ - } \ - } while (0) - -#define UNXLATE_ACCESSMODE(from, to) do { \ - switch (from & GF_O_ACCMODE) { \ - case GF_O_RDONLY: to |= O_RDONLY; \ - break; \ - case GF_O_WRONLY: to |= O_WRONLY; \ - break; \ - case GF_O_RDWR: to |= O_RDWR; \ - break; \ - } \ - } while (0) - -static inline uint32_t -gf_flags_from_flags (uint32_t flags) -{ - uint32_t gf_flags = 0; - - XLATE_ACCESSMODE (flags, gf_flags); - - XLATE_BIT (flags, gf_flags, O_CREAT); - XLATE_BIT (flags, gf_flags, O_EXCL); - XLATE_BIT (flags, gf_flags, O_NOCTTY); - XLATE_BIT (flags, gf_flags, O_TRUNC); - XLATE_BIT (flags, gf_flags, O_APPEND); - XLATE_BIT (flags, gf_flags, O_NONBLOCK); - XLATE_BIT (flags, gf_flags, O_SYNC); - XLATE_BIT (flags, gf_flags, O_ASYNC); - - XLATE_BIT (flags, gf_flags, O_DIRECT); - XLATE_BIT (flags, gf_flags, O_DIRECTORY); - XLATE_BIT (flags, gf_flags, O_NOFOLLOW); -#ifdef O_NOATIME - XLATE_BIT (flags, gf_flags, O_NOATIME); -#endif -#ifdef O_CLOEXEC - XLATE_BIT (flags, gf_flags, O_CLOEXEC); -#endif - XLATE_BIT (flags, gf_flags, O_LARGEFILE); - - return gf_flags; -} - -static inline uint32_t -gf_flags_to_flags (uint32_t gf_flags) -{ - uint32_t flags = 0; - - UNXLATE_ACCESSMODE (gf_flags, flags); - - UNXLATE_BIT (gf_flags, flags, O_CREAT); - UNXLATE_BIT (gf_flags, flags, O_EXCL); - UNXLATE_BIT (gf_flags, flags, O_NOCTTY); - UNXLATE_BIT (gf_flags, flags, O_TRUNC); - UNXLATE_BIT (gf_flags, flags, O_APPEND); - UNXLATE_BIT (gf_flags, flags, O_NONBLOCK); - UNXLATE_BIT (gf_flags, flags, O_SYNC); - UNXLATE_BIT (gf_flags, flags, O_ASYNC); - - UNXLATE_BIT (gf_flags, flags, O_DIRECT); - UNXLATE_BIT (gf_flags, flags, O_DIRECTORY); - UNXLATE_BIT (gf_flags, flags, O_NOFOLLOW); -#ifdef O_NOATIME - UNXLATE_BIT (gf_flags, flags, O_NOATIME); -#endif -#ifdef O_CLOEXEC - UNXLATE_BIT (gf_flags, flags, O_CLOEXEC); -#endif - UNXLATE_BIT (gf_flags, flags, O_LARGEFILE); - - return flags; -} - - struct gf_statfs { u_quad_t bsize; u_quad_t frsize; @@ -166,45 +51,6 @@ struct gf_statfs { }; typedef struct gf_statfs gf_statfs; -static inline void -gf_statfs_to_statfs (struct gf_statfs *gf_stat, struct statvfs *stat) -{ - if (!stat || !gf_stat) - return; - - stat->f_bsize = (gf_stat->bsize); - stat->f_frsize = (gf_stat->frsize); - stat->f_blocks = (gf_stat->blocks); - stat->f_bfree = (gf_stat->bfree); - stat->f_bavail = (gf_stat->bavail); - stat->f_files = (gf_stat->files); - stat->f_ffree = (gf_stat->ffree); - stat->f_favail = (gf_stat->favail); - stat->f_fsid = (gf_stat->fsid); - stat->f_flag = (gf_stat->flag); - stat->f_namemax = (gf_stat->namemax); -} - - -static inline void -gf_statfs_from_statfs (struct gf_statfs *gf_stat, struct statvfs *stat) -{ - if (!stat || !gf_stat) - return; - - gf_stat->bsize = stat->f_bsize; - gf_stat->frsize = stat->f_frsize; - gf_stat->blocks = stat->f_blocks; - gf_stat->bfree = stat->f_bfree; - gf_stat->bavail = stat->f_bavail; - gf_stat->files = stat->f_files; - gf_stat->ffree = stat->f_ffree; - gf_stat->favail = stat->f_favail; - gf_stat->fsid = stat->f_fsid; - gf_stat->flag = stat->f_flag; - gf_stat->namemax = stat->f_namemax; -} - struct gf_proto_flock { u_int type; u_int whence; @@ -215,36 +61,6 @@ struct gf_proto_flock { }; typedef struct gf_proto_flock gf_proto_flock; - -static inline void -gf_proto_flock_to_flock (struct gf_proto_flock *gf_proto_flock, struct gf_flock *gf_flock) -{ - if (!gf_flock || !gf_proto_flock) - return; - - gf_flock->l_type = gf_proto_flock->type; - gf_flock->l_whence = gf_proto_flock->whence; - gf_flock->l_start = gf_proto_flock->start; - gf_flock->l_len = gf_proto_flock->len; - gf_flock->l_pid = gf_proto_flock->pid; - gf_flock->l_owner = gf_proto_flock->owner; -} - - -static inline void -gf_proto_flock_from_flock (struct gf_proto_flock *gf_proto_flock, struct gf_flock *gf_flock) -{ - if (!gf_flock || !gf_proto_flock) - return; - - gf_proto_flock->type = (gf_flock->l_type); - gf_proto_flock->whence = (gf_flock->l_whence); - gf_proto_flock->start = (gf_flock->l_start); - gf_proto_flock->len = (gf_flock->l_len); - gf_proto_flock->pid = (gf_flock->l_pid) -; gf_proto_flock->owner = (gf_flock->l_owner); -} - struct gf_iatt { char ia_gfid[16]; u_quad_t ia_ino; @@ -266,60 +82,6 @@ struct gf_iatt { }; typedef struct gf_iatt gf_iatt; - -static inline void -gf_stat_to_iatt (struct gf_iatt *gf_stat, struct iatt *iatt) -{ - if (!iatt || !gf_stat) - return; - - memcpy (iatt->ia_gfid, gf_stat->ia_gfid, 16); - iatt->ia_ino = gf_stat->ia_ino ; - iatt->ia_dev = gf_stat->ia_dev ; - iatt->ia_type = ia_type_from_st_mode (gf_stat->mode) ; - iatt->ia_prot = ia_prot_from_st_mode (gf_stat->mode) ; - iatt->ia_nlink = gf_stat->ia_nlink ; - iatt->ia_uid = gf_stat->ia_uid ; - iatt->ia_gid = gf_stat->ia_gid ; - iatt->ia_rdev = gf_stat->ia_rdev ; - iatt->ia_size = gf_stat->ia_size ; - iatt->ia_blksize = gf_stat->ia_blksize ; - iatt->ia_blocks = gf_stat->ia_blocks ; - iatt->ia_atime = gf_stat->ia_atime ; - iatt->ia_atime_nsec = gf_stat->ia_atime_nsec ; - iatt->ia_mtime = gf_stat->ia_mtime ; - iatt->ia_mtime_nsec = gf_stat->ia_mtime_nsec ; - iatt->ia_ctime = gf_stat->ia_ctime ; - iatt->ia_ctime_nsec = gf_stat->ia_ctime_nsec ; -} - - -static inline void -gf_stat_from_iatt (struct gf_iatt *gf_stat, struct iatt *iatt) -{ - if (!iatt || !gf_stat) - return; - - memcpy (gf_stat->ia_gfid, iatt->ia_gfid, 16); - gf_stat->ia_ino = iatt->ia_ino ; - gf_stat->ia_dev = iatt->ia_dev ; - gf_stat->mode = st_mode_from_ia (iatt->ia_prot, iatt->ia_type); - gf_stat->ia_nlink = iatt->ia_nlink ; - gf_stat->ia_uid = iatt->ia_uid ; - gf_stat->ia_gid = iatt->ia_gid ; - gf_stat->ia_rdev = iatt->ia_rdev ; - gf_stat->ia_size = iatt->ia_size ; - gf_stat->ia_blksize = iatt->ia_blksize ; - gf_stat->ia_blocks = iatt->ia_blocks ; - gf_stat->ia_atime = iatt->ia_atime ; - gf_stat->ia_atime_nsec = iatt->ia_atime_nsec ; - gf_stat->ia_mtime = iatt->ia_mtime ; - gf_stat->ia_mtime_nsec = iatt->ia_mtime_nsec ; - gf_stat->ia_ctime = iatt->ia_ctime ; - gf_stat->ia_ctime_nsec = iatt->ia_ctime_nsec ; -} - - /* Gluster FS Payload structures */ struct gfs3_stat_req { char gfid[16]; @@ -409,7 +171,7 @@ typedef struct gfs3_unlink_rsp gfs3_unlink_rsp; struct gfs3_rmdir_req { char pargfid[16]; - int flags; + int flags; char *path; char *bname; }; diff --git a/rpc/xdr/src/glusterfs3-xdr.x b/rpc/xdr/src/glusterfs3-xdr.x new file mode 100644 index 00000000000..592f7ed70c4 --- /dev/null +++ b/rpc/xdr/src/glusterfs3-xdr.x @@ -0,0 +1,616 @@ +#define GF_REQUEST_MAXGROUPS 16 +struct gf_statfs { + unsigned hyper bsize; + unsigned hyper frsize; + unsigned hyper blocks; + unsigned hyper bfree; + unsigned hyper bavail; + unsigned hyper files; + unsigned hyper ffree; + unsigned hyper favail; + unsigned hyper fsid; + unsigned hyper flag; + unsigned hyper namemax; +}; + +struct gf_proto_flock { + unsigned int type; + unsigned int whence; + unsigned hyper start; + unsigned hyper len; + unsigned int pid; + unsigned hyper owner; +} ; + + +struct gf_iatt { + opaque ia_gfid[16]; + unsigned hyper ia_ino; /* inode number */ + unsigned hyper ia_dev; /* backing device ID */ + unsigned int mode; /* mode (type + protection )*/ + unsigned int ia_nlink; /* Link count */ + unsigned int ia_uid; /* user ID of owner */ + unsigned int ia_gid; /* group ID of owner */ + unsigned hyper ia_rdev; /* device ID (if special file) */ + unsigned hyper ia_size; /* file size in bytes */ + unsigned int ia_blksize; /* blocksize for filesystem I/O */ + unsigned hyper ia_blocks; /* number of 512B blocks allocated */ + unsigned int ia_atime; /* last access time */ + unsigned int ia_atime_nsec; + unsigned int ia_mtime; /* last modification time */ + unsigned int ia_mtime_nsec; + unsigned int ia_ctime; /* last status change time */ + unsigned int ia_ctime_nsec; +}; + +struct gfs3_stat_req { + opaque gfid[16]; + string path<>; /* NULL terminated */ + +}; +struct gfs3_stat_rsp { + int op_ret; + int op_errno; + struct gf_iatt stat; +} ; + + +struct gfs3_readlink_req { + opaque gfid[16]; + unsigned int size; + string path<>; /* NULL terminated */ +} ; + struct gfs3_readlink_rsp { + int op_ret; + int op_errno; + struct gf_iatt buf; + string path<>; /* NULL terminated */ +} ; + + + struct gfs3_mknod_req { + opaque pargfid[16]; + unsigned hyper dev; + unsigned int mode; + string path<>; /* NULL terminated */ + string bname<>; /* NULL terminated */ + opaque dict<>; +} ; + struct gfs3_mknod_rsp { + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; + + + struct gfs3_mkdir_req { + opaque pargfid[16]; + unsigned int mode; + string path<>; /* NULL terminated */ + string bname<>; /* NULL terminated */ + opaque dict<>; +} ; + struct gfs3_mkdir_rsp { + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preparent; + struct gf_iatt postparent; +} ; + + + struct gfs3_unlink_req { + opaque pargfid[16]; + string path<>; /* NULL terminated */ + string bname<>; /* NULL terminated */ +}; + struct gfs3_unlink_rsp { + int op_ret; + int op_errno; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; + + + struct gfs3_rmdir_req { + opaque pargfid[16]; + int flags; + string path<>; + string bname<>; /* NULL terminated */ +}; + struct gfs3_rmdir_rsp { + int op_ret; + int op_errno; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; + + + struct gfs3_symlink_req { + opaque pargfid[16]; + string path<>; + string bname<>; + string linkname<>; + opaque dict<>; +}; + struct gfs3_symlink_rsp { + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; + + + struct gfs3_rename_req { + opaque oldgfid[16]; + opaque newgfid[16]; + string oldpath<>; + string oldbname<>; /* NULL terminated */ + string newpath<>; + string newbname<>; /* NULL terminated */ +}; + struct gfs3_rename_rsp { + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preoldparent; + struct gf_iatt postoldparent; + struct gf_iatt prenewparent; + struct gf_iatt postnewparent; +}; + + + struct gfs3_link_req { + opaque oldgfid[16]; + opaque newgfid[16]; + string oldpath<>; + string newpath<>; + string newbname<>; +}; + struct gfs3_link_rsp { + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; + + struct gfs3_truncate_req { + opaque gfid[16]; + unsigned hyper offset; + string path<>; +}; + struct gfs3_truncate_rsp { + int op_ret; + int op_errno; + struct gf_iatt prestat; + struct gf_iatt poststat; +}; + + + struct gfs3_open_req { + opaque gfid[16]; + unsigned int flags; + unsigned int wbflags; + string path<>; +}; + struct gfs3_open_rsp { + int op_ret; + int op_errno; + hyper fd; +}; + + + struct gfs3_read_req { + opaque gfid[16]; + hyper fd; + unsigned hyper offset; + unsigned int size; +}; + struct gfs3_read_rsp { + int op_ret; + int op_errno; + struct gf_iatt stat; + unsigned int size; +} ; + +struct gfs3_lookup_req { + opaque gfid[16]; + opaque pargfid[16]; + unsigned int flags; + string path<>; + string bname<>; + opaque dict<>; +}; + struct gfs3_lookup_rsp { + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt postparent; + opaque dict<>; +} ; + + + + struct gfs3_write_req { + opaque gfid[16]; + hyper fd; + unsigned hyper offset; + unsigned int size; +}; + struct gfs3_write_rsp { + int op_ret; + int op_errno; + struct gf_iatt prestat; + struct gf_iatt poststat; +} ; + + + struct gfs3_statfs_req { + opaque gfid[16]; + string path<>; +} ; + struct gfs3_statfs_rsp { + int op_ret; + int op_errno; + struct gf_statfs statfs; +} ; + + struct gfs3_lk_req { + opaque gfid[16]; + hyper fd; + unsigned int cmd; + unsigned int type; + struct gf_proto_flock flock; +} ; + struct gfs3_lk_rsp { + int op_ret; + int op_errno; + struct gf_proto_flock flock; +} ; + + struct gfs3_inodelk_req { + opaque gfid[16]; + unsigned int cmd; + unsigned int type; + struct gf_proto_flock flock; + string path<>; + string volume<>; +} ; + +struct gfs3_finodelk_req { + opaque gfid[16]; + hyper fd; + unsigned int cmd; + unsigned int type; + struct gf_proto_flock flock; + string volume<>; +} ; + + + struct gfs3_flush_req { + opaque gfid[16]; + hyper fd; +} ; + + + struct gfs3_fsync_req { + opaque gfid[16]; + hyper fd; + unsigned int data; +} ; + struct gfs3_fsync_rsp { + int op_ret; + int op_errno; + struct gf_iatt prestat; + struct gf_iatt poststat; +} ; + + + struct gfs3_setxattr_req { + opaque gfid[16]; + unsigned int flags; + opaque dict<>; + string path<>; +} ; + + + + struct gfs3_fsetxattr_req { + opaque gfid[16]; + hyper fd; + unsigned int flags; + opaque dict<>; +} ; + + + + struct gfs3_xattrop_req { + opaque gfid[16]; + unsigned int flags; + opaque dict<>; + string path<>; +} ; + + struct gfs3_xattrop_rsp { + int op_ret; + int op_errno; + opaque dict<>; +} ; + + + struct gfs3_fxattrop_req { + opaque gfid[16]; + hyper fd; + unsigned int flags; + opaque dict<>; +} ; + + struct gfs3_fxattrop_rsp { + int op_ret; + int op_errno; + opaque dict<>; +} ; + + + struct gfs3_getxattr_req { + opaque gfid[16]; + unsigned int namelen; + string path<>; + string name<>; +} ; + struct gfs3_getxattr_rsp { + int op_ret; + int op_errno; + opaque dict<>; +} ; + + + struct gfs3_fgetxattr_req { + opaque gfid[16]; + hyper fd; + unsigned int namelen; + string name<>; +} ; + struct gfs3_fgetxattr_rsp { + int op_ret; + int op_errno; + opaque dict<>; +} ; + + + struct gfs3_removexattr_req { + opaque gfid[16]; + string path<>; + string name<>; +} ; + + + + struct gfs3_opendir_req { + opaque gfid[16]; + string path<>; +} ; + struct gfs3_opendir_rsp { + int op_ret; + int op_errno; + hyper fd; +} ; + + + struct gfs3_fsyncdir_req { + opaque gfid[16]; + hyper fd; + int data; +} ; + + struct gfs3_readdir_req { + opaque gfid[16]; + hyper fd; + unsigned hyper offset; + unsigned int size; +}; + + struct gfs3_readdirp_req { + opaque gfid[16]; + hyper fd; + unsigned hyper offset; + unsigned int size; +} ; + + + struct gf_setvolume_req { + opaque dict<>; +} ; + struct gf_setvolume_rsp { + int op_ret; + int op_errno; + opaque dict<>; +} ; + +struct gfs3_access_req { + opaque gfid[16]; + unsigned int mask; + string path<>; +} ; + + +struct gfs3_create_req { + opaque pargfid[16]; + unsigned int flags; + unsigned int mode; + string path<>; + string bname<>; + opaque dict<>; +} ; +struct gfs3_create_rsp { + int op_ret; + int op_errno; + struct gf_iatt stat; + unsigned hyper fd; + struct gf_iatt preparent; + struct gf_iatt postparent; +} ; + + + +struct gfs3_ftruncate_req { + opaque gfid[16]; + hyper fd; + unsigned hyper offset; +} ; +struct gfs3_ftruncate_rsp { + int op_ret; + int op_errno; + struct gf_iatt prestat; + struct gf_iatt poststat; +} ; + + +struct gfs3_fstat_req { + opaque gfid[16]; + hyper fd; +} ; + struct gfs3_fstat_rsp { + int op_ret; + int op_errno; + struct gf_iatt stat; +} ; + + + + struct gfs3_entrylk_req { + opaque gfid[16]; + unsigned int cmd; + unsigned int type; + unsigned hyper namelen; + string path<>; + string name<>; + string volume<>; +}; + + struct gfs3_fentrylk_req { + opaque gfid[16]; + hyper fd; + unsigned int cmd; + unsigned int type; + unsigned hyper namelen; + string name<>; + string volume<>; +}; + + + struct gfs3_setattr_req { + opaque gfid[16]; + struct gf_iatt stbuf; + int valid; + string path<>; +} ; + struct gfs3_setattr_rsp { + int op_ret; + int op_errno; + struct gf_iatt statpre; + struct gf_iatt statpost; +} ; + + struct gfs3_fsetattr_req { + hyper fd; + struct gf_iatt stbuf; + int valid; +} ; + struct gfs3_fsetattr_rsp { + int op_ret; + int op_errno; + struct gf_iatt statpre; + struct gf_iatt statpost; +} ; + + struct gfs3_rchecksum_req { + hyper fd; + unsigned hyper offset; + unsigned int len; +} ; + struct gfs3_rchecksum_rsp { + int op_ret; + int op_errno; + unsigned int weak_checksum; + opaque strong_checksum<>; +} ; + + + struct gf_getspec_req { + unsigned int flags; + string key<>; +} ; + struct gf_getspec_rsp { + int op_ret; + int op_errno; + string spec<>; +} ; + + + struct gf_log_req { + opaque msg<>; +}; + + struct gf_notify_req { + unsigned int flags; + string buf<>; +} ; + struct gf_notify_rsp { + int op_ret; + int op_errno; + unsigned int flags; + string buf<>; +} ; + +struct gfs3_releasedir_req { + opaque gfid[16]; + hyper fd; +} ; + +struct gfs3_release_req { + opaque gfid[16]; + hyper fd; +} ; + +struct gf_common_rsp { + int op_ret; + int op_errno; +} ; + +struct gfs3_dirlist { + unsigned hyper d_ino; + unsigned hyper d_off; + unsigned int d_len; + unsigned int d_type; + string name<>; + struct gfs3_dirlist *nextentry; +}; + + +struct gfs3_readdir_rsp { + int op_ret; + int op_errno; + struct gfs3_dirlist *reply; +}; + +struct gfs3_dirplist { + unsigned hyper d_ino; + unsigned hyper d_off; + unsigned int d_len; + unsigned int d_type; + string name<>; + struct gf_iatt stat; + struct gfs3_dirplist *nextentry; +}; + +struct gfs3_readdirp_rsp { + int op_ret; + int op_errno; + struct gfs3_dirplist *reply; +}; + diff --git a/rpc/xdr/src/glusterfs3.h b/rpc/xdr/src/glusterfs3.h index 363eca246cb..ecee1fea471 100644 --- a/rpc/xdr/src/glusterfs3.h +++ b/rpc/xdr/src/glusterfs3.h @@ -24,6 +24,7 @@ #include #include "glusterfs3-xdr.h" +#include "iatt.h" #define xdr_decoded_remaining_addr(xdr) ((&xdr)->x_private) #define xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy) @@ -31,6 +32,240 @@ #define xdr_decoded_length(xdr) (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base)) +#define GF_O_ACCMODE 003 +#define GF_O_RDONLY 00 +#define GF_O_WRONLY 01 +#define GF_O_RDWR 02 +#define GF_O_CREAT 0100 +#define GF_O_EXCL 0200 +#define GF_O_NOCTTY 0400 +#define GF_O_TRUNC 01000 +#define GF_O_APPEND 02000 +#define GF_O_NONBLOCK 04000 +#define GF_O_SYNC 010000 +#define GF_O_ASYNC 020000 + +#define GF_O_DIRECT 040000 +#define GF_O_DIRECTORY 0200000 +#define GF_O_NOFOLLOW 0400000 +#define GF_O_NOATIME 01000000 +#define GF_O_CLOEXEC 02000000 + +#define GF_O_LARGEFILE 0100000 + +#define XLATE_BIT(from, to, bit) do { \ + if (from & bit) \ + to = to | GF_##bit; \ + } while (0) + +#define UNXLATE_BIT(from, to, bit) do { \ + if (from & GF_##bit) \ + to = to | bit; \ + } while (0) + +#define XLATE_ACCESSMODE(from, to) do { \ + switch (from & O_ACCMODE) { \ + case O_RDONLY: to |= GF_O_RDONLY; \ + break; \ + case O_WRONLY: to |= GF_O_WRONLY; \ + break; \ + case O_RDWR: to |= GF_O_RDWR; \ + break; \ + } \ + } while (0) + +#define UNXLATE_ACCESSMODE(from, to) do { \ + switch (from & GF_O_ACCMODE) { \ + case GF_O_RDONLY: to |= O_RDONLY; \ + break; \ + case GF_O_WRONLY: to |= O_WRONLY; \ + break; \ + case GF_O_RDWR: to |= O_RDWR; \ + break; \ + } \ + } while (0) + +static inline uint32_t +gf_flags_from_flags (uint32_t flags) +{ + uint32_t gf_flags = 0; + + XLATE_ACCESSMODE (flags, gf_flags); + + XLATE_BIT (flags, gf_flags, O_CREAT); + XLATE_BIT (flags, gf_flags, O_EXCL); + XLATE_BIT (flags, gf_flags, O_NOCTTY); + XLATE_BIT (flags, gf_flags, O_TRUNC); + XLATE_BIT (flags, gf_flags, O_APPEND); + XLATE_BIT (flags, gf_flags, O_NONBLOCK); + XLATE_BIT (flags, gf_flags, O_SYNC); + XLATE_BIT (flags, gf_flags, O_ASYNC); + + XLATE_BIT (flags, gf_flags, O_DIRECT); + XLATE_BIT (flags, gf_flags, O_DIRECTORY); + XLATE_BIT (flags, gf_flags, O_NOFOLLOW); +#ifdef O_NOATIME + XLATE_BIT (flags, gf_flags, O_NOATIME); +#endif +#ifdef O_CLOEXEC + XLATE_BIT (flags, gf_flags, O_CLOEXEC); +#endif + XLATE_BIT (flags, gf_flags, O_LARGEFILE); + + return gf_flags; +} + +static inline uint32_t +gf_flags_to_flags (uint32_t gf_flags) +{ + uint32_t flags = 0; + + UNXLATE_ACCESSMODE (gf_flags, flags); + + UNXLATE_BIT (gf_flags, flags, O_CREAT); + UNXLATE_BIT (gf_flags, flags, O_EXCL); + UNXLATE_BIT (gf_flags, flags, O_NOCTTY); + UNXLATE_BIT (gf_flags, flags, O_TRUNC); + UNXLATE_BIT (gf_flags, flags, O_APPEND); + UNXLATE_BIT (gf_flags, flags, O_NONBLOCK); + UNXLATE_BIT (gf_flags, flags, O_SYNC); + UNXLATE_BIT (gf_flags, flags, O_ASYNC); + + UNXLATE_BIT (gf_flags, flags, O_DIRECT); + UNXLATE_BIT (gf_flags, flags, O_DIRECTORY); + UNXLATE_BIT (gf_flags, flags, O_NOFOLLOW); +#ifdef O_NOATIME + UNXLATE_BIT (gf_flags, flags, O_NOATIME); +#endif +#ifdef O_CLOEXEC + UNXLATE_BIT (gf_flags, flags, O_CLOEXEC); +#endif + UNXLATE_BIT (gf_flags, flags, O_LARGEFILE); + + return flags; +} + + +static inline void +gf_statfs_to_statfs (struct gf_statfs *gf_stat, struct statvfs *stat) +{ + if (!stat || !gf_stat) + return; + + stat->f_bsize = (gf_stat->bsize); + stat->f_frsize = (gf_stat->frsize); + stat->f_blocks = (gf_stat->blocks); + stat->f_bfree = (gf_stat->bfree); + stat->f_bavail = (gf_stat->bavail); + stat->f_files = (gf_stat->files); + stat->f_ffree = (gf_stat->ffree); + stat->f_favail = (gf_stat->favail); + stat->f_fsid = (gf_stat->fsid); + stat->f_flag = (gf_stat->flag); + stat->f_namemax = (gf_stat->namemax); +} + + +static inline void +gf_statfs_from_statfs (struct gf_statfs *gf_stat, struct statvfs *stat) +{ + if (!stat || !gf_stat) + return; + + gf_stat->bsize = stat->f_bsize; + gf_stat->frsize = stat->f_frsize; + gf_stat->blocks = stat->f_blocks; + gf_stat->bfree = stat->f_bfree; + gf_stat->bavail = stat->f_bavail; + gf_stat->files = stat->f_files; + gf_stat->ffree = stat->f_ffree; + gf_stat->favail = stat->f_favail; + gf_stat->fsid = stat->f_fsid; + gf_stat->flag = stat->f_flag; + gf_stat->namemax = stat->f_namemax; +} + +static inline void +gf_proto_flock_to_flock (struct gf_proto_flock *gf_proto_flock, struct gf_flock *gf_flock) +{ + if (!gf_flock || !gf_proto_flock) + return; + + gf_flock->l_type = gf_proto_flock->type; + gf_flock->l_whence = gf_proto_flock->whence; + gf_flock->l_start = gf_proto_flock->start; + gf_flock->l_len = gf_proto_flock->len; + gf_flock->l_pid = gf_proto_flock->pid; + gf_flock->l_owner = gf_proto_flock->owner; +} + + +static inline void +gf_proto_flock_from_flock (struct gf_proto_flock *gf_proto_flock, struct gf_flock *gf_flock) +{ + if (!gf_flock || !gf_proto_flock) + return; + + gf_proto_flock->type = (gf_flock->l_type); + gf_proto_flock->whence = (gf_flock->l_whence); + gf_proto_flock->start = (gf_flock->l_start); + gf_proto_flock->len = (gf_flock->l_len); + gf_proto_flock->pid = (gf_flock->l_pid); + gf_proto_flock->owner = (gf_flock->l_owner); +} + +static inline void +gf_stat_to_iatt (struct gf_iatt *gf_stat, struct iatt *iatt) +{ + if (!iatt || !gf_stat) + return; + + memcpy (iatt->ia_gfid, gf_stat->ia_gfid, 16); + iatt->ia_ino = gf_stat->ia_ino ; + iatt->ia_dev = gf_stat->ia_dev ; + iatt->ia_type = ia_type_from_st_mode (gf_stat->mode) ; + iatt->ia_prot = ia_prot_from_st_mode (gf_stat->mode) ; + iatt->ia_nlink = gf_stat->ia_nlink ; + iatt->ia_uid = gf_stat->ia_uid ; + iatt->ia_gid = gf_stat->ia_gid ; + iatt->ia_rdev = gf_stat->ia_rdev ; + iatt->ia_size = gf_stat->ia_size ; + iatt->ia_blksize = gf_stat->ia_blksize ; + iatt->ia_blocks = gf_stat->ia_blocks ; + iatt->ia_atime = gf_stat->ia_atime ; + iatt->ia_atime_nsec = gf_stat->ia_atime_nsec ; + iatt->ia_mtime = gf_stat->ia_mtime ; + iatt->ia_mtime_nsec = gf_stat->ia_mtime_nsec ; + iatt->ia_ctime = gf_stat->ia_ctime ; + iatt->ia_ctime_nsec = gf_stat->ia_ctime_nsec ; +} + + +static inline void +gf_stat_from_iatt (struct gf_iatt *gf_stat, struct iatt *iatt) +{ + if (!iatt || !gf_stat) + return; + + memcpy (gf_stat->ia_gfid, iatt->ia_gfid, 16); + gf_stat->ia_ino = iatt->ia_ino ; + gf_stat->ia_dev = iatt->ia_dev ; + gf_stat->mode = st_mode_from_ia (iatt->ia_prot, iatt->ia_type); + gf_stat->ia_nlink = iatt->ia_nlink ; + gf_stat->ia_uid = iatt->ia_uid ; + gf_stat->ia_gid = iatt->ia_gid ; + gf_stat->ia_rdev = iatt->ia_rdev ; + gf_stat->ia_size = iatt->ia_size ; + gf_stat->ia_blksize = iatt->ia_blksize ; + gf_stat->ia_blocks = iatt->ia_blocks ; + gf_stat->ia_atime = iatt->ia_atime ; + gf_stat->ia_atime_nsec = iatt->ia_atime_nsec ; + gf_stat->ia_mtime = iatt->ia_mtime ; + gf_stat->ia_mtime_nsec = iatt->ia_mtime_nsec ; + gf_stat->ia_ctime = iatt->ia_ctime ; + gf_stat->ia_ctime_nsec = iatt->ia_ctime_nsec ; +} + /* FOPS */ ssize_t xdr_serialize_lookup_rsp (struct iovec outmsg, void *resp); diff --git a/rpc/xdr/src/glusterfs3.x b/rpc/xdr/src/glusterfs3.x deleted file mode 100644 index 0bc1c915d35..00000000000 --- a/rpc/xdr/src/glusterfs3.x +++ /dev/null @@ -1,645 +0,0 @@ -#define GF_REQUEST_MAXGROUPS 16 -struct gf_statfs { - unsigned hyper bsize; - unsigned hyper frsize; - unsigned hyper blocks; - unsigned hyper bfree; - unsigned hyper bavail; - unsigned hyper files; - unsigned hyper ffree; - unsigned hyper favail; - unsigned hyper fsid; - unsigned hyper flag; - unsigned hyper namemax; -}; - -struct gf_proto_flock { - unsigned int type; - unsigned int whence; - unsigned hyper start; - unsigned hyper len; - unsigned int pid; - unsigned hyper owner; -} ; - - -struct gf_iatt { - opaque ia_gfid[16]; - unsigned hyper ia_ino; /* inode number */ - unsigned hyper ia_dev; /* backing device ID */ - unsigned int mode; /* mode (type + protection )*/ - unsigned int ia_nlink; /* Link count */ - unsigned int ia_uid; /* user ID of owner */ - unsigned int ia_gid; /* group ID of owner */ - unsigned hyper ia_rdev; /* device ID (if special file) */ - unsigned hyper ia_size; /* file size in bytes */ - unsigned int ia_blksize; /* blocksize for filesystem I/O */ - unsigned hyper ia_blocks; /* number of 512B blocks allocated */ - unsigned int ia_atime; /* last access time */ - unsigned int ia_atime_nsec; - unsigned int ia_mtime; /* last modification time */ - unsigned int ia_mtime_nsec; - unsigned int ia_ctime; /* last status change time */ - unsigned int ia_ctime_nsec; -}; - -struct gfs3_stat_req { - opaque gfid[16]; - string path<>; /* NULL terminated */ - -}; -struct gfs3_stat_rsp { - int op_ret; - int op_errno; - struct gf_iatt stat; -} ; - - -struct gfs3_readlink_req { - opaque gfid[16]; - unsigned int size; - string path<>; /* NULL terminated */ -} ; - struct gfs3_readlink_rsp { - int op_ret; - int op_errno; - struct gf_iatt buf; - string path<>; /* NULL terminated */ -} ; - - - struct gfs3_mknod_req { - opaque pargfid[16]; - unsigned hyper dev; - unsigned int mode; - string path<>; /* NULL terminated */ - string bname<>; /* NULL terminated */ - opaque dict<>; -} ; - struct gfs3_mknod_rsp { - int op_ret; - int op_errno; - struct gf_iatt stat; - struct gf_iatt preparent; - struct gf_iatt postparent; -}; - - - struct gfs3_mkdir_req { - opaque pargfid[16]; - unsigned int mode; - string path<>; /* NULL terminated */ - string bname<>; /* NULL terminated */ - opaque dict<>; -} ; - struct gfs3_mkdir_rsp { - int op_ret; - int op_errno; - struct gf_iatt stat; - struct gf_iatt preparent; - struct gf_iatt postparent; -} ; - - - struct gfs3_unlink_req { - opaque pargfid[16]; - string path<>; /* NULL terminated */ - string bname<>; /* NULL terminated */ -}; - struct gfs3_unlink_rsp { - int op_ret; - int op_errno; - struct gf_iatt preparent; - struct gf_iatt postparent; -}; - - - struct gfs3_rmdir_req { - opaque pargfid[16]; - int flags; - string path<>; - string bname<>; /* NULL terminated */ -}; - struct gfs3_rmdir_rsp { - int op_ret; - int op_errno; - struct gf_iatt preparent; - struct gf_iatt postparent; -}; - - - struct gfs3_symlink_req { - opaque pargfid[16]; - string path<>; - string bname<>; - string linkname<>; - opaque dict<>; -}; - struct gfs3_symlink_rsp { - int op_ret; - int op_errno; - struct gf_iatt stat; - struct gf_iatt preparent; - struct gf_iatt postparent; -}; - - - struct gfs3_rename_req { - opaque oldgfid[16]; - opaque newgfid[16]; - string oldpath<>; - string oldbname<>; /* NULL terminated */ - string newpath<>; - string newbname<>; /* NULL terminated */ -}; - struct gfs3_rename_rsp { - int op_ret; - int op_errno; - struct gf_iatt stat; - struct gf_iatt preoldparent; - struct gf_iatt postoldparent; - struct gf_iatt prenewparent; - struct gf_iatt postnewparent; -}; - - - struct gfs3_link_req { - opaque oldgfid[16]; - opaque newgfid[16]; - string oldpath<>; - string newpath<>; - string newbname<>; -}; - struct gfs3_link_rsp { - int op_ret; - int op_errno; - struct gf_iatt stat; - struct gf_iatt preparent; - struct gf_iatt postparent; -}; - - struct gfs3_truncate_req { - opaque gfid[16]; - unsigned hyper offset; - string path<>; -}; - struct gfs3_truncate_rsp { - int op_ret; - int op_errno; - struct gf_iatt prestat; - struct gf_iatt poststat; -}; - - - struct gfs3_open_req { - opaque gfid[16]; - unsigned int flags; - unsigned int wbflags; - string path<>; -}; - struct gfs3_open_rsp { - int op_ret; - int op_errno; - hyper fd; -}; - - - struct gfs3_read_req { - opaque gfid[16]; - hyper fd; - unsigned hyper offset; - unsigned int size; -}; - struct gfs3_read_rsp { - int op_ret; - int op_errno; - struct gf_iatt stat; - unsigned int size; -} ; - -struct gfs3_lookup_req { - opaque gfid[16]; - opaque pargfid[16]; - unsigned int flags; - string path<>; - string bname<>; - opaque dict<>; -}; - struct gfs3_lookup_rsp { - int op_ret; - int op_errno; - struct gf_iatt stat; - struct gf_iatt postparent; - opaque dict<>; -} ; - - - - struct gfs3_write_req { - opaque gfid[16]; - hyper fd; - unsigned hyper offset; - unsigned int size; -}; - struct gfs3_write_rsp { - int op_ret; - int op_errno; - struct gf_iatt prestat; - struct gf_iatt poststat; -} ; - - - struct gfs3_statfs_req { - opaque gfid[16]; - string path<>; -} ; - struct gfs3_statfs_rsp { - int op_ret; - int op_errno; - struct gf_statfs statfs; -} ; - - struct gfs3_lk_req { - opaque gfid[16]; - hyper fd; - unsigned int cmd; - unsigned int type; - struct gf_proto_flock flock; -} ; - struct gfs3_lk_rsp { - int op_ret; - int op_errno; - struct gf_proto_flock flock; -} ; - - struct gfs3_inodelk_req { - opaque gfid[16]; - unsigned int cmd; - unsigned int type; - struct gf_proto_flock flock; - string path<>; - string volume<>; -} ; - -struct gfs3_finodelk_req { - opaque gfid[16]; - hyper fd; - unsigned int cmd; - unsigned int type; - struct gf_proto_flock flock; - string volume<>; -} ; - - - struct gfs3_flush_req { - opaque gfid[16]; - hyper fd; -} ; - - - struct gfs3_fsync_req { - opaque gfid[16]; - hyper fd; - unsigned int data; -} ; - struct gfs3_fsync_rsp { - int op_ret; - int op_errno; - struct gf_iatt prestat; - struct gf_iatt poststat; -} ; - - - struct gfs3_setxattr_req { - opaque gfid[16]; - unsigned int flags; - opaque dict<>; - string path<>; -} ; - - - - struct gfs3_fsetxattr_req { - opaque gfid[16]; - hyper fd; - unsigned int flags; - opaque dict<>; -} ; - - - - struct gfs3_xattrop_req { - opaque gfid[16]; - unsigned int flags; - opaque dict<>; - string path<>; -} ; - - struct gfs3_xattrop_rsp { - int op_ret; - int op_errno; - opaque dict<>; -} ; - - - struct gfs3_fxattrop_req { - opaque gfid[16]; - hyper fd; - unsigned int flags; - opaque dict<>; -} ; - - struct gfs3_fxattrop_rsp { - int op_ret; - int op_errno; - opaque dict<>; -} ; - - - struct gfs3_getxattr_req { - opaque gfid[16]; - unsigned int namelen; - string path<>; - string name<>; -} ; - struct gfs3_getxattr_rsp { - int op_ret; - int op_errno; - opaque dict<>; -} ; - - - struct gfs3_fgetxattr_req { - opaque gfid[16]; - hyper fd; - unsigned int namelen; - string name<>; -} ; - struct gfs3_fgetxattr_rsp { - int op_ret; - int op_errno; - opaque dict<>; -} ; - - - struct gfs3_removexattr_req { - opaque gfid[16]; - string path<>; - string name<>; -} ; - - - - struct gfs3_opendir_req { - opaque gfid[16]; - string path<>; -} ; - struct gfs3_opendir_rsp { - int op_ret; - int op_errno; - hyper fd; -} ; - - - struct gfs3_fsyncdir_req { - opaque gfid[16]; - hyper fd; - int data; -} ; - - struct gfs3_readdir_req { - opaque gfid[16]; - hyper fd; - unsigned hyper offset; - unsigned int size; -}; - - struct gfs3_readdirp_req { - opaque gfid[16]; - hyper fd; - unsigned hyper offset; - unsigned int size; -} ; - - - struct gf_setvolume_req { - opaque dict<>; -} ; - struct gf_setvolume_rsp { - int op_ret; - int op_errno; - opaque dict<>; -} ; - -struct gfs3_access_req { - opaque gfid[16]; - unsigned int mask; - string path<>; -} ; - - -struct gfs3_create_req { - opaque pargfid[16]; - unsigned int flags; - unsigned int mode; - string path<>; - string bname<>; - opaque dict<>; -} ; -struct gfs3_create_rsp { - int op_ret; - int op_errno; - struct gf_iatt stat; - unsigned hyper fd; - struct gf_iatt preparent; - struct gf_iatt postparent; -} ; - - - -struct gfs3_ftruncate_req { - opaque gfid[16]; - hyper fd; - unsigned hyper offset; -} ; -struct gfs3_ftruncate_rsp { - int op_ret; - int op_errno; - struct gf_iatt prestat; - struct gf_iatt poststat; -} ; - - -struct gfs3_fstat_req { - opaque gfid[16]; - hyper fd; -} ; - struct gfs3_fstat_rsp { - int op_ret; - int op_errno; - struct gf_iatt stat; -} ; - - - - struct gfs3_entrylk_req { - opaque gfid[16]; - unsigned int cmd; - unsigned int type; - unsigned hyper namelen; - string path<>; - string name<>; - string volume<>; -}; - - struct gfs3_fentrylk_req { - opaque gfid[16]; - hyper fd; - unsigned int cmd; - unsigned int type; - unsigned hyper namelen; - string name<>; - string volume<>; -}; - - - struct gfs3_setattr_req { - opaque gfid[16]; - struct gf_iatt stbuf; - int valid; - string path<>; -} ; - struct gfs3_setattr_rsp { - int op_ret; - int op_errno; - struct gf_iatt statpre; - struct gf_iatt statpost; -} ; - - struct gfs3_fsetattr_req { - hyper fd; - struct gf_iatt stbuf; - int valid; -} ; - struct gfs3_fsetattr_rsp { - int op_ret; - int op_errno; - struct gf_iatt statpre; - struct gf_iatt statpost; -} ; - - struct gfs3_rchecksum_req { - hyper fd; - unsigned hyper offset; - unsigned int len; -} ; - struct gfs3_rchecksum_rsp { - int op_ret; - int op_errno; - unsigned int weak_checksum; - opaque strong_checksum<>; -} ; - - - struct gf_getspec_req { - unsigned int flags; - string key<>; -} ; - struct gf_getspec_rsp { - int op_ret; - int op_errno; - string spec<>; -} ; - - - struct gf_log_req { - opaque msg<>; -}; - - struct gf_notify_req { - unsigned int flags; - string buf<>; -} ; - struct gf_notify_rsp { - int op_ret; - int op_errno; - unsigned int flags; - string buf<>; -} ; - -struct gfs3_releasedir_req { - opaque gfid[16]; - hyper fd; -} ; - -struct gfs3_release_req { - opaque gfid[16]; - hyper fd; -} ; - -struct gf_common_rsp { - int op_ret; - int op_errno; -} ; - -struct gfs3_dirlist { - unsigned hyper d_ino; - unsigned hyper d_off; - unsigned int d_len; - unsigned int d_type; - string name<>; - struct gfs3_dirlist *nextentry; -}; - - -struct gfs3_readdir_rsp { - int op_ret; - int op_errno; - struct gfs3_dirlist *reply; -}; - -struct gfs3_dirplist { - unsigned hyper d_ino; - unsigned hyper d_off; - unsigned int d_len; - unsigned int d_type; - string name<>; - struct gf_iatt stat; - struct gfs3_dirplist *nextentry; -}; - -struct gfs3_readdirp_rsp { - int op_ret; - int op_errno; - struct gfs3_dirplist *reply; -}; - -struct gf_dump_req { -}; - -struct gf_prog_detail { - string progname<>; - unsigned hyper prognum; - unsigned hyper progver; - struct gf_prog_detail *next; -}; - -struct gf_dump_rsp { - struct gf_prog_detail *prog; -}; - -struct auth_glusterfs_parms { - unsigned int pid; - unsigned int uid; - unsigned int gid; - - /* Number of groups being sent through the array above. */ - unsigned int ngrps; - - /* Array of groups to which the uid belongs apart from the primary group - * in gid. - */ - unsigned int groups[GF_REQUEST_MAXGROUPS]; - - unsigned hyper lk_owner; -}; diff --git a/rpc/xdr/src/portmap-xdr.x b/rpc/xdr/src/portmap-xdr.x new file mode 100644 index 00000000000..f60dcc76c8e --- /dev/null +++ b/rpc/xdr/src/portmap-xdr.x @@ -0,0 +1,55 @@ + +struct pmap_port_by_brick_req { + string brick<>; +}; + +struct pmap_port_by_brick_rsp { + int op_ret; + int op_errno; + int status; + int port; +}; + + +struct pmap_brick_by_port_req { + int port; +}; + +struct pmap_brick_by_port_rsp { + int op_ret; + int op_errno; + int status; + string brick<>; +}; + + +struct pmap_signup_req { + string brick<>; + int port; +}; + +struct pmap_signup_rsp { + int op_ret; + int op_errno; +}; + + +struct pmap_signin_req { + string brick<>; + int port; +}; + +struct pmap_signin_rsp { + int op_ret; + int op_errno; +}; + +struct pmap_signout_req { + string brick<>; + int port; +}; + +struct pmap_signout_rsp { + int op_ret; + int op_errno; +}; diff --git a/rpc/xdr/src/portmap.x b/rpc/xdr/src/portmap.x deleted file mode 100644 index 6e9f07c4534..00000000000 --- a/rpc/xdr/src/portmap.x +++ /dev/null @@ -1,45 +0,0 @@ - -struct pmap_port_by_brick_req { - string brick<>; -}; - -struct pmap_port_by_brick_rsp { - int op_ret; - int op_errno; - int status; - int port; -}; - - -struct pmap_brick_by_port_req { - int port; -}; - -struct pmap_brick_by_port_rsp { - int op_ret; - int op_errno; - int status; - string brick<>; -}; - - -struct pmap_signup_req { -}; - -struct pmap_signup_rsp { -}; - - -struct pmap_signon_req { -}; - -struct pmap_signon_rsp { -}; - - -struct pmap_signoff_req { -}; - -struct pmap_signoff_rsp { -}; - -- cgit