[PATCH v2 08/18] mini-os: eliminate fbfront union member in struct file

Juergen Gross posted 18 patches 4 years ago
There is a newer version of this series
[PATCH v2 08/18] mini-os: eliminate fbfront union member in struct file
Posted by Juergen Gross 4 years ago
Replace the fbfront 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>
---
 fbfront.c     | 2 +-
 include/lib.h | 3 ---
 lib/sys.c     | 4 ++--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fbfront.c b/fbfront.c
index 6725da1..c8410af 100644
--- a/fbfront.c
+++ b/fbfront.c
@@ -703,7 +703,7 @@ int fbfront_open(struct fbfront_dev *dev)
 {
     dev->fd = alloc_fd(FTYPE_FB);
     printk("fb_open(%s) -> %d\n", dev->nodename, dev->fd);
-    files[dev->fd].fb.dev = dev;
+    files[dev->fd].dev = dev;
     return dev->fd;
 }
 #endif
diff --git a/include/lib.h b/include/lib.h
index 0cedae6..2a9a01c 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -199,9 +199,6 @@ struct file {
 	struct {
 	    struct kbdfront_dev *dev;
 	} kbd;
-	struct {
-	    struct fbfront_dev *dev;
-	} fb;
 #ifdef CONFIG_TPMFRONT
 	struct {
 	   struct tpmfront_dev *dev;
diff --git a/lib/sys.c b/lib/sys.c
index 62c2020..2d48657 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -287,7 +287,7 @@ int read(int fd, void *buf, size_t nbytes)
         case FTYPE_FB: {
             int ret, n;
             n = nbytes / sizeof(union xenfb_in_event);
-            ret = fbfront_receive(files[fd].fb.dev, buf, n);
+            ret = fbfront_receive(files[fd].dev, buf, n);
 	    if (ret <= 0) {
 		errno = EAGAIN;
 		return -1;
@@ -480,7 +480,7 @@ int close(int fd)
 #endif
 #ifdef CONFIG_FBFRONT
 	case FTYPE_FB:
-            shutdown_fbfront(files[fd].fb.dev);
+            shutdown_fbfront(files[fd].dev);
             files[fd].type = FTYPE_NONE;
             return 0;
 #endif
-- 
2.26.2