4.104.115
Line | |
---|
1 | /* |
---|
2 | * The license and distribution terms for this file may be |
---|
3 | * found in the file LICENSE in this distribution or at |
---|
4 | * http://www.rtems.com/license/LICENSE. |
---|
5 | * |
---|
6 | * $Id$ |
---|
7 | */ |
---|
8 | |
---|
9 | #if HAVE_CONFIG_H |
---|
10 | #include "config.h" |
---|
11 | #endif |
---|
12 | |
---|
13 | #include <stdlib.h> |
---|
14 | #include <rtems.h> |
---|
15 | #include <rtems/seterr.h> |
---|
16 | #include <rtems/score/wkspace.h> |
---|
17 | #include "devfs.h" |
---|
18 | |
---|
19 | rtems_filesystem_operations_table devFS_ops = |
---|
20 | { |
---|
21 | devFS_evaluate_path, |
---|
22 | devFS_evaluate_for_make, |
---|
23 | NULL, |
---|
24 | NULL, |
---|
25 | devFS_node_type, |
---|
26 | devFS_mknod, |
---|
27 | NULL, |
---|
28 | NULL, |
---|
29 | NULL, |
---|
30 | devFS_initialize, |
---|
31 | NULL, |
---|
32 | NULL, |
---|
33 | NULL, |
---|
34 | NULL, |
---|
35 | NULL, |
---|
36 | NULL, |
---|
37 | NULL |
---|
38 | }; |
---|
39 | |
---|
40 | |
---|
41 | rtems_filesystem_file_handlers_r devFS_file_handlers = |
---|
42 | { |
---|
43 | devFS_open, |
---|
44 | devFS_close, |
---|
45 | devFS_read, |
---|
46 | devFS_write, |
---|
47 | devFS_ioctl, |
---|
48 | NULL, |
---|
49 | devFS_stat, |
---|
50 | NULL, |
---|
51 | NULL, |
---|
52 | NULL, |
---|
53 | NULL, |
---|
54 | NULL, |
---|
55 | NULL, |
---|
56 | NULL |
---|
57 | }; |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | int devFS_initialize( |
---|
62 | rtems_filesystem_mount_table_entry_t *temp_mt_entry |
---|
63 | ) |
---|
64 | { |
---|
65 | rtems_device_name_t *device_name_table; |
---|
66 | |
---|
67 | /* allocate device only filesystem name table */ |
---|
68 | device_name_table = (rtems_device_name_t *)_Workspace_Allocate( |
---|
69 | sizeof( rtems_device_name_t ) * ( rtems_device_table_size ) |
---|
70 | ); |
---|
71 | |
---|
72 | /* no memory for device filesystem */ |
---|
73 | if (!device_name_table) |
---|
74 | rtems_set_errno_and_return_minus_one( ENOMEM ); |
---|
75 | |
---|
76 | memset( |
---|
77 | device_name_table, 0, |
---|
78 | sizeof( rtems_device_name_t ) * ( rtems_device_table_size ) |
---|
79 | ); |
---|
80 | |
---|
81 | /* set file handlers */ |
---|
82 | temp_mt_entry->mt_fs_root.handlers = &devFS_file_handlers; |
---|
83 | temp_mt_entry->mt_fs_root.ops = &devFS_ops; |
---|
84 | |
---|
85 | /* Set the node_access to device name table */ |
---|
86 | temp_mt_entry->mt_fs_root.node_access = (void *)device_name_table; |
---|
87 | |
---|
88 | return 0; |
---|
89 | } |
---|
90 | |
---|
Note: See
TracBrowser
for help on using the repository browser.