Line data Source code
1 0 : /* 2 : * Copyright (c) 2018-2022 mcumgr authors 3 : * Copyright (c) 2022 Laird Connectivity 4 : * Copyright (c) 2022-2023 Nordic Semiconductor ASA 5 : * 6 : * SPDX-License-Identifier: Apache-2.0 7 : */ 8 : 9 : #ifndef H_FS_MGMT_ 10 : #define H_FS_MGMT_ 11 : 12 : #ifdef __cplusplus 13 : extern "C" { 14 : #endif 15 : 16 : /** 17 : * Command IDs for file system management group. 18 : */ 19 1 : #define FS_MGMT_ID_FILE 0 20 0 : #define FS_MGMT_ID_STAT 1 21 0 : #define FS_MGMT_ID_HASH_CHECKSUM 2 22 0 : #define FS_MGMT_ID_SUPPORTED_HASH_CHECKSUM 3 23 0 : #define FS_MGMT_ID_OPENED_FILE 4 24 : 25 : /** 26 : * Command result codes for file system management group. 27 : */ 28 1 : enum fs_mgmt_err_code_t { 29 : /** No error, this is implied if there is no ret value in the response */ 30 : FS_MGMT_ERR_OK = 0, 31 : 32 : /** Unknown error occurred. */ 33 : FS_MGMT_ERR_UNKNOWN, 34 : 35 : /** The specified file name is not valid. */ 36 : FS_MGMT_ERR_FILE_INVALID_NAME, 37 : 38 : /** The specified file does not exist. */ 39 : FS_MGMT_ERR_FILE_NOT_FOUND, 40 : 41 : /** The specified file is a directory, not a file. */ 42 : FS_MGMT_ERR_FILE_IS_DIRECTORY, 43 : 44 : /** Error occurred whilst attempting to open a file. */ 45 : FS_MGMT_ERR_FILE_OPEN_FAILED, 46 : 47 : /** Error occurred whilst attempting to seek to an offset in a file. */ 48 : FS_MGMT_ERR_FILE_SEEK_FAILED, 49 : 50 : /** Error occurred whilst attempting to read data from a file. */ 51 : FS_MGMT_ERR_FILE_READ_FAILED, 52 : 53 : /** Error occurred whilst trying to truncate file. */ 54 : FS_MGMT_ERR_FILE_TRUNCATE_FAILED, 55 : 56 : /** Error occurred whilst trying to delete file. */ 57 : FS_MGMT_ERR_FILE_DELETE_FAILED, 58 : 59 : /** Error occurred whilst attempting to write data to a file. */ 60 : FS_MGMT_ERR_FILE_WRITE_FAILED, 61 : 62 : /** 63 : * The specified data offset is not valid, this could indicate that the file on the device 64 : * has changed since the previous command. The length of the current file on the device is 65 : * returned as "len", the user application needs to decide how to handle this (e.g. the 66 : * hash of the file could be requested and compared with the hash of the length of the 67 : * file being uploaded to see if they match or not). 68 : */ 69 : FS_MGMT_ERR_FILE_OFFSET_NOT_VALID, 70 : 71 : /** The requested offset is larger than the size of the file on the device. */ 72 : FS_MGMT_ERR_FILE_OFFSET_LARGER_THAN_FILE, 73 : 74 : /** The requested checksum or hash type was not found or is not supported by this build. */ 75 : FS_MGMT_ERR_CHECKSUM_HASH_NOT_FOUND, 76 : 77 : /** The specified mount point was not found or is not mounted. */ 78 : FS_MGMT_ERR_MOUNT_POINT_NOT_FOUND, 79 : 80 : /** The specified mount point is that of a read-only filesystem. */ 81 : FS_MGMT_ERR_READ_ONLY_FILESYSTEM, 82 : 83 : /** The operation cannot be performed because the file is empty with no contents. */ 84 : FS_MGMT_ERR_FILE_EMPTY, 85 : }; 86 : 87 : #ifdef __cplusplus 88 : } 89 : #endif 90 : 91 : #endif