source: rtems/cpukit/libfs/src/devfs/devfs_init.c @ a7d1992c

Last change on this file since a7d1992c was da154e14, checked in by Sebastian Huber <sebastian.huber@…>, on 05/14/12 at 14:55:41

Filesystem: Move operations to mount table entry

The scope of the file system operations is the file system instance.
The scope of the file system node handlers is the file location. The
benefit of moving the operations to the mount table entry is a size
reduction of the file location (rtems_filesystem_location_info_t). The
code size is slightly increased due to additional load instructions.

Restructure rtems_filesystem_mount_table_entry_t to improve cache
efficiency.

  • Property mode set to 100644
File size: 2.0 KB
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
7#if HAVE_CONFIG_H
8  #include "config.h"
9#endif
10
11#include "devfs.h"
12
13const rtems_filesystem_operations_table devFS_ops = {
14  .lock_h = rtems_filesystem_default_lock,
15  .unlock_h = rtems_filesystem_default_unlock,
16  .eval_path_h = devFS_eval_path,
17  .link_h = rtems_filesystem_default_link,
18  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
19  .node_type_h = devFS_node_type,
20  .mknod_h = devFS_mknod,
21  .rmnod_h = rtems_filesystem_default_rmnod,
22  .fchmod_h = rtems_filesystem_default_fchmod,
23  .chown_h = rtems_filesystem_default_chown,
24  .clonenod_h = rtems_filesystem_default_clonenode,
25  .freenod_h = rtems_filesystem_default_freenode,
26  .mount_h = rtems_filesystem_default_mount,
27  .fsmount_me_h = devFS_initialize,
28  .unmount_h = rtems_filesystem_default_unmount,
29  .fsunmount_me_h = rtems_filesystem_default_fsunmount,
30  .utime_h = rtems_filesystem_default_utime,
31  .symlink_h = rtems_filesystem_default_symlink,
32  .readlink_h = rtems_filesystem_default_readlink,
33  .rename_h = rtems_filesystem_default_rename,
34  .statvfs_h = rtems_filesystem_default_statvfs
35};
36
37const rtems_filesystem_file_handlers_r devFS_file_handlers = {
38  .open_h = devFS_open,
39  .close_h = devFS_close,
40  .read_h = devFS_read,
41  .write_h = devFS_write,
42  .ioctl_h = devFS_ioctl,
43  .lseek_h = rtems_filesystem_default_lseek_file,
44  .fstat_h = devFS_stat,
45  .ftruncate_h = rtems_filesystem_default_ftruncate,
46  .fsync_h = rtems_filesystem_default_fsync_or_fdatasync,
47  .fdatasync_h = rtems_filesystem_default_fsync_or_fdatasync,
48  .fcntl_h = rtems_filesystem_default_fcntl
49};
50
51int devFS_initialize(
52  rtems_filesystem_mount_table_entry_t *mt_entry,
53  const void *data
54)
55{
56  int rv = 0;
57
58  if (data != NULL) {
59    mt_entry->ops = &devFS_ops;
60    mt_entry->immutable_fs_info = data;
61    mt_entry->mt_fs_root->location.handlers = &devFS_file_handlers;
62  } else {
63    errno = EINVAL;
64    rv = -1;
65  }
66
67  return rv;
68}
69
Note: See TracBrowser for help on using the repository browser.