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

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



commit 0e55c583a0f44e6a35345d20bbe3f3c291445751
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Tue Jan 11 15:58:09 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Jan 12 11:35:46 2022 +0000

    Eliminate netfront union member in struct file
    
    Replace the netfront 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>
---
 include/lib.h | 3 ---
 lib/sys.c     | 6 +++---
 netfront.c    | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index 5201ed7..f2a124e 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -193,9 +193,6 @@ struct file {
            struct evtchn_port_list ports;
        } evtchn;
        struct gntmap gntmap;
-       struct {
-           struct netfront_dev *dev;
-       } tap;
 #ifdef CONFIG_TPMFRONT
        struct {
           struct tpmfront_dev *dev;
diff --git a/lib/sys.c b/lib/sys.c
index 8c7ea3c..b35e433 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -263,7 +263,7 @@ int read(int fd, void *buf, size_t nbytes)
 #ifdef CONFIG_NETFRONT
        case FTYPE_TAP: {
            ssize_t ret;
-           ret = netfront_receive(files[fd].tap.dev, buf, nbytes);
+           ret = netfront_receive(files[fd].dev, buf, nbytes);
            if (ret <= 0) {
                errno = EAGAIN;
                return -1;
@@ -339,7 +339,7 @@ int write(int fd, const void *buf, size_t nbytes)
 #endif
 #ifdef CONFIG_NETFRONT
        case FTYPE_TAP:
-           netfront_xmit(files[fd].tap.dev, (void*) buf, nbytes);
+           netfront_xmit(files[fd].dev, (void*) buf, nbytes);
            return nbytes;
 #endif
 #ifdef CONFIG_BLKFRONT
@@ -450,7 +450,7 @@ int close(int fd)
 #endif
 #ifdef CONFIG_NETFRONT
        case FTYPE_TAP:
-           shutdown_netfront(files[fd].tap.dev);
+           shutdown_netfront(files[fd].dev);
            files[fd].type = FTYPE_NONE;
            return 0;
 #endif
diff --git a/netfront.c b/netfront.c
index a566e34..7696451 100644
--- a/netfront.c
+++ b/netfront.c
@@ -576,7 +576,7 @@ int netfront_tap_open(char *nodename) {
     }
     dev->fd = alloc_fd(FTYPE_TAP);
     printk("tap_open(%s) -> %d\n", nodename, dev->fd);
-    files[dev->fd].tap.dev = dev;
+    files[dev->fd].dev = dev;
     return dev->fd;
 }
 #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®.