4.115
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Routine for Node Creation in MSDOS Filesystem |
---|
5 | * @ingroup libfs_msdos MSDOS FileSystem |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia |
---|
10 | * Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru> |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <sys/types.h> |
---|
22 | #include <sys/stat.h> |
---|
23 | #include <fcntl.h> |
---|
24 | #include <unistd.h> |
---|
25 | #include <errno.h> |
---|
26 | #include <stdlib.h> |
---|
27 | #include <rtems.h> |
---|
28 | |
---|
29 | #include <rtems/libio_.h> |
---|
30 | |
---|
31 | #include "fat.h" |
---|
32 | #include "fat_fat_operations.h" |
---|
33 | #include "fat_file.h" |
---|
34 | |
---|
35 | #include "msdos.h" |
---|
36 | |
---|
37 | int msdos_mknod( |
---|
38 | const rtems_filesystem_location_info_t *parentloc, |
---|
39 | const char *name, |
---|
40 | size_t namelen, |
---|
41 | mode_t mode, |
---|
42 | dev_t dev |
---|
43 | ) |
---|
44 | { |
---|
45 | int rc = RC_OK; |
---|
46 | fat_file_type_t type = 0; |
---|
47 | |
---|
48 | /* |
---|
49 | * Figure out what type of msdos node this is. |
---|
50 | */ |
---|
51 | if (S_ISDIR(mode)) |
---|
52 | { |
---|
53 | type = FAT_DIRECTORY; |
---|
54 | } |
---|
55 | else if (S_ISREG(mode)) |
---|
56 | { |
---|
57 | type = FAT_FILE; |
---|
58 | } |
---|
59 | else |
---|
60 | rtems_set_errno_and_return_minus_one(EINVAL); |
---|
61 | |
---|
62 | /* Create an MSDOS node */ |
---|
63 | rc = msdos_creat_node(parentloc, type, name, namelen, mode, NULL); |
---|
64 | |
---|
65 | return rc; |
---|
66 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.