source: rtems/cpukit/libfs/src/devfs/devfs.h @ 7baa484

4.104.115
Last change on this file since 7baa484 was 7baa484, checked in by Chris Johns <chrisj@…>, on 06/12/09 at 01:53:33

2009-06-12 Chris Johns <chrisj@…>

  • libblock/src/bdbuf.c: Update comments.
  • libblock/src/bdpart.c, libblock/src/ide_part_table.c: Get the device from the rdev field of the stat buf.
  • libcsupport/include/rtems/libio.h: Add a path length to evalpath handler. Add parent locations to rmmod and unlink handlers.
  • libcsupport/include/rtems/libio_.h: Add a path length to rtems_filesystem_evaluate_path. Add rtems_filesystem_evaluate_relative_path, rtems_filesystem_dirname, and rtems_filesystem_prefix_separators. Remove rtems_filesystem_evaluate_parent.
  • libcsupport/src/base_fs.c, libcsupport/src/chdir.c, libcsupport/src/chmod.c, libcsupport/src/chown.c, libcsupport/src/chroot.c, libcsupport/src/fchdir.c, libcsupport/src/link.c, libcsupport/src/mount.c, libcsupport/src/open.c, libcsupport/src/privateenv.c, libcsupport/src/readlink.c, libcsupport/src/unmount.c, libcsupport/src/utime.c, libcsupport/src/unmount.c, libcsupport/src/utime.c, libfs/src/devfs/devfs.h, libfs/src/devfs/devfs_eval.c, libfs/src/devfs/devstat.c, libfs/src/dosfs/msdos_create.c, libfs/src/dosfs/msdos_misc.c, libfs/src/imfs/imfs.h, libfs/src/imfs/imfs_eval.c, libfs/src/imfs/imfs_load_tar.c, libfs/src/imfs/ioman.c, libfs/src/pipe/pipe.c, libmisc/fsmount/fsmount.c, libnetworking/lib/ftpfs.c: Add the length parameter to the eval call.
  • libcsupport/src/eval.c: Add rtems_filesystem_prefix_separators, rtems_filesystem_dirname, rtems_filesystem_evaluate_relative_path. Add the length parameter to the eval call.
  • libcsupport/src/rmdir.c: Find the parent pathloc then the node pathloc from that node. Remove the call to find the parent given the node pathloc.
  • libcsupport/src/stat.c: Add the length parameter to the eval call. Set the device into the rdev field.
  • libcsupport/src/unlink.c: Find the parent pathloc then the node pathloc from that node. Remove the call to find the parent given the node pathloc.
  • libfs/src/dosfs/fat.c, libfs/src/dosfs/msdos_format.c: Get the disk device number from the stat rdev field.
  • libfs/src/dosfs/msdos.h: Add the length parameter to the eval call. Add the parent pathloc to the rmnod handler.
  • libfs/src/dosfs/msdos_dir.c: Add the parent pathloc to the rmnod handler.
  • libfs/src/dosfs/msdos_eval.c: Add the length parameter to the eval and token call.
  • libfs/src/imfs/imfs_directory.c: Add the parent pathloc to the rmnod handler.
  • libfs/src/imfs/imfs_fchmod.c: Do not test the mode flags for only the allowed flags. Add the missing flags spec'ed in the POSIX standard.
  • libfs/src/imfs/imfs_fsunmount.c, libfs/src/imfs/imfs_rmnod.c, libfs/src/imfs/imfs_unlink.c, libfs/src/imfs/memfile.c: Add the parent node. Currently ignored in the IMFS.
  • libfs/src/imfs/imfs_stat.c: Return the device number in the rdev field.
  • libfs/src/imfs/imfs_mknod.c, libfs/src/imfs/imfs_symlink.c : Add the length parameter to the token call.
  • libfs/src/nfsclient/src/nfs.c: Add the length parameter to the eval call and parent node to the rmnod and unlink command.
  • libmisc/shell/internal.h: Remove the libc mounter decl to make public.
  • libmisc/shell/main_mount.c: Add support for hooking external mount support for new file systems.
  • libmisc/shell/shell.h: Add helper functions for the mount command.
  • Property mode set to 100644
