1 /* 2 * Copyright (c) 2024 Linumiz. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <errno.h> 8 #include <stdio.h> 9 #include <zephyr/fs/fs.h> 10 #include <zephyr/sys/util_macro.h> 11 12 /** 13 * 14 * @brief deletes a name from the filesystem 15 * 16 * @return On success, zero is returned. On error, -1 is returned 17 * and errno is set to indicate the error. 18 */ 19 remove(const char * path)20int remove(const char *path) 21 { 22 if (!IS_ENABLED(CONFIG_FILE_SYSTEM)) { 23 errno = ENOTSUP; 24 return -1; 25 } 26 27 int ret = fs_unlink(path); 28 29 if (ret < 0) { 30 errno = -ret; 31 return -1; 32 } 33 34 return 0; 35 } 36