Changeset c47e1a8 in mainline for uspace/lib/c/generic/vfs/vfs.c


Ignore:
Timestamp:
2010-05-21T07:50:04Z (16 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d51ee2b
Parents:
cf8cc36 (diff), 15b592b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge mainline changes (rev. 451)

File:
1 moved

Legend:

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

    rcf8cc36 rc47e1a8  
    3535#include <vfs/vfs.h>
    3636#include <vfs/canonify.h>
     37#include <macros.h>
    3738#include <stdlib.h>
    3839#include <unistd.h>
     
    4849#include <futex.h>
    4950#include <errno.h>
    50 #include <string.h>
     51#include <str.h>
    5152#include <devmap.h>
    5253#include <ipc/vfs.h>
     
    434435}
    435436
    436 off_t lseek(int fildes, off_t offset, int whence)
    437 {
    438         ipcarg_t rc;
    439 
    440         futex_down(&vfs_phone_futex);
    441         async_serialize_start();
    442         vfs_connect();
    443        
    444         ipcarg_t newoffs;
    445         rc = async_req_3_1(vfs_phone, VFS_IN_SEEK, fildes, offset, whence,
    446             &newoffs);
    447 
    448         async_serialize_end();
    449         futex_up(&vfs_phone_futex);
    450 
     437off64_t lseek(int fildes, off64_t offset, int whence)
     438{
     439        futex_down(&vfs_phone_futex);
     440        async_serialize_start();
     441        vfs_connect();
     442       
     443        ipcarg_t newoff_lo;
     444        ipcarg_t newoff_hi;
     445        ipcarg_t rc = async_req_4_2(vfs_phone, VFS_IN_SEEK, fildes,
     446            LOWER32(offset), UPPER32(offset), whence,
     447            &newoff_lo, &newoff_hi);
     448       
     449        async_serialize_end();
     450        futex_up(&vfs_phone_futex);
     451       
    451452        if (rc != EOK)
    452                 return (off_t) -1;
    453        
    454         return (off_t) newoffs;
    455 }
    456 
    457 int ftruncate(int fildes, off_t length)
    458 {
    459         ipcarg_t rc;
    460        
    461         futex_down(&vfs_phone_futex);
    462         async_serialize_start();
    463         vfs_connect();
    464        
    465         rc = async_req_2_0(vfs_phone, VFS_IN_TRUNCATE, fildes, length);
    466         async_serialize_end();
    467         futex_up(&vfs_phone_futex);
     453                return (off64_t) -1;
     454       
     455        return (off64_t) MERGE_LOUP32(newoff_lo, newoff_hi);
     456}
     457
     458int ftruncate(int fildes, aoff64_t length)
     459{
     460        ipcarg_t rc;
     461       
     462        futex_down(&vfs_phone_futex);
     463        async_serialize_start();
     464        vfs_connect();
     465       
     466        rc = async_req_3_0(vfs_phone, VFS_IN_TRUNCATE, fildes,
     467            LOWER32(length), UPPER32(length));
     468        async_serialize_end();
     469        futex_up(&vfs_phone_futex);
     470       
    468471        return (int) rc;
    469472}
     
    479482       
    480483        req = async_send_1(vfs_phone, VFS_IN_FSTAT, fildes, NULL);
    481         rc = async_data_read_start(vfs_phone, (void *)stat, sizeof(struct stat));
     484        rc = async_data_read_start(vfs_phone, (void *) stat, sizeof(struct stat));
    482485        if (rc != EOK) {
    483486                ipcarg_t rc_orig;
     
    553556        if (!abs) {
    554557                free(dirp);
    555                 return ENOMEM;
     558                return NULL;
    556559        }
    557560       
Note: See TracChangeset for help on using the changeset viewer.