Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2542 → Rev 2543

/trunk/uspace/srv/fs/fat/fat.c
42,6 → 42,7
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <as.h>>
#include "../../vfs/vfs.h"
 
#define dprintf(...) printf(__VA_ARGS__)
62,6 → 63,8
}
};
 
uint8_t *plb_ro = NULL;
 
/**
* This connection fibril processes VFS requests from VFS.
*
141,6 → 144,25
ipc_connect_to_me(vfs_phone, 0, 0, &phonehash);
 
/*
* Allocate piece of address space for PLB.
*/
plb_ro = as_get_mappable_page(PLB_SIZE);
if (!plb_ro) {
async_wait_for(req, NULL);
return ENOMEM;
}
 
/*
* Request sharing the Path Lookup Buffer with VFS.
*/
rc = ipc_call_sync_3(vfs_phone, IPC_M_AS_AREA_RECV, plb_ro, PLB_SIZE, 0,
NULL, NULL, NULL);
if (rc) {
async_wait_for(req, NULL);
return rc;
}
/*
* Create a connection fibril to handle the callback connection.
*/
async_new_connection(phonehash, 0, NULL, fat_connection);
/trunk/uspace/srv/vfs/vfs.c
120,7 → 120,16
*/
list_initialize(&plb_head);
plb = as_get_mappable_page(PLB_SIZE);
// memset(plb, 0, PLB_SIZE);
if (!plb) {
printf("Cannot allocate a mappable piece of address space\n");
return ENOMEM;
}
if (as_area_create(plb, PLB_SIZE, AS_AREA_READ | AS_AREA_WRITE |
AS_AREA_CACHEABLE) != plb) {
printf("Cannot create address space area.\n");
return ENOMEM;
}
memset(plb, 0, PLB_SIZE);
/*
* Set a connectio handling function/fibril.
/trunk/uspace/srv/vfs/vfs_register.c
45,6 → 45,7
#include <ctype.h>
#include <bool.h>
#include <futex.h>
#include <as.h>
#include <libadt/list.h>
#include "vfs.h"
 
174,11 → 175,11
ipc_answer_fast(rid, EINVAL, 0, 0);
return;
}
fs_info_t *fs_info;
 
/*
* Allocate and initialize a buffer for the fs_info structure.
*/
fs_info_t *fs_info;
fs_info = (fs_info_t *) malloc(sizeof(fs_info_t));
if (!fs_info) {
dprintf("Could not allocate memory for FS info.\n");
261,6 → 262,45
 
dprintf("Callback connection to FS created.\n");
 
/*
* The client will want us to send him the address space area with PLB.
*/
callid = async_get_call(&call);
if (IPC_GET_METHOD(call) != IPC_M_AS_AREA_RECV) {
dprintf("Unexpected call, method = %d\n", IPC_GET_METHOD(call));
list_remove(&fs_info->fs_link);
futex_up(&fs_head_futex);
ipc_hangup(fs_info->phone);
free(fs_info);
ipc_answer_fast(callid, EINVAL, 0, 0);
ipc_answer_fast(rid, EINVAL, 0, 0);
return;
}
/*
* We can only send the client address space area PLB_SIZE bytes long.
*/
size = IPC_GET_ARG2(call);
if (size != PLB_SIZE) {
dprintf("Client suggests wrong size of PFB, size = %d\n", size);
list_remove(&fs_info->fs_link);
futex_up(&fs_head_futex);
ipc_hangup(fs_info->phone);
free(fs_info);
ipc_answer_fast(callid, EINVAL, 0, 0);
ipc_answer_fast(rid, EINVAL, 0, 0);
return;
}
 
/*
* Commit to read-only sharing the PLB with the client.
*/
ipc_answer_fast(callid, EOK, (ipcarg_t) plb,
(ipcarg_t) (AS_AREA_READ | AS_AREA_CACHEABLE));
 
dprintf("Sharing PLB.\n");
 
futex_up(&fs_head_futex);
 
/*