mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-07 12:35:28 +00:00
Implement argp support for mkfs and add --force
Support max-meta-size and max-data-size using KMGTP units with rounding. Detect other fs signatures using blkid library. Detect ScoutFS super using magic value. Move read_block() from print.c into util.c since blkid also needs it. Signed-off-by: Andy Grover <agrover@versity.com>
This commit is contained in:
@@ -26,34 +26,6 @@
|
||||
#include "srch.h"
|
||||
#include "leaf_item_hash.h"
|
||||
|
||||
static int read_block(int fd, u64 blkno, int shift, void **ret_val)
|
||||
{
|
||||
size_t size = 1ULL << shift;
|
||||
void *buf;
|
||||
int ret;
|
||||
|
||||
*ret_val = NULL;
|
||||
|
||||
buf = malloc(size);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = pread(fd, buf, size, blkno << shift);
|
||||
if (ret == -1) {
|
||||
fprintf(stderr, "read blkno %llu returned %d: %s (%d)\n",
|
||||
blkno, ret, strerror(errno), errno);
|
||||
free(buf);
|
||||
return -errno;
|
||||
} else if (ret != size) {
|
||||
fprintf(stderr, "incomplete pread\n");
|
||||
free(buf);
|
||||
return -EINVAL;
|
||||
} else {
|
||||
*ret_val = buf;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void print_block_header(struct scoutfs_block_header *hdr, int size)
|
||||
{
|
||||
u32 crc = crc_block(hdr, size);
|
||||
|
||||
Reference in New Issue
Block a user