]> xenbits.xensource.com Git - mini-os.git/commitdiff
Eliminate tpmfront union member in struct file
authorJuergen Gross <jgross@suse.com>
Tue, 11 Jan 2022 14:58:11 +0000 (15:58 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 12 Jan 2022 11:35:55 +0000 (11:35 +0000)
Replace the tpmfront 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>
include/lib.h
lib/sys.c
tpmfront.c

index d7400658398584245d62bb95a6ffa8d467c0a09c..2ddc076c25fba635bdf70be3ccc41c69ea4546f8 100644 (file)
@@ -193,11 +193,6 @@ struct file {
            struct evtchn_port_list ports;
        } evtchn;
        struct gntmap gntmap;
-#ifdef CONFIG_TPMFRONT
-       struct {
-          struct tpmfront_dev *dev;
-       } tpmfront;
-#endif
 #ifdef CONFIG_TPM_TIS
        struct {
           struct tpm_chip *dev;
index b35e43340a491d179e3fe2bd0fe45b84e0efc4a0..b042bf51f06f3fb03d8537489e7a2459b7a11612 100644 (file)
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -462,7 +462,7 @@ int close(int fd)
 #endif
 #ifdef CONFIG_TPMFRONT
        case FTYPE_TPMFRONT:
-            shutdown_tpmfront(files[fd].tpmfront.dev);
+            shutdown_tpmfront(files[fd].dev);
            files[fd].type = FTYPE_NONE;
            return 0;
 #endif
index be671c29714f7d4a452ae979824210c9f1a44b2f..0a2fefc59f5d038bdf7a3fa672e6862918a1ab8c 100644 (file)
@@ -538,7 +538,7 @@ int tpmfront_open(struct tpmfront_dev* dev)
 
    dev->fd = alloc_fd(FTYPE_TPMFRONT);
    printk("tpmfront_open(%s) -> %d\n", dev->nodename, dev->fd);
-   files[dev->fd].tpmfront.dev = dev;
+   files[dev->fd].dev = dev;
    dev->respgot = false;
    return dev->fd;
 }
@@ -547,7 +547,7 @@ int tpmfront_posix_write(int fd, const uint8_t* buf, size_t count)
 {
    int rc;
    struct tpmfront_dev* dev;
-   dev = files[fd].tpmfront.dev;
+   dev = files[fd].dev;
 
    if(count == 0) {
       return 0;
@@ -573,7 +573,7 @@ int tpmfront_posix_read(int fd, uint8_t* buf, size_t count)
    size_t dummysz;
    struct tpmfront_dev* dev;
 
-   dev = files[fd].tpmfront.dev;
+   dev = files[fd].dev;
 
    if(count == 0) {
       return 0;
@@ -606,7 +606,7 @@ int tpmfront_posix_fstat(int fd, struct stat* buf)
    uint8_t* dummybuf;
    size_t dummysz;
    int rc;
-   struct tpmfront_dev* dev = files[fd].tpmfront.dev;
+   struct tpmfront_dev* dev = files[fd].dev;
 
    /* If we have a response waiting, then read it now from the backend
     * so we can get its length*/