File size: 7.9 KB
Line 
1/**
2*  @file  libfs/devfs/devfs.h
3*
4*  This include file contains all constants and structures associated
5*  with the 'device-only' filesystem.
6*/
7
8#ifndef _RTEMS_DEVFS_H
9#define _RTEMS_DEVFS_H
10
11#include <rtems/libio_.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/**
18 *  This structure define the type of device table
19 */
20
21typedef struct
22{
23  /** This member pointes to device name which is a null-terminated string */
24  char                     *device_name;
25  /** This member is the name length of a device */
26  uint32_t                  device_name_length;
27  /** major number of a device */
28  rtems_device_major_number major;
29  /** minor number of a device */
30  rtems_device_minor_number minor;
31  /** device creation mode, only device file can be created */
32  mode_t                    mode;
33
34} rtems_device_name_t;
35
36
37
38/**
39 *  This routine associates RTEMS status code with errno
40 */
41
42extern int rtems_deviceio_errno(rtems_status_code code);
43
44
45/**
46 *  The following defines the device table size. This values
47 *  is configured during application configuration time by
48 *  the user. The default value is set to 4.
49 */
50
51extern uint32_t rtems_device_table_size;
52
53
54/**
55 *  The following defines the device-only filesystem operating
56 *  handlers.
57 */
58
59extern rtems_filesystem_operations_table devFS_ops;
60
61/**
62 *  The following defines the device-only filesystem operating
63 *  handlers.
64 */
65
66extern rtems_filesystem_file_handlers_r  devFS_file_handlers;
67
68
69/**
70 *  This handler maps open operation to rtems_io_open.
71 *  @param iop This is the RTEMS's internal representation of file.
72 *  @param pathname a null-terminated string that starts with /dev.
73 *  @param flag access flags
74 *  @param mode access mode
75 *  @retval the same as open
76 */
77
78extern int devFS_open(
79  rtems_libio_t *iop,
80  const char    *pathname,
81  uint32_t       flag,
82  uint32_t       mode
83);
84
85
86/**
87 *  This handler maps close operation to rtems_io_close.
88 *  @param iop This is the RTEMS's internal representation of file
89 *  @retval the same as close
90 */
91
92
93extern int devFS_close(
94  rtems_libio_t *iop
95);
96
97
98/**
99 *  This handler maps read operation to rtems_io_read.
100 *  @param iop This is the RTEMS's internal representation of file
101 *  @param  buffer memory location to store read data
102 *  @param  count  how many bytes to read
103 *  @retval On successful, this routine returns total bytes read. On error
104 *  it returns -1 and errno is set to proper value.
105 */
106
107extern ssize_t devFS_read(
108  rtems_libio_t *iop,
109  void          *buffer,
110  size_t         count
111);
112
113
114/**
115 *  This handler maps write operation to rtems_io_write.
116 *  @param iop This is the RTEMS's internal representation of file
117 *  @param buffer data to be written
118 *  @param count  how many bytes to write
119 *  @retval On successful, this routine returns total bytes written. On error
120 *  it returns -1 and errno is set to proper value.
121 */
122
123extern ssize_t devFS_write(
124  rtems_libio_t *iop,
125  const void    *buffer,
126  size_t         count
127);
128
129
130/**
131 *  This handler maps ioctl operation to rtems_io_ioctl.
132 *  @param iop This is the RTEMS's internal representation of file
133 *  @param command io control command
134 *  @param buffer  io control parameters
135 *  @retval On successful, this routine returns total bytes written. On error
136 *  it returns -1 and errno is set to proper value.
137 */
138
139extern int devFS_ioctl(
140  rtems_libio_t *iop,
141  uint32_t       command,
142  void          *buffer
143);
144
145
146
147
148/**
149 *  This handler gets the device file information. This routine only set the following member of struct stat:
150 *  st_dev : device number
151 *  st_mode: device file creation mode, only two mode are accepted:
152 *           S_IFCHR: character device file
153 *           S_IFBLK: block device file
154 *  @param loc contains filesystem access information
155 *  @param buf buffer to hold the device file's information
156 *  @retval On successful, this routine returns 0. On error
157 *  it returns -1 and errno is set to proper value.
158 */
159
160extern int devFS_stat(
161  rtems_filesystem_location_info_t *loc,
162  struct stat                      *buf
163);
164
165
166
167/**
168 *  This routine is invoked upon determination of a node type.
169 *  Since this is a device-only filesystem, so there is only
170 *  one node type in the system.
171 * 
172 *  @param pathloc contains filesytem access information, this
173 *         parameter is ignored
174 *  @retval always returns RTEMS_FILESYSTEM_DEVICE
175 */
176
177extern int devFS_node_type(
178  rtems_filesystem_location_info_t  *pathloc
179);
180
181
182
183/**
184 *  This routine is invoked to determine if 'pathname' exists.
185 *  This routine first check access flags, then it searches
186 *  the device table to get the information.
187 *
188 *  @param pathname device name to be searched
189 *  @param flags access flags
190 *  @param pathloc contains filesystem access information
191 *  @retval upon success(pathname exists), this routines
192 *  returns 0; if 'flag' is invalid, it returns -1 and errno
193 *  is set to EIO; otherwise, it returns -1 and errno is set to ENOENT
194 */
195
196extern int devFS_evaluate_path(
197  const char                        *pathname,
198  int                                pathnamelen,
199  int                                flags,
200  rtems_filesystem_location_info_t  *pathloc
201);
202
203
204/**
205 *  This routine is given a path to evaluate and a valid start
206 *  location. It is responsible for finding the parent node for
207 *  a requested make command, setting pathloc information to
208 *  identify the parent node, and setting the name pointer to
209 *  the first character of the name of the new node. In device
210 *  only filesystem, devices do not has a tree hierarchy, there
211 *  are no parent-child relationship. So this routine is rather
212 *  simple, it just set *name to path and returns
213 *
214 *  @param path device path to be evaluated
215 *  @param pathloc contains filesystem access information, this
216 *         parameter is ignored
217 *  @param name
218 *  @retval always returns 0
219 */
220
221extern int devFS_evaluate_for_make(
222   const char                         *path,
223   rtems_filesystem_location_info_t   *pathloc,
224   const char                        **name
225);
226
227
228
229/**
230 *  This routine is invoked upon registration of a new device
231 *  file. It is responsible for creating a item in the main
232 *  device table. This routine searches the device table in
233 *  sequential order, when found a empty slot, it fills the slot
234 *  with proper values.
235 *
236 *  @param path the device file name to be registered
237 *  @param mode file mode, this parameter is ignored
238 *  @param dev  device major and minor number
239 *  @param pathloc contains filesystem access information
240 *  @retval upon success, this routine returns 0; if 'path'
241 *  already exist, it returns -1 and errno is set to EEXIST;
242 *  if device table is full, it returns -1 and errno is set
243 *  to ENOMEM
244 */
245
246extern int devFS_mknod(
247   const char                        *path,
248   mode_t                             mode,
249   dev_t                              dev, 
250   rtems_filesystem_location_info_t  *pathloc
251);
252
253
254/**
255 *  This routine is invoked upon rtems filesystem initialization.
256 *  It is responsible for creating the main device table,
257 *  initializing it to a known state, and set device file operation
258 *  handlers. After this, the device-only filesytem is ready for use
259 *
260 *  @param  temp_mt_entry
261 *  @retval upon success, this routine returns 0; otherwise it returns
262 *  -1 and errno is set to proper value. The only error is when malloc
263 *  failed, and errno is set to NOMEM.
264 */
265
266extern int devFS_initialize(
267  rtems_filesystem_mount_table_entry_t *temp_mt_entry
268);
269
270
271/**
272 *  This routine retrieves all the device registered in system, and
273 *  prints out their detail information. For example, on one system,
274 *  devFS_show will print out following message:
275 * 
276 *  /dev/console     0  0
277 *  /dev/clock       1  0
278 *  /dev/tty0        0  0
279 *  /flash           2  0
280 *
281 *  This routine is intended for debugging, and can be used by shell
282 *  program to provide user with the system information.
283 * 
284 *  @param  none
285 *  @retval 0
286 */
287
288extern int devFS_Show(void);
289
290#ifdef __cplusplus
291}
292#endif
293
294#endif
295
Note: See TracBrowser for help on using the repository browser.