source: rtems/cpukit/libcsupport/src/__usrenv.c @ 7666afc

4.11
Last change on this file since 7666afc was 7666afc, checked in by Sebastian Huber <sebastian.huber@…>, on May 14, 2012 at 2:53:49 PM

Filesystem: Add const qualifier to lock/unlock

  • Property mode set to 100644
File size: 5.6 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2008.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  Modifications to support reference counting in the file system are
6 *  Copyright (c) 2012 embedded brains GmbH.
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 */
12
13#if HAVE_CONFIG_H
14  #include "config.h"
15#endif
16
17#include <sys/stat.h>
18
19#include <rtems/libio_.h>
20
21static int null_handler_open(
22  rtems_libio_t *iop,
23  const char *path,
24  int oflag,
25  mode_t mode
26)
27{
28  return -1;
29}
30
31static int null_handler_fstat(
32  const rtems_filesystem_location_info_t *pathloc,
33  struct stat *buf
34)
35{
36  return -1;
37}
38
39const rtems_filesystem_file_handlers_r rtems_filesystem_null_handlers = {
40  .open_h = null_handler_open,
41  .close_h = rtems_filesystem_default_close,
42  .read_h = rtems_filesystem_default_read,
43  .write_h = rtems_filesystem_default_write,
44  .ioctl_h = rtems_filesystem_default_ioctl,
45  .lseek_h = rtems_filesystem_default_lseek,
46  .fstat_h = null_handler_fstat,
47  .ftruncate_h = rtems_filesystem_default_ftruncate,
48  .fsync_h = rtems_filesystem_default_fsync_or_fdatasync,
49  .fdatasync_h = rtems_filesystem_default_fsync_or_fdatasync,
50  .fcntl_h = rtems_filesystem_default_fcntl
51};
52
53static void null_op_lock_or_unlock(
54  const rtems_filesystem_mount_table_entry_t *mt_entry
55)
56{
57  /* Do nothing */
58}
59
60static int null_op_mknod(
61  const rtems_filesystem_location_info_t *parentloc,
62  const char *name,
63  size_t namelen,
64  mode_t mode,
65  dev_t dev
66)
67{
68  return -1;
69}
70
71static int null_op_rmnod(
72  const rtems_filesystem_location_info_t *parentloc,
73  const rtems_filesystem_location_info_t *loc
74)
75{
76  return -1;
77}
78
79static int null_op_link(
80  const rtems_filesystem_location_info_t *parentloc,
81  const rtems_filesystem_location_info_t *targetloc,
82  const char *name,
83  size_t namelen
84)
85{
86  return -1;
87}
88
89static int null_op_fchmod(
90  const rtems_filesystem_location_info_t *pathloc,
91  mode_t mode
92)
93{
94  return -1;
95}
96
97static int null_op_chown(
98  const rtems_filesystem_location_info_t *loc,
99  uid_t owner,
100  gid_t group
101)
102{
103  return -1;
104}
105
106static int null_op_clonenode(
107  rtems_filesystem_location_info_t *loc
108)
109{
110  return -1;
111}
112
113static int null_op_mount(
114  rtems_filesystem_mount_table_entry_t *mt_entry
115)
116{
117  return -1;
118}
119
120static int null_op_fsmount_me(
121  rtems_filesystem_mount_table_entry_t *mt_entry,
122  const void *data
123)
124{
125  return -1;
126}
127
128static int null_op_unmount(
129  rtems_filesystem_mount_table_entry_t *mt_entry
130)
131{
132  return -1;
133}
134
135static void null_op_fsunmount_me(
136  rtems_filesystem_mount_table_entry_t *mt_entry
137)
138{
139  /* Do nothing */
140}
141
142static int null_op_utime(
143  const rtems_filesystem_location_info_t *loc,
144  time_t actime,
145  time_t modtime
146)
147{
148  return -1;
149}
150
151static int null_op_symlink(
152  const rtems_filesystem_location_info_t *parentloc,
153  const char *name,
154  size_t namelen,
155  const char *target
156)
157{
158  return -1;
159}
160
161static ssize_t null_op_readlink(
162  const rtems_filesystem_location_info_t *loc,
163  char *buf,
164  size_t bufsize
165)
166{
167  return -1;
168}
169
170static int null_op_rename(
171  const rtems_filesystem_location_info_t *oldparentloc,
172  const rtems_filesystem_location_info_t *oldloc,
173  const rtems_filesystem_location_info_t *newparentloc,
174  const char *name,
175  size_t namelen
176)
177{
178  return -1;
179}
180
181static int null_op_statvfs(
182  const rtems_filesystem_location_info_t *loc,
183  struct statvfs *buf
184)
185{
186  return -1;
187}
188
189static const rtems_filesystem_operations_table null_ops = {
190  .lock_h = null_op_lock_or_unlock,
191  .unlock_h = null_op_lock_or_unlock,
192  .eval_path_h = rtems_filesystem_default_eval_path,
193  .link_h = null_op_link,
194  .are_nodes_equal_h = rtems_filesystem_default_are_nodes_equal,
195  .node_type_h = rtems_filesystem_default_node_type,
196  .mknod_h = null_op_mknod,
197  .rmnod_h = null_op_rmnod,
198  .fchmod_h = null_op_fchmod,
199  .chown_h = null_op_chown,
200  .clonenod_h = null_op_clonenode,
201  .freenod_h = rtems_filesystem_default_freenode,
202  .mount_h = null_op_mount,
203  .fsmount_me_h = null_op_fsmount_me,
204  .unmount_h = null_op_unmount,
205  .fsunmount_me_h = null_op_fsunmount_me,
206  .utime_h = null_op_utime,
207  .symlink_h = null_op_symlink,
208  .readlink_h = null_op_readlink,
209  .rename_h = null_op_rename,
210  .statvfs_h = null_op_statvfs
211};
212
213rtems_filesystem_mount_table_entry_t rtems_filesystem_null_mt_entry = {
214  .location_chain = {
215    .Head = {
216      .Node = {
217        .next = &rtems_filesystem_global_location_null.location.mt_entry_node,
218        .previous = NULL
219      },
220      .fill = &rtems_filesystem_global_location_null.location.mt_entry_node,
221    }
222  },
223  .mt_point_node = &rtems_filesystem_global_location_null,
224  .mt_fs_root = &rtems_filesystem_global_location_null,
225  .mounted = false,
226  .writeable = false
227};
228
229rtems_filesystem_global_location_t rtems_filesystem_global_location_null = {
230  .location = {
231    .mt_entry_node = {
232      .next = &rtems_filesystem_null_mt_entry.location_chain.Tail.Node,
233      .previous = &rtems_filesystem_null_mt_entry.location_chain.Head.Node
234    },
235    .handlers = &rtems_filesystem_null_handlers,
236    .ops = &null_ops,
237    .mt_entry = &rtems_filesystem_null_mt_entry
238  },
239
240  /*
241   * The initial reference count accounts for the following references
242   *  o the root directory of the user environment,
243   *  o the current directory of the user environment,
244   *  o the root node of the null file system instance, and
245   *  o the mount point node of the null file system instance.
246   */
247  .reference_count = 4
248};
249
250rtems_user_env_t rtems_global_user_env = {
251  .current_directory = &rtems_filesystem_global_location_null,
252  .root_directory = &rtems_filesystem_global_location_null,
253  .umask = S_IWGRP | S_IWOTH
254};
255
256rtems_user_env_t *rtems_current_user_env = &rtems_global_user_env;
Note: See TracBrowser for help on using the repository browser.