Changeset 37e7dc54 in mainline


Ignore:
Timestamp:
2007-09-27T15:27:53Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6c117bb
Parents:
bcf23cf
Message:

VFS work.
Modify the protocol so that VFS and FAT (or any other FS) have to share the Path
Lookup Buffer in read-only mode.

Location:
uspace/srv
Files:
3 edited

Legend:

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

    rbcf23cf r37e7dc54  
    4343#include <unistd.h>
    4444#include <stdio.h>
     45#include <as.h>>
    4546#include "../../vfs/vfs.h"
    4647
     
    6263        }
    6364};
     65
     66uint8_t *plb_ro = NULL;
    6467
    6568/**
     
    142145
    143146        /*
     147         * Allocate piece of address space for PLB.
     148         */
     149        plb_ro = as_get_mappable_page(PLB_SIZE);
     150        if (!plb_ro) {
     151                async_wait_for(req, NULL);
     152                return ENOMEM;
     153        }
     154
     155        /*
     156         * Request sharing the Path Lookup Buffer with VFS.
     157         */
     158        rc = ipc_call_sync_3(vfs_phone, IPC_M_AS_AREA_RECV, plb_ro, PLB_SIZE, 0,
     159            NULL, NULL, NULL);
     160        if (rc) {
     161                async_wait_for(req, NULL);
     162                return rc;
     163        }
     164         
     165        /*
    144166         * Create a connection fibril to handle the callback connection.
    145167         */
  • uspace/srv/vfs/vfs.c

    rbcf23cf r37e7dc54  
    121121        list_initialize(&plb_head);
    122122        plb = as_get_mappable_page(PLB_SIZE);
    123 //      memset(plb, 0, PLB_SIZE);
     123        if (!plb) {
     124                printf("Cannot allocate a mappable piece of address space\n");
     125                return ENOMEM;
     126        }
     127        if (as_area_create(plb, PLB_SIZE, AS_AREA_READ | AS_AREA_WRITE |
     128            AS_AREA_CACHEABLE) != plb) {
     129                printf("Cannot create address space area.\n");
     130                return ENOMEM;
     131        }
     132        memset(plb, 0, PLB_SIZE);
    124133       
    125134        /*
  • uspace/srv/vfs/vfs_register.c

    rbcf23cf r37e7dc54  
    4646#include <bool.h>
    4747#include <futex.h>
     48#include <as.h>
    4849#include <libadt/list.h>
    4950#include "vfs.h"
     
    175176                return;
    176177        }
     178
     179        /*
     180         * Allocate and initialize a buffer for the fs_info structure.
     181         */
    177182        fs_info_t *fs_info;
    178 
    179         /*
    180          * Allocate and initialize a buffer for the fs_info structure.
    181          */
    182183        fs_info = (fs_info_t *) malloc(sizeof(fs_info_t));
    183184        if (!fs_info) {
     
    262263        dprintf("Callback connection to FS created.\n");
    263264
     265        /*
     266         * The client will want us to send him the address space area with PLB.
     267         */
     268        callid = async_get_call(&call);
     269        if (IPC_GET_METHOD(call) != IPC_M_AS_AREA_RECV) {
     270                dprintf("Unexpected call, method = %d\n", IPC_GET_METHOD(call));
     271                list_remove(&fs_info->fs_link);
     272                futex_up(&fs_head_futex);
     273                ipc_hangup(fs_info->phone);
     274                free(fs_info);
     275                ipc_answer_fast(callid, EINVAL, 0, 0);
     276                ipc_answer_fast(rid, EINVAL, 0, 0);
     277                return;
     278        }
     279       
     280        /*
     281         * We can only send the client address space area PLB_SIZE bytes long.
     282         */
     283        size = IPC_GET_ARG2(call);
     284        if (size != PLB_SIZE) {
     285                dprintf("Client suggests wrong size of PFB, size = %d\n", size);
     286                list_remove(&fs_info->fs_link);
     287                futex_up(&fs_head_futex);
     288                ipc_hangup(fs_info->phone);
     289                free(fs_info);
     290                ipc_answer_fast(callid, EINVAL, 0, 0);
     291                ipc_answer_fast(rid, EINVAL, 0, 0);
     292                return;
     293               
     294        }
     295
     296        /*
     297         * Commit to read-only sharing the PLB with the client.
     298         */
     299        ipc_answer_fast(callid, EOK, (ipcarg_t) plb,
     300            (ipcarg_t) (AS_AREA_READ | AS_AREA_CACHEABLE));     
     301
     302        dprintf("Sharing PLB.\n");
     303
    264304        futex_up(&fs_head_futex);
    265305
Note: See TracChangeset for help on using the changeset viewer.