Code-base clean-up and refactoring (#47)
[lunaix-os.git] / lunaix-os / kernel / block / blkpart_gpt.c
index 033fa0abe90fa222aa11121b9748ed7002a12f3e..4ffff4deb2864f3ca76311acc5114bb2a92d3fa2 100644 (file)
@@ -5,7 +5,9 @@
 #include <lunaix/status.h>
 #include <lunaix/syslog.h>
 
-#include <lib/crc.h>
+#include <asm/muldiv64.h>
+
+#include <klibc/crc.h>
 
 #define GPT_BLKSIZE 512
 #define LBA2OFF(lba) ((lba) * GPT_BLKSIZE)
@@ -46,9 +48,8 @@ blkpart_parse(struct device* master, struct gpt_header* header)
         }
 
         // Convert UEFI's 512B LB representation into local LBA range.
-        u64_t slba_local =
-          (ent->start_lba * GPT_BLKSIZE) / (u64_t)bdev->blk_size;
-        u64_t elba_local = (ent->end_lba * GPT_BLKSIZE) / (u64_t)bdev->blk_size;
+        u64_t slba_local = udiv64(ent->start_lba * GPT_BLKSIZE, bdev->blk_size);
+        u64_t elba_local = udiv64(ent->end_lba * GPT_BLKSIZE, bdev->blk_size);
 
         kprintf("%s: guid part#%d: %d..%d",
                 bdev->bdev_id,