Browse Source

gpt unix-like partition system names

master
Mathieu Serandour 1 year ago
parent
commit
bf2ca3aa2c
  1. 12
      kernel/fs/gpt.c
  2. 6
      kernel/fs/gpt.h

12
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);
}

6
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);

Loading…
Cancel
Save