/* * Copyright (C) 2024 Université de Lille * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @ingroup sys_shell_commands * @{ * * @file * @brief Shell commands for XIPFS * * @author Gregory Guche * * @} */ #if defined(MODULE_XIPFS_FS) || defined(MODULE_XIPFS) #include #include #include #include "fs/xipfs_fs.h" #include "include/xipfs.h" #include "shell.h" static char *execute_file_handler_args[XIPFS_EXEC_ARGC_MAX]; static int _execute_file_handler(int argc, char **argv) { if ( (argc == 1) || (argc > XIPFS_EXEC_ARGC_MAX) ) { printf("Usage %s xipfs_executable_filename [arg0] [arg1] ... [arg%d]\n", argv[0], (XIPFS_EXEC_ARGC_MAX - 1)); printf("\t- xipfs_executable_filename : filename of the desired XIPFS file to execute\n"); return 1; } memset(execute_file_handler_args, 0, sizeof(execute_file_handler_args)); for (int i = 1; i = (unsigned long)UINT32_MAX) { printf("Error : xipfs_executable_file_bytesize must be less than %lu.\n", UINT32_MAX); print_create_executable_file_usage(argc, argv); return 3; } int ret = xipfs_extended_driver_new_file(argv[1], (uint32_t)file_size, 1); if (ret != 0) { printf("Failed to create '%s' as an XIPFS executable file.", argv[1]); return 4; } return 0; } SHELL_COMMAND(create_executable, "Create an XIPFS executable file", _create_executable_file); #endif /* MODULE_XIPFS_FS */