[7999174] | 1 | /* |
---|
| 2 | * Memfile Operations Tables for the IMFS |
---|
| 3 | * |
---|
[08311cc3] | 4 | * COPYRIGHT (c) 1989-1999. |
---|
[7999174] | 5 | * On-Line Applications Research Corporation (OAR). |
---|
| 6 | * |
---|
| 7 | * The license and distribution terms for this file may be |
---|
| 8 | * found in the file LICENSE in this distribution or at |
---|
[cf0539b1] | 9 | * http://www.rtems.com/license/LICENSE. |
---|
[7999174] | 10 | */ |
---|
| 11 | |
---|
[d6b1d73] | 12 | #if HAVE_CONFIG_H |
---|
[3b7c123] | 13 | #include "config.h" |
---|
[d6b1d73] | 14 | #endif |
---|
| 15 | |
---|
[7999174] | 16 | #include "imfs.h" |
---|
| 17 | |
---|
[e998c985] | 18 | static int IMFS_stat_file( |
---|
| 19 | const rtems_filesystem_location_info_t *loc, |
---|
| 20 | struct stat *buf |
---|
| 21 | ) |
---|
| 22 | { |
---|
| 23 | const IMFS_jnode_t *node = loc->node_access; |
---|
| 24 | |
---|
| 25 | buf->st_size = node->info.file.size; |
---|
| 26 | buf->st_blksize = imfs_rq_memfile_bytes_per_block; |
---|
| 27 | |
---|
| 28 | return IMFS_stat( loc, buf ); |
---|
| 29 | } |
---|
| 30 | |
---|
[699ac7c] | 31 | static const rtems_filesystem_file_handlers_r IMFS_memfile_handlers = { |
---|
[7999174] | 32 | memfile_open, |
---|
[1bdff036] | 33 | rtems_filesystem_default_close, |
---|
[7999174] | 34 | memfile_read, |
---|
| 35 | memfile_write, |
---|
| 36 | memfile_ioctl, |
---|
[30d4124] | 37 | rtems_filesystem_default_lseek_file, |
---|
[e998c985] | 38 | IMFS_stat_file, |
---|
[7999174] | 39 | memfile_ftruncate, |
---|
[4116fce6] | 40 | rtems_filesystem_default_fsync_or_fdatasync_success, |
---|
| 41 | rtems_filesystem_default_fsync_or_fdatasync_success, |
---|
[3b7c123] | 42 | rtems_filesystem_default_fcntl |
---|
[7999174] | 43 | }; |
---|
[699ac7c] | 44 | |
---|
| 45 | const IMFS_node_control IMFS_node_control_memfile = { |
---|
| 46 | .imfs_type = IMFS_MEMORY_FILE, |
---|
| 47 | .handlers = &IMFS_memfile_handlers, |
---|
| 48 | .node_initialize = IMFS_node_initialize_default, |
---|
| 49 | .node_remove = IMFS_node_remove_default, |
---|
| 50 | .node_destroy = IMFS_memfile_remove |
---|
| 51 | }; |
---|
| 52 | |
---|
| 53 | const IMFS_node_control IMFS_node_control_linfile = { |
---|
| 54 | .imfs_type = IMFS_LINEAR_FILE, |
---|
| 55 | .handlers = &IMFS_memfile_handlers, |
---|
| 56 | .node_initialize = IMFS_node_initialize_default, |
---|
| 57 | .node_remove = IMFS_node_remove_default, |
---|
| 58 | .node_destroy = IMFS_node_destroy_default |
---|
| 59 | }; |
---|