X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/5ea8e2ba737f903db81d49b56778e883634512a5..b632f535c4a6882bdca0317fb88cbe6e165f24eb:/lunaix-os/includes/lunaix/device.h diff --git a/lunaix-os/includes/lunaix/device.h b/lunaix-os/includes/lunaix/device.h index beb8066..ee56b1d 100644 --- a/lunaix-os/includes/lunaix/device.h +++ b/lunaix-os/includes/lunaix/device.h @@ -7,6 +7,8 @@ #include #include +#define DEV_STRUCT_MAGIC 0x5645444c + #define DEV_MSKIF 0x00000003 #define DEV_IFVOL 0x0 // volumetric (block) device @@ -17,7 +19,9 @@ typedef unsigned int dev_t; struct device { + u32_t magic; struct llist_header siblings; + struct llist_header children; struct device* parent; struct hstr name; dev_t dev_id; @@ -26,13 +30,16 @@ struct device void* underlay; int (*read)(struct device* dev, void* buf, size_t offset, size_t len); int (*write)(struct device* dev, void* buf, size_t offset, size_t len); + int (*read_page)(struct device* dev, void* buf, size_t offset); + int (*write_page)(struct device* dev, void* buf, size_t offset); + int (*exec_cmd)(struct device* dev, u32_t req, va_list args); }; struct device* device_add(struct device* parent, void* underlay, char* name_fmt, - uint32_t type, + u32_t type, va_list args); struct device* @@ -51,12 +58,15 @@ struct device* device_getbyid(struct llist_header* devlist, dev_t id); struct device* -device_getbyhname(struct llist_header* devlist, struct hstr* name); +device_getbyhname(struct device* root_dev, struct hstr* name); struct device* -device_getbyname(struct llist_header* devlist, const char* name, size_t len); +device_getbyname(struct device* root_dev, const char* name, size_t len); struct device* -device_getbyoffset(struct llist_header* devlist, int pos); +device_getbyoffset(struct device* root_dev, int pos); + +void +device_init_builtin(); #endif /* __LUNAIX_DEVICE_H */