[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mini-os master] Eliminate blkfront union member in struct file



commit 431147cf8dc8697dc023d353f62017837262063b
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Tue Jan 11 15:58:05 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Jan 12 11:35:29 2022 +0000

    Eliminate blkfront union member in struct file
    
    Replace the blkfront specific union member in struct file with the
    common dev pointer.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
---
 blkfront.c    | 6 +++---
 include/lib.h | 3 ---
 lib/sys.c     | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

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
--
generated by git-patchbot for /home/xen/git/mini-os.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.