Develop a way to support structures in the ABI
Develop a way to pack structures into the ABI data pack. Two considerations should be taken into account:
- The new fields may be added into the structure in the next minor version.
- The structures may be inherited, and the child structure may be passed instead of a base one. This is different from interface inheritance, all the whole structure data is passed at once. For example, the VectorImageElement structure may be inherited by the Line structure. Then, the Line may be passed whereever the VectorImageElement is expected, and the receiver must have the full data and full infomration on which exact structure type was passed.
This means that the structures can't be used in the data pack directly, because their size may differ, and the parameters of the data pack are no longer statically addressed which is bad. Placing the informatiion on the exact final type and pointer/offset in the extra data section where the structure is located seems to be much more promising.
Also, it needs to be decided how the kernel knows the structure minor version to use when reading or writing data to the data pack. There are at least 3 ways of doing so:
- API to get the exact minor version of each supported structure from the module. Either a method of the module interface (the handle to which is being returned by the initialize_module call) or a dedicated call similar to initialize_module itself. Need to develop what to pass to it for the module to know which exact structure is quered for. Obviously, this information should be cached kernel-side until the module is unloaded.
- API to get the exact version of SivDK the module was built with. The kernel may have the table with each type's available minor version listed there. However, having many different modules with many different SivDK versions forces the kernel to keep many such tables cached (even for the types the modules don't use).
- Pass the minor version each time the structure is passed. This solves the module-to-kernel data marshalling, however, when the kernel passes a structure to the module it doesn't know the version to specify, so another way to know what version is supported by the module should be used.
As the result of this task, the protocol of passing the structures should be developed. This should be documented in this GitLab.