]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/devfs: Remove unused fields and functions
authorMarc Rittinghaus <marc.rittinghaus@unikraft.io>
Thu, 20 Apr 2023 14:47:45 +0000 (16:47 +0200)
committerUnikraft <monkey@unikraft.io>
Tue, 2 May 2023 20:36:20 +0000 (20:36 +0000)
The definition for device objects contain numerous fields which are not
used. In addition, there are various function definitions and
declarations which are not used or not even related to generic devices
(e.g., partition table). This commit removes all of these definitions.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #855

lib/devfs/device.c
lib/devfs/include/devfs/device.h

index 9cc3c52a376c6ec0779b718972071547fc492f8b..47826e49431db082fc9d4ea93d6026a233e37bee 100644 (file)
@@ -78,20 +78,6 @@ device_lookup(const char *name)
        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;
@@ -123,10 +109,8 @@ void device_register(struct device *dev, const char *name, int flags)
        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);
index 376576bd99d8324b8f7051af21840a15b798081f..22a47b443716889dec4c6dec88217200b7b6e651 100644 (file)
@@ -46,7 +46,7 @@ struct device;
  * 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 */
@@ -91,20 +91,6 @@ struct driver {
        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
  */
@@ -115,71 +101,9 @@ struct device {
        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);
@@ -187,17 +111,11 @@ int device_write(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.