X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/96cf56ea15a22b8b362aac6c3ab202d2608e9151..96e23fa3c6eabf8a6efebac24b740c5d4a2a1050:/lunaix-os/includes/lunaix/device.h?ds=inline diff --git a/lunaix-os/includes/lunaix/device.h b/lunaix-os/includes/lunaix/device.h index 414809a..c0ed989 100644 --- a/lunaix-os/includes/lunaix/device.h +++ b/lunaix-os/includes/lunaix/device.h @@ -6,31 +6,46 @@ #include #include +#define DEV_MSKIF 0x00000003 + +#define DEV_IFVOL 0x0 // volumetric (block) device +#define DEV_IFSEQ 0x1 // sequential (character) device +#define DEV_IFCAT 0x2 // a device category (as device groupping) + typedef unsigned int dev_t; struct device { - struct llist_header dev_list; + struct llist_header siblings; struct device* parent; struct hstr name; dev_t dev_id; + int dev_type; char name_val[DEVICE_NAME_SIZE]; void* underlay; - void* fs_node; 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); }; -void -device_init(); - struct device* device_addseq(struct device* parent, void* underlay, char* name_fmt, ...); struct device* device_addvol(struct device* parent, void* underlay, char* name_fmt, ...); +struct device* +device_addcat(struct device* parent, char* name_fmt, ...); + void device_remove(struct device* dev); +struct device* +device_getbyid(struct llist_header* devlist, dev_t id); + +struct device* +device_getbyname(struct llist_header* devlist, struct hstr* name); + +struct device* +device_getbyoffset(struct llist_header* devlist, int pos); + #endif /* __LUNAIX_DEVICE_H */