[4d3017a] | 1 | /** |
---|
[9da9cf4a] | 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @ingroup LibIO |
---|
| 5 | * |
---|
[c5782a2] | 6 | * @brief Basic IO API |
---|
| 7 | * |
---|
[cefc9aea] | 8 | * This file contains the support infrastructure used to manage the |
---|
| 9 | * table of integer style file descriptors used by the low level |
---|
| 10 | * POSIX system calls like open(), read, fstat(), etc. |
---|
[4d3017a] | 11 | */ |
---|
| 12 | |
---|
[b06e68ef] | 13 | /* |
---|
[ad78965d] | 14 | * COPYRIGHT (c) 1989-2008. |
---|
[07a3253d] | 15 | * On-Line Applications Research Corporation (OAR). |
---|
| 16 | * |
---|
[3b7c123] | 17 | * Modifications to support reference counting in the file system are |
---|
| 18 | * Copyright (c) 2012 embedded brains GmbH. |
---|
| 19 | * |
---|
[07a3253d] | 20 | * The license and distribution terms for this file may be |
---|
| 21 | * found in the file LICENSE in this distribution or at |
---|
[0eae36c7] | 22 | * http://www.rtems.com/license/LICENSE. |
---|
[b06e68ef] | 23 | */ |
---|
| 24 | |
---|
[7945944] | 25 | #ifndef _RTEMS_RTEMS_LIBIO_H |
---|
| 26 | #define _RTEMS_RTEMS_LIBIO_H |
---|
[b06e68ef] | 27 | |
---|
[7a3878b] | 28 | #include <sys/types.h> |
---|
[dcec5a4] | 29 | #include <sys/stat.h> |
---|
[9b05600] | 30 | #include <sys/ioctl.h> |
---|
[eb649786] | 31 | #include <sys/statvfs.h> |
---|
[dcec5a4] | 32 | |
---|
[9da9cf4a] | 33 | #include <unistd.h> |
---|
| 34 | #include <termios.h> |
---|
[07a3253d] | 35 | |
---|
[9da9cf4a] | 36 | #include <rtems.h> |
---|
[d09ad1f0] | 37 | #include <rtems/fs.h> |
---|
[9da9cf4a] | 38 | #include <rtems/chain.h> |
---|
[07a3253d] | 39 | |
---|
[80c2966] | 40 | #ifdef __cplusplus |
---|
| 41 | extern "C" { |
---|
| 42 | #endif |
---|
| 43 | |
---|
[9da9cf4a] | 44 | /** |
---|
[3b7c123] | 45 | * @defgroup LibIOFSOps File System Operations |
---|
[9da9cf4a] | 46 | * |
---|
[3b7c123] | 47 | * @ingroup LibIO |
---|
[9da9cf4a] | 48 | * |
---|
[3b7c123] | 49 | * @brief File system operations. |
---|
[9da9cf4a] | 50 | */ |
---|
[b697bc6] | 51 | /**@{**/ |
---|
[9da9cf4a] | 52 | |
---|
| 53 | /** |
---|
[1e01385] | 54 | * @brief File system node types. |
---|
[07a3253d] | 55 | */ |
---|
[1e01385] | 56 | typedef enum { |
---|
| 57 | RTEMS_FILESYSTEM_DIRECTORY, |
---|
| 58 | RTEMS_FILESYSTEM_DEVICE, |
---|
| 59 | RTEMS_FILESYSTEM_HARD_LINK, |
---|
| 60 | RTEMS_FILESYSTEM_SYM_LINK, |
---|
[bea7043c] | 61 | RTEMS_FILESYSTEM_MEMORY_FILE, |
---|
| 62 | RTEMS_FILESYSTEM_INVALID_NODE_TYPE |
---|
[1e01385] | 63 | } rtems_filesystem_node_types_t; |
---|
[07a3253d] | 64 | |
---|
[9da9cf4a] | 65 | /** |
---|
[3b7c123] | 66 | * @brief Locks a file system instance. |
---|
[9da9cf4a] | 67 | * |
---|
[3b7c123] | 68 | * This lock must allow nesting. |
---|
| 69 | * |
---|
| 70 | * @param[in, out] mt_entry The mount table entry of the file system instance. |
---|
| 71 | * |
---|
| 72 | * @see rtems_filesystem_default_lock(). |
---|
[07a3253d] | 73 | */ |
---|
[3b7c123] | 74 | typedef void (*rtems_filesystem_mt_entry_lock_t)( |
---|
[7666afc] | 75 | const rtems_filesystem_mount_table_entry_t *mt_entry |
---|
[3b7c123] | 76 | ); |
---|
[9da9cf4a] | 77 | |
---|
[f9a4e80] | 78 | /** |
---|
[3b7c123] | 79 | * @brief Unlocks a file system instance. |
---|
| 80 | * |
---|
| 81 | * @param[in, out] mt_entry The mount table entry of the file system instance. |
---|
| 82 | * |
---|
| 83 | * @see rtems_filesystem_default_unlock(). |
---|
[f9a4e80] | 84 | */ |
---|
[3b7c123] | 85 | typedef void (*rtems_filesystem_mt_entry_unlock_t)( |
---|
[7666afc] | 86 | const rtems_filesystem_mount_table_entry_t *mt_entry |
---|
[07a3253d] | 87 | ); |
---|
| 88 | |
---|
[f9a4e80] | 89 | /** |
---|
[3b7c123] | 90 | * @brief Path evaluation context. |
---|
[f9a4e80] | 91 | */ |
---|
[3b7c123] | 92 | typedef struct { |
---|
| 93 | /** |
---|
| 94 | * The contents of the remaining path to be evaluated. |
---|
| 95 | */ |
---|
| 96 | const char *path; |
---|
| 97 | |
---|
| 98 | /** |
---|
| 99 | * The length of the remaining path to be evaluated. |
---|
| 100 | */ |
---|
| 101 | size_t pathlen; |
---|
| 102 | |
---|
| 103 | /** |
---|
| 104 | * The contents of the token to be evaluated with respect to the current |
---|
| 105 | * location. |
---|
| 106 | */ |
---|
| 107 | const char *token; |
---|
| 108 | |
---|
| 109 | /** |
---|
| 110 | * The length of the token to be evaluated with respect to the current |
---|
| 111 | * location. |
---|
| 112 | */ |
---|
| 113 | size_t tokenlen; |
---|
| 114 | |
---|
| 115 | /** |
---|
| 116 | * The path evaluation is controlled by the following flags |
---|
[2563410] | 117 | * - RTEMS_FS_PERMS_READ, |
---|
| 118 | * - RTEMS_FS_PERMS_WRITE, |
---|
| 119 | * - RTEMS_FS_PERMS_EXEC, |
---|
| 120 | * - RTEMS_FS_FOLLOW_HARD_LINK, |
---|
| 121 | * - RTEMS_FS_FOLLOW_SYM_LINK, |
---|
| 122 | * - RTEMS_FS_MAKE, |
---|
| 123 | * - RTEMS_FS_EXCLUSIVE, |
---|
| 124 | * - RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS, and |
---|
| 125 | * - RTEMS_FS_REJECT_TERMINAL_DOT. |
---|
[3b7c123] | 126 | */ |
---|
| 127 | int flags; |
---|
| 128 | |
---|
| 129 | /** |
---|
| 130 | * Symbolic link evaluation is a recursive operation. This field helps to |
---|
| 131 | * limit the recursion level and thus prevents a stack overflow. The |
---|
| 132 | * recursion level is limited by RTEMS_FILESYSTEM_SYMLOOP_MAX. |
---|
| 133 | */ |
---|
| 134 | int recursionlevel; |
---|
| 135 | |
---|
| 136 | /** |
---|
| 137 | * This is the current file system location of the evaluation process. |
---|
| 138 | * Tokens are evaluated with respect to the current location. The token |
---|
| 139 | * interpretation may change the current location. The purpose of the path |
---|
| 140 | * evaluation is to change the start location into a final current location |
---|
| 141 | * according to the path. |
---|
| 142 | */ |
---|
| 143 | rtems_filesystem_location_info_t currentloc; |
---|
| 144 | |
---|
| 145 | /** |
---|
| 146 | * The location of the root directory of the user environment during the |
---|
| 147 | * evaluation start. |
---|
| 148 | */ |
---|
| 149 | rtems_filesystem_global_location_t *rootloc; |
---|
| 150 | |
---|
| 151 | /** |
---|
| 152 | * The start location of the evaluation process. The start location my |
---|
| 153 | * change during symbolic link evaluation. |
---|
| 154 | */ |
---|
| 155 | rtems_filesystem_global_location_t *startloc; |
---|
| 156 | } rtems_filesystem_eval_path_context_t; |
---|
[07a3253d] | 157 | |
---|
[f9a4e80] | 158 | /** |
---|
[3b7c123] | 159 | * @brief Path evaluation. |
---|
| 160 | * |
---|
| 161 | * @param[in, out] ctx The path evaluation context. |
---|
| 162 | * |
---|
| 163 | * @see rtems_filesystem_default_eval_path(). |
---|
[f9a4e80] | 164 | */ |
---|
[3b7c123] | 165 | typedef void (*rtems_filesystem_eval_path_t)( |
---|
| 166 | rtems_filesystem_eval_path_context_t *ctx |
---|
[07a3253d] | 167 | ); |
---|
| 168 | |
---|
[f9a4e80] | 169 | /** |
---|
[3b7c123] | 170 | * @brief Creates a new link for the existing file. |
---|
| 171 | * |
---|
| 172 | * @param[in] parentloc The location of the parent of the new link. |
---|
| 173 | * @param[in] targetloc The location of the target file. |
---|
| 174 | * @param[in] name Name for the new link. |
---|
| 175 | * @param[in] namelen Length of the name for the new link in characters. |
---|
| 176 | * |
---|
| 177 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 178 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 179 | * |
---|
| 180 | * @see rtems_filesystem_default_link(). |
---|
[f9a4e80] | 181 | */ |
---|
[3b7c123] | 182 | typedef int (*rtems_filesystem_link_t)( |
---|
| 183 | const rtems_filesystem_location_info_t *parentloc, |
---|
| 184 | const rtems_filesystem_location_info_t *targetloc, |
---|
| 185 | const char *name, |
---|
| 186 | size_t namelen |
---|
[07a3253d] | 187 | ); |
---|
| 188 | |
---|
[f9a4e80] | 189 | /** |
---|
[3b7c123] | 190 | * @brief Changes the mode of a node. |
---|
| 191 | * |
---|
| 192 | * @param[in] loc The location of the node. |
---|
| 193 | * @param[in] mode The new mode of the node |
---|
| 194 | * |
---|
| 195 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 196 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 197 | * |
---|
| 198 | * @see rtems_filesystem_default_fchmod(). |
---|
[f9a4e80] | 199 | */ |
---|
[3b7c123] | 200 | typedef int (*rtems_filesystem_fchmod_t)( |
---|
| 201 | const rtems_filesystem_location_info_t *loc, |
---|
| 202 | mode_t mode |
---|
[07a3253d] | 203 | ); |
---|
| 204 | |
---|
[f9a4e80] | 205 | /** |
---|
[3b7c123] | 206 | * @brief Changes owner and group of a node. |
---|
| 207 | * |
---|
| 208 | * @param[in] loc The location of the node. |
---|
| 209 | * @param[in] owner User ID for the node. |
---|
| 210 | * @param[in] group Group ID for the node. |
---|
| 211 | * |
---|
| 212 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 213 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 214 | * |
---|
| 215 | * @see rtems_filesystem_default_chown(). |
---|
[f9a4e80] | 216 | */ |
---|
[3b7c123] | 217 | typedef int (*rtems_filesystem_chown_t)( |
---|
| 218 | const rtems_filesystem_location_info_t *loc, |
---|
| 219 | uid_t owner, |
---|
| 220 | gid_t group |
---|
[07a3253d] | 221 | ); |
---|
| 222 | |
---|
[f9a4e80] | 223 | /** |
---|
[3b7c123] | 224 | * @brief Clones a location. |
---|
| 225 | * |
---|
| 226 | * The location is initialized with a bitwise copy of an existing location. |
---|
| 227 | * The caller must ensure that this location is protected from a release during |
---|
| 228 | * the clone operation. After a successful clone operation the clone will be |
---|
| 229 | * added to the location chain of the corresponding mount table entry. |
---|
| 230 | * |
---|
| 231 | * @param[in, out] loc Location to clone. |
---|
| 232 | * |
---|
| 233 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 234 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 235 | * |
---|
| 236 | * @see rtems_filesystem_default_clonenode(). |
---|
[f9a4e80] | 237 | */ |
---|
[3b7c123] | 238 | typedef int (*rtems_filesystem_clonenode_t)( |
---|
| 239 | rtems_filesystem_location_info_t *loc |
---|
[07a3253d] | 240 | ); |
---|
| 241 | |
---|
[f9a4e80] | 242 | /** |
---|
[3b7c123] | 243 | * @brief Frees the location of a node. |
---|
| 244 | * |
---|
| 245 | * @param[in] loc The location of the node. |
---|
| 246 | * |
---|
| 247 | * @see rtems_filesystem_default_freenode(). |
---|
[f9a4e80] | 248 | */ |
---|
[3b7c123] | 249 | typedef void (*rtems_filesystem_freenode_t)( |
---|
| 250 | const rtems_filesystem_location_info_t *loc |
---|
[07a3253d] | 251 | ); |
---|
| 252 | |
---|
[f9a4e80] | 253 | /** |
---|
[3b7c123] | 254 | * @brief Mounts a file system instance in a mount point (directory). |
---|
| 255 | * |
---|
| 256 | * The mount point belongs to the file system instance of the handler and is |
---|
| 257 | * specified by a field of the mount table entry. The handler must check that |
---|
| 258 | * the mount point is capable of mounting a file system instance. This is the |
---|
| 259 | * last step during the mount process. The file system instance is fully |
---|
| 260 | * initialized at this point. |
---|
| 261 | * |
---|
| 262 | * @param[in] mt_entry The mount table entry. |
---|
| 263 | * |
---|
| 264 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 265 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 266 | * |
---|
| 267 | * @see rtems_filesystem_default_mount(). |
---|
[f9a4e80] | 268 | */ |
---|
[3b7c123] | 269 | typedef int (*rtems_filesystem_mount_t) ( |
---|
| 270 | rtems_filesystem_mount_table_entry_t *mt_entry |
---|
[07a3253d] | 271 | ); |
---|
| 272 | |
---|
[f9a4e80] | 273 | /** |
---|
[3b7c123] | 274 | * @brief Initializes a file system instance. |
---|
| 275 | * |
---|
| 276 | * This function must initialize the file system root node in the mount table |
---|
| 277 | * entry. |
---|
| 278 | * |
---|
| 279 | * @param[in] mt_entry The mount table entry. |
---|
| 280 | * @param[in] data The data provided by the user. |
---|
| 281 | * |
---|
| 282 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 283 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[f9a4e80] | 284 | */ |
---|
[3b7c123] | 285 | typedef int (*rtems_filesystem_fsmount_me_t)( |
---|
| 286 | rtems_filesystem_mount_table_entry_t *mt_entry, |
---|
| 287 | const void *data |
---|
[07a3253d] | 288 | ); |
---|
| 289 | |
---|
[f9a4e80] | 290 | /** |
---|
[3b7c123] | 291 | * @brief Unmounts a file system instance in a mount point (directory). |
---|
| 292 | * |
---|
| 293 | * In case this function is successful the file system instance will be marked |
---|
| 294 | * as unmounted. The file system instance will be destroyed when the last |
---|
| 295 | * reference to it vanishes. |
---|
| 296 | * |
---|
| 297 | * @param[in] mt_entry The mount table entry. |
---|
| 298 | * |
---|
| 299 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 300 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 301 | * |
---|
| 302 | * @see rtems_filesystem_default_unmount(). |
---|
[f9a4e80] | 303 | */ |
---|
[3b7c123] | 304 | typedef int (*rtems_filesystem_unmount_t) ( |
---|
| 305 | rtems_filesystem_mount_table_entry_t *mt_entry |
---|
[07a3253d] | 306 | ); |
---|
| 307 | |
---|
[f9a4e80] | 308 | /** |
---|
[3b7c123] | 309 | * @brief Destroys a file system instance. |
---|
| 310 | * |
---|
| 311 | * The mount point node location of the mount table entry is invalid. This |
---|
| 312 | * handler must free the file system root location and all remaining resources |
---|
| 313 | * of the file system instance. |
---|
| 314 | * |
---|
| 315 | * @param[in] mt_entry The mount table entry. |
---|
| 316 | * |
---|
| 317 | * @see rtems_filesystem_default_fsunmount(). |
---|
[f9a4e80] | 318 | */ |
---|
[3b7c123] | 319 | typedef void (*rtems_filesystem_fsunmount_me_t)( |
---|
| 320 | rtems_filesystem_mount_table_entry_t *mt_entry |
---|
[af020036] | 321 | ); |
---|
| 322 | |
---|
[3b7c123] | 323 | /** |
---|
| 324 | * @brief Tests if the node of one location is equal to the node of the other |
---|
| 325 | * location. |
---|
| 326 | * |
---|
| 327 | * The caller ensures that both nodes are within the same file system instance. |
---|
| 328 | * |
---|
| 329 | * @param[in] a The one location. |
---|
| 330 | * @param[in] b The other location. |
---|
| 331 | * |
---|
| 332 | * @retval true The nodes of the locations are equal. |
---|
| 333 | * @retval false Otherwise. |
---|
| 334 | * |
---|
| 335 | * @see rtems_filesystem_default_are_nodes_equal(). |
---|
| 336 | */ |
---|
| 337 | typedef bool (*rtems_filesystem_are_nodes_equal_t)( |
---|
| 338 | const rtems_filesystem_location_info_t *a, |
---|
| 339 | const rtems_filesystem_location_info_t *b |
---|
[4a07d2b] | 340 | ); |
---|
| 341 | |
---|
[9da9cf4a] | 342 | /** |
---|
[3b7c123] | 343 | * @brief Returns the node type. |
---|
| 344 | * |
---|
| 345 | * @param[in] loc The location of the node. |
---|
| 346 | * |
---|
| 347 | * @return Type of the node. |
---|
| 348 | * |
---|
| 349 | * @see rtems_filesystem_default_node_type(). |
---|
[9da9cf4a] | 350 | */ |
---|
[3b7c123] | 351 | typedef rtems_filesystem_node_types_t (*rtems_filesystem_node_type_t)( |
---|
| 352 | const rtems_filesystem_location_info_t *loc |
---|
| 353 | ); |
---|
[f9a4e80] | 354 | |
---|
[3b7c123] | 355 | /** |
---|
| 356 | * @brief Creates a new node. |
---|
| 357 | * |
---|
| 358 | * This handler should create a new node according to the parameters. |
---|
| 359 | * |
---|
| 360 | * @param[in] parentloc The location of the parent of the new node. |
---|
| 361 | * @param[in] name Name for the new node. |
---|
| 362 | * @param[in] namelen Length of the name for the new node in characters. |
---|
| 363 | * @param[in] mode Mode for the new node. |
---|
| 364 | * @param[in] dev Optional device identifier for the new node. |
---|
| 365 | * |
---|
| 366 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 367 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 368 | * |
---|
| 369 | * @see rtems_filesystem_default_mknod(). |
---|
| 370 | */ |
---|
| 371 | typedef int (*rtems_filesystem_mknod_t)( |
---|
| 372 | const rtems_filesystem_location_info_t *parentloc, |
---|
| 373 | const char *name, |
---|
| 374 | size_t namelen, |
---|
| 375 | mode_t mode, |
---|
| 376 | dev_t dev |
---|
| 377 | ); |
---|
[f9a4e80] | 378 | |
---|
[3b7c123] | 379 | /** |
---|
| 380 | * @brief Removes a node. |
---|
| 381 | * |
---|
| 382 | * @param[in] parentloc The location of the parent of the node. |
---|
| 383 | * @param[in] loc The location of the node. |
---|
| 384 | * |
---|
| 385 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 386 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 387 | * |
---|
| 388 | * @see rtems_filesystem_default_rmnod(). |
---|
| 389 | */ |
---|
| 390 | typedef int (*rtems_filesystem_rmnod_t)( |
---|
| 391 | const rtems_filesystem_location_info_t *parentloc, |
---|
| 392 | const rtems_filesystem_location_info_t *loc |
---|
| 393 | ); |
---|
[f9a4e80] | 394 | |
---|
[3b7c123] | 395 | /** |
---|
| 396 | * @brief Set node access and modification times. |
---|
| 397 | * |
---|
| 398 | * @param[in] loc The location of the node. |
---|
| 399 | * @param[in] actime Access time for the node. |
---|
| 400 | * @param[in] modtime Modification for the node. |
---|
| 401 | * |
---|
| 402 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 403 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 404 | * |
---|
| 405 | * @see rtems_filesystem_default_utime(). |
---|
| 406 | */ |
---|
| 407 | typedef int (*rtems_filesystem_utime_t)( |
---|
| 408 | const rtems_filesystem_location_info_t *loc, |
---|
| 409 | time_t actime, |
---|
| 410 | time_t modtime |
---|
| 411 | ); |
---|
[f9a4e80] | 412 | |
---|
[3b7c123] | 413 | /** |
---|
| 414 | * @brief Makes a symbolic link to a node. |
---|
| 415 | * |
---|
| 416 | * @param[in] parentloc The location of the parent of the new symbolic link. |
---|
| 417 | * @param[in] name Name for the new symbolic link. |
---|
| 418 | * @param[in] namelen Length of the name for the new symbolic link in |
---|
| 419 | * characters. |
---|
| 420 | * @param[in] target Contents for the symbolic link. |
---|
| 421 | * |
---|
| 422 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 423 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 424 | * |
---|
| 425 | * @see rtems_filesystem_default_symlink(). |
---|
| 426 | */ |
---|
| 427 | typedef int (*rtems_filesystem_symlink_t)( |
---|
| 428 | const rtems_filesystem_location_info_t *parentloc, |
---|
| 429 | const char *name, |
---|
| 430 | size_t namelen, |
---|
| 431 | const char *target |
---|
| 432 | ); |
---|
[1e01385] | 433 | |
---|
[3b7c123] | 434 | /** |
---|
| 435 | * @brief Reads the contents of a symbolic link. |
---|
| 436 | * |
---|
| 437 | * @param[in] loc The location of the symbolic link. |
---|
| 438 | * @param[out] buf The buffer for the contents. |
---|
| 439 | * @param[in] bufsize The size of the buffer in characters. |
---|
| 440 | * |
---|
| 441 | * @retval non-negative Size of the actual contents in characters. |
---|
[d0b9295f] | 442 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 443 | * |
---|
| 444 | * @see rtems_filesystem_default_readlink(). |
---|
| 445 | */ |
---|
| 446 | typedef ssize_t (*rtems_filesystem_readlink_t)( |
---|
| 447 | const rtems_filesystem_location_info_t *loc, |
---|
| 448 | char *buf, |
---|
| 449 | size_t bufsize |
---|
| 450 | ); |
---|
[1e01385] | 451 | |
---|
[dace9ed1] | 452 | /** |
---|
[3b7c123] | 453 | * @brief Renames a node. |
---|
| 454 | * |
---|
| 455 | * @param[in] oldparentloc The location of the parent of the old node. |
---|
| 456 | * @param[in] oldloc The location of the old node. |
---|
| 457 | * @param[in] newparentloc The location of the parent of the new node. |
---|
| 458 | * @param[in] name Name for the new node. |
---|
| 459 | * @param[in] namelen Length of the name for the new node in characters. |
---|
| 460 | * |
---|
| 461 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 462 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 463 | * |
---|
| 464 | * @see rtems_filesystem_default_rename(). |
---|
[dace9ed1] | 465 | */ |
---|
[3b7c123] | 466 | typedef int (*rtems_filesystem_rename_t)( |
---|
| 467 | const rtems_filesystem_location_info_t *oldparentloc, |
---|
| 468 | const rtems_filesystem_location_info_t *oldloc, |
---|
| 469 | const rtems_filesystem_location_info_t *newparentloc, |
---|
| 470 | const char *name, |
---|
| 471 | size_t namelen |
---|
[dace9ed1] | 472 | ); |
---|
| 473 | |
---|
| 474 | /** |
---|
[3b7c123] | 475 | * @brief Gets file system information. |
---|
| 476 | * |
---|
| 477 | * @param[in] loc The location of a node. |
---|
| 478 | * @param[out] buf Buffer for file system information. |
---|
| 479 | * |
---|
| 480 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 481 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 482 | * |
---|
| 483 | * @see rtems_filesystem_default_statvfs(). |
---|
[dace9ed1] | 484 | */ |
---|
[3b7c123] | 485 | typedef int (*rtems_filesystem_statvfs_t)( |
---|
| 486 | const rtems_filesystem_location_info_t *loc, |
---|
| 487 | struct statvfs *buf |
---|
[dace9ed1] | 488 | ); |
---|
| 489 | |
---|
[3b7c123] | 490 | /** |
---|
| 491 | * @brief File system operations table. |
---|
| 492 | */ |
---|
| 493 | struct _rtems_filesystem_operations_table { |
---|
| 494 | rtems_filesystem_mt_entry_lock_t lock_h; |
---|
| 495 | rtems_filesystem_mt_entry_unlock_t unlock_h; |
---|
| 496 | rtems_filesystem_eval_path_t eval_path_h; |
---|
| 497 | rtems_filesystem_link_t link_h; |
---|
| 498 | rtems_filesystem_are_nodes_equal_t are_nodes_equal_h; |
---|
| 499 | rtems_filesystem_node_type_t node_type_h; |
---|
| 500 | rtems_filesystem_mknod_t mknod_h; |
---|
| 501 | rtems_filesystem_rmnod_t rmnod_h; |
---|
| 502 | rtems_filesystem_fchmod_t fchmod_h; |
---|
| 503 | rtems_filesystem_chown_t chown_h; |
---|
| 504 | rtems_filesystem_clonenode_t clonenod_h; |
---|
| 505 | rtems_filesystem_freenode_t freenod_h; |
---|
| 506 | rtems_filesystem_mount_t mount_h; |
---|
| 507 | rtems_filesystem_fsmount_me_t fsmount_me_h; |
---|
| 508 | rtems_filesystem_unmount_t unmount_h; |
---|
| 509 | rtems_filesystem_fsunmount_me_t fsunmount_me_h; |
---|
| 510 | rtems_filesystem_utime_t utime_h; |
---|
| 511 | rtems_filesystem_symlink_t symlink_h; |
---|
| 512 | rtems_filesystem_readlink_t readlink_h; |
---|
| 513 | rtems_filesystem_rename_t rename_h; |
---|
| 514 | rtems_filesystem_statvfs_t statvfs_h; |
---|
| 515 | }; |
---|
[07a3253d] | 516 | |
---|
[f9a4e80] | 517 | /** |
---|
[3b7c123] | 518 | * @brief File system operations table with default operations. |
---|
[f9a4e80] | 519 | */ |
---|
[3b7c123] | 520 | extern const rtems_filesystem_operations_table |
---|
| 521 | rtems_filesystem_operations_default; |
---|
[f9a4e80] | 522 | |
---|
| 523 | /** |
---|
[3b7c123] | 524 | * @brief Obtains the IO library mutex. |
---|
| 525 | * |
---|
| 526 | * @see rtems_filesystem_mt_entry_lock_t. |
---|
[f9a4e80] | 527 | */ |
---|
[3b7c123] | 528 | void rtems_filesystem_default_lock( |
---|
[7666afc] | 529 | const rtems_filesystem_mount_table_entry_t *mt_entry |
---|
[f9a4e80] | 530 | ); |
---|
| 531 | |
---|
| 532 | /** |
---|
[3b7c123] | 533 | * @brief Releases the IO library mutex. |
---|
| 534 | * |
---|
| 535 | * @see rtems_filesystem_mt_entry_unlock_t. |
---|
[f9a4e80] | 536 | */ |
---|
[3b7c123] | 537 | void rtems_filesystem_default_unlock( |
---|
[7666afc] | 538 | const rtems_filesystem_mount_table_entry_t *mt_entry |
---|
[f9a4e80] | 539 | ); |
---|
| 540 | |
---|
| 541 | /** |
---|
[3b7c123] | 542 | * @brief Terminates the path evaluation and replaces the current location with |
---|
| 543 | * the null location. |
---|
| 544 | * |
---|
| 545 | * @see rtems_filesystem_eval_path_t. |
---|
[f9a4e80] | 546 | */ |
---|
[3b7c123] | 547 | void rtems_filesystem_default_eval_path( |
---|
| 548 | rtems_filesystem_eval_path_context_t *ctx |
---|
[f9a4e80] | 549 | ); |
---|
| 550 | |
---|
| 551 | /** |
---|
[3b7c123] | 552 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 553 | * |
---|
| 554 | * @see rtems_filesystem_link_t. |
---|
[f9a4e80] | 555 | */ |
---|
[3b7c123] | 556 | int rtems_filesystem_default_link( |
---|
| 557 | const rtems_filesystem_location_info_t *parentloc, |
---|
| 558 | const rtems_filesystem_location_info_t *targetloc, |
---|
| 559 | const char *name, |
---|
| 560 | size_t namelen |
---|
[f9a4e80] | 561 | ); |
---|
| 562 | |
---|
| 563 | /** |
---|
[3b7c123] | 564 | * @brief Tests if the node access pointer of one location is equal to |
---|
| 565 | * the node access pointer of the other location. |
---|
| 566 | * |
---|
| 567 | * @param[in] a The one location. |
---|
| 568 | * @param[in] b The other location. |
---|
| 569 | * |
---|
| 570 | * @retval true The node access pointers of the locations are equal. |
---|
| 571 | * @retval false Otherwise. |
---|
| 572 | * |
---|
| 573 | * @see rtems_filesystem_are_nodes_equal_t. |
---|
[f9a4e80] | 574 | */ |
---|
[3b7c123] | 575 | bool rtems_filesystem_default_are_nodes_equal( |
---|
| 576 | const rtems_filesystem_location_info_t *a, |
---|
| 577 | const rtems_filesystem_location_info_t *b |
---|
[f9a4e80] | 578 | ); |
---|
| 579 | |
---|
| 580 | /** |
---|
[3b7c123] | 581 | * @retval RTEMS_FILESYSTEM_INVALID_NODE_TYPE Always. |
---|
| 582 | * |
---|
| 583 | * @see rtems_filesystem_node_type_t. |
---|
[f9a4e80] | 584 | */ |
---|
[3b7c123] | 585 | rtems_filesystem_node_types_t rtems_filesystem_default_node_type( |
---|
| 586 | const rtems_filesystem_location_info_t *pathloc |
---|
[f9a4e80] | 587 | ); |
---|
| 588 | |
---|
| 589 | /** |
---|
[3b7c123] | 590 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 591 | * |
---|
| 592 | * @see rtems_filesystem_mknod_t. |
---|
[f9a4e80] | 593 | */ |
---|
[3b7c123] | 594 | int rtems_filesystem_default_mknod( |
---|
| 595 | const rtems_filesystem_location_info_t *parentloc, |
---|
| 596 | const char *name, |
---|
| 597 | size_t namelen, |
---|
| 598 | mode_t mode, |
---|
| 599 | dev_t dev |
---|
[f9a4e80] | 600 | ); |
---|
| 601 | |
---|
| 602 | /** |
---|
[3b7c123] | 603 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 604 | * |
---|
| 605 | * @see rtems_filesystem_rmnod_t. |
---|
[f9a4e80] | 606 | */ |
---|
[3b7c123] | 607 | int rtems_filesystem_default_rmnod( |
---|
| 608 | const rtems_filesystem_location_info_t *parentloc, |
---|
| 609 | const rtems_filesystem_location_info_t *loc |
---|
[f9a4e80] | 610 | ); |
---|
| 611 | |
---|
| 612 | /** |
---|
[3b7c123] | 613 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 614 | * |
---|
| 615 | * @see rtems_filesystem_fchmod_t. |
---|
[f9a4e80] | 616 | */ |
---|
[3b7c123] | 617 | int rtems_filesystem_default_fchmod( |
---|
| 618 | const rtems_filesystem_location_info_t *loc, |
---|
| 619 | mode_t mode |
---|
[f9a4e80] | 620 | ); |
---|
| 621 | |
---|
| 622 | /** |
---|
[3b7c123] | 623 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 624 | * |
---|
| 625 | * @see rtems_filesystem_chown_t. |
---|
[f9a4e80] | 626 | */ |
---|
[3b7c123] | 627 | int rtems_filesystem_default_chown( |
---|
| 628 | const rtems_filesystem_location_info_t *loc, |
---|
| 629 | uid_t owner, |
---|
| 630 | gid_t group |
---|
[f9a4e80] | 631 | ); |
---|
| 632 | |
---|
[9da9cf4a] | 633 | /** |
---|
[3b7c123] | 634 | * @retval 0 Always. |
---|
[9da9cf4a] | 635 | * |
---|
[3b7c123] | 636 | * @see rtems_filesystem_clonenode_t. |
---|
[07a3253d] | 637 | */ |
---|
[3b7c123] | 638 | int rtems_filesystem_default_clonenode( |
---|
| 639 | rtems_filesystem_location_info_t *loc |
---|
| 640 | ); |
---|
[07a3253d] | 641 | |
---|
[f9a4e80] | 642 | /** |
---|
[3b7c123] | 643 | * @see rtems_filesystem_freenode_t. |
---|
[07a3253d] | 644 | */ |
---|
[3b7c123] | 645 | void rtems_filesystem_default_freenode( |
---|
| 646 | const rtems_filesystem_location_info_t *loc |
---|
[07a3253d] | 647 | ); |
---|
| 648 | |
---|
[f9a4e80] | 649 | /** |
---|
[3b7c123] | 650 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
[f9a4e80] | 651 | * |
---|
[3b7c123] | 652 | * @see rtems_filesystem_mount_t. |
---|
[07a3253d] | 653 | */ |
---|
[3b7c123] | 654 | int rtems_filesystem_default_mount ( |
---|
| 655 | rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ |
---|
[07a3253d] | 656 | ); |
---|
| 657 | |
---|
[f9a4e80] | 658 | /** |
---|
[3b7c123] | 659 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
[f9a4e80] | 660 | * |
---|
[3b7c123] | 661 | * @see rtems_filesystem_fsmount_me_t. |
---|
[f9a4e80] | 662 | */ |
---|
[3b7c123] | 663 | int rtems_filesystem_default_fsmount( |
---|
| 664 | rtems_filesystem_mount_table_entry_t *mt_entry, /* IN */ |
---|
| 665 | const void *data /* IN */ |
---|
[07a3253d] | 666 | ); |
---|
| 667 | |
---|
[f9a4e80] | 668 | /** |
---|
[3b7c123] | 669 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 670 | * |
---|
| 671 | * @see rtems_filesystem_unmount_t. |
---|
| 672 | */ |
---|
| 673 | int rtems_filesystem_default_unmount( |
---|
| 674 | rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ |
---|
[07a3253d] | 675 | ); |
---|
| 676 | |
---|
[f9a4e80] | 677 | /** |
---|
[3b7c123] | 678 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 679 | * |
---|
| 680 | * @see rtems_filesystem_fsunmount_me_t. |
---|
| 681 | */ |
---|
| 682 | void rtems_filesystem_default_fsunmount( |
---|
| 683 | rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ |
---|
[07a3253d] | 684 | ); |
---|
| 685 | |
---|
[f9a4e80] | 686 | /** |
---|
[3b7c123] | 687 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 688 | * |
---|
| 689 | * @see rtems_filesystem_utime_t. |
---|
| 690 | */ |
---|
| 691 | int rtems_filesystem_default_utime( |
---|
| 692 | const rtems_filesystem_location_info_t *loc, |
---|
| 693 | time_t actime, |
---|
| 694 | time_t modtime |
---|
[07a3253d] | 695 | ); |
---|
| 696 | |
---|
[f9a4e80] | 697 | /** |
---|
[3b7c123] | 698 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 699 | * |
---|
| 700 | * @see rtems_filesystem_symlink_t. |
---|
| 701 | */ |
---|
| 702 | int rtems_filesystem_default_symlink( |
---|
| 703 | const rtems_filesystem_location_info_t *parentloc, |
---|
| 704 | const char *name, |
---|
| 705 | size_t namelen, |
---|
| 706 | const char *target |
---|
[07a3253d] | 707 | ); |
---|
| 708 | |
---|
[f9a4e80] | 709 | /** |
---|
[3b7c123] | 710 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 711 | * |
---|
| 712 | * @see rtems_filesystem_readlink_t. |
---|
| 713 | */ |
---|
| 714 | ssize_t rtems_filesystem_default_readlink( |
---|
| 715 | const rtems_filesystem_location_info_t *loc, |
---|
| 716 | char *buf, |
---|
| 717 | size_t bufsize |
---|
[07a3253d] | 718 | ); |
---|
| 719 | |
---|
[f9a4e80] | 720 | /** |
---|
[3b7c123] | 721 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 722 | * |
---|
| 723 | * @see rtems_filesystem_rename_t. |
---|
| 724 | */ |
---|
| 725 | int rtems_filesystem_default_rename( |
---|
| 726 | const rtems_filesystem_location_info_t *oldparentloc, |
---|
| 727 | const rtems_filesystem_location_info_t *oldloc, |
---|
| 728 | const rtems_filesystem_location_info_t *newparentloc, |
---|
| 729 | const char *name, |
---|
| 730 | size_t namelen |
---|
[07a3253d] | 731 | ); |
---|
| 732 | |
---|
[f9a4e80] | 733 | /** |
---|
[3b7c123] | 734 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 735 | * |
---|
| 736 | * @see rtems_filesystem_statvfs_t. |
---|
| 737 | */ |
---|
| 738 | int rtems_filesystem_default_statvfs( |
---|
| 739 | const rtems_filesystem_location_info_t *loc, |
---|
| 740 | struct statvfs *buf |
---|
[07a3253d] | 741 | ); |
---|
| 742 | |
---|
[3b7c123] | 743 | /** @} */ |
---|
| 744 | |
---|
[f9a4e80] | 745 | /** |
---|
[3b7c123] | 746 | * @defgroup LibIOFSHandler File System Node Handler |
---|
| 747 | * |
---|
| 748 | * @ingroup LibIO |
---|
| 749 | * |
---|
| 750 | * @brief File system node handler. |
---|
| 751 | */ |
---|
[b697bc6] | 752 | /**@{**/ |
---|
[07a3253d] | 753 | |
---|
[f9a4e80] | 754 | /** |
---|
[3b7c123] | 755 | * @brief Opens a node. |
---|
| 756 | * |
---|
| 757 | * @param[in, out] iop The IO pointer. |
---|
| 758 | * @param[in] path The path. |
---|
| 759 | * @param[in] oflag The open flags. |
---|
| 760 | * @param[in] mode Optional mode for node creation. |
---|
| 761 | * |
---|
| 762 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 763 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 764 | * |
---|
| 765 | * @see rtems_filesystem_default_open(). |
---|
| 766 | */ |
---|
| 767 | typedef int (*rtems_filesystem_open_t)( |
---|
| 768 | rtems_libio_t *iop, |
---|
| 769 | const char *path, |
---|
| 770 | int oflag, |
---|
| 771 | mode_t mode |
---|
[07a3253d] | 772 | ); |
---|
| 773 | |
---|
[f9a4e80] | 774 | /** |
---|
[3b7c123] | 775 | * @brief Closes a node. |
---|
| 776 | * |
---|
| 777 | * @param[in, out] iop The IO pointer. |
---|
| 778 | * |
---|
| 779 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 780 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 781 | * |
---|
| 782 | * @see rtems_filesystem_default_close(). |
---|
| 783 | */ |
---|
| 784 | typedef int (*rtems_filesystem_close_t)( |
---|
| 785 | rtems_libio_t *iop |
---|
[07a3253d] | 786 | ); |
---|
| 787 | |
---|
[f9a4e80] | 788 | /** |
---|
[3b7c123] | 789 | * @brief Reads from a node. |
---|
| 790 | * |
---|
[53da07e] | 791 | * This handler is responsible to update the offset field of the IO descriptor. |
---|
| 792 | * |
---|
[3b7c123] | 793 | * @param[in, out] iop The IO pointer. |
---|
| 794 | * @param[out] buffer The buffer for read data. |
---|
| 795 | * @param[in] count The size of the buffer in characters. |
---|
| 796 | * |
---|
| 797 | * @retval non-negative Count of read characters. |
---|
[d0b9295f] | 798 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 799 | * |
---|
| 800 | * @see rtems_filesystem_default_read(). |
---|
| 801 | */ |
---|
| 802 | typedef ssize_t (*rtems_filesystem_read_t)( |
---|
| 803 | rtems_libio_t *iop, |
---|
| 804 | void *buffer, |
---|
| 805 | size_t count |
---|
[07a3253d] | 806 | ); |
---|
| 807 | |
---|
[f9a4e80] | 808 | /** |
---|
[3b7c123] | 809 | * @brief Writes to a node. |
---|
| 810 | * |
---|
[53da07e] | 811 | * This handler is responsible to update the offset field of the IO descriptor. |
---|
| 812 | * |
---|
[3b7c123] | 813 | * @param[in, out] iop The IO pointer. |
---|
| 814 | * @param[out] buffer The buffer for write data. |
---|
| 815 | * @param[in] count The size of the buffer in characters. |
---|
| 816 | * |
---|
| 817 | * @retval non-negative Count of written characters. |
---|
[d0b9295f] | 818 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 819 | * |
---|
| 820 | * @see rtems_filesystem_default_write(). |
---|
| 821 | */ |
---|
| 822 | typedef ssize_t (*rtems_filesystem_write_t)( |
---|
| 823 | rtems_libio_t *iop, |
---|
| 824 | const void *buffer, |
---|
| 825 | size_t count |
---|
[07a3253d] | 826 | ); |
---|
| 827 | |
---|
[f9a4e80] | 828 | /** |
---|
[3b7c123] | 829 | * @brief IO control of a node. |
---|
| 830 | * |
---|
| 831 | * @param[in, out] iop The IO pointer. |
---|
| 832 | * @param[in] request The IO control request. |
---|
| 833 | * @param[in, out] buffer The buffer for IO control request data. |
---|
| 834 | * |
---|
| 835 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 836 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 837 | * |
---|
| 838 | * @see rtems_filesystem_default_ioctl(). |
---|
| 839 | */ |
---|
| 840 | typedef int (*rtems_filesystem_ioctl_t)( |
---|
[df01da67] | 841 | rtems_libio_t *iop, |
---|
| 842 | ioctl_command_t request, |
---|
| 843 | void *buffer |
---|
[07a3253d] | 844 | ); |
---|
| 845 | |
---|
[f9a4e80] | 846 | /** |
---|
[3b7c123] | 847 | * @brief Moves the read/write file offset. |
---|
| 848 | * |
---|
| 849 | * @param[in, out] iop The IO pointer. |
---|
[adef4e4] | 850 | * @param[in] offset The offset. |
---|
| 851 | * @param[in] whence The reference position for the offset. |
---|
[3b7c123] | 852 | * |
---|
| 853 | * @retval non-negative The new offset from the beginning of the file. |
---|
[d0b9295f] | 854 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 855 | * |
---|
[30d4124] | 856 | * @see rtems_filesystem_default_lseek(), |
---|
| 857 | * rtems_filesystem_default_lseek_file(), and |
---|
| 858 | * rtems_filesystem_default_lseek_directory(). |
---|
[3b7c123] | 859 | */ |
---|
| 860 | typedef off_t (*rtems_filesystem_lseek_t)( |
---|
| 861 | rtems_libio_t *iop, |
---|
| 862 | off_t offset, |
---|
| 863 | int whence |
---|
[8ec7abb] | 864 | ); |
---|
| 865 | |
---|
[f9a4e80] | 866 | /** |
---|
[3b7c123] | 867 | * @brief Gets a node status. |
---|
| 868 | * |
---|
| 869 | * @param[in, out] iop The IO pointer. |
---|
| 870 | * @param[out] stat The buffer to status information. |
---|
| 871 | * |
---|
| 872 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 873 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 874 | * |
---|
| 875 | * @see rtems_filesystem_default_fstat(). |
---|
| 876 | */ |
---|
| 877 | typedef int (*rtems_filesystem_fstat_t)( |
---|
| 878 | const rtems_filesystem_location_info_t *loc, |
---|
| 879 | struct stat *buf |
---|
[eb649786] | 880 | ); |
---|
| 881 | |
---|
[9da9cf4a] | 882 | /** |
---|
[3b7c123] | 883 | * @brief Truncates a file to a specified length. |
---|
| 884 | * |
---|
| 885 | * @param[in, out] iop The IO pointer. |
---|
| 886 | * @param[in] length The new length in characters. |
---|
| 887 | * |
---|
| 888 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 889 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 890 | * |
---|
| 891 | * @see rtems_filesystem_default_ftruncate() and |
---|
| 892 | * rtems_filesystem_default_ftruncate_directory(). |
---|
[07a3253d] | 893 | */ |
---|
[3b7c123] | 894 | typedef int (*rtems_filesystem_ftruncate_t)( |
---|
| 895 | rtems_libio_t *iop, |
---|
| 896 | off_t length |
---|
| 897 | ); |
---|
[1e01385] | 898 | |
---|
| 899 | /** |
---|
[3b7c123] | 900 | * @brief Synchronizes changes to a file. |
---|
| 901 | * |
---|
| 902 | * @param[in, out] iop The IO pointer. |
---|
| 903 | * |
---|
| 904 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 905 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 906 | * |
---|
[4116fce6] | 907 | * @see rtems_filesystem_default_fsync_or_fdatasync() and |
---|
| 908 | * rtems_filesystem_default_fsync_or_fdatasync_success(). |
---|
[f9a4e80] | 909 | */ |
---|
[3b7c123] | 910 | typedef int (*rtems_filesystem_fsync_t)( |
---|
| 911 | rtems_libio_t *iop |
---|
[1e01385] | 912 | ); |
---|
[f9a4e80] | 913 | |
---|
[1e01385] | 914 | /** |
---|
[3b7c123] | 915 | * @brief Synchronizes the data of a file. |
---|
| 916 | * |
---|
| 917 | * @param[in, out] iop The IO pointer. |
---|
| 918 | * |
---|
| 919 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 920 | * @retval -1 An error occurred. The errno is set to indicate the error. |
---|
[3b7c123] | 921 | * |
---|
[4116fce6] | 922 | * @see rtems_filesystem_default_fsync_or_fdatasync() and |
---|
| 923 | * rtems_filesystem_default_fsync_or_fdatasync_success(). |
---|
[1e01385] | 924 | */ |
---|
[3b7c123] | 925 | typedef int (*rtems_filesystem_fdatasync_t)( |
---|
| 926 | rtems_libio_t *iop |
---|
[1e01385] | 927 | ); |
---|
[f9a4e80] | 928 | |
---|
| 929 | /** |
---|
[3b7c123] | 930 | * @brief File control. |
---|
| 931 | * |
---|
| 932 | * @param[in, out] iop The IO pointer. |
---|
| 933 | * @param[in] cmd Control command. |
---|
| 934 | * |
---|
| 935 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 936 | * @retval errno An error occurred. This value is assigned to errno. |
---|
[3b7c123] | 937 | * |
---|
| 938 | * @see rtems_filesystem_default_fcntl(). |
---|
[f9a4e80] | 939 | */ |
---|
[3b7c123] | 940 | typedef int (*rtems_filesystem_fcntl_t)( |
---|
| 941 | rtems_libio_t *iop, |
---|
| 942 | int cmd |
---|
[f9a4e80] | 943 | ); |
---|
| 944 | |
---|
| 945 | /** |
---|
[3b7c123] | 946 | * @brief File system node operations table. |
---|
[f9a4e80] | 947 | */ |
---|
[3b7c123] | 948 | struct _rtems_filesystem_file_handlers_r { |
---|
| 949 | rtems_filesystem_open_t open_h; |
---|
| 950 | rtems_filesystem_close_t close_h; |
---|
| 951 | rtems_filesystem_read_t read_h; |
---|
| 952 | rtems_filesystem_write_t write_h; |
---|
| 953 | rtems_filesystem_ioctl_t ioctl_h; |
---|
| 954 | rtems_filesystem_lseek_t lseek_h; |
---|
| 955 | rtems_filesystem_fstat_t fstat_h; |
---|
| 956 | rtems_filesystem_ftruncate_t ftruncate_h; |
---|
| 957 | rtems_filesystem_fsync_t fsync_h; |
---|
| 958 | rtems_filesystem_fdatasync_t fdatasync_h; |
---|
| 959 | rtems_filesystem_fcntl_t fcntl_h; |
---|
| 960 | }; |
---|
[f9a4e80] | 961 | |
---|
[1e01385] | 962 | /** |
---|
[3b7c123] | 963 | * @brief File system node handler table with default node handlers. |
---|
[1e01385] | 964 | */ |
---|
[3b7c123] | 965 | extern const rtems_filesystem_file_handlers_r |
---|
| 966 | rtems_filesystem_handlers_default; |
---|
[1e01385] | 967 | |
---|
[6683a58] | 968 | /** |
---|
[3b7c123] | 969 | * @retval 0 Always. |
---|
| 970 | * |
---|
| 971 | * @see rtems_filesystem_open_t. |
---|
[6683a58] | 972 | */ |
---|
[3b7c123] | 973 | int rtems_filesystem_default_open( |
---|
| 974 | rtems_libio_t *iop, |
---|
| 975 | const char *path, |
---|
| 976 | int oflag, |
---|
| 977 | mode_t mode |
---|
[6683a58] | 978 | ); |
---|
| 979 | |
---|
[f9a4e80] | 980 | /** |
---|
[3b7c123] | 981 | * @retval 0 Always. |
---|
| 982 | * |
---|
| 983 | * @see rtems_filesystem_close_t. |
---|
[f9a4e80] | 984 | */ |
---|
[3b7c123] | 985 | int rtems_filesystem_default_close( |
---|
| 986 | rtems_libio_t *iop |
---|
[f9a4e80] | 987 | ); |
---|
| 988 | |
---|
| 989 | /** |
---|
[3b7c123] | 990 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 991 | * |
---|
| 992 | * @see rtems_filesystem_read_t. |
---|
[f9a4e80] | 993 | */ |
---|
[3b7c123] | 994 | ssize_t rtems_filesystem_default_read( |
---|
| 995 | rtems_libio_t *iop, |
---|
| 996 | void *buffer, |
---|
| 997 | size_t count |
---|
[f9a4e80] | 998 | ); |
---|
| 999 | |
---|
| 1000 | /** |
---|
[3b7c123] | 1001 | * @retval -1 Always. The errno is set to ENOTSUP. |
---|
| 1002 | * |
---|
| 1003 | * @see rtems_filesystem_write_t. |
---|
[f9a4e80] | 1004 | */ |
---|
[3b7c123] | 1005 | ssize_t rtems_filesystem_default_write( |
---|
| 1006 | rtems_libio_t *iop, |
---|
| 1007 | const void *buffer, |
---|
| 1008 | size_t count |
---|
[f9a4e80] | 1009 | ); |
---|
| 1010 | |
---|
| 1011 | /** |
---|
[ba120d1] | 1012 | * @retval -1 Always. The errno is set to ENOTTY. |
---|
[3b7c123] | 1013 | * |
---|
| 1014 | * @see rtems_filesystem_ioctl_t. |
---|
[f9a4e80] | 1015 | */ |
---|
[3b7c123] | 1016 | int rtems_filesystem_default_ioctl( |
---|
[df01da67] | 1017 | rtems_libio_t *iop, |
---|
| 1018 | ioctl_command_t request, |
---|
| 1019 | void *buffer |
---|
[f9a4e80] | 1020 | ); |
---|
| 1021 | |
---|
| 1022 | /** |
---|
[a76c2373] | 1023 | * @retval -1 Always. The errno is set to ESPIPE. |
---|
[3b7c123] | 1024 | * |
---|
| 1025 | * @see rtems_filesystem_lseek_t. |
---|
[f9a4e80] | 1026 | */ |
---|
[3b7c123] | 1027 | off_t rtems_filesystem_default_lseek( |
---|
| 1028 | rtems_libio_t *iop, |
---|
[adef4e4] | 1029 | off_t offset, |
---|
| 1030 | int whence |
---|
| 1031 | ); |
---|
| 1032 | |
---|
[30d4124] | 1033 | /** |
---|
| 1034 | * @brief An offset 0 with a whence of SEEK_SET will perform a directory rewind |
---|
| 1035 | * operation. |
---|
| 1036 | * |
---|
| 1037 | * This function has no protection against concurrent access. |
---|
| 1038 | * |
---|
| 1039 | * @retval -1 The offset is not zero or the whence is not SEEK_SET. |
---|
| 1040 | * @retval 0 Successful rewind operation. |
---|
| 1041 | * |
---|
| 1042 | * @see rtems_filesystem_lseek_t. |
---|
| 1043 | */ |
---|
| 1044 | off_t rtems_filesystem_default_lseek_directory( |
---|
| 1045 | rtems_libio_t *iop, |
---|
| 1046 | off_t offset, |
---|
| 1047 | int whence |
---|
| 1048 | ); |
---|
| 1049 | |
---|
| 1050 | /** |
---|
| 1051 | * @brief Default lseek() handler for files. |
---|
| 1052 | * |
---|
| 1053 | * The fstat() handler will be used to obtain the file size in case whence is |
---|
| 1054 | * SEEK_END. |
---|
| 1055 | * |
---|
| 1056 | * This function has no protection against concurrent access. |
---|
| 1057 | * |
---|
[d0b9295f] | 1058 | * @retval -1 An error occurred. In case an integer overflow occurred, then the |
---|
[30d4124] | 1059 | * errno will be set to EOVERFLOW. In case the new offset is negative, then |
---|
| 1060 | * the errno will be set to EINVAL. In case the whence is SEEK_END and the |
---|
| 1061 | * fstat() handler to obtain the current file size returned an error status, |
---|
| 1062 | * then the errno will be set by the fstat() handler. |
---|
| 1063 | * @retval offset The new offset. |
---|
| 1064 | * |
---|
| 1065 | * @see rtems_filesystem_lseek_t. |
---|
| 1066 | */ |
---|
| 1067 | off_t rtems_filesystem_default_lseek_file( |
---|
| 1068 | rtems_libio_t *iop, |
---|
| 1069 | off_t offset, |
---|
| 1070 | int whence |
---|
| 1071 | ); |
---|
| 1072 | |
---|
[f9a4e80] | 1073 | /** |
---|
[3b7c123] | 1074 | * @brief Sets the mode to S_IRWXU | S_IRWXG | S_IRWXO. |
---|
| 1075 | * |
---|
| 1076 | * @retval 0 Always. |
---|
| 1077 | * |
---|
| 1078 | * @see rtems_filesystem_fstat_t. |
---|
[f9a4e80] | 1079 | */ |
---|
[3b7c123] | 1080 | int rtems_filesystem_default_fstat( |
---|
| 1081 | const rtems_filesystem_location_info_t *loc, |
---|
| 1082 | struct stat *buf |
---|
[f9a4e80] | 1083 | ); |
---|
| 1084 | |
---|
| 1085 | /** |
---|
[8d66446] | 1086 | * @retval -1 Always. The errno is set to EINVAL. |
---|
[3b7c123] | 1087 | * |
---|
| 1088 | * @see rtems_filesystem_ftruncate_t. |
---|
[f9a4e80] | 1089 | */ |
---|
[3b7c123] | 1090 | int rtems_filesystem_default_ftruncate( |
---|
| 1091 | rtems_libio_t *iop, |
---|
| 1092 | off_t length |
---|
[f9a4e80] | 1093 | ); |
---|
| 1094 | |
---|
| 1095 | /** |
---|
[3b7c123] | 1096 | * @retval -1 Always. The errno is set to EISDIR. |
---|
| 1097 | * |
---|
| 1098 | * @see rtems_filesystem_ftruncate_t. |
---|
[f9a4e80] | 1099 | */ |
---|
[3b7c123] | 1100 | int rtems_filesystem_default_ftruncate_directory( |
---|
| 1101 | rtems_libio_t *iop, |
---|
| 1102 | off_t length |
---|
[f9a4e80] | 1103 | ); |
---|
| 1104 | |
---|
| 1105 | /** |
---|
[4116fce6] | 1106 | * @retval -1 Always. The errno is set to EINVAL. |
---|
[3b7c123] | 1107 | * |
---|
[4116fce6] | 1108 | * @see rtems_filesystem_fsync_t and rtems_filesystem_fdatasync_t. |
---|
[f9a4e80] | 1109 | */ |
---|
[4116fce6] | 1110 | int rtems_filesystem_default_fsync_or_fdatasync( |
---|
[3b7c123] | 1111 | rtems_libio_t *iop |
---|
[f9a4e80] | 1112 | ); |
---|
| 1113 | |
---|
| 1114 | /** |
---|
[4116fce6] | 1115 | * @retval 0 Always. |
---|
[3b7c123] | 1116 | * |
---|
[4116fce6] | 1117 | * @see rtems_filesystem_fsync_t and rtems_filesystem_fdatasync_t. |
---|
[f9a4e80] | 1118 | */ |
---|
[4116fce6] | 1119 | int rtems_filesystem_default_fsync_or_fdatasync_success( |
---|
[3b7c123] | 1120 | rtems_libio_t *iop |
---|
[f9a4e80] | 1121 | ); |
---|
| 1122 | |
---|
| 1123 | /** |
---|
[3b7c123] | 1124 | * @retval 0 Always. |
---|
| 1125 | * |
---|
| 1126 | * @see rtems_filesystem_fcntl_t. |
---|
[f9a4e80] | 1127 | */ |
---|
[3b7c123] | 1128 | int rtems_filesystem_default_fcntl( |
---|
| 1129 | rtems_libio_t *iop, |
---|
| 1130 | int cmd |
---|
[f9a4e80] | 1131 | ); |
---|
| 1132 | |
---|
[3b7c123] | 1133 | /** @} */ |
---|
| 1134 | |
---|
[f9a4e80] | 1135 | /** |
---|
[3b7c123] | 1136 | * @defgroup LibIO IO Library |
---|
| 1137 | * |
---|
| 1138 | * @brief Provides system call and file system interface definitions. |
---|
| 1139 | * |
---|
| 1140 | * General purpose communication channel for RTEMS to allow UNIX/POSIX |
---|
| 1141 | * system call behavior under RTEMS. Initially this supported only |
---|
| 1142 | * IO to devices but has since been enhanced to support networking |
---|
| 1143 | * and support for mounted file systems. |
---|
[f9a4e80] | 1144 | */ |
---|
[b697bc6] | 1145 | /**@{**/ |
---|
[3b7c123] | 1146 | |
---|
| 1147 | typedef off_t rtems_off64_t __attribute__((deprecated)); |
---|
[f9a4e80] | 1148 | |
---|
[7d01d244] | 1149 | /** |
---|
[9da9cf4a] | 1150 | * @brief Gets the mount handler for the file system @a type. |
---|
| 1151 | * |
---|
| 1152 | * @return The file system mount handler associated with the @a type, or |
---|
[7d01d244] | 1153 | * @c NULL if no such association exists. |
---|
[29e92b0] | 1154 | */ |
---|
[7d01d244] | 1155 | rtems_filesystem_fsmount_me_t |
---|
| 1156 | rtems_filesystem_get_mount_handler( |
---|
| 1157 | const char *type |
---|
| 1158 | ); |
---|
[29e92b0] | 1159 | |
---|
[9da9cf4a] | 1160 | /** |
---|
| 1161 | * @brief Contain file system specific information which is required to support |
---|
| 1162 | * fpathconf(). |
---|
[b06e68ef] | 1163 | */ |
---|
| 1164 | typedef struct { |
---|
[29e92b0] | 1165 | int link_max; /* count */ |
---|
| 1166 | int max_canon; /* max formatted input line size */ |
---|
| 1167 | int max_input; /* max input line size */ |
---|
| 1168 | int name_max; /* max name length */ |
---|
| 1169 | int path_max; /* max path */ |
---|
| 1170 | int pipe_buf; /* pipe buffer size */ |
---|
| 1171 | int posix_async_io; /* async IO supported on fs, 0=no, 1=yes */ |
---|
| 1172 | int posix_chown_restrictions; /* can chown: 0=no, 1=yes */ |
---|
| 1173 | int posix_no_trunc; /* error on names > max name, 0=no, 1=yes */ |
---|
| 1174 | int posix_prio_io; /* priority IO, 0=no, 1=yes */ |
---|
| 1175 | int posix_sync_io; /* file can be sync'ed, 0=no, 1=yes */ |
---|
| 1176 | int posix_vdisable; /* special char processing, 0=no, 1=yes */ |
---|
[07a3253d] | 1177 | } rtems_filesystem_limits_and_options_t; |
---|
| 1178 | |
---|
[9da9cf4a] | 1179 | /** |
---|
[6d5ba49] | 1180 | * @brief Default pathconf settings. |
---|
[9da9cf4a] | 1181 | * |
---|
[6d5ba49] | 1182 | * Override in a filesystem. |
---|
[29e92b0] | 1183 | */ |
---|
[3b7c123] | 1184 | extern const rtems_filesystem_limits_and_options_t |
---|
| 1185 | rtems_filesystem_default_pathconf; |
---|
[29e92b0] | 1186 | |
---|
[9da9cf4a] | 1187 | /** |
---|
| 1188 | * @brief An open file data structure. |
---|
| 1189 | * |
---|
| 1190 | * It will be indexed by 'fd'. |
---|
| 1191 | * |
---|
| 1192 | * @todo Should really have a separate per/file data structure that this points |
---|
[30d4124] | 1193 | * to (eg: offset, driver, pathname should be in that) |
---|
[07a3253d] | 1194 | */ |
---|
| 1195 | struct rtems_libio_tt { |
---|
[aa61d53] | 1196 | rtems_driver_name_t *driver; |
---|
[b799e4eb] | 1197 | off_t offset; /* current offset into file */ |
---|
[aa61d53] | 1198 | uint32_t flags; |
---|
| 1199 | rtems_filesystem_location_info_t pathinfo; |
---|
| 1200 | uint32_t data0; /* private to "driver" */ |
---|
| 1201 | void *data1; /* ... */ |
---|
[07a3253d] | 1202 | }; |
---|
| 1203 | |
---|
[9da9cf4a] | 1204 | /** |
---|
| 1205 | * @brief Paramameter block for read/write. |
---|
| 1206 | * |
---|
| 1207 | * It must include 'offset' instead of using iop's offset since we can have |
---|
| 1208 | * multiple outstanding i/o's on a device. |
---|
[b06e68ef] | 1209 | */ |
---|
| 1210 | typedef struct { |
---|
[aa61d53] | 1211 | rtems_libio_t *iop; |
---|
[b799e4eb] | 1212 | off_t offset; |
---|
[aa61d53] | 1213 | char *buffer; |
---|
| 1214 | uint32_t count; |
---|
| 1215 | uint32_t flags; |
---|
| 1216 | uint32_t bytes_moved; |
---|
[b06e68ef] | 1217 | } rtems_libio_rw_args_t; |
---|
| 1218 | |
---|
[9da9cf4a] | 1219 | /** |
---|
| 1220 | * @brief Parameter block for open/close. |
---|
[b06e68ef] | 1221 | */ |
---|
| 1222 | typedef struct { |
---|
[aa61d53] | 1223 | rtems_libio_t *iop; |
---|
| 1224 | uint32_t flags; |
---|
| 1225 | uint32_t mode; |
---|
[b06e68ef] | 1226 | } rtems_libio_open_close_args_t; |
---|
| 1227 | |
---|
[9da9cf4a] | 1228 | /** |
---|
| 1229 | * @brief Parameter block for ioctl. |
---|
[b06e68ef] | 1230 | */ |
---|
| 1231 | typedef struct { |
---|
[aa61d53] | 1232 | rtems_libio_t *iop; |
---|
[df01da67] | 1233 | ioctl_command_t command; |
---|
[aa61d53] | 1234 | void *buffer; |
---|
[5b045eb] | 1235 | int ioctl_return; |
---|
[b06e68ef] | 1236 | } rtems_libio_ioctl_args_t; |
---|
| 1237 | |
---|
[9da9cf4a] | 1238 | /** |
---|
| 1239 | * @name Flag Values |
---|
[b06e68ef] | 1240 | */ |
---|
[b697bc6] | 1241 | /**@{**/ |
---|
[9da9cf4a] | 1242 | |
---|
[145c9343] | 1243 | #define LIBIO_FLAGS_NO_DELAY 0x0001U /* return immediately if no data */ |
---|
| 1244 | #define LIBIO_FLAGS_READ 0x0002U /* reading */ |
---|
| 1245 | #define LIBIO_FLAGS_WRITE 0x0004U /* writing */ |
---|
| 1246 | #define LIBIO_FLAGS_OPEN 0x0100U /* device is open */ |
---|
| 1247 | #define LIBIO_FLAGS_APPEND 0x0200U /* all writes append */ |
---|
| 1248 | #define LIBIO_FLAGS_CREATE 0x0400U /* create file */ |
---|
| 1249 | #define LIBIO_FLAGS_CLOSE_ON_EXEC 0x0800U /* close on process exec() */ |
---|
[b06e68ef] | 1250 | #define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE) |
---|
| 1251 | |
---|
[9da9cf4a] | 1252 | /** @} */ |
---|
| 1253 | |
---|
[cefc9aea] | 1254 | /** |
---|
| 1255 | * @brief RTEMS LibIO Initialization |
---|
[c5782a2] | 1256 | * |
---|
[cefc9aea] | 1257 | * Called by BSP startup code to initialize the libio subsystem. |
---|
| 1258 | */ |
---|
[07a3253d] | 1259 | void rtems_libio_init(void); |
---|
[b06e68ef] | 1260 | |
---|
[9da9cf4a] | 1261 | /** |
---|
| 1262 | * @name External I/O Handlers |
---|
[e2d79559] | 1263 | */ |
---|
[b697bc6] | 1264 | /**@{**/ |
---|
[07a3253d] | 1265 | |
---|
| 1266 | typedef int (*rtems_libio_open_t)( |
---|
| 1267 | const char *pathname, |
---|
[83c5fc1] | 1268 | uint32_t flag, |
---|
| 1269 | uint32_t mode |
---|
[07a3253d] | 1270 | ); |
---|
| 1271 | |
---|
| 1272 | typedef int (*rtems_libio_close_t)( |
---|
| 1273 | int fd |
---|
| 1274 | ); |
---|
| 1275 | |
---|
[b637dbb] | 1276 | typedef ssize_t (*rtems_libio_read_t)( |
---|
[07a3253d] | 1277 | int fd, |
---|
| 1278 | void *buffer, |
---|
[b637dbb] | 1279 | size_t count |
---|
[07a3253d] | 1280 | ); |
---|
| 1281 | |
---|
[b637dbb] | 1282 | typedef ssize_t (*rtems_libio_write_t)( |
---|
[07a3253d] | 1283 | int fd, |
---|
| 1284 | const void *buffer, |
---|
[b637dbb] | 1285 | size_t count |
---|
[07a3253d] | 1286 | ); |
---|
| 1287 | |
---|
| 1288 | typedef int (*rtems_libio_ioctl_t)( |
---|
| 1289 | int fd, |
---|
[83c5fc1] | 1290 | uint32_t command, |
---|
[07a3253d] | 1291 | void *buffer |
---|
| 1292 | ); |
---|
| 1293 | |
---|
[b799e4eb] | 1294 | typedef off_t (*rtems_libio_lseek_t)( |
---|
[07d6fd5] | 1295 | int fd, |
---|
[b799e4eb] | 1296 | off_t offset, |
---|
[07d6fd5] | 1297 | int whence |
---|
[07a3253d] | 1298 | ); |
---|
| 1299 | |
---|
[9da9cf4a] | 1300 | /** @} */ |
---|
| 1301 | |
---|
| 1302 | /** |
---|
| 1303 | * @name Permission Macros |
---|
| 1304 | */ |
---|
[b697bc6] | 1305 | /**@{**/ |
---|
[9da9cf4a] | 1306 | |
---|
[07a3253d] | 1307 | /* |
---|
| 1308 | * The following macros are used to build up the permissions sets |
---|
| 1309 | * used to check permissions. These are similar in style to the |
---|
| 1310 | * mode_t bits and should stay compatible with them. |
---|
| 1311 | */ |
---|
[2563410] | 1312 | #define RTEMS_FS_PERMS_READ 0x4 |
---|
| 1313 | #define RTEMS_FS_PERMS_WRITE 0x2 |
---|
| 1314 | #define RTEMS_FS_PERMS_EXEC 0x1 |
---|
| 1315 | #define RTEMS_FS_PERMS_RWX \ |
---|
| 1316 | (RTEMS_FS_PERMS_READ | RTEMS_FS_PERMS_WRITE | RTEMS_FS_PERMS_EXEC) |
---|
| 1317 | #define RTEMS_FS_FOLLOW_HARD_LINK 0x8 |
---|
| 1318 | #define RTEMS_FS_FOLLOW_SYM_LINK 0x10 |
---|
| 1319 | #define RTEMS_FS_FOLLOW_LINK \ |
---|
| 1320 | (RTEMS_FS_FOLLOW_HARD_LINK | RTEMS_FS_FOLLOW_SYM_LINK) |
---|
| 1321 | #define RTEMS_FS_MAKE 0x20 |
---|
| 1322 | #define RTEMS_FS_EXCLUSIVE 0x40 |
---|
| 1323 | #define RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS 0x80 |
---|
| 1324 | #define RTEMS_FS_REJECT_TERMINAL_DOT 0x100 |
---|
[07a3253d] | 1325 | |
---|
[9da9cf4a] | 1326 | /** @} */ |
---|
[7e476f0] | 1327 | |
---|
[0b178f04] | 1328 | union __rtems_dev_t { |
---|
[7e476f0] | 1329 | dev_t device; |
---|
| 1330 | struct { |
---|
| 1331 | rtems_device_major_number major; |
---|
| 1332 | rtems_device_minor_number minor; |
---|
| 1333 | } __overlay; |
---|
| 1334 | }; |
---|
| 1335 | |
---|
[50f32b11] | 1336 | static inline dev_t rtems_filesystem_make_dev_t( |
---|
| 1337 | rtems_device_major_number _major, |
---|
[7e476f0] | 1338 | rtems_device_minor_number _minor |
---|
| 1339 | ) |
---|
| 1340 | { |
---|
[0b178f04] | 1341 | union __rtems_dev_t temp; |
---|
[7e476f0] | 1342 | |
---|
| 1343 | temp.__overlay.major = _major; |
---|
| 1344 | temp.__overlay.minor = _minor; |
---|
| 1345 | return temp.device; |
---|
| 1346 | } |
---|
| 1347 | |
---|
| 1348 | static inline rtems_device_major_number rtems_filesystem_dev_major_t( |
---|
| 1349 | dev_t device |
---|
| 1350 | ) |
---|
| 1351 | { |
---|
[0b178f04] | 1352 | union __rtems_dev_t temp; |
---|
[7e476f0] | 1353 | |
---|
| 1354 | temp.device = device; |
---|
| 1355 | return temp.__overlay.major; |
---|
| 1356 | } |
---|
| 1357 | |
---|
| 1358 | |
---|
| 1359 | static inline rtems_device_minor_number rtems_filesystem_dev_minor_t( |
---|
| 1360 | dev_t device |
---|
| 1361 | ) |
---|
| 1362 | { |
---|
[0b178f04] | 1363 | union __rtems_dev_t temp; |
---|
[7e476f0] | 1364 | |
---|
| 1365 | temp.device = device; |
---|
| 1366 | return temp.__overlay.minor; |
---|
| 1367 | } |
---|
| 1368 | |
---|
[07a3253d] | 1369 | #define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \ |
---|
| 1370 | do { \ |
---|
[dd19c0b] | 1371 | (_major) = rtems_filesystem_dev_major_t ( _dev ); \ |
---|
| 1372 | (_minor) = rtems_filesystem_dev_minor_t( _dev ); \ |
---|
[07a3253d] | 1373 | } while(0) |
---|
| 1374 | |
---|
[6c0fcd4] | 1375 | /* |
---|
| 1376 | * Prototypes for filesystem |
---|
| 1377 | */ |
---|
| 1378 | |
---|
[c9bb60a] | 1379 | /** |
---|
| 1380 | * @brief Base File System Initialization |
---|
[c5782a2] | 1381 | * |
---|
[c9bb60a] | 1382 | * Initialize the foundation of the file system. This is specified |
---|
| 1383 | * by the structure rtems_filesystem_mount_table. The usual |
---|
| 1384 | * configuration is a single instantiation of the IMFS or miniIMFS with |
---|
| 1385 | * a single "/dev" directory in it. |
---|
| 1386 | */ |
---|
[6c0fcd4] | 1387 | void rtems_filesystem_initialize( void ); |
---|
| 1388 | |
---|
[a290fbe9] | 1389 | typedef void (*rtems_libio_helper)(void); |
---|
[6c0fcd4] | 1390 | |
---|
[a290fbe9] | 1391 | extern const rtems_libio_helper rtems_libio_init_helper; |
---|
[6c0fcd4] | 1392 | |
---|
[5fa0e5c5] | 1393 | extern const rtems_libio_helper rtems_libio_post_driver_helper; |
---|
[6c0fcd4] | 1394 | |
---|
[b7cf1ff7] | 1395 | extern const rtems_libio_helper rtems_libio_exit_helper; |
---|
| 1396 | |
---|
[a290fbe9] | 1397 | extern const rtems_libio_helper rtems_fs_init_helper; |
---|
| 1398 | |
---|
| 1399 | void rtems_libio_helper_null(void); |
---|
| 1400 | |
---|
[5fa0e5c5] | 1401 | void rtems_libio_post_driver(void); |
---|
[6c0fcd4] | 1402 | |
---|
[b7cf1ff7] | 1403 | void rtems_libio_exit(void); |
---|
| 1404 | |
---|
[6c0fcd4] | 1405 | /** |
---|
| 1406 | * @brief Creates a directory and all its parent directories according to |
---|
| 1407 | * @a path. |
---|
| 1408 | * |
---|
| 1409 | * The @a mode value selects the access permissions of the directory. |
---|
| 1410 | * |
---|
| 1411 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 1412 | * @retval -1 An error occurred. The @c errno indicates the error. |
---|
[6c0fcd4] | 1413 | */ |
---|
| 1414 | extern int rtems_mkdir(const char *path, mode_t mode); |
---|
| 1415 | |
---|
| 1416 | /** @} */ |
---|
| 1417 | |
---|
| 1418 | /** |
---|
| 1419 | * @defgroup FileSystemTypesAndMount File System Types and Mount |
---|
| 1420 | * |
---|
| 1421 | * @ingroup LibIO |
---|
| 1422 | * |
---|
| 1423 | * @brief File system types and mount. |
---|
| 1424 | */ |
---|
[b697bc6] | 1425 | /**@{**/ |
---|
[6c0fcd4] | 1426 | |
---|
[14fc3a77] | 1427 | /** |
---|
| 1428 | * @name File System Types |
---|
| 1429 | */ |
---|
[b697bc6] | 1430 | /**@{**/ |
---|
[14fc3a77] | 1431 | |
---|
| 1432 | #define RTEMS_FILESYSTEM_TYPE_IMFS "imfs" |
---|
| 1433 | #define RTEMS_FILESYSTEM_TYPE_MINIIMFS "mimfs" |
---|
| 1434 | #define RTEMS_FILESYSTEM_TYPE_DEVFS "devfs" |
---|
| 1435 | #define RTEMS_FILESYSTEM_TYPE_FTPFS "ftpfs" |
---|
| 1436 | #define RTEMS_FILESYSTEM_TYPE_TFTPFS "tftpfs" |
---|
| 1437 | #define RTEMS_FILESYSTEM_TYPE_NFS "nfs" |
---|
| 1438 | #define RTEMS_FILESYSTEM_TYPE_DOSFS "dosfs" |
---|
| 1439 | #define RTEMS_FILESYSTEM_TYPE_RFS "rfs" |
---|
[3c96bee] | 1440 | #define RTEMS_FILESYSTEM_TYPE_JFFS2 "jffs2" |
---|
[14fc3a77] | 1441 | |
---|
| 1442 | /** @} */ |
---|
| 1443 | |
---|
[6c0fcd4] | 1444 | /** |
---|
| 1445 | * @brief Mount table entry. |
---|
| 1446 | */ |
---|
| 1447 | struct rtems_filesystem_mount_table_entry_tt { |
---|
[3b7c123] | 1448 | rtems_chain_node mt_node; |
---|
[da154e14] | 1449 | void *fs_info; |
---|
| 1450 | const rtems_filesystem_operations_table *ops; |
---|
| 1451 | const void *immutable_fs_info; |
---|
[3b7c123] | 1452 | rtems_chain_control location_chain; |
---|
| 1453 | rtems_filesystem_global_location_t *mt_point_node; |
---|
| 1454 | rtems_filesystem_global_location_t *mt_fs_root; |
---|
| 1455 | bool mounted; |
---|
| 1456 | bool writeable; |
---|
[0a95800a] | 1457 | const rtems_filesystem_limits_and_options_t *pathconf_limits_and_options; |
---|
[6c0fcd4] | 1458 | |
---|
| 1459 | /* |
---|
| 1460 | * The target or mount point of the file system. |
---|
| 1461 | */ |
---|
| 1462 | const char *target; |
---|
| 1463 | |
---|
| 1464 | /* |
---|
| 1465 | * The type of filesystem or the name of the filesystem. |
---|
| 1466 | */ |
---|
| 1467 | const char *type; |
---|
| 1468 | |
---|
| 1469 | /* |
---|
| 1470 | * When someone adds a mounted filesystem on a real device, |
---|
| 1471 | * this will need to be used. |
---|
| 1472 | * |
---|
| 1473 | * The lower layers can manage how this is managed. Leave as a |
---|
| 1474 | * string. |
---|
| 1475 | */ |
---|
| 1476 | char *dev; |
---|
[847ad44] | 1477 | |
---|
| 1478 | /** |
---|
| 1479 | * The task that initiated the unmount process. After unmount process |
---|
[93b29f0] | 1480 | * completion this task will be notified via the transient event. |
---|
| 1481 | * |
---|
| 1482 | * @see ClassicEventTransient. |
---|
[847ad44] | 1483 | */ |
---|
| 1484 | rtems_id unmount_task; |
---|
[6c0fcd4] | 1485 | }; |
---|
| 1486 | |
---|
| 1487 | /** |
---|
| 1488 | * @brief File system options. |
---|
[07a3253d] | 1489 | */ |
---|
[6c0fcd4] | 1490 | typedef enum { |
---|
| 1491 | RTEMS_FILESYSTEM_READ_ONLY, |
---|
| 1492 | RTEMS_FILESYSTEM_READ_WRITE, |
---|
| 1493 | RTEMS_FILESYSTEM_BAD_OPTIONS |
---|
| 1494 | } rtems_filesystem_options_t; |
---|
[07a3253d] | 1495 | |
---|
[6c0fcd4] | 1496 | /** |
---|
| 1497 | * @brief File system table entry. |
---|
| 1498 | */ |
---|
| 1499 | typedef struct rtems_filesystem_table_t { |
---|
| 1500 | const char *type; |
---|
| 1501 | rtems_filesystem_fsmount_me_t mount_h; |
---|
| 1502 | } rtems_filesystem_table_t; |
---|
[07a3253d] | 1503 | |
---|
[6c0fcd4] | 1504 | /** |
---|
| 1505 | * @brief Static table of file systems. |
---|
| 1506 | * |
---|
| 1507 | * Externally defined by confdefs.h or the user. |
---|
| 1508 | */ |
---|
| 1509 | extern const rtems_filesystem_table_t rtems_filesystem_table []; |
---|
| 1510 | |
---|
[3b7c123] | 1511 | extern rtems_chain_control rtems_filesystem_mount_table; |
---|
| 1512 | |
---|
[6c0fcd4] | 1513 | /** |
---|
| 1514 | * @brief Registers a file system @a type. |
---|
| 1515 | * |
---|
| 1516 | * The @a mount_h handler will be used to mount a file system of this @a type. |
---|
| 1517 | * |
---|
| 1518 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 1519 | * @retval -1 An error occurred. The @c errno indicates the error. |
---|
[6c0fcd4] | 1520 | */ |
---|
| 1521 | int rtems_filesystem_register( |
---|
| 1522 | const char *type, |
---|
| 1523 | rtems_filesystem_fsmount_me_t mount_h |
---|
| 1524 | ); |
---|
| 1525 | |
---|
| 1526 | /** |
---|
| 1527 | * @brief Unregisters a file system @a type. |
---|
| 1528 | * |
---|
| 1529 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 1530 | * @retval -1 An error occurred. The @c errno indicates the error. |
---|
[6c0fcd4] | 1531 | */ |
---|
| 1532 | int rtems_filesystem_unregister( |
---|
| 1533 | const char *type |
---|
| 1534 | ); |
---|
| 1535 | |
---|
| 1536 | /** |
---|
[816a9cad] | 1537 | * @brief Unmounts the file system instance at the specified mount path. |
---|
[6c0fcd4] | 1538 | * |
---|
[847ad44] | 1539 | * The function waits for the unmount process completion. In case the calling |
---|
| 1540 | * thread uses resources of the unmounted file system the function may never |
---|
| 1541 | * return. In case the calling thread has its root or current directory in the |
---|
| 1542 | * unmounted file system the function returns with an error status and errno is |
---|
| 1543 | * set to EBUSY. |
---|
| 1544 | * |
---|
[93b29f0] | 1545 | * The unmount process completion notification uses the transient event. It is |
---|
| 1546 | * a fatal error to terminate the calling thread while waiting for this event. |
---|
[847ad44] | 1547 | * |
---|
| 1548 | * A concurrent unmount request for the same file system instance has |
---|
| 1549 | * unpredictable effects. |
---|
[6c0fcd4] | 1550 | * |
---|
[816a9cad] | 1551 | * @param[in] mount_path The path to the file system instance mount point. |
---|
| 1552 | * |
---|
[6c0fcd4] | 1553 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 1554 | * @retval -1 An error occurred. The @c errno indicates the error. |
---|
[93b29f0] | 1555 | * |
---|
| 1556 | * @see ClassicEventTransient. |
---|
[6c0fcd4] | 1557 | */ |
---|
[9da9cf4a] | 1558 | int unmount( |
---|
| 1559 | const char *mount_path |
---|
| 1560 | ); |
---|
| 1561 | |
---|
[6c0fcd4] | 1562 | /** |
---|
[816a9cad] | 1563 | * @brief Mounts a file system instance at the specified target path. |
---|
[6d5ba49] | 1564 | * |
---|
[816a9cad] | 1565 | * To mount a standard file system instance one of the following defines should |
---|
| 1566 | * be used to select the file system type |
---|
[6d5ba49] | 1567 | * - RTEMS_FILESYSTEM_TYPE_DEVFS, |
---|
| 1568 | * - RTEMS_FILESYSTEM_TYPE_DOSFS, |
---|
| 1569 | * - RTEMS_FILESYSTEM_TYPE_FTPFS, |
---|
| 1570 | * - RTEMS_FILESYSTEM_TYPE_IMFS, |
---|
[5fe19134] | 1571 | * - RTEMS_FILESYSTEM_TYPE_JFFS2, |
---|
[6d5ba49] | 1572 | * - RTEMS_FILESYSTEM_TYPE_MINIIMFS, |
---|
| 1573 | * - RTEMS_FILESYSTEM_TYPE_NFS, |
---|
| 1574 | * - RTEMS_FILESYSTEM_TYPE_RFS, or |
---|
| 1575 | * - RTEMS_FILESYSTEM_TYPE_TFTPFS. |
---|
| 1576 | * |
---|
[816a9cad] | 1577 | * Only configured or registered file system types are available. You can add |
---|
| 1578 | * file system types to your application configuration with the following |
---|
| 1579 | * configuration options |
---|
[6d5ba49] | 1580 | * - CONFIGURE_FILESYSTEM_DEVFS, |
---|
| 1581 | * - CONFIGURE_FILESYSTEM_DOSFS, |
---|
| 1582 | * - CONFIGURE_FILESYSTEM_FTPFS, |
---|
| 1583 | * - CONFIGURE_FILESYSTEM_IMFS, |
---|
[5fe19134] | 1584 | * - CONFIGURE_FILESYSTEM_JFFS2, |
---|
[6d5ba49] | 1585 | * - CONFIGURE_FILESYSTEM_MINIIMFS, |
---|
| 1586 | * - CONFIGURE_FILESYSTEM_NFS, |
---|
| 1587 | * - CONFIGURE_FILESYSTEM_RFS, and |
---|
| 1588 | * - CONFIGURE_FILESYSTEM_TFTPFS. |
---|
| 1589 | * |
---|
[816a9cad] | 1590 | * In addition to these configuration options file system types can be |
---|
| 1591 | * registered with rtems_filesystem_register(). |
---|
| 1592 | * |
---|
| 1593 | * @param[in] source The source parameter will be forwarded to the file system |
---|
| 1594 | * initialization handler. Usually the source is a path to the corresponding |
---|
[5fe19134] | 1595 | * device file, or @c NULL in case the file system does not use a device file. |
---|
[816a9cad] | 1596 | * @param[in] target The target path must lead to an existing directory, or |
---|
| 1597 | * must be @c NULL. In case the target is @c NULL, the root file system will |
---|
| 1598 | * be mounted. |
---|
| 1599 | * @param[in] filesystemtype This string selects the file system type. |
---|
| 1600 | * @param[in] options The options specify if the file system instance allows |
---|
| 1601 | * read-write or read-only access. |
---|
| 1602 | * @param[in] data The data parameter will be forwarded to the file system |
---|
| 1603 | * initialization handler. It can be used to pass file system specific mount |
---|
| 1604 | * options. The data structure for mount options is file system specific. See |
---|
| 1605 | * also in the corresponding file system documentation. |
---|
[6d5ba49] | 1606 | * |
---|
| 1607 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 1608 | * @retval -1 An error occurred. The @c errno indicates the error. |
---|
[816a9cad] | 1609 | * |
---|
| 1610 | * @see rtems_filesystem_register(), mount_and_make_target_path(), @ref DOSFS |
---|
| 1611 | * and @ref JFFS2. |
---|
[6c0fcd4] | 1612 | */ |
---|
[9da9cf4a] | 1613 | int mount( |
---|
| 1614 | const char *source, |
---|
| 1615 | const char *target, |
---|
| 1616 | const char *filesystemtype, |
---|
| 1617 | rtems_filesystem_options_t options, |
---|
| 1618 | const void *data |
---|
| 1619 | ); |
---|
| 1620 | |
---|
[b813d632] | 1621 | /** |
---|
| 1622 | * @brief Mounts a file system and makes the @a target path. |
---|
| 1623 | * |
---|
| 1624 | * The @a target path will be created with rtems_mkdir() and must not be |
---|
| 1625 | * @c NULL. |
---|
| 1626 | * |
---|
| 1627 | * @see mount(). |
---|
| 1628 | * |
---|
| 1629 | * @retval 0 Successful operation. |
---|
[d0b9295f] | 1630 | * @retval -1 An error occurred. The @c errno indicates the error. |
---|
[b813d632] | 1631 | */ |
---|
| 1632 | int mount_and_make_target_path( |
---|
| 1633 | const char *source, |
---|
| 1634 | const char *target, |
---|
| 1635 | const char *filesystemtype, |
---|
| 1636 | rtems_filesystem_options_t options, |
---|
| 1637 | const void *data |
---|
| 1638 | ); |
---|
| 1639 | |
---|
[6c0fcd4] | 1640 | /** |
---|
| 1641 | * @brief Per file system type routine. |
---|
| 1642 | * |
---|
| 1643 | * @see rtems_filesystem_iterate(). |
---|
| 1644 | * |
---|
| 1645 | * @retval true Stop the iteration. |
---|
| 1646 | * @retval false Continue the iteration. |
---|
| 1647 | */ |
---|
| 1648 | typedef bool (*rtems_per_filesystem_routine)( |
---|
| 1649 | const rtems_filesystem_table_t *fs_entry, |
---|
| 1650 | void *arg |
---|
| 1651 | ); |
---|
| 1652 | |
---|
| 1653 | /** |
---|
| 1654 | * @brief Iterates over all file system types. |
---|
| 1655 | * |
---|
| 1656 | * For each file system type the @a routine will be called with the entry and |
---|
| 1657 | * the @a routine_arg parameter. |
---|
| 1658 | * |
---|
| 1659 | * Do not register or unregister file system types in @a routine. |
---|
| 1660 | * |
---|
| 1661 | * The iteration is protected by the IO library mutex. |
---|
| 1662 | * |
---|
| 1663 | * @retval true Iteration stopped due to @a routine return status. |
---|
| 1664 | * @retval false Iteration through all entries. |
---|
[9da9cf4a] | 1665 | */ |
---|
[6c0fcd4] | 1666 | bool rtems_filesystem_iterate( |
---|
| 1667 | rtems_per_filesystem_routine routine, |
---|
| 1668 | void *routine_arg |
---|
| 1669 | ); |
---|
[9da9cf4a] | 1670 | |
---|
[6c0fcd4] | 1671 | /** |
---|
[3b7c123] | 1672 | * @brief Mount table entry visitor. |
---|
[6c0fcd4] | 1673 | * |
---|
| 1674 | * @retval true Stop the iteration. |
---|
| 1675 | * @retval false Continue the iteration. |
---|
[3b7c123] | 1676 | * |
---|
| 1677 | * @see rtems_filesystem_mount_iterate(). |
---|
[6c0fcd4] | 1678 | */ |
---|
[3b7c123] | 1679 | typedef bool (*rtems_filesystem_mt_entry_visitor)( |
---|
[6c0fcd4] | 1680 | const rtems_filesystem_mount_table_entry_t *mt_entry, |
---|
| 1681 | void *arg |
---|
| 1682 | ); |
---|
| 1683 | |
---|
| 1684 | /** |
---|
[3b7c123] | 1685 | * @brief Iterates over all file system mount entries. |
---|
[6c0fcd4] | 1686 | * |
---|
[3b7c123] | 1687 | * The iteration is protected by the IO library mutex. Do not mount or unmount |
---|
| 1688 | * file systems in the visitor function. |
---|
[6c0fcd4] | 1689 | * |
---|
[3b7c123] | 1690 | * @param[in] visitor For each file system mount entry the visitor function |
---|
| 1691 | * will be called with the entry and the visitor argument as parameters. |
---|
| 1692 | * @param[in] visitor_arg The second parameter for the visitor function. |
---|
[6c0fcd4] | 1693 | * |
---|
[3b7c123] | 1694 | * @retval true Iteration stopped due to visitor function return status. |
---|
[6c0fcd4] | 1695 | * @retval false Iteration through all entries. |
---|
| 1696 | */ |
---|
[3b7c123] | 1697 | bool rtems_filesystem_mount_iterate( |
---|
| 1698 | rtems_filesystem_mt_entry_visitor visitor, |
---|
| 1699 | void *visitor_arg |
---|
[6c0fcd4] | 1700 | ); |
---|
| 1701 | |
---|
[9da9cf4a] | 1702 | typedef struct { |
---|
[3b7c123] | 1703 | const char *source; |
---|
| 1704 | const char *target; |
---|
| 1705 | const char *filesystemtype; |
---|
| 1706 | rtems_filesystem_options_t options; |
---|
| 1707 | const void *data; |
---|
| 1708 | } rtems_filesystem_mount_configuration; |
---|
| 1709 | |
---|
| 1710 | extern const rtems_filesystem_mount_configuration |
---|
| 1711 | rtems_filesystem_root_configuration; |
---|
[9da9cf4a] | 1712 | |
---|
| 1713 | /** @} */ |
---|
| 1714 | |
---|
| 1715 | /** |
---|
| 1716 | * @defgroup Termios Termios |
---|
| 1717 | * |
---|
| 1718 | * @ingroup LibIO |
---|
| 1719 | * |
---|
| 1720 | * @brief Termios |
---|
[161e1b3f] | 1721 | */ |
---|
[b697bc6] | 1722 | /**@{**/ |
---|
[07a3253d] | 1723 | |
---|
[161e1b3f] | 1724 | typedef struct rtems_termios_callbacks { |
---|
[07a3253d] | 1725 | int (*firstOpen)(int major, int minor, void *arg); |
---|
| 1726 | int (*lastClose)(int major, int minor, void *arg); |
---|
| 1727 | int (*pollRead)(int minor); |
---|
[89926c9] | 1728 | ssize_t (*write)(int minor, const char *buf, size_t len); |
---|
[07a3253d] | 1729 | int (*setAttributes)(int minor, const struct termios *t); |
---|
| 1730 | int (*stopRemoteTx)(int minor); |
---|
| 1731 | int (*startRemoteTx)(int minor); |
---|
| 1732 | int outputUsesInterrupts; |
---|
[161e1b3f] | 1733 | } rtems_termios_callbacks; |
---|
| 1734 | |
---|
[ae35953d] | 1735 | void rtems_termios_initialize (void); |
---|
[07a3253d] | 1736 | |
---|
[1f5d2ba] | 1737 | /* |
---|
| 1738 | * CCJ: Change before opening a tty. Newer code from Eric is coming |
---|
| 1739 | * so extra work to handle an open tty is not worth it. If the tty |
---|
| 1740 | * is open, close then open it again. |
---|
| 1741 | */ |
---|
| 1742 | rtems_status_code rtems_termios_bufsize ( |
---|
[96406152] | 1743 | size_t cbufsize, /* cooked buffer size */ |
---|
| 1744 | size_t raw_input, /* raw input buffer size */ |
---|
| 1745 | size_t raw_output /* raw output buffer size */ |
---|
[1f5d2ba] | 1746 | ); |
---|
| 1747 | |
---|
[ae35953d] | 1748 | rtems_status_code rtems_termios_open ( |
---|
[161e1b3f] | 1749 | rtems_device_major_number major, |
---|
| 1750 | rtems_device_minor_number minor, |
---|
| 1751 | void *arg, |
---|
| 1752 | const rtems_termios_callbacks *callbacks |
---|
[07a3253d] | 1753 | ); |
---|
| 1754 | |
---|
| 1755 | rtems_status_code rtems_termios_close( |
---|
| 1756 | void *arg |
---|
| 1757 | ); |
---|
| 1758 | |
---|
| 1759 | rtems_status_code rtems_termios_read( |
---|
| 1760 | void *arg |
---|
| 1761 | ); |
---|
| 1762 | |
---|
| 1763 | rtems_status_code rtems_termios_write( |
---|
| 1764 | void *arg |
---|
| 1765 | ); |
---|
| 1766 | |
---|
| 1767 | rtems_status_code rtems_termios_ioctl( |
---|
| 1768 | void *arg |
---|
| 1769 | ); |
---|
| 1770 | |
---|
| 1771 | int rtems_termios_enqueue_raw_characters( |
---|
| 1772 | void *ttyp, |
---|
[18124551] | 1773 | const char *buf, |
---|
[07a3253d] | 1774 | int len |
---|
| 1775 | ); |
---|
| 1776 | |
---|
| 1777 | int rtems_termios_dequeue_characters( |
---|
| 1778 | void *ttyp, |
---|
| 1779 | int len |
---|
| 1780 | ); |
---|
| 1781 | |
---|
[9da9cf4a] | 1782 | /** @} */ |
---|
[eaee27b] | 1783 | |
---|
[6c0fcd4] | 1784 | /** |
---|
| 1785 | * @brief The pathconf setting for a file system. |
---|
| 1786 | */ |
---|
| 1787 | #define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options) |
---|
| 1788 | |
---|
| 1789 | /** |
---|
| 1790 | * @brief The type of file system. Its name. |
---|
| 1791 | */ |
---|
| 1792 | #define rtems_filesystem_type(_mte) ((_mte)->type) |
---|
| 1793 | |
---|
| 1794 | /** |
---|
| 1795 | * @brief The mount point of a file system. |
---|
| 1796 | */ |
---|
| 1797 | #define rtems_filesystem_mount_point(_mte) ((_mte)->target) |
---|
| 1798 | |
---|
| 1799 | /** |
---|
| 1800 | * @brief The device entry of a file system. |
---|
| 1801 | */ |
---|
| 1802 | #define rtems_filesystem_mount_device(_mte) ((_mte)->dev) |
---|
| 1803 | |
---|
[80c2966] | 1804 | #ifdef __cplusplus |
---|
| 1805 | } |
---|
| 1806 | #endif |
---|
| 1807 | |
---|
[b06e68ef] | 1808 | #endif /* _RTEMS_LIBIO_H */ |
---|