Skip to contentSkip to conversation

mini-os: remove device specific struct file members

PATCH Superseded Juergen Gross 3 participants 11 messages Jan 7, 2022 – Jan 10, 2022

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover mini-os: remove device specific struct file members

This small series is a followup to the series sent recently:

https://lists.xen.org/archives/html/xen-devel/2022-01/threads.html#00110

It contains the last cleanups related to struct file and can only be applied after the Xen libraries have stopped using the related union members.

Juergen Gross (2):
mini-os: remove event channel specific struct file member
mini-os: remove gnttab specific member from struct file

 include/lib.h | 13 -------------
 1 file changed, 13 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/2 mini-os: remove event channel specific struct file member

The event channel specific union member in struct file is no longer needed, so remove it together with the associated structure definitions.

---
 include/lib.h | 12 ------------
 1 file changed, 12 deletions(-)
include/lib.h +0 -12
index 7a0546b..cbfeea3 100644
@@ -173,15 +173,6 @@ enum fd_type {
     FTYPE_TPM_TIS,
 };
 
-LIST_HEAD(evtchn_port_list, evtchn_port_info);
-
-struct evtchn_port_info {
-        LIST_ENTRY(evtchn_port_info) list;
-        evtchn_port_t port;
-        unsigned long pending;
-        int bound;
-};
-
 struct file {
     enum fd_type type;
     bool read;	/* maybe available for read */
@@ -189,9 +180,6 @@ struct file {
     union {
         int fd; /* Any fd from an upper layer. */
         void *dev;
-	struct {
-	    struct evtchn_port_list ports;
-	} evtchn;
 	struct gntmap gntmap;
     };
 };
Signature · 1 line
2.26.2
#4 lore raw

PATCH 2/2 mini-os: remove gnttab specific member from struct file

In reply to Juergen Gross

The event channel specific union member in struct file is no longer needed, so remove it

---
 include/lib.h | 1 -
 1 file changed, 1 deletion(-)
include/lib.h +0 -1
index cbfeea3..b82e285 100644
@@ -180,7 +180,6 @@ struct file {
     union {
         int fd; /* Any fd from an upper layer. */
         void *dev;
-	struct gntmap gntmap;
     };
 };
 
Signature · 1 line
2.26.2
#5 lore raw
In reply to Juergen Gross
Quoted 8 lines · Juergen Gross

This small series is a followup to the series sent recently:

https://lists.xen.org/archives/html/xen-devel/2022-01/threads.html#00110

It contains the last cleanups related to struct file and can only be applied after the Xen libraries have stopped using the related union members.

Quoted 7 lines

Juergen Gross (2):
mini-os: remove event channel specific struct file member
mini-os: remove gnttab specific member from struct file

 include/lib.h | 13 -------------
 1 file changed, 13 deletions(-)

This all looks fine.  Even if we don't want to hide struct file, shouldn't we at least make the files[] array private to the MiniOS core?  It's another implementation detail which external users mustn't rely on.

~Andrew

#6 lore raw
Quoted 13 lines · Andrew Cooper
Quoted 12 lines · Juergen Gross

This small series is a followup to the series sent recently:

https://lists.xen.org/archives/html/xen-devel/2022-01/threads.html#00110

It contains the last cleanups related to struct file and can only be applied after the Xen libraries have stopped using the related union members.

Juergen Gross (2):
mini-os: remove event channel specific struct file member
mini-os: remove gnttab specific member from struct file

Quoted 8 lines
Quoted 3 lines
  include/lib.h | 13 -------------
  1 file changed, 13 deletions(-)

This all looks fine.  Even if we don't want to hide struct file, shouldn't we at least make the files[] array private to the MiniOS core?  It's another implementation detail which external users mustn't rely on.

In theory yes.

This will need some more work either by splitting headers or by using get_file_from_fd() everywhere in Mini-OS.

Juergen

#2 lore raw

Re: [PATCH 1/2] mini-os: remove event channel specific struct file member

In reply to Juergen Gross

Juergen Gross, le ven. 07 janv. 2022 11:47:05 +0100, a ecrit:

Quoted 2 lines

The event channel specific union member in struct file is no longer needed,

Doesn't xen/tools/libs/evtchn/minios.c use it?

Quoted 40 lines

so remove it together with the associated structure definitions.

---
 include/lib.h | 12 ------------
 1 file changed, 12 deletions(-)
include/lib.h +0 -12
index 7a0546b..cbfeea3 100644
@@ -173,15 +173,6 @@ enum fd_type {
     FTYPE_TPM_TIS,
 };
 
-LIST_HEAD(evtchn_port_list, evtchn_port_info);
-
-struct evtchn_port_info {
-        LIST_ENTRY(evtchn_port_info) list;
-        evtchn_port_t port;
-        unsigned long pending;
-        int bound;
-};
-
 struct file {
     enum fd_type type;
     bool read;	/* maybe available for read */
@@ -189,9 +180,6 @@ struct file {
     union {
         int fd; /* Any fd from an upper layer. */
         void *dev;
-	struct {
-	    struct evtchn_port_list ports;
-	} evtchn;
 	struct gntmap gntmap;
     };
 };
Signature · 1 line
2.26.2
#7 lore raw
In reply to Juergen Gross

Juergen Gross, le ven. 07 janv. 2022 11:47:04 +0100, a ecrit:

Quoted 2 lines

can only be applied after the Xen libraries have stopped using the related union members.

Ah, ok :) Was that submitted somewhere?

Samuel

#8 lore raw
Quoted 5 lines · Samuel Thibault

Juergen Gross, le ven. 07 janv. 2022 11:47:04 +0100, a ecrit:

Quoted 2 lines

can only be applied after the Xen libraries have stopped using the related union members.

Ah, ok :) Was that submitted somewhere?

I've sent the patches, but they can be applied only after the first Mini-OS series has been applied and the Xen build is using the updated Mini-OS tree.

Meanwhile I've found a way to decouple Mini-OS and the Xen libs even further. So this series and the Xen one will be updated.

In the end the libs will use dynamic hooks and Mini-OS will no longer need to have a config knob for supporting the libs (other than having libc enabled).

Juergen

#3 lore raw

Re: [PATCH 1/2] mini-os: remove event channel specific struct file member

In reply to Samuel Thibault
Quoted 5 lines · Samuel Thibault

Juergen Gross, le ven. 07 janv. 2022 11:47:05 +0100, a ecrit:

Quoted 2 lines

The event channel specific union member in struct file is no longer needed,

Doesn't xen/tools/libs/evtchn/minios.c use it?

Not after the Xen patches have been applied.

Juergen

#10 lore raw

Andrew Cooper, le lun. 10 janv. 2022 11:35:14 +0000, a ecrit:

Quoted 7 lines · Samuel Thibault
Quoted 4 lines

Juergen Gross, le ven. 07 janv. 2022 11:47:04 +0100, a ecrit:

Quoted 2 lines

can only be applied after the Xen libraries have stopped using the related union members.

Ah, ok :) Was that submitted somewhere?

https://lore.kernel.org/xen-devel/[email protected]/T/#u

Ok!

Samuel