source: rtems/c/src/libfs/src/imfs/imfs_mknod.c @ c058578

4.104.114.84.95
Last change on this file since c058578 was c058578, checked in by Joel Sherrill <joel.sherrill@…>, on 11/01/00 at 21:02:46

2000-11-01 Joel Sherrill <joel@…>

  • src/imfs/Makefile.am, src/imfs/deviceio.c, src/imfs/imfs_chown.c, src/imfs/imfs_config.c, src/imfs/imfs_creat.c, src/imfs/imfs_debug.c, src/imfs/imfs_directory.c, src/imfs/imfs_eval.c, src/imfs/imfs_fchmod.c, src/imfs/imfs_free.c, src/imfs/imfs_fsunmount.c, src/imfs/imfs_gtkn.c, src/imfs/imfs_init.c, src/imfs/imfs_initsupp.c, src/imfs/imfs_link.c, src/imfs/imfs_mknod.c, src/imfs/imfs_mount.c, src/imfs/imfs_readlink.c, src/imfs/imfs_rmnod.c, src/imfs/imfs_stat.c, src/imfs/imfs_symlink.c, src/imfs/imfs_unixstub.c, src/imfs/imfs_unlink.c, src/imfs/imfs_unmount.c, src/imfs/imfs_utime.c, src/imfs/ioman.c, src/imfs/memfile.c, src/imfs/miniimfs_init.c: assoc.h, error.h, libio_.h, libio.h, and libcsupport.h moved from libc to lib/include/rtems and now must be referenced as <rtems/XXX.h>. Now we do not have to reach up and over to libc to pick them up.
  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  IMFS_mknod
3 *
4 *  Routine to create a node in the IMFS file system.
5 *
6 *  COPYRIGHT (c) 1989-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <sys/types.h>
17#include <sys/stat.h>
18#include <fcntl.h>
19#include <unistd.h>
20#include <errno.h>
21#include <stdlib.h>
22
23#include "imfs.h"
24#include <rtems/libio_.h>
25
26int IMFS_mknod(
27  const char                        *token,      /* IN */
28  mode_t                             mode,       /* IN */
29  dev_t                              dev,        /* IN */
30  rtems_filesystem_location_info_t  *pathloc     /* IN/OUT */
31)
32{
33  IMFS_token_types   type = 0;
34  IMFS_jnode_t      *new_node;
35  int                result;
36  char               new_name[ IMFS_NAME_MAX + 1 ];
37  IMFS_types_union   info;
38 
39  IMFS_get_token( token, new_name, &result );
40
41  /*
42   *  Figure out what type of IMFS node this is.
43   */
44
45  if ( S_ISDIR(mode) )
46    type = IMFS_DIRECTORY;
47  else if ( S_ISREG(mode) )
48    type = IMFS_MEMORY_FILE;
49  else if ( S_ISBLK(mode) || S_ISCHR(mode) ) {
50    type = IMFS_DEVICE;
51    rtems_filesystem_split_dev_t( dev, info.device.major, info.device.minor );
52  } else  {
53    set_errno_and_return_minus_one( EINVAL );
54  }
55 
56  /*
57   *  Allocate and fill in an IMFS jnode
58   */
59
60  new_node = IMFS_create_node(
61    pathloc,
62    type,
63    new_name,
64    mode,
65    &info
66  );
67
68  if ( !new_node )
69    set_errno_and_return_minus_one( ENOMEM );
70
71  return 0;
72}
73
Note: See TracBrowser for help on using the repository browser.