return NULL;
}
-struct partition_table_entry {
- uint8_t bootable;
- uint8_t starting_head;
- uint16_t starting_sector:6;
- uint16_t starting_cylinder:10;
- uint8_t system_id;
- uint8_t ending_head;
- uint16_t ending_sector:6;
- uint16_t ending_cylinder:10;
- uint32_t rela_sector;
- uint32_t total_sectors;
-} __packed;
-
-
void device_register(struct device *dev, const char *name, int flags)
{
size_t len;
dev->flags = flags;
dev->active = 1;
dev->refcnt = 1;
- dev->offset = 0;
dev->private_data = priv;
dev->next = device_list;
- dev->max_io_size = UINT_MAX;
device_list = dev;
uk_mutex_unlock(&devfs_lock);
* Device information
*/
struct devinfo {
- unsigned long cookie; /* index cookie */
+ unsigned long cookie; /* index cookie */
struct device *id; /* device id */
int flags; /* device characteristics flags */
char name[MAXDEVNAME]; /* device name */
int flags; /* state of driver */
};
-/*
- * flags for the driver.
- */
-
-typedef enum device_state {
- DS_INACTIVE = 0x00, /* driver is inactive */
- DS_ALIVE = 0x01, /* probe succeded */
- DS_ACTIVE = 0x02, /* intialized */
- DS_DEBUG = 0x04, /* debug */
- DS_NOTPRESENT = 0x08, /* not probed or probe failed */
- DS_ATTACHING = 0x10, /* currently attaching */
- DS_ATTACHED = 0x20, /*attach method called */
-} device_state_t;
-
/*
* Device object
*/
int flags; /* D_* flags defined above */
int active; /* device has not been destroyed */
int refcnt; /* reference count */
- off_t size; /* device size */
- off_t offset; /* 0 for the main drive, if we have a
- * partition, this is the start address
- */
- size_t max_io_size;
void *private_data; /* private storage */
-
- void *softc;
- void *ivars;
- device_state_t state;
- const char *desc;
- int unit;
- int irq;
- int vector;
};
-typedef struct device *device_t;
-
-static inline int
-device_set_unit(device_t dev, int unit)
-{
- dev->unit = unit;
- return 0;
-}
-
-static inline int
-device_get_unit(device_t dev)
-{
- return dev->unit;
-}
-
-static inline const char *
-device_get_desc(device_t dev)
-{
- return dev->desc;
-}
-
-static inline void
-device_set_desc(device_t dev, const char *desc)
-{
- dev->desc = desc;
-}
-
-static inline void
-device_set_softc(device_t dev, void *softc)
-{
- dev->softc = softc;
-}
-
-static inline void *
-device_get_softc(device_t dev)
-{
- return dev->softc;
-}
-
-static inline void device_quiet(device_t dev __unused)
-{
-}
-
-static inline const char *
-devtoname(struct device *dev)
-{
- return dev->name;
-}
-
int device_open(const char *name, int mode, struct device **devp);
int device_close(struct device *dev);
int device_read(struct device *dev, struct uio *uio, int ioflags);
int device_ioctl(struct device *dev, unsigned long cmd, void *arg);
int device_info(struct devinfo *info);
-int bdev_read(struct device *dev, struct uio *uio, int ioflags);
-int bdev_write(struct device *dev, struct uio *uio, int ioflags);
-
int devop_noop();
int devop_eperm();
struct device *device_create(struct driver *drv, const char *name, int flags);
int device_destroy(struct device *dev);
-int device_destroy_locked(struct device *dev);
-void device_register(struct device *device, const char *name, int flags);
-void read_partition_table(struct device *device);
/*
* Ideally, any dev node registration should happen before we mount devfs.