From ad077d644a0e3ff2e712eccfda68d481afbf5695 Mon Sep 17 00:00:00 2001 From: "Tate, Hongliang Tian" Date: Thu, 16 Apr 2020 08:45:41 +0000 Subject: [PATCH] Fix the demo for the embedded mode --- demos/embedded_mode/bench_driver/main.c | 5 +++-- src/pal/include/occlum_pal_api.h | 8 ++++---- src/pal/src/pal_api.c | 2 +- src/run/main.c | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/demos/embedded_mode/bench_driver/main.c b/demos/embedded_mode/bench_driver/main.c index f9d2e336..e9d73d78 100644 --- a/demos/embedded_mode/bench_driver/main.c +++ b/demos/embedded_mode/bench_driver/main.c @@ -42,8 +42,9 @@ int main(int argc, char* argv[]) { const char* total_bytes_str = argv[1]; // Init Occlum PAL - const char* occlum_instance_dir = ".occlum"; - if (occlum_pal_init(occlum_instance_dir) < 0) { + occlum_pal_attr_t pal_attr = OCCLUM_PAL_ATTR_INITVAL; + pal_attr.instance_dir = ".occlum"; + if (occlum_pal_init(&pal_attr) < 0) { return EXIT_FAILURE; } diff --git a/src/pal/include/occlum_pal_api.h b/src/pal/include/occlum_pal_api.h index b9a3dcf1..06fb6a22 100644 --- a/src/pal/include/occlum_pal_api.h +++ b/src/pal/include/occlum_pal_api.h @@ -8,7 +8,7 @@ extern "C" { /* * Occlum PAL attributes */ -typedef struct { +typedef struct occlum_pal_attr { // Occlum instance dir. // // Specifies the path of an Occlum instance directory. Usually, this @@ -36,11 +36,11 @@ typedef struct { /* * The struct which consists of file descriptors of standard I/O */ -struct occlum_stdio_fds { +typedef struct occlum_stdio_fds { int stdin_fd; int stdout_fd; int stderr_fd; -}; +} occlum_stdio_fds_t; /* * @brief Initialize an Occlum enclave @@ -49,7 +49,7 @@ struct occlum_stdio_fds { * * @retval If 0, then success; otherwise, check errno for the exact error type. */ -int occlum_pal_init(occlum_pal_attr_t* attr); +int occlum_pal_init(const struct occlum_pal_attr* attr); /* * @brief Execute a command inside the Occlum enclave diff --git a/src/pal/src/pal_api.c b/src/pal/src/pal_api.c index 26bffb11..0bcd5afa 100644 --- a/src/pal/src/pal_api.c +++ b/src/pal/src/pal_api.c @@ -5,7 +5,7 @@ #include "pal_log.h" #include "pal_syscall.h" -int occlum_pal_init(occlum_pal_attr_t* attr) { +int occlum_pal_init(const struct occlum_pal_attr* attr) { errno = 0; if (attr == NULL) { diff --git a/src/run/main.c b/src/run/main.c index e6add33a..95f3e165 100644 --- a/src/run/main.c +++ b/src/run/main.c @@ -25,7 +25,7 @@ int main(int argc, char* argv[]) { const char** cmd_args = (const char**) &argv[2]; // Init Occlum PAL - occlum_pal_attr_t attr = OCCLUM_PAL_ATTR_INITVAL; + struct occlum_pal_attr attr = OCCLUM_PAL_ATTR_INITVAL; attr.instance_dir = get_instance_dir(); attr.log_level = getenv("OCCLUM_LOG_LEVEL"); if (occlum_pal_init(&attr) < 0) {