[MINIOS PATCH v3 0/5] mini-os: remove struct file dependency on config

Juergen Gross posted 5 patches 2 years, 3 months ago
Failed in applying to current master (apply log)
Config.mk                     |  11 +-
Makefile                      |   2 +-
arch/x86/testbuild/all-no     |   2 +-
arch/x86/testbuild/all-yes    |   2 +-
arch/x86/testbuild/newxen-yes |   2 +-
include/lib.h                 |  59 ++++--
lib/sys.c                     | 345 ++++++++++++++++++++++++++--------
lib/xs.c                      |   1 -
8 files changed, 313 insertions(+), 111 deletions(-)
[MINIOS PATCH v3 0/5] 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 1, 2, and  4 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.

Patch 5 is preparing a possible future support of libxenstore instead
of using the Mini-OS internal variant located in lib/xs.c.

Changes in v3:
- first 14 patches already applied
- added patch 5

Changes in V2:
- added 3 more patches

Juergen Gross (5):
  introduce get_file_from_fd()
  reset file type in close() in one place only
  remove file type FTYPE_XC
  use function vectors instead of switch for file operations
  add CONFIG_LIBXS item

 Config.mk                     |  11 +-
 Makefile                      |   2 +-
 arch/x86/testbuild/all-no     |   2 +-
 arch/x86/testbuild/all-yes    |   2 +-
 arch/x86/testbuild/newxen-yes |   2 +-
 include/lib.h                 |  59 ++++--
 lib/sys.c                     | 345 ++++++++++++++++++++++++++--------
 lib/xs.c                      |   1 -
 8 files changed, 313 insertions(+), 111 deletions(-)

-- 
2.26.2


Re: [MINIOS PATCH v3 0/5] mini-os: remove struct file dependency on config
Posted by Samuel Thibault 2 years, 3 months ago
Juergen Gross, le dim. 16 janv. 2022 07:45:22 +0100, a ecrit:
> 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 1, 2, and  4 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.
> 
> Patch 5 is preparing a possible future support of libxenstore instead
> of using the Mini-OS internal variant located in lib/xs.c.

Thanks!

Samuel