unsigned long long o_bandwidth;
size_t o_chunk_size;
enum ct_action o_action;
+ char *o_event_fifo;
char *o_mnt;
char *o_hsm_root;
char *o_src; /* for import, or rebind */
" --dry-run Don't run, just show what would be done\n"
" -c, --chunk-size <sz> I/O size used during data copy\n"
" (unit can be used, default is MB)\n"
+ " -f, --event-fifo <path> Write events stream to fifo\n"
" -p, --hsm-root <path> Target HSM mount point\n"
" -q, --quiet Produce less verbose output\n"
" -u, --update-interval <s> Interval between progress reports sent\n"
{"chunk-size", required_argument, NULL, 'c'},
{"chunk_size", required_argument, NULL, 'c'},
{"daemon", no_argument, &opt.o_daemonize, 1},
+ {"event-fifo", required_argument, NULL, 'f'},
+ {"event_fifo", required_argument, NULL, 'f'},
{"dry-run", no_argument, &opt.o_dry_run, 1},
{"help", no_argument, NULL, 'h'},
{"hsm-root", required_argument, NULL, 'p'},
unsigned long long unit;
optind = 0;
- while ((c = getopt_long(argc, argv, "A:b:c:hiMp:qru:v",
+ while ((c = getopt_long(argc, argv, "A:b:c:f:hiMp:qru:v",
long_opts, NULL)) != -1) {
switch (c) {
case 'A':
else
opt.o_bandwidth = value;
break;
+ case 'f':
+ opt.o_event_fifo = optarg;
+ break;
case 'h':
usage(argv[0], 0);
case 'i':
return rc;
}
+ /* Don't read beyond a given extent */
+ length = min(hai->hai_extent.length, src_st.st_size);
+
he.offset = offset;
he.length = 0;
- rc = llapi_hsm_action_progress(hcp, &he, 0);
+ rc = llapi_hsm_action_progress(hcp, &he, length, 0);
if (rc < 0) {
/* Action has been canceled or something wrong
* is happening. Stop copying data. */
}
errno = 0;
- /* Don't read beyond a given extent */
- length = min(hai->hai_extent.length, src_st.st_size);
buf = malloc(opt.o_chunk_size);
if (buf == NULL) {
last_print_time = time(0);
CT_TRACE("%%"LPU64" ", 100 * write_total / length);
he.length = write_total;
- rc = llapi_hsm_action_progress(hcp, &he, 0);
+ rc = llapi_hsm_action_progress(hcp, &he, length, 0);
if (rc < 0) {
/* Action has been canceled or something wrong
* is happening. Stop copying data. */
setbuf(stdout, NULL);
+ if (opt.o_event_fifo != NULL) {
+ rc = llapi_hsm_register_event_fifo(opt.o_event_fifo);
+ if (rc < 0) {
+ CT_ERROR(rc, "failed to register event fifo");
+ return rc;
+ }
+ llapi_error_callback_set(llapi_hsm_log_error);
+ }
+
rc = llapi_hsm_copytool_register(&ctdata, opt.o_mnt, 0,
opt.o_archive_cnt, opt.o_archive_id);
if (rc < 0) {
}
llapi_hsm_copytool_unregister(&ctdata);
+ if (opt.o_event_fifo != NULL)
+ llapi_hsm_unregister_event_fifo(opt.o_event_fifo);
return rc;
}