* even if the dump is exactly aligned, the last index will be full of
* zeros. If the last index entry is non-zero, the dump is incomplete.
* Correspondingly, the last chunk will have a count < num_indicies.
+ *
+ * Return 0 for success, -1 for failure.
*/
static int
metablock->mb_count = cpu_to_be16(cur_index);
if (fwrite(metablock, (cur_index + 1) << BBSHIFT, 1, outf) != 1) {
print_warning("error writing to file: %s", strerror(errno));
- return 0;
+ return -errno;
}
memset(block_index, 0, num_indicies * sizeof(__be64));
cur_index = 0;
- return 1;
+ return 0;
}
static int
char *data;
__int64_t off;
int i;
+ int ret;
/*
* Run the write verifier to recalculate the buffer CRCs and check
_("%s: write verifer failed on bno 0x%llx/0x%x\n"),
__func__, (long long)buf->bp->b_bn,
buf->bp->b_bcount);
- return buf->bp->b_error;
+ return -buf->bp->b_error;
}
}
block_index[cur_index] = cpu_to_be64(off);
memcpy(&block_buffer[cur_index << BBSHIFT], data, BBSIZE);
if (++cur_index == num_indicies) {
- if (!write_index())
- return 0;
+ ret = write_index();
+ if (ret)
+ return ret;
}
}
- return !seenint();
+ return seenint() ? -EINTR : 0;
}
rval = !stop_on_read_error;
goto pop_out;
}
- if (!write_buf(iocur_top))
+ if (write_buf(iocur_top))
goto pop_out;
if (!(*func)(iocur_top->data, agno, agbno, level - 1, btype, arg))
default: ;
}
- if (!write_buf(iocur_top)) {
+ if (write_buf(iocur_top)) {
pop_cur();
return 0;
}
xfs_dinode_calc_crc(mp, dip);
}
skip_processing:
- if (!write_buf(iocur_top))
+ if (write_buf(iocur_top))
goto pop_out;
inodes_copied += XFS_INODES_PER_CHUNK;
if (stop_on_read_error)
goto pop_out;
} else {
- if (!write_buf(iocur_top))
+ if (write_buf(iocur_top))
goto pop_out;
}
if (stop_on_read_error)
goto pop_out;
} else {
- if (!write_buf(iocur_top))
+ if (write_buf(iocur_top))
goto pop_out;
}
if (stop_on_read_error)
goto pop_out;
} else {
- if (!write_buf(iocur_top))
+ if (write_buf(iocur_top))
goto pop_out;
}
if (stop_on_read_error)
goto pop_out;
} else {
- if (!write_buf(iocur_top))
+ if (write_buf(iocur_top))
goto pop_out;
}
print_warning("cannot read log");
return !stop_on_read_error;
}
- return write_buf(iocur_top);
+ return !write_buf(iocur_top);
}
static int
/* write the remaining index */
if (!exitcode)
- exitcode = !write_index();
+ exitcode = write_index() < 0;
if (progress_since_warning)
fputc('\n', (outf == stdout) ? stderr : stdout);