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
fix: memory leakage in file descriptor allocation
[lunaix-os.git]
/
lunaix-os
/
includes
/
lunaix
/
block.h
diff --git
a/lunaix-os/includes/lunaix/block.h
b/lunaix-os/includes/lunaix/block.h
index 40935f9f630bb79da872ea7874606e743630647c..4b0c824d1ca06f77e3da46c9a53628da3b15ea09 100644
(file)
--- a/
lunaix-os/includes/lunaix/block.h
+++ b/
lunaix-os/includes/lunaix/block.h
@@
-2,46
+2,58
@@
#define __LUNAIX_BLOCK_H
#include <hal/ahci/hba.h>
#define __LUNAIX_BLOCK_H
#include <hal/ahci/hba.h>
+#include <lunaix/blkio.h>
#include <lunaix/device.h>
#define LPT_SIG 0x414e554c
#define PARTITION_NAME_SIZE 48
#define DEV_ID_SIZE 32
#include <lunaix/device.h>
#define LPT_SIG 0x414e554c
#define PARTITION_NAME_SIZE 48
#define DEV_ID_SIZE 32
-typedef uint64_t partition_t;
-typedef uint32_t bdev_t;
-
struct block_dev
{
char bdev_id[DEV_ID_SIZE];
char name[PARTITION_NAME_SIZE];
struct block_dev
{
char bdev_id[DEV_ID_SIZE];
char name[PARTITION_NAME_SIZE];
- struct
hba_device* hd_dev
;
+ struct
blkio_context* blkio
;
struct device* dev;
struct device* dev;
- uint64_t base_lba;
- uint64_t end_lba;
+ void* driver;
+ u64_t end_lba;
+ u32_t blk_size;
};
struct lpt_entry
{
char part_name[PARTITION_NAME_SIZE];
};
struct lpt_entry
{
char part_name[PARTITION_NAME_SIZE];
- u
int
64_t base_lba;
- u
int
64_t end_lba;
+ u64_t base_lba;
+ u64_t end_lba;
} __attribute__((packed));
// Lunaix Partition Table
struct lpt_header
{
} __attribute__((packed));
// Lunaix Partition Table
struct lpt_header
{
- u
int
32_t signature;
- u
int
32_t crc;
- u
int
32_t pt_start_lba;
- u
int
32_t pt_end_lba;
- u
int
32_t table_len;
+ u32_t signature;
+ u32_t crc;
+ u32_t pt_start_lba;
+ u32_t pt_end_lba;
+ u32_t table_len;
} __attribute__((packed));
} __attribute__((packed));
+typedef u64_t partition_t;
+typedef uint32_t bdev_t;
+typedef void (*devfs_exporter)(struct block_dev* bdev, void* fsnode);
+
void
block_init();
void
block_init();
+struct block_dev*
+block_alloc_dev(const char* blk_id, void* driver, req_handler ioreq_handler);
+
int
int
-block_mount_disk(struct hba_device* hd_dev);
+block_mount(struct block_dev* bdev, devfs_exporter export);
+
+void
+blk_mapping_init();
+
+void
+blk_set_blkmapping(struct block_dev* bdev, void* fsnode);
#endif /* __LUNAIX_BLOCK_H */
#endif /* __LUNAIX_BLOCK_H */