Changeset 86ffa27f in mainline for uspace/srv/fs/ext2fs


Ignore:
Timestamp:
2011-08-07T11:21:44Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cc574511
Parents:
15f3c3f (diff), e8067c0 (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.

Location:
uspace/srv/fs/ext2fs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/ext2fs/ext2fs.c

    r15f3c3f r86ffa27f  
    11/*
    22 * Copyright (c) 2006 Martin Decky
    3  * Copyright (c) 2008 Jakub Jermar
    43 * Copyright (c) 2011 Martin Sucha
    54 * All rights reserved.
     
    5554};
    5655
    57 fs_reg_t ext2fs_reg;
    58 
    59 /**
    60  * This connection fibril processes VFS requests from VFS.
    61  *
    62  * In order to support simultaneous VFS requests, our design is as follows.
    63  * The connection fibril accepts VFS requests from VFS. If there is only one
    64  * instance of the fibril, VFS will need to serialize all VFS requests it sends
    65  * to EXT2FS. To overcome this bottleneck, VFS can send EXT2FS the IPC_M_CONNECT_ME_TO
    66  * call. In that case, a new connection fibril will be created, which in turn
    67  * will accept the call. Thus, a new phone will be opened for VFS.
    68  *
    69  * There are few issues with this arrangement. First, VFS can run out of
    70  * available phones. In that case, VFS can close some other phones or use one
    71  * phone for more serialized requests. Similarily, EXT2FS can refuse to duplicate
    72  * the connection. VFS should then just make use of already existing phones and
    73  * route its requests through them. To avoid paying the fibril creation price
    74  * upon each request, EXT2FS might want to keep the connections open after the
    75  * request has been completed.
    76  */
    77 static void ext2fs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    78 {
    79         if (iid) {
    80                 /*
    81                  * This only happens for connections opened by
    82                  * IPC_M_CONNECT_ME_TO calls as opposed to callback connections
    83                  * created by IPC_M_CONNECT_TO_ME.
    84                  */
    85                 async_answer_0(iid, EOK);
    86         }
    87        
    88         dprintf(NAME ": connection opened\n");
    89         while (true) {
    90                 ipc_call_t call;
    91                 ipc_callid_t callid = async_get_call(&call);
    92                
    93                 if (!IPC_GET_IMETHOD(call))
    94                         return;
    95                
    96                 switch (IPC_GET_IMETHOD(call)) {
    97                 case VFS_OUT_MOUNTED:
    98                         ext2fs_mounted(callid, &call);
    99                         break;
    100                 case VFS_OUT_MOUNT:
    101                         ext2fs_mount(callid, &call);
    102                         break;
    103                 case VFS_OUT_UNMOUNTED:
    104                         ext2fs_unmounted(callid, &call);
    105                         break;
    106                 case VFS_OUT_UNMOUNT:
    107                         ext2fs_unmount(callid, &call);
    108                         break;
    109                 case VFS_OUT_LOOKUP:
    110                         ext2fs_lookup(callid, &call);
    111                         break;
    112                 case VFS_OUT_READ:
    113                         ext2fs_read(callid, &call);
    114                         break;
    115                 case VFS_OUT_WRITE:
    116                         ext2fs_write(callid, &call);
    117                         break;
    118                 case VFS_OUT_TRUNCATE:
    119                         ext2fs_truncate(callid, &call);
    120                         break;
    121                 case VFS_OUT_STAT:
    122                         ext2fs_stat(callid, &call);
    123                         break;
    124                 case VFS_OUT_CLOSE:
    125                         ext2fs_close(callid, &call);
    126                         break;
    127                 case VFS_OUT_DESTROY:
    128                         ext2fs_destroy(callid, &call);
    129                         break;
    130                 case VFS_OUT_OPEN_NODE:
    131                         ext2fs_open_node(callid, &call);
    132                         break;
    133                 case VFS_OUT_SYNC:
    134                         ext2fs_sync(callid, &call);
    135                         break;
    136                 default:
    137                         async_answer_0(callid, ENOTSUP);
    138                         break;
    139                 }
    140         }
    141 }
    142 
    14356int main(int argc, char **argv)
    14457{
     
    15871        }       
    15972               
    160         rc = fs_register(vfs_sess, &ext2fs_reg, &ext2fs_vfs_info, ext2fs_connection);
     73        rc = fs_register(vfs_sess, &ext2fs_vfs_info, &ext2fs_ops,
     74            &ext2fs_libfs_ops);
    16175        if (rc != EOK) {
    16276                fprintf(stdout, NAME ": Failed to register fs (%d)\n", rc);
  • uspace/srv/fs/ext2fs/ext2fs.h

    r15f3c3f r86ffa27f  
    11/*
    2  * Copyright (c) 2008 Jakub Jermar
    32 * Copyright (c) 2011 Martin Sucha
    43 * All rights reserved.
     
    3635
    3736#include <libext2.h>
    38 #include <fibril_synch.h>
    3937#include <libfs.h>
    40 #include <atomic.h>
    4138#include <sys/types.h>
    42 #include <bool.h>
    43 #include "../../vfs/vfs.h"
    44 
    45 #ifndef dprintf
    46 #define dprintf(...)    printf(__VA_ARGS__)
    47 #endif
    4839
    4940#define min(a, b)               ((a) < (b) ? (a) : (b))
    5041
    51 extern fs_reg_t ext2fs_reg;
     42extern vfs_out_ops_t ext2fs_ops;
     43extern libfs_ops_t ext2fs_libfs_ops;
    5244
    5345extern int ext2fs_global_init(void);
    5446extern int ext2fs_global_fini(void);
    55 extern void ext2fs_mounted(ipc_callid_t, ipc_call_t *);
    56 extern void ext2fs_mount(ipc_callid_t, ipc_call_t *);
    57 extern void ext2fs_unmounted(ipc_callid_t, ipc_call_t *);
    58 extern void ext2fs_unmount(ipc_callid_t, ipc_call_t *);
    59 extern void ext2fs_lookup(ipc_callid_t, ipc_call_t *);
    60 extern void ext2fs_read(ipc_callid_t, ipc_call_t *);
    61 extern void ext2fs_write(ipc_callid_t, ipc_call_t *);
    62 extern void ext2fs_truncate(ipc_callid_t, ipc_call_t *);
    63 extern void ext2fs_stat(ipc_callid_t, ipc_call_t *);
    64 extern void ext2fs_close(ipc_callid_t, ipc_call_t *);
    65 extern void ext2fs_destroy(ipc_callid_t, ipc_call_t *);
    66 extern void ext2fs_open_node(ipc_callid_t, ipc_call_t *);
    67 extern void ext2fs_stat(ipc_callid_t, ipc_call_t *);
    68 extern void ext2fs_sync(ipc_callid_t, ipc_call_t *);
    6947
    7048#endif
  • uspace/srv/fs/ext2fs/ext2fs_ops.c

    r15f3c3f r86ffa27f  
    11/*
    2  * Copyright (c) 2008 Jakub Jermar
    32 * Copyright (c) 2011 Martin Sucha
    43 * All rights reserved.
     
    8786 */
    8887static int ext2fs_instance_get(service_id_t, ext2fs_instance_t **);
    89 static void ext2fs_read_directory(ipc_callid_t, ipc_callid_t, aoff64_t,
    90         size_t, ext2fs_instance_t *, ext2_inode_ref_t *);
    91 static void ext2fs_read_file(ipc_callid_t, ipc_callid_t, aoff64_t,
    92         size_t, ext2fs_instance_t *, ext2_inode_ref_t *);
     88static int ext2fs_read_directory(ipc_callid_t, aoff64_t, size_t,
     89    ext2fs_instance_t *, ext2_inode_ref_t *, size_t *);
     90static int ext2fs_read_file(ipc_callid_t, aoff64_t, size_t, ext2fs_instance_t *,
     91    ext2_inode_ref_t *, size_t *);
    9392static bool ext2fs_is_dots(const uint8_t *, size_t);
    9493static int ext2fs_node_get_core(fs_node_t **, ext2fs_instance_t *, fs_index_t);
     
    111110static aoff64_t ext2fs_size_get(fs_node_t *);
    112111static unsigned ext2fs_lnkcnt_get(fs_node_t *);
    113 static char ext2fs_plb_get_char(unsigned);
    114112static bool ext2fs_is_directory(fs_node_t *);
    115113static bool ext2fs_is_file(fs_node_t *node);
     
    240238        }
    241239       
    242         rc = ext2_directory_iterator_init(&it, fs, eparent->inode_ref);
     240        rc = ext2_directory_iterator_init(&it, fs, eparent->inode_ref, 0);
    243241        if (rc != EOK) {
    244242                return rc;
     
    478476        }
    479477       
    480         rc = ext2_directory_iterator_init(&it, fs, enode->inode_ref);
     478        rc = ext2_directory_iterator_init(&it, fs, enode->inode_ref, 0);
    481479        if (rc != EOK) {
    482480                EXT2FS_DBG("error %u", rc);
     
    538536        EXT2FS_DBG("%u", count);
    539537        return count;
    540 }
    541 
    542 char ext2fs_plb_get_char(unsigned pos)
    543 {
    544         return ext2fs_reg.plb_ro[pos % PLB_SIZE];
    545538}
    546539
     
    586579        .size_get = ext2fs_size_get,
    587580        .lnkcnt_get = ext2fs_lnkcnt_get,
    588         .plb_get_char = ext2fs_plb_get_char,
    589581        .is_directory = ext2fs_is_directory,
    590582        .is_file = ext2fs_is_file,
     
    596588 */
    597589
    598 void ext2fs_mounted(ipc_callid_t rid, ipc_call_t *request)
    599 {
    600         EXT2FS_DBG("");
    601         int rc;
    602         service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
     590static int ext2fs_mounted(service_id_t service_id, const char *opts,
     591   fs_index_t *index, aoff64_t *size, unsigned *lnkcnt)
     592{
     593        EXT2FS_DBG("");
     594        int rc;
    603595        ext2_filesystem_t *fs;
    604596        ext2fs_instance_t *inst;
    605597        bool read_only;
    606598       
    607         /* Accept the mount options */
    608         char *opts;
    609         rc = async_data_write_accept((void **) &opts, true, 0, 0, 0, NULL);
    610        
    611         if (rc != EOK) {
    612                 async_answer_0(rid, rc);
    613                 return;
    614         }
    615 
    616         free(opts);
    617        
    618599        /* Allocate libext2 filesystem structure */
    619600        fs = (ext2_filesystem_t *) malloc(sizeof(ext2_filesystem_t));
    620         if (fs == NULL) {
    621                 async_answer_0(rid, ENOMEM);
    622                 return;
    623         }
     601        if (fs == NULL)
     602                return ENOMEM;
    624603       
    625604        /* Allocate instance structure */
     
    627606        if (inst == NULL) {
    628607                free(fs);
    629                 async_answer_0(rid, ENOMEM);
    630                 return;
     608                return ENOMEM;
    631609        }
    632610       
     
    636614                free(fs);
    637615                free(inst);
    638                 async_answer_0(rid, rc);
    639                 return;
     616                return rc;
    640617        }
    641618       
     
    646623                free(fs);
    647624                free(inst);
    648                 async_answer_0(rid, rc);
    649                 return;
     625                return rc;
    650626        }
    651627       
     
    656632                free(fs);
    657633                free(inst);
    658                 async_answer_0(rid, rc);
    659                 return;
     634                return rc;
    660635        }
    661636       
     
    673648                free(fs);
    674649                free(inst);
    675                 async_answer_0(rid, rc);
    676                 return;
     650                return rc;
    677651        }
    678652        ext2fs_node_t *enode = EXT2FS_NODE(root_node);
     
    683657        fibril_mutex_unlock(&instance_list_mutex);
    684658       
    685         async_answer_3(rid, EOK,
    686             EXT2_INODE_ROOT_INDEX,
    687             0,
    688             ext2_inode_get_usage_count(enode->inode_ref->inode));
     659        *index = EXT2_INODE_ROOT_INDEX;
     660        *size = 0;
     661        *lnkcnt = ext2_inode_get_usage_count(enode->inode_ref->inode);
    689662       
    690663        ext2fs_node_put(root_node);
    691 }
    692 
    693 void ext2fs_mount(ipc_callid_t rid, ipc_call_t *request)
    694 {
    695         EXT2FS_DBG("");
    696         libfs_mount(&ext2fs_libfs_ops, ext2fs_reg.fs_handle, rid, request);
    697 }
    698 
    699 void ext2fs_unmounted(ipc_callid_t rid, ipc_call_t *request)
    700 {
    701         EXT2FS_DBG("");
    702         service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
     664
     665        return EOK;
     666}
     667
     668static int ext2fs_unmounted(service_id_t service_id)
     669{
     670        EXT2FS_DBG("");
    703671        ext2fs_instance_t *inst;
    704672        int rc;
     
    706674        rc = ext2fs_instance_get(service_id, &inst);
    707675       
    708         if (rc != EOK) {
    709                 async_answer_0(rid, rc);
    710                 return;
    711         }
     676        if (rc != EOK)
     677                return rc;
    712678       
    713679        fibril_mutex_lock(&open_nodes_lock);
     
    716682        if (inst->open_nodes_count != 0) {
    717683                fibril_mutex_unlock(&open_nodes_lock);
    718                 async_answer_0(rid, EBUSY);
    719                 return;
     684                return EBUSY;
    720685        }
    721686       
     
    729694        ext2_filesystem_fini(inst->filesystem);
    730695       
    731         async_answer_0(rid, EOK);
    732 }
    733 
    734 void ext2fs_unmount(ipc_callid_t rid, ipc_call_t *request)
    735 {
    736         EXT2FS_DBG("");
    737         libfs_unmount(&ext2fs_libfs_ops, rid, request);
    738 }
    739 
    740 void ext2fs_lookup(ipc_callid_t rid, ipc_call_t *request)
    741 {
    742         EXT2FS_DBG("");
    743         libfs_lookup(&ext2fs_libfs_ops, ext2fs_reg.fs_handle, rid, request);
    744 }
    745 
    746 void ext2fs_read(ipc_callid_t rid, ipc_call_t *request)
    747 {
    748         EXT2FS_DBG("");
    749         service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    750         fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    751         aoff64_t pos =
    752             (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request));
     696        return EOK;
     697}
     698
     699static int
     700ext2fs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
     701    size_t *rbytes)
     702{
     703        EXT2FS_DBG("");
    753704       
    754705        ext2fs_instance_t *inst;
     
    763714        if (!async_data_read_receive(&callid, &size)) {
    764715                async_answer_0(callid, EINVAL);
    765                 async_answer_0(rid, EINVAL);
    766                 return;
     716                return EINVAL;
    767717        }
    768718       
     
    770720        if (rc != EOK) {
    771721                async_answer_0(callid, rc);
    772                 async_answer_0(rid, rc);
    773                 return;
     722                return rc;
    774723        }
    775724       
     
    777726        if (rc != EOK) {
    778727                async_answer_0(callid, rc);
    779                 async_answer_0(rid, rc);
    780                 return;
     728                return rc;
    781729        }
    782730       
    783731        if (ext2_inode_is_type(inst->filesystem->superblock, inode_ref->inode,
    784                     EXT2_INODE_MODE_FILE)) {
    785                 ext2fs_read_file(rid, callid, pos, size, inst, inode_ref);
    786         }
    787         else if (ext2_inode_is_type(inst->filesystem->superblock, inode_ref->inode,
    788                     EXT2_INODE_MODE_DIRECTORY)) {
    789                 ext2fs_read_directory(rid, callid, pos, size, inst, inode_ref);
    790         }
    791         else {
     732            EXT2_INODE_MODE_FILE)) {
     733                rc = ext2fs_read_file(callid, pos, size, inst, inode_ref,
     734                    rbytes);
     735        } else if (ext2_inode_is_type(inst->filesystem->superblock,
     736            inode_ref->inode, EXT2_INODE_MODE_DIRECTORY)) {
     737                rc = ext2fs_read_directory(callid, pos, size, inst, inode_ref,
     738                    rbytes);
     739        } else {
    792740                /* Other inode types not supported */
    793741                async_answer_0(callid, ENOTSUP);
    794                 async_answer_0(rid, ENOTSUP);
     742                rc = ENOTSUP;
    795743        }
    796744       
    797745        ext2_filesystem_put_inode_ref(inode_ref);
    798746       
     747        return rc;
    799748}
    800749
     
    814763}
    815764
    816 void ext2fs_read_directory(ipc_callid_t rid, ipc_callid_t callid, aoff64_t pos,
    817         size_t size, ext2fs_instance_t *inst, ext2_inode_ref_t *inode_ref)
     765int ext2fs_read_directory(ipc_callid_t callid, aoff64_t pos, size_t size,
     766    ext2fs_instance_t *inst, ext2_inode_ref_t *inode_ref, size_t *rbytes)
    818767{
    819768        ext2_directory_iterator_t it;
    820         aoff64_t cur;
     769        aoff64_t next;
    821770        uint8_t *buf;
    822771        size_t name_size;
     
    824773        bool found = false;
    825774       
    826         rc = ext2_directory_iterator_init(&it, inst->filesystem, inode_ref);
     775        rc = ext2_directory_iterator_init(&it, inst->filesystem, inode_ref, pos);
    827776        if (rc != EOK) {
    828777                async_answer_0(callid, rc);
    829                 async_answer_0(rid, rc);
    830                 return;
    831         }
    832        
    833         /* Find the index we want to read
    834          * Note that we need to iterate and count as
    835          * the underlying structure is a linked list
    836          * Moreover, we want to skip . and .. entries
     778                return rc;
     779        }
     780       
     781        /* Find next interesting directory entry.
     782         * We want to skip . and .. entries
    837783         * as these are not used in HelenOS
    838784         */
    839         cur = 0;
    840785        while (it.current != NULL) {
    841786                if (it.current->inode == 0) {
     
    844789               
    845790                name_size = ext2_directory_entry_ll_get_name_length(
    846                         inst->filesystem->superblock, it.current);
     791                    inst->filesystem->superblock, it.current);
    847792               
    848793                /* skip . and .. */
     
    851796                }
    852797               
    853                 /* Is this the dir entry we want to read? */
    854                 if (cur == pos) {
    855                         /* The on-disk entry does not contain \0 at the end
    856                          * end of entry name, so we copy it to new buffer
    857                          * and add the \0 at the end
    858                          */
    859                         buf = malloc(name_size+1);
    860                         if (buf == NULL) {
    861                                 ext2_directory_iterator_fini(&it);
    862                                 async_answer_0(callid, ENOMEM);
    863                                 async_answer_0(rid, ENOMEM);
    864                                 return;
    865                         }
    866                         memcpy(buf, &it.current->name, name_size);
    867                         *(buf+name_size) = 0;
    868                         found = true;
    869                         (void) async_data_read_finalize(callid, buf, name_size+1);
    870                         free(buf);
    871                         break;
    872                 }
    873                 cur++;
     798                /* The on-disk entry does not contain \0 at the end
     799                 * end of entry name, so we copy it to new buffer
     800                 * and add the \0 at the end
     801                 */
     802                buf = malloc(name_size+1);
     803                if (buf == NULL) {
     804                        ext2_directory_iterator_fini(&it);
     805                        async_answer_0(callid, ENOMEM);
     806                        return ENOMEM;
     807                }
     808                memcpy(buf, &it.current->name, name_size);
     809                *(buf + name_size) = 0;
     810                found = true;
     811                (void) async_data_read_finalize(callid, buf, name_size + 1);
     812                free(buf);
     813                break;
    874814               
    875815skip:
     
    878818                        ext2_directory_iterator_fini(&it);
    879819                        async_answer_0(callid, rc);
    880                         async_answer_0(rid, rc);
    881                         return;
    882                 }
     820                        return rc;
     821                }
     822        }
     823       
     824        if (found) {
     825                rc = ext2_directory_iterator_next(&it);
     826                if (rc != EOK)
     827                        return rc;
     828                next = it.current_offset;
    883829        }
    884830       
    885831        rc = ext2_directory_iterator_fini(&it);
    886         if (rc != EOK) {
    887                 async_answer_0(rid, rc);
    888                 return;
    889         }
     832        if (rc != EOK)
     833                return rc;
    890834       
    891835        if (found) {
    892                 async_answer_1(rid, EOK, 1);
    893         }
    894         else {
     836                *rbytes = next - pos;
     837                return EOK;
     838        } else {
    895839                async_answer_0(callid, ENOENT);
    896                 async_answer_0(rid, ENOENT);
    897         }
    898 }
    899 
    900 void ext2fs_read_file(ipc_callid_t rid, ipc_callid_t callid, aoff64_t pos,
    901         size_t size, ext2fs_instance_t *inst, ext2_inode_ref_t *inode_ref)
     840                return ENOENT;
     841        }
     842}
     843
     844int ext2fs_read_file(ipc_callid_t callid, aoff64_t pos, size_t size,
     845    ext2fs_instance_t *inst, ext2_inode_ref_t *inode_ref, size_t *rbytes)
    902846{
    903847        int rc;
     
    917861                /* Read 0 bytes successfully */
    918862                async_data_read_finalize(callid, NULL, 0);
    919                 async_answer_1(rid, EOK, 0);
    920                 return;
     863                *rbytes = 0;
     864                return EOK;
    921865        }
    922866       
     
    937881        if (rc != EOK) {
    938882                async_answer_0(callid, rc);
    939                 async_answer_0(rid, rc);
    940                 return;
     883                return rc;
    941884        }
    942885       
     
    950893                if (buffer == NULL) {
    951894                        async_answer_0(callid, ENOMEM);
    952                         async_answer_0(rid, ENOMEM);
    953                         return;
     895                        return ENOMEM;
    954896                }
    955897               
     
    957899               
    958900                async_data_read_finalize(callid, buffer, bytes);
    959                 async_answer_1(rid, EOK, bytes);
     901                *rbytes = bytes;
    960902               
    961903                free(buffer);
    962904               
    963                 return;
     905                return EOK;
    964906        }
    965907       
     
    968910        if (rc != EOK) {
    969911                async_answer_0(callid, rc);
    970                 async_answer_0(rid, rc);
    971                 return;
     912                return rc;
    972913        }
    973914       
     
    976917       
    977918        rc = block_put(block);
    978         if (rc != EOK) {
    979                 async_answer_0(rid, rc);
    980                 return;
    981         }
    982                
    983         async_answer_1(rid, EOK, bytes);
    984 }
    985 
    986 void ext2fs_write(ipc_callid_t rid, ipc_call_t *request)
    987 {
    988         EXT2FS_DBG("");
    989 //      service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    990 //      fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    991 //      aoff64_t pos =
    992 //          (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request));
    993        
    994         // TODO
    995         async_answer_0(rid, ENOTSUP);
    996 }
    997 
    998 void ext2fs_truncate(ipc_callid_t rid, ipc_call_t *request)
    999 {
    1000         EXT2FS_DBG("");
    1001 //      service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    1002 //      fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    1003 //      aoff64_t size =
    1004 //          (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), IPC_GET_ARG4(*request));
    1005        
    1006         // TODO
    1007         async_answer_0(rid, ENOTSUP);
    1008 }
    1009 
    1010 void ext2fs_close(ipc_callid_t rid, ipc_call_t *request)
    1011 {
    1012         EXT2FS_DBG("");
    1013         async_answer_0(rid, EOK);
    1014 }
    1015 
    1016 void ext2fs_destroy(ipc_callid_t rid, ipc_call_t *request)
    1017 {
    1018         EXT2FS_DBG("");
    1019 //      service_id_t service_id = (service_id_t)IPC_GET_ARG1(*request);
    1020 //      fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
    1021        
    1022         // TODO
    1023         async_answer_0(rid, ENOTSUP);
    1024 }
    1025 
    1026 void ext2fs_open_node(ipc_callid_t rid, ipc_call_t *request)
    1027 {
    1028         EXT2FS_DBG("");
    1029         libfs_open_node(&ext2fs_libfs_ops, ext2fs_reg.fs_handle, rid, request);
    1030 }
    1031 
    1032 void ext2fs_stat(ipc_callid_t rid, ipc_call_t *request)
    1033 {
    1034         EXT2FS_DBG("");
    1035         libfs_stat(&ext2fs_libfs_ops, ext2fs_reg.fs_handle, rid, request);
    1036 }
    1037 
    1038 void ext2fs_sync(ipc_callid_t rid, ipc_call_t *request)
    1039 {
    1040         EXT2FS_DBG("");
    1041 //      service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request);
    1042 //      fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request);
    1043        
    1044         // TODO
    1045         async_answer_0(rid, ENOTSUP);
    1046 }
     919        if (rc != EOK)
     920                return rc;
     921       
     922        *rbytes = bytes;
     923        return EOK;
     924}
     925
     926static int
     927ext2fs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
     928    size_t *wbytes, aoff64_t *nsize)
     929{
     930        EXT2FS_DBG("");
     931        return ENOTSUP;
     932}
     933
     934static int
     935ext2fs_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
     936{
     937        EXT2FS_DBG("");
     938        return ENOTSUP;
     939}
     940
     941static int ext2fs_close(service_id_t service_id, fs_index_t index)
     942{
     943        EXT2FS_DBG("");
     944        return EOK;
     945}
     946
     947static int ext2fs_destroy(service_id_t service_id, fs_index_t index)
     948{
     949        EXT2FS_DBG("");
     950        return ENOTSUP;
     951}
     952
     953static int ext2fs_sync(service_id_t service_id, fs_index_t index)
     954{
     955        EXT2FS_DBG("");
     956        return ENOTSUP;
     957}
     958
     959vfs_out_ops_t ext2fs_ops = {
     960        .mounted = ext2fs_mounted,
     961        .unmounted = ext2fs_unmounted,
     962        .read = ext2fs_read,
     963        .write = ext2fs_write,
     964        .truncate = ext2fs_truncate,
     965        .close = ext2fs_close,
     966        .destroy = ext2fs_destroy,
     967        .sync = ext2fs_sync,
     968};
    1047969
    1048970/**
    1049971 * @}
    1050972 */
     973
Note: See TracChangeset for help on using the changeset viewer.