]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/devfs: Remove unused devops
authorMarc Rittinghaus <marc.rittinghaus@unikraft.io>
Thu, 20 Apr 2023 14:39:25 +0000 (16:39 +0200)
committerUnikraft <monkey@unikraft.io>
Tue, 2 May 2023 20:36:20 +0000 (20:36 +0000)
This commit removes unused operations from the device operations
structure and updates the no-op macros and functions to be usable
for seldomly set operations (also externally).

Checkpatch-Ignore: FUNCTION_WITHOUT_ARGS
Checkpatch-Ignore: USE_NEGATIVE_ERRNO
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/exportsyms.uk
lib/devfs/include/devfs/device.h

index d67aee4a30ed1264735af5a31140ae3549729028..9cc3c52a376c6ec0779b718972071547fc492f8b 100644 (file)
@@ -52,6 +52,7 @@
 #include <string.h>
 
 #include <vfscore/prex.h>
+#include <vfscore/uio.h>
 #include <uk/essentials.h>
 #include <uk/mutex.h>
 
@@ -425,14 +426,13 @@ device_info(struct devinfo *info)
 }
 
 int
-enodev(void)
+devop_noop()
 {
-       return ENODEV;
+       return 0;
 }
 
 int
-nullop(void)
+devop_eperm()
 {
-       return 0;
+       return EPERM;
 }
-
index e5edd9052a54ff0073e6195d3c344b1941753c2b..8aacd3b7af7b43dbf8834a317f68870a41af7793 100644 (file)
@@ -4,3 +4,6 @@ device_close
 device_read
 device_ioctl
 device_info
+
+devop_noop
+devop_eperm
index cec718496372401dcf41830a87344327840a2049..376576bd99d8324b8f7051af21840a15b798081f 100644 (file)
 #include <sys/types.h>
 #include <uk/init.h>
 
-#include <vfscore/uio.h>
-
 #define MAXDEVNAME     12
 #define DO_RWMASK      0x3
 
-struct bio;
+struct uio;
 struct device;
 
 /*
@@ -62,13 +60,11 @@ struct devinfo {
 #define D_REM          0x00000004      /* removable device */
 #define D_TTY          0x00000010      /* tty device */
 
-typedef int (*devop_open_t)   (struct device *, int);
-typedef int (*devop_close_t)  (struct device *);
-typedef int (*devop_read_t)   (struct device *, struct uio *, int);
-typedef int (*devop_write_t)  (struct device *, struct uio *, int);
-typedef int (*devop_ioctl_t)  (struct device *, unsigned long, void *);
-typedef int (*devop_devctl_t) (struct device *, unsigned long, void *);
-typedef void (*devop_strategy_t)(struct bio *);
+typedef int (*devop_open_t)(struct device *, int);
+typedef int (*devop_close_t)(struct device *);
+typedef int (*devop_read_t)(struct device *, struct uio *, int);
+typedef int (*devop_write_t)(struct device *, struct uio *, int);
+typedef int (*devop_ioctl_t)(struct device *, unsigned long, void *);
 
 /*
  * Device operations
@@ -79,17 +75,11 @@ struct devops {
        devop_read_t    read;
        devop_write_t   write;
        devop_ioctl_t   ioctl;
-       devop_devctl_t  devctl;
-       devop_strategy_t strategy;
 };
 
-
-#define        no_open         ((devop_open_t)nullop)
-#define        no_close        ((devop_close_t)nullop)
-#define        no_read         ((devop_read_t)enodev)
-#define        no_write        ((devop_write_t)enodev)
-#define        no_ioctl        ((devop_ioctl_t)enodev)
-#define        no_devctl       ((devop_devctl_t)nullop)
+#define        dev_noop_open   ((devop_open_t)devop_noop)
+#define        dev_noop_close  ((devop_close_t)devop_noop)
+#define dev_noop_ioctl ((devop_ioctl_t)devop_eperm)
 
 /*
  * Driver object
@@ -200,8 +190,8 @@ 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    enodev(void);
-int    nullop(void);
+int devop_noop();
+int devop_eperm();
 
 struct device *device_create(struct driver *drv, const char *name, int flags);
 int device_destroy(struct device *dev);