make-bcache: bcache.o
probe-bcache: LDLIBS += `pkg-config --libs uuid`
bcache-super-show: LDLIBS += `pkg-config --libs uuid`
+bcache-super-show: CFLAGS += -std=gnu99
bcache-super-show: bcache.o
* GPLv2
*/
+
#define _FILE_OFFSET_BITS 64
#define __USE_FILE_OFFSET64
#define _XOPEN_SOURCE 500
}
+static bool accepted_char(char c)
+{
+ if ('0' <= c && c <= '9')
+ return true;
+ if ('A' <= c && c <= 'Z')
+ return true;
+ if ('a' <= c && c <= 'z')
+ return true;
+ if (strchr(".-_", c))
+ return true;
+ return false;
+}
+
+static void print_encode(char* in)
+{
+ for (char* pos = in; *pos; pos++)
+ if (accepted_char(*pos))
+ putchar(*pos);
+ else
+ printf("%%%x", *pos);
+}
+
+
int main(int argc, char **argv)
{
bool force_csum = false;
putchar('\n');
+ char label[SB_LABEL_SIZE + 1];
+ strncpy(label, (char*)sb.label, SB_LABEL_SIZE);
+ label[SB_LABEL_SIZE] = '\0';
+ printf("dev.label\t\t");
+ if (*label)
+ print_encode(label);
+ else
+ printf("(empty)");
+ putchar('\n');
+
uuid_unparse(sb.uuid, uuid);
printf("dev.uuid\t\t%s\n", uuid);
#define BDEV_STATE_DIRTY 2U
#define BDEV_STATE_STALE 3U
-inline uint64_t crc64(const void *_data, size_t len);
+uint64_t crc64(const void *_data, size_t len);
#define node(i, j) ((void *) ((i)->d + (j)))
#define end(i) node(i, (i)->keys)