Changeset c028b22 in mainline for uspace/srv/fs/tmpfs


Ignore:
Timestamp:
2011-07-08T17:01:01Z (15 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cc1a727
Parents:
4e36219 (diff), 026793d (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/tmpfs
Files:
4 edited

Legend:

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

    r4e36219 rc028b22  
    3030/** @addtogroup fs
    3131 * @{
    32  */ 
     32 */
    3333
    3434/**
     
    4343#include "tmpfs.h"
    4444#include <ipc/services.h>
    45 #include <ipc/ns.h>
     45#include <ns.h>
    4646#include <async.h>
    4747#include <errno.h>
     
    8282 * request has been completed.
    8383 */
    84 static void tmpfs_connection(ipc_callid_t iid, ipc_call_t *icall)
     84static void tmpfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    8585{
    8686        if (iid) {
     
    9494       
    9595        dprintf(NAME ": connection opened\n");
    96         while (1) {
    97                 ipc_callid_t callid;
     96       
     97        while (true) {
    9898                ipc_call_t call;
    99        
    100                 callid = async_get_call(&call);
    101                 switch  (IPC_GET_IMETHOD(call)) {
    102                 case IPC_M_PHONE_HUNGUP:
     99                ipc_callid_t callid = async_get_call(&call);
     100               
     101                if (!IPC_GET_IMETHOD(call))
    103102                        return;
     103               
     104                switch (IPC_GET_IMETHOD(call)) {
    104105                case VFS_OUT_MOUNTED:
    105106                        tmpfs_mounted(callid, &call);
     
    151152{
    152153        printf(NAME ": HelenOS TMPFS file system server\n");
    153 
     154       
    154155        if (!tmpfs_init()) {
    155156                printf(NAME ": failed to initialize TMPFS\n");
    156157                return -1;
    157158        }
    158 
    159         int vfs_phone = service_connect_blocking(SERVICE_VFS, 0, 0);
    160         if (vfs_phone < EOK) {
     159       
     160        async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
     161            SERVICE_VFS, 0, 0);
     162        if (!vfs_sess) {
    161163                printf(NAME ": Unable to connect to VFS\n");
    162164                return -1;
    163165        }
    164 
    165         int rc = fs_register(vfs_phone, &tmpfs_reg, &tmpfs_vfs_info,
     166       
     167        int rc = fs_register(vfs_sess, &tmpfs_reg, &tmpfs_vfs_info,
    166168            tmpfs_connection);
    167169        if (rc != EOK) {
     
    169171                return rc;
    170172        }
    171 
     173       
    172174        printf(NAME ": Accepting connections\n");
    173175        task_retval(0);
    174176        async_manager();
    175         /* not reached */
     177       
     178        /* Not reached */
    176179        return 0;
    177180}
     
    179182/**
    180183 * @}
    181  */ 
     184 */
  • uspace/srv/fs/tmpfs/tmpfs.h

    r4e36219 rc028b22  
    6767        size_t size;            /**< File size if type is TMPFS_FILE. */
    6868        void *data;             /**< File content's if type is TMPFS_FILE. */
    69         link_t cs_head;         /**< Head of child's siblings list. */
     69        list_t cs_list;         /**< Child's siblings list. */
    7070} tmpfs_node_t;
    7171
  • uspace/srv/fs/tmpfs/tmpfs_dump.c

    r4e36219 rc028b22  
    167167        int rc;
    168168
    169         rc = block_init(dev, TMPFS_COMM_SIZE);
     169        rc = block_init(EXCHANGE_SERIALIZE, dev, TMPFS_COMM_SIZE);
    170170        if (rc != EOK)
    171171                return false;
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    r4e36219 rc028b22  
    8585static int tmpfs_has_children(bool *has_children, fs_node_t *fn)
    8686{
    87         *has_children = !list_empty(&TMPFS_NODE(fn)->cs_head);
     87        *has_children = !list_empty(&TMPFS_NODE(fn)->cs_list);
    8888        return EOK;
    8989}
     
    180180            nh_link);
    181181
    182         while (!list_empty(&nodep->cs_head)) {
    183                 tmpfs_dentry_t *dentryp = list_get_instance(nodep->cs_head.next,
    184                     tmpfs_dentry_t, link);
     182        while (!list_empty(&nodep->cs_list)) {
     183                tmpfs_dentry_t *dentryp = list_get_instance(
     184                    list_first(&nodep->cs_list), tmpfs_dentry_t, link);
    185185
    186186                assert(nodep->type == TMPFS_DIRECTORY);
     
    214214        nodep->data = NULL;
    215215        link_initialize(&nodep->nh_link);
    216         list_initialize(&nodep->cs_head);
     216        list_initialize(&nodep->cs_list);
    217217}
    218218
     
    262262{
    263263        tmpfs_node_t *parentp = TMPFS_NODE(pfn);
    264         link_t *lnk;
    265 
    266         for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head;
    267             lnk = lnk->next) {
     264
     265        list_foreach(parentp->cs_list, lnk) {
    268266                tmpfs_dentry_t *dentryp;
    269267                dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
     
    353351       
    354352        assert(!nodep->lnkcnt);
    355         assert(list_empty(&nodep->cs_head));
     353        assert(list_empty(&nodep->cs_list));
    356354
    357355        unsigned long key[] = {
     
    373371        tmpfs_node_t *childp = TMPFS_NODE(cfn);
    374372        tmpfs_dentry_t *dentryp;
    375         link_t *lnk;
    376373
    377374        assert(parentp->type == TMPFS_DIRECTORY);
    378375
    379376        /* Check for duplicit entries. */
    380         for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head;
    381             lnk = lnk->next) {
     377        list_foreach(parentp->cs_list, lnk) {
    382378                dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
    383379                if (!str_cmp(dentryp->name, nm))
     
    401397        dentryp->node = childp;
    402398        childp->lnkcnt++;
    403         list_append(&dentryp->link, &parentp->cs_head);
     399        list_append(&dentryp->link, &parentp->cs_list);
    404400
    405401        return EOK;
     
    411407        tmpfs_node_t *childp = NULL;
    412408        tmpfs_dentry_t *dentryp;
    413         link_t *lnk;
    414409
    415410        if (!parentp)
    416411                return EBUSY;
    417412       
    418         for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head;
    419             lnk = lnk->next) {
     413        list_foreach(parentp->cs_list, lnk) {
    420414                dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
    421415                if (!str_cmp(dentryp->name, nm)) {
     
    423417                        assert(FS_NODE(childp) == cfn);
    424418                        break;
    425                 }       
     419                }
    426420        }
    427421
     
    429423                return ENOENT;
    430424               
    431         if ((childp->lnkcnt == 1) && !list_empty(&childp->cs_head))
     425        if ((childp->lnkcnt == 1) && !list_empty(&childp->cs_list))
    432426                return ENOTEMPTY;
    433427
     
    550544                tmpfs_dentry_t *dentryp;
    551545                link_t *lnk;
    552                 aoff64_t i;
    553546               
    554547                assert(nodep->type == TMPFS_DIRECTORY);
     
    559552                 * hash table.
    560553                 */
    561                 for (i = 0, lnk = nodep->cs_head.next;
    562                     (i < pos) && (lnk != &nodep->cs_head);
    563                     i++, lnk = lnk->next)
    564                         ;
    565 
    566                 if (lnk == &nodep->cs_head) {
     554                lnk = list_nth(&nodep->cs_list, pos);
     555               
     556                if (lnk == NULL) {
    567557                        async_answer_0(callid, ENOENT);
    568558                        async_answer_1(rid, ENOENT, 0);
Note: See TracChangeset for help on using the changeset viewer.