58 "BLOCKS_PER_IO UPDATE_FLAG OFFSET\n");
66 #define GET_ARG(arg, cmd, saveptr) \ 67 arg = strtok_r(cmd, "\n ", saveptr); \ 73 #define GET_COMMON_ARG(arg, fname, saveptr, id, \ 74 block_size, block_count, blocks_per_io) \ 75 GET_ARG(arg, NULL, &saveptr); \ 76 m0_obj_id_sscanf(arg, &id); \ 77 GET_ARG(arg, NULL, &saveptr); \ 78 fname = strdup(arg); \ 79 GET_ARG(arg, NULL, &saveptr); \ 80 block_size = atoi(arg); \ 81 GET_ARG(arg, NULL, &saveptr); \ 82 block_count = atoi(arg); \ 83 GET_ARG(arg, NULL, &saveptr); \ 84 blocks_per_io = atoi(arg); 88 fprintf(
file,
"Usage: %s [OPTION]...\n" 89 "Launches Client client.\n" 91 "Mandatory arguments to long options are mandatory for short options too.\n" 92 " -l, --local ADDR Local endpoint address\n" 93 " -H, --ha ADDR HA endpoint address\n" 94 " -p, --profile FID Profile FID\n" 95 " -P, --process FID Process FID\n" 96 " -L, --layout-id INT Layout ID, range: [1-14]\n" 97 " -e, --enable-locks Enables acquiring and releasing RW locks " 98 "before and after performing IO.\n" 99 " -b --blocks-per-io INT Number of blocks (>=0) per IO. Default=100 " 100 "if 0 or nothing is provided.\n" 101 " -r, --read-verify Verify parity after reading the data\n" 102 " -S, --msg_size INT Max RPC msg size 64k i.e 65536\n" 103 "%*c Note: this should match with m0d's current " 105 " -q, --min_queue INT Minimum length of the receive queue i.e 16\n" 106 " -h, --help Shows this help text and exit\n" 107 , prog_name,
WIDTH,
' ');
110 int main(
int argc,
char **argv)
131 fprintf(stderr,
"init failed! rc = %d\n",
rc);
135 memset(&
fid, 0,
sizeof fid);
152 if (strcmp(arg,
"read") == 0) {
154 block_size, block_count,
167 block_size, block_count,
offset,
171 }
else if (strcmp(arg,
"write") == 0) {
173 block_size, block_count,
176 fprintf(stderr,
"Blocks per IO (%d) is out of " 177 "range. Max is %d for write " 178 "operation!\n", blocks_per_io,
184 update_flag = atoi(arg) ? true :
false;
197 block_size, block_count,
offset,
198 blocks_per_io,
params.cup_take_locks,
200 }
else if (strcmp(arg,
"touch") == 0) {
207 }
else if (strcmp(arg,
"delete") == 0) {
214 }
else if (strcmp(arg,
"help") == 0)
219 fprintf(stderr,
"IO failed! rc = %d\n",
rc);
221 }
while (arg ==
NULL || strcmp(arg,
"quit") != 0);
M0_INTERNAL bool entity_id_is_valid(const struct m0_uint128 *id)
static struct m0_container container
void m0_console_printf(const char *fmt,...)
int m0_obj_id_sscanf(char *idstr, struct m0_uint128 *obj_id)
int m0_write(struct m0_container *container, char *src, struct m0_uint128 id, uint32_t block_size, uint32_t block_count, uint64_t update_offset, int blks_per_io, bool take_locks, bool update_mode)
M0_INTERNAL void client_init(struct sim *s, struct client_conf *conf)
#define GET_ARG(arg, cmd, saveptr)
const struct m0_uint128 M0_ID_APP
return M0_ERR(-EOPNOTSUPP)
struct m0_addb_ctx m0_addb_ctx
int m0_utility_args_init(int argc, char **argv, struct m0_utility_param *params, struct m0_idx_dix_config *dix_conf, struct m0_config *conf, void(*utility_usage)(FILE *, char *))
int touch(struct m0_container *container, struct m0_uint128 id, bool take_locks)
int main(int argc, char **argv)
void * m0_alloc(size_t size)
static void c0client_usage(FILE *file, char *prog_name)
static m0_bindex_t offset
M0_INTERNAL int m0_bcount_get(const char *arg, m0_bcount_t *out)
#define GET_COMMON_ARG(arg, fname, saveptr, id, block_size, block_count, blocks_per_io)
M0_INTERNAL void client_fini(struct client_conf *conf)
static struct m0_idx_dix_config dix_conf
int m0_read(struct m0_container *container, struct m0_uint128 id, char *dest, uint32_t block_size, uint32_t block_count, uint64_t offset, int blks_per_io, bool take_locks, uint32_t flags, struct m0_fid *read_pver)
int m0_unlink(struct m0_container *container, struct m0_uint128 id, bool take_locks)