From 527214c7ee648cccbe4abbb11bde298b7b52141b Mon Sep 17 00:00:00 2001 From: Adam Spragg Date: Mon, 16 May 2022 09:44:30 +0100 Subject: Label file Format 0 explicitly as Format 0 --- FILEFORMAT | 42 ------------------------------------------ FILEFORMAT_0 | 42 ++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- README | 2 +- src/metaentry.c | 4 ++-- src/metastore.h | 2 +- 6 files changed, 47 insertions(+), 47 deletions(-) delete mode 100644 FILEFORMAT create mode 100644 FILEFORMAT_0 diff --git a/FILEFORMAT b/FILEFORMAT deleted file mode 100644 index 0fddf85..0000000 --- a/FILEFORMAT +++ /dev/null @@ -1,42 +0,0 @@ -Version 0 ---------- - -Following sections explain internals of metastore file (.metadata). - - -### Data types - - CSTRING = NUL-terminated binary string - BSTRING(N) = binary string of length N - INT(N) = N byte integer in little-endian byte order - - -### File layout - - HEADER - N * ENTRY - - -### HEADER format - - BSTRING(10) - Magic header - "MeTaSt00r3" - BSTRING(8) - Version - "\0\0\0\0\0\0\0\0" (currently) - - -### ENTRY format - - CSTRING - Path (absolute or relative) - CSTRING - Owner (owner name, not uid) - CSTRING - Group (group name, not gid) - - INT(8) - Mtime (seconds) - INT(8) - Mtime (nanoseconds) - INT(2) - Mode (st_mode from struct stat st_mode AND 0177777, - i.e. unix permissions and type of file) - - INT(4) - num_xattrs - FOR (i = 0; i < num_xattrs; i++) { - CSTRING - xattr name - INT(4) - xattrlen - BSTRING(xattrlen) - xattr value - } diff --git a/FILEFORMAT_0 b/FILEFORMAT_0 new file mode 100644 index 0000000..0fddf85 --- /dev/null +++ b/FILEFORMAT_0 @@ -0,0 +1,42 @@ +Version 0 +--------- + +Following sections explain internals of metastore file (.metadata). + + +### Data types + + CSTRING = NUL-terminated binary string + BSTRING(N) = binary string of length N + INT(N) = N byte integer in little-endian byte order + + +### File layout + + HEADER + N * ENTRY + + +### HEADER format + + BSTRING(10) - Magic header - "MeTaSt00r3" + BSTRING(8) - Version - "\0\0\0\0\0\0\0\0" (currently) + + +### ENTRY format + + CSTRING - Path (absolute or relative) + CSTRING - Owner (owner name, not uid) + CSTRING - Group (group name, not gid) + + INT(8) - Mtime (seconds) + INT(8) - Mtime (nanoseconds) + INT(2) - Mode (st_mode from struct stat st_mode AND 0177777, + i.e. unix permissions and type of file) + + INT(4) - num_xattrs + FOR (i = 0; i < num_xattrs; i++) { + CSTRING - xattr name + INT(4) - xattrlen + BSTRING(xattrlen) - xattr value + } diff --git a/Makefile b/Makefile index 364825c..656071e 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ UNAME_S := $(shell uname -s) DOCS := \ AUTHORS \ - FILEFORMAT \ + FILEFORMAT_0 \ LICENSE.GPLv2 \ NEWS \ README \ diff --git a/README b/README index 02b0545..907cca7 100644 --- a/README +++ b/README @@ -44,7 +44,7 @@ Dump action can be really helpful in such cases. File format ----------- -See FILEFORMAT file, which describes internals of metastore file. +See FILEFORMAT_0 file, which describes internals of metastore file. Requirements diff --git a/src/metaentry.c b/src/metaentry.c index fe1c6d1..a26c764 100644 --- a/src/metaentry.c +++ b/src/metaentry.c @@ -422,7 +422,7 @@ mentries_tofile(const struct metahash *mhash, const char *path) } write_binary_string(SIGNATURE, SIGNATURELEN, to); - write_binary_string(VERSION, VERSIONLEN, to); + write_binary_string(VERSION_0, VERSIONLEN, to); for (key = 0; key < HASH_INDEXES; key++) { for (mentry = mhash->bucket[key]; mentry; mentry = mentry->next) { @@ -494,7 +494,7 @@ mentries_fromfile(struct metahash **mhash, const char *path) } ptr += SIGNATURELEN; - if (strncmp(ptr, VERSION, VERSIONLEN)) { + if (strncmp(ptr, VERSION_0, VERSIONLEN)) { msg(MSG_CRITICAL, "Invalid version of file %s\n", path); goto out; } diff --git a/src/metastore.h b/src/metastore.h index bedad6c..612b55b 100644 --- a/src/metastore.h +++ b/src/metastore.h @@ -24,7 +24,7 @@ /* Each file starts with SIGNATURE and VERSION */ #define SIGNATURE "MeTaSt00r3" #define SIGNATURELEN 10 -#define VERSION "\0\0\0\0\0\0\0\0" +#define VERSION_0 "\0\0\0\0\0\0\0\0" #define VERSIONLEN 8 /* Default filename */ -- cgit v1.2.1