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