From bf2ca3aa2c20436b13ac9609ed16bdde7d4c2964 Mon Sep 17 00:00:00 2001 From: Mathieu Serandour Date: Fri, 11 Feb 2022 13:45:31 +0100 Subject: [PATCH] gpt unix-like partition system names --- kernel/fs/gpt.c | 12 +++++++++--- kernel/fs/gpt.h | 6 ++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/kernel/fs/gpt.c b/kernel/fs/gpt.c index 9ba9307..77fefa5 100644 --- a/kernel/fs/gpt.c +++ b/kernel/fs/gpt.c @@ -10,7 +10,7 @@ // return 0 if equals, non zero else - inline int guidcmp(GUID const a, GUID const b) { +static int guidcmp(GUID const a, GUID const b) { return ((a.high ^ b.high) | (a.low ^ b.low)); } @@ -127,8 +127,6 @@ static GUID makeGUID( return PARTITION_UNKNOWNED; } -//partition_t* find_partition(GUID guid); - void gpt_scan(const struct storage_interface* sti) { @@ -185,8 +183,16 @@ void gpt_scan(const struct storage_interface* sti) { .interface = sti, }; + + p.sysname = malloc(strlen(sti->driver->device->name.ptr) + 2 + 4); + + sprintf(p.sysname, "%sp%u", sti->driver->device->name.ptr, i+1); + utf16le2ascii(p.name, entry->name, 35); + + log_warn("gnezugneu '%s' - '%s'", p.name, p.sysname); + register_partition(&p); } diff --git a/kernel/fs/gpt.h b/kernel/fs/gpt.h index 3592053..b3a2aee 100644 --- a/kernel/fs/gpt.h +++ b/kernel/fs/gpt.h @@ -20,6 +20,11 @@ typedef struct disk_part { // null terminated char name[36]; + + // name in the system + // Linux-like (nvme0p0, nvme10p4, ...) + // part number begins with 1 begins with + char* sysname; } disk_part_t; inline @@ -51,3 +56,4 @@ disk_part_t* search_partition(const char* name); // release partition information memory void gpt_cleanup(void); +