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