Changeset a56cef9 in mainline


Ignore:
Timestamp:
2017-03-30T21:09:51Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6e5562a
Parents:
67e881c
Message:

Rename fsync() to vfs_sync()

Location:
uspace
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/kio/kio.c

    r67e881c ra56cef9  
    4848#include <adt/prodcons.h>
    4949#include <tinput.h>
     50#include <vfs/vfs.h>
    5051
    5152#define NAME       "kio"
     
    128129                       
    129130                        fflush(log);
    130                         fsync(fileno(log));
     131                        vfs_sync(fileno(log));
    131132                }
    132133               
  • uspace/lib/c/generic/io/io.c

    r67e881c ra56cef9  
    836836       
    837837        if ((stream->fd >= 0) && (stream->need_sync)) {
     838                int rc;
     839
    838840                /**
    839841                 * Better than syncing always, but probably still not the
     
    841843                 */
    842844                stream->need_sync = false;
    843                 if (fsync(stream->fd) != 0) {
    844                         /* errno was set by fsync() */
     845                rc = vfs_sync(stream->fd);
     846                if (rc != EOK) {
     847                        errno = rc;
    845848                        return EOF;
    846849                }
  • uspace/lib/c/generic/vfs/vfs.c

    r67e881c ra56cef9  
    597597 *
    598598 * @param fildes File descriptor
    599  * @return 0 on success. On error returns -1 and sets errno.
    600  */
    601 int fsync(int fildes)
    602 {
    603         async_exch_t *exch = vfs_exchange_begin();
    604         sysarg_t rc = async_req_1_0(exch, VFS_IN_SYNC, fildes);
    605         vfs_exchange_end(exch);
    606        
    607         if (rc != EOK) {
    608                 errno = rc;
    609                 return -1;
    610         }
    611        
    612         return 0;
     599 * @return EOK on success or a negative error code otherwise.
     600 */
     601int vfs_sync(int file)
     602{
     603        async_exch_t *exch = vfs_exchange_begin();
     604        sysarg_t rc = async_req_1_0(exch, VFS_IN_SYNC, file);
     605        vfs_exchange_end(exch);
     606       
     607        return rc;
    613608}
    614609
     
    620615 * @param length Length
    621616 *
    622  * @return 0 on success or a negative erroc code otherwise.
     617 * @return EOK on success or a negative erroc code otherwise.
    623618 */
    624619int vfs_resize(int file, aoff64_t length)
  • uspace/lib/c/include/unistd.h

    r67e881c ra56cef9  
    6262
    6363extern int close(int);
    64 extern int fsync(int);
    6564
    6665extern char *getcwd(char *, size_t);
  • uspace/lib/c/include/vfs/vfs.h

    r67e881c ra56cef9  
    9595extern int vfs_statfs(int, struct statfs *);
    9696extern int vfs_statfs_path(const char *, struct statfs *);
     97extern int vfs_sync(int);
    9798extern int vfs_unlink(int, const char *, int);
    9899extern int vfs_unlink_path(const char *);
  • uspace/lib/posix/source/unistd.c

    r67e881c ra56cef9  
    247247int posix_fsync(int fildes)
    248248{
    249         return negerrno(fsync, fildes);
     249        if (rcerrno(vfs_sync, fildes) != EOK)
     250                return -1;
     251        else
     252                return 0;
    250253}
    251254
Note: See TracChangeset for help on using the changeset viewer.