forked from Imagelibrary/rtems
2008-09-17 Miao Yan <yanmiaobest@gmail.com>
* Makefile.am, preinstall.am, libcsupport/Makefile.am, libcsupport/include/rtems/libcsupport.h, libcsupport/include/rtems/libio.h, libcsupport/src/base_fs.c, libcsupport/src/libio_init.c, libcsupport/src/newlibc_exit.c, libcsupport/src/newlibc_init.c, libcsupport/src/sync.c, libfs/Makefile.am, libfs/src/imfs/deviceio.c, sapi/include/confdefs.h: Merge GSOC project code to add simple device only filesystem (devfs), optionally completely drop out filesystem, and to clean up disabling newlib reentrancy support. This dropped 17K from the minimum.exe for sparc/sis and arm/rtl22xx_t now has a 15K code space. * libcsupport/src/__usrenv.c, libcsupport/src/newlibc_reent.c, libfs/src/devfs/devclose.c, libfs/src/devfs/devfs.h, libfs/src/devfs/devfs_eval.c, libfs/src/devfs/devfs_init.c, libfs/src/devfs/devfs_mknod.c, libfs/src/devfs/devfs_node_type.c, libfs/src/devfs/devfs_show.c, libfs/src/devfs/devioctl.c, libfs/src/devfs/devopen.c, libfs/src/devfs/devread.c, libfs/src/devfs/devstat.c, libfs/src/devfs/devwrite.c, libfs/src/imfs/deviceerrno.c: New files. * libcsupport/src/newlibc.c: Removed.
This commit is contained in:
87
cpukit/libfs/src/devfs/devfs_init.c
Normal file
87
cpukit/libfs/src/devfs/devfs_init.c
Normal file
@@ -0,0 +1,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user