Changeset 67e881c in mainline for uspace/srv/vfs/vfs_ops.c


Ignore:
Timestamp:
2017-03-30T20:59:36Z (7 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()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_ops.c

    r79ea5af r67e881c  
    585585}
    586586
     587int vfs_op_resize(int fd, int64_t size)
     588{
     589        vfs_file_t *file = vfs_file_get(fd);
     590        if (!file)
     591                return EBADF;
     592
     593        fibril_rwlock_write_lock(&file->node->contents_rwlock);
     594       
     595        int rc = vfs_truncate_internal(file->node->fs_handle,
     596            file->node->service_id, file->node->index, size);
     597        if (rc == EOK)
     598                file->node->size = size;
     599       
     600        fibril_rwlock_write_unlock(&file->node->contents_rwlock);
     601        vfs_file_put(file);
     602        return rc;
     603}
     604
    587605int vfs_op_stat(int fd)
    588606{
     
    652670       
    653671        return (int) rc;
    654 }
    655 
    656 int vfs_op_truncate(int fd, int64_t size)
    657 {
    658         vfs_file_t *file = vfs_file_get(fd);
    659         if (!file)
    660                 return EBADF;
    661 
    662         fibril_rwlock_write_lock(&file->node->contents_rwlock);
    663        
    664         int rc = vfs_truncate_internal(file->node->fs_handle,
    665             file->node->service_id, file->node->index, size);
    666         if (rc == EOK)
    667                 file->node->size = size;
    668        
    669         fibril_rwlock_write_unlock(&file->node->contents_rwlock);
    670         vfs_file_put(file);
    671         return rc;
    672672}
    673673
Note: See TracChangeset for help on using the changeset viewer.