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 : /**
13 : * @brief MCUmgr File System Management API
14 : * @defgroup mcumgr_fs_mgmt File System Management
15 : * @ingroup mcumgr_mgmt_api
16 : * @{
17 : */
18 :
19 : #ifdef __cplusplus
20 : extern "C" {
21 : #endif
22 :
23 : /**
24 : * @name Command IDs for File System Management group.
25 : * @{
26 : */
27 1 : #define FS_MGMT_ID_FILE 0 /**< File download/upload */
28 1 : #define FS_MGMT_ID_STAT 1 /**< File status */
29 1 : #define FS_MGMT_ID_HASH_CHECKSUM 2 /**< File hash/checksum */
30 1 : #define FS_MGMT_ID_SUPPORTED_HASH_CHECKSUM 3 /**< Supported file hash/checksum types */
31 1 : #define FS_MGMT_ID_OPENED_FILE 4 /**< File close */
32 : /**
33 : * @}
34 : */
35 :
36 : /**
37 : * Command result codes for file system management group.
38 : */
39 1 : enum fs_mgmt_err_code_t {
40 : /** No error, this is implied if there is no ret value in the response */
41 : FS_MGMT_ERR_OK = 0,
42 :
43 : /** Unknown error occurred. */
44 : FS_MGMT_ERR_UNKNOWN,
45 :
46 : /** The specified file name is not valid. */
47 : FS_MGMT_ERR_FILE_INVALID_NAME,
48 :
49 : /** The specified file does not exist. */
50 : FS_MGMT_ERR_FILE_NOT_FOUND,
51 :
52 : /** The specified file is a directory, not a file. */
53 : FS_MGMT_ERR_FILE_IS_DIRECTORY,
54 :
55 : /** Error occurred whilst attempting to open a file. */
56 : FS_MGMT_ERR_FILE_OPEN_FAILED,
57 :
58 : /** Error occurred whilst attempting to seek to an offset in a file. */
59 : FS_MGMT_ERR_FILE_SEEK_FAILED,
60 :
61 : /** Error occurred whilst attempting to read data from a file. */
62 : FS_MGMT_ERR_FILE_READ_FAILED,
63 :
64 : /** Error occurred whilst trying to truncate file. */
65 : FS_MGMT_ERR_FILE_TRUNCATE_FAILED,
66 :
67 : /** Error occurred whilst trying to delete file. */
68 : FS_MGMT_ERR_FILE_DELETE_FAILED,
69 :
70 : /** Error occurred whilst attempting to write data to a file. */
71 : FS_MGMT_ERR_FILE_WRITE_FAILED,
72 :
73 : /**
74 : * The specified data offset is not valid, this could indicate that the file on the device
75 : * has changed since the previous command. The length of the current file on the device is
76 : * returned as "len", the user application needs to decide how to handle this (e.g. the
77 : * hash of the file could be requested and compared with the hash of the length of the
78 : * file being uploaded to see if they match or not).
79 : */
80 : FS_MGMT_ERR_FILE_OFFSET_NOT_VALID,
81 :
82 : /** The requested offset is larger than the size of the file on the device. */
83 : FS_MGMT_ERR_FILE_OFFSET_LARGER_THAN_FILE,
84 :
85 : /** The requested checksum or hash type was not found or is not supported by this build. */
86 : FS_MGMT_ERR_CHECKSUM_HASH_NOT_FOUND,
87 :
88 : /** The specified mount point was not found or is not mounted. */
89 : FS_MGMT_ERR_MOUNT_POINT_NOT_FOUND,
90 :
91 : /** The specified mount point is that of a read-only filesystem. */
92 : FS_MGMT_ERR_READ_ONLY_FILESYSTEM,
93 :
94 : /** The operation cannot be performed because the file is empty with no contents. */
95 : FS_MGMT_ERR_FILE_EMPTY,
96 : };
97 :
98 : #ifdef __cplusplus
99 : }
100 : #endif
101 :
102 : /**
103 : * @}
104 : */
105 :
106 : #endif
|