[4d3017a] | 1 | /** |
---|
[9da9cf4a] | 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @ingroup LibIO |
---|
| 5 | * |
---|
| 6 | * @brief Basic IO API. |
---|
[4d3017a] | 7 | */ |
---|
| 8 | |
---|
[b06e68ef] | 9 | /* |
---|
[ad78965d] | 10 | * COPYRIGHT (c) 1989-2008. |
---|
[07a3253d] | 11 | * On-Line Applications Research Corporation (OAR). |
---|
| 12 | * |
---|
| 13 | * The license and distribution terms for this file may be |
---|
| 14 | * found in the file LICENSE in this distribution or at |
---|
[0eae36c7] | 15 | * http://www.rtems.com/license/LICENSE. |
---|
[b06e68ef] | 16 | * |
---|
| 17 | * $Id$ |
---|
| 18 | */ |
---|
| 19 | |
---|
[7945944] | 20 | #ifndef _RTEMS_RTEMS_LIBIO_H |
---|
| 21 | #define _RTEMS_RTEMS_LIBIO_H |
---|
[b06e68ef] | 22 | |
---|
[7a3878b] | 23 | #include <sys/types.h> |
---|
[dcec5a4] | 24 | #include <sys/stat.h> |
---|
[9b05600] | 25 | #include <sys/ioctl.h> |
---|
[eb649786] | 26 | #include <sys/statvfs.h> |
---|
[dcec5a4] | 27 | |
---|
[9da9cf4a] | 28 | #include <unistd.h> |
---|
| 29 | #include <termios.h> |
---|
[07a3253d] | 30 | |
---|
[9da9cf4a] | 31 | #include <rtems.h> |
---|
[d09ad1f0] | 32 | #include <rtems/fs.h> |
---|
[9da9cf4a] | 33 | #include <rtems/chain.h> |
---|
[07a3253d] | 34 | |
---|
[80c2966] | 35 | #ifdef __cplusplus |
---|
| 36 | extern "C" { |
---|
| 37 | #endif |
---|
| 38 | |
---|
[9da9cf4a] | 39 | /** |
---|
| 40 | * @defgroup LibIO IO Library |
---|
| 41 | * |
---|
| 42 | * @brief Provides system call and file system interface definitions. |
---|
| 43 | * |
---|
| 44 | * General purpose communication channel for RTEMS to allow UNIX/POSIX |
---|
| 45 | * system call behavior under RTEMS. Initially this supported only |
---|
| 46 | * IO to devices but has since been enhanced to support networking |
---|
| 47 | * and support for mounted file systems. |
---|
| 48 | * |
---|
| 49 | * @{ |
---|
| 50 | */ |
---|
| 51 | |
---|
| 52 | /** |
---|
[f9a4e80] | 53 | * A 64-bit file offset for internal use by RTEMS. Based on the Newlib |
---|
[9da9cf4a] | 54 | * type. |
---|
[07d6fd5] | 55 | */ |
---|
| 56 | typedef _off64_t rtems_off64_t; |
---|
| 57 | |
---|
[9da9cf4a] | 58 | /** |
---|
[14fc3a77] | 59 | * @name File System Node Types |
---|
[9da9cf4a] | 60 | * |
---|
| 61 | * @{ |
---|
[07a3253d] | 62 | */ |
---|
[9da9cf4a] | 63 | |
---|
[a1f1011] | 64 | #define RTEMS_FILESYSTEM_DIRECTORY 1 |
---|
| 65 | #define RTEMS_FILESYSTEM_DEVICE 2 |
---|
| 66 | #define RTEMS_FILESYSTEM_HARD_LINK 3 |
---|
| 67 | #define RTEMS_FILESYSTEM_SYM_LINK 4 |
---|
| 68 | #define RTEMS_FILESYSTEM_MEMORY_FILE 5 |
---|
[9da9cf4a] | 69 | |
---|
| 70 | /** @} */ |
---|
| 71 | |
---|
[a1f1011] | 72 | typedef int rtems_filesystem_node_types_t; |
---|
[07a3253d] | 73 | |
---|
[9da9cf4a] | 74 | /** |
---|
| 75 | * @name File System Node Operations |
---|
| 76 | * |
---|
| 77 | * @{ |
---|
[07a3253d] | 78 | */ |
---|
[9da9cf4a] | 79 | |
---|
[f9a4e80] | 80 | /** |
---|
| 81 | * This type defines the interface to the open(2) system call |
---|
| 82 | * support which is provided by a file system implementation. |
---|
| 83 | */ |
---|
[07a3253d] | 84 | typedef int (*rtems_filesystem_open_t)( |
---|
| 85 | rtems_libio_t *iop, |
---|
| 86 | const char *pathname, |
---|
[83c5fc1] | 87 | uint32_t flag, |
---|
| 88 | uint32_t mode |
---|
[07a3253d] | 89 | ); |
---|
| 90 | |
---|
[f9a4e80] | 91 | /** |
---|
| 92 | * This type defines the interface to the close(2) system call |
---|
| 93 | * support which is provided by a file system implementation. |
---|
| 94 | */ |
---|
[07a3253d] | 95 | typedef int (*rtems_filesystem_close_t)( |
---|
| 96 | rtems_libio_t *iop |
---|
| 97 | ); |
---|
| 98 | |
---|
[f9a4e80] | 99 | /** |
---|
| 100 | * This type defines the interface to the read(2) system call |
---|
| 101 | * support which is provided by a file system implementation. |
---|
| 102 | */ |
---|
[5d0b2f7] | 103 | typedef ssize_t (*rtems_filesystem_read_t)( |
---|
[07a3253d] | 104 | rtems_libio_t *iop, |
---|
| 105 | void *buffer, |
---|
[7192476f] | 106 | size_t count |
---|
[07a3253d] | 107 | ); |
---|
| 108 | |
---|
[f9a4e80] | 109 | /** |
---|
| 110 | * This type defines the interface to the write(2) system call |
---|
| 111 | * support which is provided by a file system implementation. |
---|
| 112 | */ |
---|
[5d0b2f7] | 113 | typedef ssize_t (*rtems_filesystem_write_t)( |
---|
[07a3253d] | 114 | rtems_libio_t *iop, |
---|
| 115 | const void *buffer, |
---|
[7192476f] | 116 | size_t count |
---|
[07a3253d] | 117 | ); |
---|
| 118 | |
---|
[f9a4e80] | 119 | /** |
---|
| 120 | * This type defines the interface to the ioctl(2) system call |
---|
| 121 | * support which is provided by a file system implementation. |
---|
| 122 | */ |
---|
[07a3253d] | 123 | typedef int (*rtems_filesystem_ioctl_t)( |
---|
| 124 | rtems_libio_t *iop, |
---|
[83c5fc1] | 125 | uint32_t command, |
---|
[07a3253d] | 126 | void *buffer |
---|
| 127 | ); |
---|
| 128 | |
---|
[f9a4e80] | 129 | /** |
---|
| 130 | * This type defines the interface to the lseek(2) system call |
---|
| 131 | * support which is provided by a file system implementation. |
---|
| 132 | */ |
---|
[07d6fd5] | 133 | typedef rtems_off64_t (*rtems_filesystem_lseek_t)( |
---|
[07a3253d] | 134 | rtems_libio_t *iop, |
---|
[07d6fd5] | 135 | rtems_off64_t length, |
---|
[07a3253d] | 136 | int whence |
---|
| 137 | ); |
---|
| 138 | |
---|
[f9a4e80] | 139 | /** |
---|
| 140 | * This type defines the interface to the fstat(2) system call |
---|
| 141 | * support which is provided by a file system implementation. |
---|
| 142 | */ |
---|
[07a3253d] | 143 | typedef int (*rtems_filesystem_fstat_t)( |
---|
| 144 | rtems_filesystem_location_info_t *loc, |
---|
| 145 | struct stat *buf |
---|
| 146 | ); |
---|
| 147 | |
---|
[f9a4e80] | 148 | /** |
---|
| 149 | * This type defines the interface to the fchmod(2) system call |
---|
| 150 | * support which is provided by a file system implementation. |
---|
| 151 | */ |
---|
[07a3253d] | 152 | typedef int (*rtems_filesystem_fchmod_t)( |
---|
| 153 | rtems_filesystem_location_info_t *loc, |
---|
| 154 | mode_t mode |
---|
| 155 | ); |
---|
| 156 | |
---|
[f9a4e80] | 157 | /** |
---|
| 158 | * This type defines the interface to the ftruncate(2) system call |
---|
| 159 | * support which is provided by a file system implementation. |
---|
| 160 | */ |
---|
[07a3253d] | 161 | typedef int (*rtems_filesystem_ftruncate_t)( |
---|
| 162 | rtems_libio_t *iop, |
---|
[07d6fd5] | 163 | rtems_off64_t length |
---|
[07a3253d] | 164 | ); |
---|
| 165 | |
---|
[f9a4e80] | 166 | /** |
---|
| 167 | * This type defines the interface to the fpathconf(2) system call |
---|
| 168 | * support which is provided by a file system implementation. |
---|
| 169 | */ |
---|
[07a3253d] | 170 | typedef int (*rtems_filesystem_fpathconf_t)( |
---|
| 171 | rtems_libio_t *iop, |
---|
| 172 | int name |
---|
| 173 | ); |
---|
| 174 | |
---|
[f9a4e80] | 175 | /** |
---|
| 176 | * This type defines the interface to the fsync(2) system call |
---|
| 177 | * support which is provided by a file system implementation. |
---|
| 178 | */ |
---|
[07a3253d] | 179 | typedef int (*rtems_filesystem_fsync_t)( |
---|
| 180 | rtems_libio_t *iop |
---|
| 181 | ); |
---|
| 182 | |
---|
[f9a4e80] | 183 | /** |
---|
| 184 | * This type defines the interface to the fdatasync(2) system call |
---|
| 185 | * support which is provided by a file system implementation. |
---|
| 186 | */ |
---|
[07a3253d] | 187 | typedef int (*rtems_filesystem_fdatasync_t)( |
---|
| 188 | rtems_libio_t *iop |
---|
| 189 | ); |
---|
| 190 | |
---|
[f9a4e80] | 191 | /** |
---|
| 192 | * This type defines the interface to the fnctl(2) system call |
---|
| 193 | * support which is provided by a file system implementation. |
---|
| 194 | */ |
---|
[af020036] | 195 | typedef int (*rtems_filesystem_fcntl_t)( |
---|
[e2116f9] | 196 | int cmd, |
---|
[af020036] | 197 | rtems_libio_t *iop |
---|
| 198 | ); |
---|
| 199 | |
---|
[4a07d2b] | 200 | typedef int (*rtems_filesystem_rmnod_t)( |
---|
[7baa484] | 201 | rtems_filesystem_location_info_t *parent_loc, /* IN */ |
---|
[4a07d2b] | 202 | rtems_filesystem_location_info_t *pathloc /* IN */ |
---|
| 203 | ); |
---|
| 204 | |
---|
[9da9cf4a] | 205 | /** @} */ |
---|
| 206 | |
---|
| 207 | /** |
---|
| 208 | * @brief File system node operations table. |
---|
| 209 | */ |
---|
[d09ad1f0] | 210 | struct _rtems_filesystem_file_handlers_r { |
---|
[f9a4e80] | 211 | /** |
---|
| 212 | * This field points to the file system specific implementation |
---|
| 213 | * of the support routine for the open(2) system call |
---|
| 214 | * |
---|
| 215 | * @note This method must have a filesystem specific implementation. |
---|
| 216 | * |
---|
| 217 | * @note There is no default implementation. |
---|
| 218 | */ |
---|
| 219 | rtems_filesystem_open_t open_h; |
---|
| 220 | |
---|
| 221 | /** |
---|
| 222 | * This field points to the file system specific implementation |
---|
| 223 | * of the support routine for the close(2) system call |
---|
| 224 | * |
---|
| 225 | * @note This method is REQUIRED by all file systems. |
---|
| 226 | * |
---|
| 227 | * @note There is no default implementation. |
---|
| 228 | */ |
---|
| 229 | rtems_filesystem_close_t close_h; |
---|
| 230 | |
---|
| 231 | /** |
---|
| 232 | * This field points to the file system specific implementation |
---|
| 233 | * of the support routine for the read(2) system call |
---|
| 234 | * |
---|
| 235 | * @note This method must have a filesystem specific implementation. |
---|
| 236 | * |
---|
| 237 | * @note The default implementation returns -1 and sets |
---|
| 238 | * errno to ENOTSUP. |
---|
| 239 | */ |
---|
| 240 | rtems_filesystem_read_t read_h; |
---|
| 241 | |
---|
| 242 | /** |
---|
| 243 | * This field points to the file system specific implementation |
---|
| 244 | * of the support routine for the write(2) system call |
---|
| 245 | * |
---|
| 246 | * @note This method may use a default implementation. |
---|
| 247 | * |
---|
| 248 | * @note The default implementation returns -1 and sets |
---|
| 249 | * errno to ENOTSUP. |
---|
| 250 | */ |
---|
| 251 | rtems_filesystem_write_t write_h; |
---|
| 252 | |
---|
| 253 | /** |
---|
| 254 | * This field points to the file system specific implementation |
---|
| 255 | * of the support routine for the ioctl(2) system call |
---|
| 256 | * |
---|
| 257 | * @note This method may use a default implementation. |
---|
| 258 | * |
---|
| 259 | * @note The default implementation returns -1 and sets |
---|
| 260 | * errno to ENOTSUP. |
---|
| 261 | */ |
---|
| 262 | rtems_filesystem_ioctl_t ioctl_h; |
---|
| 263 | |
---|
| 264 | /** |
---|
| 265 | * This field points to the file system specific implementation |
---|
| 266 | * of the support routine for the lseek(2) system call |
---|
| 267 | * |
---|
| 268 | * @note This method may use a default implementation. |
---|
| 269 | * |
---|
| 270 | * @note The default implementation returns -1 and sets |
---|
| 271 | * errno to ENOTSUP. |
---|
| 272 | */ |
---|
| 273 | rtems_filesystem_lseek_t lseek_h; |
---|
| 274 | |
---|
| 275 | /** |
---|
| 276 | * This field points to the file system specific implementation |
---|
| 277 | * of the support routine for the fstat(2) system call |
---|
| 278 | * |
---|
| 279 | * @note This method may use a default implementation. |
---|
| 280 | * |
---|
| 281 | * @note The default implementation returns -1 and sets |
---|
| 282 | * errno to ENOTSUP. |
---|
| 283 | */ |
---|
| 284 | rtems_filesystem_fstat_t fstat_h; |
---|
| 285 | |
---|
| 286 | /** |
---|
| 287 | * This field points to the file system specific implementation |
---|
| 288 | * of the support routine for the fchmod(2) system call |
---|
| 289 | * |
---|
| 290 | * @note This method may use a default implementation. |
---|
| 291 | * |
---|
| 292 | * @note The default implementation returns -1 and sets |
---|
| 293 | * errno to ENOTSUP. |
---|
| 294 | */ |
---|
| 295 | rtems_filesystem_fchmod_t fchmod_h; |
---|
| 296 | |
---|
| 297 | /** |
---|
| 298 | * This field points to the file system specific implementation |
---|
| 299 | * of the support routine for the ftruncate(2) system call |
---|
| 300 | * |
---|
| 301 | * @note This method may use a default implementation. |
---|
| 302 | * |
---|
| 303 | * @note The default implementation returns -1 and sets |
---|
| 304 | * errno to ENOTSUP. |
---|
| 305 | */ |
---|
| 306 | rtems_filesystem_ftruncate_t ftruncate_h; |
---|
| 307 | |
---|
| 308 | /** |
---|
| 309 | * This field points to the file system specific implementation |
---|
| 310 | * of the support routine for the fpathconf(2) system call |
---|
| 311 | * |
---|
| 312 | * @note This method may use a default implementation. |
---|
| 313 | * |
---|
| 314 | * @note The default implementation returns -1 and sets |
---|
| 315 | * errno to ENOTSUP. |
---|
| 316 | */ |
---|
| 317 | rtems_filesystem_fpathconf_t fpathconf_h; |
---|
| 318 | |
---|
| 319 | /** |
---|
| 320 | * This field points to the file system specific implementation |
---|
| 321 | * of the support routine for the fsync(2) system call |
---|
| 322 | * |
---|
| 323 | * @note This method may use a default implementation. |
---|
| 324 | * |
---|
| 325 | * @note The default implementation returns -1 and sets |
---|
| 326 | * errno to ENOTSUP. |
---|
| 327 | */ |
---|
| 328 | rtems_filesystem_fsync_t fsync_h; |
---|
| 329 | |
---|
| 330 | /** |
---|
| 331 | * This field points to the file system specific implementation |
---|
| 332 | * of the support routine for the fdatasync(2) system call |
---|
| 333 | * |
---|
| 334 | * @note This method may use a default implementation. |
---|
| 335 | * |
---|
| 336 | * @note The default implementation returns -1 and sets |
---|
| 337 | * errno to ENOTSUP. |
---|
| 338 | */ |
---|
| 339 | rtems_filesystem_fdatasync_t fdatasync_h; |
---|
| 340 | |
---|
| 341 | /** |
---|
| 342 | * This field points to the file system specific implementation |
---|
| 343 | * of the support routine for the fcntl(2) system call |
---|
| 344 | * |
---|
| 345 | * @note This method may use a default implementation. |
---|
| 346 | * |
---|
| 347 | * @note The default implementation returns -1 and sets |
---|
| 348 | * errno to ENOTSUP. |
---|
| 349 | */ |
---|
| 350 | rtems_filesystem_fcntl_t fcntl_h; |
---|
| 351 | |
---|
| 352 | /** |
---|
| 353 | * This field points to the file system specific implementation |
---|
| 354 | * of the support routine for the rmnod(2) system call |
---|
| 355 | * |
---|
| 356 | * @note This method may use a default implementation. |
---|
| 357 | * |
---|
| 358 | * @note The default implementation returns -1 and sets |
---|
| 359 | * errno to ENOTSUP. |
---|
| 360 | */ |
---|
| 361 | rtems_filesystem_rmnod_t rmnod_h; |
---|
[d09ad1f0] | 362 | }; |
---|
[07a3253d] | 363 | |
---|
[f9a4e80] | 364 | /** |
---|
| 365 | * This method defines the interface to the default read(2) |
---|
| 366 | * system call support which is provided by a file system |
---|
| 367 | * implementation. |
---|
| 368 | */ |
---|
| 369 | size_t rtems_filesystem_default_read( |
---|
| 370 | rtems_libio_t *iop, |
---|
| 371 | void *buffer, |
---|
| 372 | size_t count |
---|
| 373 | ); |
---|
| 374 | |
---|
| 375 | /** |
---|
| 376 | * This method defines the interface to the default write(2) system call |
---|
| 377 | * support which is provided by a file system implementation. |
---|
| 378 | */ |
---|
| 379 | ssize_t rtems_filesystem_default_write( |
---|
| 380 | rtems_libio_t *iop, |
---|
| 381 | const void *buffer, |
---|
| 382 | size_t count |
---|
| 383 | ); |
---|
| 384 | |
---|
| 385 | /** |
---|
| 386 | * This method defines the interface to the default ioctl(2) system call |
---|
| 387 | * support which is provided by a file system implementation. |
---|
| 388 | */ |
---|
| 389 | int rtems_filesystem_default_ioctl( |
---|
| 390 | rtems_libio_t *iop, |
---|
| 391 | uint32_t command, |
---|
| 392 | void *buffer |
---|
| 393 | ); |
---|
| 394 | |
---|
| 395 | /** |
---|
| 396 | * This method defines the interface to the default lseek(2) system call |
---|
| 397 | * support which is provided by a file system implementation. |
---|
| 398 | */ |
---|
| 399 | rtems_off64_t rtems_filesystem_default_lseek( |
---|
| 400 | rtems_libio_t *iop, |
---|
| 401 | rtems_off64_t length, |
---|
| 402 | int whence |
---|
| 403 | ); |
---|
| 404 | |
---|
| 405 | /** |
---|
| 406 | * This method defines the interface to the default fstat(2) system call |
---|
| 407 | * support which is provided by a file system implementation. |
---|
| 408 | */ |
---|
| 409 | int rtems_filesystem_default_fstat( |
---|
| 410 | rtems_filesystem_location_info_t *loc, |
---|
| 411 | struct stat *buf |
---|
| 412 | ); |
---|
| 413 | |
---|
| 414 | /** |
---|
| 415 | * This method defines the interface to the default fchmod(2) system call |
---|
| 416 | * support which is provided by a file system implementation. |
---|
| 417 | */ |
---|
| 418 | int rtems_filesystem_default_fchmod( |
---|
| 419 | rtems_filesystem_location_info_t *loc, |
---|
| 420 | mode_t mode |
---|
| 421 | ); |
---|
| 422 | |
---|
| 423 | /** |
---|
| 424 | * This method defines the interface to the default ftruncate(2) system call |
---|
| 425 | * support which is provided by a file system implementation. |
---|
| 426 | */ |
---|
| 427 | int rtems_filesystem_default_ftruncate( |
---|
| 428 | rtems_libio_t *iop, |
---|
| 429 | rtems_off64_t length |
---|
| 430 | ); |
---|
| 431 | |
---|
| 432 | /** |
---|
| 433 | * This method defines the interface to the default fpathconf(2) system call |
---|
| 434 | * support which is provided by a file system implementation. |
---|
| 435 | */ |
---|
| 436 | int rtems_filesystem_default_fpathconf( |
---|
| 437 | rtems_libio_t *iop, |
---|
| 438 | int name |
---|
| 439 | ); |
---|
| 440 | |
---|
| 441 | /** |
---|
| 442 | * This method defines the interface to the default fsync(2) system call |
---|
| 443 | * support which is provided by a file system implementation. |
---|
| 444 | */ |
---|
| 445 | int rtems_filesystem_default_fsync( |
---|
| 446 | rtems_libio_t *iop |
---|
| 447 | ); |
---|
| 448 | |
---|
| 449 | /** |
---|
| 450 | * This method defines the interface to the default fdatasync(2) system call |
---|
| 451 | * support which is provided by a file system implementation. |
---|
| 452 | */ |
---|
| 453 | int rtems_filesystem_default_fdatasync( |
---|
| 454 | rtems_libio_t *iop |
---|
| 455 | ); |
---|
| 456 | |
---|
| 457 | /** |
---|
| 458 | * This method defines the interface to the default fnctl(2) system call |
---|
| 459 | * support which is provided by a file system implementation. |
---|
| 460 | */ |
---|
| 461 | int rtems_filesystem_default_fcntl( |
---|
| 462 | int cmd, |
---|
| 463 | rtems_libio_t *iop |
---|
| 464 | ); |
---|
| 465 | |
---|
| 466 | /** |
---|
| 467 | * This method defines the interface to the default rmnod(2) system call |
---|
| 468 | * support which is provided by a file system implementation. |
---|
| 469 | */ |
---|
| 470 | int rtems_filesystem_default_rmnod( |
---|
| 471 | rtems_filesystem_location_info_t *parent_loc, /* IN */ |
---|
| 472 | rtems_filesystem_location_info_t *pathloc /* IN */ |
---|
| 473 | ); |
---|
| 474 | |
---|
[9da9cf4a] | 475 | /** |
---|
| 476 | * @name File System Operations |
---|
| 477 | * |
---|
| 478 | * @{ |
---|
[07a3253d] | 479 | */ |
---|
| 480 | |
---|
[f9a4e80] | 481 | /** |
---|
| 482 | * This type defines the interface to the mknod(2) system call |
---|
| 483 | * support which is provided by a file system implementation. |
---|
| 484 | * |
---|
| 485 | * @note This routine does not allocate any space and |
---|
| 486 | * rtems_filesystem_freenode_t is not called by the generic |
---|
| 487 | * after calling this routine. ie. node_access does not have |
---|
| 488 | * to contain valid data when the routine returns. |
---|
[07a3253d] | 489 | */ |
---|
| 490 | typedef int (*rtems_filesystem_mknod_t)( |
---|
| 491 | const char *path, /* IN */ |
---|
| 492 | mode_t mode, /* IN */ |
---|
| 493 | dev_t dev, /* IN */ |
---|
| 494 | rtems_filesystem_location_info_t *pathloc /* IN/OUT */ |
---|
| 495 | ); |
---|
| 496 | |
---|
[f9a4e80] | 497 | /** |
---|
| 498 | * This type defines the interface that allows the |
---|
| 499 | * file system implementation to parse a path and |
---|
| 500 | * allocate any memory necessary for tracking purposes. |
---|
| 501 | * |
---|
| 502 | * @note rtems_filesystem_freenode_t must be called by |
---|
| 503 | * the generic after calling this routine |
---|
[07a3253d] | 504 | */ |
---|
| 505 | typedef int (*rtems_filesystem_evalpath_t)( |
---|
| 506 | const char *pathname, /* IN */ |
---|
[fb1b349] | 507 | size_t pathnamelen, /* IN */ |
---|
[07a3253d] | 508 | int flags, /* IN */ |
---|
| 509 | rtems_filesystem_location_info_t *pathloc /* IN/OUT */ |
---|
| 510 | ); |
---|
| 511 | |
---|
[f9a4e80] | 512 | /** |
---|
| 513 | * This type defines the interface that allows the |
---|
| 514 | * file system implementation to parse a path with the |
---|
| 515 | * intent of creating a new node and to |
---|
| 516 | * allocate any memory necessary for tracking purposes. |
---|
| 517 | * |
---|
| 518 | * @note rtems_filesystem_freenode_t must be called by |
---|
| 519 | * the generic after calling this routine |
---|
| 520 | */ |
---|
[07a3253d] | 521 | typedef int (*rtems_filesystem_evalmake_t)( |
---|
| 522 | const char *path, /* IN */ |
---|
| 523 | rtems_filesystem_location_info_t *pathloc, /* IN/OUT */ |
---|
| 524 | const char **name /* OUT */ |
---|
| 525 | ); |
---|
| 526 | |
---|
[f9a4e80] | 527 | /** |
---|
| 528 | * This type defines the interface to the link(2) system call |
---|
| 529 | * support which is provided by a file system implementation. |
---|
| 530 | */ |
---|
[07a3253d] | 531 | typedef int (*rtems_filesystem_link_t)( |
---|
[f9a4e80] | 532 | rtems_filesystem_location_info_t *to_loc, /* IN */ |
---|
| 533 | rtems_filesystem_location_info_t *parent_loc, /* IN */ |
---|
| 534 | const char *name /* IN */ |
---|
[07a3253d] | 535 | ); |
---|
| 536 | |
---|
[f9a4e80] | 537 | /** |
---|
| 538 | * This type defines the interface to the unlink(2) system call |
---|
| 539 | * support which is provided by a file system implementation. |
---|
| 540 | */ |
---|
[07a3253d] | 541 | typedef int (*rtems_filesystem_unlink_t)( |
---|
[f9a4e80] | 542 | rtems_filesystem_location_info_t *parent_pathloc, /* IN */ |
---|
| 543 | rtems_filesystem_location_info_t *pathloc /* IN */ |
---|
[07a3253d] | 544 | ); |
---|
| 545 | |
---|
[f9a4e80] | 546 | /** |
---|
| 547 | * This type defines the interface to the chown(2) system call |
---|
| 548 | * support which is provided by a file system implementation. |
---|
| 549 | */ |
---|
[07a3253d] | 550 | typedef int (*rtems_filesystem_chown_t)( |
---|
[f9a4e80] | 551 | rtems_filesystem_location_info_t *pathloc, /* IN */ |
---|
| 552 | uid_t owner, /* IN */ |
---|
| 553 | gid_t group /* IN */ |
---|
[07a3253d] | 554 | ); |
---|
| 555 | |
---|
[f9a4e80] | 556 | /** |
---|
| 557 | * This type defines the interface to the freenod(2) system call |
---|
| 558 | * support which is provided by a file system implementation. |
---|
| 559 | */ |
---|
[07a3253d] | 560 | typedef int (*rtems_filesystem_freenode_t)( |
---|
| 561 | rtems_filesystem_location_info_t *pathloc /* IN */ |
---|
| 562 | ); |
---|
| 563 | |
---|
[f9a4e80] | 564 | /** |
---|
| 565 | * This type defines the interface that allows the implemented |
---|
| 566 | * filesystem ot mount another filesystem at the given location. |
---|
| 567 | */ |
---|
[07a3253d] | 568 | typedef int (* rtems_filesystem_mount_t ) ( |
---|
[29e92b0] | 569 | rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ |
---|
[07a3253d] | 570 | ); |
---|
| 571 | |
---|
[f9a4e80] | 572 | /** |
---|
| 573 | * This type defines the interface that allows a file system |
---|
| 574 | * implementation to do any necessary work that is needed when |
---|
| 575 | * it is being mounted. |
---|
| 576 | */ |
---|
[07a3253d] | 577 | typedef int (* rtems_filesystem_fsmount_me_t )( |
---|
[29e92b0] | 578 | rtems_filesystem_mount_table_entry_t *mt_entry, /* IN */ |
---|
| 579 | const void *data /* IN */ |
---|
[07a3253d] | 580 | ); |
---|
| 581 | |
---|
[f9a4e80] | 582 | /** |
---|
| 583 | * This type defines the interface allow the filesystem to |
---|
| 584 | * unmount a filesystem that was mounted at one of its node |
---|
| 585 | * locations. |
---|
| 586 | */ |
---|
[07a3253d] | 587 | typedef int (* rtems_filesystem_unmount_t ) ( |
---|
[29e92b0] | 588 | rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ |
---|
[07a3253d] | 589 | ); |
---|
| 590 | |
---|
[f9a4e80] | 591 | /** |
---|
| 592 | * This type defines the interface that allows a file system |
---|
| 593 | * implementation to do any necessary work that is needed when |
---|
| 594 | * it is being unmounted. |
---|
| 595 | */ |
---|
[07a3253d] | 596 | typedef int (* rtems_filesystem_fsunmount_me_t ) ( |
---|
[29e92b0] | 597 | rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ |
---|
[07a3253d] | 598 | ); |
---|
| 599 | |
---|
[f9a4e80] | 600 | /** |
---|
| 601 | * This type defines the interface that will return the |
---|
| 602 | * type of a filesystem implementations node. |
---|
| 603 | */ |
---|
[07a3253d] | 604 | typedef rtems_filesystem_node_types_t (* rtems_filesystem_node_type_t) ( |
---|
[29e92b0] | 605 | rtems_filesystem_location_info_t *pathloc /* IN */ |
---|
[07a3253d] | 606 | ); |
---|
| 607 | |
---|
[f9a4e80] | 608 | /** |
---|
| 609 | * This type defines the interface to the time(2) system call |
---|
| 610 | * support which is provided by a file system implementation. |
---|
| 611 | */ |
---|
[07a3253d] | 612 | typedef int (* rtems_filesystem_utime_t)( |
---|
| 613 | rtems_filesystem_location_info_t *pathloc, /* IN */ |
---|
| 614 | time_t actime, /* IN */ |
---|
| 615 | time_t modtime /* IN */ |
---|
| 616 | ); |
---|
| 617 | |
---|
[f9a4e80] | 618 | /** |
---|
| 619 | * This type defines the interface to the link(2) system call |
---|
| 620 | * support which is provided by a file system implementation. |
---|
| 621 | */ |
---|
[07a3253d] | 622 | typedef int (*rtems_filesystem_evaluate_link_t)( |
---|
| 623 | rtems_filesystem_location_info_t *pathloc, /* IN/OUT */ |
---|
| 624 | int flags /* IN */ |
---|
| 625 | ); |
---|
| 626 | |
---|
[f9a4e80] | 627 | /** |
---|
| 628 | * This type defines the interface to the symlink(2) system call |
---|
| 629 | * support which is provided by a file system implementation. |
---|
| 630 | */ |
---|
[07a3253d] | 631 | typedef int (*rtems_filesystem_symlink_t)( |
---|
| 632 | rtems_filesystem_location_info_t *loc, /* IN */ |
---|
| 633 | const char *link_name, /* IN */ |
---|
| 634 | const char *node_name |
---|
| 635 | ); |
---|
| 636 | |
---|
[f9a4e80] | 637 | /** |
---|
| 638 | * This type defines the interface to the readlink(2) system call |
---|
| 639 | * support which is provided by a file system implementation. |
---|
| 640 | */ |
---|
[07a3253d] | 641 | typedef int (*rtems_filesystem_readlink_t)( |
---|
[50f32b11] | 642 | rtems_filesystem_location_info_t *loc, /* IN */ |
---|
| 643 | char *buf, /* OUT */ |
---|
| 644 | size_t bufsize |
---|
[07a3253d] | 645 | ); |
---|
| 646 | |
---|
[f9a4e80] | 647 | /** |
---|
| 648 | * This type defines the interface to the name(2) system call |
---|
| 649 | * support which is provided by a file system implementation. |
---|
| 650 | */ |
---|
[8ec7abb] | 651 | typedef int (*rtems_filesystem_rename_t)( |
---|
| 652 | rtems_filesystem_location_info_t *old_parent_loc, /* IN */ |
---|
| 653 | rtems_filesystem_location_info_t *old_loc, /* IN */ |
---|
| 654 | rtems_filesystem_location_info_t *new_parent_loc, /* IN */ |
---|
| 655 | const char *name /* IN */ |
---|
| 656 | ); |
---|
| 657 | |
---|
[f9a4e80] | 658 | /** |
---|
| 659 | * This type defines the interface to the statvfs(2) system call |
---|
| 660 | * support which is provided by a file system implementation. |
---|
| 661 | */ |
---|
[eb649786] | 662 | typedef int (*rtems_filesystem_statvfs_t)( |
---|
| 663 | rtems_filesystem_location_info_t *loc, /* IN */ |
---|
| 664 | struct statvfs *buf /* OUT */ |
---|
| 665 | ); |
---|
| 666 | |
---|
[9da9cf4a] | 667 | /** @} */ |
---|
[07a3253d] | 668 | |
---|
[9da9cf4a] | 669 | /** |
---|
| 670 | * @brief File system operations table. |
---|
[07a3253d] | 671 | */ |
---|
[d09ad1f0] | 672 | struct _rtems_filesystem_operations_table { |
---|
[f9a4e80] | 673 | |
---|
| 674 | /** |
---|
| 675 | * This field points to the file system specific implementation |
---|
| 676 | * of the support routine that evaluates a character path and |
---|
| 677 | * returns the node assocated with the last node in the path. |
---|
| 678 | * |
---|
| 679 | * @note This method must have a filesystem specific implementation. |
---|
| 680 | * |
---|
| 681 | * @note There is no default implementation. |
---|
| 682 | */ |
---|
[9c3fa30] | 683 | rtems_filesystem_evalpath_t evalpath_h; |
---|
[f9a4e80] | 684 | |
---|
| 685 | /** |
---|
| 686 | * This field points to the file system specific implementation |
---|
| 687 | * of the support routine that evaluates a character path and |
---|
| 688 | * returns the node assocated with next to the last node in |
---|
| 689 | * the path. The last node will be the new node to be created. |
---|
| 690 | * |
---|
| 691 | * @note This method must have a filesystem specific implementation. |
---|
| 692 | * |
---|
| 693 | * @note There is no default implementation. |
---|
| 694 | */ |
---|
[9c3fa30] | 695 | rtems_filesystem_evalmake_t evalformake_h; |
---|
[f9a4e80] | 696 | |
---|
| 697 | /** |
---|
| 698 | * This field points to the file system specific implementation |
---|
| 699 | * of the support routine for the link(2) system call |
---|
| 700 | * |
---|
| 701 | * @note This method may use a default implementation. |
---|
| 702 | * |
---|
| 703 | * @note The default implementation returns -1 and sets |
---|
| 704 | * errno to ENOTSUP. |
---|
| 705 | */ |
---|
[9c3fa30] | 706 | rtems_filesystem_link_t link_h; |
---|
[f9a4e80] | 707 | |
---|
| 708 | /** |
---|
| 709 | * This field points to the file system specific implementation |
---|
| 710 | * of the support routine for the unlink(2) system call |
---|
| 711 | * |
---|
| 712 | * @note This method may use a default implementation. |
---|
| 713 | * |
---|
| 714 | * @note The default implementation returns -1 and sets |
---|
| 715 | * errno to ENOTSUP. |
---|
| 716 | */ |
---|
[9c3fa30] | 717 | rtems_filesystem_unlink_t unlink_h; |
---|
[f9a4e80] | 718 | |
---|
| 719 | /** |
---|
| 720 | * This field points to the file system specific implementation |
---|
| 721 | * of a method that returns the node type of the given node. |
---|
| 722 | * |
---|
| 723 | * @note This method may use a default implementation. |
---|
| 724 | * |
---|
| 725 | * @note The default implementation returns -1 and sets |
---|
| 726 | * errno to ENOTSUP. |
---|
| 727 | */ |
---|
[9c3fa30] | 728 | rtems_filesystem_node_type_t node_type_h; |
---|
[f9a4e80] | 729 | |
---|
| 730 | /** |
---|
| 731 | * This field points to the file system specific implementation |
---|
| 732 | * of the support routine for the link(2) system call |
---|
| 733 | * |
---|
| 734 | * @note This method may use a mknod implementation. |
---|
| 735 | * |
---|
| 736 | * @note The default implementation returns -1 and sets |
---|
| 737 | * errno to ENOTSUP. |
---|
| 738 | */ |
---|
[9c3fa30] | 739 | rtems_filesystem_mknod_t mknod_h; |
---|
[f9a4e80] | 740 | |
---|
| 741 | /** |
---|
| 742 | * This field points to the file system specific implementation |
---|
| 743 | * of the support routine for the link(2) system call |
---|
| 744 | * |
---|
| 745 | * @note This method may use a default implementation. |
---|
| 746 | * |
---|
| 747 | * @note The default implementation returns -1 and sets |
---|
| 748 | * errno to ENOTSUP. |
---|
| 749 | */ |
---|
[9c3fa30] | 750 | rtems_filesystem_chown_t chown_h; |
---|
[f9a4e80] | 751 | |
---|
| 752 | /** |
---|
| 753 | * This field points to the file system specific implementation |
---|
| 754 | * of the support routine for the freenod(2) system call |
---|
| 755 | * |
---|
| 756 | * @note This method may use a default implementation. |
---|
| 757 | * |
---|
| 758 | * @note The default implementation returns -1 and sets |
---|
| 759 | * errno to ENOTSUP. |
---|
| 760 | */ |
---|
[9c3fa30] | 761 | rtems_filesystem_freenode_t freenod_h; |
---|
[f9a4e80] | 762 | |
---|
| 763 | /** |
---|
| 764 | * This field points to the file system specific implementation |
---|
| 765 | * of the support routine for the mount(2) system call |
---|
| 766 | * |
---|
| 767 | * @note This method may use a default implementation. |
---|
| 768 | * |
---|
| 769 | * @note The default implementation returns -1 and sets |
---|
| 770 | * errno to ENOTSUP. |
---|
| 771 | */ |
---|
[9c3fa30] | 772 | rtems_filesystem_mount_t mount_h; |
---|
[f9a4e80] | 773 | |
---|
| 774 | /** |
---|
| 775 | * This field points to the file system specific implementation |
---|
| 776 | * of the support routine for the fsmount(2) system call |
---|
| 777 | * |
---|
| 778 | * @note This method may use a default implementation. |
---|
| 779 | * |
---|
| 780 | * @note The default implementation returns -1 and sets |
---|
| 781 | * errno to ENOTSUP. |
---|
| 782 | */ |
---|
[9c3fa30] | 783 | rtems_filesystem_fsmount_me_t fsmount_me_h; |
---|
[f9a4e80] | 784 | |
---|
| 785 | /** |
---|
| 786 | * This field points to the file system specific implementation |
---|
| 787 | * of the support routine for the unmount(2) system call |
---|
| 788 | * |
---|
| 789 | * @note This method may use a default implementation. |
---|
| 790 | * |
---|
| 791 | * @note The default implementation returns -1 and sets |
---|
| 792 | * errno to ENOTSUP. |
---|
| 793 | */ |
---|
[9c3fa30] | 794 | rtems_filesystem_unmount_t unmount_h; |
---|
[f9a4e80] | 795 | |
---|
| 796 | /** |
---|
| 797 | * This field points to the file system specific implementation |
---|
| 798 | * of the support routine for the fsunmount(2) system call |
---|
| 799 | * |
---|
| 800 | * @note This method may use a default implementation. |
---|
| 801 | * |
---|
| 802 | * @note The default implementation returns -1 and sets |
---|
| 803 | * errno to ENOTSUP. |
---|
| 804 | */ |
---|
[9c3fa30] | 805 | rtems_filesystem_fsunmount_me_t fsunmount_me_h; |
---|
[f9a4e80] | 806 | |
---|
| 807 | /** |
---|
| 808 | * This field points to the file system specific implementation |
---|
| 809 | * of the support routine for the utime(2) system call |
---|
| 810 | * |
---|
| 811 | * @note This method may use a default implementation. |
---|
| 812 | * |
---|
| 813 | * @note The default implementation returns -1 and sets |
---|
| 814 | * errno to ENOTSUP. |
---|
| 815 | */ |
---|
[9c3fa30] | 816 | rtems_filesystem_utime_t utime_h; |
---|
[f9a4e80] | 817 | |
---|
| 818 | /** |
---|
| 819 | * This field points to the file system specific implementation |
---|
| 820 | * of the support routine for the eval_link(2) system call |
---|
| 821 | * |
---|
| 822 | * @note This method may use a default implementation. |
---|
| 823 | * |
---|
| 824 | * @note The default implementation returns -1 and sets |
---|
| 825 | * errno to ENOTSUP. |
---|
| 826 | */ |
---|
[9c3fa30] | 827 | rtems_filesystem_evaluate_link_t eval_link_h; |
---|
[f9a4e80] | 828 | |
---|
| 829 | /** |
---|
| 830 | * This field points to the file system specific implementation |
---|
| 831 | * of the support routine for the sumlink(2) system call |
---|
| 832 | * |
---|
| 833 | * @note This method may use a default implementation. |
---|
| 834 | * |
---|
| 835 | * @note The default implementation returns -1 and sets |
---|
| 836 | * errno to ENOTSUP. |
---|
| 837 | */ |
---|
[9c3fa30] | 838 | rtems_filesystem_symlink_t symlink_h; |
---|
[f9a4e80] | 839 | |
---|
| 840 | /** |
---|
| 841 | * This field points to the file system specific implementation |
---|
| 842 | * of the support routine for the readlink(2) system call |
---|
| 843 | * |
---|
| 844 | * @note This method may use a default implementation. |
---|
| 845 | * |
---|
| 846 | * @note The default implementation returns -1 and sets |
---|
| 847 | * errno to ENOTSUP. |
---|
| 848 | */ |
---|
[9c3fa30] | 849 | rtems_filesystem_readlink_t readlink_h; |
---|
[f9a4e80] | 850 | |
---|
| 851 | /** |
---|
| 852 | * This field points to the file system specific implementation |
---|
| 853 | * of the support routine for the rename(2) system call |
---|
| 854 | * |
---|
| 855 | * @note This method may use a default implementation. |
---|
| 856 | * |
---|
| 857 | * @note The default implementation returns -1 and sets |
---|
| 858 | * errno to ENOTSUP. |
---|
| 859 | */ |
---|
[8ec7abb] | 860 | rtems_filesystem_rename_t rename_h; |
---|
[f9a4e80] | 861 | |
---|
| 862 | /** |
---|
| 863 | * This field points to the file system specific implementation |
---|
| 864 | * of the support routine for the statvfs(2) system call |
---|
| 865 | * |
---|
| 866 | * @note This method may use a default implementation. |
---|
| 867 | * |
---|
| 868 | * @note The default implementation returns -1 and sets |
---|
| 869 | * errno to ENOTSUP. |
---|
| 870 | */ |
---|
[eb649786] | 871 | rtems_filesystem_statvfs_t statvfs_h; |
---|
[d09ad1f0] | 872 | }; |
---|
| 873 | |
---|
[f9a4e80] | 874 | /* |
---|
| 875 | * @brief Default filesystem evalpath |
---|
| 876 | */ |
---|
| 877 | |
---|
| 878 | |
---|
| 879 | /** |
---|
| 880 | * @brief Provides a defualt routine for filesystem |
---|
| 881 | * implementation of a link command. |
---|
| 882 | */ |
---|
| 883 | int rtems_filesystem_default_link( |
---|
| 884 | rtems_filesystem_location_info_t *to_loc, /* IN */ |
---|
| 885 | rtems_filesystem_location_info_t *parent_loc, /* IN */ |
---|
| 886 | const char *name /* IN */ |
---|
| 887 | ); |
---|
| 888 | |
---|
| 889 | /** |
---|
| 890 | * @brief Provides a defualt routine for filesystem |
---|
| 891 | * implementation of a unlink command. |
---|
| 892 | */ |
---|
| 893 | int rtems_filesystem_default_unlink( |
---|
| 894 | rtems_filesystem_location_info_t *parent_pathloc, /* IN */ |
---|
| 895 | rtems_filesystem_location_info_t *pathloc /* IN */ |
---|
| 896 | ); |
---|
| 897 | |
---|
| 898 | /** |
---|
| 899 | * @brief Provides a defualt routine for filesystem |
---|
| 900 | * implementation of a chown command. |
---|
| 901 | */ |
---|
| 902 | int rtems_filesystem_default_chown( |
---|
| 903 | rtems_filesystem_location_info_t *pathloc, /* IN */ |
---|
| 904 | uid_t owner, /* IN */ |
---|
| 905 | gid_t group /* IN */ |
---|
| 906 | ); |
---|
| 907 | |
---|
| 908 | /** |
---|
| 909 | * @brief Provides a defualt routine for filesystem |
---|
| 910 | * implementation of a freenode command. |
---|
| 911 | */ |
---|
| 912 | int rtems_filesystem_default_freenode( |
---|
| 913 | rtems_filesystem_location_info_t *pathloc /* IN */ |
---|
| 914 | ); |
---|
| 915 | |
---|
| 916 | /** |
---|
| 917 | * @brief Provides a defualt routine for filesystem |
---|
| 918 | * implementation of a mount command. |
---|
| 919 | */ |
---|
| 920 | int rtems_filesystem_default_mount ( |
---|
| 921 | rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ |
---|
| 922 | ); |
---|
| 923 | |
---|
| 924 | /** |
---|
| 925 | * @brief Provides a defualt routine for filesystem |
---|
| 926 | * implementation of a fsmount command. |
---|
| 927 | */ |
---|
| 928 | int rtems_filesystem_default_fsmount( |
---|
| 929 | rtems_filesystem_mount_table_entry_t *mt_entry, /* IN */ |
---|
| 930 | const void *data /* IN */ |
---|
| 931 | ); |
---|
| 932 | |
---|
| 933 | /** |
---|
| 934 | * @brief Provides a defualt routine for filesystem |
---|
| 935 | * implementation of a unmount command. |
---|
| 936 | */ |
---|
| 937 | int rtems_filesystem_default_unmount( |
---|
| 938 | rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ |
---|
| 939 | ); |
---|
| 940 | |
---|
| 941 | /** |
---|
| 942 | * @brief Provides a defualt routine for filesystem |
---|
| 943 | * implementation of a fsunmount command. |
---|
| 944 | */ |
---|
| 945 | int rtems_filesystem_default_fsunmount( |
---|
| 946 | rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ |
---|
| 947 | ); |
---|
| 948 | |
---|
| 949 | |
---|
| 950 | /** |
---|
| 951 | * @brief Provides a defualt routine for filesystem |
---|
| 952 | * implementation of a utime command. |
---|
| 953 | */ |
---|
| 954 | int rtems_filesystem_default_utime( |
---|
| 955 | rtems_filesystem_location_info_t *pathloc, /* IN */ |
---|
| 956 | time_t actime, /* IN */ |
---|
| 957 | time_t modtime /* IN */ |
---|
| 958 | ); |
---|
| 959 | |
---|
| 960 | /** |
---|
| 961 | * @brief Provides a defualt routine for filesystem |
---|
| 962 | * implementation of a link command. |
---|
| 963 | */ |
---|
| 964 | int rtems_filesystem_default_evaluate_link( |
---|
| 965 | rtems_filesystem_location_info_t *pathloc, /* IN/OUT */ |
---|
| 966 | int flags /* IN */ |
---|
| 967 | ); |
---|
| 968 | |
---|
| 969 | /** |
---|
| 970 | * @brief Provides a defualt routine for filesystem |
---|
| 971 | * implementation of a symlink command. |
---|
| 972 | */ |
---|
| 973 | int rtems_filesystem_default_symlink( |
---|
| 974 | rtems_filesystem_location_info_t *loc, /* IN */ |
---|
| 975 | const char *link_name, /* IN */ |
---|
| 976 | const char *node_name |
---|
| 977 | ); |
---|
| 978 | |
---|
| 979 | /** |
---|
| 980 | * @brief Provides a defualt routine for filesystem |
---|
| 981 | * implementation of a readlink command. |
---|
| 982 | */ |
---|
| 983 | int rtems_filesystem_default_readlink( |
---|
| 984 | rtems_filesystem_location_info_t *loc, /* IN */ |
---|
| 985 | char *buf, /* OUT */ |
---|
| 986 | size_t bufsize |
---|
| 987 | ); |
---|
| 988 | |
---|
| 989 | /** |
---|
| 990 | * @brief Provides a defualt routine for filesystem |
---|
| 991 | * implementation of a rename command. |
---|
| 992 | */ |
---|
| 993 | int rtems_filesystem_default_rename( |
---|
| 994 | rtems_filesystem_location_info_t *old_parent_loc, /* IN */ |
---|
| 995 | rtems_filesystem_location_info_t *old_loc, /* IN */ |
---|
| 996 | rtems_filesystem_location_info_t *new_parent_loc, /* IN */ |
---|
| 997 | const char *name /* IN */ |
---|
| 998 | ); |
---|
| 999 | |
---|
| 1000 | /** |
---|
| 1001 | * @brief Provides a defualt routine for filesystem |
---|
| 1002 | * implementation of a statvfs command. |
---|
| 1003 | */ |
---|
| 1004 | int rtems_filesystem_default_statvfs( |
---|
| 1005 | rtems_filesystem_location_info_t *loc, /* IN */ |
---|
| 1006 | struct statvfs *buf /* OUT */ |
---|
| 1007 | ); |
---|
| 1008 | |
---|
[7d01d244] | 1009 | /** |
---|
| 1010 | * @brief File system table entry. |
---|
[29e92b0] | 1011 | */ |
---|
[dfce6724] | 1012 | typedef struct rtems_filesystem_table_t { |
---|
[29e92b0] | 1013 | const char *type; |
---|
| 1014 | rtems_filesystem_fsmount_me_t mount_h; |
---|
| 1015 | } rtems_filesystem_table_t; |
---|
| 1016 | |
---|
[7d01d244] | 1017 | /** |
---|
| 1018 | * @brief Static table of file systems. |
---|
| 1019 | * |
---|
| 1020 | * Externally defined by confdefs.h or the user. |
---|
[29e92b0] | 1021 | */ |
---|
[7d01d244] | 1022 | extern const rtems_filesystem_table_t rtems_filesystem_table []; |
---|
[29e92b0] | 1023 | |
---|
[7d01d244] | 1024 | /** |
---|
| 1025 | * @brief Per file system table entry routine type. |
---|
| 1026 | * |
---|
[9da9cf4a] | 1027 | * @see rtems_filesystem_iterate(). |
---|
| 1028 | * |
---|
| 1029 | * @retval true Continue the iteration. |
---|
| 1030 | * @retval false Stop the iteration. |
---|
[29e92b0] | 1031 | */ |
---|
[7d01d244] | 1032 | typedef bool (*rtems_per_filesystem_routine)( |
---|
| 1033 | const rtems_filesystem_table_t *entry, |
---|
| 1034 | void *arg |
---|
| 1035 | ); |
---|
[29e92b0] | 1036 | |
---|
[7d01d244] | 1037 | /** |
---|
| 1038 | * @brief Iterates over the file system table. |
---|
| 1039 | * |
---|
| 1040 | * For each file system table entry the @a routine will be called with the |
---|
| 1041 | * table entry and the @a routine_arg parameter. |
---|
| 1042 | */ |
---|
| 1043 | void |
---|
| 1044 | rtems_filesystem_iterate( |
---|
| 1045 | rtems_per_filesystem_routine routine, |
---|
| 1046 | void *routine_arg |
---|
| 1047 | ); |
---|
| 1048 | |
---|
| 1049 | /** |
---|
[9da9cf4a] | 1050 | * @brief Gets the mount handler for the file system @a type. |
---|
| 1051 | * |
---|
| 1052 | * @return The file system mount handler associated with the @a type, or |
---|
[7d01d244] | 1053 | * @c NULL if no such association exists. |
---|
[29e92b0] | 1054 | */ |
---|
[7d01d244] | 1055 | rtems_filesystem_fsmount_me_t |
---|
| 1056 | rtems_filesystem_get_mount_handler( |
---|
| 1057 | const char *type |
---|
| 1058 | ); |
---|
[29e92b0] | 1059 | |
---|
| 1060 | /* |
---|
| 1061 | * Get the first entry in the mount table. |
---|
| 1062 | */ |
---|
| 1063 | rtems_filesystem_mount_table_entry_t* |
---|
| 1064 | rtems_filesystem_mounts_first( void ); |
---|
| 1065 | |
---|
| 1066 | /* |
---|
| 1067 | * Get the next entry in the mount table. |
---|
| 1068 | */ |
---|
| 1069 | rtems_filesystem_mount_table_entry_t* |
---|
| 1070 | rtems_filesystem_mounts_next( rtems_filesystem_mount_table_entry_t *entry ); |
---|
| 1071 | |
---|
| 1072 | /* |
---|
| 1073 | * Register a file system. |
---|
| 1074 | */ |
---|
| 1075 | int |
---|
| 1076 | rtems_filesystem_register( |
---|
| 1077 | const char *type, |
---|
| 1078 | rtems_filesystem_fsmount_me_t mount_h |
---|
| 1079 | ); |
---|
| 1080 | |
---|
| 1081 | /* |
---|
| 1082 | * Unregister a file system. |
---|
| 1083 | */ |
---|
| 1084 | int |
---|
| 1085 | rtems_filesystem_unregister( |
---|
| 1086 | const char *type |
---|
| 1087 | ); |
---|
| 1088 | |
---|
[9da9cf4a] | 1089 | /** |
---|
| 1090 | * @brief Contain file system specific information which is required to support |
---|
| 1091 | * fpathconf(). |
---|
[b06e68ef] | 1092 | */ |
---|
| 1093 | typedef struct { |
---|
[29e92b0] | 1094 | int link_max; /* count */ |
---|
| 1095 | int max_canon; /* max formatted input line size */ |
---|
| 1096 | int max_input; /* max input line size */ |
---|
| 1097 | int name_max; /* max name length */ |
---|
| 1098 | int path_max; /* max path */ |
---|
| 1099 | int pipe_buf; /* pipe buffer size */ |
---|
| 1100 | int posix_async_io; /* async IO supported on fs, 0=no, 1=yes */ |
---|
| 1101 | int posix_chown_restrictions; /* can chown: 0=no, 1=yes */ |
---|
| 1102 | int posix_no_trunc; /* error on names > max name, 0=no, 1=yes */ |
---|
| 1103 | int posix_prio_io; /* priority IO, 0=no, 1=yes */ |
---|
| 1104 | int posix_sync_io; /* file can be sync'ed, 0=no, 1=yes */ |
---|
| 1105 | int posix_vdisable; /* special char processing, 0=no, 1=yes */ |
---|
[07a3253d] | 1106 | } rtems_filesystem_limits_and_options_t; |
---|
| 1107 | |
---|
[9da9cf4a] | 1108 | /** |
---|
| 1109 | * @brief Default pathconf settings. |
---|
| 1110 | * |
---|
| 1111 | * Override in a filesystem. |
---|
[29e92b0] | 1112 | */ |
---|
| 1113 | extern const rtems_filesystem_limits_and_options_t rtems_filesystem_default_pathconf; |
---|
| 1114 | |
---|
[9da9cf4a] | 1115 | /** |
---|
| 1116 | * @brief Mount table entry. |
---|
[07a3253d] | 1117 | */ |
---|
[657e1bf6] | 1118 | struct rtems_filesystem_mount_table_entry_tt { |
---|
[72d2ec4d] | 1119 | rtems_chain_node Node; |
---|
[07a3253d] | 1120 | rtems_filesystem_location_info_t mt_point_node; |
---|
| 1121 | rtems_filesystem_location_info_t mt_fs_root; |
---|
| 1122 | int options; |
---|
| 1123 | void *fs_info; |
---|
| 1124 | |
---|
| 1125 | rtems_filesystem_limits_and_options_t pathconf_limits_and_options; |
---|
[b06e68ef] | 1126 | |
---|
[29e92b0] | 1127 | /* |
---|
| 1128 | * The target or mount point of the file system. |
---|
| 1129 | */ |
---|
| 1130 | const char *target; |
---|
| 1131 | |
---|
| 1132 | /* |
---|
| 1133 | * The type of filesystem or the name of the filesystem. |
---|
| 1134 | */ |
---|
| 1135 | const char *type; |
---|
| 1136 | |
---|
[07a3253d] | 1137 | /* |
---|
| 1138 | * When someone adds a mounted filesystem on a real device, |
---|
| 1139 | * this will need to be used. |
---|
| 1140 | * |
---|
[7baa484] | 1141 | * The lower layers can manage how this is managed. Leave as a |
---|
| 1142 | * string. |
---|
[07a3253d] | 1143 | */ |
---|
| 1144 | char *dev; |
---|
| 1145 | }; |
---|
[b06e68ef] | 1146 | |
---|
[29e92b0] | 1147 | /** |
---|
[9da9cf4a] | 1148 | * @brief The pathconf setting for a file system. |
---|
[29e92b0] | 1149 | */ |
---|
| 1150 | #define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options) |
---|
| 1151 | |
---|
| 1152 | /** |
---|
[9da9cf4a] | 1153 | * @brief The type of file system. Its name. |
---|
[29e92b0] | 1154 | */ |
---|
| 1155 | #define rtems_filesystem_type(_mte) ((_mte)->type) |
---|
| 1156 | |
---|
| 1157 | /** |
---|
[9da9cf4a] | 1158 | * @brief The mount point of a file system. |
---|
[29e92b0] | 1159 | */ |
---|
| 1160 | #define rtems_filesystem_mount_point(_mte) ((_mte)->target) |
---|
| 1161 | |
---|
| 1162 | /** |
---|
[9da9cf4a] | 1163 | * @brief The device entry of a file system. |
---|
[29e92b0] | 1164 | */ |
---|
| 1165 | #define rtems_filesystem_mount_device(_mte) ((_mte)->dev) |
---|
| 1166 | |
---|
[9da9cf4a] | 1167 | /** |
---|
| 1168 | * @brief File systems options. |
---|
[07a3253d] | 1169 | */ |
---|
[aa61d53] | 1170 | typedef enum { |
---|
[07a3253d] | 1171 | RTEMS_FILESYSTEM_READ_ONLY, |
---|
[4ecc390] | 1172 | RTEMS_FILESYSTEM_READ_WRITE, |
---|
[07a3253d] | 1173 | RTEMS_FILESYSTEM_BAD_OPTIONS |
---|
| 1174 | } rtems_filesystem_options_t; |
---|
| 1175 | |
---|
[9da9cf4a] | 1176 | /** |
---|
| 1177 | * @brief An open file data structure. |
---|
| 1178 | * |
---|
| 1179 | * It will be indexed by 'fd'. |
---|
| 1180 | * |
---|
| 1181 | * @todo Should really have a separate per/file data structure that this points |
---|
| 1182 | * to (eg: size, offset, driver, pathname should be in that) |
---|
[07a3253d] | 1183 | */ |
---|
| 1184 | struct rtems_libio_tt { |
---|
[aa61d53] | 1185 | rtems_driver_name_t *driver; |
---|
| 1186 | rtems_off64_t size; /* size of file */ |
---|
| 1187 | rtems_off64_t offset; /* current offset into file */ |
---|
| 1188 | uint32_t flags; |
---|
| 1189 | rtems_filesystem_location_info_t pathinfo; |
---|
| 1190 | rtems_id sem; |
---|
| 1191 | uint32_t data0; /* private to "driver" */ |
---|
| 1192 | void *data1; /* ... */ |
---|
| 1193 | void *file_info; /* used by file handlers */ |
---|
| 1194 | const rtems_filesystem_file_handlers_r *handlers; /* type specific handlers */ |
---|
[07a3253d] | 1195 | }; |
---|
| 1196 | |
---|
[9da9cf4a] | 1197 | /** |
---|
| 1198 | * @brief Paramameter block for read/write. |
---|
| 1199 | * |
---|
| 1200 | * It must include 'offset' instead of using iop's offset since we can have |
---|
| 1201 | * multiple outstanding i/o's on a device. |
---|
[b06e68ef] | 1202 | */ |
---|
| 1203 | typedef struct { |
---|
[aa61d53] | 1204 | rtems_libio_t *iop; |
---|
| 1205 | rtems_off64_t offset; |
---|
| 1206 | char *buffer; |
---|
| 1207 | uint32_t count; |
---|
| 1208 | uint32_t flags; |
---|
| 1209 | uint32_t bytes_moved; |
---|
[b06e68ef] | 1210 | } rtems_libio_rw_args_t; |
---|
| 1211 | |
---|
[9da9cf4a] | 1212 | /** |
---|
| 1213 | * @brief Parameter block for open/close. |
---|
[b06e68ef] | 1214 | */ |
---|
| 1215 | typedef struct { |
---|
[aa61d53] | 1216 | rtems_libio_t *iop; |
---|
| 1217 | uint32_t flags; |
---|
| 1218 | uint32_t mode; |
---|
[b06e68ef] | 1219 | } rtems_libio_open_close_args_t; |
---|
| 1220 | |
---|
[9da9cf4a] | 1221 | /** |
---|
| 1222 | * @brief Parameter block for ioctl. |
---|
[b06e68ef] | 1223 | */ |
---|
| 1224 | typedef struct { |
---|
[aa61d53] | 1225 | rtems_libio_t *iop; |
---|
| 1226 | uint32_t command; |
---|
| 1227 | void *buffer; |
---|
| 1228 | uint32_t ioctl_return; |
---|
[b06e68ef] | 1229 | } rtems_libio_ioctl_args_t; |
---|
| 1230 | |
---|
[9da9cf4a] | 1231 | /** |
---|
| 1232 | * @name Flag Values |
---|
| 1233 | * |
---|
| 1234 | * @{ |
---|
[b06e68ef] | 1235 | */ |
---|
[9da9cf4a] | 1236 | |
---|
[b06e68ef] | 1237 | #define LIBIO_FLAGS_NO_DELAY 0x0001 /* return immediately if no data */ |
---|
| 1238 | #define LIBIO_FLAGS_READ 0x0002 /* reading */ |
---|
| 1239 | #define LIBIO_FLAGS_WRITE 0x0004 /* writing */ |
---|
| 1240 | #define LIBIO_FLAGS_OPEN 0x0100 /* device is open */ |
---|
| 1241 | #define LIBIO_FLAGS_APPEND 0x0200 /* all writes append */ |
---|
| 1242 | #define LIBIO_FLAGS_CREATE 0x0400 /* create file */ |
---|
[07a3253d] | 1243 | #define LIBIO_FLAGS_CLOSE_ON_EXEC 0x0800 /* close on process exec() */ |
---|
[b06e68ef] | 1244 | #define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE) |
---|
| 1245 | |
---|
[9da9cf4a] | 1246 | /** @} */ |
---|
| 1247 | |
---|
[07a3253d] | 1248 | void rtems_libio_init(void); |
---|
[b06e68ef] | 1249 | |
---|
[9da9cf4a] | 1250 | /** |
---|
| 1251 | * @name External I/O Handlers |
---|
| 1252 | * |
---|
| 1253 | * @{ |
---|
[e2d79559] | 1254 | */ |
---|
[07a3253d] | 1255 | |
---|
| 1256 | typedef int (*rtems_libio_open_t)( |
---|
| 1257 | const char *pathname, |
---|
[83c5fc1] | 1258 | uint32_t flag, |
---|
| 1259 | uint32_t mode |
---|
[07a3253d] | 1260 | ); |
---|
| 1261 | |
---|
| 1262 | typedef int (*rtems_libio_close_t)( |
---|
| 1263 | int fd |
---|
| 1264 | ); |
---|
| 1265 | |
---|
| 1266 | typedef int (*rtems_libio_read_t)( |
---|
| 1267 | int fd, |
---|
| 1268 | void *buffer, |
---|
[83c5fc1] | 1269 | uint32_t count |
---|
[07a3253d] | 1270 | ); |
---|
| 1271 | |
---|
| 1272 | typedef int (*rtems_libio_write_t)( |
---|
| 1273 | int fd, |
---|
| 1274 | const void *buffer, |
---|
[83c5fc1] | 1275 | uint32_t count |
---|
[07a3253d] | 1276 | ); |
---|
| 1277 | |
---|
| 1278 | typedef int (*rtems_libio_ioctl_t)( |
---|
| 1279 | int fd, |
---|
[83c5fc1] | 1280 | uint32_t command, |
---|
[07a3253d] | 1281 | void *buffer |
---|
| 1282 | ); |
---|
| 1283 | |
---|
[07d6fd5] | 1284 | typedef rtems_off64_t (*rtems_libio_lseek_t)( |
---|
| 1285 | int fd, |
---|
| 1286 | rtems_off64_t offset, |
---|
| 1287 | int whence |
---|
[07a3253d] | 1288 | ); |
---|
| 1289 | |
---|
[9da9cf4a] | 1290 | /** @} */ |
---|
| 1291 | |
---|
| 1292 | /** |
---|
| 1293 | * @name Permission Macros |
---|
| 1294 | * |
---|
| 1295 | * @{ |
---|
| 1296 | */ |
---|
| 1297 | |
---|
[07a3253d] | 1298 | /* |
---|
| 1299 | * The following macros are used to build up the permissions sets |
---|
| 1300 | * used to check permissions. These are similar in style to the |
---|
| 1301 | * mode_t bits and should stay compatible with them. |
---|
| 1302 | */ |
---|
| 1303 | #define RTEMS_LIBIO_PERMS_READ S_IROTH |
---|
| 1304 | #define RTEMS_LIBIO_PERMS_WRITE S_IWOTH |
---|
| 1305 | #define RTEMS_LIBIO_PERMS_RDWR (S_IROTH|S_IWOTH) |
---|
| 1306 | #define RTEMS_LIBIO_PERMS_EXEC S_IXOTH |
---|
| 1307 | #define RTEMS_LIBIO_PERMS_SEARCH RTEMS_LIBIO_PERMS_EXEC |
---|
| 1308 | #define RTEMS_LIBIO_PERMS_RWX S_IRWXO |
---|
| 1309 | |
---|
[9da9cf4a] | 1310 | /** @} */ |
---|
[7e476f0] | 1311 | |
---|
[0b178f04] | 1312 | union __rtems_dev_t { |
---|
[7e476f0] | 1313 | dev_t device; |
---|
| 1314 | struct { |
---|
| 1315 | rtems_device_major_number major; |
---|
| 1316 | rtems_device_minor_number minor; |
---|
| 1317 | } __overlay; |
---|
| 1318 | }; |
---|
| 1319 | |
---|
[50f32b11] | 1320 | static inline dev_t rtems_filesystem_make_dev_t( |
---|
| 1321 | rtems_device_major_number _major, |
---|
[7e476f0] | 1322 | rtems_device_minor_number _minor |
---|
| 1323 | ) |
---|
| 1324 | { |
---|
[0b178f04] | 1325 | union __rtems_dev_t temp; |
---|
[7e476f0] | 1326 | |
---|
| 1327 | temp.__overlay.major = _major; |
---|
| 1328 | temp.__overlay.minor = _minor; |
---|
| 1329 | return temp.device; |
---|
| 1330 | } |
---|
| 1331 | |
---|
| 1332 | static inline rtems_device_major_number rtems_filesystem_dev_major_t( |
---|
| 1333 | dev_t device |
---|
| 1334 | ) |
---|
| 1335 | { |
---|
[0b178f04] | 1336 | union __rtems_dev_t temp; |
---|
[7e476f0] | 1337 | |
---|
| 1338 | temp.device = device; |
---|
| 1339 | return temp.__overlay.major; |
---|
| 1340 | } |
---|
| 1341 | |
---|
| 1342 | |
---|
| 1343 | static inline rtems_device_minor_number rtems_filesystem_dev_minor_t( |
---|
| 1344 | dev_t device |
---|
| 1345 | ) |
---|
| 1346 | { |
---|
[0b178f04] | 1347 | union __rtems_dev_t temp; |
---|
[7e476f0] | 1348 | |
---|
| 1349 | temp.device = device; |
---|
| 1350 | return temp.__overlay.minor; |
---|
| 1351 | } |
---|
| 1352 | |
---|
[07a3253d] | 1353 | #define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \ |
---|
| 1354 | do { \ |
---|
[dd19c0b] | 1355 | (_major) = rtems_filesystem_dev_major_t ( _dev ); \ |
---|
| 1356 | (_minor) = rtems_filesystem_dev_minor_t( _dev ); \ |
---|
[07a3253d] | 1357 | } while(0) |
---|
| 1358 | |
---|
| 1359 | /* |
---|
| 1360 | * Verifies that the permission flag is valid. |
---|
| 1361 | */ |
---|
| 1362 | #define rtems_libio_is_valid_perms( _perm ) \ |
---|
| 1363 | (~ ((~RTEMS_LIBIO_PERMS_RWX) & _perm )) |
---|
| 1364 | |
---|
[14fc3a77] | 1365 | /** |
---|
| 1366 | * @name File System Types |
---|
| 1367 | * |
---|
| 1368 | * @{ |
---|
| 1369 | */ |
---|
| 1370 | |
---|
| 1371 | #define RTEMS_FILESYSTEM_TYPE_IMFS "imfs" |
---|
| 1372 | #define RTEMS_FILESYSTEM_TYPE_MINIIMFS "mimfs" |
---|
| 1373 | #define RTEMS_FILESYSTEM_TYPE_DEVFS "devfs" |
---|
| 1374 | #define RTEMS_FILESYSTEM_TYPE_FTPFS "ftpfs" |
---|
| 1375 | #define RTEMS_FILESYSTEM_TYPE_TFTPFS "tftpfs" |
---|
| 1376 | #define RTEMS_FILESYSTEM_TYPE_NFS "nfs" |
---|
| 1377 | #define RTEMS_FILESYSTEM_TYPE_DOSFS "dosfs" |
---|
| 1378 | #define RTEMS_FILESYSTEM_TYPE_RFS "rfs" |
---|
| 1379 | |
---|
| 1380 | /** @} */ |
---|
| 1381 | |
---|
[07a3253d] | 1382 | /* |
---|
| 1383 | * Prototypes for filesystem |
---|
| 1384 | */ |
---|
| 1385 | |
---|
| 1386 | void rtems_filesystem_initialize( void ); |
---|
| 1387 | |
---|
[9da9cf4a] | 1388 | int unmount( |
---|
| 1389 | const char *mount_path |
---|
| 1390 | ); |
---|
| 1391 | |
---|
| 1392 | int mount( |
---|
| 1393 | const char *source, |
---|
| 1394 | const char *target, |
---|
| 1395 | const char *filesystemtype, |
---|
| 1396 | rtems_filesystem_options_t options, |
---|
| 1397 | const void *data |
---|
| 1398 | ); |
---|
| 1399 | |
---|
[b813d632] | 1400 | /** |
---|
| 1401 | * @brief Mounts a file system and makes the @a target path. |
---|
| 1402 | * |
---|
| 1403 | * The @a target path will be created with rtems_mkdir() and must not be |
---|
| 1404 | * @c NULL. |
---|
| 1405 | * |
---|
| 1406 | * @see mount(). |
---|
| 1407 | * |
---|
| 1408 | * @retval 0 Successful operation. |
---|
| 1409 | * @retval -1 An error occured. The @c errno indicates the error. |
---|
| 1410 | */ |
---|
| 1411 | int mount_and_make_target_path( |
---|
| 1412 | const char *source, |
---|
| 1413 | const char *target, |
---|
| 1414 | const char *filesystemtype, |
---|
| 1415 | rtems_filesystem_options_t options, |
---|
| 1416 | const void *data |
---|
| 1417 | ); |
---|
| 1418 | |
---|
[ae35953d] | 1419 | /* |
---|
[9da9cf4a] | 1420 | * Boot Time Mount Table Structure |
---|
| 1421 | */ |
---|
| 1422 | |
---|
| 1423 | typedef struct { |
---|
| 1424 | const char *type; |
---|
| 1425 | rtems_filesystem_options_t fsoptions; |
---|
| 1426 | const char *device; |
---|
| 1427 | const char *mount_point; |
---|
| 1428 | } rtems_filesystem_mount_table_t; |
---|
| 1429 | |
---|
| 1430 | extern const rtems_filesystem_mount_table_t *rtems_filesystem_mount_table; |
---|
| 1431 | extern const int rtems_filesystem_mount_table_size; |
---|
| 1432 | |
---|
| 1433 | typedef void (*rtems_libio_init_functions_t)(void); |
---|
| 1434 | extern rtems_libio_init_functions_t rtems_libio_init_helper; |
---|
| 1435 | |
---|
| 1436 | void open_dev_console(void); |
---|
| 1437 | |
---|
| 1438 | typedef void (*rtems_libio_supp_functions_t)(void); |
---|
| 1439 | extern rtems_libio_supp_functions_t rtems_libio_supp_helper; |
---|
| 1440 | |
---|
| 1441 | typedef void (*rtems_fs_init_functions_t)(void); |
---|
| 1442 | extern rtems_fs_init_functions_t rtems_fs_init_helper; |
---|
| 1443 | |
---|
| 1444 | /** |
---|
[d5b5a06] | 1445 | * @brief Creates a directory and all its parent directories according to |
---|
[9da9cf4a] | 1446 | * @a path. |
---|
| 1447 | * |
---|
| 1448 | * The @a mode value selects the access permissions of the directory. |
---|
| 1449 | * |
---|
| 1450 | * @retval 0 Successful operation. |
---|
[b813d632] | 1451 | * @retval -1 An error occured. The @c errno indicates the error. |
---|
[9da9cf4a] | 1452 | */ |
---|
| 1453 | extern int rtems_mkdir(const char *path, mode_t mode); |
---|
| 1454 | |
---|
| 1455 | /** @} */ |
---|
| 1456 | |
---|
| 1457 | /** |
---|
| 1458 | * @defgroup Termios Termios |
---|
| 1459 | * |
---|
| 1460 | * @ingroup LibIO |
---|
| 1461 | * |
---|
| 1462 | * @brief Termios |
---|
| 1463 | * |
---|
| 1464 | * @{ |
---|
[161e1b3f] | 1465 | */ |
---|
[07a3253d] | 1466 | |
---|
[161e1b3f] | 1467 | typedef struct rtems_termios_callbacks { |
---|
[07a3253d] | 1468 | int (*firstOpen)(int major, int minor, void *arg); |
---|
| 1469 | int (*lastClose)(int major, int minor, void *arg); |
---|
| 1470 | int (*pollRead)(int minor); |
---|
[b2cc165] | 1471 | ssize_t (*write)(int minor, const char *buf, size_t len); |
---|
[07a3253d] | 1472 | int (*setAttributes)(int minor, const struct termios *t); |
---|
| 1473 | int (*stopRemoteTx)(int minor); |
---|
| 1474 | int (*startRemoteTx)(int minor); |
---|
| 1475 | int outputUsesInterrupts; |
---|
[161e1b3f] | 1476 | } rtems_termios_callbacks; |
---|
| 1477 | |
---|
[ae35953d] | 1478 | void rtems_termios_initialize (void); |
---|
[07a3253d] | 1479 | |
---|
[1f5d2ba] | 1480 | /* |
---|
| 1481 | * CCJ: Change before opening a tty. Newer code from Eric is coming |
---|
| 1482 | * so extra work to handle an open tty is not worth it. If the tty |
---|
| 1483 | * is open, close then open it again. |
---|
| 1484 | */ |
---|
| 1485 | rtems_status_code rtems_termios_bufsize ( |
---|
| 1486 | int cbufsize, /* cooked buffer size */ |
---|
| 1487 | int raw_input, /* raw input buffer size */ |
---|
| 1488 | int raw_output /* raw output buffer size */ |
---|
| 1489 | ); |
---|
| 1490 | |
---|
[ae35953d] | 1491 | rtems_status_code rtems_termios_open ( |
---|
[161e1b3f] | 1492 | rtems_device_major_number major, |
---|
| 1493 | rtems_device_minor_number minor, |
---|
| 1494 | void *arg, |
---|
| 1495 | const rtems_termios_callbacks *callbacks |
---|
[07a3253d] | 1496 | ); |
---|
| 1497 | |
---|
| 1498 | rtems_status_code rtems_termios_close( |
---|
| 1499 | void *arg |
---|
| 1500 | ); |
---|
| 1501 | |
---|
| 1502 | rtems_status_code rtems_termios_read( |
---|
| 1503 | void *arg |
---|
| 1504 | ); |
---|
| 1505 | |
---|
| 1506 | rtems_status_code rtems_termios_write( |
---|
| 1507 | void *arg |
---|
| 1508 | ); |
---|
| 1509 | |
---|
| 1510 | rtems_status_code rtems_termios_ioctl( |
---|
| 1511 | void *arg |
---|
| 1512 | ); |
---|
| 1513 | |
---|
| 1514 | int rtems_termios_enqueue_raw_characters( |
---|
| 1515 | void *ttyp, |
---|
| 1516 | char *buf, |
---|
| 1517 | int len |
---|
| 1518 | ); |
---|
| 1519 | |
---|
| 1520 | int rtems_termios_dequeue_characters( |
---|
| 1521 | void *ttyp, |
---|
| 1522 | int len |
---|
| 1523 | ); |
---|
| 1524 | |
---|
[9da9cf4a] | 1525 | /** @} */ |
---|
[eaee27b] | 1526 | |
---|
[80c2966] | 1527 | #ifdef __cplusplus |
---|
| 1528 | } |
---|
| 1529 | #endif |
---|
| 1530 | |
---|
[b06e68ef] | 1531 | #endif /* _RTEMS_LIBIO_H */ |
---|