- char *fname, *commands;
- const char *newfile;
- const char *oldpath;
- struct stat st;
- struct statfs stfs;
- size_t mmap_len = 0, i;
- unsigned char *mmap_ptr = NULL, junk = 0;
- int rc, len, fd = -1;
- int flags;
- int save_errno;
- int verbose = 0;
- int gid = 0;
- struct lu_fid fid;
- struct timespec ts;
- struct lov_user_md_v3 lum;
-
- if (argc < 3) {
- fprintf(stderr, usage, argv[0]);
- exit(1);
- }
-
- memset(&st, 0, sizeof(st));
- sem_init(&sem, 0, 0);
- /* use sigaction instead of signal to avoid SA_ONESHOT semantics */
- sigaction(SIGUSR1, &(const struct sigaction){.sa_handler = &usr1_handler},
- NULL);
-
- fname = argv[1];
-
- for (commands = argv[2]; *commands; commands++) {
- switch (*commands) {
- case '_':
- if (verbose) {
- printf("PAUSING\n");
- fflush(stdout);
- }
- len = atoi(commands+1);
+ char *fname, *commands;
+ const char *newfile;
+ const char *oldpath;
+ struct stat st;
+ struct statfs stfs;
+ size_t mmap_len = 0, i;
+ unsigned char *mmap_ptr = NULL, junk = 1;
+ int len, fd = -1;
+ int flags;
+ int save_errno;
+ int verbose = 0;
+ int gid = 0;
+ struct lu_fid fid;
+ struct timespec ts;
+ struct lov_user_md_v3 lum;
+ char *xattr_buf = NULL;
+ size_t xattr_buf_size = 0;
+ long long rc = 0;
+ long long last_rc;
+
+ if (argc < 3) {
+ fprintf(stderr, usage, argv[0]);
+ exit(1);
+ }
+
+ memset(&st, 0, sizeof(st));
+ sem_init(&sem, 0, 0);
+ /* use sigaction instead of signal to avoid SA_ONESHOT semantics */
+ sigaction(SIGUSR1,
+ &(const struct sigaction){.sa_handler = &usr1_handler}, NULL);
+
+ fname = argv[1];
+
+ for (commands = argv[2]; *commands; commands++) {
+ /*
+ * XXX Most commands return 0 or we exit so we only
+ * update rc where really needed.
+ */
+ last_rc = rc;
+ rc = 0;
+
+ switch (*commands) {
+ case '_':
+ if (verbose) {
+ printf("PAUSING\n");
+ fflush(stdout);
+ }
+ len = atoi(commands + 1);