Changeset 67e881c in mainline for uspace/lib/c


Ignore:
Timestamp:
2017-03-30T20:59:36Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a56cef9
Parents:
79ea5af
Message:

Rename ftruncate() to vfs_resize()

Location:
uspace/lib/c
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/vfs/vfs.c

    r79ea5af r67e881c  
    408408                assert(!(oflag & O_APPEND));
    409409               
    410                 (void) ftruncate(fd, 0);
     410                (void) vfs_resize(fd, 0);
    411411        }
    412412
     
    620620 * @param length Length
    621621 *
    622  * @return 0 on success, -1 on error and sets errno.
    623  */
    624 int ftruncate(int fildes, aoff64_t length)
     622 * @return 0 on success or a negative erroc code otherwise.
     623 */
     624int vfs_resize(int file, aoff64_t length)
    625625{
    626626        sysarg_t rc;
    627627       
    628628        async_exch_t *exch = vfs_exchange_begin();
    629         rc = async_req_3_0(exch, VFS_IN_TRUNCATE, fildes,
    630             LOWER32(length), UPPER32(length));
    631         vfs_exchange_end(exch);
    632        
    633         if (rc != EOK) {
    634                 errno = rc;
    635                 return -1;
    636         }
    637        
    638         return 0;
     629        rc = async_req_3_0(exch, VFS_IN_RESIZE, file, LOWER32(length),
     630            UPPER32(length));
     631        vfs_exchange_end(exch);
     632       
     633        return rc;
    639634}
    640635
  • uspace/lib/c/include/ipc/vfs.h

    r79ea5af r67e881c  
    6565        VFS_IN_READ = IPC_FIRST_USER_METHOD,
    6666        VFS_IN_WRITE,
    67         VFS_IN_TRUNCATE,
     67        VFS_IN_RESIZE,
    6868        VFS_IN_STAT,
    6969        VFS_IN_CLOSE,
  • uspace/lib/c/include/unistd.h

    r79ea5af r67e881c  
    6161extern ssize_t read(int, aoff64_t *, void *, size_t);
    6262
    63 extern int ftruncate(int, aoff64_t);
    64 
    6563extern int close(int);
    6664extern int fsync(int);
  • uspace/lib/c/include/vfs/vfs.h

    r79ea5af r67e881c  
    9090extern int vfs_root(void);
    9191extern void vfs_root_set(int);
     92extern int vfs_resize(int, aoff64_t);
    9293extern int vfs_stat(int, struct stat *);
    9394extern int vfs_stat_path(const char *, struct stat *);
Note: See TracChangeset for help on using the changeset viewer.