source: rtems/cpukit/libcsupport/src/mknod.c @ 9b4422a2

4.11
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on May 3, 2012 at 3:09:24 PM

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  mknod()
3 *
4 *  This routine is not defined in the POSIX 1003.1b standard but is
5 *  commonly supported on most UNIX and POSIX systems.  It is the
6 *  foundation for creating file system objects.
7 *
8 *  COPYRIGHT (c) 1989-1999.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 */
15
16#if HAVE_CONFIG_H
17  #include "config.h"
18#endif
19
20#include <sys/stat.h>
21
22#include <rtems/libio_.h>
23
24int rtems_filesystem_mknod(
25  const rtems_filesystem_location_info_t *parentloc,
26  const char *name,
27  size_t namelen,
28  mode_t mode,
29  dev_t dev
30)
31{
32  int rv = 0;
33
34  mode &= ~rtems_filesystem_umask;
35
36  switch (mode & S_IFMT) {
37    case S_IFBLK:
38    case S_IFCHR:
39    case S_IFDIR:
40    case S_IFIFO:
41    case S_IFREG:
42      break;
43    default:
44      errno = EINVAL;
45      rv = -1;
46      break;
47  }
48 
49  if ( rv == 0 ) {
50    rv = (*parentloc->ops->mknod_h)( parentloc, name, namelen, mode, dev );
51  }
52
53  return rv;
54}
55
56int mknod( const char *path, mode_t mode, dev_t dev )
57{
58  int rv = 0;
59  rtems_filesystem_eval_path_context_t ctx;
60  int eval_flags = RTEMS_FS_FOLLOW_LINK
61    | RTEMS_FS_MAKE
62    | RTEMS_FS_EXCLUSIVE
63    | (S_ISDIR(mode) ? RTEMS_FS_ACCEPT_RESIDUAL_DELIMITERS : 0);
64  const rtems_filesystem_location_info_t *currentloc =
65    rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
66
67  rv = rtems_filesystem_mknod(
68    currentloc,
69    rtems_filesystem_eval_path_get_token( &ctx ),
70    rtems_filesystem_eval_path_get_tokenlen( &ctx ),
71    mode,
72    dev
73  );
74
75  rtems_filesystem_eval_path_cleanup( &ctx );
76
77  return rv;
78}
Note: See TracBrowser for help on using the repository browser.