RTEMS Logo

RTEMS 4.9.4 On-Line Library


mknod

PREV UP NEXT Bookshelf RTEMS Filesystem Design Guide

4.19: mknod

File:

mknod.c

Processing:

This function will allow for the creation of the following types of nodes under the filesystem:

At the present time, an attempt to create a FIFO will result in an ENOTSUP error to the calling function. This routine is layered the filesystem specific routines evalformake and mknod. The introduction of a new filesystem must include its own evalformake and mknod function to support the generic mknod() function. Under this condition the generic mknod() function should accommodate other filesystem types without alteration.

Development Comments:

Test for nodal types - I thought that this test should look like the following code:

if ( (mode & S_IFDIR) = = S_IFDIR) ||
     (mode & S_IFREG) = = S_IFREG) ||
     (mode & S_IFCHR) = = S_IFCHR) ||
     (mode & S_IFBLK) = = S_IFBLK) ||
     (mode & S_IFIFO) = = S_IFIFO))
     Set_errno_and_return_minus_one (EINVAL);

Where:

Determine if the pathname that we are trying to create starts at the root directory or is relative to the current directory using the rtems_filesystem_get_start_loc() function.

Determine if the pathname leads to a valid directory that can be accessed for the creation of a node.

If the pathname is a valid location to create a node, verify that a filesystem specific mknod() function exists.

If the mknod() function exists, call the filesystem specific mknod() function. Pass the name, mode, device type and the location information associated with the directory under which the node will be created.


PREV UP NEXT Bookshelf RTEMS Filesystem Design Guide

Copyright © 1988-2008 OAR Corporation