File indexing completed on 2025-05-11 08:24:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifdef HAVE_CONFIG_H
0019 #include "config.h"
0020 #endif
0021
0022 #include <sys/types.h>
0023 #include <sys/stat.h>
0024 #include <fcntl.h>
0025 #include <unistd.h>
0026 #include <errno.h>
0027 #include <stdlib.h>
0028 #include <rtems.h>
0029
0030 #include <rtems/libio_.h>
0031
0032 #include "fat.h"
0033 #include "fat_fat_operations.h"
0034 #include "fat_file.h"
0035
0036 #include "msdos.h"
0037
0038 int msdos_mknod(
0039 const rtems_filesystem_location_info_t *parentloc,
0040 const char *name,
0041 size_t namelen,
0042 mode_t mode,
0043 dev_t dev
0044 )
0045 {
0046 int rc = RC_OK;
0047 fat_file_type_t type = FAT_DIRECTORY;
0048
0049
0050
0051
0052 if (S_ISDIR(mode))
0053 {
0054 type = FAT_DIRECTORY;
0055 }
0056 else if (S_ISREG(mode))
0057 {
0058 type = FAT_FILE;
0059 }
0060 else
0061 rtems_set_errno_and_return_minus_one(EINVAL);
0062
0063
0064 rc = msdos_creat_node(parentloc, type, name, namelen, mode, NULL);
0065
0066 return rc;
0067 }