diff options
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 30 |
1 files changed, 25 insertions, 5 deletions
@@ -40,17 +40,23 @@ struct status { int write_average_i; struct timespec write_average_begin_times[WRAVG_STEPS]; off_t write_average_amounts[WRAVG_STEPS]; + + size_t nspans; + size_t span_off; + size_t spans_size; + struct span *spans; }; #define STATUS_INIT {.pass_nr = 1, .last_success = {-1, 0}, .direction = FORWARDS} - - -/* deadshred.c */ -extern struct status status; -extern _Atomic volatile sig_atomic_t exiting; +#define STATUS_TRANSFER_SIZE (offsetof(struct status, nspans) + sizeof(size_t)) /* io.c */ +void writeall(int fd, const void *data, size_t n, const char *fname); +void filecpy(int fd, off_t src, off_t len, const char *fname); off_t filesize(int fd, const char *fname); +#if defined(__linux__) +char *get_device_name(unsigned int devmajor, unsigned int devminor); +#endif /* fmt.c */ @@ -62,6 +68,7 @@ __attribute__((__pure__)) off_t unhumansize(const char *s, char flag); const char *durationstr(const struct timespec *dur, char *buf, int second_decimals); const char *humanbytespersecond(double bytes_per_second, char *buf); +const char *exact_and_human_size(off_t bytes, char *buf, int with_unit); /* text.c */ @@ -87,6 +94,19 @@ void used_random(ssize_t amount); /* sig.c */ +extern _Atomic volatile sig_atomic_t exiting; void setup_sighandler(void); void block_sigs(void); void unblock_sigs(void); + + +/* ask.c */ +int confirm(const char *device, off_t off, off_t len, off_t end); + + +/* map.c */ +void add_span(struct status *status, off_t off, off_t amount, size_t blocksize, int try_join); +void dump_map(int fd, const struct status *status, const char *fname); +off_t measure_map_dump(const struct status *status); +off_t load_map(int fd, struct status *status, enum direction direction, const char *fname); +void update_map(int fd, const struct status *status, const char *fname); |