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