diff options
Diffstat (limited to 'rpc/rpc-lib/src')
-rw-r--r-- | rpc/rpc-lib/src/protocol-common.h | 567 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt-ping.h | 5 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.h | 277 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-drc.h | 96 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-lib-messages.h | 23 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-transport.h | 313 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc-common.h | 119 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc.h | 734 | ||||
-rw-r--r-- | rpc/rpc-lib/src/xdr-common.h | 41 | ||||
-rw-r--r-- | rpc/rpc-lib/src/xdr-rpc.h | 86 | ||||
-rw-r--r-- | rpc/rpc-lib/src/xdr-rpcclnt.h | 21 |
11 files changed, 1129 insertions, 1153 deletions
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h index 1dfd6d5128b..4950857ae9e 100644 --- a/rpc/rpc-lib/src/protocol-common.h +++ b/rpc/rpc-lib/src/protocol-common.h @@ -12,366 +12,367 @@ #define _PROTOCOL_COMMON_H enum gf_fop_procnum { - GFS3_OP_NULL, /* 0 */ - GFS3_OP_STAT, - GFS3_OP_READLINK, - GFS3_OP_MKNOD, - GFS3_OP_MKDIR, - GFS3_OP_UNLINK, - GFS3_OP_RMDIR, - GFS3_OP_SYMLINK, - GFS3_OP_RENAME, - GFS3_OP_LINK, - GFS3_OP_TRUNCATE, - GFS3_OP_OPEN, - GFS3_OP_READ, - GFS3_OP_WRITE, - GFS3_OP_STATFS, - GFS3_OP_FLUSH, - GFS3_OP_FSYNC, - GFS3_OP_SETXATTR, - GFS3_OP_GETXATTR, - GFS3_OP_REMOVEXATTR, - GFS3_OP_OPENDIR, - GFS3_OP_FSYNCDIR, - GFS3_OP_ACCESS, - GFS3_OP_CREATE, - GFS3_OP_FTRUNCATE, - GFS3_OP_FSTAT, - GFS3_OP_LK, - GFS3_OP_LOOKUP, - GFS3_OP_READDIR, - GFS3_OP_INODELK, - GFS3_OP_FINODELK, - GFS3_OP_ENTRYLK, - GFS3_OP_FENTRYLK, - GFS3_OP_XATTROP, - GFS3_OP_FXATTROP, - GFS3_OP_FGETXATTR, - GFS3_OP_FSETXATTR, - GFS3_OP_RCHECKSUM, - GFS3_OP_SETATTR, - GFS3_OP_FSETATTR, - GFS3_OP_READDIRP, - GFS3_OP_RELEASE, - GFS3_OP_RELEASEDIR, - GFS3_OP_FREMOVEXATTR, - GFS3_OP_FALLOCATE, - GFS3_OP_DISCARD, - GFS3_OP_ZEROFILL, - GFS3_OP_IPC, - GFS3_OP_SEEK, - GFS3_OP_COMPOUND, - GFS3_OP_LEASE, - GFS3_OP_GETACTIVELK, - GFS3_OP_SETACTIVELK, - GFS3_OP_ICREATE, - GFS3_OP_NAMELINK, - GFS3_OP_PUT, - GFS3_OP_MAXVALUE, + GFS3_OP_NULL, /* 0 */ + GFS3_OP_STAT, + GFS3_OP_READLINK, + GFS3_OP_MKNOD, + GFS3_OP_MKDIR, + GFS3_OP_UNLINK, + GFS3_OP_RMDIR, + GFS3_OP_SYMLINK, + GFS3_OP_RENAME, + GFS3_OP_LINK, + GFS3_OP_TRUNCATE, + GFS3_OP_OPEN, + GFS3_OP_READ, + GFS3_OP_WRITE, + GFS3_OP_STATFS, + GFS3_OP_FLUSH, + GFS3_OP_FSYNC, + GFS3_OP_SETXATTR, + GFS3_OP_GETXATTR, + GFS3_OP_REMOVEXATTR, + GFS3_OP_OPENDIR, + GFS3_OP_FSYNCDIR, + GFS3_OP_ACCESS, + GFS3_OP_CREATE, + GFS3_OP_FTRUNCATE, + GFS3_OP_FSTAT, + GFS3_OP_LK, + GFS3_OP_LOOKUP, + GFS3_OP_READDIR, + GFS3_OP_INODELK, + GFS3_OP_FINODELK, + GFS3_OP_ENTRYLK, + GFS3_OP_FENTRYLK, + GFS3_OP_XATTROP, + GFS3_OP_FXATTROP, + GFS3_OP_FGETXATTR, + GFS3_OP_FSETXATTR, + GFS3_OP_RCHECKSUM, + GFS3_OP_SETATTR, + GFS3_OP_FSETATTR, + GFS3_OP_READDIRP, + GFS3_OP_RELEASE, + GFS3_OP_RELEASEDIR, + GFS3_OP_FREMOVEXATTR, + GFS3_OP_FALLOCATE, + GFS3_OP_DISCARD, + GFS3_OP_ZEROFILL, + GFS3_OP_IPC, + GFS3_OP_SEEK, + GFS3_OP_COMPOUND, + GFS3_OP_LEASE, + GFS3_OP_GETACTIVELK, + GFS3_OP_SETACTIVELK, + GFS3_OP_ICREATE, + GFS3_OP_NAMELINK, + GFS3_OP_PUT, + GFS3_OP_MAXVALUE, }; enum gf_handshake_procnum { - GF_HNDSK_NULL, - GF_HNDSK_SETVOLUME, - GF_HNDSK_GETSPEC, - GF_HNDSK_PING, - GF_HNDSK_SET_LK_VER, - GF_HNDSK_EVENT_NOTIFY, - GF_HNDSK_GET_VOLUME_INFO, - GF_HNDSK_GET_SNAPSHOT_INFO, - GF_HNDSK_MAXVALUE, + GF_HNDSK_NULL, + GF_HNDSK_SETVOLUME, + GF_HNDSK_GETSPEC, + GF_HNDSK_PING, + GF_HNDSK_SET_LK_VER, + GF_HNDSK_EVENT_NOTIFY, + GF_HNDSK_GET_VOLUME_INFO, + GF_HNDSK_GET_SNAPSHOT_INFO, + GF_HNDSK_MAXVALUE, }; enum gf_pmap_procnum { - GF_PMAP_NULL = 0, - GF_PMAP_PORTBYBRICK, - GF_PMAP_BRICKBYPORT, - /* - * SIGNUP is not used, and shouldn't be used. It was kept here only - * to avoid changing the numbers for things that come after it in this - * list. - */ - GF_PMAP_SIGNUP, - GF_PMAP_SIGNIN, - GF_PMAP_SIGNOUT, - GF_PMAP_MAXVALUE, + GF_PMAP_NULL = 0, + GF_PMAP_PORTBYBRICK, + GF_PMAP_BRICKBYPORT, + /* + * SIGNUP is not used, and shouldn't be used. It was kept here only + * to avoid changing the numbers for things that come after it in this + * list. + */ + GF_PMAP_SIGNUP, + GF_PMAP_SIGNIN, + GF_PMAP_SIGNOUT, + GF_PMAP_MAXVALUE, }; enum gf_aggregator_procnum { - GF_AGGREGATOR_NULL = 0, - GF_AGGREGATOR_LOOKUP, - GF_AGGREGATOR_GETLIMIT, - GF_AGGREGATOR_MAXVALUE, + GF_AGGREGATOR_NULL = 0, + GF_AGGREGATOR_LOOKUP, + GF_AGGREGATOR_GETLIMIT, + GF_AGGREGATOR_MAXVALUE, }; enum gf_pmap_port_type { - GF_PMAP_PORT_FREE = 0, - GF_PMAP_PORT_FOREIGN, /* it actually means, not sure who is using it, but it is in-use */ - GF_PMAP_PORT_LEASED, - GF_PMAP_PORT_ANY, - GF_PMAP_PORT_BRICKSERVER, /* port used by brick process */ + GF_PMAP_PORT_FREE = 0, + GF_PMAP_PORT_FOREIGN, /* it actually means, not sure who is using it, but it + is in-use */ + GF_PMAP_PORT_LEASED, + GF_PMAP_PORT_ANY, + GF_PMAP_PORT_BRICKSERVER, /* port used by brick process */ }; typedef enum gf_pmap_port_type gf_pmap_port_type_t; enum gf_probe_resp { - GF_PROBE_SUCCESS, - GF_PROBE_LOCALHOST, - GF_PROBE_FRIEND, - GF_PROBE_ANOTHER_CLUSTER, - GF_PROBE_VOLUME_CONFLICT, - GF_PROBE_SAME_UUID, - GF_PROBE_UNKNOWN_PEER, - GF_PROBE_ADD_FAILED, - GF_PROBE_QUORUM_NOT_MET, - GF_PROBE_MISSED_SNAP_CONFLICT, - GF_PROBE_SNAP_CONFLICT, - GF_PROBE_FRIEND_DETACHING, + GF_PROBE_SUCCESS, + GF_PROBE_LOCALHOST, + GF_PROBE_FRIEND, + GF_PROBE_ANOTHER_CLUSTER, + GF_PROBE_VOLUME_CONFLICT, + GF_PROBE_SAME_UUID, + GF_PROBE_UNKNOWN_PEER, + GF_PROBE_ADD_FAILED, + GF_PROBE_QUORUM_NOT_MET, + GF_PROBE_MISSED_SNAP_CONFLICT, + GF_PROBE_SNAP_CONFLICT, + GF_PROBE_FRIEND_DETACHING, }; enum gf_deprobe_resp { - GF_DEPROBE_SUCCESS, - GF_DEPROBE_LOCALHOST, - GF_DEPROBE_NOT_FRIEND, - GF_DEPROBE_BRICK_EXIST, - GF_DEPROBE_FRIEND_DOWN, - GF_DEPROBE_QUORUM_NOT_MET, - GF_DEPROBE_FRIEND_DETACHING, - GF_DEPROBE_SNAP_BRICK_EXIST, + GF_DEPROBE_SUCCESS, + GF_DEPROBE_LOCALHOST, + GF_DEPROBE_NOT_FRIEND, + GF_DEPROBE_BRICK_EXIST, + GF_DEPROBE_FRIEND_DOWN, + GF_DEPROBE_QUORUM_NOT_MET, + GF_DEPROBE_FRIEND_DETACHING, + GF_DEPROBE_SNAP_BRICK_EXIST, }; enum gf_cbk_procnum { - GF_CBK_NULL = 0, - GF_CBK_FETCHSPEC, - GF_CBK_INO_FLUSH, - GF_CBK_EVENT_NOTIFY, - GF_CBK_GET_SNAPS, - GF_CBK_CACHE_INVALIDATION, - GF_CBK_CHILD_UP, - GF_CBK_CHILD_DOWN, - GF_CBK_RECALL_LEASE, - GF_CBK_STATEDUMP, - GF_CBK_INODELK_CONTENTION, - GF_CBK_ENTRYLK_CONTENTION, - GF_CBK_MAXVALUE, + GF_CBK_NULL = 0, + GF_CBK_FETCHSPEC, + GF_CBK_INO_FLUSH, + GF_CBK_EVENT_NOTIFY, + GF_CBK_GET_SNAPS, + GF_CBK_CACHE_INVALIDATION, + GF_CBK_CHILD_UP, + GF_CBK_CHILD_DOWN, + GF_CBK_RECALL_LEASE, + GF_CBK_STATEDUMP, + GF_CBK_INODELK_CONTENTION, + GF_CBK_ENTRYLK_CONTENTION, + GF_CBK_MAXVALUE, }; enum gluster_cli_procnum { - GLUSTER_CLI_NULL, /* 0 */ - GLUSTER_CLI_PROBE, - GLUSTER_CLI_DEPROBE, - GLUSTER_CLI_LIST_FRIENDS, - GLUSTER_CLI_CREATE_VOLUME, - GLUSTER_CLI_GET_VOLUME, - GLUSTER_CLI_GET_NEXT_VOLUME, - GLUSTER_CLI_DELETE_VOLUME, - GLUSTER_CLI_START_VOLUME, - GLUSTER_CLI_STOP_VOLUME, - GLUSTER_CLI_RENAME_VOLUME, - GLUSTER_CLI_DEFRAG_VOLUME, - GLUSTER_CLI_SET_VOLUME, - GLUSTER_CLI_ADD_BRICK, - GLUSTER_CLI_REMOVE_BRICK, - GLUSTER_CLI_REPLACE_BRICK, - GLUSTER_CLI_LOG_ROTATE, - GLUSTER_CLI_GETSPEC, - GLUSTER_CLI_PMAP_PORTBYBRICK, - GLUSTER_CLI_SYNC_VOLUME, - GLUSTER_CLI_RESET_VOLUME, - GLUSTER_CLI_FSM_LOG, - GLUSTER_CLI_GSYNC_SET, - GLUSTER_CLI_PROFILE_VOLUME, - GLUSTER_CLI_QUOTA, - GLUSTER_CLI_TOP_VOLUME, - GLUSTER_CLI_GETWD, - GLUSTER_CLI_STATUS_VOLUME, - GLUSTER_CLI_STATUS_ALL, - GLUSTER_CLI_MOUNT, - GLUSTER_CLI_UMOUNT, - GLUSTER_CLI_HEAL_VOLUME, - GLUSTER_CLI_STATEDUMP_VOLUME, - GLUSTER_CLI_LIST_VOLUME, - GLUSTER_CLI_CLRLOCKS_VOLUME, - GLUSTER_CLI_UUID_RESET, - GLUSTER_CLI_UUID_GET, - GLUSTER_CLI_COPY_FILE, - GLUSTER_CLI_SYS_EXEC, - GLUSTER_CLI_SNAP, - GLUSTER_CLI_BARRIER_VOLUME, - GLUSTER_CLI_GET_VOL_OPT, - GLUSTER_CLI_GANESHA, - GLUSTER_CLI_BITROT, - GLUSTER_CLI_ATTACH_TIER, - GLUSTER_CLI_TIER, - GLUSTER_CLI_GET_STATE, - GLUSTER_CLI_RESET_BRICK, - GLUSTER_CLI_REMOVE_TIER_BRICK, - GLUSTER_CLI_ADD_TIER_BRICK, - GLUSTER_CLI_MAXVALUE, + GLUSTER_CLI_NULL, /* 0 */ + GLUSTER_CLI_PROBE, + GLUSTER_CLI_DEPROBE, + GLUSTER_CLI_LIST_FRIENDS, + GLUSTER_CLI_CREATE_VOLUME, + GLUSTER_CLI_GET_VOLUME, + GLUSTER_CLI_GET_NEXT_VOLUME, + GLUSTER_CLI_DELETE_VOLUME, + GLUSTER_CLI_START_VOLUME, + GLUSTER_CLI_STOP_VOLUME, + GLUSTER_CLI_RENAME_VOLUME, + GLUSTER_CLI_DEFRAG_VOLUME, + GLUSTER_CLI_SET_VOLUME, + GLUSTER_CLI_ADD_BRICK, + GLUSTER_CLI_REMOVE_BRICK, + GLUSTER_CLI_REPLACE_BRICK, + GLUSTER_CLI_LOG_ROTATE, + GLUSTER_CLI_GETSPEC, + GLUSTER_CLI_PMAP_PORTBYBRICK, + GLUSTER_CLI_SYNC_VOLUME, + GLUSTER_CLI_RESET_VOLUME, + GLUSTER_CLI_FSM_LOG, + GLUSTER_CLI_GSYNC_SET, + GLUSTER_CLI_PROFILE_VOLUME, + GLUSTER_CLI_QUOTA, + GLUSTER_CLI_TOP_VOLUME, + GLUSTER_CLI_GETWD, + GLUSTER_CLI_STATUS_VOLUME, + GLUSTER_CLI_STATUS_ALL, + GLUSTER_CLI_MOUNT, + GLUSTER_CLI_UMOUNT, + GLUSTER_CLI_HEAL_VOLUME, + GLUSTER_CLI_STATEDUMP_VOLUME, + GLUSTER_CLI_LIST_VOLUME, + GLUSTER_CLI_CLRLOCKS_VOLUME, + GLUSTER_CLI_UUID_RESET, + GLUSTER_CLI_UUID_GET, + GLUSTER_CLI_COPY_FILE, + GLUSTER_CLI_SYS_EXEC, + GLUSTER_CLI_SNAP, + GLUSTER_CLI_BARRIER_VOLUME, + GLUSTER_CLI_GET_VOL_OPT, + GLUSTER_CLI_GANESHA, + GLUSTER_CLI_BITROT, + GLUSTER_CLI_ATTACH_TIER, + GLUSTER_CLI_TIER, + GLUSTER_CLI_GET_STATE, + GLUSTER_CLI_RESET_BRICK, + GLUSTER_CLI_REMOVE_TIER_BRICK, + GLUSTER_CLI_ADD_TIER_BRICK, + GLUSTER_CLI_MAXVALUE, }; enum glusterd_mgmt_procnum { - GLUSTERD_MGMT_NULL, /* 0 */ - GLUSTERD_MGMT_CLUSTER_LOCK, - GLUSTERD_MGMT_CLUSTER_UNLOCK, - GLUSTERD_MGMT_STAGE_OP, - GLUSTERD_MGMT_COMMIT_OP, - GLUSTERD_MGMT_MAXVALUE, + GLUSTERD_MGMT_NULL, /* 0 */ + GLUSTERD_MGMT_CLUSTER_LOCK, + GLUSTERD_MGMT_CLUSTER_UNLOCK, + GLUSTERD_MGMT_STAGE_OP, + GLUSTERD_MGMT_COMMIT_OP, + GLUSTERD_MGMT_MAXVALUE, }; enum glusterd_friend_procnum { - GLUSTERD_FRIEND_NULL, /* 0 */ - GLUSTERD_PROBE_QUERY, - GLUSTERD_FRIEND_ADD, - GLUSTERD_FRIEND_REMOVE, - GLUSTERD_FRIEND_UPDATE, - GLUSTERD_FRIEND_MAXVALUE, + GLUSTERD_FRIEND_NULL, /* 0 */ + GLUSTERD_PROBE_QUERY, + GLUSTERD_FRIEND_ADD, + GLUSTERD_FRIEND_REMOVE, + GLUSTERD_FRIEND_UPDATE, + GLUSTERD_FRIEND_MAXVALUE, }; enum glusterd_brick_procnum { - GLUSTERD_BRICK_NULL, /* 0 */ - GLUSTERD_BRICK_TERMINATE, - GLUSTERD_BRICK_XLATOR_INFO, - GLUSTERD_BRICK_XLATOR_OP, - GLUSTERD_BRICK_STATUS, - GLUSTERD_BRICK_OP, - GLUSTERD_BRICK_XLATOR_DEFRAG, - GLUSTERD_NODE_PROFILE, - GLUSTERD_NODE_STATUS, - GLUSTERD_VOLUME_BARRIER_OP, - GLUSTERD_BRICK_BARRIER, - GLUSTERD_NODE_BITROT, - GLUSTERD_BRICK_ATTACH, - GLUSTERD_DUMP_METRICS, - GLUSTERD_BRICK_MAXVALUE, + GLUSTERD_BRICK_NULL, /* 0 */ + GLUSTERD_BRICK_TERMINATE, + GLUSTERD_BRICK_XLATOR_INFO, + GLUSTERD_BRICK_XLATOR_OP, + GLUSTERD_BRICK_STATUS, + GLUSTERD_BRICK_OP, + GLUSTERD_BRICK_XLATOR_DEFRAG, + GLUSTERD_NODE_PROFILE, + GLUSTERD_NODE_STATUS, + GLUSTERD_VOLUME_BARRIER_OP, + GLUSTERD_BRICK_BARRIER, + GLUSTERD_NODE_BITROT, + GLUSTERD_BRICK_ATTACH, + GLUSTERD_DUMP_METRICS, + GLUSTERD_BRICK_MAXVALUE, }; enum glusterd_mgmt_hndsk_procnum { - GD_MGMT_HNDSK_NULL, - GD_MGMT_HNDSK_VERSIONS, - GD_MGMT_HNDSK_VERSIONS_ACK, - GD_MGMT_HNDSK_MAXVALUE, + GD_MGMT_HNDSK_NULL, + GD_MGMT_HNDSK_VERSIONS, + GD_MGMT_HNDSK_VERSIONS_ACK, + GD_MGMT_HNDSK_MAXVALUE, }; typedef enum { - GF_SHD_OP_INVALID, - GF_SHD_OP_HEAL_INDEX, - GF_SHD_OP_HEAL_FULL, - GF_SHD_OP_INDEX_SUMMARY, - GF_SHD_OP_HEALED_FILES, - GF_SHD_OP_HEAL_FAILED_FILES, - GF_SHD_OP_SPLIT_BRAIN_FILES, - GF_SHD_OP_STATISTICS, - GF_SHD_OP_STATISTICS_HEAL_COUNT, - GF_SHD_OP_STATISTICS_HEAL_COUNT_PER_REPLICA, - GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE, - GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK, - GF_SHD_OP_HEAL_ENABLE, - GF_SHD_OP_HEAL_DISABLE, - GF_SHD_OP_SBRAIN_HEAL_FROM_LATEST_MTIME, - GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE, - GF_SHD_OP_GRANULAR_ENTRY_HEAL_DISABLE, - GF_SHD_OP_HEAL_SUMMARY, -} gf_xl_afr_op_t ; + GF_SHD_OP_INVALID, + GF_SHD_OP_HEAL_INDEX, + GF_SHD_OP_HEAL_FULL, + GF_SHD_OP_INDEX_SUMMARY, + GF_SHD_OP_HEALED_FILES, + GF_SHD_OP_HEAL_FAILED_FILES, + GF_SHD_OP_SPLIT_BRAIN_FILES, + GF_SHD_OP_STATISTICS, + GF_SHD_OP_STATISTICS_HEAL_COUNT, + GF_SHD_OP_STATISTICS_HEAL_COUNT_PER_REPLICA, + GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE, + GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK, + GF_SHD_OP_HEAL_ENABLE, + GF_SHD_OP_HEAL_DISABLE, + GF_SHD_OP_SBRAIN_HEAL_FROM_LATEST_MTIME, + GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE, + GF_SHD_OP_GRANULAR_ENTRY_HEAL_DISABLE, + GF_SHD_OP_HEAL_SUMMARY, +} gf_xl_afr_op_t; struct gf_gsync_detailed_status_ { - char node[NAME_MAX]; - char master[NAME_MAX]; - char brick[PATH_MAX]; - char slave_user[NAME_MAX]; - char slave[NAME_MAX]; - char slave_node[NAME_MAX]; - char worker_status[NAME_MAX]; - char crawl_status[NAME_MAX]; - char last_synced[NAME_MAX]; - char last_synced_utc[NAME_MAX]; - char entry[NAME_MAX]; - char data[NAME_MAX]; - char meta[NAME_MAX]; - char failures[NAME_MAX]; - char checkpoint_time[NAME_MAX]; - char checkpoint_time_utc[NAME_MAX]; - char checkpoint_completed[NAME_MAX]; - char checkpoint_completion_time[NAME_MAX]; - char checkpoint_completion_time_utc[NAME_MAX]; - char brick_host_uuid[NAME_MAX]; - char slavekey[NAME_MAX]; - char session_slave[NAME_MAX]; + char node[NAME_MAX]; + char master[NAME_MAX]; + char brick[PATH_MAX]; + char slave_user[NAME_MAX]; + char slave[NAME_MAX]; + char slave_node[NAME_MAX]; + char worker_status[NAME_MAX]; + char crawl_status[NAME_MAX]; + char last_synced[NAME_MAX]; + char last_synced_utc[NAME_MAX]; + char entry[NAME_MAX]; + char data[NAME_MAX]; + char meta[NAME_MAX]; + char failures[NAME_MAX]; + char checkpoint_time[NAME_MAX]; + char checkpoint_time_utc[NAME_MAX]; + char checkpoint_completed[NAME_MAX]; + char checkpoint_completion_time[NAME_MAX]; + char checkpoint_completion_time_utc[NAME_MAX]; + char brick_host_uuid[NAME_MAX]; + char slavekey[NAME_MAX]; + char session_slave[NAME_MAX]; }; enum glusterd_mgmt_v3_procnum { - GLUSTERD_MGMT_V3_NULL, /* 0 */ - GLUSTERD_MGMT_V3_LOCK, - GLUSTERD_MGMT_V3_PRE_VALIDATE, - GLUSTERD_MGMT_V3_BRICK_OP, - GLUSTERD_MGMT_V3_COMMIT, - GLUSTERD_MGMT_V3_POST_VALIDATE, - GLUSTERD_MGMT_V3_UNLOCK, - GLUSTERD_MGMT_V3_MAXVALUE, + GLUSTERD_MGMT_V3_NULL, /* 0 */ + GLUSTERD_MGMT_V3_LOCK, + GLUSTERD_MGMT_V3_PRE_VALIDATE, + GLUSTERD_MGMT_V3_BRICK_OP, + GLUSTERD_MGMT_V3_COMMIT, + GLUSTERD_MGMT_V3_POST_VALIDATE, + GLUSTERD_MGMT_V3_UNLOCK, + GLUSTERD_MGMT_V3_MAXVALUE, }; typedef struct gf_gsync_detailed_status_ gf_gsync_status_t; enum gf_get_volume_info_type { - GF_GET_VOLUME_NONE, /* 0 */ - GF_GET_VOLUME_UUID + GF_GET_VOLUME_NONE, /* 0 */ + GF_GET_VOLUME_UUID }; typedef enum gf_get_volume_info_type gf_get_volume_info_type; - enum gf_get_snapshot_info_type { - GF_GET_SNAPSHOT_LIST, + GF_GET_SNAPSHOT_LIST, }; typedef enum gf_get_snapshot_info_type gf_get_snapshot_info_type; -enum gf_getspec_flags_type { - GF_GETSPEC_FLAG_SERVERS_LIST = 1 -}; +enum gf_getspec_flags_type { GF_GETSPEC_FLAG_SERVERS_LIST = 1 }; typedef enum gf_getspec_flags_type gf_getspec_flags_type; -#define GLUSTER_HNDSK_PROGRAM 14398633 /* Completely random */ -#define GLUSTER_HNDSK_VERSION 2 /* 0.0.2 */ +#define GLUSTER_HNDSK_PROGRAM 14398633 /* Completely random */ +#define GLUSTER_HNDSK_VERSION 2 /* 0.0.2 */ -#define GLUSTER_PMAP_PROGRAM 34123456 -#define GLUSTER_PMAP_VERSION 1 +#define GLUSTER_PMAP_PROGRAM 34123456 +#define GLUSTER_PMAP_VERSION 1 -#define GLUSTER_CBK_PROGRAM 52743234 /* Completely random */ -#define GLUSTER_CBK_VERSION 1 /* 0.0.1 */ +#define GLUSTER_CBK_PROGRAM 52743234 /* Completely random */ +#define GLUSTER_CBK_VERSION 1 /* 0.0.1 */ -#define GLUSTER_FOP_PROGRAM 1298437 /* Completely random */ -#define GLUSTER_FOP_VERSION 330 /* 3.3.0 */ -#define GLUSTER_FOP_PROCCNT GFS3_OP_MAXVALUE +#define GLUSTER_FOP_PROGRAM 1298437 /* Completely random */ +#define GLUSTER_FOP_VERSION 330 /* 3.3.0 */ +#define GLUSTER_FOP_PROCCNT GFS3_OP_MAXVALUE -#define GLUSTER_FOP_VERSION_v2 400 /* 4.0.0 */ +#define GLUSTER_FOP_VERSION_v2 400 /* 4.0.0 */ /* Aggregator */ #define GLUSTER_AGGREGATOR_PROGRAM 29852134 /* Completely random */ #define GLUSTER_AGGREGATOR_VERSION 1 /* Second version */ -#define GD_MGMT_PROGRAM 1238433 /* Completely random */ -#define GD_MGMT_VERSION 2 /* 0.0.2 */ +#define GD_MGMT_PROGRAM 1238433 /* Completely random */ +#define GD_MGMT_VERSION 2 /* 0.0.2 */ -#define GD_FRIEND_PROGRAM 1238437 /* Completely random */ -#define GD_FRIEND_VERSION 2 /* 0.0.2 */ +#define GD_FRIEND_PROGRAM 1238437 /* Completely random */ +#define GD_FRIEND_VERSION 2 /* 0.0.2 */ -#define GLUSTER_CLI_PROGRAM 1238463 /* Completely random */ -#define GLUSTER_CLI_VERSION 2 /* 0.0.2 */ +#define GLUSTER_CLI_PROGRAM 1238463 /* Completely random */ +#define GLUSTER_CLI_VERSION 2 /* 0.0.2 */ -#define GD_BRICK_PROGRAM 4867634 /*Completely random*/ -#define GD_BRICK_VERSION 2 +#define GD_BRICK_PROGRAM 4867634 /*Completely random*/ +#define GD_BRICK_VERSION 2 /* Third version */ -#define GD_MGMT_V3_VERSION 3 +#define GD_MGMT_V3_VERSION 3 /* OP-VERSION handshake */ -#define GD_MGMT_HNDSK_PROGRAM 1239873 /* Completely random */ -#define GD_MGMT_HNDSK_VERSION 1 +#define GD_MGMT_HNDSK_PROGRAM 1239873 /* Completely random */ +#define GD_MGMT_HNDSK_VERSION 1 -#define GD_VOLUME_NAME_MAX ((NAME_MAX + 1) - 5) /* Maximum size of volume name */ -#define GD_VOLUME_NAME_MAX_TIER (GD_VOLUME_NAME_MAX + 5) /* +5 needed for '-hot' - and '-cold' suffixes*/ +#define GD_VOLUME_NAME_MAX \ + ((NAME_MAX + 1) - 5) /* Maximum size of volume name */ +#define GD_VOLUME_NAME_MAX_TIER \ + (GD_VOLUME_NAME_MAX + 5) /* +5 needed for '-hot' \ + and '-cold' suffixes*/ -#define GLUSTER_PROCESS_UUID_FMT "CTX_ID:%s-GRAPH_ID:%d-PID:%d-HOST:%s-PC_NAME:%s-RECON_NO:%s" +#define GLUSTER_PROCESS_UUID_FMT \ + "CTX_ID:%s-GRAPH_ID:%d-PID:%d-HOST:%s-PC_NAME:%s-RECON_NO:%s" #endif /* !_PROTOCOL_COMMON_H */ diff --git a/rpc/rpc-lib/src/rpc-clnt-ping.h b/rpc/rpc-lib/src/rpc-clnt-ping.h index d92e5054190..fcbac6f9e21 100644 --- a/rpc/rpc-lib/src/rpc-clnt-ping.h +++ b/rpc/rpc-lib/src/rpc-clnt-ping.h @@ -8,9 +8,8 @@ cases as published by the Free Software Foundation. */ - #define RPC_DEFAULT_PING_TIMEOUT 30 void -rpc_clnt_check_and_start_ping (struct rpc_clnt *rpc_ptr); +rpc_clnt_check_and_start_ping(struct rpc_clnt *rpc_ptr); int -rpc_clnt_remove_ping_timer_locked (struct rpc_clnt *rpc); +rpc_clnt_remove_ping_timer_locked(struct rpc_clnt *rpc); diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h index 2d6cb060c4e..28b6f0e7f4d 100644 --- a/rpc/rpc-lib/src/rpc-clnt.h +++ b/rpc/rpc-lib/src/rpc-clnt.h @@ -18,14 +18,13 @@ #include "glusterfs3.h" typedef enum { - RPC_CLNT_CONNECT, - RPC_CLNT_DISCONNECT, - RPC_CLNT_PING, - RPC_CLNT_MSG, - RPC_CLNT_DESTROY + RPC_CLNT_CONNECT, + RPC_CLNT_DISCONNECT, + RPC_CLNT_PING, + RPC_CLNT_MSG, + RPC_CLNT_DESTROY } rpc_clnt_event_t; - #define SFRAME_GET_PROGNUM(sframe) (sframe->rpcreq->prog->prognum) #define SFRAME_GET_PROGVER(sframe) (sframe->rpcreq->prog->progver) #define SFRAME_GET_PROCNUM(sframe) (sframe->rpcreq->procnum) @@ -35,60 +34,59 @@ struct rpc_clnt; struct rpc_clnt_config; struct rpc_clnt_program; -typedef int (*rpc_clnt_notify_t) (struct rpc_clnt *rpc, void *mydata, - rpc_clnt_event_t fn, void *data); +typedef int (*rpc_clnt_notify_t)(struct rpc_clnt *rpc, void *mydata, + rpc_clnt_event_t fn, void *data); -typedef int (*fop_cbk_fn_t) (struct rpc_req *req, struct iovec *iov, int count, - void *myframe); +typedef int (*fop_cbk_fn_t)(struct rpc_req *req, struct iovec *iov, int count, + void *myframe); -typedef int (*clnt_fn_t) (call_frame_t *fr, xlator_t *xl, void *args); +typedef int (*clnt_fn_t)(call_frame_t *fr, xlator_t *xl, void *args); struct saved_frame { - union { - struct list_head list; - struct { - struct saved_frame *frame_next; - struct saved_frame *frame_prev; - }; - }; - void *capital_this; - void *frame; - struct timeval saved_at; - struct rpc_req *rpcreq; - rpc_transport_rsp_t rsp; + union { + struct list_head list; + struct { + struct saved_frame *frame_next; + struct saved_frame *frame_prev; + }; + }; + void *capital_this; + void *frame; + struct timeval saved_at; + struct rpc_req *rpcreq; + rpc_transport_rsp_t rsp; }; struct saved_frames { - int64_t count; - struct saved_frame sf; - struct saved_frame lk_sf; + int64_t count; + struct saved_frame sf; + struct saved_frame lk_sf; }; - /* Initialized by procnum */ typedef struct rpc_clnt_procedure { - char *procname; - clnt_fn_t fn; + char *procname; + clnt_fn_t fn; } rpc_clnt_procedure_t; typedef struct rpc_clnt_program { - char *progname; - int prognum; - int progver; - rpc_clnt_procedure_t *proctable; - char **procnames; - int numproc; + char *progname; + int prognum; + int progver; + rpc_clnt_procedure_t *proctable; + char **procnames; + int numproc; } rpc_clnt_prog_t; -typedef int (*rpcclnt_cb_fn) (struct rpc_clnt *rpc, void *mydata, void *data); +typedef int (*rpcclnt_cb_fn)(struct rpc_clnt *rpc, void *mydata, void *data); /* The descriptor for each procedure/actor that runs * over the RPC service. */ typedef struct rpcclnt_actor_desc { - char procname[32]; - int procnum; - rpcclnt_cb_fn actor; + char procname[32]; + int procnum; + rpcclnt_cb_fn actor; } rpcclnt_cb_actor_t; /* Describes a program and its version along with the function pointers @@ -96,113 +94,112 @@ typedef struct rpcclnt_actor_desc { * Never changed ever by any thread so no need for a lock. */ typedef struct rpcclnt_cb_program { - char progname[32]; - int prognum; - int progver; - rpcclnt_cb_actor_t *actors; /* All procedure handlers */ - int numactors; /* Num actors in actor array */ - - /* Program specific state handed to actors */ - void *private; + char progname[32]; + int prognum; + int progver; + rpcclnt_cb_actor_t *actors; /* All procedure handlers */ + int numactors; /* Num actors in actor array */ + /* Program specific state handed to actors */ + void *private; - /* list member to link to list of registered services with rpc_clnt */ - struct list_head program; + /* list member to link to list of registered services with rpc_clnt */ + struct list_head program; - /* Needed for passing back in cb_actor */ - void *mydata; + /* Needed for passing back in cb_actor */ + void *mydata; } rpcclnt_cb_program_t; - - typedef struct rpc_auth_data { - int flavour; - int datalen; - char authdata[GF_MAX_AUTH_BYTES]; + int flavour; + int datalen; + char authdata[GF_MAX_AUTH_BYTES]; } rpc_auth_data_t; - struct rpc_clnt_config { - int rpc_timeout; - int remote_port; - char * remote_host; - int ping_timeout; + int rpc_timeout; + int remote_port; + char *remote_host; + int ping_timeout; }; - -#define rpc_auth_flavour(au) ((au).flavour) +#define rpc_auth_flavour(au) ((au).flavour) struct rpc_clnt_connection { - pthread_mutex_t lock; - rpc_transport_t *trans; - struct rpc_clnt_config config; - gf_timer_t *reconnect; - gf_timer_t *timer; - gf_timer_t *ping_timer; - struct rpc_clnt *rpc_clnt; - char connected; - gf_boolean_t disconnected; - struct saved_frames *saved_frames; - int32_t frame_timeout; - struct timespec last_sent; - struct timespec last_received; - int32_t ping_started; - char *name; - int32_t ping_timeout; - uint64_t pingcnt; - uint64_t msgcnt; - uint64_t cleanup_gen; + pthread_mutex_t lock; + rpc_transport_t *trans; + struct rpc_clnt_config config; + gf_timer_t *reconnect; + gf_timer_t *timer; + gf_timer_t *ping_timer; + struct rpc_clnt *rpc_clnt; + char connected; + gf_boolean_t disconnected; + struct saved_frames *saved_frames; + int32_t frame_timeout; + struct timespec last_sent; + struct timespec last_received; + int32_t ping_started; + char *name; + int32_t ping_timeout; + uint64_t pingcnt; + uint64_t msgcnt; + uint64_t cleanup_gen; }; typedef struct rpc_clnt_connection rpc_clnt_connection_t; struct rpc_req { - rpc_clnt_connection_t *conn; - uint32_t xid; - struct iovec req[2]; - int reqcnt; - struct iobref *req_iobref; - struct iovec rsp[2]; - int rspcnt; - struct iobref *rsp_iobref; - int rpc_status; - rpc_auth_data_t verf; - rpc_clnt_prog_t *prog; - int procnum; - fop_cbk_fn_t cbkfn; - void *conn_private; + rpc_clnt_connection_t *conn; + uint32_t xid; + struct iovec req[2]; + int reqcnt; + struct iobref *req_iobref; + struct iovec rsp[2]; + int rspcnt; + struct iobref *rsp_iobref; + int rpc_status; + rpc_auth_data_t verf; + rpc_clnt_prog_t *prog; + int procnum; + fop_cbk_fn_t cbkfn; + void *conn_private; }; typedef struct rpc_clnt { - pthread_mutex_t lock; - rpc_clnt_notify_t notifyfn; - rpc_clnt_connection_t conn; - void *mydata; - gf_atomic_t xid; + pthread_mutex_t lock; + rpc_clnt_notify_t notifyfn; + rpc_clnt_connection_t conn; + void *mydata; + gf_atomic_t xid; - /* list of cb programs registered with rpc-clnt */ - struct list_head programs; + /* list of cb programs registered with rpc-clnt */ + struct list_head programs; - /* Memory pool for rpc_req_t */ - struct mem_pool *reqpool; + /* Memory pool for rpc_req_t */ + struct mem_pool *reqpool; - struct mem_pool *saved_frames_pool; + struct mem_pool *saved_frames_pool; - glusterfs_ctx_t *ctx; - gf_atomic_t refcount; - int auth_value; - char disabled; - xlator_t *owner; + glusterfs_ctx_t *ctx; + gf_atomic_t refcount; + int auth_value; + char disabled; + xlator_t *owner; } rpc_clnt_t; -struct rpc_clnt *rpc_clnt_new (dict_t *options, xlator_t *owner, - char *name, uint32_t reqpool_size); +struct rpc_clnt * +rpc_clnt_new(dict_t *options, xlator_t *owner, char *name, + uint32_t reqpool_size); -int rpc_clnt_start (struct rpc_clnt *rpc); +int +rpc_clnt_start(struct rpc_clnt *rpc); -int rpc_clnt_cleanup_and_start (struct rpc_clnt *rpc); +int +rpc_clnt_cleanup_and_start(struct rpc_clnt *rpc); -int rpc_clnt_register_notify (struct rpc_clnt *rpc, rpc_clnt_notify_t fn, - void *mydata); +int +rpc_clnt_register_notify(struct rpc_clnt *rpc, rpc_clnt_notify_t fn, + void *mydata); /* Some preconditions related to vectors holding responses. * @rsphdr: should contain pointer to buffer which can hold response header @@ -219,44 +216,50 @@ int rpc_clnt_register_notify (struct rpc_clnt *rpc, rpc_clnt_notify_t fn, * of the header. */ -int rpc_clnt_submit (struct rpc_clnt *rpc, rpc_clnt_prog_t *prog, - int procnum, fop_cbk_fn_t cbkfn, - struct iovec *proghdr, int proghdrcount, - struct iovec *progpayload, int progpayloadcount, - struct iobref *iobref, void *frame, struct iovec *rsphdr, - int rsphdr_count, struct iovec *rsp_payload, - int rsp_payload_count, struct iobref *rsp_iobref); +int +rpc_clnt_submit(struct rpc_clnt *rpc, rpc_clnt_prog_t *prog, int procnum, + fop_cbk_fn_t cbkfn, struct iovec *proghdr, int proghdrcount, + struct iovec *progpayload, int progpayloadcount, + struct iobref *iobref, void *frame, struct iovec *rsphdr, + int rsphdr_count, struct iovec *rsp_payload, + int rsp_payload_count, struct iobref *rsp_iobref); struct rpc_clnt * -rpc_clnt_ref (struct rpc_clnt *rpc); +rpc_clnt_ref(struct rpc_clnt *rpc); struct rpc_clnt * -rpc_clnt_unref (struct rpc_clnt *rpc); +rpc_clnt_unref(struct rpc_clnt *rpc); -int rpc_clnt_connection_cleanup (rpc_clnt_connection_t *conn); -int rpc_clnt_reconnect_cleanup (rpc_clnt_connection_t *conn); -gf_boolean_t is_rpc_clnt_disconnected (rpc_clnt_connection_t *conn); +int +rpc_clnt_connection_cleanup(rpc_clnt_connection_t *conn); +int +rpc_clnt_reconnect_cleanup(rpc_clnt_connection_t *conn); +gf_boolean_t +is_rpc_clnt_disconnected(rpc_clnt_connection_t *conn); -void rpc_clnt_reconnect (void *trans_ptr); +void +rpc_clnt_reconnect(void *trans_ptr); -void rpc_clnt_reconfig (struct rpc_clnt *rpc, struct rpc_clnt_config *config); +void +rpc_clnt_reconfig(struct rpc_clnt *rpc, struct rpc_clnt_config *config); /* All users of RPC services should use this API to register their * procedure handlers. */ -int rpcclnt_cbk_program_register (struct rpc_clnt *svc, - rpcclnt_cb_program_t *program, void *mydata); +int +rpcclnt_cbk_program_register(struct rpc_clnt *svc, + rpcclnt_cb_program_t *program, void *mydata); void -rpc_clnt_disable (struct rpc_clnt *rpc); +rpc_clnt_disable(struct rpc_clnt *rpc); void -rpc_clnt_disconnect (struct rpc_clnt *rpc); +rpc_clnt_disconnect(struct rpc_clnt *rpc); char -rpc_clnt_is_disabled (struct rpc_clnt *rpc); +rpc_clnt_is_disabled(struct rpc_clnt *rpc); int -rpc_clnt_mgmt_pmap_signout (glusterfs_ctx_t *ctx, char *brick_name); +rpc_clnt_mgmt_pmap_signout(glusterfs_ctx_t *ctx, char *brick_name); #endif /* !_RPC_CLNT_H */ diff --git a/rpc/rpc-lib/src/rpc-drc.h b/rpc/rpc-lib/src/rpc-drc.h index cd9e2c73d32..1fd1e5e24ef 100644 --- a/rpc/rpc-lib/src/rpc-drc.h +++ b/rpc/rpc-lib/src/rpc-drc.h @@ -19,83 +19,79 @@ /* per-client cache structure */ struct drc_client { - uint32_t ref; - union gf_sock_union sock_union; - /* pointers to the cache */ - struct rb_table *rbtree; - /* no. of ops currently cached */ - uint32_t op_count; - struct list_head client_list; + uint32_t ref; + union gf_sock_union sock_union; + /* pointers to the cache */ + struct rb_table *rbtree; + /* no. of ops currently cached */ + uint32_t op_count; + struct list_head client_list; }; struct drc_cached_op { - drc_op_state_t state; - uint32_t xid; - int prognum; - int progversion; - int procnum; - rpc_transport_msg_t msg; - drc_client_t *client; - struct list_head client_list; - struct list_head global_list; - int32_t ref; + drc_op_state_t state; + uint32_t xid; + int prognum; + int progversion; + int procnum; + rpc_transport_msg_t msg; + drc_client_t *client; + struct list_head client_list; + struct list_head global_list; + int32_t ref; }; /* global drc definitions */ -enum drc_status { - DRC_UNINITIATED, - DRC_INITIATED -}; +enum drc_status { DRC_UNINITIATED, DRC_INITIATED }; typedef enum drc_status drc_status_t; struct drc_globals { - /* allocator must be the first member since - * it is used so in gf_libavl_allocator - */ - struct libavl_allocator allocator; - drc_type_t type; - /* configurable size parameter */ - uint32_t global_cache_size; - drc_lru_factor_t lru_factor; - gf_lock_t lock; - drc_status_t status; - uint32_t op_count; - uint64_t cache_hits; - uint64_t intransit_hits; - struct mem_pool *mempool; - struct list_head cache_head; - uint32_t client_count; - struct list_head clients_head; + /* allocator must be the first member since + * it is used so in gf_libavl_allocator + */ + struct libavl_allocator allocator; + drc_type_t type; + /* configurable size parameter */ + uint32_t global_cache_size; + drc_lru_factor_t lru_factor; + gf_lock_t lock; + drc_status_t status; + uint32_t op_count; + uint64_t cache_hits; + uint64_t intransit_hits; + struct mem_pool *mempool; + struct list_head cache_head; + uint32_t client_count; + struct list_head clients_head; }; int -rpcsvc_need_drc (rpcsvc_request_t *req); +rpcsvc_need_drc(rpcsvc_request_t *req); drc_cached_op_t * -rpcsvc_drc_lookup (rpcsvc_request_t *req); +rpcsvc_drc_lookup(rpcsvc_request_t *req); int -rpcsvc_send_cached_reply (rpcsvc_request_t *req, drc_cached_op_t *reply); +rpcsvc_send_cached_reply(rpcsvc_request_t *req, drc_cached_op_t *reply); int -rpcsvc_cache_reply (rpcsvc_request_t *req, struct iobref *iobref, - struct iovec *rpchdr, int rpchdrcount, - struct iovec *proghdr, int proghdrcount, - struct iovec *payload, int payloadcount); +rpcsvc_cache_reply(rpcsvc_request_t *req, struct iobref *iobref, + struct iovec *rpchdr, int rpchdrcount, struct iovec *proghdr, + int proghdrcount, struct iovec *payload, int payloadcount); int -rpcsvc_cache_request (rpcsvc_request_t *req); +rpcsvc_cache_request(rpcsvc_request_t *req); int32_t -rpcsvc_drc_priv (rpcsvc_drc_globals_t *drc); +rpcsvc_drc_priv(rpcsvc_drc_globals_t *drc); int -rpcsvc_drc_init (rpcsvc_t *svc, dict_t *options); +rpcsvc_drc_init(rpcsvc_t *svc, dict_t *options); int -rpcsvc_drc_deinit (rpcsvc_t *svc); +rpcsvc_drc_deinit(rpcsvc_t *svc); int -rpcsvc_drc_reconfigure (rpcsvc_t *svc, dict_t *options); +rpcsvc_drc_reconfigure(rpcsvc_t *svc, dict_t *options); #endif /* RPC_DRC_H */ diff --git a/rpc/rpc-lib/src/rpc-lib-messages.h b/rpc/rpc-lib/src/rpc-lib-messages.h index 31e0d8ea267..9251578a121 100644 --- a/rpc/rpc-lib/src/rpc-lib-messages.h +++ b/rpc/rpc-lib/src/rpc-lib-messages.h @@ -23,21 +23,12 @@ * glfs-message-id.h. */ -GLFS_MSGID(RPC_LIB, - TRANS_MSG_ADDR_FAMILY_NOT_SPECIFIED, - TRANS_MSG_UNKNOWN_ADDR_FAMILY, - TRANS_MSG_REMOTE_HOST_ERROR, - TRANS_MSG_DNS_RESOL_FAILED, - TRANS_MSG_LISTEN_PATH_ERROR, - TRANS_MSG_CONNECT_PATH_ERROR, - TRANS_MSG_GET_ADDR_INFO_FAILED, - TRANS_MSG_PORT_BIND_FAILED, - TRANS_MSG_INET_ERROR, - TRANS_MSG_GET_NAME_INFO_FAILED, - TRANS_MSG_TRANSPORT_ERROR, - TRANS_MSG_TIMEOUT_EXCEEDED, - TRANS_MSG_SOCKET_BIND_ERROR -); +GLFS_MSGID(RPC_LIB, TRANS_MSG_ADDR_FAMILY_NOT_SPECIFIED, + TRANS_MSG_UNKNOWN_ADDR_FAMILY, TRANS_MSG_REMOTE_HOST_ERROR, + TRANS_MSG_DNS_RESOL_FAILED, TRANS_MSG_LISTEN_PATH_ERROR, + TRANS_MSG_CONNECT_PATH_ERROR, TRANS_MSG_GET_ADDR_INFO_FAILED, + TRANS_MSG_PORT_BIND_FAILED, TRANS_MSG_INET_ERROR, + TRANS_MSG_GET_NAME_INFO_FAILED, TRANS_MSG_TRANSPORT_ERROR, + TRANS_MSG_TIMEOUT_EXCEEDED, TRANS_MSG_SOCKET_BIND_ERROR); #endif /* !_RPC_LIB_MESSAGES_H_ */ - diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h index 332efb45c25..c238501b5c7 100644 --- a/rpc/rpc-lib/src/rpc-transport.h +++ b/rpc/rpc-lib/src/rpc-transport.h @@ -11,7 +11,6 @@ #ifndef __RPC_TRANSPORT_H__ #define __RPC_TRANSPORT_H__ - #include <inttypes.h> #ifdef GF_SOLARIS_HOST_OS #include <rpc/auth.h> @@ -21,7 +20,6 @@ #include <rpc/rpc_msg.h> - #ifndef MAX_IOVEC #define MAX_IOVEC 16 #endif @@ -43,17 +41,17 @@ */ #define RPC_FRAGSIZE(fraghdr) ((uint32_t)(fraghdr & 0x7fffffffU)) -#define RPC_FRAGHDR_SIZE 4 -#define RPC_MSGTYPE_SIZE 8 +#define RPC_FRAGHDR_SIZE 4 +#define RPC_MSGTYPE_SIZE 8 /* size of the msg from the start of call-body till and including credlen */ -#define RPC_CALL_BODY_SIZE 24 +#define RPC_CALL_BODY_SIZE 24 -#define RPC_REPLY_STATUS_SIZE 4 +#define RPC_REPLY_STATUS_SIZE 4 #define RPC_AUTH_FLAVOUR_N_LENGTH_SIZE 8 -#define RPC_ACCEPT_STATUS_LEN 4 +#define RPC_ACCEPT_STATUS_LEN 4 struct rpc_transport_ops; typedef struct rpc_transport rpc_transport_t; @@ -63,24 +61,24 @@ typedef struct rpc_transport rpc_transport_t; #include "rpcsvc-common.h" struct peer_info { - struct sockaddr_storage sockaddr; - socklen_t sockaddr_len; - char identifier[UNIX_PATH_MAX]; - // OP-VERSION of clients - uint32_t max_op_version; - uint32_t min_op_version; - //Volume mounted by client - char volname[NAME_MAX]; + struct sockaddr_storage sockaddr; + socklen_t sockaddr_len; + char identifier[UNIX_PATH_MAX]; + // OP-VERSION of clients + uint32_t max_op_version; + uint32_t min_op_version; + // Volume mounted by client + char volname[NAME_MAX]; }; typedef struct peer_info peer_info_t; typedef enum msg_type msg_type_t; typedef enum { - RPC_TRANSPORT_ACCEPT, /* New client has been accepted */ - RPC_TRANSPORT_DISCONNECT, /* Connection is disconnected */ - RPC_TRANSPORT_CLEANUP, /* connection is about to be freed */ - /*RPC_TRANSPORT_READ,*/ /* An event used to enable rpcsvc to instruct + RPC_TRANSPORT_ACCEPT, /* New client has been accepted */ + RPC_TRANSPORT_DISCONNECT, /* Connection is disconnected */ + RPC_TRANSPORT_CLEANUP, /* connection is about to be freed */ + /*RPC_TRANSPORT_READ,*/ /* An event used to enable rpcsvc to instruct * transport the number of bytes to read. * This helps in reading large msgs, wherein * the rpc actors might decide to place the @@ -92,54 +90,54 @@ typedef enum { * reading a single msg, this event may be * delivered more than once. */ - RPC_TRANSPORT_MAP_XID_REQUEST, /* receiver of this event should send - * the prognum and procnum corresponding - * to xid. - */ - RPC_TRANSPORT_MSG_RECEIVED, /* Complete rpc msg has been read */ - RPC_TRANSPORT_CONNECT, /* client is connected to server */ - RPC_TRANSPORT_MSG_SENT, + RPC_TRANSPORT_MAP_XID_REQUEST, /* receiver of this event should send + * the prognum and procnum corresponding + * to xid. + */ + RPC_TRANSPORT_MSG_RECEIVED, /* Complete rpc msg has been read */ + RPC_TRANSPORT_CONNECT, /* client is connected to server */ + RPC_TRANSPORT_MSG_SENT, } rpc_transport_event_t; struct rpc_transport_msg { - struct iovec *rpchdr; - int rpchdrcount; - struct iovec *proghdr; - int proghdrcount; - struct iovec *progpayload; - int progpayloadcount; - struct iobref *iobref; + struct iovec *rpchdr; + int rpchdrcount; + struct iovec *proghdr; + int proghdrcount; + struct iovec *progpayload; + int progpayloadcount; + struct iobref *iobref; }; typedef struct rpc_transport_msg rpc_transport_msg_t; struct rpc_transport_rsp { - struct iovec *rsphdr; - int rsphdr_count; - struct iovec *rsp_payload; - int rsp_payload_count; - struct iobref *rsp_iobref; + struct iovec *rsphdr; + int rsphdr_count; + struct iovec *rsp_payload; + int rsp_payload_count; + struct iobref *rsp_iobref; }; typedef struct rpc_transport_rsp rpc_transport_rsp_t; struct rpc_transport_req { - rpc_transport_msg_t msg; - rpc_transport_rsp_t rsp; - struct rpc_req *rpc_req; + rpc_transport_msg_t msg; + rpc_transport_rsp_t rsp; + struct rpc_req *rpc_req; }; typedef struct rpc_transport_req rpc_transport_req_t; struct rpc_transport_reply { - rpc_transport_msg_t msg; - void *private; + rpc_transport_msg_t msg; + void *private; }; typedef struct rpc_transport_reply rpc_transport_reply_t; struct rpc_transport_data { - char is_request; - union { - rpc_transport_req_t req; - rpc_transport_reply_t reply; - } data; + char is_request; + union { + rpc_transport_req_t req; + rpc_transport_reply_t reply; + } data; }; typedef struct rpc_transport_data rpc_transport_data_t; @@ -147,173 +145,166 @@ typedef struct rpc_transport_data rpc_transport_data_t; * rpc_request, hence these should be removed from request_info */ struct rpc_request_info { - uint32_t xid; - int prognum; - int progver; - int procnum; - void *rpc_req; /* struct rpc_req */ - rpc_transport_rsp_t rsp; + uint32_t xid; + int prognum; + int progver; + int procnum; + void *rpc_req; /* struct rpc_req */ + rpc_transport_rsp_t rsp; }; typedef struct rpc_request_info rpc_request_info_t; - struct rpc_transport_pollin { - struct iovec vector[MAX_IOVEC]; - int count; - char vectored; - void *private; - struct iobref *iobref; - char is_reply; + struct iovec vector[MAX_IOVEC]; + int count; + char vectored; + void *private; + struct iobref *iobref; + char is_reply; }; typedef struct rpc_transport_pollin rpc_transport_pollin_t; -typedef int (*rpc_transport_notify_t) (rpc_transport_t *, void *mydata, - rpc_transport_event_t, void *data, ...); - +typedef int (*rpc_transport_notify_t)(rpc_transport_t *, void *mydata, + rpc_transport_event_t, void *data, ...); struct rpc_transport { - struct rpc_transport_ops *ops; - rpc_transport_t *listener; /* listener transport to which - * request for creation of this - * transport came from. valid only - * on server process. - */ - - void *private; - struct _client *xl_private; - void *xl; /* Used for THIS */ - void *mydata; - pthread_mutex_t lock; - gf_atomic_t refcount; - - int32_t outstanding_rpc_count; - - glusterfs_ctx_t *ctx; - dict_t *options; - char *name; - void *dnscache; - void *drc_client; - data_t *buf; - int32_t (*init) (rpc_transport_t *this); - void (*fini) (rpc_transport_t *this); - int (*reconfigure) (rpc_transport_t *this, dict_t *options); - rpc_transport_notify_t notify; - void *notify_data; - peer_info_t peerinfo; - peer_info_t myinfo; - - uint64_t total_bytes_read; - uint64_t total_bytes_write; - uint32_t xid; /* RPC/XID used for callbacks */ - - struct list_head list; - int bind_insecure; - void *dl_handle; /* handle of dlopen() */ - char *ssl_name; - dict_t *clnt_options; /* store options received from - * client */ - /* connect_failed: saves the connect() syscall status as socket_t - * member holding connect() status can't be accessed by higher gfapi - * layer or in client management notification handler functions - */ - gf_boolean_t connect_failed; + struct rpc_transport_ops *ops; + rpc_transport_t *listener; /* listener transport to which + * request for creation of this + * transport came from. valid only + * on server process. + */ + + void *private; + struct _client *xl_private; + void *xl; /* Used for THIS */ + void *mydata; + pthread_mutex_t lock; + gf_atomic_t refcount; + + int32_t outstanding_rpc_count; + + glusterfs_ctx_t *ctx; + dict_t *options; + char *name; + void *dnscache; + void *drc_client; + data_t *buf; + int32_t (*init)(rpc_transport_t *this); + void (*fini)(rpc_transport_t *this); + int (*reconfigure)(rpc_transport_t *this, dict_t *options); + rpc_transport_notify_t notify; + void *notify_data; + peer_info_t peerinfo; + peer_info_t myinfo; + + uint64_t total_bytes_read; + uint64_t total_bytes_write; + uint32_t xid; /* RPC/XID used for callbacks */ + + struct list_head list; + int bind_insecure; + void *dl_handle; /* handle of dlopen() */ + char *ssl_name; + dict_t *clnt_options; /* store options received from + * client */ + /* connect_failed: saves the connect() syscall status as socket_t + * member holding connect() status can't be accessed by higher gfapi + * layer or in client management notification handler functions + */ + gf_boolean_t connect_failed; }; struct rpc_transport_ops { - /* no need of receive op, msg will be delivered through an event - * notification - */ - int32_t (*submit_request) (rpc_transport_t *this, - rpc_transport_req_t *req); - int32_t (*submit_reply) (rpc_transport_t *this, - rpc_transport_reply_t *reply); - int32_t (*connect) (rpc_transport_t *this, int port); - int32_t (*listen) (rpc_transport_t *this); - int32_t (*disconnect) (rpc_transport_t *this, gf_boolean_t wait); - int32_t (*get_peername) (rpc_transport_t *this, char *hostname, - int hostlen); - int32_t (*get_peeraddr) (rpc_transport_t *this, char *peeraddr, - int addrlen, struct sockaddr_storage *sa, - socklen_t sasize); - int32_t (*get_myname) (rpc_transport_t *this, char *hostname, - int hostlen); - int32_t (*get_myaddr) (rpc_transport_t *this, char *peeraddr, - int addrlen, struct sockaddr_storage *sa, - socklen_t sasize); - int32_t (*throttle) (rpc_transport_t *this, gf_boolean_t onoff); + /* no need of receive op, msg will be delivered through an event + * notification + */ + int32_t (*submit_request)(rpc_transport_t *this, rpc_transport_req_t *req); + int32_t (*submit_reply)(rpc_transport_t *this, + rpc_transport_reply_t *reply); + int32_t (*connect)(rpc_transport_t *this, int port); + int32_t (*listen)(rpc_transport_t *this); + int32_t (*disconnect)(rpc_transport_t *this, gf_boolean_t wait); + int32_t (*get_peername)(rpc_transport_t *this, char *hostname, int hostlen); + int32_t (*get_peeraddr)(rpc_transport_t *this, char *peeraddr, int addrlen, + struct sockaddr_storage *sa, socklen_t sasize); + int32_t (*get_myname)(rpc_transport_t *this, char *hostname, int hostlen); + int32_t (*get_myaddr)(rpc_transport_t *this, char *peeraddr, int addrlen, + struct sockaddr_storage *sa, socklen_t sasize); + int32_t (*throttle)(rpc_transport_t *this, gf_boolean_t onoff); }; int32_t -rpc_transport_count (const char *transport_type); +rpc_transport_count(const char *transport_type); int32_t -rpc_transport_listen (rpc_transport_t *this); +rpc_transport_listen(rpc_transport_t *this); int32_t -rpc_transport_connect (rpc_transport_t *this, int port); +rpc_transport_connect(rpc_transport_t *this, int port); int32_t -rpc_transport_disconnect (rpc_transport_t *this, gf_boolean_t wait); +rpc_transport_disconnect(rpc_transport_t *this, gf_boolean_t wait); int32_t -rpc_transport_destroy (rpc_transport_t *this); +rpc_transport_destroy(rpc_transport_t *this); int32_t -rpc_transport_notify (rpc_transport_t *this, rpc_transport_event_t event, - void *data, ...); +rpc_transport_notify(rpc_transport_t *this, rpc_transport_event_t event, + void *data, ...); int32_t -rpc_transport_submit_request (rpc_transport_t *this, rpc_transport_req_t *req); +rpc_transport_submit_request(rpc_transport_t *this, rpc_transport_req_t *req); int32_t -rpc_transport_submit_reply (rpc_transport_t *this, - rpc_transport_reply_t *reply); +rpc_transport_submit_reply(rpc_transport_t *this, rpc_transport_reply_t *reply); rpc_transport_t * -rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *name); +rpc_transport_load(glusterfs_ctx_t *ctx, dict_t *options, char *name); rpc_transport_t * -rpc_transport_ref (rpc_transport_t *trans); +rpc_transport_ref(rpc_transport_t *trans); int32_t -rpc_transport_unref (rpc_transport_t *trans); +rpc_transport_unref(rpc_transport_t *trans); int -rpc_transport_register_notify (rpc_transport_t *trans, rpc_transport_notify_t, - void *mydata); +rpc_transport_register_notify(rpc_transport_t *trans, rpc_transport_notify_t, + void *mydata); int32_t -rpc_transport_get_peername (rpc_transport_t *this, char *hostname, int hostlen); +rpc_transport_get_peername(rpc_transport_t *this, char *hostname, int hostlen); int32_t -rpc_transport_get_peeraddr (rpc_transport_t *this, char *peeraddr, int addrlen, - struct sockaddr_storage *sa, size_t salen); +rpc_transport_get_peeraddr(rpc_transport_t *this, char *peeraddr, int addrlen, + struct sockaddr_storage *sa, size_t salen); int32_t -rpc_transport_get_myname (rpc_transport_t *this, char *hostname, int hostlen); +rpc_transport_get_myname(rpc_transport_t *this, char *hostname, int hostlen); int32_t -rpc_transport_get_myaddr (rpc_transport_t *this, char *peeraddr, int addrlen, - struct sockaddr_storage *sa, size_t salen); +rpc_transport_get_myaddr(rpc_transport_t *this, char *peeraddr, int addrlen, + struct sockaddr_storage *sa, size_t salen); int -rpc_transport_throttle (rpc_transport_t *this, gf_boolean_t onoff); +rpc_transport_throttle(rpc_transport_t *this, gf_boolean_t onoff); rpc_transport_pollin_t * -rpc_transport_pollin_alloc (rpc_transport_t *this, struct iovec *vector, - int count, struct iobuf *hdr_iobuf, - struct iobref *iobref, void *private); +rpc_transport_pollin_alloc(rpc_transport_t *this, struct iovec *vector, + int count, struct iobuf *hdr_iobuf, + struct iobref *iobref, void *private); void -rpc_transport_pollin_destroy (rpc_transport_pollin_t *pollin); +rpc_transport_pollin_destroy(rpc_transport_pollin_t *pollin); int -rpc_transport_keepalive_options_set (dict_t *options, int32_t interval, - int32_t time, int32_t timeout); +rpc_transport_keepalive_options_set(dict_t *options, int32_t interval, + int32_t time, int32_t timeout); int -rpc_transport_unix_options_build (dict_t **options, char *filepath, - int frame_timeout); +rpc_transport_unix_options_build(dict_t **options, char *filepath, + int frame_timeout); int -rpc_transport_inet_options_build (dict_t **options, const char *hostname, int port); +rpc_transport_inet_options_build(dict_t **options, const char *hostname, + int port); #endif /* __RPC_TRANSPORT_H__ */ diff --git a/rpc/rpc-lib/src/rpcsvc-common.h b/rpc/rpc-lib/src/rpcsvc-common.h index ab715d3417e..6a36b1f1b9b 100644 --- a/rpc/rpc-lib/src/rpcsvc-common.h +++ b/rpc/rpc-lib/src/rpcsvc-common.h @@ -19,17 +19,16 @@ #include "xlator.h" typedef enum { - RPCSVC_EVENT_ACCEPT, - RPCSVC_EVENT_DISCONNECT, - RPCSVC_EVENT_TRANSPORT_DESTROY, - RPCSVC_EVENT_LISTENER_DEAD, + RPCSVC_EVENT_ACCEPT, + RPCSVC_EVENT_DISCONNECT, + RPCSVC_EVENT_TRANSPORT_DESTROY, + RPCSVC_EVENT_LISTENER_DEAD, } rpcsvc_event_t; - struct rpcsvc_state; -typedef int (*rpcsvc_notify_t) (struct rpcsvc_state *, void *mydata, - rpcsvc_event_t, void *data); +typedef int (*rpcsvc_notify_t)(struct rpcsvc_state *, void *mydata, + rpcsvc_event_t, void *data); struct drc_globals; typedef struct drc_globals rpcsvc_drc_globals_t; @@ -37,95 +36,79 @@ typedef struct drc_globals rpcsvc_drc_globals_t; /* Contains global state required for all the RPC services. */ typedef struct rpcsvc_state { + /* Contains list of (program, version) handlers. + * other options. + */ - /* Contains list of (program, version) handlers. - * other options. - */ - - pthread_rwlock_t rpclock; + pthread_rwlock_t rpclock; - unsigned int memfactor; + unsigned int memfactor; - /* List of the authentication schemes available. */ - struct list_head authschemes; + /* List of the authentication schemes available. */ + struct list_head authschemes; - /* Reference to the options */ - dict_t *options; + /* Reference to the options */ + dict_t *options; - /* Allow insecure ports. */ - gf_boolean_t allow_insecure; - gf_boolean_t register_portmap; - gf_boolean_t root_squash; - uid_t anonuid; - gid_t anongid; - glusterfs_ctx_t *ctx; + /* Allow insecure ports. */ + gf_boolean_t allow_insecure; + gf_boolean_t register_portmap; + gf_boolean_t root_squash; + uid_t anonuid; + gid_t anongid; + glusterfs_ctx_t *ctx; - /* list of connections which will listen for incoming connections */ - struct list_head listeners; + /* list of connections which will listen for incoming connections */ + struct list_head listeners; - /* list of programs registered with rpcsvc */ - struct list_head programs; + /* list of programs registered with rpcsvc */ + struct list_head programs; - /* list of notification callbacks */ - struct list_head notify; - int notify_count; + /* list of notification callbacks */ + struct list_head notify; + int notify_count; - xlator_t *xl; /* xlator */ - void *mydata; - rpcsvc_notify_t notifyfn; - struct mem_pool *rxpool; - rpcsvc_drc_globals_t *drc; + xlator_t *xl; /* xlator */ + void *mydata; + rpcsvc_notify_t notifyfn; + struct mem_pool *rxpool; + rpcsvc_drc_globals_t *drc; - /* per-client limit of outstanding rpc requests */ - int outstanding_rpc_limit; - gf_boolean_t addr_namelookup; - /* determine whether throttling is needed, by default OFF */ - gf_boolean_t throttle; + /* per-client limit of outstanding rpc requests */ + int outstanding_rpc_limit; + gf_boolean_t addr_namelookup; + /* determine whether throttling is needed, by default OFF */ + gf_boolean_t throttle; } rpcsvc_t; /* DRC START */ -enum drc_op_type { - DRC_NA = 0, - DRC_IDEMPOTENT = 1, - DRC_NON_IDEMPOTENT = 2 -}; +enum drc_op_type { DRC_NA = 0, DRC_IDEMPOTENT = 1, DRC_NON_IDEMPOTENT = 2 }; typedef enum drc_op_type drc_op_type_t; -enum drc_type { - DRC_TYPE_NONE = 0, - DRC_TYPE_IN_MEMORY = 1 -}; +enum drc_type { DRC_TYPE_NONE = 0, DRC_TYPE_IN_MEMORY = 1 }; typedef enum drc_type drc_type_t; enum drc_lru_factor { - DRC_LRU_5_PC = 20, - DRC_LRU_10_PC = 10, - DRC_LRU_25_PC = 4, - DRC_LRU_50_PC = 2 + DRC_LRU_5_PC = 20, + DRC_LRU_10_PC = 10, + DRC_LRU_25_PC = 4, + DRC_LRU_50_PC = 2 }; typedef enum drc_lru_factor drc_lru_factor_t; -enum drc_xid_state { - DRC_XID_MONOTONOUS = 0, - DRC_XID_WRAPPED = 1 -}; +enum drc_xid_state { DRC_XID_MONOTONOUS = 0, DRC_XID_WRAPPED = 1 }; typedef enum drc_xid_state drc_xid_state_t; -enum drc_op_state { - DRC_OP_IN_TRANSIT = 0, - DRC_OP_CACHED = 1 -}; +enum drc_op_state { DRC_OP_IN_TRANSIT = 0, DRC_OP_CACHED = 1 }; typedef enum drc_op_state drc_op_state_t; -enum drc_policy { - DRC_LRU = 0 -}; +enum drc_policy { DRC_LRU = 0 }; typedef enum drc_policy drc_policy_t; /* Default policies for DRC */ -#define DRC_DEFAULT_TYPE DRC_TYPE_IN_MEMORY -#define DRC_DEFAULT_CACHE_SIZE 0x20000 -#define DRC_DEFAULT_LRU_FACTOR DRC_LRU_25_PC +#define DRC_DEFAULT_TYPE DRC_TYPE_IN_MEMORY +#define DRC_DEFAULT_CACHE_SIZE 0x20000 +#define DRC_DEFAULT_LRU_FACTOR DRC_LRU_25_PC /* DRC END */ diff --git a/rpc/rpc-lib/src/rpcsvc.h b/rpc/rpc-lib/src/rpcsvc.h index c6efa4f5369..ebb836fba3f 100644 --- a/rpc/rpc-lib/src/rpcsvc.h +++ b/rpc/rpc-lib/src/rpcsvc.h @@ -33,29 +33,30 @@ #define MAX_IOVEC 16 #endif -#define RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT 64 /* Default for protocol/server */ +#define RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT \ + 64 /* Default for protocol/server */ #define RPCSVC_DEF_NFS_OUTSTANDING_RPC_LIMIT 16 /* Default for nfs/server */ #define RPCSVC_MAX_OUTSTANDING_RPC_LIMIT 65536 #define RPCSVC_MIN_OUTSTANDING_RPC_LIMIT 0 /* No limit i.e. Unlimited */ -#define GF_RPCSVC "rpc-service" +#define GF_RPCSVC "rpc-service" #define RPCSVC_THREAD_STACK_SIZE ((size_t)(1024 * GF_UNIT_KB)) -#define RPCSVC_FRAGHDR_SIZE 4 /* 4-byte RPC fragment header size */ -#define RPCSVC_DEFAULT_LISTEN_PORT GF_DEFAULT_BASE_PORT -#define RPCSVC_DEFAULT_MEMFACTOR 8 -#define RPCSVC_EVENTPOOL_SIZE_MULT 1024 -#define RPCSVC_POOLCOUNT_MULT 64 -#define RPCSVC_CONN_READ (128 * GF_UNIT_KB) -#define RPCSVC_PAGE_SIZE (128 * GF_UNIT_KB) -#define RPC_ROOT_UID 0 -#define RPC_ROOT_GID 0 -#define RPC_NOBODY_UID 65534 -#define RPC_NOBODY_GID 65534 +#define RPCSVC_FRAGHDR_SIZE 4 /* 4-byte RPC fragment header size */ +#define RPCSVC_DEFAULT_LISTEN_PORT GF_DEFAULT_BASE_PORT +#define RPCSVC_DEFAULT_MEMFACTOR 8 +#define RPCSVC_EVENTPOOL_SIZE_MULT 1024 +#define RPCSVC_POOLCOUNT_MULT 64 +#define RPCSVC_CONN_READ (128 * GF_UNIT_KB) +#define RPCSVC_PAGE_SIZE (128 * GF_UNIT_KB) +#define RPC_ROOT_UID 0 +#define RPC_ROOT_GID 0 +#define RPC_NOBODY_UID 65534 +#define RPC_NOBODY_GID 65534 /* RPC Record States */ -#define RPCSVC_READ_FRAGHDR 1 -#define RPCSVC_READ_FRAG 2 +#define RPCSVC_READ_FRAGHDR 1 +#define RPCSVC_READ_FRAG 2 /* The size in bytes, if crossed by a fragment will be handed over to the * vectored actor so that it can allocate its buffers the way it wants. * In our RPC layer, we assume that vectored RPC requests/records are never @@ -63,21 +64,28 @@ * whether the record should be handled in RPC layer completely or handed to * the vectored handler. */ -#define RPCSVC_VECTORED_FRAGSZ 4096 -#define RPCSVC_VECTOR_READCRED 1003 -#define RPCSVC_VECTOR_READVERFSZ 1004 -#define RPCSVC_VECTOR_READVERF 1005 -#define RPCSVC_VECTOR_IGNORE 1006 -#define RPCSVC_VECTOR_READVEC 1007 -#define RPCSVC_VECTOR_READPROCHDR 1008 - -#define rpcsvc_record_vectored_baremsg(rs) (((rs)->state == RPCSVC_READ_FRAG) && (rs)->vecstate == 0) -#define rpcsvc_record_vectored_cred(rs) ((rs)->vecstate == RPCSVC_VECTOR_READCRED) -#define rpcsvc_record_vectored_verfsz(rs) ((rs)->vecstate == RPCSVC_VECTOR_READVERFSZ) -#define rpcsvc_record_vectored_verfread(rs) ((rs)->vecstate == RPCSVC_VECTOR_READVERF) -#define rpcsvc_record_vectored_ignore(rs) ((rs)->vecstate == RPCSVC_VECTOR_IGNORE) -#define rpcsvc_record_vectored_readvec(rs) ((rs)->vecstate == RPCSVC_VECTOR_READVEC) -#define rpcsvc_record_vectored_readprochdr(rs) ((rs)->vecstate == RPCSVC_VECTOR_READPROCHDR) +#define RPCSVC_VECTORED_FRAGSZ 4096 +#define RPCSVC_VECTOR_READCRED 1003 +#define RPCSVC_VECTOR_READVERFSZ 1004 +#define RPCSVC_VECTOR_READVERF 1005 +#define RPCSVC_VECTOR_IGNORE 1006 +#define RPCSVC_VECTOR_READVEC 1007 +#define RPCSVC_VECTOR_READPROCHDR 1008 + +#define rpcsvc_record_vectored_baremsg(rs) \ + (((rs)->state == RPCSVC_READ_FRAG) && (rs)->vecstate == 0) +#define rpcsvc_record_vectored_cred(rs) \ + ((rs)->vecstate == RPCSVC_VECTOR_READCRED) +#define rpcsvc_record_vectored_verfsz(rs) \ + ((rs)->vecstate == RPCSVC_VECTOR_READVERFSZ) +#define rpcsvc_record_vectored_verfread(rs) \ + ((rs)->vecstate == RPCSVC_VECTOR_READVERF) +#define rpcsvc_record_vectored_ignore(rs) \ + ((rs)->vecstate == RPCSVC_VECTOR_IGNORE) +#define rpcsvc_record_vectored_readvec(rs) \ + ((rs)->vecstate == RPCSVC_VECTOR_READVEC) +#define rpcsvc_record_vectored_readprochdr(rs) \ + ((rs)->vecstate == RPCSVC_VECTOR_READPROCHDR) #define rpcsvc_record_vectored(rs) ((rs)->fragsize > RPCSVC_VECTORED_FRAGSZ) /* Includes bytes up to and including the credential length field. The credlen * will be followed by @credlen bytes of credential data which will have to be @@ -85,60 +93,58 @@ * verifier which will also have to be read separately including the 8 bytes of * verf flavour and verflen. */ -#define RPCSVC_BARERPC_MSGSZ 32 -#define rpcsvc_record_readfraghdr(rs) ((rs)->state == RPCSVC_READ_FRAGHDR) -#define rpcsvc_record_readfrag(rs) ((rs)->state == RPCSVC_READ_FRAG) +#define RPCSVC_BARERPC_MSGSZ 32 +#define rpcsvc_record_readfraghdr(rs) ((rs)->state == RPCSVC_READ_FRAGHDR) +#define rpcsvc_record_readfrag(rs) ((rs)->state == RPCSVC_READ_FRAG) -#define RPCSVC_LOWVERS 2 +#define RPCSVC_LOWVERS 2 #define RPCSVC_HIGHVERS 2 - #if 0 #error "defined in /usr/include/rpc/auth.h" -#define AUTH_NONE 0 /* no authentication */ -#define AUTH_NULL 0 /* backward compatibility */ -#define AUTH_SYS 1 /* unix style (uid, gids) */ -#define AUTH_UNIX AUTH_SYS -#define AUTH_SHORT 2 /* short hand unix style */ -#define AUTH_DES 3 /* des style (encrypted timestamps) */ -#define AUTH_DH AUTH_DES /* Diffie-Hellman (this is DES) */ -#define AUTH_KERB 4 /* kerberos style */ -#endif /* */ +#define AUTH_NONE 0 /* no authentication */ +#define AUTH_NULL 0 /* backward compatibility */ +#define AUTH_SYS 1 /* unix style (uid, gids) */ +#define AUTH_UNIX AUTH_SYS +#define AUTH_SHORT 2 /* short hand unix style */ +#define AUTH_DES 3 /* des style (encrypted timestamps) */ +#define AUTH_DH AUTH_DES /* Diffie-Hellman (this is DES) */ +#define AUTH_KERB 4 /* kerberos style */ +#endif /* */ typedef struct rpcsvc_program rpcsvc_program_t; struct rpcsvc_notify_wrapper { - struct list_head list; - void *data; - rpcsvc_notify_t notify; + struct list_head list; + void *data; + rpcsvc_notify_t notify; }; typedef struct rpcsvc_notify_wrapper rpcsvc_notify_wrapper_t; - typedef struct rpcsvc_request rpcsvc_request_t; typedef struct { - rpc_transport_t *trans; - rpcsvc_t *svc; - /* FIXME: remove address from this structure. Instead use get_myaddr - * interface implemented by individual transports. - */ - struct sockaddr_storage sa; - struct list_head list; + rpc_transport_t *trans; + rpcsvc_t *svc; + /* FIXME: remove address from this structure. Instead use get_myaddr + * interface implemented by individual transports. + */ + struct sockaddr_storage sa; + struct list_head list; } rpcsvc_listener_t; struct rpcsvc_config { - int max_block_size; + int max_block_size; }; typedef struct rpcsvc_auth_data { - int flavour; - int datalen; - char authdata[GF_MAX_AUTH_BYTES]; + int flavour; + int datalen; + char authdata[GF_MAX_AUTH_BYTES]; } rpcsvc_auth_data_t; -#define rpcsvc_auth_flavour(au) ((au).flavour) +#define rpcsvc_auth_flavour(au) ((au).flavour) typedef struct drc_client drc_client_t; typedef struct drc_cached_op drc_cached_op_t; @@ -148,163 +154,161 @@ typedef struct drc_cached_op drc_cached_op_t; * transmitted. * */ struct rpcsvc_request { - /* connection over which this request came. */ - rpc_transport_t *trans; - - rpcsvc_t *svc; - - rpcsvc_program_t *prog; + /* connection over which this request came. */ + rpc_transport_t *trans; - /* The identifier for the call from client. - * Needed to pair the reply with the call. - */ - uint32_t xid; + rpcsvc_t *svc; - int prognum; + rpcsvc_program_t *prog; - int progver; + /* The identifier for the call from client. + * Needed to pair the reply with the call. + */ + uint32_t xid; - int procnum; + int prognum; - int type; + int progver; - /* Uid and gid filled by the rpc-auth module during the authentication - * phase. - */ - uid_t uid; - gid_t gid; - pid_t pid; + int procnum; - gf_lkowner_t lk_owner; - uint64_t gfs_id; + int type; - /* Might want to move this to AUTH_UNIX specific state since this array - * is not available for every authentication scheme. - */ - gid_t *auxgids; - gid_t auxgidsmall[SMALL_GROUP_COUNT]; - gid_t *auxgidlarge; - int auxgidcount; + /* Uid and gid filled by the rpc-auth module during the authentication + * phase. + */ + uid_t uid; + gid_t gid; + pid_t pid; + gf_lkowner_t lk_owner; + uint64_t gfs_id; - /* The RPC message payload, contains the data required - * by the program actors. This is the buffer that will need to - * be de-xdred by the actor. - */ - struct iovec msg[MAX_IOVEC]; - int count; + /* Might want to move this to AUTH_UNIX specific state since this array + * is not available for every authentication scheme. + */ + gid_t *auxgids; + gid_t auxgidsmall[SMALL_GROUP_COUNT]; + gid_t *auxgidlarge; + int auxgidcount; - struct iobref *iobref; + /* The RPC message payload, contains the data required + * by the program actors. This is the buffer that will need to + * be de-xdred by the actor. + */ + struct iovec msg[MAX_IOVEC]; + int count; - /* Status of the RPC call, whether it was accepted or denied. */ - int rpc_status; + struct iobref *iobref; - /* In case, the call was denied, the RPC error is stored here - * till the reply is sent. - */ - int rpc_err; + /* Status of the RPC call, whether it was accepted or denied. */ + int rpc_status; - /* In case the failure happened because of an authentication problem - * , this value needs to be assigned the correct auth error number. - */ - int auth_err; + /* In case, the call was denied, the RPC error is stored here + * till the reply is sent. + */ + int rpc_err; - /* There can be cases of RPC requests where the reply needs to - * be built from multiple sources. E.g. where even the NFS reply - * can contain a payload, as in the NFSv3 read reply. Here the RPC header - * ,NFS header and the read data are brought together separately from - * different buffers, so we need to stage the buffers temporarily here - * before all of them get added to the connection's transmission list. - */ - struct list_head txlist; + /* In case the failure happened because of an authentication problem + * , this value needs to be assigned the correct auth error number. + */ + int auth_err; - /* While the reply record is being built, this variable keeps track - * of how many bytes have been added to the record. - */ - size_t payloadsize; + /* There can be cases of RPC requests where the reply needs to + * be built from multiple sources. E.g. where even the NFS reply + * can contain a payload, as in the NFSv3 read reply. Here the RPC header + * ,NFS header and the read data are brought together separately from + * different buffers, so we need to stage the buffers temporarily here + * before all of them get added to the connection's transmission list. + */ + struct list_head txlist; - /* The credentials extracted from the rpc request */ - rpcsvc_auth_data_t cred; + /* While the reply record is being built, this variable keeps track + * of how many bytes have been added to the record. + */ + size_t payloadsize; - /* The verified extracted from the rpc request. In request side - * processing this contains the verifier sent by the client, on reply - * side processing, it is filled with the verified that will be - * sent to the client. - */ - rpcsvc_auth_data_t verf; + /* The credentials extracted from the rpc request */ + rpcsvc_auth_data_t cred; - /* Execute this request's actor function in ownthread of program?*/ - gf_boolean_t ownthread; + /* The verified extracted from the rpc request. In request side + * processing this contains the verifier sent by the client, on reply + * side processing, it is filled with the verified that will be + * sent to the client. + */ + rpcsvc_auth_data_t verf; - gf_boolean_t synctask; - /* Container for a RPC program wanting to store a temp - * request-specific item. - */ - void *private; + /* Execute this request's actor function in ownthread of program?*/ + gf_boolean_t ownthread; - /* Container for transport to store request-specific item */ - void *trans_private; + gf_boolean_t synctask; + /* Container for a RPC program wanting to store a temp + * request-specific item. + */ + void *private; - /* pointer to cached reply for use in DRC */ - drc_cached_op_t *reply; + /* Container for transport to store request-specific item */ + void *trans_private; - /* request queue in rpcsvc */ - struct list_head request_list; + /* pointer to cached reply for use in DRC */ + drc_cached_op_t *reply; - /* Things passed to rpc layer from client */ + /* request queue in rpcsvc */ + struct list_head request_list; - /* @flags: Can be used for binary data passed in xdata to be - passed here instead */ - unsigned int flags; - - /* ctime: origin of time on the client side, ideally this is - the one we should consider for time */ - struct timespec ctime; + /* Things passed to rpc layer from client */ + + /* @flags: Can be used for binary data passed in xdata to be + passed here instead */ + unsigned int flags; + + /* ctime: origin of time on the client side, ideally this is + the one we should consider for time */ + struct timespec ctime; }; #define rpcsvc_request_program(req) ((rpcsvc_program_t *)((req)->prog)) #define rpcsvc_request_procnum(req) (((req)->procnum)) -#define rpcsvc_request_program_private(req) (((rpcsvc_program_t *)((req)->prog))->private) -#define rpcsvc_request_accepted(req) ((req)->rpc_status == MSG_ACCEPTED) +#define rpcsvc_request_program_private(req) \ + (((rpcsvc_program_t *)((req)->prog))->private) +#define rpcsvc_request_accepted(req) ((req)->rpc_status == MSG_ACCEPTED) #define rpcsvc_request_accepted_success(req) ((req)->rpc_err == SUCCESS) #define rpcsvc_request_prog_minauth(req) (rpcsvc_request_program(req)->min_auth) #define rpcsvc_request_cred_flavour(req) (rpcsvc_auth_flavour(req->cred)) #define rpcsvc_request_verf_flavour(req) (rpcsvc_auth_flavour(req->verf)) -#define rpcsvc_request_service(req) ((req)->svc) -#define rpcsvc_request_uid(req) ((req)->uid) -#define rpcsvc_request_gid(req) ((req)->gid) -#define rpcsvc_request_private(req) ((req)->private) -#define rpcsvc_request_xid(req) ((req)->xid) -#define rpcsvc_request_set_private(req,prv) (req)->private = (void *)(prv) -#define rpcsvc_request_iobref_ref(req) (iobref_ref ((req)->iobref)) -#define rpcsvc_request_record_ref(req) (iobuf_ref ((req)->recordiob)) -#define rpcsvc_request_record_unref(req) (iobuf_unref ((req)->recordiob)) -#define rpcsvc_request_record_iob(req) ((req)->recordiob) -#define rpcsvc_request_set_vecstate(req, state) ((req)->vecstate = state) +#define rpcsvc_request_service(req) ((req)->svc) +#define rpcsvc_request_uid(req) ((req)->uid) +#define rpcsvc_request_gid(req) ((req)->gid) +#define rpcsvc_request_private(req) ((req)->private) +#define rpcsvc_request_xid(req) ((req)->xid) +#define rpcsvc_request_set_private(req, prv) (req)->private = (void *)(prv) +#define rpcsvc_request_iobref_ref(req) (iobref_ref((req)->iobref)) +#define rpcsvc_request_record_ref(req) (iobuf_ref((req)->recordiob)) +#define rpcsvc_request_record_unref(req) (iobuf_unref((req)->recordiob)) +#define rpcsvc_request_record_iob(req) ((req)->recordiob) +#define rpcsvc_request_set_vecstate(req, state) ((req)->vecstate = state) #define rpcsvc_request_vecstate(req) ((req)->vecstate) #define rpcsvc_request_transport(req) ((req)->trans) #define rpcsvc_request_transport_ref(req) (rpc_transport_ref((req)->trans)) -#define RPC_AUTH_ROOT_SQUASH(req) \ - do { \ - int gidcount = 0; \ - if (req->svc->root_squash) { \ - if (req->uid == RPC_ROOT_UID) \ - req->uid = req->svc->anonuid; \ - if (req->gid == RPC_ROOT_GID) \ - req->gid = req->svc->anongid; \ - \ - for (gidcount = 0; gidcount < req->auxgidcount; \ - ++gidcount) { \ - if (!req->auxgids[gidcount]) \ - req->auxgids[gidcount] = \ - req->svc->anongid; \ - } \ - } \ - } while (0); - -#define RPCSVC_ACTOR_SUCCESS 0 -#define RPCSVC_ACTOR_ERROR (-1) -#define RPCSVC_ACTOR_IGNORE (-2) +#define RPC_AUTH_ROOT_SQUASH(req) \ + do { \ + int gidcount = 0; \ + if (req->svc->root_squash) { \ + if (req->uid == RPC_ROOT_UID) \ + req->uid = req->svc->anonuid; \ + if (req->gid == RPC_ROOT_GID) \ + req->gid = req->svc->anongid; \ + \ + for (gidcount = 0; gidcount < req->auxgidcount; ++gidcount) { \ + if (!req->auxgids[gidcount]) \ + req->auxgids[gidcount] = req->svc->anongid; \ + } \ + } \ + } while (0); + +#define RPCSVC_ACTOR_SUCCESS 0 +#define RPCSVC_ACTOR_ERROR (-1) +#define RPCSVC_ACTOR_IGNORE (-2) /* Functor for every type of protocol actor * must be defined like this. @@ -318,44 +322,44 @@ struct rpcsvc_request { * should return RPCSVC_ACTOR_ERROR. * */ -typedef int (*rpcsvc_actor) (rpcsvc_request_t *req); -typedef int (*rpcsvc_vector_sizer) (int state, ssize_t *readsize, - char *base_addr, char *curr_addr); +typedef int (*rpcsvc_actor)(rpcsvc_request_t *req); +typedef int (*rpcsvc_vector_sizer)(int state, ssize_t *readsize, + char *base_addr, char *curr_addr); /* Every protocol actor will also need to specify the function the RPC layer * will use to serialize or encode the message into XDR format just before * transmitting on the connection. */ -typedef void *(*rpcsvc_encode_reply) (void *msg); +typedef void *(*rpcsvc_encode_reply)(void *msg); /* Once the reply has been transmitted, the message will have to be de-allocated * , so every actor will need to provide a function that deallocates the message * it had allocated as a response. */ -typedef void (*rpcsvc_deallocate_reply) (void *msg); +typedef void (*rpcsvc_deallocate_reply)(void *msg); -#define RPCSVC_NAME_MAX 32 +#define RPCSVC_NAME_MAX 32 /* The descriptor for each procedure/actor that runs * over the RPC service. */ typedef struct rpcsvc_actor_desc { - char procname[RPCSVC_NAME_MAX]; - int procnum; - rpcsvc_actor actor; - - /* Handler for cases where the RPC requests fragments are large enough - * to benefit from being decoded into aligned memory addresses. While - * decoding the request in a non-vectored manner, due to the nature of - * the XDR scheme, RPC cannot guarantee memory aligned addresses for - * the resulting message-specific structures. Allowing a specialized - * handler for letting the RPC program read the data from the network - * directly into its aligned buffers. - */ - rpcsvc_vector_sizer vector_sizer; - - /* Can actor be ran on behalf an unprivileged requestor? */ - gf_boolean_t unprivileged; - drc_op_type_t op_type; + char procname[RPCSVC_NAME_MAX]; + int procnum; + rpcsvc_actor actor; + + /* Handler for cases where the RPC requests fragments are large enough + * to benefit from being decoded into aligned memory addresses. While + * decoding the request in a non-vectored manner, due to the nature of + * the XDR scheme, RPC cannot guarantee memory aligned addresses for + * the resulting message-specific structures. Allowing a specialized + * handler for letting the RPC program read the data from the network + * directly into its aligned buffers. + */ + rpcsvc_vector_sizer vector_sizer; + + /* Can actor be ran on behalf an unprivileged requestor? */ + gf_boolean_t unprivileged; + drc_op_type_t op_type; } rpcsvc_actor_t; /* Describes a program and its version along with the function pointers @@ -363,87 +367,86 @@ typedef struct rpcsvc_actor_desc { * Never changed ever by any thread so no need for a lock. */ struct rpcsvc_program { - char progname[RPCSVC_NAME_MAX]; - int prognum; - int progver; - /* FIXME */ - dict_t *options; /* An opaque dictionary - * populated by the program - * (probably from xl->options) - * which contain enough - * information for transport to - * initialize. As a part of - * cleanup, the members of - * options which are of interest - * to transport should be put - * into a structure for better - * readability and structure - * should replace options member - * here. - */ - uint16_t progport; /* Registered with portmap */ + char progname[RPCSVC_NAME_MAX]; + int prognum; + int progver; + /* FIXME */ + dict_t *options; /* An opaque dictionary + * populated by the program + * (probably from xl->options) + * which contain enough + * information for transport to + * initialize. As a part of + * cleanup, the members of + * options which are of interest + * to transport should be put + * into a structure for better + * readability and structure + * should replace options member + * here. + */ + uint16_t progport; /* Registered with portmap */ #if 0 int progaddrfamily; /* AF_INET or AF_INET6 */ char *proghost; /* Bind host, can be NULL */ #endif - rpcsvc_actor_t *actors; /* All procedure handlers */ - int numactors; /* Num actors in actor array */ - int proghighvers; /* Highest ver for program - supported by the system. */ - int proglowvers; /* Lowest ver */ - - /* Program specific state handed to actors */ - void *private; - - - /* This upcall is provided by the program during registration. - * It is used to notify the program about events like connection being - * destroyed etc. The rpc program may take appropriate actions, for eg., - * in the case of connection being destroyed, it should cleanup its - * state stored in the connection. - */ - rpcsvc_notify_t notify; - - /* An integer that identifies the min auth strength that is required - * by this protocol, for eg. MOUNT3 needs AUTH_UNIX at least. - * See RFC 1813, Section 5.2.1. - */ - int min_auth; - - /* Execute actor function in program's own thread? This will reduce */ - /* the workload on poller threads */ - gf_boolean_t ownthread; - gf_boolean_t alive; - - gf_boolean_t synctask; - /* list member to link to list of registered services with rpcsvc */ - struct list_head program; - struct list_head request_queue; - pthread_mutex_t queue_lock; - pthread_cond_t queue_cond; - pthread_t thread; - int threadcount; - /* eventthreadcount is just a readonly copy of the actual value - * owned by the event sub-system - * It is used to control the scaling of rpcsvc_request_handler threads - */ - int eventthreadcount; + rpcsvc_actor_t *actors; /* All procedure handlers */ + int numactors; /* Num actors in actor array */ + int proghighvers; /* Highest ver for program + supported by the system. */ + int proglowvers; /* Lowest ver */ + + /* Program specific state handed to actors */ + void *private; + + /* This upcall is provided by the program during registration. + * It is used to notify the program about events like connection being + * destroyed etc. The rpc program may take appropriate actions, for eg., + * in the case of connection being destroyed, it should cleanup its + * state stored in the connection. + */ + rpcsvc_notify_t notify; + + /* An integer that identifies the min auth strength that is required + * by this protocol, for eg. MOUNT3 needs AUTH_UNIX at least. + * See RFC 1813, Section 5.2.1. + */ + int min_auth; + + /* Execute actor function in program's own thread? This will reduce */ + /* the workload on poller threads */ + gf_boolean_t ownthread; + gf_boolean_t alive; + + gf_boolean_t synctask; + /* list member to link to list of registered services with rpcsvc */ + struct list_head program; + struct list_head request_queue; + pthread_mutex_t queue_lock; + pthread_cond_t queue_cond; + pthread_t thread; + int threadcount; + /* eventthreadcount is just a readonly copy of the actual value + * owned by the event sub-system + * It is used to control the scaling of rpcsvc_request_handler threads + */ + int eventthreadcount; }; typedef struct rpcsvc_cbk_program { - char *progname; - int prognum; - int progver; + char *progname; + int prognum; + int progver; } rpcsvc_cbk_program_t; /* All users of RPC services should use this API to register their * procedure handlers. */ extern int -rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t *program, - gf_boolean_t add_to_head); +rpcsvc_program_register(rpcsvc_t *svc, rpcsvc_program_t *program, + gf_boolean_t add_to_head); extern int -rpcsvc_program_unregister (rpcsvc_t *svc, rpcsvc_program_t *program); +rpcsvc_program_unregister(rpcsvc_t *svc, rpcsvc_program_t *program); /* This will create and add a listener to listener pool. Programs can * use any of the listener in this pool. A single listener can be used by @@ -454,149 +457,150 @@ rpcsvc_program_unregister (rpcsvc_t *svc, rpcsvc_program_t *program); */ /* FIXME: can multiple programs registered on same port? */ extern int32_t -rpcsvc_create_listeners (rpcsvc_t *svc, dict_t *options, char *name); +rpcsvc_create_listeners(rpcsvc_t *svc, dict_t *options, char *name); void -rpcsvc_listener_destroy (rpcsvc_listener_t *listener); +rpcsvc_listener_destroy(rpcsvc_listener_t *listener); extern int -rpcsvc_program_register_portmap (rpcsvc_program_t *newprog, uint32_t port); +rpcsvc_program_register_portmap(rpcsvc_program_t *newprog, uint32_t port); #ifdef IPV6_DEFAULT extern int -rpcsvc_program_register_rpcbind6 (rpcsvc_program_t *newprog, uint32_t port); +rpcsvc_program_register_rpcbind6(rpcsvc_program_t *newprog, uint32_t port); extern int -rpcsvc_program_unregister_rpcbind6 (rpcsvc_program_t *newprog); +rpcsvc_program_unregister_rpcbind6(rpcsvc_program_t *newprog); #endif extern int -rpcsvc_program_unregister_portmap (rpcsvc_program_t *newprog); +rpcsvc_program_unregister_portmap(rpcsvc_program_t *newprog); extern int -rpcsvc_register_portmap_enabled (rpcsvc_t *svc); +rpcsvc_register_portmap_enabled(rpcsvc_t *svc); /* Inits the global RPC service data structures. * Called in main. */ extern rpcsvc_t * -rpcsvc_init (xlator_t *xl, glusterfs_ctx_t *ctx, dict_t *options, - uint32_t poolcount); +rpcsvc_init(xlator_t *xl, glusterfs_ctx_t *ctx, dict_t *options, + uint32_t poolcount); extern int -rpcsvc_reconfigure_options (rpcsvc_t *svc, dict_t *options); +rpcsvc_reconfigure_options(rpcsvc_t *svc, dict_t *options); int -rpcsvc_register_notify (rpcsvc_t *svc, rpcsvc_notify_t notify, void *mydata); +rpcsvc_register_notify(rpcsvc_t *svc, rpcsvc_notify_t notify, void *mydata); /* unregister a notification callback @notify with data @mydata from svc. * returns the number of notification callbacks unregistered. */ int -rpcsvc_unregister_notify (rpcsvc_t *svc, rpcsvc_notify_t notify, void *mydata); +rpcsvc_unregister_notify(rpcsvc_t *svc, rpcsvc_notify_t notify, void *mydata); int -rpcsvc_transport_submit (rpc_transport_t *trans, struct iovec *rpchdr, - int rpchdrcount, struct iovec *proghdr, - int proghdrcount, struct iovec *progpayload, - int progpayloadcount, struct iobref *iobref, - void *priv); +rpcsvc_transport_submit(rpc_transport_t *trans, struct iovec *rpchdr, + int rpchdrcount, struct iovec *proghdr, + int proghdrcount, struct iovec *progpayload, + int progpayloadcount, struct iobref *iobref, + void *priv); int -rpcsvc_submit_message (rpcsvc_request_t *req, struct iovec *proghdr, - int hdrcount, struct iovec *payload, int payloadcount, - struct iobref *iobref); +rpcsvc_submit_message(rpcsvc_request_t *req, struct iovec *proghdr, + int hdrcount, struct iovec *payload, int payloadcount, + struct iobref *iobref); int -rpcsvc_submit_generic (rpcsvc_request_t *req, struct iovec *proghdr, - int hdrcount, struct iovec *payload, int payloadcount, - struct iobref *iobref); +rpcsvc_submit_generic(rpcsvc_request_t *req, struct iovec *proghdr, + int hdrcount, struct iovec *payload, int payloadcount, + struct iobref *iobref); extern int -rpcsvc_error_reply (rpcsvc_request_t *req); +rpcsvc_error_reply(rpcsvc_request_t *req); -#define RPCSVC_PEER_STRLEN 1024 -#define RPCSVC_AUTH_ACCEPT 1 -#define RPCSVC_AUTH_REJECT 2 -#define RPCSVC_AUTH_DONTCARE 3 +#define RPCSVC_PEER_STRLEN 1024 +#define RPCSVC_AUTH_ACCEPT 1 +#define RPCSVC_AUTH_REJECT 2 +#define RPCSVC_AUTH_DONTCARE 3 extern int -rpcsvc_transport_peername (rpc_transport_t *trans, char *hostname, int hostlen); +rpcsvc_transport_peername(rpc_transport_t *trans, char *hostname, int hostlen); extern int -rpcsvc_transport_peeraddr (rpc_transport_t *trans, char *addrstr, int addrlen, - struct sockaddr_storage *returnsa, socklen_t sasize); +rpcsvc_transport_peeraddr(rpc_transport_t *trans, char *addrstr, int addrlen, + struct sockaddr_storage *returnsa, socklen_t sasize); extern int -rpcsvc_auth_check (rpcsvc_t *svc, char *volname, char *ipaddr); +rpcsvc_auth_check(rpcsvc_t *svc, char *volname, char *ipaddr); extern int -rpcsvc_transport_privport_check (rpcsvc_t *svc, char *volname, uint16_t port); - -#define rpcsvc_request_seterr(req, err) ((req)->rpc_err = (int)(err)) -#define rpcsvc_request_set_autherr(req, err) ((req)->auth_err = (int)(err)) +rpcsvc_transport_privport_check(rpcsvc_t *svc, char *volname, uint16_t port); -extern int rpcsvc_submit_vectors (rpcsvc_request_t *req); +#define rpcsvc_request_seterr(req, err) ((req)->rpc_err = (int)(err)) +#define rpcsvc_request_set_autherr(req, err) ((req)->auth_err = (int)(err)) -extern int rpcsvc_request_attach_vector (rpcsvc_request_t *req, - struct iovec msgvec, struct iobuf *iob, - struct iobref *ioref, int finalvector); +extern int +rpcsvc_submit_vectors(rpcsvc_request_t *req); +extern int +rpcsvc_request_attach_vector(rpcsvc_request_t *req, struct iovec msgvec, + struct iobuf *iob, struct iobref *ioref, + int finalvector); -typedef int (*auth_init_trans) (rpc_transport_t *trans, void *priv); -typedef int (*auth_init_request) (rpcsvc_request_t *req, void *priv); -typedef int (*auth_request_authenticate) (rpcsvc_request_t *req, void *priv); +typedef int (*auth_init_trans)(rpc_transport_t *trans, void *priv); +typedef int (*auth_init_request)(rpcsvc_request_t *req, void *priv); +typedef int (*auth_request_authenticate)(rpcsvc_request_t *req, void *priv); /* This structure needs to be registered by every authentication scheme. * Our authentication schemes are stored per connection because * each connection will end up using a different authentication scheme. */ typedef struct rpcsvc_auth_ops { - auth_init_trans transport_init; - auth_init_request request_init; - auth_request_authenticate authenticate; + auth_init_trans transport_init; + auth_init_request request_init; + auth_request_authenticate authenticate; } rpcsvc_auth_ops_t; typedef struct rpcsvc_auth_flavour_desc { - char authname[RPCSVC_NAME_MAX]; - int authnum; - rpcsvc_auth_ops_t *authops; - void *authprivate; + char authname[RPCSVC_NAME_MAX]; + int authnum; + rpcsvc_auth_ops_t *authops; + void *authprivate; } rpcsvc_auth_t; -typedef void * (*rpcsvc_auth_initer_t) (rpcsvc_t *svc, dict_t *options); +typedef void *(*rpcsvc_auth_initer_t)(rpcsvc_t *svc, dict_t *options); struct rpcsvc_auth_list { - struct list_head authlist; - rpcsvc_auth_initer_t init; - /* Should be the name with which we identify the auth scheme given - * in the volfile options. - * This should be different from the authname in rpc_auth_t - * in way that makes it easier to specify this scheme in the volfile. - * This is because the technical names of the schemes can be a bit - * arcane. - */ - char name[RPCSVC_NAME_MAX]; - rpcsvc_auth_t *auth; - int enable; + struct list_head authlist; + rpcsvc_auth_initer_t init; + /* Should be the name with which we identify the auth scheme given + * in the volfile options. + * This should be different from the authname in rpc_auth_t + * in way that makes it easier to specify this scheme in the volfile. + * This is because the technical names of the schemes can be a bit + * arcane. + */ + char name[RPCSVC_NAME_MAX]; + rpcsvc_auth_t *auth; + int enable; }; extern int -rpcsvc_auth_request_init (rpcsvc_request_t *req, struct rpc_msg *callmsg); +rpcsvc_auth_request_init(rpcsvc_request_t *req, struct rpc_msg *callmsg); extern int -rpcsvc_auth_init (rpcsvc_t *svc, dict_t *options); +rpcsvc_auth_init(rpcsvc_t *svc, dict_t *options); extern int -rpcsvc_auth_reconf (rpcsvc_t *svc, dict_t *options); +rpcsvc_auth_reconf(rpcsvc_t *svc, dict_t *options); extern int -rpcsvc_auth_transport_init (rpc_transport_t *xprt); +rpcsvc_auth_transport_init(rpc_transport_t *xprt); extern int -rpcsvc_authenticate (rpcsvc_request_t *req); +rpcsvc_authenticate(rpcsvc_request_t *req); extern int -rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen); +rpcsvc_auth_array(rpcsvc_t *svc, char *volname, int *autharr, int arrlen); /* If the request has been sent using AUTH_UNIX, this function returns the * auxiliary gids as an array, otherwise, it returns NULL. @@ -604,51 +608,53 @@ rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen); * authentication code even further to support mode auth schemes. */ extern gid_t * -rpcsvc_auth_unix_auxgids (rpcsvc_request_t *req, int *arrlen); +rpcsvc_auth_unix_auxgids(rpcsvc_request_t *req, int *arrlen); extern char * -rpcsvc_volume_allowed (dict_t *options, char *volname); +rpcsvc_volume_allowed(dict_t *options, char *volname); -int rpcsvc_request_submit (rpcsvc_t *rpc, rpc_transport_t *trans, - rpcsvc_cbk_program_t *prog, int procnum, - void *req, glusterfs_ctx_t *ctx, - xdrproc_t xdrproc); +int +rpcsvc_request_submit(rpcsvc_t *rpc, rpc_transport_t *trans, + rpcsvc_cbk_program_t *prog, int procnum, void *req, + glusterfs_ctx_t *ctx, xdrproc_t xdrproc); -int rpcsvc_callback_submit (rpcsvc_t *rpc, rpc_transport_t *trans, - rpcsvc_cbk_program_t *prog, int procnum, - struct iovec *proghdr, int proghdrcount, - struct iobref *iobref); +int +rpcsvc_callback_submit(rpcsvc_t *rpc, rpc_transport_t *trans, + rpcsvc_cbk_program_t *prog, int procnum, + struct iovec *proghdr, int proghdrcount, + struct iobref *iobref); rpcsvc_actor_t * -rpcsvc_program_actor (rpcsvc_request_t *req); +rpcsvc_program_actor(rpcsvc_request_t *req); int -rpcsvc_transport_unix_options_build (dict_t **options, char *filepath); +rpcsvc_transport_unix_options_build(dict_t **options, char *filepath); int -rpcsvc_set_allow_insecure (rpcsvc_t *svc, dict_t *options); +rpcsvc_set_allow_insecure(rpcsvc_t *svc, dict_t *options); int -rpcsvc_set_addr_namelookup (rpcsvc_t *svc, dict_t *options); +rpcsvc_set_addr_namelookup(rpcsvc_t *svc, dict_t *options); int -rpcsvc_set_root_squash (rpcsvc_t *svc, dict_t *options); +rpcsvc_set_root_squash(rpcsvc_t *svc, dict_t *options); int -rpcsvc_set_outstanding_rpc_limit (rpcsvc_t *svc, dict_t *options, int defvalue); +rpcsvc_set_outstanding_rpc_limit(rpcsvc_t *svc, dict_t *options, int defvalue); int -rpcsvc_set_throttle_on (rpcsvc_t *svc); +rpcsvc_set_throttle_on(rpcsvc_t *svc); int -rpcsvc_set_throttle_off (rpcsvc_t *svc); +rpcsvc_set_throttle_off(rpcsvc_t *svc); gf_boolean_t -rpcsvc_get_throttle (rpcsvc_t *svc); +rpcsvc_get_throttle(rpcsvc_t *svc); int -rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen); +rpcsvc_auth_array(rpcsvc_t *svc, char *volname, int *autharr, int arrlen); rpcsvc_vector_sizer -rpcsvc_get_program_vector_sizer (rpcsvc_t *svc, uint32_t prognum, - uint32_t progver, int procnum); +rpcsvc_get_program_vector_sizer(rpcsvc_t *svc, uint32_t prognum, + uint32_t progver, int procnum); extern int -rpcsvc_ownthread_reconf (rpcsvc_t *svc, int new_eventthreadcount); +rpcsvc_ownthread_reconf(rpcsvc_t *svc, int new_eventthreadcount); -void rpcsvc_autoscale_threads (glusterfs_ctx_t *ctx, rpcsvc_t *rpc, int incr); +void +rpcsvc_autoscale_threads(glusterfs_ctx_t *ctx, rpcsvc_t *rpc, int incr); #endif diff --git a/rpc/rpc-lib/src/xdr-common.h b/rpc/rpc-lib/src/xdr-common.h index db6b5f1a0d2..7b0bc36ec64 100644 --- a/rpc/rpc-lib/src/xdr-common.h +++ b/rpc/rpc-lib/src/xdr-common.h @@ -22,10 +22,10 @@ #endif /* __NetBSD__ */ enum gf_dump_procnum { - GF_DUMP_NULL, - GF_DUMP_DUMP, - GF_DUMP_PING, - GF_DUMP_MAXVALUE, + GF_DUMP_NULL, + GF_DUMP_DUMP, + GF_DUMP_PING, + GF_DUMP_MAXVALUE, }; #define GLUSTER_DUMP_PROGRAM 123451501 /* Completely random */ @@ -33,7 +33,7 @@ enum gf_dump_procnum { /* MAX_AUTH_BYTES is restricted to 400 bytes, see * http://tools.ietf.org/html/rfc5531#section-8.2 */ -#define GF_MAX_AUTH_BYTES MAX_AUTH_BYTES +#define GF_MAX_AUTH_BYTES MAX_AUTH_BYTES /* The size of an AUTH_GLUSTERFS_V2 structure: * @@ -58,32 +58,33 @@ enum gf_dump_procnum { * ------- * On v3, there are 4 more units, and hence it will be 9 xdr-units */ -#define GF_AUTH_GLUSTERFS_MAX_GROUPS(lk_len, type) \ - ((type == AUTH_GLUSTERFS_v2) ? (95 - lk_len) : (91 - lk_len)) -#define GF_AUTH_GLUSTERFS_MAX_LKOWNER(groups_len, type) \ - ((type == AUTH_GLUSTERFS_v2) ? (95 - groups_len) : (91 - groups_len)) - +#define GF_AUTH_GLUSTERFS_MAX_GROUPS(lk_len, type) \ + ((type == AUTH_GLUSTERFS_v2) ? (95 - lk_len) : (91 - lk_len)) +#define GF_AUTH_GLUSTERFS_MAX_LKOWNER(groups_len, type) \ + ((type == AUTH_GLUSTERFS_v2) ? (95 - groups_len) : (91 - groups_len)) #ifdef GF_LINUX_HOST_OS #define xdr_u_int32_t xdr_uint32_t #define xdr_u_int64_t xdr_uint64_t #ifdef IPV6_DEFAULT -unsigned long xdr_sizeof (xdrproc_t func, void *data); +unsigned long +xdr_sizeof(xdrproc_t func, void *data); #endif #endif #ifdef GF_DARWIN_HOST_OS #define xdr_u_quad_t xdr_u_int64_t -#define xdr_quad_t xdr_int64_t +#define xdr_quad_t xdr_int64_t #define xdr_uint32_t xdr_u_int32_t #define xdr_uint64_t xdr_u_int64_t #define uint64_t u_int64_t -unsigned long xdr_sizeof (xdrproc_t func, void *data); +unsigned long +xdr_sizeof(xdrproc_t func, void *data); #endif #if defined(__NetBSD__) #define xdr_u_quad_t xdr_u_int64_t -#define xdr_quad_t xdr_int64_t +#define xdr_quad_t xdr_int64_t #define xdr_uint32_t xdr_u_int32_t #define xdr_uint64_t xdr_u_int64_t #endif @@ -92,7 +93,7 @@ unsigned long xdr_sizeof (xdrproc_t func, void *data); #define u_quad_t uint64_t #define quad_t int64_t #define xdr_u_quad_t xdr_uint64_t -#define xdr_quad_t xdr_int64_t +#define xdr_quad_t xdr_int64_t #endif /* Returns the address of the byte that follows the @@ -100,16 +101,18 @@ unsigned long xdr_sizeof (xdrproc_t func, void *data); * E.g. once the RPC call for NFS has been decoded, the macro will return * the address from which the NFS header starts. */ -#define xdr_decoded_remaining_addr(xdr) ((&xdr)->x_private) +#define xdr_decoded_remaining_addr(xdr) ((&xdr)->x_private) /* Returns the length of the remaining record after the previous decode * operation completed. */ -#define xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy) +#define xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy) /* Returns the number of bytes used by the last encode operation. */ -#define xdr_encoded_length(xdr) (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base)) +#define xdr_encoded_length(xdr) \ + (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base)) -#define xdr_decoded_length(xdr) (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base)) +#define xdr_decoded_length(xdr) \ + (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base)) #endif diff --git a/rpc/rpc-lib/src/xdr-rpc.h b/rpc/rpc-lib/src/xdr-rpc.h index 9f0e78a0fc1..a57cd9430be 100644 --- a/rpc/rpc-lib/src/xdr-rpc.h +++ b/rpc/rpc-lib/src/xdr-rpc.h @@ -28,66 +28,68 @@ #include "xdr-common.h" typedef enum { - AUTH_GLUSTERFS = 5, - AUTH_GLUSTERFS_v2 = 390039, /* using a number from 'unused' range, - from the list available in RFC5531 */ - AUTH_GLUSTERFS_v3 = 390040, /* this too is unused */ + AUTH_GLUSTERFS = 5, + AUTH_GLUSTERFS_v2 = 390039, /* using a number from 'unused' range, + from the list available in RFC5531 */ + AUTH_GLUSTERFS_v3 = 390040, /* this too is unused */ } gf_rpc_authtype_t; /* Converts a given network buffer from its XDR format to a structure * that contains everything an RPC call needs to work. */ extern int -xdr_to_rpc_call (char *msgbuf, size_t len, struct rpc_msg *call, - struct iovec *payload, char *credbytes, char *verfbytes); +xdr_to_rpc_call(char *msgbuf, size_t len, struct rpc_msg *call, + struct iovec *payload, char *credbytes, char *verfbytes); extern int -rpc_fill_empty_reply (struct rpc_msg *reply, uint32_t xid); +rpc_fill_empty_reply(struct rpc_msg *reply, uint32_t xid); extern int -rpc_fill_denied_reply (struct rpc_msg *reply, int rjstat, int auth_err); +rpc_fill_denied_reply(struct rpc_msg *reply, int rjstat, int auth_err); extern int -rpc_fill_accepted_reply (struct rpc_msg *reply, int arstat, int proglow, - int proghigh, int verf, int len, char *vdata); +rpc_fill_accepted_reply(struct rpc_msg *reply, int arstat, int proglow, + int proghigh, int verf, int len, char *vdata); extern int -rpc_reply_to_xdr (struct rpc_msg *reply, char *dest, size_t len, - struct iovec *dst); +rpc_reply_to_xdr(struct rpc_msg *reply, char *dest, size_t len, + struct iovec *dst); extern int -xdr_to_auth_unix_cred (char *msgbuf, int msglen, struct authunix_parms *au, - char *machname, gid_t *gids); +xdr_to_auth_unix_cred(char *msgbuf, int msglen, struct authunix_parms *au, + char *machname, gid_t *gids); /* Macros that simplify accessing the members of an RPC call structure. */ -#define rpc_call_xid(call) ((call)->rm_xid) -#define rpc_call_direction(call) ((call)->rm_direction) -#define rpc_call_rpcvers(call) ((call)->ru.RM_cmb.cb_rpcvers) -#define rpc_call_program(call) ((call)->ru.RM_cmb.cb_prog) -#define rpc_call_progver(call) ((call)->ru.RM_cmb.cb_vers) -#define rpc_call_progproc(call) ((call)->ru.RM_cmb.cb_proc) -#define rpc_opaque_auth_flavour(oa) ((oa)->oa_flavor) -#define rpc_opaque_auth_len(oa) ((oa)->oa_length) - -#define rpc_call_cred_flavour(call) (rpc_opaque_auth_flavour ((&(call)->ru.RM_cmb.cb_cred))) -#define rpc_call_cred_len(call) (rpc_opaque_auth_len ((&(call)->ru.RM_cmb.cb_cred))) - - -#define rpc_call_verf_flavour(call) (rpc_opaque_auth_flavour ((&(call)->ru.RM_cmb.cb_verf))) -#define rpc_call_verf_len(call) (rpc_opaque_auth_len ((&(call)->ru.RM_cmb.cb_verf))) - - -#if defined(GF_DARWIN_HOST_OS) || !defined (HAVE_RPC_RPC_H) -#define GF_PRI_RPC_XID PRIu32 -#define GF_PRI_RPC_VERSION PRIu32 -#define GF_PRI_RPC_PROG_ID PRIu32 -#define GF_PRI_RPC_PROG_VERS PRIu32 -#define GF_PRI_RPC_PROC PRIu32 +#define rpc_call_xid(call) ((call)->rm_xid) +#define rpc_call_direction(call) ((call)->rm_direction) +#define rpc_call_rpcvers(call) ((call)->ru.RM_cmb.cb_rpcvers) +#define rpc_call_program(call) ((call)->ru.RM_cmb.cb_prog) +#define rpc_call_progver(call) ((call)->ru.RM_cmb.cb_vers) +#define rpc_call_progproc(call) ((call)->ru.RM_cmb.cb_proc) +#define rpc_opaque_auth_flavour(oa) ((oa)->oa_flavor) +#define rpc_opaque_auth_len(oa) ((oa)->oa_length) + +#define rpc_call_cred_flavour(call) \ + (rpc_opaque_auth_flavour((&(call)->ru.RM_cmb.cb_cred))) +#define rpc_call_cred_len(call) \ + (rpc_opaque_auth_len((&(call)->ru.RM_cmb.cb_cred))) + +#define rpc_call_verf_flavour(call) \ + (rpc_opaque_auth_flavour((&(call)->ru.RM_cmb.cb_verf))) +#define rpc_call_verf_len(call) \ + (rpc_opaque_auth_len((&(call)->ru.RM_cmb.cb_verf))) + +#if defined(GF_DARWIN_HOST_OS) || !defined(HAVE_RPC_RPC_H) +#define GF_PRI_RPC_XID PRIu32 +#define GF_PRI_RPC_VERSION PRIu32 +#define GF_PRI_RPC_PROG_ID PRIu32 +#define GF_PRI_RPC_PROG_VERS PRIu32 +#define GF_PRI_RPC_PROC PRIu32 #define GF_PRI_RPC_PROC_VERSION PRIu32 #else -#define GF_PRI_RPC_XID PRIu64 -#define GF_PRI_RPC_VERSION PRIu64 -#define GF_PRI_RPC_PROG_ID PRIu64 -#define GF_PRI_RPC_PROG_VERS PRIu64 -#define GF_PRI_RPC_PROC PRIu64 +#define GF_PRI_RPC_XID PRIu64 +#define GF_PRI_RPC_VERSION PRIu64 +#define GF_PRI_RPC_PROG_ID PRIu64 +#define GF_PRI_RPC_PROG_VERS PRIu64 +#define GF_PRI_RPC_PROC PRIu64 #define GF_PRI_RPC_PROC_VERSION PRIu64 #endif diff --git a/rpc/rpc-lib/src/xdr-rpcclnt.h b/rpc/rpc-lib/src/xdr-rpcclnt.h index e8d615a872e..4d6e38d429c 100644 --- a/rpc/rpc-lib/src/xdr-rpcclnt.h +++ b/rpc/rpc-lib/src/xdr-rpcclnt.h @@ -20,18 +20,19 @@ #include <rpc/auth_unix.h> /* Macros that simplify accessing the members of an RPC call structure. */ -#define rpc_reply_xid(reply) ((reply)->rm_xid) -#define rpc_reply_status(reply) ((reply)->ru.RM_rmb.rp_stat) -#define rpc_accepted_reply_status(reply) ((reply)->acpted_rply.ar_stat) -#define rpc_reply_verf_flavour(reply) ((reply)->acpted_rply.ar_verf.oa_flavor) +#define rpc_reply_xid(reply) ((reply)->rm_xid) +#define rpc_reply_status(reply) ((reply)->ru.RM_rmb.rp_stat) +#define rpc_accepted_reply_status(reply) ((reply)->acpted_rply.ar_stat) +#define rpc_reply_verf_flavour(reply) ((reply)->acpted_rply.ar_verf.oa_flavor) -int xdr_to_rpc_reply (char *msgbuf, size_t len, struct rpc_msg *reply, - struct iovec *payload, char *verfbytes); int -rpc_request_to_xdr (struct rpc_msg *request, char *dest, size_t len, - struct iovec *dst); +xdr_to_rpc_reply(char *msgbuf, size_t len, struct rpc_msg *reply, + struct iovec *payload, char *verfbytes); int -auth_unix_cred_to_xdr (struct authunix_parms *au, char *dest, size_t len, - struct iovec *iov); +rpc_request_to_xdr(struct rpc_msg *request, char *dest, size_t len, + struct iovec *dst); +int +auth_unix_cred_to_xdr(struct authunix_parms *au, char *dest, size_t len, + struct iovec *iov); #endif |