Message ID | 20220106115741.3219-10-jgross@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mini-os: remove struct file dependency from config | expand |
Juergen Gross, le jeu. 06 janv. 2022 12:57:35 +0100, a ecrit: > Replace the kbdfront 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 c8410af..1e055fb 100644 > --- a/fbfront.c > +++ b/fbfront.c > @@ -302,7 +302,7 @@ int kbdfront_open(struct kbdfront_dev *dev) > { > dev->fd = alloc_fd(FTYPE_KBD); > printk("kbd_open(%s) -> %d\n", dev->nodename, dev->fd); > - files[dev->fd].kbd.dev = dev; > + files[dev->fd].dev = dev; > return dev->fd; > } > #endif > diff --git a/include/lib.h b/include/lib.h > index 2a9a01c..5201ed7 100644 > --- a/include/lib.h > +++ b/include/lib.h > @@ -196,9 +196,6 @@ struct file { > struct { > struct netfront_dev *dev; > } tap; > - struct { > - struct kbdfront_dev *dev; > - } kbd; > #ifdef CONFIG_TPMFRONT > struct { > struct tpmfront_dev *dev; > diff --git a/lib/sys.c b/lib/sys.c > index 2d48657..8c7ea3c 100644 > --- a/lib/sys.c > +++ b/lib/sys.c > @@ -275,7 +275,7 @@ int read(int fd, void *buf, size_t nbytes) > case FTYPE_KBD: { > int ret, n; > n = nbytes / sizeof(union xenkbd_in_event); > - ret = kbdfront_receive(files[fd].kbd.dev, buf, n); > + ret = kbdfront_receive(files[fd].dev, buf, n); > if (ret <= 0) { > errno = EAGAIN; > return -1; > @@ -474,7 +474,7 @@ int close(int fd) > #endif > #ifdef CONFIG_KBDFRONT > case FTYPE_KBD: > - shutdown_kbdfront(files[fd].kbd.dev); > + shutdown_kbdfront(files[fd].dev); > files[fd].type = FTYPE_NONE; > return 0; > #endif > -- > 2.26.2 >
diff --git a/fbfront.c b/fbfront.c index c8410af..1e055fb 100644 --- a/fbfront.c +++ b/fbfront.c @@ -302,7 +302,7 @@ int kbdfront_open(struct kbdfront_dev *dev) { dev->fd = alloc_fd(FTYPE_KBD); printk("kbd_open(%s) -> %d\n", dev->nodename, dev->fd); - files[dev->fd].kbd.dev = dev; + files[dev->fd].dev = dev; return dev->fd; } #endif diff --git a/include/lib.h b/include/lib.h index 2a9a01c..5201ed7 100644 --- a/include/lib.h +++ b/include/lib.h @@ -196,9 +196,6 @@ struct file { struct { struct netfront_dev *dev; } tap; - struct { - struct kbdfront_dev *dev; - } kbd; #ifdef CONFIG_TPMFRONT struct { struct tpmfront_dev *dev; diff --git a/lib/sys.c b/lib/sys.c index 2d48657..8c7ea3c 100644 --- a/lib/sys.c +++ b/lib/sys.c @@ -275,7 +275,7 @@ int read(int fd, void *buf, size_t nbytes) case FTYPE_KBD: { int ret, n; n = nbytes / sizeof(union xenkbd_in_event); - ret = kbdfront_receive(files[fd].kbd.dev, buf, n); + ret = kbdfront_receive(files[fd].dev, buf, n); if (ret <= 0) { errno = EAGAIN; return -1; @@ -474,7 +474,7 @@ int close(int fd) #endif #ifdef CONFIG_KBDFRONT case FTYPE_KBD: - shutdown_kbdfront(files[fd].kbd.dev); + shutdown_kbdfront(files[fd].dev); files[fd].type = FTYPE_NONE; return 0; #endif
Replace the kbdfront specific union member in struct file with the common dev pointer. Signed-off-by: Juergen Gross <jgross@suse.com> --- fbfront.c | 2 +- include/lib.h | 3 --- lib/sys.c | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-)