Proposal: Add support for disks with custom block ops#303
Conversation
|
Can one of the admins verify this patch? |
|
This is for adding support for other (then raw) disk image types, like qcow, right? I think we should add the custom ops at the end of the lkl_disk structure, just like we do on the netdev side. That way we will not break the API. And in lkl_disk_add, if the ops field is null we can initialize it with the default ops. Also, if you plan to add support for other disk image types, could you please take a look at how we did it for netdev and see if it fits? |
|
@tavip Yes, this is to support things lke qcow images or encrypted images or (in my case) network backed images. I changed my implementation to what you propose by adding a custom ops field at the end of the #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <lkl.h>
int main()
{
struct lkl_disk *bar;
void *foo;
foo = malloc(1024);
memset(foo, '@', 1024);
free(foo);
bar = malloc(sizeof(struct lkl_disk));
printf("bar->ops = %p\n", bar->ops);
}Running this prints |
|
@tavip the AUR says 'Required by (0)' and in UEFI everything is being linked statically anyway. So if you ask me you can break binary compatibility as often as you want :) |
|
If there is a valid reason (as in this case), I think one can break the API as necessary. LKL does not publish releases nor is it widespread enough yet that one needs to be overly careful. |
5d37a53 to
159bb16
Compare
Extend `struct lkl_disk` to enable mounting disks that require special handling of read/write requests like qcow images, encrypted block devices, or network images. If `ops` is NULL liblkl will use the default platform ops in order to not break existing users. Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
159bb16 to
34d763b
Compare
|
@tavip Sounds good. I changed the PR to your suggested implementation |
|
@lkl-jenkins: test this please |
tavip
left a comment
There was a problem hiding this comment.
As you mentioned, this breaks the API, and we need to initialize the .ops field to NULL in the following apps: fs2tar.c, tests/boot.c and cptofs.c. lklfuse is fine, since there the lkl_disk is not allocated on stack but globally.
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
|
@tavip fixed |
|
@lkl-jenkins: test this please |
Introduce a new function,
lkl_disk_add2, that accepts one moreparameter than the original
lkl_disk_addwhich allows the caller to usea custom way of serving block requests.
lkl_disk_addis implemented as a trivial case forlkl_disk_add2bypassing the default ops in order to not break existing users.
This change is