Changeset 6e5562a in mainline for uspace/app


Ignore:
Timestamp:
2017-03-31T19:57:38Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
80743a1
Parents:
a56cef9
Message:

Introduce vfs_link_path() and replace mkdir() with it

Location:
uspace/app
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/cp/cp.c

    ra56cef9 r6e5562a  
    3636#include <str.h>
    3737#include <fcntl.h>
    38 #include <sys/stat.h>
    3938#include <vfs/vfs.h>
    4039#include <dirent.h>
     
    296295                                merge_paths(dest_path, PATH_MAX, src_dirname);
    297296
    298                                 if (mkdir(dest_path, 0) != 0) {
     297                                if (vfs_link_path(dest_path, KIND_DIRECTORY) != EOK) {
    299298                                        printf("Unable to create "
    300299                                            "dest directory %s\n", dest_path);
     
    310309                         * e.g. cp -r /src /data/new_dir_src
    311310                         */
    312                         if (mkdir(dest_path, 0) != 0) {
     311                        if (vfs_link_path(dest_path, KIND_DIRECTORY) != EOK) {
    313312                                printf("Unable to create "
    314313                                    "dest directory %s\n", dest_path);
  • uspace/app/bdsh/cmds/modules/mkdir/mkdir.c

    ra56cef9 r6e5562a  
    3232#include <fcntl.h>
    3333#include <sys/types.h>
    34 #include <sys/stat.h>
    3534#include <getopt.h>
    3635#include <stdarg.h>
     
    9897
    9998        if (!create_parents) {
    100                 if (mkdir(path, 0) != 0) {
     99                ret = vfs_link_path(path, KIND_DIRECTORY);
     100                if (ret != EOK) {
    101101                        cli_error(CL_EFAIL, "%s: could not create %s (%s)",
    102                             cmdname, path, str_error(errno));
     102                            cmdname, path, str_error(ret));
    103103                        ret = 1;
    104104                }
     
    136136                        path[prev_off] = 0;
    137137
    138                         if (mkdir(path, 0) != 0 && errno != EEXIST) {
     138                        ret = vfs_link_path(path, KIND_DIRECTORY);
     139                        if (ret != EOK && ret != EEXIST) {
    139140                                cli_error(CL_EFAIL, "%s: could not create %s (%s)",
    140                                     cmdname, path, str_error(errno));
     141                                    cmdname, path, str_error(ret));
    141142                                ret = 1;
    142143                                goto leave;
     
    146147                }
    147148                /* Create the final directory. */
    148                 if (mkdir(path, 0) != 0) {
     149                ret = vfs_link_path(path, KIND_DIRECTORY);
     150                if (ret != EOK) {
    149151                        cli_error(CL_EFAIL, "%s: could not create %s (%s)",
    150                             cmdname, path, str_error(errno));
     152                            cmdname, path, str_error(ret));
    151153                        ret = 1;
    152154                }
  • uspace/app/bdsh/cmds/modules/mkfile/mkfile.c

    ra56cef9 r6e5562a  
    3333#include <fcntl.h>
    3434#include <sys/types.h>
    35 #include <sys/stat.h>
    3635#include <macros.h>
    3736#include <getopt.h>
  • uspace/app/fontviewer/fontviewer.c

    ra56cef9 r6e5562a  
    3636#include <unistd.h>
    3737#include <fcntl.h>
    38 #include <sys/stat.h>
    3938#include <errno.h>
    4039#include <malloc.h>
  • uspace/app/sysinst/futil.c

    ra56cef9 r6e5562a  
    3939#include <stdio.h>
    4040#include <stdlib.h>
    41 #include <sys/stat.h>
    4241#include <vfs/vfs.h>
    4342#include <sys/types.h>
     
    130129                } else if (s.is_directory) {
    131130                        printf("Create directory '%s'\n", destp);
    132                         rc = mkdir(destp, 0);
     131                        rc = vfs_link_path(destp, KIND_DIRECTORY);
    133132                        if (rc != EOK)
    134133                                return EIO;
  • uspace/app/sysinst/sysinst.c

    ra56cef9 r6e5562a  
    4343#include <stdio.h>
    4444#include <stdlib.h>
    45 #include <sys/stat.h>
    4645#include <task.h>
    4746#include <vfs/vfs.h>
     
    175174                return EIO;
    176175
    177         rc = mkdir(MOUNT_POINT, 0);
     176        rc = vfs_link_path(MOUNT_POINT, KIND_DIRECTORY);
    178177        if (rc != EOK)
    179178                return rc;
     
    214213
    215214        printf("sysinst_copy_boot_files(): create CD mount point\n");
    216         rc = mkdir(CD_MOUNT_POINT, 0);
     215        rc = vfs_link_path(CD_MOUNT_POINT, KIND_DIRECTORY);
    217216        if (rc != EOK)
    218217                return rc;
  • uspace/app/taskdump/elf_core.c

    ra56cef9 r6e5562a  
    5454#include <errno.h>
    5555#include <sys/types.h>
    56 #include <sys/stat.h>
    5756#include <unistd.h>
    5857#include <fcntl.h>
  • uspace/app/taskdump/symtab.c

    ra56cef9 r6e5562a  
    4141#include <errno.h>
    4242#include <sys/types.h>
    43 #include <sys/stat.h>
    4443#include <fcntl.h>
    4544
  • uspace/app/tester/hw/misc/virtchar1.c

    ra56cef9 r6e5562a  
    4545#include <vfs/vfs.h>
    4646#include <vfs/vfs_sess.h>
    47 #include <sys/stat.h>
    4847#include <fcntl.h>
    4948#include "../../tester.h"
  • uspace/app/tester/vfs/vfs1.c

    ra56cef9 r6e5562a  
    3737#include <loc.h>
    3838#include <sys/types.h>
    39 #include <sys/stat.h>
    4039#include "../tester.h"
    4140
     
    7170{
    7271        aoff64_t pos = 0;
     72        int rc;
    7373
    74         if (mkdir(TEST_DIRECTORY, 0) != 0) {
    75                 TPRINTF("rc=%d\n", errno);
    76                 return "mkdir() failed";
     74        rc = vfs_link_path(TEST_DIRECTORY, KIND_DIRECTORY);
     75        if (rc != EOK) {
     76                TPRINTF("rc=%d\n", rc);
     77                return "vfs_link_path() failed";
    7778        }
    7879        TPRINTF("Created directory %s\n", TEST_DIRECTORY);
  • uspace/app/untar/main.c

    ra56cef9 r6e5562a  
    3535#include <stdio.h>
    3636#include <stdlib.h>
    37 #include <sys/stat.h>
    3837#include <errno.h>
    3938#include <str_error.h>
     39#include <vfs/vfs.h>
    4040#include "tar.h"
    4141
     
    103103static int handle_directory(const tar_header_t *header, FILE *tarfile)
    104104{
    105         if (mkdir(header->filename, 0755) != 0) {
    106                 if (errno != EEXIST) {
     105        int rc;
     106
     107        rc = vfs_link_path(header->filename, KIND_DIRECTORY);
     108        if (rc != EOK) {
     109                if (rc != EEXIST) {
    107110                        fprintf(stderr, "Failed to create directory %s: %s.\n",
    108                             header->filename, str_error(errno));
    109                         return errno;
     111                            header->filename, str_error(rc));
     112                        return rc;
    110113                }
    111114        }
  • uspace/app/websrv/websrv.c

    ra56cef9 r6e5562a  
    3939#include <stdio.h>
    4040#include <sys/types.h>
    41 #include <sys/stat.h>
    4241#include <stdlib.h>
    4342#include <fcntl.h>
Note: See TracChangeset for help on using the changeset viewer.