git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add lunaix dynamic linker as submodule
[lunaix-os.git]
/
lunaix-os
/
kernel
/
block
/
block.c
diff --git
a/lunaix-os/kernel/block/block.c
b/lunaix-os/kernel/block/block.c
index 1cade0c78106650c595bcea492a4c399b1132214..c4e29e191e0b0df376fc0ed0767998e2ff8ca439 100644
(file)
--- a/
lunaix-os/kernel/block/block.c
+++ b/
lunaix-os/kernel/block/block.c
@@
-1,16
+1,18
@@
-#include <hal/ahci/hba.h>
#include <klibc/stdio.h>
#include <klibc/string.h>
#include <klibc/stdio.h>
#include <klibc/string.h>
+
+#include <hal/ahci/hba.h>
+
#include <lib/crc.h>
#include <lib/crc.h>
+
+#include <lunaix/blkpart_gpt.h>
#include <lunaix/block.h>
#include <lunaix/fs/twifs.h>
#include <lunaix/mm/cake.h>
#include <lunaix/block.h>
#include <lunaix/fs/twifs.h>
#include <lunaix/mm/cake.h>
+#include <lunaix/mm/page.h>
#include <lunaix/mm/valloc.h>
#include <lunaix/mm/valloc.h>
-#include <lunaix/syslog.h>
-
-#include <lunaix/blkpart_gpt.h>
-
#include <lunaix/spike.h>
#include <lunaix/spike.h>
+#include <lunaix/syslog.h>
#define BLOCK_EREAD 1
#define BLOCK_ESIG 2
#define BLOCK_EREAD 1
#define BLOCK_ESIG 2
@@
-24,6
+26,7
@@
LOG_MODULE("BLOCK")
static struct cake_pile* lbd_pile;
static struct block_dev** dev_registry;
static struct twifs_node* blk_sysroot;
static struct cake_pile* lbd_pile;
static struct block_dev** dev_registry;
static struct twifs_node* blk_sysroot;
+static struct device* blk_parent_dev;
int free_slot = 0;
int free_slot = 0;
@@
-41,6
+44,7
@@
block_init()
dev_registry = vcalloc(sizeof(struct block_dev*), MAX_DEV);
free_slot = 0;
blk_sysroot = twifs_dir_node(NULL, "block");
dev_registry = vcalloc(sizeof(struct block_dev*), MAX_DEV);
free_slot = 0;
blk_sysroot = twifs_dir_node(NULL, "block");
+ blk_parent_dev = device_addcat(NULL, "block");
}
int
}
int
@@
-314,7
+318,8
@@
__block_register(struct block_dev* bdev)
return 0;
}
return 0;
}
- struct device* dev = device_addvol(NULL, bdev, "sd%c", 'a' + free_slot);
+ struct device* dev =
+ device_addvol(blk_parent_dev, bdev, "sd%c", 'a' + free_slot);
dev->write = __block_write;
dev->write_page = __block_write_page;
dev->read = __block_read;
dev->write = __block_write;
dev->write_page = __block_write_page;
dev->read = __block_read;