seL4 / seL4_libs

No-assurance libraries for rapid-prototyping of seL4 apps.
https://docs.sel4.systems
Other
52 stars 62 forks source link

libsel4muslcsys: use const for CPIO data #62

Closed axel-h closed 2 years ago

axel-h commented 2 years ago

CPIO data cannot be modified, it's basically ROM. The CPIO APIs have been changed some time back to use the const qualifier to properly reflect this. Add the const qualifier here also to avoid compiler warnings.

For example, this is the compiler warning with the FileServer from the VM examples:

.../libs/sel4_global_components/components/FileServer/src/server.c: In function ‘pre_init’:
.../libs/sel4_global_components/components/FileServer/src/server.c:34:63: warning: passing argument 3 of ‘muslcsys_install_cpio_interface’ from incompatible pointer type [-Wincompatible-pointer-types]
     muslcsys_install_cpio_interface(_cpio_archive, cpio_size, cpio_get_file);
                                                               ^~~~~~~~~~~~~
In file included from .../libs/sel4_global_components/components/FileServer/src/server.c:13:
.../libs/sel4_libs/libsel4muslcsys/include/muslcsys/io.h:55:66: note: expected ‘muslcsys_cpio_get_file_fn_t’ {aka ‘void * (*)(void *, long unsigned int,  const char *, long unsigned int *)’} but argument is of type ‘const void * (*)(const void *, long unsigned int,  const char *, long unsigned int *)’
                                      muslcsys_cpio_get_file_fn_t fn);
                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~