Changeset 163fc09 in mainline


Ignore:
Timestamp:
2017-04-02T11:47:52Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ce04ea44
Parents:
151f1cc
Message:

Rename rename() to vfs_rename_path()

Location:
uspace
Files:
6 edited

Legend:

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

    r151f1cc r163fc09  
    3030#include <stdlib.h>
    3131#include <errno.h>
     32#include <vfs/vfs.h>
    3233#include "config.h"
    3334#include "util.h"
     
    5960        }
    6061
    61         rc = rename(argv[1], argv[2]);
    62         if (rc != 0) {
     62        rc = vfs_rename_path(argv[1], argv[2]);
     63        if (rc != EOK) {
    6364                printf("Unable to rename %s to %s (error=%d)\n",
    64                     argv[1], argv[2], errno);
     65                    argv[1], argv[2], rc);
    6566                return CMD_FAILURE;
    6667        }
  • uspace/app/tester/vfs/vfs1.c

    r151f1cc r163fc09  
    114114                return rv;
    115115       
    116         if (rename(TEST_FILE, TEST_FILE2) != 0)
    117                 return "rename() failed";
     116        if (vfs_rename_path(TEST_FILE, TEST_FILE2) != EOK)
     117                return "vfs_rename_path() failed";
    118118        TPRINTF("Renamed %s to %s\n", TEST_FILE, TEST_FILE2);
    119119       
  • uspace/lib/c/generic/vfs/vfs.c

    r151f1cc r163fc09  
    833833 * @param new New name
    834834 *
    835  * @return 0 on success. On error returns -1 and sets errno.
    836  */
    837 int rename(const char *old, const char *new)
     835 * @return EOK on success or a negative error code otherwise.
     836 */
     837int vfs_rename_path(const char *old, const char *new)
    838838{
    839839        sysarg_t rc;
     
    843843        size_t olda_size;
    844844        char *olda = vfs_absolutize(old, &olda_size);
    845         if (olda == NULL) {
    846                 errno = ENOMEM;
    847                 return -1;
    848         }
     845        if (olda == NULL)
     846                return ENOMEM;
    849847
    850848        size_t newa_size;
     
    852850        if (newa == NULL) {
    853851                free(olda);
    854                 errno = ENOMEM;
    855                 return -1;
     852                return ENOMEM;
    856853        }
    857854       
     
    861858                free(olda);
    862859                free(newa);
    863                 errno = ENOENT;
    864                 return -1;
     860                return ENOENT;
    865861        }
    866862       
     
    875871                if (rc_orig != EOK)
    876872                        rc = rc_orig;
    877                 if (rc != EOK) {
    878                         errno = rc;
    879                         return -1;
    880                 }
    881                 return 0;
     873                return rc;
    882874        }
    883875        rc = async_data_write_start(exch, newa, newa_size);
     
    890882                if (rc_orig != EOK)
    891883                        rc = rc_orig;
    892                 if (rc != EOK) {
    893                         errno = rc;
    894                         return -1;
    895                 }
    896                 return 0;
     884                return rc;
    897885        }
    898886        vfs_exchange_end(exch);
     
    902890        async_wait_for(req, &rc);
    903891
    904         if (rc != EOK) {
    905                 errno = rc;
    906                 return -1;
    907         }
    908 
    909         return 0;
     892        return rc;
    910893}
    911894
  • uspace/lib/c/include/stdio.h

    r151f1cc r163fc09  
    141141extern void setbuf(FILE *, void *);
    142142
    143 /* Misc file functions */
    144 extern int rename(const char *, const char *);
    145 
    146143#endif
    147144
  • uspace/lib/c/include/vfs/vfs.h

    r151f1cc r163fc09  
    9696extern int vfs_open(int, int);
    9797extern int vfs_put(int);
     98extern int vfs_rename_path(const char *, const char *);
    9899extern int vfs_resize(int, aoff64_t);
    99100extern int vfs_root(void);
  • uspace/lib/posix/source/stdio.c

    r151f1cc r163fc09  
    590590int posix_rename(const char *old, const char *new)
    591591{
    592         return negerrno(rename, old, new);
     592        int rc = rcerrno(vfs_rename_path, old, new);
     593        if (rc != EOK)
     594                return -1;
     595        else
     596                return 0;
    593597}
    594598
Note: See TracChangeset for help on using the changeset viewer.