diff options
Diffstat (limited to 'rpc')
-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 | ||||
-rw-r--r-- | rpc/rpc-transport/rdma/src/name.h | 19 | ||||
-rw-r--r-- | rpc/rpc-transport/rdma/src/rdma.h | 506 | ||||
-rw-r--r-- | rpc/rpc-transport/rdma/src/rpc-trans-rdma-messages.h | 119 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/name.h | 20 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/socket-mem-types.h | 8 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.h | 385 | ||||
-rw-r--r-- | rpc/xdr/src/glusterfs3.h | 1408 | ||||
-rw-r--r-- | rpc/xdr/src/msg-nfs3.h | 134 | ||||
-rw-r--r-- | rpc/xdr/src/xdr-generic.h | 31 | ||||
-rw-r--r-- | rpc/xdr/src/xdr-nfs3.h | 1431 |
21 files changed, 3214 insertions, 3129 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 diff --git a/rpc/rpc-transport/rdma/src/name.h b/rpc/rpc-transport/rdma/src/name.h index 742fc5fc3f2..6c782b52db5 100644 --- a/rpc/rpc-transport/rdma/src/name.h +++ b/rpc/rpc-transport/rdma/src/name.h @@ -16,21 +16,20 @@ #include "compat.h" int32_t -gf_rdma_client_bind (rpc_transport_t *this, struct sockaddr *sockaddr, - socklen_t *sockaddr_len, struct rdma_cm_id *cm_id); +gf_rdma_client_bind(rpc_transport_t *this, struct sockaddr *sockaddr, + socklen_t *sockaddr_len, struct rdma_cm_id *cm_id); int32_t -gf_rdma_client_get_remote_sockaddr (rpc_transport_t *this, - struct sockaddr *sockaddr, - socklen_t *sockaddr_len, - int16_t remote_port); +gf_rdma_client_get_remote_sockaddr(rpc_transport_t *this, + struct sockaddr *sockaddr, + socklen_t *sockaddr_len, + int16_t remote_port); int32_t -gf_rdma_server_get_local_sockaddr (rpc_transport_t *this, - struct sockaddr *addr, - socklen_t *addr_len); +gf_rdma_server_get_local_sockaddr(rpc_transport_t *this, struct sockaddr *addr, + socklen_t *addr_len); int32_t -gf_rdma_get_transport_identifiers (rpc_transport_t *this); +gf_rdma_get_transport_identifiers(rpc_transport_t *this); #endif /* _IB_VERBS_NAME_H */ diff --git a/rpc/rpc-transport/rdma/src/rdma.h b/rpc/rpc-transport/rdma/src/rdma.h index 39f7f45046d..84c1397054b 100644 --- a/rpc/rpc-transport/rdma/src/rdma.h +++ b/rpc/rpc-transport/rdma/src/rdma.h @@ -11,7 +11,6 @@ #ifndef _XPORT_RDMA_H #define _XPORT_RDMA_H - #ifndef MAX_IOVEC #define MAX_IOVEC 16 #endif /* MAX_IOVEC */ @@ -29,364 +28,357 @@ /* FIXME: give appropriate values to these macros */ #define GF_DEFAULT_RDMA_LISTEN_PORT (GF_DEFAULT_BASE_PORT + 1) - /* If you are changing GF_RDMA_MAX_SEGMENTS, please make sure to update * GLUSTERFS_GF_RDMA_MAX_HEADER_SIZE defined in glusterfs.h . */ -#define GF_RDMA_MAX_SEGMENTS 8 +#define GF_RDMA_MAX_SEGMENTS 8 -#define GF_RDMA_VERSION 1 -#define GF_RDMA_POOL_SIZE 512 +#define GF_RDMA_VERSION 1 +#define GF_RDMA_POOL_SIZE 512 /* Additional attributes */ -#define GF_RDMA_TIMEOUT 14 -#define GF_RDMA_RETRY_CNT 7 -#define GF_RDMA_RNR_RETRY 7 +#define GF_RDMA_TIMEOUT 14 +#define GF_RDMA_RETRY_CNT 7 +#define GF_RDMA_RNR_RETRY 7 -typedef enum gf_rdma_errcode { - ERR_VERS = 1, - ERR_CHUNK = 2 -}gf_rdma_errcode_t; +typedef enum gf_rdma_errcode { ERR_VERS = 1, ERR_CHUNK = 2 } gf_rdma_errcode_t; struct gf_rdma_err_vers { - uint32_t gf_rdma_vers_low; /* Version range supported by peer */ - uint32_t gf_rdma_vers_high; -}__attribute__ ((packed)); + uint32_t gf_rdma_vers_low; /* Version range supported by peer */ + uint32_t gf_rdma_vers_high; +} __attribute__((packed)); typedef struct gf_rdma_err_vers gf_rdma_err_vers_t; typedef enum gf_rdma_proc { - GF_RDMA_MSG = 0, /* An RPC call or reply msg */ - GF_RDMA_NOMSG = 1, /* An RPC call or reply msg - separate body */ - GF_RDMA_MSGP = 2, /* An RPC call or reply msg with padding */ - GF_RDMA_DONE = 3, /* Client signals reply completion */ - GF_RDMA_ERROR = 4 /* An RPC RDMA encoding error */ -}gf_rdma_proc_t; + GF_RDMA_MSG = 0, /* An RPC call or reply msg */ + GF_RDMA_NOMSG = 1, /* An RPC call or reply msg - separate body */ + GF_RDMA_MSGP = 2, /* An RPC call or reply msg with padding */ + GF_RDMA_DONE = 3, /* Client signals reply completion */ + GF_RDMA_ERROR = 4 /* An RPC RDMA encoding error */ +} gf_rdma_proc_t; typedef enum gf_rdma_chunktype { - gf_rdma_noch = 0, /* no chunk */ - gf_rdma_readch, /* some argument through rdma read */ - gf_rdma_areadch, /* entire request through rdma read */ - gf_rdma_writech, /* some result through rdma write */ - gf_rdma_replych /* entire reply through rdma write */ -}gf_rdma_chunktype_t; + gf_rdma_noch = 0, /* no chunk */ + gf_rdma_readch, /* some argument through rdma read */ + gf_rdma_areadch, /* entire request through rdma read */ + gf_rdma_writech, /* some result through rdma write */ + gf_rdma_replych /* entire reply through rdma write */ +} gf_rdma_chunktype_t; /* If you are modifying __gf_rdma_header, please make sure to change - * GLUSTERFS_GF_RDMA_MAX_HEADER_SIZE defined in glusterfs.h to reflect your changes + * GLUSTERFS_GF_RDMA_MAX_HEADER_SIZE defined in glusterfs.h to reflect your + * changes */ struct __gf_rdma_header { - uint32_t rm_xid; /* Mirrors the RPC header xid */ - uint32_t rm_vers; /* Version of this protocol */ - uint32_t rm_credit; /* Buffers requested/granted */ - uint32_t rm_type; /* Type of message (enum gf_rdma_proc) */ - union { - struct { /* no chunks */ - uint32_t rm_empty[3]; /* 3 empty chunk lists */ - }__attribute__((packed)) rm_nochunks; - - struct { /* no chunks and padded */ - uint32_t rm_align; /* Padding alignment */ - uint32_t rm_thresh; /* Padding threshold */ - uint32_t rm_pempty[3]; /* 3 empty chunk lists */ - }__attribute__((packed)) rm_padded; - - struct { - uint32_t rm_type; - gf_rdma_err_vers_t rm_version; - }__attribute__ ((packed)) rm_error; - - uint32_t rm_chunks[0]; /* read, write and reply chunks */ - }__attribute__ ((packed)) rm_body; + uint32_t rm_xid; /* Mirrors the RPC header xid */ + uint32_t rm_vers; /* Version of this protocol */ + uint32_t rm_credit; /* Buffers requested/granted */ + uint32_t rm_type; /* Type of message (enum gf_rdma_proc) */ + union { + struct { /* no chunks */ + uint32_t rm_empty[3]; /* 3 empty chunk lists */ + } __attribute__((packed)) rm_nochunks; + + struct { /* no chunks and padded */ + uint32_t rm_align; /* Padding alignment */ + uint32_t rm_thresh; /* Padding threshold */ + uint32_t rm_pempty[3]; /* 3 empty chunk lists */ + } __attribute__((packed)) rm_padded; + + struct { + uint32_t rm_type; + gf_rdma_err_vers_t rm_version; + } __attribute__((packed)) rm_error; + + uint32_t rm_chunks[0]; /* read, write and reply chunks */ + } __attribute__((packed)) rm_body; } __attribute__((packed)); typedef struct __gf_rdma_header gf_rdma_header_t; -/* If you are modifying __gf_rdma_segment or __gf_rdma_read_chunk, please make sure - * to change GLUSTERFS_GF_RDMA_MAX_HEADER_SIZE defined in glusterfs.h to reflect - * your changes. +/* If you are modifying __gf_rdma_segment or __gf_rdma_read_chunk, please make + * sure to change GLUSTERFS_GF_RDMA_MAX_HEADER_SIZE defined in glusterfs.h to + * reflect your changes. */ struct __gf_rdma_segment { - uint32_t rs_handle; /* Registered memory handle */ - uint32_t rs_length; /* Length of the chunk in bytes */ - uint64_t rs_offset; /* Chunk virtual address or offset */ + uint32_t rs_handle; /* Registered memory handle */ + uint32_t rs_length; /* Length of the chunk in bytes */ + uint64_t rs_offset; /* Chunk virtual address or offset */ } __attribute__((packed)); typedef struct __gf_rdma_segment gf_rdma_segment_t; /* read chunk(s), encoded as a linked list. */ struct __gf_rdma_read_chunk { - uint32_t rc_discrim; /* 1 indicates presence */ - uint32_t rc_position; /* Position in XDR stream */ - gf_rdma_segment_t rc_target; + uint32_t rc_discrim; /* 1 indicates presence */ + uint32_t rc_position; /* Position in XDR stream */ + gf_rdma_segment_t rc_target; } __attribute__((packed)); typedef struct __gf_rdma_read_chunk gf_rdma_read_chunk_t; /* write chunk, and reply chunk. */ struct __gf_rdma_write_chunk { - gf_rdma_segment_t wc_target; + gf_rdma_segment_t wc_target; } __attribute__((packed)); typedef struct __gf_rdma_write_chunk gf_rdma_write_chunk_t; /* write chunk(s), encoded as a counted array. */ struct __gf_rdma_write_array { - uint32_t wc_discrim; /* 1 indicates presence */ - uint32_t wc_nchunks; /* Array count */ - struct __gf_rdma_write_chunk wc_array[0]; + uint32_t wc_discrim; /* 1 indicates presence */ + uint32_t wc_nchunks; /* Array count */ + struct __gf_rdma_write_chunk wc_array[0]; } __attribute__((packed)); typedef struct __gf_rdma_write_array gf_rdma_write_array_t; /* options per transport end point */ struct __gf_rdma_options { - int32_t port; - char *device_name; - enum ibv_mtu mtu; - int32_t send_count; - int32_t recv_count; - uint64_t recv_size; - uint64_t send_size; - uint8_t attr_timeout; - uint8_t attr_retry_cnt; - uint8_t attr_rnr_retry; - uint32_t backlog; + int32_t port; + char *device_name; + enum ibv_mtu mtu; + int32_t send_count; + int32_t recv_count; + uint64_t recv_size; + uint64_t send_size; + uint8_t attr_timeout; + uint8_t attr_retry_cnt; + uint8_t attr_rnr_retry; + uint32_t backlog; }; typedef struct __gf_rdma_options gf_rdma_options_t; struct __gf_rdma_reply_info { - uint32_t rm_xid; /* xid in network endian */ - gf_rdma_chunktype_t type; /* - * can be either gf_rdma_replych - * or gf_rdma_writech. - */ - gf_rdma_write_array_t *wc_array; - struct mem_pool *pool; + uint32_t rm_xid; /* xid in network endian */ + gf_rdma_chunktype_t type; /* + * can be either gf_rdma_replych + * or gf_rdma_writech. + */ + gf_rdma_write_array_t *wc_array; + struct mem_pool *pool; }; typedef struct __gf_rdma_reply_info gf_rdma_reply_info_t; struct __gf_rdma_ioq { - union { - struct list_head list; - struct { - struct __gf_rdma_ioq *next; - struct __gf_rdma_ioq *prev; - }; + union { + struct list_head list; + struct { + struct __gf_rdma_ioq *next; + struct __gf_rdma_ioq *prev; }; + }; + + char is_request; + struct iovec rpchdr[MAX_IOVEC]; + int rpchdr_count; + struct iovec proghdr[MAX_IOVEC]; + int proghdr_count; + struct iovec prog_payload[MAX_IOVEC]; + int prog_payload_count; + + struct iobref *iobref; + + union { + struct __gf_rdma_ioq_request { + /* used to build reply_chunk for GF_RDMA_NOMSG type msgs */ + struct iovec rsphdr_vec[MAX_IOVEC]; + int rsphdr_count; + + /* + * used to build write_array during operations like + * read. + */ + struct iovec rsp_payload[MAX_IOVEC]; + int rsp_payload_count; + + struct rpc_req *rpc_req; /* FIXME: hack! hack! should be + * cleaned up later + */ + struct iobref *rsp_iobref; + } request; + + gf_rdma_reply_info_t *reply_info; + } msg; - char is_request; - struct iovec rpchdr[MAX_IOVEC]; - int rpchdr_count; - struct iovec proghdr[MAX_IOVEC]; - int proghdr_count; - struct iovec prog_payload[MAX_IOVEC]; - int prog_payload_count; - - struct iobref *iobref; - - union { - struct __gf_rdma_ioq_request { - /* used to build reply_chunk for GF_RDMA_NOMSG type msgs */ - struct iovec rsphdr_vec[MAX_IOVEC]; - int rsphdr_count; - - /* - * used to build write_array during operations like - * read. - */ - struct iovec rsp_payload[MAX_IOVEC]; - int rsp_payload_count; - - struct rpc_req *rpc_req; /* FIXME: hack! hack! should be - * cleaned up later - */ - struct iobref *rsp_iobref; - }request; - - gf_rdma_reply_info_t *reply_info; - }msg; - - struct mem_pool *pool; + struct mem_pool *pool; }; typedef struct __gf_rdma_ioq gf_rdma_ioq_t; typedef enum __gf_rdma_send_post_type { - GF_RDMA_SEND_POST_NO_CHUNKLIST, /* post which is sent using rdma-send - * and the msg carries no - * chunklists. - */ - GF_RDMA_SEND_POST_READ_CHUNKLIST, /* post which is sent using rdma-send - * and the msg carries only read - * chunklist. - */ - GF_RDMA_SEND_POST_WRITE_CHUNKLIST, /* post which is sent using - * rdma-send and the msg carries - * only write chunklist. - */ - GF_RDMA_SEND_POST_READ_WRITE_CHUNKLIST, /* post which is sent using - * rdma-send and the msg - * carries both read and - * write chunklists. - */ - GF_RDMA_SEND_POST_GF_RDMA_READ, /* RDMA read */ - GF_RDMA_SEND_POST_GF_RDMA_WRITE, /* RDMA write */ -}gf_rdma_send_post_type_t; + GF_RDMA_SEND_POST_NO_CHUNKLIST, /* post which is sent using rdma-send + * and the msg carries no + * chunklists. + */ + GF_RDMA_SEND_POST_READ_CHUNKLIST, /* post which is sent using rdma-send + * and the msg carries only read + * chunklist. + */ + GF_RDMA_SEND_POST_WRITE_CHUNKLIST, /* post which is sent using + * rdma-send and the msg carries + * only write chunklist. + */ + GF_RDMA_SEND_POST_READ_WRITE_CHUNKLIST, /* post which is sent using + * rdma-send and the msg + * carries both read and + * write chunklists. + */ + GF_RDMA_SEND_POST_GF_RDMA_READ, /* RDMA read */ + GF_RDMA_SEND_POST_GF_RDMA_WRITE, /* RDMA write */ +} gf_rdma_send_post_type_t; /* represents one communication peer, two per transport_t */ struct __gf_rdma_peer { - rpc_transport_t *trans; - struct rdma_cm_id *cm_id; - struct ibv_qp *qp; - pthread_t rdma_event_thread; - char quota_set; - - int32_t recv_count; - int32_t send_count; - int32_t recv_size; - int32_t send_size; - - int32_t quota; - union { - struct list_head ioq; - struct { - gf_rdma_ioq_t *ioq_next; - gf_rdma_ioq_t *ioq_prev; - }; + rpc_transport_t *trans; + struct rdma_cm_id *cm_id; + struct ibv_qp *qp; + pthread_t rdma_event_thread; + char quota_set; + + int32_t recv_count; + int32_t send_count; + int32_t recv_size; + int32_t send_size; + + int32_t quota; + union { + struct list_head ioq; + struct { + gf_rdma_ioq_t *ioq_next; + gf_rdma_ioq_t *ioq_prev; }; - - /* QP attributes, needed to connect with remote QP */ - int32_t local_lid; - int32_t local_psn; - int32_t local_qpn; - int32_t remote_lid; - int32_t remote_psn; - int32_t remote_qpn; + }; + + /* QP attributes, needed to connect with remote QP */ + int32_t local_lid; + int32_t local_psn; + int32_t local_qpn; + int32_t remote_lid; + int32_t remote_psn; + int32_t remote_qpn; }; typedef struct __gf_rdma_peer gf_rdma_peer_t; struct __gf_rdma_post_context { - struct ibv_mr *mr[GF_RDMA_MAX_SEGMENTS]; - int mr_count; - struct iovec vector[MAX_IOVEC]; - int count; - struct iobref *iobref; - struct iobuf *hdr_iobuf; - char is_request; - int gf_rdma_reads; - gf_rdma_reply_info_t *reply_info; + struct ibv_mr *mr[GF_RDMA_MAX_SEGMENTS]; + int mr_count; + struct iovec vector[MAX_IOVEC]; + int count; + struct iobref *iobref; + struct iobuf *hdr_iobuf; + char is_request; + int gf_rdma_reads; + gf_rdma_reply_info_t *reply_info; }; typedef struct __gf_rdma_post_context gf_rdma_post_context_t; -typedef enum { - GF_RDMA_SEND_POST, - GF_RDMA_RECV_POST -} gf_rdma_post_type_t; +typedef enum { GF_RDMA_SEND_POST, GF_RDMA_RECV_POST } gf_rdma_post_type_t; struct __gf_rdma_post { - struct __gf_rdma_post *next, *prev; - struct ibv_mr *mr; - char *buf; - int32_t buf_size; - char aux; - int32_t reused; - struct __gf_rdma_device *device; - gf_rdma_post_type_t type; - gf_rdma_post_context_t ctx; - int refcount; - pthread_mutex_t lock; + struct __gf_rdma_post *next, *prev; + struct ibv_mr *mr; + char *buf; + int32_t buf_size; + char aux; + int32_t reused; + struct __gf_rdma_device *device; + gf_rdma_post_type_t type; + gf_rdma_post_context_t ctx; + int refcount; + pthread_mutex_t lock; }; typedef struct __gf_rdma_post gf_rdma_post_t; struct __gf_rdma_queue { - gf_rdma_post_t active_posts, passive_posts; - int32_t active_count, passive_count; - pthread_mutex_t lock; + gf_rdma_post_t active_posts, passive_posts; + int32_t active_count, passive_count; + pthread_mutex_t lock; }; typedef struct __gf_rdma_queue gf_rdma_queue_t; struct __gf_rdma_qpreg { - pthread_mutex_t lock; - int32_t count; - struct _qpent { - struct _qpent *next, *prev; - int32_t qp_num; - gf_rdma_peer_t *peer; - } ents[42]; + pthread_mutex_t lock; + int32_t count; + struct _qpent { + struct _qpent *next, *prev; + int32_t qp_num; + gf_rdma_peer_t *peer; + } ents[42]; }; typedef struct __gf_rdma_qpreg gf_rdma_qpreg_t; /* context per device, stored in global glusterfs_ctx_t->ib */ struct __gf_rdma_device { - struct __gf_rdma_device *next; - const char *device_name; - struct ibv_context *context; - int32_t port; - struct ibv_pd *pd; - struct ibv_srq *srq; - gf_rdma_qpreg_t qpreg; - struct ibv_comp_channel *send_chan, *recv_chan; - struct ibv_cq *send_cq, *recv_cq; - gf_rdma_queue_t sendq, recvq; - pthread_t send_thread, recv_thread, async_event_thread; - struct mem_pool *request_ctx_pool; - struct mem_pool *ioq_pool; - struct mem_pool *reply_info_pool; - struct list_head all_mr; - pthread_mutex_t all_mr_lock; + struct __gf_rdma_device *next; + const char *device_name; + struct ibv_context *context; + int32_t port; + struct ibv_pd *pd; + struct ibv_srq *srq; + gf_rdma_qpreg_t qpreg; + struct ibv_comp_channel *send_chan, *recv_chan; + struct ibv_cq *send_cq, *recv_cq; + gf_rdma_queue_t sendq, recvq; + pthread_t send_thread, recv_thread, async_event_thread; + struct mem_pool *request_ctx_pool; + struct mem_pool *ioq_pool; + struct mem_pool *reply_info_pool; + struct list_head all_mr; + pthread_mutex_t all_mr_lock; }; typedef struct __gf_rdma_device gf_rdma_device_t; - struct __gf_rdma_arena_mr { - struct list_head list; - struct iobuf_arena *iobuf_arena; - struct ibv_mr *mr; + struct list_head list; + struct iobuf_arena *iobuf_arena; + struct ibv_mr *mr; }; typedef struct __gf_rdma_arena_mr gf_rdma_arena_mr; struct __gf_rdma_ctx { - gf_rdma_device_t *device; - struct rdma_event_channel *rdma_cm_event_channel; - pthread_t rdma_cm_thread; - pthread_mutex_t lock; - int32_t dlcount; + gf_rdma_device_t *device; + struct rdma_event_channel *rdma_cm_event_channel; + pthread_t rdma_cm_thread; + pthread_mutex_t lock; + int32_t dlcount; }; typedef struct __gf_rdma_ctx gf_rdma_ctx_t; struct __gf_rdma_request_context { - struct ibv_mr *mr[GF_RDMA_MAX_SEGMENTS]; - int mr_count; - struct mem_pool *pool; - gf_rdma_peer_t *peer; - struct iobref *iobref; - struct iobref *rsp_iobref; + struct ibv_mr *mr[GF_RDMA_MAX_SEGMENTS]; + int mr_count; + struct mem_pool *pool; + gf_rdma_peer_t *peer; + struct iobref *iobref; + struct iobref *rsp_iobref; }; typedef struct __gf_rdma_request_context gf_rdma_request_context_t; typedef enum { - GF_RDMA_SERVER_LISTENER, - GF_RDMA_SERVER, - GF_RDMA_CLIENT, + GF_RDMA_SERVER_LISTENER, + GF_RDMA_SERVER, + GF_RDMA_CLIENT, } gf_rdma_transport_entity_t; struct __gf_rdma_private { - int32_t idx; - unsigned char connected; - in_addr_t addr; - unsigned short port; - - /* IB Verbs Driver specific variables, pointers */ - gf_rdma_peer_t peer; - struct __gf_rdma_device *device; - gf_rdma_options_t options; - - /* Used by trans->op->receive */ - char *data_ptr; - int32_t data_offset; - int32_t data_len; - - /* Mutex */ - pthread_mutex_t write_mutex; - rpc_transport_t *listener; - pthread_mutex_t recv_mutex; - pthread_cond_t recv_cond; - gf_rdma_transport_entity_t entity; - uint32_t backlog; + int32_t idx; + unsigned char connected; + in_addr_t addr; + unsigned short port; + + /* IB Verbs Driver specific variables, pointers */ + gf_rdma_peer_t peer; + struct __gf_rdma_device *device; + gf_rdma_options_t options; + + /* Used by trans->op->receive */ + char *data_ptr; + int32_t data_offset; + int32_t data_len; + + /* Mutex */ + pthread_mutex_t write_mutex; + rpc_transport_t *listener; + pthread_mutex_t recv_mutex; + pthread_cond_t recv_cond; + gf_rdma_transport_entity_t entity; + uint32_t backlog; }; -typedef struct __gf_rdma_private gf_rdma_private_t; +typedef struct __gf_rdma_private gf_rdma_private_t; #endif /* _XPORT_GF_RDMA_H */ diff --git a/rpc/rpc-transport/rdma/src/rpc-trans-rdma-messages.h b/rpc/rpc-transport/rdma/src/rpc-trans-rdma-messages.h index 97979970e73..6e9ea9a2925 100644 --- a/rpc/rpc-transport/rdma/src/rpc-trans-rdma-messages.h +++ b/rpc/rpc-transport/rdma/src/rpc-trans-rdma-messages.h @@ -23,85 +23,44 @@ * glfs-message-id.h. */ -GLFS_MSGID(RPC_TRANS_RDMA, - RDMA_MSG_PORT_BIND_FAILED, - RDMA_MSG_POST_CREATION_FAILED, - RDMA_MSG_DEREGISTER_ARENA_FAILED, - RDMA_MSG_MR_ALOC_FAILED, - RDMA_MSG_PREREG_BUFFER_FAILED, - RDMA_MSG_CQ_CREATION_FAILED, - RDMA_MSG_REQ_NOTIFY_CQ_REVQ_FAILED, - RDMA_MSG_QUERY_DEVICE_FAILED, - RDMA_MSG_REQ_NOTIFY_CQ_SENDQ_FAILED, - RDMA_MSG_SEND_COMP_CHAN_FAILED, - RDMA_MSG_RECV_COMP_CHAN_FAILED, - RDMA_MSG_ALOC_PROT_DOM_FAILED, - RDMA_MSG_CRE_SRQ_FAILED, - RDMA_MSG_ALOC_POST_FAILED, - RDMA_MSG_SEND_COMP_THREAD_FAILED, - RDMA_MSG_RECV_COMP_THREAD_FAILED, - RDMA_MSG_ASYNC_EVENT_THEAD_FAILED, - RDMA_MSG_GET_DEVICE_NAME_FAILED, - RDMA_MSG_GET_IB_DEVICE_FAILED, - RDMA_MSG_CREAT_INC_TRANS_FAILED, - RDMA_MSG_CREAT_QP_FAILED, - RDMA_MSG_ACCEPT_FAILED, - RDMA_MSG_CONNECT_FAILED, - RDMA_MSG_ROUTE_RESOLVE_FAILED, - RDMA_MSG_GET_DEVICE_FAILED, - RDMA_MSG_PEER_DISCONNECTED, - RDMA_MSG_ENCODE_ERROR, - RDMA_MSG_POST_SEND_FAILED, - RDMA_MSG_READ_CHUNK_VECTOR_FAILED, - RDMA_MSG_WRITE_CHUNK_VECTOR_FAILED, - RDMA_MSG_WRITE_REPLY_CHUNCK_CONFLICT, - RDMA_MSG_CHUNK_COUNT_GREAT_MAX_SEGMENTS, - RDMA_MSG_CREATE_READ_CHUNK_FAILED, - RDMA_MSG_CREATE_WRITE_REPLAY_FAILED, - RDMA_MSG_SEND_SIZE_GREAT_INLINE_THRESHOLD, - RDMA_MSG_REG_ACCESS_LOCAL_WRITE_FAILED, - RDMA_MSG_WRITE_PEER_FAILED, - RDMA_MSG_SEND_REPLY_FAILED, - RDMA_MSG_INVALID_CHUNK_TYPE, - RDMA_MSG_PROC_IOQ_ENTRY_FAILED, - RDMA_MSG_NEW_IOQ_ENTRY_FAILED, - RDMA_MSG_RPC_REPLY_CREATE_FAILED, - RDMA_MSG_GET_READ_CHUNK_FAILED, - RDMA_MSG_GET_WRITE_CHUNK_FAILED, - RDMA_MSG_REPLY_INFO_ALLOC_FAILED, - RDMA_MSG_RDMA_ERROR_RECEIVED, - RDMA_MSG_GET_REQ_INFO_RPC_FAILED, - RDMA_MSG_POLL_IN_NOTIFY_FAILED, - RDMA_MSG_HEADER_DECODE_FAILED, - RDMA_MSG_EVENT_SRQ_LIMIT_REACHED, - RDMA_MSG_UNRECG_MQ_VALUE, - RDMA_MSG_BUFFER_ERROR, - RDMA_MSG_OPTION_SET_FAILED, - RDMA_MSG_LISTEN_FAILED, - RDMA_MSG_INIT_IB_DEVICE_FAILED, - RDMA_MSG_WRITE_CLIENT_ERROR, - RDMA_MSG_CHUNKLIST_ERROR, - RDMA_MSG_INVALID_ENTRY, - RDMA_MSG_READ_CLIENT_ERROR, - RDMA_MSG_RPC_ST_ERROR, - RDMA_MSG_PEER_READ_FAILED, - RDMA_MSG_POST_MISSING, - RDMA_MSG_PEER_REQ_FAILED, - RDMA_MSG_PEER_REP_FAILED, - RDMA_MSG_EVENT_ERROR, - RDMA_MSG_IBV_GET_CQ_FAILED, - RDMA_MSG_IBV_REQ_NOTIFY_CQ_FAILED, - RDMA_MSG_RECV_ERROR, - RDMA_MSG_IBV_POLL_CQ_ERROR, - RDMA_MSG_RDMA_HANDLE_FAILED, - RDMA_MSG_CM_EVENT_FAILED, - RDMA_MSG_CLIENT_BIND_FAILED, - RDMA_MSG_RDMA_RESOLVE_ADDR_FAILED, - RDMA_MSG_NW_ADDR_UNKNOWN, - RDMA_MSG_RDMA_BIND_ADDR_FAILED, - RDMA_MSG_SEND_CLIENT_ERROR, - RDMA_MSG_UNRECG_MTU_VALUE -); +GLFS_MSGID( + RPC_TRANS_RDMA, RDMA_MSG_PORT_BIND_FAILED, RDMA_MSG_POST_CREATION_FAILED, + RDMA_MSG_DEREGISTER_ARENA_FAILED, RDMA_MSG_MR_ALOC_FAILED, + RDMA_MSG_PREREG_BUFFER_FAILED, RDMA_MSG_CQ_CREATION_FAILED, + RDMA_MSG_REQ_NOTIFY_CQ_REVQ_FAILED, RDMA_MSG_QUERY_DEVICE_FAILED, + RDMA_MSG_REQ_NOTIFY_CQ_SENDQ_FAILED, RDMA_MSG_SEND_COMP_CHAN_FAILED, + RDMA_MSG_RECV_COMP_CHAN_FAILED, RDMA_MSG_ALOC_PROT_DOM_FAILED, + RDMA_MSG_CRE_SRQ_FAILED, RDMA_MSG_ALOC_POST_FAILED, + RDMA_MSG_SEND_COMP_THREAD_FAILED, RDMA_MSG_RECV_COMP_THREAD_FAILED, + RDMA_MSG_ASYNC_EVENT_THEAD_FAILED, RDMA_MSG_GET_DEVICE_NAME_FAILED, + RDMA_MSG_GET_IB_DEVICE_FAILED, RDMA_MSG_CREAT_INC_TRANS_FAILED, + RDMA_MSG_CREAT_QP_FAILED, RDMA_MSG_ACCEPT_FAILED, RDMA_MSG_CONNECT_FAILED, + RDMA_MSG_ROUTE_RESOLVE_FAILED, RDMA_MSG_GET_DEVICE_FAILED, + RDMA_MSG_PEER_DISCONNECTED, RDMA_MSG_ENCODE_ERROR, + RDMA_MSG_POST_SEND_FAILED, RDMA_MSG_READ_CHUNK_VECTOR_FAILED, + RDMA_MSG_WRITE_CHUNK_VECTOR_FAILED, RDMA_MSG_WRITE_REPLY_CHUNCK_CONFLICT, + RDMA_MSG_CHUNK_COUNT_GREAT_MAX_SEGMENTS, RDMA_MSG_CREATE_READ_CHUNK_FAILED, + RDMA_MSG_CREATE_WRITE_REPLAY_FAILED, + RDMA_MSG_SEND_SIZE_GREAT_INLINE_THRESHOLD, + RDMA_MSG_REG_ACCESS_LOCAL_WRITE_FAILED, RDMA_MSG_WRITE_PEER_FAILED, + RDMA_MSG_SEND_REPLY_FAILED, RDMA_MSG_INVALID_CHUNK_TYPE, + RDMA_MSG_PROC_IOQ_ENTRY_FAILED, RDMA_MSG_NEW_IOQ_ENTRY_FAILED, + RDMA_MSG_RPC_REPLY_CREATE_FAILED, RDMA_MSG_GET_READ_CHUNK_FAILED, + RDMA_MSG_GET_WRITE_CHUNK_FAILED, RDMA_MSG_REPLY_INFO_ALLOC_FAILED, + RDMA_MSG_RDMA_ERROR_RECEIVED, RDMA_MSG_GET_REQ_INFO_RPC_FAILED, + RDMA_MSG_POLL_IN_NOTIFY_FAILED, RDMA_MSG_HEADER_DECODE_FAILED, + RDMA_MSG_EVENT_SRQ_LIMIT_REACHED, RDMA_MSG_UNRECG_MQ_VALUE, + RDMA_MSG_BUFFER_ERROR, RDMA_MSG_OPTION_SET_FAILED, RDMA_MSG_LISTEN_FAILED, + RDMA_MSG_INIT_IB_DEVICE_FAILED, RDMA_MSG_WRITE_CLIENT_ERROR, + RDMA_MSG_CHUNKLIST_ERROR, RDMA_MSG_INVALID_ENTRY, + RDMA_MSG_READ_CLIENT_ERROR, RDMA_MSG_RPC_ST_ERROR, + RDMA_MSG_PEER_READ_FAILED, RDMA_MSG_POST_MISSING, RDMA_MSG_PEER_REQ_FAILED, + RDMA_MSG_PEER_REP_FAILED, RDMA_MSG_EVENT_ERROR, RDMA_MSG_IBV_GET_CQ_FAILED, + RDMA_MSG_IBV_REQ_NOTIFY_CQ_FAILED, RDMA_MSG_RECV_ERROR, + RDMA_MSG_IBV_POLL_CQ_ERROR, RDMA_MSG_RDMA_HANDLE_FAILED, + RDMA_MSG_CM_EVENT_FAILED, RDMA_MSG_CLIENT_BIND_FAILED, + RDMA_MSG_RDMA_RESOLVE_ADDR_FAILED, RDMA_MSG_NW_ADDR_UNKNOWN, + RDMA_MSG_RDMA_BIND_ADDR_FAILED, RDMA_MSG_SEND_CLIENT_ERROR, + RDMA_MSG_UNRECG_MTU_VALUE); #endif /* !_RPC_TRANS_RDMA_MESSAGES_H_ */ - diff --git a/rpc/rpc-transport/socket/src/name.h b/rpc/rpc-transport/socket/src/name.h index 0a13d8a9624..85f8bb7040b 100644 --- a/rpc/rpc-transport/socket/src/name.h +++ b/rpc/rpc-transport/socket/src/name.h @@ -14,22 +14,20 @@ #include "compat.h" int32_t -client_bind (rpc_transport_t *this, - struct sockaddr *sockaddr, - socklen_t *sockaddr_len, - int sock); +client_bind(rpc_transport_t *this, struct sockaddr *sockaddr, + socklen_t *sockaddr_len, int sock); int32_t -socket_client_get_remote_sockaddr (rpc_transport_t *this, - struct sockaddr *sockaddr, - socklen_t *sockaddr_len, - sa_family_t *sa_family); +socket_client_get_remote_sockaddr(rpc_transport_t *this, + struct sockaddr *sockaddr, + socklen_t *sockaddr_len, + sa_family_t *sa_family); int32_t -socket_server_get_local_sockaddr (rpc_transport_t *this, struct sockaddr *addr, - socklen_t *addr_len, sa_family_t *sa_family); +socket_server_get_local_sockaddr(rpc_transport_t *this, struct sockaddr *addr, + socklen_t *addr_len, sa_family_t *sa_family); int32_t -get_transport_identifiers (rpc_transport_t *this); +get_transport_identifiers(rpc_transport_t *this); #endif /* _SOCKET_NAME_H */ diff --git a/rpc/rpc-transport/socket/src/socket-mem-types.h b/rpc/rpc-transport/socket/src/socket-mem-types.h index d1860e6c9a9..81635b72320 100644 --- a/rpc/rpc-transport/socket/src/socket-mem-types.h +++ b/rpc/rpc-transport/socket/src/socket-mem-types.h @@ -14,10 +14,10 @@ #include "mem-types.h" typedef enum gf_sock_mem_types_ { - gf_sock_connect_error_state_t = gf_common_mt_end + 1, - gf_sock_mt_lock_array, - gf_sock_mt_tid_wrap, - gf_sock_mt_end + gf_sock_connect_error_state_t = gf_common_mt_end + 1, + gf_sock_mt_lock_array, + gf_sock_mt_tid_wrap, + gf_sock_mt_end } gf_sock_mem_types_t; #endif diff --git a/rpc/rpc-transport/socket/src/socket.h b/rpc/rpc-transport/socket/src/socket.h index 4e65489f987..27db0ed427b 100644 --- a/rpc/rpc-transport/socket/src/socket.h +++ b/rpc/rpc-transport/socket/src/socket.h @@ -33,7 +33,7 @@ #define MAX_IOVEC 16 #endif /* MAX_IOVEC */ -#define GF_DEFAULT_SOCKET_LISTEN_PORT GF_DEFAULT_BASE_PORT +#define GF_DEFAULT_SOCKET_LISTEN_PORT GF_DEFAULT_BASE_PORT #define RPC_MAX_FRAGMENT_SIZE 0x7fffffff @@ -45,247 +45,246 @@ * setsockopt will fail. Having larger values might be beneficial for * IB links. */ -#define GF_DEFAULT_SOCKET_WINDOW_SIZE (0) -#define GF_MAX_SOCKET_WINDOW_SIZE (1 * GF_UNIT_MB) -#define GF_MIN_SOCKET_WINDOW_SIZE (0) -#define GF_USE_DEFAULT_KEEPALIVE (-1) +#define GF_DEFAULT_SOCKET_WINDOW_SIZE (0) +#define GF_MAX_SOCKET_WINDOW_SIZE (1 * GF_UNIT_MB) +#define GF_MIN_SOCKET_WINDOW_SIZE (0) +#define GF_USE_DEFAULT_KEEPALIVE (-1) -#define GF_KEEPALIVE_TIME (20) -#define GF_KEEPALIVE_INTERVAL (2) -#define GF_KEEPALIVE_COUNT (9) +#define GF_KEEPALIVE_TIME (20) +#define GF_KEEPALIVE_INTERVAL (2) +#define GF_KEEPALIVE_COUNT (9) typedef enum { - SP_STATE_NADA = 0, - SP_STATE_COMPLETE, - SP_STATE_READING_FRAGHDR, - SP_STATE_READ_FRAGHDR, - SP_STATE_READING_FRAG, + SP_STATE_NADA = 0, + SP_STATE_COMPLETE, + SP_STATE_READING_FRAGHDR, + SP_STATE_READ_FRAGHDR, + SP_STATE_READING_FRAG, } sp_rpcrecord_state_t; typedef enum { - SP_STATE_RPCFRAG_INIT, - SP_STATE_READING_MSGTYPE, - SP_STATE_READ_MSGTYPE, - SP_STATE_NOTIFYING_XID + SP_STATE_RPCFRAG_INIT, + SP_STATE_READING_MSGTYPE, + SP_STATE_READ_MSGTYPE, + SP_STATE_NOTIFYING_XID } sp_rpcfrag_state_t; typedef enum { - SP_STATE_SIMPLE_MSG_INIT, - SP_STATE_READING_SIMPLE_MSG, + SP_STATE_SIMPLE_MSG_INIT, + SP_STATE_READING_SIMPLE_MSG, } sp_rpcfrag_simple_msg_state_t; typedef enum { - SP_STATE_VECTORED_REQUEST_INIT, - SP_STATE_READING_CREDBYTES, - SP_STATE_READ_CREDBYTES, /* read credential data. */ - SP_STATE_READING_VERFBYTES, - SP_STATE_READ_VERFBYTES, /* read verifier data */ - SP_STATE_READING_PROGHDR, - SP_STATE_READ_PROGHDR, - SP_STATE_READING_PROGHDR_XDATA, - SP_STATE_READ_PROGHDR_XDATA, /* It's a bad "name" in the generic - RPC state machine, but greatly - aids code review (and xdata is - the only "consumer" of this state) - */ - SP_STATE_READING_PROG, + SP_STATE_VECTORED_REQUEST_INIT, + SP_STATE_READING_CREDBYTES, + SP_STATE_READ_CREDBYTES, /* read credential data. */ + SP_STATE_READING_VERFBYTES, + SP_STATE_READ_VERFBYTES, /* read verifier data */ + SP_STATE_READING_PROGHDR, + SP_STATE_READ_PROGHDR, + SP_STATE_READING_PROGHDR_XDATA, + SP_STATE_READ_PROGHDR_XDATA, /* It's a bad "name" in the generic + RPC state machine, but greatly + aids code review (and xdata is + the only "consumer" of this state) + */ + SP_STATE_READING_PROG, } sp_rpcfrag_vectored_request_state_t; typedef enum { - SP_STATE_REQUEST_HEADER_INIT, - SP_STATE_READING_RPCHDR1, - SP_STATE_READ_RPCHDR1, /* read msg from beginning till and - * including credlen - */ + SP_STATE_REQUEST_HEADER_INIT, + SP_STATE_READING_RPCHDR1, + SP_STATE_READ_RPCHDR1, /* read msg from beginning till and + * including credlen + */ } sp_rpcfrag_request_header_state_t; struct ioq { - union { - struct list_head list; - struct { - struct ioq *next; - struct ioq *prev; - }; + union { + struct list_head list; + struct { + struct ioq *next; + struct ioq *prev; }; - - uint32_t fraghdr; - struct iovec vector[MAX_IOVEC]; - int count; - struct iovec *pending_vector; - int pending_count; - struct iobref *iobref; + }; + + uint32_t fraghdr; + struct iovec vector[MAX_IOVEC]; + int count; + struct iovec *pending_vector; + int pending_count; + struct iobref *iobref; }; typedef struct { - sp_rpcfrag_request_header_state_t header_state; - sp_rpcfrag_vectored_request_state_t vector_state; - int vector_sizer_state; + sp_rpcfrag_request_header_state_t header_state; + sp_rpcfrag_vectored_request_state_t vector_state; + int vector_sizer_state; } sp_rpcfrag_request_state_t; typedef enum { - SP_STATE_VECTORED_REPLY_STATUS_INIT, - SP_STATE_READING_REPLY_STATUS, - SP_STATE_READ_REPLY_STATUS, + SP_STATE_VECTORED_REPLY_STATUS_INIT, + SP_STATE_READING_REPLY_STATUS, + SP_STATE_READ_REPLY_STATUS, } sp_rpcfrag_vectored_reply_status_state_t; typedef enum { - SP_STATE_ACCEPTED_SUCCESS_REPLY_INIT, - SP_STATE_READING_PROC_HEADER, - SP_STATE_READING_PROC_OPAQUE, - SP_STATE_READ_PROC_OPAQUE, - SP_STATE_READ_PROC_HEADER, + SP_STATE_ACCEPTED_SUCCESS_REPLY_INIT, + SP_STATE_READING_PROC_HEADER, + SP_STATE_READING_PROC_OPAQUE, + SP_STATE_READ_PROC_OPAQUE, + SP_STATE_READ_PROC_HEADER, } sp_rpcfrag_vectored_reply_accepted_success_state_t; typedef enum { - SP_STATE_ACCEPTED_REPLY_INIT, - SP_STATE_READING_REPLY_VERFLEN, - SP_STATE_READ_REPLY_VERFLEN, - SP_STATE_READING_REPLY_VERFBYTES, - SP_STATE_READ_REPLY_VERFBYTES, + SP_STATE_ACCEPTED_REPLY_INIT, + SP_STATE_READING_REPLY_VERFLEN, + SP_STATE_READ_REPLY_VERFLEN, + SP_STATE_READING_REPLY_VERFBYTES, + SP_STATE_READ_REPLY_VERFBYTES, } sp_rpcfrag_vectored_reply_accepted_state_t; typedef struct { - uint32_t accept_status; - sp_rpcfrag_vectored_reply_status_state_t status_state; - sp_rpcfrag_vectored_reply_accepted_state_t accepted_state; - sp_rpcfrag_vectored_reply_accepted_success_state_t accepted_success_state; + uint32_t accept_status; + sp_rpcfrag_vectored_reply_status_state_t status_state; + sp_rpcfrag_vectored_reply_accepted_state_t accepted_state; + sp_rpcfrag_vectored_reply_accepted_success_state_t accepted_success_state; } sp_rpcfrag_vectored_reply_state_t; struct gf_sock_incoming_frag { - char *fragcurrent; - uint32_t bytes_read; - uint32_t remaining_size; - struct iovec vector; - struct iovec *pending_vector; - union { - sp_rpcfrag_request_state_t request; - sp_rpcfrag_vectored_reply_state_t reply; - } call_body; - - sp_rpcfrag_simple_msg_state_t simple_state; - sp_rpcfrag_state_t state; + char *fragcurrent; + uint32_t bytes_read; + uint32_t remaining_size; + struct iovec vector; + struct iovec *pending_vector; + union { + sp_rpcfrag_request_state_t request; + sp_rpcfrag_vectored_reply_state_t reply; + } call_body; + + sp_rpcfrag_simple_msg_state_t simple_state; + sp_rpcfrag_state_t state; }; #define GF_SOCKET_RA_MAX 1024 struct gf_sock_incoming { - sp_rpcrecord_state_t record_state; - struct gf_sock_incoming_frag frag; - char *proghdr_base_addr; - struct iobuf *iobuf; - size_t iobuf_size; - struct iovec vector[2]; - int count; - struct iovec payload_vector; - struct iobref *iobref; - rpc_request_info_t *request_info; - struct iovec *pending_vector; - int pending_count; - uint32_t fraghdr; - char complete_record; - msg_type_t msg_type; - size_t total_bytes_read; - - size_t ra_read; - size_t ra_max; - size_t ra_served; - char *ra_buf; + sp_rpcrecord_state_t record_state; + struct gf_sock_incoming_frag frag; + char *proghdr_base_addr; + struct iobuf *iobuf; + size_t iobuf_size; + struct iovec vector[2]; + int count; + struct iovec payload_vector; + struct iobref *iobref; + rpc_request_info_t *request_info; + struct iovec *pending_vector; + int pending_count; + uint32_t fraghdr; + char complete_record; + msg_type_t msg_type; + size_t total_bytes_read; + + size_t ra_read; + size_t ra_max; + size_t ra_served; + char *ra_buf; }; typedef enum { - OT_IDLE, /* Uninitialized or termination complete. */ - OT_SPAWNING, /* Past pthread_create but not in thread yet. */ - OT_RUNNING, /* Poller thread running normally. */ - OT_CALLBACK, /* Poller thread in the middle of a callback. */ - OT_PLEASE_DIE, /* Poller termination requested. */ + OT_IDLE, /* Uninitialized or termination complete. */ + OT_SPAWNING, /* Past pthread_create but not in thread yet. */ + OT_RUNNING, /* Poller thread running normally. */ + OT_CALLBACK, /* Poller thread in the middle of a callback. */ + OT_PLEASE_DIE, /* Poller termination requested. */ } ot_state_t; typedef struct { - int32_t sock; - int32_t idx; - int32_t gen; - /* -1 = not connected. 0 = in progress. 1 = connected */ - char connected; - /* 1 = connect failed for reasons other than EINPROGRESS/ENOENT - see socket_connect for details */ - char connect_failed; - char bio; - char connect_finish_log; - char submit_log; - union { - struct list_head ioq; - struct { - struct ioq *ioq_next; - struct ioq *ioq_prev; - }; - }; - struct gf_sock_incoming incoming; - pthread_mutex_t in_lock; - pthread_mutex_t out_lock; - pthread_mutex_t cond_lock; - pthread_cond_t cond; - int windowsize; - char lowlat; - char nodelay; - int keepalive; - int keepaliveidle; - int keepaliveintvl; - int keepalivecnt; - int timeout; - uint32_t backlog; - gf_boolean_t read_fail_log; - gf_boolean_t ssl_enabled; /* outbound I/O */ - gf_boolean_t mgmt_ssl; /* outbound mgmt */ - mgmt_ssl_t srvr_ssl; - gf_boolean_t use_ssl; - SSL_METHOD *ssl_meth; - SSL_CTX *ssl_ctx; - int ssl_session_id; - BIO *ssl_sbio; - SSL *ssl_ssl; - char *ssl_own_cert; - char *ssl_private_key; - char *ssl_ca_list; - pthread_t thread; - int pipe[2]; - gf_boolean_t is_server; - int log_ctr; - gf_boolean_t ssl_accepted; /* To indicate SSL_accept() */ - gf_boolean_t ssl_connected;/* or SSL_connect() has been - * been completed on this socket. - * These are valid only when - * use_ssl is true. - */ - /* SSL_CTX is created for each transport. Since we are now using non- - * blocking mechanism for SSL_accept() and SSL_connect(), the SSL - * context is created on the first EPOLLIN event which may lead to - * SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE and may not complete the - * SSL connection at the first attempt. - * ssl_context_created is a flag to note that we've created the SSL - * context for the connection so that we don't blindly create any more - * while !ssl_accepted or !ssl_connected. - */ - gf_boolean_t ssl_context_created; - gf_boolean_t accepted; /* explicit flag to be set in - * socket_event_handler() for - * newly accepted socket - */ - - /* ssl_error_required is used only during the SSL connection setup - * phase. - * It holds the error code returned by SSL_get_error() and is used to - * arm the epoll event set for the required event for the specific fd. - */ - int ssl_error_required; - - GF_REF_DECL; /* refcount to keep track of socket_poller - threads */ + int32_t sock; + int32_t idx; + int32_t gen; + /* -1 = not connected. 0 = in progress. 1 = connected */ + char connected; + /* 1 = connect failed for reasons other than EINPROGRESS/ENOENT + see socket_connect for details */ + char connect_failed; + char bio; + char connect_finish_log; + char submit_log; + union { + struct list_head ioq; struct { - pthread_mutex_t lock; - pthread_cond_t cond; - uint64_t in_progress; - } notify; + struct ioq *ioq_next; + struct ioq *ioq_prev; + }; + }; + struct gf_sock_incoming incoming; + pthread_mutex_t in_lock; + pthread_mutex_t out_lock; + pthread_mutex_t cond_lock; + pthread_cond_t cond; + int windowsize; + char lowlat; + char nodelay; + int keepalive; + int keepaliveidle; + int keepaliveintvl; + int keepalivecnt; + int timeout; + uint32_t backlog; + gf_boolean_t read_fail_log; + gf_boolean_t ssl_enabled; /* outbound I/O */ + gf_boolean_t mgmt_ssl; /* outbound mgmt */ + mgmt_ssl_t srvr_ssl; + gf_boolean_t use_ssl; + SSL_METHOD *ssl_meth; + SSL_CTX *ssl_ctx; + int ssl_session_id; + BIO *ssl_sbio; + SSL *ssl_ssl; + char *ssl_own_cert; + char *ssl_private_key; + char *ssl_ca_list; + pthread_t thread; + int pipe[2]; + gf_boolean_t is_server; + int log_ctr; + gf_boolean_t ssl_accepted; /* To indicate SSL_accept() */ + gf_boolean_t ssl_connected; /* or SSL_connect() has been + * been completed on this socket. + * These are valid only when + * use_ssl is true. + */ + /* SSL_CTX is created for each transport. Since we are now using non- + * blocking mechanism for SSL_accept() and SSL_connect(), the SSL + * context is created on the first EPOLLIN event which may lead to + * SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE and may not complete the + * SSL connection at the first attempt. + * ssl_context_created is a flag to note that we've created the SSL + * context for the connection so that we don't blindly create any more + * while !ssl_accepted or !ssl_connected. + */ + gf_boolean_t ssl_context_created; + gf_boolean_t accepted; /* explicit flag to be set in + * socket_event_handler() for + * newly accepted socket + */ + + /* ssl_error_required is used only during the SSL connection setup + * phase. + * It holds the error code returned by SSL_get_error() and is used to + * arm the epoll event set for the required event for the specific fd. + */ + int ssl_error_required; + + GF_REF_DECL; /* refcount to keep track of socket_poller + threads */ + struct { + pthread_mutex_t lock; + pthread_cond_t cond; + uint64_t in_progress; + } notify; } socket_private_t; - #endif diff --git a/rpc/xdr/src/glusterfs3.h b/rpc/xdr/src/glusterfs3.h index 4ffad3c5b45..b8ef394abaf 100644 --- a/rpc/xdr/src/glusterfs3.h +++ b/rpc/xdr/src/glusterfs3.h @@ -20,867 +20,877 @@ #include "protocol-common.h" #include "upcall-utils.h" -#define xdr_decoded_remaining_addr(xdr) ((&xdr)->x_private) -#define xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy) -#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 GF_O_ACCMODE 003 -#define GF_O_RDONLY 00 -#define GF_O_WRONLY 01 -#define GF_O_RDWR 02 -#define GF_O_CREAT 0100 -#define GF_O_EXCL 0200 -#define GF_O_NOCTTY 0400 -#define GF_O_TRUNC 01000 -#define GF_O_APPEND 02000 -#define GF_O_NONBLOCK 04000 -#define GF_O_SYNC 010000 -#define GF_O_ASYNC 020000 - -#define GF_O_DIRECT 040000 -#define GF_O_DIRECTORY 0200000 -#define GF_O_NOFOLLOW 0400000 -#define GF_O_NOATIME 01000000 -#define GF_O_CLOEXEC 02000000 - -#define GF_O_LARGEFILE 0100000 - -#define GF_O_FMODE_EXEC 040 - -#define XLATE_BIT(from, to, bit) do { \ - if (from & bit) \ - to = to | GF_##bit; \ - } while (0) - -#define UNXLATE_BIT(from, to, bit) do { \ - if (from & GF_##bit) \ - to = to | bit; \ - } while (0) - -#define XLATE_ACCESSMODE(from, to) do { \ - switch (from & O_ACCMODE) { \ - case O_RDONLY: to |= GF_O_RDONLY; \ - break; \ - case O_WRONLY: to |= GF_O_WRONLY; \ - break; \ - case O_RDWR: to |= GF_O_RDWR; \ - break; \ - } \ - } while (0) - -#define UNXLATE_ACCESSMODE(from, to) do { \ - switch (from & GF_O_ACCMODE) { \ - case GF_O_RDONLY: to |= O_RDONLY; \ - break; \ - case GF_O_WRONLY: to |= O_WRONLY; \ - break; \ - case GF_O_RDWR: to |= O_RDWR; \ - break; \ - } \ - } while (0) +#define xdr_decoded_remaining_addr(xdr) ((&xdr)->x_private) +#define xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy) +#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 GF_O_ACCMODE 003 +#define GF_O_RDONLY 00 +#define GF_O_WRONLY 01 +#define GF_O_RDWR 02 +#define GF_O_CREAT 0100 +#define GF_O_EXCL 0200 +#define GF_O_NOCTTY 0400 +#define GF_O_TRUNC 01000 +#define GF_O_APPEND 02000 +#define GF_O_NONBLOCK 04000 +#define GF_O_SYNC 010000 +#define GF_O_ASYNC 020000 + +#define GF_O_DIRECT 040000 +#define GF_O_DIRECTORY 0200000 +#define GF_O_NOFOLLOW 0400000 +#define GF_O_NOATIME 01000000 +#define GF_O_CLOEXEC 02000000 + +#define GF_O_LARGEFILE 0100000 + +#define GF_O_FMODE_EXEC 040 + +#define XLATE_BIT(from, to, bit) \ + do { \ + if (from & bit) \ + to = to | GF_##bit; \ + } while (0) + +#define UNXLATE_BIT(from, to, bit) \ + do { \ + if (from & GF_##bit) \ + to = to | bit; \ + } while (0) + +#define XLATE_ACCESSMODE(from, to) \ + do { \ + switch (from & O_ACCMODE) { \ + case O_RDONLY: \ + to |= GF_O_RDONLY; \ + break; \ + case O_WRONLY: \ + to |= GF_O_WRONLY; \ + break; \ + case O_RDWR: \ + to |= GF_O_RDWR; \ + break; \ + } \ + } while (0) + +#define UNXLATE_ACCESSMODE(from, to) \ + do { \ + switch (from & GF_O_ACCMODE) { \ + case GF_O_RDONLY: \ + to |= O_RDONLY; \ + break; \ + case GF_O_WRONLY: \ + to |= O_WRONLY; \ + break; \ + case GF_O_RDWR: \ + to |= O_RDWR; \ + break; \ + } \ + } while (0) static inline uint32_t -gf_flags_from_flags (uint32_t flags) +gf_flags_from_flags(uint32_t flags) { - uint32_t gf_flags = 0; - - XLATE_ACCESSMODE (flags, gf_flags); - - XLATE_BIT (flags, gf_flags, O_CREAT); - XLATE_BIT (flags, gf_flags, O_EXCL); - XLATE_BIT (flags, gf_flags, O_NOCTTY); - XLATE_BIT (flags, gf_flags, O_TRUNC); - XLATE_BIT (flags, gf_flags, O_APPEND); - XLATE_BIT (flags, gf_flags, O_NONBLOCK); - XLATE_BIT (flags, gf_flags, O_SYNC); - XLATE_BIT (flags, gf_flags, O_ASYNC); - - XLATE_BIT (flags, gf_flags, O_DIRECT); - XLATE_BIT (flags, gf_flags, O_DIRECTORY); - XLATE_BIT (flags, gf_flags, O_NOFOLLOW); + uint32_t gf_flags = 0; + + XLATE_ACCESSMODE(flags, gf_flags); + + XLATE_BIT(flags, gf_flags, O_CREAT); + XLATE_BIT(flags, gf_flags, O_EXCL); + XLATE_BIT(flags, gf_flags, O_NOCTTY); + XLATE_BIT(flags, gf_flags, O_TRUNC); + XLATE_BIT(flags, gf_flags, O_APPEND); + XLATE_BIT(flags, gf_flags, O_NONBLOCK); + XLATE_BIT(flags, gf_flags, O_SYNC); + XLATE_BIT(flags, gf_flags, O_ASYNC); + + XLATE_BIT(flags, gf_flags, O_DIRECT); + XLATE_BIT(flags, gf_flags, O_DIRECTORY); + XLATE_BIT(flags, gf_flags, O_NOFOLLOW); #ifdef O_NOATIME - XLATE_BIT (flags, gf_flags, O_NOATIME); + XLATE_BIT(flags, gf_flags, O_NOATIME); #endif #ifdef O_CLOEXEC - XLATE_BIT (flags, gf_flags, O_CLOEXEC); + XLATE_BIT(flags, gf_flags, O_CLOEXEC); #endif - XLATE_BIT (flags, gf_flags, O_LARGEFILE); - XLATE_BIT (flags, gf_flags, O_FMODE_EXEC); + XLATE_BIT(flags, gf_flags, O_LARGEFILE); + XLATE_BIT(flags, gf_flags, O_FMODE_EXEC); - return gf_flags; + return gf_flags; } static inline uint32_t -gf_flags_to_flags (uint32_t gf_flags) +gf_flags_to_flags(uint32_t gf_flags) { - uint32_t flags = 0; - - UNXLATE_ACCESSMODE (gf_flags, flags); - - UNXLATE_BIT (gf_flags, flags, O_CREAT); - UNXLATE_BIT (gf_flags, flags, O_EXCL); - UNXLATE_BIT (gf_flags, flags, O_NOCTTY); - UNXLATE_BIT (gf_flags, flags, O_TRUNC); - UNXLATE_BIT (gf_flags, flags, O_APPEND); - UNXLATE_BIT (gf_flags, flags, O_NONBLOCK); - UNXLATE_BIT (gf_flags, flags, O_SYNC); - UNXLATE_BIT (gf_flags, flags, O_ASYNC); - - UNXLATE_BIT (gf_flags, flags, O_DIRECT); - UNXLATE_BIT (gf_flags, flags, O_DIRECTORY); - UNXLATE_BIT (gf_flags, flags, O_NOFOLLOW); + uint32_t flags = 0; + + UNXLATE_ACCESSMODE(gf_flags, flags); + + UNXLATE_BIT(gf_flags, flags, O_CREAT); + UNXLATE_BIT(gf_flags, flags, O_EXCL); + UNXLATE_BIT(gf_flags, flags, O_NOCTTY); + UNXLATE_BIT(gf_flags, flags, O_TRUNC); + UNXLATE_BIT(gf_flags, flags, O_APPEND); + UNXLATE_BIT(gf_flags, flags, O_NONBLOCK); + UNXLATE_BIT(gf_flags, flags, O_SYNC); + UNXLATE_BIT(gf_flags, flags, O_ASYNC); + + UNXLATE_BIT(gf_flags, flags, O_DIRECT); + UNXLATE_BIT(gf_flags, flags, O_DIRECTORY); + UNXLATE_BIT(gf_flags, flags, O_NOFOLLOW); #ifdef O_NOATIME - UNXLATE_BIT (gf_flags, flags, O_NOATIME); + UNXLATE_BIT(gf_flags, flags, O_NOATIME); #endif #ifdef O_CLOEXEC - UNXLATE_BIT (gf_flags, flags, O_CLOEXEC); + UNXLATE_BIT(gf_flags, flags, O_CLOEXEC); #endif - UNXLATE_BIT (gf_flags, flags, O_LARGEFILE); - UNXLATE_BIT (gf_flags, flags, O_FMODE_EXEC); + UNXLATE_BIT(gf_flags, flags, O_LARGEFILE); + UNXLATE_BIT(gf_flags, flags, O_FMODE_EXEC); - return flags; + return flags; } - static inline void -gf_statfs_to_statfs (struct gf_statfs *gf_stat, struct statvfs *stat) +gf_statfs_to_statfs(struct gf_statfs *gf_stat, struct statvfs *stat) { - if (!stat || !gf_stat) - return; - - stat->f_bsize = (gf_stat->bsize); - stat->f_frsize = (gf_stat->frsize); - stat->f_blocks = (gf_stat->blocks); - stat->f_bfree = (gf_stat->bfree); - stat->f_bavail = (gf_stat->bavail); - stat->f_files = (gf_stat->files); - stat->f_ffree = (gf_stat->ffree); - stat->f_favail = (gf_stat->favail); - stat->f_fsid = (gf_stat->fsid); - stat->f_flag = (gf_stat->flag); - stat->f_namemax = (gf_stat->namemax); + if (!stat || !gf_stat) + return; + + stat->f_bsize = (gf_stat->bsize); + stat->f_frsize = (gf_stat->frsize); + stat->f_blocks = (gf_stat->blocks); + stat->f_bfree = (gf_stat->bfree); + stat->f_bavail = (gf_stat->bavail); + stat->f_files = (gf_stat->files); + stat->f_ffree = (gf_stat->ffree); + stat->f_favail = (gf_stat->favail); + stat->f_fsid = (gf_stat->fsid); + stat->f_flag = (gf_stat->flag); + stat->f_namemax = (gf_stat->namemax); } - static inline void -gf_statfs_from_statfs (struct gf_statfs *gf_stat, struct statvfs *stat) +gf_statfs_from_statfs(struct gf_statfs *gf_stat, struct statvfs *stat) { - if (!stat || !gf_stat) - return; - - gf_stat->bsize = stat->f_bsize; - gf_stat->frsize = stat->f_frsize; - gf_stat->blocks = stat->f_blocks; - gf_stat->bfree = stat->f_bfree; - gf_stat->bavail = stat->f_bavail; - gf_stat->files = stat->f_files; - gf_stat->ffree = stat->f_ffree; - gf_stat->favail = stat->f_favail; - gf_stat->fsid = stat->f_fsid; - gf_stat->flag = stat->f_flag; - gf_stat->namemax = stat->f_namemax; + if (!stat || !gf_stat) + return; + + gf_stat->bsize = stat->f_bsize; + gf_stat->frsize = stat->f_frsize; + gf_stat->blocks = stat->f_blocks; + gf_stat->bfree = stat->f_bfree; + gf_stat->bavail = stat->f_bavail; + gf_stat->files = stat->f_files; + gf_stat->ffree = stat->f_ffree; + gf_stat->favail = stat->f_favail; + gf_stat->fsid = stat->f_fsid; + gf_stat->flag = stat->f_flag; + gf_stat->namemax = stat->f_namemax; } static inline void -gf_proto_lease_to_lease (struct gf_proto_lease *gf_proto_lease, struct gf_lease *gf_lease) +gf_proto_lease_to_lease(struct gf_proto_lease *gf_proto_lease, + struct gf_lease *gf_lease) { - if (!gf_lease || !gf_proto_lease) - return; + if (!gf_lease || !gf_proto_lease) + return; - gf_lease->cmd = gf_proto_lease->cmd; - gf_lease->lease_type = gf_proto_lease->lease_type; - memcpy (gf_lease->lease_id, gf_proto_lease->lease_id, LEASE_ID_SIZE); + gf_lease->cmd = gf_proto_lease->cmd; + gf_lease->lease_type = gf_proto_lease->lease_type; + memcpy(gf_lease->lease_id, gf_proto_lease->lease_id, LEASE_ID_SIZE); } static inline void -gf_proto_lease_from_lease (struct gf_proto_lease *gf_proto_lease, struct gf_lease *gf_lease) +gf_proto_lease_from_lease(struct gf_proto_lease *gf_proto_lease, + struct gf_lease *gf_lease) { - if (!gf_lease || !gf_proto_lease) - return; + if (!gf_lease || !gf_proto_lease) + return; - gf_proto_lease->cmd = gf_lease->cmd; - gf_proto_lease->lease_type = gf_lease->lease_type; - memcpy (gf_proto_lease->lease_id, gf_lease->lease_id, LEASE_ID_SIZE); + gf_proto_lease->cmd = gf_lease->cmd; + gf_proto_lease->lease_type = gf_lease->lease_type; + memcpy(gf_proto_lease->lease_id, gf_lease->lease_id, LEASE_ID_SIZE); } static inline int -gf_proto_recall_lease_to_upcall (struct gfs3_recall_lease_req *recall_lease, - struct gf_upcall *gf_up_data) +gf_proto_recall_lease_to_upcall(struct gfs3_recall_lease_req *recall_lease, + struct gf_upcall *gf_up_data) { - struct gf_upcall_recall_lease *tmp = NULL; - int ret = 0; + struct gf_upcall_recall_lease *tmp = NULL; + int ret = 0; - GF_VALIDATE_OR_GOTO(THIS->name, recall_lease, out); - GF_VALIDATE_OR_GOTO(THIS->name, gf_up_data, out); + GF_VALIDATE_OR_GOTO(THIS->name, recall_lease, out); + GF_VALIDATE_OR_GOTO(THIS->name, gf_up_data, out); - tmp = (struct gf_upcall_recall_lease *)gf_up_data->data; - tmp->lease_type = recall_lease->lease_type; - memcpy (gf_up_data->gfid, recall_lease->gfid, 16); - memcpy (tmp->tid, recall_lease->tid, 16); + tmp = (struct gf_upcall_recall_lease *)gf_up_data->data; + tmp->lease_type = recall_lease->lease_type; + memcpy(gf_up_data->gfid, recall_lease->gfid, 16); + memcpy(tmp->tid, recall_lease->tid, 16); - GF_PROTOCOL_DICT_UNSERIALIZE (THIS, tmp->dict, - (recall_lease->xdata).xdata_val, - (recall_lease->xdata).xdata_len, ret, - errno, out); + GF_PROTOCOL_DICT_UNSERIALIZE( + THIS, tmp->dict, (recall_lease->xdata).xdata_val, + (recall_lease->xdata).xdata_len, ret, errno, out); out: - return ret; - + return ret; } static inline int -gf_proto_recall_lease_from_upcall (xlator_t *this, - struct gfs3_recall_lease_req *recall_lease, - struct gf_upcall *gf_up_data) +gf_proto_recall_lease_from_upcall(xlator_t *this, + struct gfs3_recall_lease_req *recall_lease, + struct gf_upcall *gf_up_data) { - struct gf_upcall_recall_lease *tmp = NULL; - int ret = 0; + struct gf_upcall_recall_lease *tmp = NULL; + int ret = 0; - GF_VALIDATE_OR_GOTO(this->name, recall_lease, out); - GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); + GF_VALIDATE_OR_GOTO(this->name, recall_lease, out); + GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); - tmp = (struct gf_upcall_recall_lease *)gf_up_data->data; - recall_lease->lease_type = tmp->lease_type; - memcpy (recall_lease->gfid, gf_up_data->gfid, 16); - memcpy (recall_lease->tid, tmp->tid, 16); + tmp = (struct gf_upcall_recall_lease *)gf_up_data->data; + recall_lease->lease_type = tmp->lease_type; + memcpy(recall_lease->gfid, gf_up_data->gfid, 16); + memcpy(recall_lease->tid, tmp->tid, 16); - GF_PROTOCOL_DICT_SERIALIZE (this, tmp->dict, - &(recall_lease->xdata).xdata_val, - (recall_lease->xdata).xdata_len, ret, out); + GF_PROTOCOL_DICT_SERIALIZE(this, tmp->dict, + &(recall_lease->xdata).xdata_val, + (recall_lease->xdata).xdata_len, ret, out); out: - return ret; - + return ret; } static inline void -gf_proto_flock_to_flock (struct gf_proto_flock *gf_proto_flock, struct gf_flock *gf_flock) +gf_proto_flock_to_flock(struct gf_proto_flock *gf_proto_flock, + struct gf_flock *gf_flock) { - if (!gf_flock || !gf_proto_flock) - return; - - gf_flock->l_type = gf_proto_flock->type; - gf_flock->l_whence = gf_proto_flock->whence; - gf_flock->l_start = gf_proto_flock->start; - gf_flock->l_len = gf_proto_flock->len; - gf_flock->l_pid = gf_proto_flock->pid; - gf_flock->l_owner.len = gf_proto_flock->lk_owner.lk_owner_len; - if (gf_flock->l_owner.len && - (gf_flock->l_owner.len < GF_MAX_LOCK_OWNER_LEN)) - memcpy (gf_flock->l_owner.data, gf_proto_flock->lk_owner.lk_owner_val, - gf_flock->l_owner.len); + if (!gf_flock || !gf_proto_flock) + return; + + gf_flock->l_type = gf_proto_flock->type; + gf_flock->l_whence = gf_proto_flock->whence; + gf_flock->l_start = gf_proto_flock->start; + gf_flock->l_len = gf_proto_flock->len; + gf_flock->l_pid = gf_proto_flock->pid; + gf_flock->l_owner.len = gf_proto_flock->lk_owner.lk_owner_len; + if (gf_flock->l_owner.len && + (gf_flock->l_owner.len < GF_MAX_LOCK_OWNER_LEN)) + memcpy(gf_flock->l_owner.data, gf_proto_flock->lk_owner.lk_owner_val, + gf_flock->l_owner.len); } - static inline void -gf_proto_flock_from_flock (struct gf_proto_flock *gf_proto_flock, struct gf_flock *gf_flock) +gf_proto_flock_from_flock(struct gf_proto_flock *gf_proto_flock, + struct gf_flock *gf_flock) { - if (!gf_flock || !gf_proto_flock) - return; - - gf_proto_flock->type = (gf_flock->l_type); - gf_proto_flock->whence = (gf_flock->l_whence); - gf_proto_flock->start = (gf_flock->l_start); - gf_proto_flock->len = (gf_flock->l_len); - gf_proto_flock->pid = (gf_flock->l_pid); - gf_proto_flock->lk_owner.lk_owner_len = gf_flock->l_owner.len; - if (gf_flock->l_owner.len) - gf_proto_flock->lk_owner.lk_owner_val = gf_flock->l_owner.data; + if (!gf_flock || !gf_proto_flock) + return; + + gf_proto_flock->type = (gf_flock->l_type); + gf_proto_flock->whence = (gf_flock->l_whence); + gf_proto_flock->start = (gf_flock->l_start); + gf_proto_flock->len = (gf_flock->l_len); + gf_proto_flock->pid = (gf_flock->l_pid); + gf_proto_flock->lk_owner.lk_owner_len = gf_flock->l_owner.len; + if (gf_flock->l_owner.len) + gf_proto_flock->lk_owner.lk_owner_val = gf_flock->l_owner.data; } static inline void -gf_stat_to_iatt (struct gf_iatt *gf_stat, struct iatt *iatt) +gf_stat_to_iatt(struct gf_iatt *gf_stat, struct iatt *iatt) { - if (!iatt || !gf_stat) - return; - - memcpy (iatt->ia_gfid, gf_stat->ia_gfid, 16); - iatt->ia_ino = gf_stat->ia_ino ; - iatt->ia_dev = gf_stat->ia_dev ; - iatt->ia_type = ia_type_from_st_mode (gf_stat->mode) ; - iatt->ia_prot = ia_prot_from_st_mode (gf_stat->mode) ; - iatt->ia_nlink = gf_stat->ia_nlink ; - iatt->ia_uid = gf_stat->ia_uid ; - iatt->ia_gid = gf_stat->ia_gid ; - iatt->ia_rdev = gf_stat->ia_rdev ; - iatt->ia_size = gf_stat->ia_size ; - iatt->ia_blksize = gf_stat->ia_blksize ; - iatt->ia_blocks = gf_stat->ia_blocks ; - iatt->ia_atime = gf_stat->ia_atime ; - iatt->ia_atime_nsec = gf_stat->ia_atime_nsec ; - iatt->ia_mtime = gf_stat->ia_mtime ; - iatt->ia_mtime_nsec = gf_stat->ia_mtime_nsec ; - iatt->ia_ctime = gf_stat->ia_ctime ; - iatt->ia_ctime_nsec = gf_stat->ia_ctime_nsec ; + if (!iatt || !gf_stat) + return; + + memcpy(iatt->ia_gfid, gf_stat->ia_gfid, 16); + iatt->ia_ino = gf_stat->ia_ino; + iatt->ia_dev = gf_stat->ia_dev; + iatt->ia_type = ia_type_from_st_mode(gf_stat->mode); + iatt->ia_prot = ia_prot_from_st_mode(gf_stat->mode); + iatt->ia_nlink = gf_stat->ia_nlink; + iatt->ia_uid = gf_stat->ia_uid; + iatt->ia_gid = gf_stat->ia_gid; + iatt->ia_rdev = gf_stat->ia_rdev; + iatt->ia_size = gf_stat->ia_size; + iatt->ia_blksize = gf_stat->ia_blksize; + iatt->ia_blocks = gf_stat->ia_blocks; + iatt->ia_atime = gf_stat->ia_atime; + iatt->ia_atime_nsec = gf_stat->ia_atime_nsec; + iatt->ia_mtime = gf_stat->ia_mtime; + iatt->ia_mtime_nsec = gf_stat->ia_mtime_nsec; + iatt->ia_ctime = gf_stat->ia_ctime; + iatt->ia_ctime_nsec = gf_stat->ia_ctime_nsec; } static inline void -gf_stat_from_iatt (struct gf_iatt *gf_stat, struct iatt *iatt) +gf_stat_from_iatt(struct gf_iatt *gf_stat, struct iatt *iatt) { - if (!iatt || !gf_stat) - return; - - memcpy (gf_stat->ia_gfid, iatt->ia_gfid, 16); - gf_stat->ia_ino = iatt->ia_ino ; - gf_stat->ia_dev = iatt->ia_dev ; - gf_stat->mode = st_mode_from_ia (iatt->ia_prot, iatt->ia_type); - gf_stat->ia_nlink = iatt->ia_nlink ; - gf_stat->ia_uid = iatt->ia_uid ; - gf_stat->ia_gid = iatt->ia_gid ; - gf_stat->ia_rdev = iatt->ia_rdev ; - gf_stat->ia_size = iatt->ia_size ; - gf_stat->ia_blksize = iatt->ia_blksize ; - gf_stat->ia_blocks = iatt->ia_blocks ; - gf_stat->ia_atime = iatt->ia_atime ; - gf_stat->ia_atime_nsec = iatt->ia_atime_nsec ; - gf_stat->ia_mtime = iatt->ia_mtime ; - gf_stat->ia_mtime_nsec = iatt->ia_mtime_nsec ; - gf_stat->ia_ctime = iatt->ia_ctime ; - gf_stat->ia_ctime_nsec = iatt->ia_ctime_nsec ; + if (!iatt || !gf_stat) + return; + + memcpy(gf_stat->ia_gfid, iatt->ia_gfid, 16); + gf_stat->ia_ino = iatt->ia_ino; + gf_stat->ia_dev = iatt->ia_dev; + gf_stat->mode = st_mode_from_ia(iatt->ia_prot, iatt->ia_type); + gf_stat->ia_nlink = iatt->ia_nlink; + gf_stat->ia_uid = iatt->ia_uid; + gf_stat->ia_gid = iatt->ia_gid; + gf_stat->ia_rdev = iatt->ia_rdev; + gf_stat->ia_size = iatt->ia_size; + gf_stat->ia_blksize = iatt->ia_blksize; + gf_stat->ia_blocks = iatt->ia_blocks; + gf_stat->ia_atime = iatt->ia_atime; + gf_stat->ia_atime_nsec = iatt->ia_atime_nsec; + gf_stat->ia_mtime = iatt->ia_mtime; + gf_stat->ia_mtime_nsec = iatt->ia_mtime_nsec; + gf_stat->ia_ctime = iatt->ia_ctime; + gf_stat->ia_ctime_nsec = iatt->ia_ctime_nsec; } static inline int -gf_proto_cache_invalidation_from_upcall (xlator_t *this, - gfs3_cbk_cache_invalidation_req *gf_c_req, - struct gf_upcall *gf_up_data) +gf_proto_cache_invalidation_from_upcall( + xlator_t *this, gfs3_cbk_cache_invalidation_req *gf_c_req, + struct gf_upcall *gf_up_data) { - struct gf_upcall_cache_invalidation *gf_c_data = NULL; - int is_cache_inval = 0; - int ret = -1; - - GF_VALIDATE_OR_GOTO(this->name, gf_c_req, out); - GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); - - is_cache_inval = ((gf_up_data->event_type == - GF_UPCALL_CACHE_INVALIDATION) ? 1 : 0); - GF_VALIDATE_OR_GOTO(this->name, is_cache_inval, out); - - gf_c_data = (struct gf_upcall_cache_invalidation *)gf_up_data->data; - GF_VALIDATE_OR_GOTO(this->name, gf_c_data, out); - - gf_c_req->gfid = uuid_utoa (gf_up_data->gfid); - gf_c_req->event_type = gf_up_data->event_type; - gf_c_req->flags = gf_c_data->flags; - gf_c_req->expire_time_attr = gf_c_data->expire_time_attr; - gf_stat_from_iatt (&gf_c_req->stat, &gf_c_data->stat); - gf_stat_from_iatt (&gf_c_req->parent_stat, &gf_c_data->p_stat); - gf_stat_from_iatt (&gf_c_req->oldparent_stat, &gf_c_data->oldp_stat); - - ret = 0; - GF_PROTOCOL_DICT_SERIALIZE (this, gf_c_data->dict, &(gf_c_req->xdata).xdata_val, - (gf_c_req->xdata).xdata_len, ret, out); + struct gf_upcall_cache_invalidation *gf_c_data = NULL; + int is_cache_inval = 0; + int ret = -1; + + GF_VALIDATE_OR_GOTO(this->name, gf_c_req, out); + GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); + + is_cache_inval = ((gf_up_data->event_type == GF_UPCALL_CACHE_INVALIDATION) + ? 1 + : 0); + GF_VALIDATE_OR_GOTO(this->name, is_cache_inval, out); + + gf_c_data = (struct gf_upcall_cache_invalidation *)gf_up_data->data; + GF_VALIDATE_OR_GOTO(this->name, gf_c_data, out); + + gf_c_req->gfid = uuid_utoa(gf_up_data->gfid); + gf_c_req->event_type = gf_up_data->event_type; + gf_c_req->flags = gf_c_data->flags; + gf_c_req->expire_time_attr = gf_c_data->expire_time_attr; + gf_stat_from_iatt(&gf_c_req->stat, &gf_c_data->stat); + gf_stat_from_iatt(&gf_c_req->parent_stat, &gf_c_data->p_stat); + gf_stat_from_iatt(&gf_c_req->oldparent_stat, &gf_c_data->oldp_stat); + + ret = 0; + GF_PROTOCOL_DICT_SERIALIZE(this, gf_c_data->dict, + &(gf_c_req->xdata).xdata_val, + (gf_c_req->xdata).xdata_len, ret, out); out: - return ret; + return ret; } static inline int -gf_proto_cache_invalidation_to_upcall (xlator_t *this, - gfs3_cbk_cache_invalidation_req *gf_c_req, - struct gf_upcall *gf_up_data) +gf_proto_cache_invalidation_to_upcall(xlator_t *this, + gfs3_cbk_cache_invalidation_req *gf_c_req, + struct gf_upcall *gf_up_data) { - struct gf_upcall_cache_invalidation *gf_c_data = NULL; - int ret = -1; - - GF_VALIDATE_OR_GOTO(this->name, gf_c_req, out); - GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); - - gf_c_data = (struct gf_upcall_cache_invalidation *)gf_up_data->data; - GF_VALIDATE_OR_GOTO(this->name, gf_c_data, out); - - ret = gf_uuid_parse (gf_c_req->gfid, gf_up_data->gfid); - if (ret) { - gf_log (this->name, GF_LOG_WARNING, "gf_uuid_parse(%s) failed", - gf_c_req->gfid); - gf_up_data->event_type = GF_UPCALL_EVENT_NULL; - goto out; - } - - gf_up_data->event_type = gf_c_req->event_type; - - gf_c_data->flags = gf_c_req->flags; - gf_c_data->expire_time_attr = gf_c_req->expire_time_attr; - gf_stat_to_iatt (&gf_c_req->stat, &gf_c_data->stat); - gf_stat_to_iatt (&gf_c_req->parent_stat, &gf_c_data->p_stat); - gf_stat_to_iatt (&gf_c_req->oldparent_stat, &gf_c_data->oldp_stat); - - ret = 0; - GF_PROTOCOL_DICT_UNSERIALIZE (this, gf_c_data->dict, - (gf_c_req->xdata).xdata_val, - (gf_c_req->xdata).xdata_len, ret, - ret, out); - - /* If no dict was sent, create an empty dict, so that each xlator - * need not check if empty then create new dict. Will be unref'd by the - * caller */ - if (!gf_c_data->dict) - gf_c_data->dict = dict_new (); - out: - return ret; + struct gf_upcall_cache_invalidation *gf_c_data = NULL; + int ret = -1; + + GF_VALIDATE_OR_GOTO(this->name, gf_c_req, out); + GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); + + gf_c_data = (struct gf_upcall_cache_invalidation *)gf_up_data->data; + GF_VALIDATE_OR_GOTO(this->name, gf_c_data, out); + + ret = gf_uuid_parse(gf_c_req->gfid, gf_up_data->gfid); + if (ret) { + gf_log(this->name, GF_LOG_WARNING, "gf_uuid_parse(%s) failed", + gf_c_req->gfid); + gf_up_data->event_type = GF_UPCALL_EVENT_NULL; + goto out; + } + + gf_up_data->event_type = gf_c_req->event_type; + + gf_c_data->flags = gf_c_req->flags; + gf_c_data->expire_time_attr = gf_c_req->expire_time_attr; + gf_stat_to_iatt(&gf_c_req->stat, &gf_c_data->stat); + gf_stat_to_iatt(&gf_c_req->parent_stat, &gf_c_data->p_stat); + gf_stat_to_iatt(&gf_c_req->oldparent_stat, &gf_c_data->oldp_stat); + + ret = 0; + GF_PROTOCOL_DICT_UNSERIALIZE(this, gf_c_data->dict, + (gf_c_req->xdata).xdata_val, + (gf_c_req->xdata).xdata_len, ret, ret, out); + + /* If no dict was sent, create an empty dict, so that each xlator + * need not check if empty then create new dict. Will be unref'd by the + * caller */ + if (!gf_c_data->dict) + gf_c_data->dict = dict_new(); +out: + return ret; } static inline int -gf_proto_inodelk_contention_to_upcall (struct gfs4_inodelk_contention_req *lc, - struct gf_upcall *gf_up_data) +gf_proto_inodelk_contention_to_upcall(struct gfs4_inodelk_contention_req *lc, + struct gf_upcall *gf_up_data) { - struct gf_upcall_inodelk_contention *tmp = NULL; - xlator_t *this = NULL; - int ret = -1; - int op_errno = EINVAL; + struct gf_upcall_inodelk_contention *tmp = NULL; + xlator_t *this = NULL; + int ret = -1; + int op_errno = EINVAL; - this = THIS; + this = THIS; - GF_VALIDATE_OR_GOTO(this->name, lc, out); - GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); + GF_VALIDATE_OR_GOTO(this->name, lc, out); + GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); - tmp = (struct gf_upcall_inodelk_contention *)gf_up_data->data; + tmp = (struct gf_upcall_inodelk_contention *)gf_up_data->data; - gf_uuid_copy(gf_up_data->gfid, (unsigned char *)lc->gfid); + gf_uuid_copy(gf_up_data->gfid, (unsigned char *)lc->gfid); - gf_proto_flock_to_flock(&lc->flock, &tmp->flock); - tmp->pid = lc->pid; - tmp->domain = lc->domain; - if ((tmp->domain != NULL) && (*tmp->domain == 0)) { - tmp->domain = NULL; - } + gf_proto_flock_to_flock(&lc->flock, &tmp->flock); + tmp->pid = lc->pid; + tmp->domain = lc->domain; + if ((tmp->domain != NULL) && (*tmp->domain == 0)) { + tmp->domain = NULL; + } - GF_PROTOCOL_DICT_UNSERIALIZE (this, tmp->xdata, lc->xdata.xdata_val, - lc->xdata.xdata_len, ret, op_errno, out); + GF_PROTOCOL_DICT_UNSERIALIZE(this, tmp->xdata, lc->xdata.xdata_val, + lc->xdata.xdata_len, ret, op_errno, out); - ret = 0; + ret = 0; out: - if (ret < 0) { - ret = -op_errno; - } + if (ret < 0) { + ret = -op_errno; + } - return ret; + return ret; } static inline int -gf_proto_inodelk_contention_from_upcall (xlator_t *this, - struct gfs4_inodelk_contention_req *lc, - struct gf_upcall *gf_up_data) +gf_proto_inodelk_contention_from_upcall(xlator_t *this, + struct gfs4_inodelk_contention_req *lc, + struct gf_upcall *gf_up_data) { - struct gf_upcall_inodelk_contention *tmp = NULL; - int ret = -1; - int op_errno = EINVAL; + struct gf_upcall_inodelk_contention *tmp = NULL; + int ret = -1; + int op_errno = EINVAL; - GF_VALIDATE_OR_GOTO(this->name, lc, out); - GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); + GF_VALIDATE_OR_GOTO(this->name, lc, out); + GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); - tmp = (struct gf_upcall_inodelk_contention *)gf_up_data->data; + tmp = (struct gf_upcall_inodelk_contention *)gf_up_data->data; - gf_uuid_copy((unsigned char *)lc->gfid, gf_up_data->gfid); + gf_uuid_copy((unsigned char *)lc->gfid, gf_up_data->gfid); - gf_proto_flock_from_flock(&lc->flock, &tmp->flock); - lc->pid = tmp->pid; - lc->domain = (char *)tmp->domain; - if (lc->domain == NULL) { - lc->domain = ""; - } + gf_proto_flock_from_flock(&lc->flock, &tmp->flock); + lc->pid = tmp->pid; + lc->domain = (char *)tmp->domain; + if (lc->domain == NULL) { + lc->domain = ""; + } - GF_PROTOCOL_DICT_SERIALIZE (this, tmp->xdata, &lc->xdata.xdata_val, - lc->xdata.xdata_len, op_errno, out); + GF_PROTOCOL_DICT_SERIALIZE(this, tmp->xdata, &lc->xdata.xdata_val, + lc->xdata.xdata_len, op_errno, out); - ret = 0; + ret = 0; out: - if (ret < 0) { - ret = -op_errno; - } + if (ret < 0) { + ret = -op_errno; + } - return ret; + return ret; } static inline int -gf_proto_entrylk_contention_to_upcall (struct gfs4_entrylk_contention_req *lc, - struct gf_upcall *gf_up_data) +gf_proto_entrylk_contention_to_upcall(struct gfs4_entrylk_contention_req *lc, + struct gf_upcall *gf_up_data) { - struct gf_upcall_entrylk_contention *tmp = NULL; - xlator_t *this = NULL; - int ret = -1; - int op_errno = EINVAL; + struct gf_upcall_entrylk_contention *tmp = NULL; + xlator_t *this = NULL; + int ret = -1; + int op_errno = EINVAL; - this = THIS; + this = THIS; - GF_VALIDATE_OR_GOTO(this->name, lc, out); - GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); + GF_VALIDATE_OR_GOTO(this->name, lc, out); + GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); - tmp = (struct gf_upcall_entrylk_contention *)gf_up_data->data; + tmp = (struct gf_upcall_entrylk_contention *)gf_up_data->data; - gf_uuid_copy(gf_up_data->gfid, (unsigned char *)lc->gfid); + gf_uuid_copy(gf_up_data->gfid, (unsigned char *)lc->gfid); - tmp->type = lc->type; - tmp->name = lc->name; - if ((tmp->name != NULL) && (*tmp->name == 0)) { - tmp->name = NULL; - } - tmp->pid = lc->pid; - tmp->domain = lc->domain; - if ((tmp->domain != NULL) && (*tmp->domain == 0)) { - tmp->domain = NULL; - } + tmp->type = lc->type; + tmp->name = lc->name; + if ((tmp->name != NULL) && (*tmp->name == 0)) { + tmp->name = NULL; + } + tmp->pid = lc->pid; + tmp->domain = lc->domain; + if ((tmp->domain != NULL) && (*tmp->domain == 0)) { + tmp->domain = NULL; + } - GF_PROTOCOL_DICT_UNSERIALIZE (this, tmp->xdata, lc->xdata.xdata_val, - lc->xdata.xdata_len, ret, op_errno, out); + GF_PROTOCOL_DICT_UNSERIALIZE(this, tmp->xdata, lc->xdata.xdata_val, + lc->xdata.xdata_len, ret, op_errno, out); - ret = 0; + ret = 0; out: - if (ret < 0) { - ret = -op_errno; - } + if (ret < 0) { + ret = -op_errno; + } - return ret; + return ret; } static inline int -gf_proto_entrylk_contention_from_upcall (xlator_t *this, - struct gfs4_entrylk_contention_req *lc, - struct gf_upcall *gf_up_data) +gf_proto_entrylk_contention_from_upcall(xlator_t *this, + struct gfs4_entrylk_contention_req *lc, + struct gf_upcall *gf_up_data) { - struct gf_upcall_entrylk_contention *tmp = NULL; - int ret = -1; - int op_errno = EINVAL; + struct gf_upcall_entrylk_contention *tmp = NULL; + int ret = -1; + int op_errno = EINVAL; - GF_VALIDATE_OR_GOTO(this->name, lc, out); - GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); + GF_VALIDATE_OR_GOTO(this->name, lc, out); + GF_VALIDATE_OR_GOTO(this->name, gf_up_data, out); - tmp = (struct gf_upcall_entrylk_contention *)gf_up_data->data; + tmp = (struct gf_upcall_entrylk_contention *)gf_up_data->data; - gf_uuid_copy((unsigned char *)lc->gfid, gf_up_data->gfid); + gf_uuid_copy((unsigned char *)lc->gfid, gf_up_data->gfid); - lc->type = tmp->type; - lc->name = (char *)tmp->name; - if (lc->name == NULL) { - lc->name = ""; - } - lc->pid = tmp->pid; - lc->domain = (char *)tmp->domain; - if (lc->domain == NULL) { - lc->domain = ""; - } + lc->type = tmp->type; + lc->name = (char *)tmp->name; + if (lc->name == NULL) { + lc->name = ""; + } + lc->pid = tmp->pid; + lc->domain = (char *)tmp->domain; + if (lc->domain == NULL) { + lc->domain = ""; + } - GF_PROTOCOL_DICT_SERIALIZE (this, tmp->xdata, &lc->xdata.xdata_val, - lc->xdata.xdata_len, op_errno, out); + GF_PROTOCOL_DICT_SERIALIZE(this, tmp->xdata, &lc->xdata.xdata_val, + lc->xdata.xdata_len, op_errno, out); - ret = 0; + ret = 0; out: - if (ret < 0) { - ret = -op_errno; - } + if (ret < 0) { + ret = -op_errno; + } - return ret; + return ret; } static inline void -gfx_stat_to_iattx (struct gfx_iattx *gf_stat, struct iatt *iatt) +gfx_stat_to_iattx(struct gfx_iattx *gf_stat, struct iatt *iatt) { - if (!iatt || !gf_stat) - return; - - memcpy (iatt->ia_gfid, gf_stat->ia_gfid, 16); - - iatt->ia_flags = gf_stat->ia_flags; - iatt->ia_ino = gf_stat->ia_ino ; - iatt->ia_dev = gf_stat->ia_dev ; - iatt->ia_rdev = gf_stat->ia_rdev ; - iatt->ia_size = gf_stat->ia_size ; - iatt->ia_nlink = gf_stat->ia_nlink ; - iatt->ia_uid = gf_stat->ia_uid ; - iatt->ia_gid = gf_stat->ia_gid ; - iatt->ia_blksize = gf_stat->ia_blksize ; - iatt->ia_blocks = gf_stat->ia_blocks ; - iatt->ia_atime = gf_stat->ia_atime ; - iatt->ia_atime_nsec = gf_stat->ia_atime_nsec ; - iatt->ia_mtime = gf_stat->ia_mtime ; - iatt->ia_mtime_nsec = gf_stat->ia_mtime_nsec ; - iatt->ia_ctime = gf_stat->ia_ctime ; - iatt->ia_ctime_nsec = gf_stat->ia_ctime_nsec ; - iatt->ia_btime = gf_stat->ia_btime ; - iatt->ia_btime_nsec = gf_stat->ia_btime_nsec ; - iatt->ia_attributes = gf_stat->ia_attributes; - iatt->ia_attributes_mask = gf_stat->ia_attributes_mask; - - iatt->ia_type = ia_type_from_st_mode (gf_stat->mode); - iatt->ia_prot = ia_prot_from_st_mode (gf_stat->mode); + if (!iatt || !gf_stat) + return; + + memcpy(iatt->ia_gfid, gf_stat->ia_gfid, 16); + + iatt->ia_flags = gf_stat->ia_flags; + iatt->ia_ino = gf_stat->ia_ino; + iatt->ia_dev = gf_stat->ia_dev; + iatt->ia_rdev = gf_stat->ia_rdev; + iatt->ia_size = gf_stat->ia_size; + iatt->ia_nlink = gf_stat->ia_nlink; + iatt->ia_uid = gf_stat->ia_uid; + iatt->ia_gid = gf_stat->ia_gid; + iatt->ia_blksize = gf_stat->ia_blksize; + iatt->ia_blocks = gf_stat->ia_blocks; + iatt->ia_atime = gf_stat->ia_atime; + iatt->ia_atime_nsec = gf_stat->ia_atime_nsec; + iatt->ia_mtime = gf_stat->ia_mtime; + iatt->ia_mtime_nsec = gf_stat->ia_mtime_nsec; + iatt->ia_ctime = gf_stat->ia_ctime; + iatt->ia_ctime_nsec = gf_stat->ia_ctime_nsec; + iatt->ia_btime = gf_stat->ia_btime; + iatt->ia_btime_nsec = gf_stat->ia_btime_nsec; + iatt->ia_attributes = gf_stat->ia_attributes; + iatt->ia_attributes_mask = gf_stat->ia_attributes_mask; + + iatt->ia_type = ia_type_from_st_mode(gf_stat->mode); + iatt->ia_prot = ia_prot_from_st_mode(gf_stat->mode); } - static inline void -gfx_stat_from_iattx (struct gfx_iattx *gf_stat, struct iatt *iatt) +gfx_stat_from_iattx(struct gfx_iattx *gf_stat, struct iatt *iatt) { - if (!iatt || !gf_stat) - return; - - memcpy (gf_stat->ia_gfid, iatt->ia_gfid, 16); - gf_stat->ia_ino = iatt->ia_ino ; - gf_stat->ia_dev = iatt->ia_dev ; - - gf_stat->ia_nlink = iatt->ia_nlink ; - gf_stat->ia_uid = iatt->ia_uid ; - gf_stat->ia_gid = iatt->ia_gid ; - gf_stat->ia_rdev = iatt->ia_rdev ; - gf_stat->ia_size = iatt->ia_size ; - gf_stat->ia_blksize = iatt->ia_blksize ; - gf_stat->ia_blocks = iatt->ia_blocks ; - gf_stat->ia_atime = iatt->ia_atime ; - gf_stat->ia_atime_nsec = iatt->ia_atime_nsec ; - gf_stat->ia_mtime = iatt->ia_mtime ; - gf_stat->ia_mtime_nsec = iatt->ia_mtime_nsec ; - gf_stat->ia_ctime = iatt->ia_ctime ; - gf_stat->ia_ctime_nsec = iatt->ia_ctime_nsec ; - - gf_stat->ia_flags = iatt->ia_flags; - gf_stat->ia_btime = iatt->ia_btime ; - gf_stat->ia_btime_nsec = iatt->ia_btime_nsec ; - gf_stat->ia_attributes = iatt->ia_attributes; - gf_stat->ia_attributes_mask = iatt->ia_attributes_mask; - - gf_stat->mode = st_mode_from_ia (iatt->ia_prot, iatt->ia_type); + if (!iatt || !gf_stat) + return; + + memcpy(gf_stat->ia_gfid, iatt->ia_gfid, 16); + gf_stat->ia_ino = iatt->ia_ino; + gf_stat->ia_dev = iatt->ia_dev; + + gf_stat->ia_nlink = iatt->ia_nlink; + gf_stat->ia_uid = iatt->ia_uid; + gf_stat->ia_gid = iatt->ia_gid; + gf_stat->ia_rdev = iatt->ia_rdev; + gf_stat->ia_size = iatt->ia_size; + gf_stat->ia_blksize = iatt->ia_blksize; + gf_stat->ia_blocks = iatt->ia_blocks; + gf_stat->ia_atime = iatt->ia_atime; + gf_stat->ia_atime_nsec = iatt->ia_atime_nsec; + gf_stat->ia_mtime = iatt->ia_mtime; + gf_stat->ia_mtime_nsec = iatt->ia_mtime_nsec; + gf_stat->ia_ctime = iatt->ia_ctime; + gf_stat->ia_ctime_nsec = iatt->ia_ctime_nsec; + + gf_stat->ia_flags = iatt->ia_flags; + gf_stat->ia_btime = iatt->ia_btime; + gf_stat->ia_btime_nsec = iatt->ia_btime_nsec; + gf_stat->ia_attributes = iatt->ia_attributes; + gf_stat->ia_attributes_mask = iatt->ia_attributes_mask; + + gf_stat->mode = st_mode_from_ia(iatt->ia_prot, iatt->ia_type); } /* dict_to_xdr () */ static inline int -dict_to_xdr (dict_t *this, gfx_dict *dict) +dict_to_xdr(dict_t *this, gfx_dict *dict) { - int ret = -1; - int i = 0; - int index = 0; - data_pair_t *dpair = NULL; - gfx_dict_pair *xpair = NULL; - ssize_t size = 0; - - /* This is a failure as we expect destination to be valid */ - if (!dict) - goto out; - - /* This is OK as dictionary can be null, in which case, destination - should also know that it is NULL. */ - if (!this) { - /* encode special meaning data here, - while decoding, you know it is NULL dict */ - dict->count = -1; - /* everything else is normal */ - dict->pairs.pairs_len = 0; - ret = 0; - goto out; - } - - /* Do the whole operation in locked region */ - LOCK (&this->lock); - - dict->pairs.pairs_val = GF_CALLOC (1, (this->count * - sizeof (gfx_dict_pair)), - gf_common_mt_char); - if (!dict->pairs.pairs_val) - goto out; - - dpair = this->members_list; - for (i = 0; i < this->count; i++) { - xpair = &dict->pairs.pairs_val[index]; - - xpair->key.key_val = dpair->key; - xpair->key.key_len = strlen (dpair->key) + 1; - xpair->value.type = dpair->value->data_type; - switch (dpair->value->data_type) { - /* Add more type here */ - case GF_DATA_TYPE_INT: - index++; - xpair->value.gfx_value_u.value_int = - strtoll (dpair->value->data, NULL, 0); - break; - case GF_DATA_TYPE_UINT: - index++; - xpair->value.gfx_value_u.value_uint = - strtoull (dpair->value->data, NULL, 0); - break; - case GF_DATA_TYPE_DOUBLE: - index++; - xpair->value.gfx_value_u.value_dbl = - strtod (dpair->value->data, NULL); - break; - case GF_DATA_TYPE_STR: - index++; - xpair->value.gfx_value_u.val_string.val_string_val = dpair->value->data; - xpair->value.gfx_value_u.val_string.val_string_len = dpair->value->len; - break; - case GF_DATA_TYPE_IATT: - index++; - gfx_stat_from_iattx (&xpair->value.gfx_value_u.iatt, - (struct iatt *)dpair->value->data); - break; - case GF_DATA_TYPE_GFUUID: - index++; - memcpy (&xpair->value.gfx_value_u.uuid, - dpair->value->data, sizeof (uuid_t)); - break; - - case GF_DATA_TYPE_PTR: - index++; - /* Ideally, each type of data stored in dictionary - should have type. A pointer type shouldn't be - sent on wire */ - - /* This is done for backward compatibility as dict is - heavily used for transporting data over wire. - Ideally, wherever there is an issue, fix and - move on */ - xpair->value.gfx_value_u.other.other_val = - dpair->value->data; - xpair->value.gfx_value_u.other.other_len = - dpair->value->len; - - /* Change this to INFO, after taking the above down */ - gf_msg ("dict", GF_LOG_INFO, EINVAL, - LG_MSG_DICT_SERIAL_FAILED, - "key '%s' would not be sent on wire in the future", - dpair->key); - break; - default: - /* Unknown type and ptr type is not sent on wire */ - gf_msg ("dict", GF_LOG_WARNING, EINVAL, LG_MSG_DICT_SERIAL_FAILED, - "key '%s' is not sent on wire", dpair->key); - break; - } - dpair = dpair->next; + int ret = -1; + int i = 0; + int index = 0; + data_pair_t *dpair = NULL; + gfx_dict_pair *xpair = NULL; + ssize_t size = 0; + + /* This is a failure as we expect destination to be valid */ + if (!dict) + goto out; + + /* This is OK as dictionary can be null, in which case, destination + should also know that it is NULL. */ + if (!this) { + /* encode special meaning data here, + while decoding, you know it is NULL dict */ + dict->count = -1; + /* everything else is normal */ + dict->pairs.pairs_len = 0; + ret = 0; + goto out; + } + + /* Do the whole operation in locked region */ + LOCK(&this->lock); + + dict->pairs.pairs_val = GF_CALLOC(1, (this->count * sizeof(gfx_dict_pair)), + gf_common_mt_char); + if (!dict->pairs.pairs_val) + goto out; + + dpair = this->members_list; + for (i = 0; i < this->count; i++) { + xpair = &dict->pairs.pairs_val[index]; + + xpair->key.key_val = dpair->key; + xpair->key.key_len = strlen(dpair->key) + 1; + xpair->value.type = dpair->value->data_type; + switch (dpair->value->data_type) { + /* Add more type here */ + case GF_DATA_TYPE_INT: + index++; + xpair->value.gfx_value_u.value_int = strtoll(dpair->value->data, + NULL, 0); + break; + case GF_DATA_TYPE_UINT: + index++; + xpair->value.gfx_value_u.value_uint = strtoull( + dpair->value->data, NULL, 0); + break; + case GF_DATA_TYPE_DOUBLE: + index++; + xpair->value.gfx_value_u.value_dbl = strtod(dpair->value->data, + NULL); + break; + case GF_DATA_TYPE_STR: + index++; + xpair->value.gfx_value_u.val_string + .val_string_val = dpair->value->data; + xpair->value.gfx_value_u.val_string + .val_string_len = dpair->value->len; + break; + case GF_DATA_TYPE_IATT: + index++; + gfx_stat_from_iattx(&xpair->value.gfx_value_u.iatt, + (struct iatt *)dpair->value->data); + break; + case GF_DATA_TYPE_GFUUID: + index++; + memcpy(&xpair->value.gfx_value_u.uuid, dpair->value->data, + sizeof(uuid_t)); + break; + + case GF_DATA_TYPE_PTR: + index++; + /* Ideally, each type of data stored in dictionary + should have type. A pointer type shouldn't be + sent on wire */ + + /* This is done for backward compatibility as dict is + heavily used for transporting data over wire. + Ideally, wherever there is an issue, fix and + move on */ + xpair->value.gfx_value_u.other.other_val = dpair->value->data; + xpair->value.gfx_value_u.other.other_len = dpair->value->len; + + /* Change this to INFO, after taking the above down */ + gf_msg("dict", GF_LOG_INFO, EINVAL, LG_MSG_DICT_SERIAL_FAILED, + "key '%s' would not be sent on wire in the future", + dpair->key); + break; + default: + /* Unknown type and ptr type is not sent on wire */ + gf_msg("dict", GF_LOG_WARNING, EINVAL, + LG_MSG_DICT_SERIAL_FAILED, + "key '%s' is not sent on wire", dpair->key); + break; } + dpair = dpair->next; + } - dict->pairs.pairs_len = index; - dict->count = index; + dict->pairs.pairs_len = index; + dict->count = index; - /* This is required mainly in the RPC layer to understand the - boundary for proper payload. Hence only send the size of - variable XDR size. ie, the formula should be: - xdr_size = total size - (xdr_size + count + pairs.pairs_len)) */ - size = xdr_sizeof ((xdrproc_t) xdr_gfx_dict, dict); + /* This is required mainly in the RPC layer to understand the + boundary for proper payload. Hence only send the size of + variable XDR size. ie, the formula should be: + xdr_size = total size - (xdr_size + count + pairs.pairs_len)) */ + size = xdr_sizeof((xdrproc_t)xdr_gfx_dict, dict); - dict->xdr_size = (size > 12) ? (size - 12) : 0; + dict->xdr_size = (size > 12) ? (size - 12) : 0; - ret = 0; + ret = 0; out: - /* this can be null here, so unlock only if its not null */ - if (this) - UNLOCK (&this->lock); + /* this can be null here, so unlock only if its not null */ + if (this) + UNLOCK(&this->lock); - return ret; + return ret; } static inline int -xdr_to_dict (gfx_dict *dict, dict_t **to) +xdr_to_dict(gfx_dict *dict, dict_t **to) { - int ret = -1; - int index = 0; - char *key = NULL; - char *value = NULL; - gfx_dict_pair *xpair = NULL; - dict_t *this = NULL; - unsigned char *uuid = NULL; - struct iatt *iatt = NULL; - - if (!to || !dict) - goto out; - - if (dict->count < 0) { - /* indicates NULL dict was passed for encoding */ - ret = 0; - goto out; - } - - this = dict_new(); - if (!this) - goto out; - - for (index = 0; index < dict->pairs.pairs_len; index++) { - ret = -1; - xpair = &dict->pairs.pairs_val[index]; - - key = xpair->key.key_val; - switch (xpair->value.type) { - /* Add more type here */ - case GF_DATA_TYPE_INT: - ret = dict_set_int64 (this, key, - xpair->value.gfx_value_u.value_int); - break; - case GF_DATA_TYPE_UINT: - ret = dict_set_uint64 (this, key, - xpair->value.gfx_value_u.value_uint); - break; - case GF_DATA_TYPE_DOUBLE: - ret = dict_set_double (this, key, - xpair->value.gfx_value_u.value_dbl); - break; - case GF_DATA_TYPE_STR: - value = GF_MALLOC (xpair->value.gfx_value_u.val_string.val_string_len + 1, - gf_common_mt_char); - if (!value) { - errno = ENOMEM; - goto out; - } - memcpy (value, xpair->value.gfx_value_u.val_string.val_string_val, - xpair->value.gfx_value_u.val_string.val_string_len); - value[xpair->value.gfx_value_u.val_string.val_string_len] = '\0'; - free (xpair->value.gfx_value_u.val_string.val_string_val); - ret = dict_set_dynstr (this, key, value); - break; - case GF_DATA_TYPE_GFUUID: - uuid = GF_MALLOC (sizeof (uuid_t), gf_common_mt_uuid_t); - if (!uuid) { - errno = ENOMEM; - goto out; - } - memcpy (uuid, xpair->value.gfx_value_u.uuid, sizeof (uuid_t)); - ret = dict_set_gfuuid (this, key, uuid, false); - break; - case GF_DATA_TYPE_IATT: - iatt = GF_CALLOC (1, sizeof (struct iatt), gf_common_mt_char); - if (!iatt) { - errno = ENOMEM; - goto out; - } - gfx_stat_to_iattx (&xpair->value.gfx_value_u.iatt, iatt); - ret = dict_set_iatt (this, key, iatt, false); - break; - case GF_DATA_TYPE_PTR: - value = GF_MALLOC (xpair->value.gfx_value_u.other.other_len + 1, - gf_common_mt_char); - if (!value) { - errno = ENOMEM; - goto out; - } - memcpy (value, xpair->value.gfx_value_u.other.other_val, - xpair->value.gfx_value_u.other.other_len); - value[xpair->value.gfx_value_u.other.other_len] = '\0'; - free (xpair->value.gfx_value_u.other.other_val); - ret = dict_set_dynptr (this, key, value, - xpair->value.gfx_value_u.other.other_len); - break; - default: - ret = 0; - /* Unknown type and ptr type is not sent on wire */ - break; + int ret = -1; + int index = 0; + char *key = NULL; + char *value = NULL; + gfx_dict_pair *xpair = NULL; + dict_t *this = NULL; + unsigned char *uuid = NULL; + struct iatt *iatt = NULL; + + if (!to || !dict) + goto out; + + if (dict->count < 0) { + /* indicates NULL dict was passed for encoding */ + ret = 0; + goto out; + } + + this = dict_new(); + if (!this) + goto out; + + for (index = 0; index < dict->pairs.pairs_len; index++) { + ret = -1; + xpair = &dict->pairs.pairs_val[index]; + + key = xpair->key.key_val; + switch (xpair->value.type) { + /* Add more type here */ + case GF_DATA_TYPE_INT: + ret = dict_set_int64(this, key, + xpair->value.gfx_value_u.value_int); + break; + case GF_DATA_TYPE_UINT: + ret = dict_set_uint64(this, key, + xpair->value.gfx_value_u.value_uint); + break; + case GF_DATA_TYPE_DOUBLE: + ret = dict_set_double(this, key, + xpair->value.gfx_value_u.value_dbl); + break; + case GF_DATA_TYPE_STR: + value = GF_MALLOC( + xpair->value.gfx_value_u.val_string.val_string_len + 1, + gf_common_mt_char); + if (!value) { + errno = ENOMEM; + goto out; } - if (ret) { - gf_msg_debug (THIS->name, ENOMEM, - "failed to set the key (%s) into dict", - key); + memcpy(value, + xpair->value.gfx_value_u.val_string.val_string_val, + xpair->value.gfx_value_u.val_string.val_string_len); + value[xpair->value.gfx_value_u.val_string.val_string_len] = + '\0'; + free(xpair->value.gfx_value_u.val_string.val_string_val); + ret = dict_set_dynstr(this, key, value); + break; + case GF_DATA_TYPE_GFUUID: + uuid = GF_MALLOC(sizeof(uuid_t), gf_common_mt_uuid_t); + if (!uuid) { + errno = ENOMEM; + goto out; } - free (xpair->key.key_val); + memcpy(uuid, xpair->value.gfx_value_u.uuid, sizeof(uuid_t)); + ret = dict_set_gfuuid(this, key, uuid, false); + break; + case GF_DATA_TYPE_IATT: + iatt = GF_CALLOC(1, sizeof(struct iatt), gf_common_mt_char); + if (!iatt) { + errno = ENOMEM; + goto out; + } + gfx_stat_to_iattx(&xpair->value.gfx_value_u.iatt, iatt); + ret = dict_set_iatt(this, key, iatt, false); + break; + case GF_DATA_TYPE_PTR: + value = GF_MALLOC(xpair->value.gfx_value_u.other.other_len + 1, + gf_common_mt_char); + if (!value) { + errno = ENOMEM; + goto out; + } + memcpy(value, xpair->value.gfx_value_u.other.other_val, + xpair->value.gfx_value_u.other.other_len); + value[xpair->value.gfx_value_u.other.other_len] = '\0'; + free(xpair->value.gfx_value_u.other.other_val); + ret = dict_set_dynptr(this, key, value, + xpair->value.gfx_value_u.other.other_len); + break; + default: + ret = 0; + /* Unknown type and ptr type is not sent on wire */ + break; } + if (ret) { + gf_msg_debug(THIS->name, ENOMEM, + "failed to set the key (%s) into dict", key); + } + free(xpair->key.key_val); + } - free (dict->pairs.pairs_val); - ret = 0; + free(dict->pairs.pairs_val); + ret = 0; - /* If everything is fine, assign the dictionary to target */ - *to = this; - this = NULL; + /* If everything is fine, assign the dictionary to target */ + *to = this; + this = NULL; out: - if (this) - dict_unref (this); + if (this) + dict_unref(this); - return ret; + return ret; } #endif /* !_GLUSTERFS3_H */ diff --git a/rpc/xdr/src/msg-nfs3.h b/rpc/xdr/src/msg-nfs3.h index 628daea5547..869ddc3524a 100644 --- a/rpc/xdr/src/msg-nfs3.h +++ b/rpc/xdr/src/msg-nfs3.h @@ -18,202 +18,202 @@ #include <sys/uio.h> extern ssize_t -xdr_to_mountpath (struct iovec outpath, struct iovec inmsg); +xdr_to_mountpath(struct iovec outpath, struct iovec inmsg); extern ssize_t -xdr_serialize_mountres3 (struct iovec outmsg, mountres3 *res); +xdr_serialize_mountres3(struct iovec outmsg, mountres3 *res); extern ssize_t -xdr_serialize_mountbody (struct iovec outmsg, mountbody *mb); +xdr_serialize_mountbody(struct iovec outmsg, mountbody *mb); extern ssize_t -xdr_to_getattr3args (struct iovec inmsg, getattr3args *ga); +xdr_to_getattr3args(struct iovec inmsg, getattr3args *ga); extern ssize_t -xdr_serialize_getattr3res (struct iovec outmsg, getattr3res *res); +xdr_serialize_getattr3res(struct iovec outmsg, getattr3res *res); extern ssize_t -xdr_serialize_setattr3res (struct iovec outmsg, setattr3res *res); +xdr_serialize_setattr3res(struct iovec outmsg, setattr3res *res); extern ssize_t -xdr_to_setattr3args (struct iovec inmsg, setattr3args *sa); +xdr_to_setattr3args(struct iovec inmsg, setattr3args *sa); extern ssize_t -xdr_serialize_lookup3res (struct iovec outmsg, lookup3res *res); +xdr_serialize_lookup3res(struct iovec outmsg, lookup3res *res); extern ssize_t -xdr_to_lookup3args (struct iovec inmsg, lookup3args *la); +xdr_to_lookup3args(struct iovec inmsg, lookup3args *la); extern ssize_t -xdr_to_access3args (struct iovec inmsg, access3args *ac); +xdr_to_access3args(struct iovec inmsg, access3args *ac); extern ssize_t -xdr_serialize_access3res (struct iovec outmsg, access3res *res); +xdr_serialize_access3res(struct iovec outmsg, access3res *res); extern ssize_t -xdr_to_readlink3args (struct iovec inmsg, readlink3args *ra); +xdr_to_readlink3args(struct iovec inmsg, readlink3args *ra); extern ssize_t -xdr_serialize_readlink3res (struct iovec outmsg, readlink3res *res); +xdr_serialize_readlink3res(struct iovec outmsg, readlink3res *res); extern ssize_t -xdr_to_read3args (struct iovec inmsg, read3args *ra); +xdr_to_read3args(struct iovec inmsg, read3args *ra); extern ssize_t -xdr_serialize_read3res (struct iovec outmsg, read3res *res); +xdr_serialize_read3res(struct iovec outmsg, read3res *res); extern ssize_t -xdr_serialize_read3res_nocopy (struct iovec outmsg, read3res *res); +xdr_serialize_read3res_nocopy(struct iovec outmsg, read3res *res); extern ssize_t -xdr_to_write3args (struct iovec inmsg, write3args *wa); +xdr_to_write3args(struct iovec inmsg, write3args *wa); extern ssize_t -xdr_to_write3args_nocopy (struct iovec inmsg, write3args *wa, - struct iovec *payload); +xdr_to_write3args_nocopy(struct iovec inmsg, write3args *wa, + struct iovec *payload); extern ssize_t -xdr_serialize_write3res (struct iovec outmsg, write3res *res); +xdr_serialize_write3res(struct iovec outmsg, write3res *res); extern ssize_t -xdr_to_create3args (struct iovec inmsg, create3args *ca); +xdr_to_create3args(struct iovec inmsg, create3args *ca); extern ssize_t -xdr_serialize_create3res (struct iovec outmsg, create3res *res); +xdr_serialize_create3res(struct iovec outmsg, create3res *res); extern ssize_t -xdr_serialize_mkdir3res (struct iovec outmsg, mkdir3res *res); +xdr_serialize_mkdir3res(struct iovec outmsg, mkdir3res *res); extern ssize_t -xdr_to_mkdir3args (struct iovec inmsg, mkdir3args *ma); +xdr_to_mkdir3args(struct iovec inmsg, mkdir3args *ma); extern ssize_t -xdr_to_symlink3args (struct iovec inmsg, symlink3args *sa); +xdr_to_symlink3args(struct iovec inmsg, symlink3args *sa); extern ssize_t -xdr_serialize_symlink3res (struct iovec outmsg, symlink3res *res); +xdr_serialize_symlink3res(struct iovec outmsg, symlink3res *res); extern ssize_t -xdr_to_mknod3args (struct iovec inmsg, mknod3args *ma); +xdr_to_mknod3args(struct iovec inmsg, mknod3args *ma); extern ssize_t -xdr_serialize_mknod3res (struct iovec outmsg, mknod3res *res); +xdr_serialize_mknod3res(struct iovec outmsg, mknod3res *res); extern ssize_t -xdr_to_remove3args (struct iovec inmsg, remove3args *ra); +xdr_to_remove3args(struct iovec inmsg, remove3args *ra); extern ssize_t -xdr_serialize_remove3res (struct iovec outmsg, remove3res *res); +xdr_serialize_remove3res(struct iovec outmsg, remove3res *res); extern ssize_t -xdr_to_rmdir3args (struct iovec inmsg, rmdir3args *ra); +xdr_to_rmdir3args(struct iovec inmsg, rmdir3args *ra); extern ssize_t -xdr_serialize_rmdir3res (struct iovec outmsg, rmdir3res *res); +xdr_serialize_rmdir3res(struct iovec outmsg, rmdir3res *res); extern ssize_t -xdr_serialize_rename3res (struct iovec outmsg, rename3res *res); +xdr_serialize_rename3res(struct iovec outmsg, rename3res *res); extern ssize_t -xdr_to_rename3args (struct iovec inmsg, rename3args *ra); +xdr_to_rename3args(struct iovec inmsg, rename3args *ra); extern ssize_t -xdr_serialize_link3res (struct iovec outmsg, link3res *li); +xdr_serialize_link3res(struct iovec outmsg, link3res *li); extern ssize_t -xdr_to_link3args (struct iovec inmsg, link3args *la); +xdr_to_link3args(struct iovec inmsg, link3args *la); extern ssize_t -xdr_to_readdir3args (struct iovec inmsg, readdir3args *rd); +xdr_to_readdir3args(struct iovec inmsg, readdir3args *rd); extern ssize_t -xdr_serialize_readdir3res (struct iovec outmsg, readdir3res *res); +xdr_serialize_readdir3res(struct iovec outmsg, readdir3res *res); extern ssize_t -xdr_to_readdirp3args (struct iovec inmsg, readdirp3args *rp); +xdr_to_readdirp3args(struct iovec inmsg, readdirp3args *rp); extern ssize_t -xdr_serialize_readdirp3res (struct iovec outmsg, readdirp3res *res); +xdr_serialize_readdirp3res(struct iovec outmsg, readdirp3res *res); extern ssize_t -xdr_to_fsstat3args (struct iovec inmsg, fsstat3args *fa); +xdr_to_fsstat3args(struct iovec inmsg, fsstat3args *fa); extern ssize_t -xdr_serialize_fsstat3res (struct iovec outmsg, fsstat3res *res); +xdr_serialize_fsstat3res(struct iovec outmsg, fsstat3res *res); extern ssize_t -xdr_to_fsinfo3args (struct iovec inmsg, fsinfo3args *fi); +xdr_to_fsinfo3args(struct iovec inmsg, fsinfo3args *fi); extern ssize_t -xdr_serialize_fsinfo3res (struct iovec outmsg, fsinfo3res *res); +xdr_serialize_fsinfo3res(struct iovec outmsg, fsinfo3res *res); extern ssize_t -xdr_to_pathconf3args (struct iovec inmsg, pathconf3args *pc); +xdr_to_pathconf3args(struct iovec inmsg, pathconf3args *pc); extern ssize_t -xdr_serialize_pathconf3res (struct iovec outmsg, pathconf3res *res); +xdr_serialize_pathconf3res(struct iovec outmsg, pathconf3res *res); extern ssize_t -xdr_to_commit3args (struct iovec inmsg, commit3args *ca); +xdr_to_commit3args(struct iovec inmsg, commit3args *ca); extern ssize_t -xdr_serialize_commit3res (struct iovec outmsg, commit3res *res); +xdr_serialize_commit3res(struct iovec outmsg, commit3res *res); extern ssize_t -xdr_serialize_exports (struct iovec outmsg, exports *elist); +xdr_serialize_exports(struct iovec outmsg, exports *elist); extern ssize_t -xdr_serialize_mountlist (struct iovec outmsg, mountlist *ml); +xdr_serialize_mountlist(struct iovec outmsg, mountlist *ml); extern ssize_t -xdr_serialize_mountstat3 (struct iovec outmsg, mountstat3 *m); +xdr_serialize_mountstat3(struct iovec outmsg, mountstat3 *m); extern ssize_t -xdr_serialize_nfsstat3 (struct iovec outmsg, nfsstat3 *s); +xdr_serialize_nfsstat3(struct iovec outmsg, nfsstat3 *s); extern ssize_t -xdr_to_nlm4_testargs (struct iovec inmsg, nlm4_testargs *args); +xdr_to_nlm4_testargs(struct iovec inmsg, nlm4_testargs *args); extern ssize_t -xdr_serialize_nlm4_testres (struct iovec outmsg, nlm4_testres *res); +xdr_serialize_nlm4_testres(struct iovec outmsg, nlm4_testres *res); extern ssize_t -xdr_to_nlm4_lockargs (struct iovec inmsg, nlm4_lockargs *args); +xdr_to_nlm4_lockargs(struct iovec inmsg, nlm4_lockargs *args); extern ssize_t -xdr_serialize_nlm4_res (struct iovec outmsg, nlm4_res *res); +xdr_serialize_nlm4_res(struct iovec outmsg, nlm4_res *res); extern ssize_t -xdr_to_nlm4_cancelargs (struct iovec inmsg, nlm4_cancargs *args); +xdr_to_nlm4_cancelargs(struct iovec inmsg, nlm4_cancargs *args); extern ssize_t -xdr_to_nlm4_unlockargs (struct iovec inmsg, nlm4_unlockargs *args); +xdr_to_nlm4_unlockargs(struct iovec inmsg, nlm4_unlockargs *args); extern ssize_t -xdr_to_nlm4_shareargs (struct iovec inmsg, nlm4_shareargs *args); +xdr_to_nlm4_shareargs(struct iovec inmsg, nlm4_shareargs *args); extern ssize_t -xdr_serialize_nlm4_shareres (struct iovec outmsg, nlm4_shareres *res); +xdr_serialize_nlm4_shareres(struct iovec outmsg, nlm4_shareres *res); extern ssize_t -xdr_serialize_nlm4_testargs (struct iovec outmsg, nlm4_testargs *args); +xdr_serialize_nlm4_testargs(struct iovec outmsg, nlm4_testargs *args); extern ssize_t -xdr_to_nlm4_res (struct iovec inmsg, nlm4_res *args); +xdr_to_nlm4_res(struct iovec inmsg, nlm4_res *args); extern ssize_t -xdr_to_nlm4_freeallargs (struct iovec inmsg, nlm4_freeallargs *args); +xdr_to_nlm4_freeallargs(struct iovec inmsg, nlm4_freeallargs *args); extern ssize_t -xdr_to_getaclargs (struct iovec inmsg, getaclargs *args); +xdr_to_getaclargs(struct iovec inmsg, getaclargs *args); extern ssize_t -xdr_to_setaclargs (struct iovec inmsg, setaclargs *args); +xdr_to_setaclargs(struct iovec inmsg, setaclargs *args); extern ssize_t -xdr_serialize_getaclreply (struct iovec inmsg, getaclreply *res); +xdr_serialize_getaclreply(struct iovec inmsg, getaclreply *res); extern ssize_t -xdr_serialize_setaclreply (struct iovec inmsg, setaclreply *res); +xdr_serialize_setaclreply(struct iovec inmsg, setaclreply *res); #endif diff --git a/rpc/xdr/src/xdr-generic.h b/rpc/xdr/src/xdr-generic.h index 2f12290ef02..367ef555dd3 100644 --- a/rpc/xdr/src/xdr-generic.h +++ b/rpc/xdr/src/xdr-generic.h @@ -17,12 +17,14 @@ #include "compat.h" -#define xdr_decoded_remaining_addr(xdr) ((&xdr)->x_private) -#define xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy) -#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_remaining_addr(xdr) ((&xdr)->x_private) +#define xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy) +#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_BYTES_PER_UNIT 4 +#define XDR_BYTES_PER_UNIT 4 /* On OSX > 10.9 @@ -47,29 +49,28 @@ */ #if defined(__NetBSD__) -#define PROC(xdr, res) proc(xdr, res) +#define PROC(xdr, res) proc(xdr, res) #else -#define PROC(xdr, res) proc(xdr, res, 0) +#define PROC(xdr, res) proc(xdr, res, 0) #endif ssize_t -xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc); +xdr_serialize_generic(struct iovec outmsg, void *res, xdrproc_t proc); ssize_t -xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc); +xdr_to_generic(struct iovec inmsg, void *args, xdrproc_t proc); ssize_t -xdr_to_generic_payload (struct iovec inmsg, void *args, xdrproc_t proc, - struct iovec *pendingpayload); - +xdr_to_generic_payload(struct iovec inmsg, void *args, xdrproc_t proc, + struct iovec *pendingpayload); extern int -xdr_bytes_round_up (struct iovec *vec, size_t bufsize); +xdr_bytes_round_up(struct iovec *vec, size_t bufsize); extern ssize_t -xdr_length_round_up (size_t len, size_t bufsize); +xdr_length_round_up(size_t len, size_t bufsize); void -xdr_vector_round_up (struct iovec *vec, int vcount, uint32_t count); +xdr_vector_round_up(struct iovec *vec, int vcount, uint32_t count); #endif /* !_XDR_GENERIC_H */ diff --git a/rpc/xdr/src/xdr-nfs3.h b/rpc/xdr/src/xdr-nfs3.h index 3861771e299..b7f5abefffd 100644 --- a/rpc/xdr/src/xdr-nfs3.h +++ b/rpc/xdr/src/xdr-nfs3.h @@ -14,25 +14,27 @@ #include <rpc/rpc.h> #include <sys/types.h> -#define NFS3_FHSIZE 64 -#define NFS3_COOKIEVERFSIZE 8 -#define NFS3_CREATEVERFSIZE 8 -#define NFS3_WRITEVERFSIZE 8 +#define NFS3_FHSIZE 64 +#define NFS3_COOKIEVERFSIZE 8 +#define NFS3_CREATEVERFSIZE 8 +#define NFS3_WRITEVERFSIZE 8 -#define NFS3_ENTRY3_FIXED_SIZE 24 -#define NFS3_POSTOPATTR_SIZE 88 -#define NFS3_READDIR_RESOK_SIZE (NFS3_POSTOPATTR_SIZE + sizeof (bool_t) + NFS3_COOKIEVERFSIZE) +#define NFS3_ENTRY3_FIXED_SIZE 24 +#define NFS3_POSTOPATTR_SIZE 88 +#define NFS3_READDIR_RESOK_SIZE \ + (NFS3_POSTOPATTR_SIZE + sizeof(bool_t) + NFS3_COOKIEVERFSIZE) /* In size of post_op_fh3, the length of the file handle will have to be * included separately since we have variable length fh. Here we only account * for the field for handle_follows and for the file handle length field. */ -#define NFS3_POSTOPFH3_FIXED_SIZE (sizeof (bool_t) + sizeof (uint32_t)) +#define NFS3_POSTOPFH3_FIXED_SIZE (sizeof(bool_t) + sizeof(uint32_t)) /* Similarly, the size of the entry will have to include the variable length * file handle and the length of the entry name. */ -#define NFS3_ENTRYP3_FIXED_SIZE (NFS3_ENTRY3_FIXED_SIZE + NFS3_POSTOPATTR_SIZE + NFS3_POSTOPFH3_FIXED_SIZE) +#define NFS3_ENTRYP3_FIXED_SIZE \ + (NFS3_ENTRY3_FIXED_SIZE + NFS3_POSTOPATTR_SIZE + NFS3_POSTOPFH3_FIXED_SIZE) typedef uint64_t uint64; typedef int64_t int64; @@ -52,284 +54,284 @@ typedef uint64 offset3; typedef uint32 mode3; typedef uint32 count3; -#define NFS3MODE_SETXUID 0x00800 -#define NFS3MODE_SETXGID 0x00400 -#define NFS3MODE_SAVESWAPTXT 0x00200 -#define NFS3MODE_ROWNER 0x00100 -#define NFS3MODE_WOWNER 0x00080 -#define NFS3MODE_XOWNER 0x00040 -#define NFS3MODE_RGROUP 0x00020 -#define NFS3MODE_WGROUP 0x00010 -#define NFS3MODE_XGROUP 0x00008 -#define NFS3MODE_ROTHER 0x00004 -#define NFS3MODE_WOTHER 0x00002 -#define NFS3MODE_XOTHER 0x00001 +#define NFS3MODE_SETXUID 0x00800 +#define NFS3MODE_SETXGID 0x00400 +#define NFS3MODE_SAVESWAPTXT 0x00200 +#define NFS3MODE_ROWNER 0x00100 +#define NFS3MODE_WOWNER 0x00080 +#define NFS3MODE_XOWNER 0x00040 +#define NFS3MODE_RGROUP 0x00020 +#define NFS3MODE_WGROUP 0x00010 +#define NFS3MODE_XGROUP 0x00008 +#define NFS3MODE_ROTHER 0x00004 +#define NFS3MODE_WOTHER 0x00002 +#define NFS3MODE_XOTHER 0x00001 enum nfsstat3 { - NFS3_OK = 0, - NFS3ERR_PERM = 1, - NFS3ERR_NOENT = 2, - NFS3ERR_IO = 5, - NFS3ERR_NXIO = 6, - NFS3ERR_ACCES = 13, - NFS3ERR_EXIST = 17, - NFS3ERR_XDEV = 18, - NFS3ERR_NODEV = 19, - NFS3ERR_NOTDIR = 20, - NFS3ERR_ISDIR = 21, - NFS3ERR_INVAL = 22, - NFS3ERR_FBIG = 27, - NFS3ERR_NOSPC = 28, - NFS3ERR_ROFS = 30, - NFS3ERR_MLINK = 31, - NFS3ERR_NAMETOOLONG = 63, - NFS3ERR_NOTEMPTY = 66, - NFS3ERR_DQUOT = 69, - NFS3ERR_STALE = 70, - NFS3ERR_REMOTE = 71, - NFS3ERR_BADHANDLE = 10001, - NFS3ERR_NOT_SYNC = 10002, - NFS3ERR_BAD_COOKIE = 10003, - NFS3ERR_NOTSUPP = 10004, - NFS3ERR_TOOSMALL = 10005, - NFS3ERR_SERVERFAULT = 10006, - NFS3ERR_BADTYPE = 10007, - NFS3ERR_JUKEBOX = 10008, - NFS3ERR_END_OF_LIST = -1, + NFS3_OK = 0, + NFS3ERR_PERM = 1, + NFS3ERR_NOENT = 2, + NFS3ERR_IO = 5, + NFS3ERR_NXIO = 6, + NFS3ERR_ACCES = 13, + NFS3ERR_EXIST = 17, + NFS3ERR_XDEV = 18, + NFS3ERR_NODEV = 19, + NFS3ERR_NOTDIR = 20, + NFS3ERR_ISDIR = 21, + NFS3ERR_INVAL = 22, + NFS3ERR_FBIG = 27, + NFS3ERR_NOSPC = 28, + NFS3ERR_ROFS = 30, + NFS3ERR_MLINK = 31, + NFS3ERR_NAMETOOLONG = 63, + NFS3ERR_NOTEMPTY = 66, + NFS3ERR_DQUOT = 69, + NFS3ERR_STALE = 70, + NFS3ERR_REMOTE = 71, + NFS3ERR_BADHANDLE = 10001, + NFS3ERR_NOT_SYNC = 10002, + NFS3ERR_BAD_COOKIE = 10003, + NFS3ERR_NOTSUPP = 10004, + NFS3ERR_TOOSMALL = 10005, + NFS3ERR_SERVERFAULT = 10006, + NFS3ERR_BADTYPE = 10007, + NFS3ERR_JUKEBOX = 10008, + NFS3ERR_END_OF_LIST = -1, }; typedef enum nfsstat3 nfsstat3; enum ftype3 { - NF3REG = 1, - NF3DIR = 2, - NF3BLK = 3, - NF3CHR = 4, - NF3LNK = 5, - NF3SOCK = 6, - NF3FIFO = 7, + NF3REG = 1, + NF3DIR = 2, + NF3BLK = 3, + NF3CHR = 4, + NF3LNK = 5, + NF3SOCK = 6, + NF3FIFO = 7, }; typedef enum ftype3 ftype3; struct specdata3 { - uint32 specdata1; - uint32 specdata2; + uint32 specdata1; + uint32 specdata2; }; typedef struct specdata3 specdata3; struct nfs_fh3 { - struct { - u_int data_len; - char *data_val; - } data; + struct { + u_int data_len; + char *data_val; + } data; }; typedef struct nfs_fh3 nfs_fh3; struct nfstime3 { - uint32 seconds; - uint32 nseconds; + uint32 seconds; + uint32 nseconds; }; typedef struct nfstime3 nfstime3; struct fattr3 { - ftype3 type; - mode3 mode; - uint32 nlink; - uid3 uid; - gid3 gid; - size3 size; - size3 used; - specdata3 rdev; - uint64 fsid; - fileid3 fileid; - nfstime3 atime; - nfstime3 mtime; - nfstime3 ctime; + ftype3 type; + mode3 mode; + uint32 nlink; + uid3 uid; + gid3 gid; + size3 size; + size3 used; + specdata3 rdev; + uint64 fsid; + fileid3 fileid; + nfstime3 atime; + nfstime3 mtime; + nfstime3 ctime; }; typedef struct fattr3 fattr3; struct post_op_attr { - bool_t attributes_follow; - union { - fattr3 attributes; - } post_op_attr_u; + bool_t attributes_follow; + union { + fattr3 attributes; + } post_op_attr_u; }; typedef struct post_op_attr post_op_attr; struct wcc_attr { - size3 size; - nfstime3 mtime; - nfstime3 ctime; + size3 size; + nfstime3 mtime; + nfstime3 ctime; }; typedef struct wcc_attr wcc_attr; struct pre_op_attr { - bool_t attributes_follow; - union { - wcc_attr attributes; - } pre_op_attr_u; + bool_t attributes_follow; + union { + wcc_attr attributes; + } pre_op_attr_u; }; typedef struct pre_op_attr pre_op_attr; struct wcc_data { - pre_op_attr before; - post_op_attr after; + pre_op_attr before; + post_op_attr after; }; typedef struct wcc_data wcc_data; struct post_op_fh3 { - bool_t handle_follows; - union { - nfs_fh3 handle; - } post_op_fh3_u; + bool_t handle_follows; + union { + nfs_fh3 handle; + } post_op_fh3_u; }; typedef struct post_op_fh3 post_op_fh3; enum time_how { - DONT_CHANGE = 0, - SET_TO_SERVER_TIME = 1, - SET_TO_CLIENT_TIME = 2, + DONT_CHANGE = 0, + SET_TO_SERVER_TIME = 1, + SET_TO_CLIENT_TIME = 2, }; typedef enum time_how time_how; struct set_mode3 { - bool_t set_it; - union { - mode3 mode; - } set_mode3_u; + bool_t set_it; + union { + mode3 mode; + } set_mode3_u; }; typedef struct set_mode3 set_mode3; struct set_uid3 { - bool_t set_it; - union { - uid3 uid; - } set_uid3_u; + bool_t set_it; + union { + uid3 uid; + } set_uid3_u; }; typedef struct set_uid3 set_uid3; struct set_gid3 { - bool_t set_it; - union { - gid3 gid; - } set_gid3_u; + bool_t set_it; + union { + gid3 gid; + } set_gid3_u; }; typedef struct set_gid3 set_gid3; struct set_size3 { - bool_t set_it; - union { - size3 size; - } set_size3_u; + bool_t set_it; + union { + size3 size; + } set_size3_u; }; typedef struct set_size3 set_size3; struct set_atime { - time_how set_it; - union { - nfstime3 atime; - } set_atime_u; + time_how set_it; + union { + nfstime3 atime; + } set_atime_u; }; typedef struct set_atime set_atime; struct set_mtime { - time_how set_it; - union { - nfstime3 mtime; - } set_mtime_u; + time_how set_it; + union { + nfstime3 mtime; + } set_mtime_u; }; typedef struct set_mtime set_mtime; struct sattr3 { - set_mode3 mode; - set_uid3 uid; - set_gid3 gid; - set_size3 size; - set_atime atime; - set_mtime mtime; + set_mode3 mode; + set_uid3 uid; + set_gid3 gid; + set_size3 size; + set_atime atime; + set_mtime mtime; }; typedef struct sattr3 sattr3; struct diropargs3 { - nfs_fh3 dir; - filename3 name; + nfs_fh3 dir; + filename3 name; }; typedef struct diropargs3 diropargs3; struct getattr3args { - nfs_fh3 object; + nfs_fh3 object; }; typedef struct getattr3args getattr3args; struct getattr3resok { - fattr3 obj_attributes; + fattr3 obj_attributes; }; typedef struct getattr3resok getattr3resok; struct getattr3res { - nfsstat3 status; - union { - getattr3resok resok; - } getattr3res_u; + nfsstat3 status; + union { + getattr3resok resok; + } getattr3res_u; }; typedef struct getattr3res getattr3res; struct sattrguard3 { - bool_t check; - union { - nfstime3 obj_ctime; - } sattrguard3_u; + bool_t check; + union { + nfstime3 obj_ctime; + } sattrguard3_u; }; typedef struct sattrguard3 sattrguard3; struct setattr3args { - nfs_fh3 object; - sattr3 new_attributes; - sattrguard3 guard; + nfs_fh3 object; + sattr3 new_attributes; + sattrguard3 guard; }; typedef struct setattr3args setattr3args; struct setattr3resok { - wcc_data obj_wcc; + wcc_data obj_wcc; }; typedef struct setattr3resok setattr3resok; struct setattr3resfail { - wcc_data obj_wcc; + wcc_data obj_wcc; }; typedef struct setattr3resfail setattr3resfail; struct setattr3res { - nfsstat3 status; - union { - setattr3resok resok; - setattr3resfail resfail; - } setattr3res_u; + nfsstat3 status; + union { + setattr3resok resok; + setattr3resfail resfail; + } setattr3res_u; }; typedef struct setattr3res setattr3res; struct lookup3args { - diropargs3 what; + diropargs3 what; }; typedef struct lookup3args lookup3args; struct lookup3resok { - nfs_fh3 object; - post_op_attr obj_attributes; - post_op_attr dir_attributes; + nfs_fh3 object; + post_op_attr obj_attributes; + post_op_attr dir_attributes; }; typedef struct lookup3resok lookup3resok; struct lookup3resfail { - post_op_attr dir_attributes; + post_op_attr dir_attributes; }; typedef struct lookup3resfail lookup3resfail; struct lookup3res { - nfsstat3 status; - union { - lookup3resok resok; - lookup3resfail resfail; - } lookup3res_u; + nfsstat3 status; + union { + lookup3resok resok; + lookup3resfail resfail; + } lookup3res_u; }; typedef struct lookup3res lookup3res; #define ACCESS3_READ 0x0001 @@ -340,104 +342,104 @@ typedef struct lookup3res lookup3res; #define ACCESS3_EXECUTE 0x0020 struct access3args { - nfs_fh3 object; - uint32 access; + nfs_fh3 object; + uint32 access; }; typedef struct access3args access3args; struct access3resok { - post_op_attr obj_attributes; - uint32 access; + post_op_attr obj_attributes; + uint32 access; }; typedef struct access3resok access3resok; struct access3resfail { - post_op_attr obj_attributes; + post_op_attr obj_attributes; }; typedef struct access3resfail access3resfail; struct access3res { - nfsstat3 status; - union { - access3resok resok; - access3resfail resfail; - } access3res_u; + nfsstat3 status; + union { + access3resok resok; + access3resfail resfail; + } access3res_u; }; typedef struct access3res access3res; struct readlink3args { - nfs_fh3 symlink; + nfs_fh3 symlink; }; typedef struct readlink3args readlink3args; struct readlink3resok { - post_op_attr symlink_attributes; - nfspath3 data; + post_op_attr symlink_attributes; + nfspath3 data; }; typedef struct readlink3resok readlink3resok; struct readlink3resfail { - post_op_attr symlink_attributes; + post_op_attr symlink_attributes; }; typedef struct readlink3resfail readlink3resfail; struct readlink3res { - nfsstat3 status; - union { - readlink3resok resok; - readlink3resfail resfail; - } readlink3res_u; + nfsstat3 status; + union { + readlink3resok resok; + readlink3resfail resfail; + } readlink3res_u; }; typedef struct readlink3res readlink3res; struct read3args { - nfs_fh3 file; - offset3 offset; - count3 count; + nfs_fh3 file; + offset3 offset; + count3 count; }; typedef struct read3args read3args; struct read3resok { - post_op_attr file_attributes; - count3 count; - bool_t eof; - struct { - u_int data_len; - char *data_val; - } data; + post_op_attr file_attributes; + count3 count; + bool_t eof; + struct { + u_int data_len; + char *data_val; + } data; }; typedef struct read3resok read3resok; struct read3resfail { - post_op_attr file_attributes; + post_op_attr file_attributes; }; typedef struct read3resfail read3resfail; struct read3res { - nfsstat3 status; - union { - read3resok resok; - read3resfail resfail; - } read3res_u; + nfsstat3 status; + union { + read3resok resok; + read3resfail resfail; + } read3res_u; }; typedef struct read3res read3res; enum stable_how { - UNSTABLE = 0, - DATA_SYNC = 1, - FILE_SYNC = 2, + UNSTABLE = 0, + DATA_SYNC = 1, + FILE_SYNC = 2, }; typedef enum stable_how stable_how; struct write3args { - nfs_fh3 file; - offset3 offset; - count3 count; - stable_how stable; - struct { - u_int data_len; - char *data_val; - } data; + nfs_fh3 file; + offset3 offset; + count3 count; + stable_how stable; + struct { + u_int data_len; + char *data_val; + } data; }; typedef struct write3args write3args; @@ -446,393 +448,395 @@ typedef struct write3args write3args; * sizeof (nfs_fh3) rather than first trying to extract the fh size of the * network followed by a sized-read of the file handle. */ -#define NFS3_WRITE3ARGS_SIZE (sizeof (uint32_t) + NFS3_FHSIZE + sizeof (offset3) + sizeof (count3) + sizeof (uint32_t)) +#define NFS3_WRITE3ARGS_SIZE \ + (sizeof(uint32_t) + NFS3_FHSIZE + sizeof(offset3) + sizeof(count3) + \ + sizeof(uint32_t)) struct write3resok { - wcc_data file_wcc; - count3 count; - stable_how committed; - writeverf3 verf; + wcc_data file_wcc; + count3 count; + stable_how committed; + writeverf3 verf; }; typedef struct write3resok write3resok; struct write3resfail { - wcc_data file_wcc; + wcc_data file_wcc; }; typedef struct write3resfail write3resfail; struct write3res { - nfsstat3 status; - union { - write3resok resok; - write3resfail resfail; - } write3res_u; + nfsstat3 status; + union { + write3resok resok; + write3resfail resfail; + } write3res_u; }; typedef struct write3res write3res; enum createmode3 { - UNCHECKED = 0, - GUARDED = 1, - EXCLUSIVE = 2, + UNCHECKED = 0, + GUARDED = 1, + EXCLUSIVE = 2, }; typedef enum createmode3 createmode3; struct createhow3 { - createmode3 mode; - union { - sattr3 obj_attributes; - createverf3 verf; - } createhow3_u; + createmode3 mode; + union { + sattr3 obj_attributes; + createverf3 verf; + } createhow3_u; }; typedef struct createhow3 createhow3; struct create3args { - diropargs3 where; - createhow3 how; + diropargs3 where; + createhow3 how; }; typedef struct create3args create3args; struct create3resok { - post_op_fh3 obj; - post_op_attr obj_attributes; - wcc_data dir_wcc; + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; }; typedef struct create3resok create3resok; struct create3resfail { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct create3resfail create3resfail; struct create3res { - nfsstat3 status; - union { - create3resok resok; - create3resfail resfail; - } create3res_u; + nfsstat3 status; + union { + create3resok resok; + create3resfail resfail; + } create3res_u; }; typedef struct create3res create3res; struct mkdir3args { - diropargs3 where; - sattr3 attributes; + diropargs3 where; + sattr3 attributes; }; typedef struct mkdir3args mkdir3args; struct mkdir3resok { - post_op_fh3 obj; - post_op_attr obj_attributes; - wcc_data dir_wcc; + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; }; typedef struct mkdir3resok mkdir3resok; struct mkdir3resfail { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct mkdir3resfail mkdir3resfail; struct mkdir3res { - nfsstat3 status; - union { - mkdir3resok resok; - mkdir3resfail resfail; - } mkdir3res_u; + nfsstat3 status; + union { + mkdir3resok resok; + mkdir3resfail resfail; + } mkdir3res_u; }; typedef struct mkdir3res mkdir3res; struct symlinkdata3 { - sattr3 symlink_attributes; - nfspath3 symlink_data; + sattr3 symlink_attributes; + nfspath3 symlink_data; }; typedef struct symlinkdata3 symlinkdata3; struct symlink3args { - diropargs3 where; - symlinkdata3 symlink; + diropargs3 where; + symlinkdata3 symlink; }; typedef struct symlink3args symlink3args; struct symlink3resok { - post_op_fh3 obj; - post_op_attr obj_attributes; - wcc_data dir_wcc; + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; }; typedef struct symlink3resok symlink3resok; struct symlink3resfail { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct symlink3resfail symlink3resfail; struct symlink3res { - nfsstat3 status; - union { - symlink3resok resok; - symlink3resfail resfail; - } symlink3res_u; + nfsstat3 status; + union { + symlink3resok resok; + symlink3resfail resfail; + } symlink3res_u; }; typedef struct symlink3res symlink3res; struct devicedata3 { - sattr3 dev_attributes; - specdata3 spec; + sattr3 dev_attributes; + specdata3 spec; }; typedef struct devicedata3 devicedata3; struct mknoddata3 { - ftype3 type; - union { - devicedata3 device; - sattr3 pipe_attributes; - } mknoddata3_u; + ftype3 type; + union { + devicedata3 device; + sattr3 pipe_attributes; + } mknoddata3_u; }; typedef struct mknoddata3 mknoddata3; struct mknod3args { - diropargs3 where; - mknoddata3 what; + diropargs3 where; + mknoddata3 what; }; typedef struct mknod3args mknod3args; struct mknod3resok { - post_op_fh3 obj; - post_op_attr obj_attributes; - wcc_data dir_wcc; + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; }; typedef struct mknod3resok mknod3resok; struct mknod3resfail { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct mknod3resfail mknod3resfail; struct mknod3res { - nfsstat3 status; - union { - mknod3resok resok; - mknod3resfail resfail; - } mknod3res_u; + nfsstat3 status; + union { + mknod3resok resok; + mknod3resfail resfail; + } mknod3res_u; }; typedef struct mknod3res mknod3res; struct remove3args { - diropargs3 object; + diropargs3 object; }; typedef struct remove3args remove3args; struct remove3resok { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct remove3resok remove3resok; struct remove3resfail { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct remove3resfail remove3resfail; struct remove3res { - nfsstat3 status; - union { - remove3resok resok; - remove3resfail resfail; - } remove3res_u; + nfsstat3 status; + union { + remove3resok resok; + remove3resfail resfail; + } remove3res_u; }; typedef struct remove3res remove3res; struct rmdir3args { - diropargs3 object; + diropargs3 object; }; typedef struct rmdir3args rmdir3args; struct rmdir3resok { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct rmdir3resok rmdir3resok; struct rmdir3resfail { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct rmdir3resfail rmdir3resfail; struct rmdir3res { - nfsstat3 status; - union { - rmdir3resok resok; - rmdir3resfail resfail; - } rmdir3res_u; + nfsstat3 status; + union { + rmdir3resok resok; + rmdir3resfail resfail; + } rmdir3res_u; }; typedef struct rmdir3res rmdir3res; struct rename3args { - diropargs3 from; - diropargs3 to; + diropargs3 from; + diropargs3 to; }; typedef struct rename3args rename3args; struct rename3resok { - wcc_data fromdir_wcc; - wcc_data todir_wcc; + wcc_data fromdir_wcc; + wcc_data todir_wcc; }; typedef struct rename3resok rename3resok; struct rename3resfail { - wcc_data fromdir_wcc; - wcc_data todir_wcc; + wcc_data fromdir_wcc; + wcc_data todir_wcc; }; typedef struct rename3resfail rename3resfail; struct rename3res { - nfsstat3 status; - union { - rename3resok resok; - rename3resfail resfail; - } rename3res_u; + nfsstat3 status; + union { + rename3resok resok; + rename3resfail resfail; + } rename3res_u; }; typedef struct rename3res rename3res; struct link3args { - nfs_fh3 file; - diropargs3 link; + nfs_fh3 file; + diropargs3 link; }; typedef struct link3args link3args; struct link3resok { - post_op_attr file_attributes; - wcc_data linkdir_wcc; + post_op_attr file_attributes; + wcc_data linkdir_wcc; }; typedef struct link3resok link3resok; struct link3resfail { - post_op_attr file_attributes; - wcc_data linkdir_wcc; + post_op_attr file_attributes; + wcc_data linkdir_wcc; }; typedef struct link3resfail link3resfail; struct link3res { - nfsstat3 status; - union { - link3resok resok; - link3resfail resfail; - } link3res_u; + nfsstat3 status; + union { + link3resok resok; + link3resfail resfail; + } link3res_u; }; typedef struct link3res link3res; struct readdir3args { - nfs_fh3 dir; - cookie3 cookie; - cookieverf3 cookieverf; - count3 count; + nfs_fh3 dir; + cookie3 cookie; + cookieverf3 cookieverf; + count3 count; }; typedef struct readdir3args readdir3args; struct entry3 { - fileid3 fileid; - filename3 name; - cookie3 cookie; - struct entry3 *nextentry; + fileid3 fileid; + filename3 name; + cookie3 cookie; + struct entry3 *nextentry; }; typedef struct entry3 entry3; struct dirlist3 { - entry3 *entries; - bool_t eof; + entry3 *entries; + bool_t eof; }; typedef struct dirlist3 dirlist3; struct readdir3resok { - post_op_attr dir_attributes; - cookieverf3 cookieverf; - dirlist3 reply; + post_op_attr dir_attributes; + cookieverf3 cookieverf; + dirlist3 reply; }; typedef struct readdir3resok readdir3resok; struct readdir3resfail { - post_op_attr dir_attributes; + post_op_attr dir_attributes; }; typedef struct readdir3resfail readdir3resfail; struct readdir3res { - nfsstat3 status; - union { - readdir3resok resok; - readdir3resfail resfail; - } readdir3res_u; + nfsstat3 status; + union { + readdir3resok resok; + readdir3resfail resfail; + } readdir3res_u; }; typedef struct readdir3res readdir3res; struct readdirp3args { - nfs_fh3 dir; - cookie3 cookie; - cookieverf3 cookieverf; - count3 dircount; - count3 maxcount; + nfs_fh3 dir; + cookie3 cookie; + cookieverf3 cookieverf; + count3 dircount; + count3 maxcount; }; typedef struct readdirp3args readdirp3args; struct entryp3 { - fileid3 fileid; - filename3 name; - cookie3 cookie; - post_op_attr name_attributes; - post_op_fh3 name_handle; - struct entryp3 *nextentry; + fileid3 fileid; + filename3 name; + cookie3 cookie; + post_op_attr name_attributes; + post_op_fh3 name_handle; + struct entryp3 *nextentry; }; typedef struct entryp3 entryp3; struct dirlistp3 { - entryp3 *entries; - bool_t eof; + entryp3 *entries; + bool_t eof; }; typedef struct dirlistp3 dirlistp3; struct readdirp3resok { - post_op_attr dir_attributes; - cookieverf3 cookieverf; - dirlistp3 reply; + post_op_attr dir_attributes; + cookieverf3 cookieverf; + dirlistp3 reply; }; typedef struct readdirp3resok readdirp3resok; struct readdirp3resfail { - post_op_attr dir_attributes; + post_op_attr dir_attributes; }; typedef struct readdirp3resfail readdirp3resfail; struct readdirp3res { - nfsstat3 status; - union { - readdirp3resok resok; - readdirp3resfail resfail; - } readdirp3res_u; + nfsstat3 status; + union { + readdirp3resok resok; + readdirp3resfail resfail; + } readdirp3res_u; }; typedef struct readdirp3res readdirp3res; struct fsstat3args { - nfs_fh3 fsroot; + nfs_fh3 fsroot; }; typedef struct fsstat3args fsstat3args; struct fsstat3resok { - post_op_attr obj_attributes; - size3 tbytes; - size3 fbytes; - size3 abytes; - size3 tfiles; - size3 ffiles; - size3 afiles; - uint32 invarsec; + post_op_attr obj_attributes; + size3 tbytes; + size3 fbytes; + size3 abytes; + size3 tfiles; + size3 ffiles; + size3 afiles; + uint32 invarsec; }; typedef struct fsstat3resok fsstat3resok; struct fsstat3resfail { - post_op_attr obj_attributes; + post_op_attr obj_attributes; }; typedef struct fsstat3resfail fsstat3resfail; struct fsstat3res { - nfsstat3 status; - union { - fsstat3resok resok; - fsstat3resfail resfail; - } fsstat3res_u; + nfsstat3 status; + union { + fsstat3resok resok; + fsstat3resfail resfail; + } fsstat3res_u; }; typedef struct fsstat3res fsstat3res; #define FSF3_LINK 0x0001 @@ -841,93 +845,93 @@ typedef struct fsstat3res fsstat3res; #define FSF3_CANSETTIME 0x0010 struct fsinfo3args { - nfs_fh3 fsroot; + nfs_fh3 fsroot; }; typedef struct fsinfo3args fsinfo3args; struct fsinfo3resok { - post_op_attr obj_attributes; - uint32 rtmax; - uint32 rtpref; - uint32 rtmult; - uint32 wtmax; - uint32 wtpref; - uint32 wtmult; - uint32 dtpref; - size3 maxfilesize; - nfstime3 time_delta; - uint32 properties; + post_op_attr obj_attributes; + uint32 rtmax; + uint32 rtpref; + uint32 rtmult; + uint32 wtmax; + uint32 wtpref; + uint32 wtmult; + uint32 dtpref; + size3 maxfilesize; + nfstime3 time_delta; + uint32 properties; }; typedef struct fsinfo3resok fsinfo3resok; struct fsinfo3resfail { - post_op_attr obj_attributes; + post_op_attr obj_attributes; }; typedef struct fsinfo3resfail fsinfo3resfail; struct fsinfo3res { - nfsstat3 status; - union { - fsinfo3resok resok; - fsinfo3resfail resfail; - } fsinfo3res_u; + nfsstat3 status; + union { + fsinfo3resok resok; + fsinfo3resfail resfail; + } fsinfo3res_u; }; typedef struct fsinfo3res fsinfo3res; struct pathconf3args { - nfs_fh3 object; + nfs_fh3 object; }; typedef struct pathconf3args pathconf3args; struct pathconf3resok { - post_op_attr obj_attributes; - uint32 linkmax; - uint32 name_max; - bool_t no_trunc; - bool_t chown_restricted; - bool_t case_insensitive; - bool_t case_preserving; + post_op_attr obj_attributes; + uint32 linkmax; + uint32 name_max; + bool_t no_trunc; + bool_t chown_restricted; + bool_t case_insensitive; + bool_t case_preserving; }; typedef struct pathconf3resok pathconf3resok; struct pathconf3resfail { - post_op_attr obj_attributes; + post_op_attr obj_attributes; }; typedef struct pathconf3resfail pathconf3resfail; struct pathconf3res { - nfsstat3 status; - union { - pathconf3resok resok; - pathconf3resfail resfail; - } pathconf3res_u; + nfsstat3 status; + union { + pathconf3resok resok; + pathconf3resfail resfail; + } pathconf3res_u; }; typedef struct pathconf3res pathconf3res; struct commit3args { - nfs_fh3 file; - offset3 offset; - count3 count; + nfs_fh3 file; + offset3 offset; + count3 count; }; typedef struct commit3args commit3args; struct commit3resok { - wcc_data file_wcc; - writeverf3 verf; + wcc_data file_wcc; + writeverf3 verf; }; typedef struct commit3resok commit3resok; struct commit3resfail { - wcc_data file_wcc; + wcc_data file_wcc; }; typedef struct commit3resfail commit3resfail; struct commit3res { - nfsstat3 status; - union { - commit3resok resok; - commit3resfail resfail; - } commit3res_u; + nfsstat3 status; + union { + commit3resok resok; + commit3resfail resfail; + } commit3res_u; }; typedef struct commit3res commit3res; #define MNTPATHLEN 1024 @@ -935,8 +939,8 @@ typedef struct commit3res commit3res; #define FHSIZE3 NFS3_FHSIZE typedef struct { - u_int fhandle3_len; - char *fhandle3_val; + u_int fhandle3_len; + char *fhandle3_val; } fhandle3; typedef char *dirpath; @@ -944,257 +948,404 @@ typedef char *dirpath; typedef char *name; enum mountstat3 { - MNT3_OK = 0, - MNT3ERR_PERM = 1, - MNT3ERR_NOENT = 2, - MNT3ERR_IO = 5, - MNT3ERR_ACCES = 13, - MNT3ERR_NOTDIR = 20, - MNT3ERR_INVAL = 22, - MNT3ERR_NAMETOOLONG = 63, - MNT3ERR_NOTSUPP = 10004, - MNT3ERR_SERVERFAULT = 10006, + MNT3_OK = 0, + MNT3ERR_PERM = 1, + MNT3ERR_NOENT = 2, + MNT3ERR_IO = 5, + MNT3ERR_ACCES = 13, + MNT3ERR_NOTDIR = 20, + MNT3ERR_INVAL = 22, + MNT3ERR_NAMETOOLONG = 63, + MNT3ERR_NOTSUPP = 10004, + MNT3ERR_SERVERFAULT = 10006, }; typedef enum mountstat3 mountstat3; struct mountres3_ok { - fhandle3 fhandle; - struct { - u_int auth_flavors_len; - int *auth_flavors_val; - } auth_flavors; + fhandle3 fhandle; + struct { + u_int auth_flavors_len; + int *auth_flavors_val; + } auth_flavors; }; typedef struct mountres3_ok mountres3_ok; struct mountres3 { - mountstat3 fhs_status; - union { - mountres3_ok mountinfo; - } mountres3_u; + mountstat3 fhs_status; + union { + mountres3_ok mountinfo; + } mountres3_u; }; typedef struct mountres3 mountres3; typedef struct mountbody *mountlist; struct mountbody { - name ml_hostname; - dirpath ml_directory; - mountlist ml_next; + name ml_hostname; + dirpath ml_directory; + mountlist ml_next; }; typedef struct mountbody mountbody; typedef struct groupnode *groups; struct groupnode { - name gr_name; - groups gr_next; + name gr_name; + groups gr_next; }; typedef struct groupnode groupnode; typedef struct exportnode *exports; struct exportnode { - dirpath ex_dir; - groups ex_groups; - exports ex_next; + dirpath ex_dir; + groups ex_groups; + exports ex_next; }; typedef struct exportnode exportnode; -#define NFS_PROGRAM 100003 -#define NFS_V3 3 - -#define NFS3_NULL 0 -#define NFS3_GETATTR 1 -#define NFS3_SETATTR 2 -#define NFS3_LOOKUP 3 -#define NFS3_ACCESS 4 -#define NFS3_READLINK 5 -#define NFS3_READ 6 -#define NFS3_WRITE 7 -#define NFS3_CREATE 8 -#define NFS3_MKDIR 9 -#define NFS3_SYMLINK 10 -#define NFS3_MKNOD 11 -#define NFS3_REMOVE 12 -#define NFS3_RMDIR 13 -#define NFS3_RENAME 14 -#define NFS3_LINK 15 -#define NFS3_READDIR 16 -#define NFS3_READDIRP 17 -#define NFS3_FSSTAT 18 -#define NFS3_FSINFO 19 -#define NFS3_PATHCONF 20 -#define NFS3_COMMIT 21 -#define NFS3_PROC_COUNT 22 - -#define MOUNT_PROGRAM 100005 -#define MOUNT_V3 3 -#define MOUNT_V1 1 - -#define MOUNT3_NULL 0 -#define MOUNT3_MNT 1 -#define MOUNT3_DUMP 2 -#define MOUNT3_UMNT 3 -#define MOUNT3_UMNTALL 4 -#define MOUNT3_EXPORT 5 -#define MOUNT3_PROC_COUNT 6 - -#define MOUNT1_NULL 0 -#define MOUNT1_MNT 1 -#define MOUNT1_DUMP 2 -#define MOUNT1_UMNT 3 -#define MOUNT1_UMNTALL 4 -#define MOUNT1_EXPORT 5 -#define MOUNT1_PROC_COUNT 6 +#define NFS_PROGRAM 100003 +#define NFS_V3 3 + +#define NFS3_NULL 0 +#define NFS3_GETATTR 1 +#define NFS3_SETATTR 2 +#define NFS3_LOOKUP 3 +#define NFS3_ACCESS 4 +#define NFS3_READLINK 5 +#define NFS3_READ 6 +#define NFS3_WRITE 7 +#define NFS3_CREATE 8 +#define NFS3_MKDIR 9 +#define NFS3_SYMLINK 10 +#define NFS3_MKNOD 11 +#define NFS3_REMOVE 12 +#define NFS3_RMDIR 13 +#define NFS3_RENAME 14 +#define NFS3_LINK 15 +#define NFS3_READDIR 16 +#define NFS3_READDIRP 17 +#define NFS3_FSSTAT 18 +#define NFS3_FSINFO 19 +#define NFS3_PATHCONF 20 +#define NFS3_COMMIT 21 +#define NFS3_PROC_COUNT 22 + +#define MOUNT_PROGRAM 100005 +#define MOUNT_V3 3 +#define MOUNT_V1 1 + +#define MOUNT3_NULL 0 +#define MOUNT3_MNT 1 +#define MOUNT3_DUMP 2 +#define MOUNT3_UMNT 3 +#define MOUNT3_UMNTALL 4 +#define MOUNT3_EXPORT 5 +#define MOUNT3_PROC_COUNT 6 + +#define MOUNT1_NULL 0 +#define MOUNT1_MNT 1 +#define MOUNT1_DUMP 2 +#define MOUNT1_UMNT 3 +#define MOUNT1_UMNTALL 4 +#define MOUNT1_EXPORT 5 +#define MOUNT1_PROC_COUNT 6 /* the xdr functions */ -extern bool_t xdr_uint64 (XDR *, uint64*); -extern bool_t xdr_int64 (XDR *, int64*); -extern bool_t xdr_uint32 (XDR *, uint32*); -extern bool_t xdr_int32 (XDR *, int32*); -extern bool_t xdr_filename3 (XDR *, filename3*); -extern bool_t xdr_nfspath3 (XDR *, nfspath3*); -extern bool_t xdr_fileid3 (XDR *, fileid3*); -extern bool_t xdr_cookie3 (XDR *, cookie3*); -extern bool_t xdr_cookieverf3 (XDR *, cookieverf3); -extern bool_t xdr_createverf3 (XDR *, createverf3); -extern bool_t xdr_writeverf3 (XDR *, writeverf3); -extern bool_t xdr_uid3 (XDR *, uid3*); -extern bool_t xdr_gid3 (XDR *, gid3*); -extern bool_t xdr_size3 (XDR *, size3*); -extern bool_t xdr_offset3 (XDR *, offset3*); -extern bool_t xdr_mode3 (XDR *, mode3*); -extern bool_t xdr_count3 (XDR *, count3*); -extern bool_t xdr_nfsstat3 (XDR *, nfsstat3*); -extern bool_t xdr_ftype3 (XDR *, ftype3*); -extern bool_t xdr_specdata3 (XDR *, specdata3*); -extern bool_t xdr_nfs_fh3 (XDR *, nfs_fh3*); -extern bool_t xdr_nfstime3 (XDR *, nfstime3*); -extern bool_t xdr_fattr3 (XDR *, fattr3*); -extern bool_t xdr_post_op_attr (XDR *, post_op_attr*); -extern bool_t xdr_wcc_attr (XDR *, wcc_attr*); -extern bool_t xdr_pre_op_attr (XDR *, pre_op_attr*); -extern bool_t xdr_wcc_data (XDR *, wcc_data*); -extern bool_t xdr_post_op_fh3 (XDR *, post_op_fh3*); -extern bool_t xdr_time_how (XDR *, time_how*); -extern bool_t xdr_set_mode3 (XDR *, set_mode3*); -extern bool_t xdr_set_uid3 (XDR *, set_uid3*); -extern bool_t xdr_set_gid3 (XDR *, set_gid3*); -extern bool_t xdr_set_size3 (XDR *, set_size3*); -extern bool_t xdr_set_atime (XDR *, set_atime*); -extern bool_t xdr_set_mtime (XDR *, set_mtime*); -extern bool_t xdr_sattr3 (XDR *, sattr3*); -extern bool_t xdr_diropargs3 (XDR *, diropargs3*); -extern bool_t xdr_getattr3args (XDR *, getattr3args*); -extern bool_t xdr_getattr3resok (XDR *, getattr3resok*); -extern bool_t xdr_getattr3res (XDR *, getattr3res*); -extern bool_t xdr_sattrguard3 (XDR *, sattrguard3*); -extern bool_t xdr_setattr3args (XDR *, setattr3args*); -extern bool_t xdr_setattr3resok (XDR *, setattr3resok*); -extern bool_t xdr_setattr3resfail (XDR *, setattr3resfail*); -extern bool_t xdr_setattr3res (XDR *, setattr3res*); -extern bool_t xdr_lookup3args (XDR *, lookup3args*); -extern bool_t xdr_lookup3resok (XDR *, lookup3resok*); -extern bool_t xdr_lookup3resfail (XDR *, lookup3resfail*); -extern bool_t xdr_lookup3res (XDR *, lookup3res*); -extern bool_t xdr_access3args (XDR *, access3args*); -extern bool_t xdr_access3resok (XDR *, access3resok*); -extern bool_t xdr_access3resfail (XDR *, access3resfail*); -extern bool_t xdr_access3res (XDR *, access3res*); -extern bool_t xdr_readlink3args (XDR *, readlink3args*); -extern bool_t xdr_readlink3resok (XDR *, readlink3resok*); -extern bool_t xdr_readlink3resfail (XDR *, readlink3resfail*); -extern bool_t xdr_readlink3res (XDR *, readlink3res*); -extern bool_t xdr_read3args (XDR *, read3args*); -extern bool_t xdr_read3resok (XDR *, read3resok*); -extern bool_t xdr_read3resfail (XDR *, read3resfail*); -extern bool_t xdr_read3res (XDR *, read3res*); -extern bool_t xdr_read3res_nocopy (XDR *xdrs, read3res *objp); -extern bool_t xdr_stable_how (XDR *, stable_how*); -extern bool_t xdr_write3args (XDR *, write3args*); -extern bool_t xdr_write3resok (XDR *, write3resok*); -extern bool_t xdr_write3resfail (XDR *, write3resfail*); -extern bool_t xdr_write3res (XDR *, write3res*); -extern bool_t xdr_createmode3 (XDR *, createmode3*); -extern bool_t xdr_createhow3 (XDR *, createhow3*); -extern bool_t xdr_create3args (XDR *, create3args*); -extern bool_t xdr_create3resok (XDR *, create3resok*); -extern bool_t xdr_create3resfail (XDR *, create3resfail*); -extern bool_t xdr_create3res (XDR *, create3res*); -extern bool_t xdr_mkdir3args (XDR *, mkdir3args*); -extern bool_t xdr_mkdir3resok (XDR *, mkdir3resok*); -extern bool_t xdr_mkdir3resfail (XDR *, mkdir3resfail*); -extern bool_t xdr_mkdir3res (XDR *, mkdir3res*); -extern bool_t xdr_symlinkdata3 (XDR *, symlinkdata3*); -extern bool_t xdr_symlink3args (XDR *, symlink3args*); -extern bool_t xdr_symlink3resok (XDR *, symlink3resok*); -extern bool_t xdr_symlink3resfail (XDR *, symlink3resfail*); -extern bool_t xdr_symlink3res (XDR *, symlink3res*); -extern bool_t xdr_devicedata3 (XDR *, devicedata3*); -extern bool_t xdr_mknoddata3 (XDR *, mknoddata3*); -extern bool_t xdr_mknod3args (XDR *, mknod3args*); -extern bool_t xdr_mknod3resok (XDR *, mknod3resok*); -extern bool_t xdr_mknod3resfail (XDR *, mknod3resfail*); -extern bool_t xdr_mknod3res (XDR *, mknod3res*); -extern bool_t xdr_remove3args (XDR *, remove3args*); -extern bool_t xdr_remove3resok (XDR *, remove3resok*); -extern bool_t xdr_remove3resfail (XDR *, remove3resfail*); -extern bool_t xdr_remove3res (XDR *, remove3res*); -extern bool_t xdr_rmdir3args (XDR *, rmdir3args*); -extern bool_t xdr_rmdir3resok (XDR *, rmdir3resok*); -extern bool_t xdr_rmdir3resfail (XDR *, rmdir3resfail*); -extern bool_t xdr_rmdir3res (XDR *, rmdir3res*); -extern bool_t xdr_rename3args (XDR *, rename3args*); -extern bool_t xdr_rename3resok (XDR *, rename3resok*); -extern bool_t xdr_rename3resfail (XDR *, rename3resfail*); -extern bool_t xdr_rename3res (XDR *, rename3res*); -extern bool_t xdr_link3args (XDR *, link3args*); -extern bool_t xdr_link3resok (XDR *, link3resok*); -extern bool_t xdr_link3resfail (XDR *, link3resfail*); -extern bool_t xdr_link3res (XDR *, link3res*); -extern bool_t xdr_readdir3args (XDR *, readdir3args*); -extern bool_t xdr_entry3 (XDR *, entry3*); -extern bool_t xdr_dirlist3 (XDR *, dirlist3*); -extern bool_t xdr_readdir3resok (XDR *, readdir3resok*); -extern bool_t xdr_readdir3resfail (XDR *, readdir3resfail*); -extern bool_t xdr_readdir3res (XDR *, readdir3res*); -extern bool_t xdr_readdirp3args (XDR *, readdirp3args*); -extern bool_t xdr_entryp3 (XDR *, entryp3*); -extern bool_t xdr_dirlistp3 (XDR *, dirlistp3*); -extern bool_t xdr_readdirp3resok (XDR *, readdirp3resok*); -extern bool_t xdr_readdirp3resfail (XDR *, readdirp3resfail*); -extern bool_t xdr_readdirp3res (XDR *, readdirp3res*); -extern bool_t xdr_fsstat3args (XDR *, fsstat3args*); -extern bool_t xdr_fsstat3resok (XDR *, fsstat3resok*); -extern bool_t xdr_fsstat3resfail (XDR *, fsstat3resfail*); -extern bool_t xdr_fsstat3res (XDR *, fsstat3res*); -extern bool_t xdr_fsinfo3args (XDR *, fsinfo3args*); -extern bool_t xdr_fsinfo3resok (XDR *, fsinfo3resok*); -extern bool_t xdr_fsinfo3resfail (XDR *, fsinfo3resfail*); -extern bool_t xdr_fsinfo3res (XDR *, fsinfo3res*); -extern bool_t xdr_pathconf3args (XDR *, pathconf3args*); -extern bool_t xdr_pathconf3resok (XDR *, pathconf3resok*); -extern bool_t xdr_pathconf3resfail (XDR *, pathconf3resfail*); -extern bool_t xdr_pathconf3res (XDR *, pathconf3res*); -extern bool_t xdr_commit3args (XDR *, commit3args*); -extern bool_t xdr_commit3resok (XDR *, commit3resok*); -extern bool_t xdr_commit3resfail (XDR *, commit3resfail*); -extern bool_t xdr_commit3res (XDR *, commit3res*); -extern bool_t xdr_fhandle3 (XDR *, fhandle3*); -extern bool_t xdr_dirpath (XDR *, dirpath*); -extern bool_t xdr_name (XDR *, name*); -extern bool_t xdr_mountstat3 (XDR *, mountstat3*); -extern bool_t xdr_mountres3_ok (XDR *, mountres3_ok*); -extern bool_t xdr_mountres3 (XDR *, mountres3*); -extern bool_t xdr_mountlist (XDR *, mountlist*); -extern bool_t xdr_mountbody (XDR *, mountbody*); -extern bool_t xdr_groups (XDR *, groups*); -extern bool_t xdr_groupnode (XDR *, groupnode*); -extern bool_t xdr_exports (XDR *, exports*); -extern bool_t xdr_exportnode (XDR *, exportnode*); - -extern void xdr_free_exports_list (struct exportnode *first); -extern void xdr_free_mountlist (mountlist ml); - -extern void xdr_free_write3args_nocopy (write3args *wa); +extern bool_t +xdr_uint64(XDR *, uint64 *); +extern bool_t +xdr_int64(XDR *, int64 *); +extern bool_t +xdr_uint32(XDR *, uint32 *); +extern bool_t +xdr_int32(XDR *, int32 *); +extern bool_t +xdr_filename3(XDR *, filename3 *); +extern bool_t +xdr_nfspath3(XDR *, nfspath3 *); +extern bool_t +xdr_fileid3(XDR *, fileid3 *); +extern bool_t +xdr_cookie3(XDR *, cookie3 *); +extern bool_t +xdr_cookieverf3(XDR *, cookieverf3); +extern bool_t +xdr_createverf3(XDR *, createverf3); +extern bool_t +xdr_writeverf3(XDR *, writeverf3); +extern bool_t +xdr_uid3(XDR *, uid3 *); +extern bool_t +xdr_gid3(XDR *, gid3 *); +extern bool_t +xdr_size3(XDR *, size3 *); +extern bool_t +xdr_offset3(XDR *, offset3 *); +extern bool_t +xdr_mode3(XDR *, mode3 *); +extern bool_t +xdr_count3(XDR *, count3 *); +extern bool_t +xdr_nfsstat3(XDR *, nfsstat3 *); +extern bool_t +xdr_ftype3(XDR *, ftype3 *); +extern bool_t +xdr_specdata3(XDR *, specdata3 *); +extern bool_t +xdr_nfs_fh3(XDR *, nfs_fh3 *); +extern bool_t +xdr_nfstime3(XDR *, nfstime3 *); +extern bool_t +xdr_fattr3(XDR *, fattr3 *); +extern bool_t +xdr_post_op_attr(XDR *, post_op_attr *); +extern bool_t +xdr_wcc_attr(XDR *, wcc_attr *); +extern bool_t +xdr_pre_op_attr(XDR *, pre_op_attr *); +extern bool_t +xdr_wcc_data(XDR *, wcc_data *); +extern bool_t +xdr_post_op_fh3(XDR *, post_op_fh3 *); +extern bool_t +xdr_time_how(XDR *, time_how *); +extern bool_t +xdr_set_mode3(XDR *, set_mode3 *); +extern bool_t +xdr_set_uid3(XDR *, set_uid3 *); +extern bool_t +xdr_set_gid3(XDR *, set_gid3 *); +extern bool_t +xdr_set_size3(XDR *, set_size3 *); +extern bool_t +xdr_set_atime(XDR *, set_atime *); +extern bool_t +xdr_set_mtime(XDR *, set_mtime *); +extern bool_t +xdr_sattr3(XDR *, sattr3 *); +extern bool_t +xdr_diropargs3(XDR *, diropargs3 *); +extern bool_t +xdr_getattr3args(XDR *, getattr3args *); +extern bool_t +xdr_getattr3resok(XDR *, getattr3resok *); +extern bool_t +xdr_getattr3res(XDR *, getattr3res *); +extern bool_t +xdr_sattrguard3(XDR *, sattrguard3 *); +extern bool_t +xdr_setattr3args(XDR *, setattr3args *); +extern bool_t +xdr_setattr3resok(XDR *, setattr3resok *); +extern bool_t +xdr_setattr3resfail(XDR *, setattr3resfail *); +extern bool_t +xdr_setattr3res(XDR *, setattr3res *); +extern bool_t +xdr_lookup3args(XDR *, lookup3args *); +extern bool_t +xdr_lookup3resok(XDR *, lookup3resok *); +extern bool_t +xdr_lookup3resfail(XDR *, lookup3resfail *); +extern bool_t +xdr_lookup3res(XDR *, lookup3res *); +extern bool_t +xdr_access3args(XDR *, access3args *); +extern bool_t +xdr_access3resok(XDR *, access3resok *); +extern bool_t +xdr_access3resfail(XDR *, access3resfail *); +extern bool_t +xdr_access3res(XDR *, access3res *); +extern bool_t +xdr_readlink3args(XDR *, readlink3args *); +extern bool_t +xdr_readlink3resok(XDR *, readlink3resok *); +extern bool_t +xdr_readlink3resfail(XDR *, readlink3resfail *); +extern bool_t +xdr_readlink3res(XDR *, readlink3res *); +extern bool_t +xdr_read3args(XDR *, read3args *); +extern bool_t +xdr_read3resok(XDR *, read3resok *); +extern bool_t +xdr_read3resfail(XDR *, read3resfail *); +extern bool_t +xdr_read3res(XDR *, read3res *); +extern bool_t +xdr_read3res_nocopy(XDR *xdrs, read3res *objp); +extern bool_t +xdr_stable_how(XDR *, stable_how *); +extern bool_t +xdr_write3args(XDR *, write3args *); +extern bool_t +xdr_write3resok(XDR *, write3resok *); +extern bool_t +xdr_write3resfail(XDR *, write3resfail *); +extern bool_t +xdr_write3res(XDR *, write3res *); +extern bool_t +xdr_createmode3(XDR *, createmode3 *); +extern bool_t +xdr_createhow3(XDR *, createhow3 *); +extern bool_t +xdr_create3args(XDR *, create3args *); +extern bool_t +xdr_create3resok(XDR *, create3resok *); +extern bool_t +xdr_create3resfail(XDR *, create3resfail *); +extern bool_t +xdr_create3res(XDR *, create3res *); +extern bool_t +xdr_mkdir3args(XDR *, mkdir3args *); +extern bool_t +xdr_mkdir3resok(XDR *, mkdir3resok *); +extern bool_t +xdr_mkdir3resfail(XDR *, mkdir3resfail *); +extern bool_t +xdr_mkdir3res(XDR *, mkdir3res *); +extern bool_t +xdr_symlinkdata3(XDR *, symlinkdata3 *); +extern bool_t +xdr_symlink3args(XDR *, symlink3args *); +extern bool_t +xdr_symlink3resok(XDR *, symlink3resok *); +extern bool_t +xdr_symlink3resfail(XDR *, symlink3resfail *); +extern bool_t +xdr_symlink3res(XDR *, symlink3res *); +extern bool_t +xdr_devicedata3(XDR *, devicedata3 *); +extern bool_t +xdr_mknoddata3(XDR *, mknoddata3 *); +extern bool_t +xdr_mknod3args(XDR *, mknod3args *); +extern bool_t +xdr_mknod3resok(XDR *, mknod3resok *); +extern bool_t +xdr_mknod3resfail(XDR *, mknod3resfail *); +extern bool_t +xdr_mknod3res(XDR *, mknod3res *); +extern bool_t +xdr_remove3args(XDR *, remove3args *); +extern bool_t +xdr_remove3resok(XDR *, remove3resok *); +extern bool_t +xdr_remove3resfail(XDR *, remove3resfail *); +extern bool_t +xdr_remove3res(XDR *, remove3res *); +extern bool_t +xdr_rmdir3args(XDR *, rmdir3args *); +extern bool_t +xdr_rmdir3resok(XDR *, rmdir3resok *); +extern bool_t +xdr_rmdir3resfail(XDR *, rmdir3resfail *); +extern bool_t +xdr_rmdir3res(XDR *, rmdir3res *); +extern bool_t +xdr_rename3args(XDR *, rename3args *); +extern bool_t +xdr_rename3resok(XDR *, rename3resok *); +extern bool_t +xdr_rename3resfail(XDR *, rename3resfail *); +extern bool_t +xdr_rename3res(XDR *, rename3res *); +extern bool_t +xdr_link3args(XDR *, link3args *); +extern bool_t +xdr_link3resok(XDR *, link3resok *); +extern bool_t +xdr_link3resfail(XDR *, link3resfail *); +extern bool_t +xdr_link3res(XDR *, link3res *); +extern bool_t +xdr_readdir3args(XDR *, readdir3args *); +extern bool_t +xdr_entry3(XDR *, entry3 *); +extern bool_t +xdr_dirlist3(XDR *, dirlist3 *); +extern bool_t +xdr_readdir3resok(XDR *, readdir3resok *); +extern bool_t +xdr_readdir3resfail(XDR *, readdir3resfail *); +extern bool_t +xdr_readdir3res(XDR *, readdir3res *); +extern bool_t +xdr_readdirp3args(XDR *, readdirp3args *); +extern bool_t +xdr_entryp3(XDR *, entryp3 *); +extern bool_t +xdr_dirlistp3(XDR *, dirlistp3 *); +extern bool_t +xdr_readdirp3resok(XDR *, readdirp3resok *); +extern bool_t +xdr_readdirp3resfail(XDR *, readdirp3resfail *); +extern bool_t +xdr_readdirp3res(XDR *, readdirp3res *); +extern bool_t +xdr_fsstat3args(XDR *, fsstat3args *); +extern bool_t +xdr_fsstat3resok(XDR *, fsstat3resok *); +extern bool_t +xdr_fsstat3resfail(XDR *, fsstat3resfail *); +extern bool_t +xdr_fsstat3res(XDR *, fsstat3res *); +extern bool_t +xdr_fsinfo3args(XDR *, fsinfo3args *); +extern bool_t +xdr_fsinfo3resok(XDR *, fsinfo3resok *); +extern bool_t +xdr_fsinfo3resfail(XDR *, fsinfo3resfail *); +extern bool_t +xdr_fsinfo3res(XDR *, fsinfo3res *); +extern bool_t +xdr_pathconf3args(XDR *, pathconf3args *); +extern bool_t +xdr_pathconf3resok(XDR *, pathconf3resok *); +extern bool_t +xdr_pathconf3resfail(XDR *, pathconf3resfail *); +extern bool_t +xdr_pathconf3res(XDR *, pathconf3res *); +extern bool_t +xdr_commit3args(XDR *, commit3args *); +extern bool_t +xdr_commit3resok(XDR *, commit3resok *); +extern bool_t +xdr_commit3resfail(XDR *, commit3resfail *); +extern bool_t +xdr_commit3res(XDR *, commit3res *); +extern bool_t +xdr_fhandle3(XDR *, fhandle3 *); +extern bool_t +xdr_dirpath(XDR *, dirpath *); +extern bool_t +xdr_name(XDR *, name *); +extern bool_t +xdr_mountstat3(XDR *, mountstat3 *); +extern bool_t +xdr_mountres3_ok(XDR *, mountres3_ok *); +extern bool_t +xdr_mountres3(XDR *, mountres3 *); +extern bool_t +xdr_mountlist(XDR *, mountlist *); +extern bool_t +xdr_mountbody(XDR *, mountbody *); +extern bool_t +xdr_groups(XDR *, groups *); +extern bool_t +xdr_groupnode(XDR *, groupnode *); +extern bool_t +xdr_exports(XDR *, exports *); +extern bool_t +xdr_exportnode(XDR *, exportnode *); + +extern void +xdr_free_exports_list(struct exportnode *first); +extern void +xdr_free_mountlist(mountlist ml); + +extern void +xdr_free_write3args_nocopy(write3args *wa); #endif |