[9bff3752] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @brief Creates the Main Device Table |
---|
| 5 | * @ingroup DevFsDeviceTable Define Device Table Type |
---|
| 6 | */ |
---|
| 7 | |
---|
[d40da79b] | 8 | /* |
---|
| 9 | * The license and distribution terms for this file may be |
---|
| 10 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 11 | * http://www.rtems.org/license/LICENSE. |
---|
[d40da79b] | 12 | */ |
---|
| 13 | |
---|
| 14 | #if HAVE_CONFIG_H |
---|
[3b7c123] | 15 | #include "config.h" |
---|
[d40da79b] | 16 | #endif |
---|
| 17 | |
---|
| 18 | #include "devfs.h" |
---|
| 19 | |
---|
[3b7c123] | 20 | const rtems_filesystem_operations_table devFS_ops = { |
---|
| 21 | .lock_h = rtems_filesystem_default_lock, |
---|
| 22 | .unlock_h = rtems_filesystem_default_unlock, |
---|
| 23 | .eval_path_h = devFS_eval_path, |
---|
| 24 | .link_h = rtems_filesystem_default_link, |
---|
| 25 | .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal, |
---|
| 26 | .mknod_h = devFS_mknod, |
---|
| 27 | .rmnod_h = rtems_filesystem_default_rmnod, |
---|
| 28 | .fchmod_h = rtems_filesystem_default_fchmod, |
---|
| 29 | .chown_h = rtems_filesystem_default_chown, |
---|
| 30 | .clonenod_h = rtems_filesystem_default_clonenode, |
---|
| 31 | .freenod_h = rtems_filesystem_default_freenode, |
---|
| 32 | .mount_h = rtems_filesystem_default_mount, |
---|
| 33 | .unmount_h = rtems_filesystem_default_unmount, |
---|
| 34 | .fsunmount_me_h = rtems_filesystem_default_fsunmount, |
---|
| 35 | .utime_h = rtems_filesystem_default_utime, |
---|
| 36 | .symlink_h = rtems_filesystem_default_symlink, |
---|
| 37 | .readlink_h = rtems_filesystem_default_readlink, |
---|
| 38 | .rename_h = rtems_filesystem_default_rename, |
---|
| 39 | .statvfs_h = rtems_filesystem_default_statvfs |
---|
[d40da79b] | 40 | }; |
---|
| 41 | |
---|
[3b7c123] | 42 | const rtems_filesystem_file_handlers_r devFS_file_handlers = { |
---|
| 43 | .open_h = devFS_open, |
---|
| 44 | .close_h = devFS_close, |
---|
| 45 | .read_h = devFS_read, |
---|
| 46 | .write_h = devFS_write, |
---|
| 47 | .ioctl_h = devFS_ioctl, |
---|
[30d4124] | 48 | .lseek_h = rtems_filesystem_default_lseek_file, |
---|
[3b7c123] | 49 | .fstat_h = devFS_stat, |
---|
| 50 | .ftruncate_h = rtems_filesystem_default_ftruncate, |
---|
[4116fce6] | 51 | .fsync_h = rtems_filesystem_default_fsync_or_fdatasync, |
---|
| 52 | .fdatasync_h = rtems_filesystem_default_fsync_or_fdatasync, |
---|
[2f68778] | 53 | .fcntl_h = rtems_filesystem_default_fcntl, |
---|
[56bea43] | 54 | .kqfilter_h = rtems_filesystem_default_kqfilter, |
---|
[c6bb1c33] | 55 | .mmap_h = rtems_filesystem_default_mmap, |
---|
[56bea43] | 56 | .poll_h = rtems_filesystem_default_poll, |
---|
[2f68778] | 57 | .readv_h = rtems_filesystem_default_readv, |
---|
| 58 | .writev_h = rtems_filesystem_default_writev |
---|
[d40da79b] | 59 | }; |
---|
| 60 | |
---|
| 61 | int devFS_initialize( |
---|
[3b7c123] | 62 | rtems_filesystem_mount_table_entry_t *mt_entry, |
---|
| 63 | const void *data |
---|
[d40da79b] | 64 | ) |
---|
| 65 | { |
---|
[3b7c123] | 66 | int rv = 0; |
---|
[d40da79b] | 67 | |
---|
[3b7c123] | 68 | if (data != NULL) { |
---|
[da154e14] | 69 | mt_entry->ops = &devFS_ops; |
---|
[3b7c123] | 70 | mt_entry->immutable_fs_info = data; |
---|
| 71 | mt_entry->mt_fs_root->location.handlers = &devFS_file_handlers; |
---|
| 72 | } else { |
---|
| 73 | errno = EINVAL; |
---|
| 74 | rv = -1; |
---|
| 75 | } |
---|
[d40da79b] | 76 | |
---|
[3b7c123] | 77 | return rv; |
---|
[d40da79b] | 78 | } |
---|
| 79 | |
---|