[PATCH v2 00/18] mini-os: remove struct file dependency on config

Juergen Gross posted 18 patches 2 years, 3 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
Config.mk                     |   1 -
arch/x86/testbuild/all-no     |   1 -
arch/x86/testbuild/all-yes    |   1 -
arch/x86/testbuild/newxen-yes |   1 -
blkfront.c                    |  15 +-
console/xencons_ring.c        |   2 +-
fbfront.c                     |  16 +-
include/lib.h                 | 123 ++++++------
include/tpmfront.h            |   2 +
lib/sys.c                     | 363 +++++++++++++++++++++++-----------
lib/xs.c                      |  14 +-
netfront.c                    |   6 +-
tpm_tis.c                     |  23 +--
tpmfront.c                    |  33 ++--
14 files changed, 352 insertions(+), 249 deletions(-)
[PATCH v2 00/18] mini-os: remove struct file dependency on config
Posted by Juergen Gross 2 years, 3 months ago
Today the layout of struct file is depending on the Mini-OS
configuration. This is especially bad as the layout is exported to
external users like the Xen libraries built for Mini-OS, and those
are being built only once for multiple stubdom configurations.

Today there is no direct problem resulting from this, as the main
difference between struct file layouts is a large union containing all
the device specific data for the different file types. The largest
union member is not configuration dependant, so the build is currently
not broken.

In order to avoid any future problems this patch series is eliminating
the configuration dependency by replacing most of the device specific
union members by a single pointer.

The two union members used by Xen libraries can't be replaced yet, as
those need to be switched to use the generic pointer first.

In order to hide the Mini-OS internal implementation of the files
array, patches 15-17 are introducing a common framework to access a
struct file via its file descriptor, and to allocate new file types
dynamically instead of having them all pre-defined. The file type
specific operations are supplied via a function vector in order to
remove the dependency of lib/sys.c on all the various file types.

Changes in V2:
- added 3 more patches

Juergen Gross (18):
  mini-os: split struct file definition from its usage
  mini-os: makes file.read bool and move it ahead of device specific
    part
  mini-os: make offset a common struct file member for all types
  mini-os: replace multiple fd elements in struct file by common one
  mini-os: introduce a common dev pointer in struct file
  mini-os: eliminate blkfront union member in struct file
  mini-os: eliminate consfront union member in struct file
  mini-os: eliminate fbfront union member in struct file
  mini-os: eliminate kbdfront union member in struct file
  mini-os: eliminate netfront union member in struct file
  mini-os: move tpm respgot member of struct file to device specific
    data
  mini-os: eliminate tpmfront union member in struct file
  mini-os: eliminate tpmtis union member in struct file
  mini-os: eliminate xenbus union member in struct file
  mini-os: introduce get_file_from_fd()
  mini-os: reset file type in close() in one place only
  mini-os: use function vectors instead of switch for file operations
  mini-os: remove file type FTYPE_XC

 Config.mk                     |   1 -
 arch/x86/testbuild/all-no     |   1 -
 arch/x86/testbuild/all-yes    |   1 -
 arch/x86/testbuild/newxen-yes |   1 -
 blkfront.c                    |  15 +-
 console/xencons_ring.c        |   2 +-
 fbfront.c                     |  16 +-
 include/lib.h                 | 123 ++++++------
 include/tpmfront.h            |   2 +
 lib/sys.c                     | 363 +++++++++++++++++++++++-----------
 lib/xs.c                      |  14 +-
 netfront.c                    |   6 +-
 tpm_tis.c                     |  23 +--
 tpmfront.c                    |  33 ++--
 14 files changed, 352 insertions(+), 249 deletions(-)

-- 
2.26.2


Re: [PATCH v2 00/18] mini-os: remove struct file dependency on config
Posted by Andrew Cooper 2 years, 3 months ago
On 11/01/2022 14:57, Juergen Gross wrote:
> Today the layout of struct file is depending on the Mini-OS
> configuration. This is especially bad as the layout is exported to
> external users like the Xen libraries built for Mini-OS, and those
> are being built only once for multiple stubdom configurations.
>
> Today there is no direct problem resulting from this, as the main
> difference between struct file layouts is a large union containing all
> the device specific data for the different file types. The largest
> union member is not configuration dependant, so the build is currently
> not broken.
>
> In order to avoid any future problems this patch series is eliminating
> the configuration dependency by replacing most of the device specific
> union members by a single pointer.
>
> The two union members used by Xen libraries can't be replaced yet, as
> those need to be switched to use the generic pointer first.
>
> In order to hide the Mini-OS internal implementation of the files
> array, patches 15-17 are introducing a common framework to access a
> struct file via its file descriptor, and to allocate new file types
> dynamically instead of having them all pre-defined. The file type
> specific operations are supplied via a function vector in order to
> remove the dependency of lib/sys.c on all the various file types.

Patches 1 thru 15 seem fine and ready to go.  Would it help to get those
committed now?

~Andrew

Re: [PATCH v2 00/18] mini-os: remove struct file dependency on config
Posted by Juergen Gross 2 years, 3 months ago
On 11.01.22 20:42, Andrew Cooper wrote:
> On 11/01/2022 14:57, Juergen Gross wrote:
>> Today the layout of struct file is depending on the Mini-OS
>> configuration. This is especially bad as the layout is exported to
>> external users like the Xen libraries built for Mini-OS, and those
>> are being built only once for multiple stubdom configurations.
>>
>> Today there is no direct problem resulting from this, as the main
>> difference between struct file layouts is a large union containing all
>> the device specific data for the different file types. The largest
>> union member is not configuration dependant, so the build is currently
>> not broken.
>>
>> In order to avoid any future problems this patch series is eliminating
>> the configuration dependency by replacing most of the device specific
>> union members by a single pointer.
>>
>> The two union members used by Xen libraries can't be replaced yet, as
>> those need to be switched to use the generic pointer first.
>>
>> In order to hide the Mini-OS internal implementation of the files
>> array, patches 15-17 are introducing a common framework to access a
>> struct file via its file descriptor, and to allocate new file types
>> dynamically instead of having them all pre-defined. The file type
>> specific operations are supplied via a function vector in order to
>> remove the dependency of lib/sys.c on all the various file types.
> 
> Patches 1 thru 15 seem fine and ready to go.  Would it help to get those
> committed now?

With the one remark you had for patch 15 I think patches 1-14 could go
in now.


Juergen