Changeset 79d031b in mainline


Ignore:
Timestamp:
2008-08-12T20:47:16Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c06dbf9
Parents:
4bf40f6
Message:

More complete fat_read().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_ops.c

    r4bf40f6 r79d031b  
    7070#define FAT_DENTRY_DOT          0x2e
    7171#define FAT_DENTRY_ERASED       0xe5
     72
     73#define min(a, b)               ((a) < (b) ? (a) : (b))
    7274
    7375static void dentry_name_canonify(fat_dentry_t *d, char *buf)
     
    713715        off_t pos = (off_t)IPC_GET_ARG3(*request);
    714716        fat_node_t *nodep = (fat_node_t *)fat_node_get(dev_handle, index);
     717        uint16_t bps = fat_bps_get(dev_handle);
     718        size_t bytes;
     719
    715720        if (!nodep) {
    716721                ipc_answer_0(rid, ENOENT);
     
    728733
    729734        if (nodep->type == FAT_FILE) {
    730                 /* TODO */
    731                 fat_node_put(nodep);
    732                 ipc_answer_0(callid, ENOTSUP);
    733                 ipc_answer_0(rid, ENOTSUP);
    734                 return;
     735                block_t *b;
     736
     737                bytes = min(len, bps - pos % bps);
     738                b = fat_block_get(nodep, pos / bps);
     739                (void) ipc_data_read_finalize(callid, b->data + pos % bps,
     740                    bytes);
     741                block_put(b);
    735742        } else {
    736743                assert(nodep->type == FAT_DIRECTORY);
     
    743750
    744751        fat_node_put(nodep);
     752        ipc_answer_1(rid, EOK, (ipcarg_t)bytes);
    745753}
    746754
Note: See TracChangeset for help on using the changeset viewer.