Changeset 677745a in mainline for uspace/srv/vfs


Ignore:
Timestamp:
2013-07-29T12:54:39Z (12 years ago)
Author:
Jiri Zarevucky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5bcd5b7
Parents:
b7c62a9
Message:

Have lookup return the last found directory, and the portion of path traversed. In exchange, only size < 2GB is returned from lookup.

Location:
uspace/srv/vfs
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs.h

    rb7c62a9 r677745a  
    113113        vfs_node_type_t type;   /**< Partial info about the node type. */
    114114
    115         aoff64_t size;          /**< Cached size if the node is a file. */
     115        int64_t size;           /**< Cached size if the node is a file. */
    116116
    117117        /**
     
    185185extern unsigned vfs_nodes_refcount_sum_get(fs_handle_t, service_id_t);
    186186
     187int64_t vfs_node_get_size(vfs_node_t *node);
    187188
    188189#define MAX_OPEN_FILES  128
  • uspace/srv/vfs/vfs_lookup.c

    rb7c62a9 r677745a  
    270270        }
    271271       
     272        unsigned last = IPC_GET_ARG3(answer);
     273        if (last != first + len) {
     274                /* The path wasn't processed entirely. */
     275                rc = ENOENT;
     276                goto out;
     277        }
     278       
    272279        if (!result) {
    273280                rc = EOK;
     
    278285        result->triplet.service_id = (service_id_t) IPC_GET_ARG1(answer);
    279286        result->triplet.index = (fs_index_t) IPC_GET_ARG2(answer);
    280         result->size =
    281             (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(answer), IPC_GET_ARG4(answer));
     287        result->size = (int64_t)(int32_t) IPC_GET_ARG4(answer);
    282288        result->type = IPC_GET_ARG5(answer);
    283289        rc = EOK;
  • uspace/srv/vfs/vfs_node.c

    rb7c62a9 r677745a  
    4545#include <async.h>
    4646#include <errno.h>
     47#include <macros.h>
    4748
    4849/** Mutex protecting the VFS node hash table. */
     
    300301}
    301302
     303int64_t vfs_node_get_size(vfs_node_t *node)
     304{
     305        if (node->size == -1) {
     306                sysarg_t sz1 = 0;
     307                sysarg_t sz2 = 0;
     308               
     309                async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
     310                (void) async_req_2_2(exch, VFS_OUT_GET_SIZE,
     311                        node->service_id, node->index, &sz1, &sz2);
     312                vfs_exchange_release(exch);
     313               
     314                node->size = MERGE_LOUP32(sz1, sz2);
     315        }
     316        return node->size;
     317}
     318
    302319/**
    303320 * @}
  • uspace/srv/vfs/vfs_ops.c

    rb7c62a9 r677745a  
    840840        } else {
    841841                if (file->append)
    842                         file->pos = file->node->size;
     842                        file->pos = vfs_node_get_size(file->node);
    843843               
    844844                rc = async_data_write_forward_4_1(fs_exch, VFS_OUT_WRITE,
     
    942942        case SEEK_END:
    943943                fibril_rwlock_read_lock(&file->node->contents_rwlock);
    944                 aoff64_t size = file->node->size;
     944                aoff64_t size = vfs_node_get_size(file->node);
    945945               
    946946                if ((off >= 0) && (size + off < size)) {
Note: See TracChangeset for help on using the changeset viewer.