diff mbox series

[v2,06/18] mini-os: eliminate blkfront union member in struct file

Message ID 20220111145817.22170-7-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series mini-os: remove struct file dependency on config | expand

Commit Message

Jürgen Groß Jan. 11, 2022, 2:58 p.m. UTC
Replace the blkfront specific union member in struct file with the
common dev pointer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 blkfront.c    | 6 +++---
 include/lib.h | 3 ---
 lib/sys.c     | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/blkfront.c b/blkfront.c
index 8137106..e3f42be 100644
--- a/blkfront.c
+++ b/blkfront.c
@@ -562,13 +562,13 @@  int blkfront_open(struct blkfront_dev *dev)
     }
     dev->fd = alloc_fd(FTYPE_BLK);
     printk("blk_open(%s) -> %d\n", dev->nodename, dev->fd);
-    files[dev->fd].blk.dev = dev;
+    files[dev->fd].dev = dev;
     return dev->fd;
 }
 
 int blkfront_posix_rwop(int fd, uint8_t* buf, size_t count, int write)
 {
-   struct blkfront_dev* dev = files[fd].blk.dev;
+   struct blkfront_dev* dev = files[fd].dev;
    off_t offset = files[fd].offset;
    struct blkfront_aiocb aiocb;
    unsigned long long disksize = dev->info.sectors * dev->info.sector_size;
@@ -718,7 +718,7 @@  int blkfront_posix_rwop(int fd, uint8_t* buf, size_t count, int write)
 
 int blkfront_posix_fstat(int fd, struct stat* buf)
 {
-   struct blkfront_dev* dev = files[fd].blk.dev;
+   struct blkfront_dev* dev = files[fd].dev;
 
    buf->st_mode = dev->info.mode;
    buf->st_uid = 0;
diff --git a/include/lib.h b/include/lib.h
index 60aaf1c..3a40634 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -196,9 +196,6 @@  struct file {
 	struct {
 	    struct netfront_dev *dev;
 	} tap;
-	struct {
-	    struct blkfront_dev *dev;
-	} blk;
 	struct {
 	    struct kbdfront_dev *dev;
 	} kbd;
diff --git a/lib/sys.c b/lib/sys.c
index 1da7401..f2fdbdf 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -456,7 +456,7 @@  int close(int fd)
 #endif
 #ifdef CONFIG_BLKFRONT
 	case FTYPE_BLK:
-            shutdown_blkfront(files[fd].blk.dev);
+            shutdown_blkfront(files[fd].dev);
 	    files[fd].type = FTYPE_NONE;
 	    return 0;
 #endif