mirror of
https://github.com/versity/scoutfs.git
synced 2026-09-03 14:47:07 +00:00
scoutfs-utils: add support for format_hash
Calculate the hash of format.h and ioctl.h, put it in the super during mkfs, and print it out. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
+5
-1
@@ -1,5 +1,9 @@
|
||||
SCOUTFS_FORMAT_HASH := \
|
||||
$(shell cat src/format.h src/ioctl.h | md5sum | cut -b1-16)
|
||||
|
||||
CFLAGS := -Wall -O2 -Werror -D_FILE_OFFSET_BITS=64 -g -msse4.2 \
|
||||
-fno-strict-aliasing
|
||||
-fno-strict-aliasing \
|
||||
-DSCOUTFS_FORMAT_HASH=0x$(SCOUTFS_FORMAT_HASH)LLU
|
||||
|
||||
BIN := src/scoutfs
|
||||
OBJ := $(patsubst %.c,%.o,$(wildcard src/*.c))
|
||||
|
||||
@@ -430,6 +430,7 @@ struct scoutfs_inet_addr {
|
||||
struct scoutfs_super_block {
|
||||
struct scoutfs_block_header hdr;
|
||||
__le64 id;
|
||||
__le64 format_hash;
|
||||
__u8 uuid[SCOUTFS_UUID_BYTES];
|
||||
__le64 next_ino;
|
||||
__le64 next_seq;
|
||||
|
||||
@@ -208,6 +208,7 @@ static int write_new_fs(char *path, int fd)
|
||||
pseudo_random_bytes(&super->hdr.fsid, sizeof(super->hdr.fsid));
|
||||
super->hdr.seq = cpu_to_le64(1);
|
||||
super->id = cpu_to_le64(SCOUTFS_SUPER_ID);
|
||||
super->format_hash = cpu_to_le64(SCOUTFS_FORMAT_HASH);
|
||||
uuid_generate(super->uuid);
|
||||
super->next_ino = cpu_to_le64(SCOUTFS_ROOT_INO + 1);
|
||||
super->next_seq = cpu_to_le64(1);
|
||||
@@ -369,12 +370,14 @@ static int write_new_fs(char *path, int fd)
|
||||
printf("Created scoutfs filesystem:\n"
|
||||
" device path: %s\n"
|
||||
" fsid: %llx\n"
|
||||
" format hash: %llx\n"
|
||||
" uuid: %s\n"
|
||||
" device bytes: "SIZE_FMT"\n"
|
||||
" btree ring blocks: "SIZE_FMT"\n"
|
||||
" usable segments: "SIZE_FMT"\n",
|
||||
path,
|
||||
le64_to_cpu(super->hdr.fsid),
|
||||
le64_to_cpu(super->format_hash),
|
||||
uuid_str,
|
||||
SIZE_ARGS(size, 1),
|
||||
SIZE_ARGS(le64_to_cpu(super->bring.nr_blocks),
|
||||
|
||||
+4
-2
@@ -551,8 +551,10 @@ static void print_super_block(struct scoutfs_super_block *super, u64 blkno)
|
||||
|
||||
printf("super blkno %llu\n", blkno);
|
||||
print_block_header(&super->hdr);
|
||||
printf(" id %llx uuid %s\n",
|
||||
le64_to_cpu(super->id), uuid_str);
|
||||
printf(" id %llx format_hash %llx\n"
|
||||
" uuid %s\n",
|
||||
le64_to_cpu(super->id), le64_to_cpu(super->format_hash),
|
||||
uuid_str);
|
||||
|
||||
/* XXX these are all in a crazy order */
|
||||
printf(" next_ino %llu next_seq %llu next_seg_seq %llu\n"
|
||||
|
||||
Reference in New Issue
Block a user