/trunk/uspace/srv/vfs/vfs.c |
---|
32,7 → 32,7 |
/** |
* @file vfs.c |
* @brief VFS multiplexer for HelenOS. |
* @brief VFS service for HelenOS. |
*/ |
#include <ipc/ipc.h> |
41,6 → 41,8 |
#include <errno.h> |
#include <stdio.h> |
#include <bool.h> |
#include <string.h> |
#include <as.h> |
#include <libadt/list.h> |
#include "vfs.h" |
108,9 → 110,31 |
printf("VFS: HelenOS VFS server\n"); |
/* |
* Initialize the list of registered file systems. |
*/ |
list_initialize(&fs_head); |
/* |
* Allocate and initialize the Path Lookup Buffer. |
*/ |
list_initialize(&plb_head); |
plb = as_get_mappable_page(PLB_SIZE); |
// memset(plb, 0, PLB_SIZE); |
/* |
* Set a connectio handling function/fibril. |
*/ |
async_set_client_connection(vfs_connection); |
/* |
* Register at the naming service. |
*/ |
ipc_connect_to_me(PHONE_NS, SERVICE_VFS, 0, &phonead); |
/* |
* Start accepting connections. |
*/ |
async_manager(); |
return 0; |
} |
/trunk/uspace/srv/vfs/vfs_mount.c |
---|
0,0 → 1,56 |
/* |
* Copyright (c) 2007 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup fs |
* @{ |
*/ |
/** |
* @file vfs.c |
* @brief VFS_MOUNT method. |
*/ |
#include <ipc/ipc.h> |
#include <async.h> |
#include <errno.h> |
#include <stdlib.h> |
#include <string.h> |
#include <bool.h> |
#include <futex.h> |
#include <libadt/list.h> |
#include "vfs.h" |
vfs_node_t *rootfs = NULL; |
void vfs_mount(ipc_callid_t rid, ipc_call_t *request) |
{ |
} |
/** |
* @} |
*/ |
/trunk/uspace/srv/vfs/vfs.h |
---|
36,7 → 36,7 |
#include <ipc/ipc.h> |
#include <libadt/list.h> |
#include <atomic.h> |
#include <types.h> |
#include <sys/types.h> |
#define dprintf(...) printf(__VA_ARGS__) |
44,8 → 44,6 |
#define IPC_METHOD_TO_VFS_OP(m) ((m) - VFS_FIRST) |
typedef int64_t off_t; |
typedef enum { |
VFS_REGISTER = VFS_FIRST, |
VFS_MOUNT, |
125,10 → 123,28 |
off_t pos; |
} vfs_file_t; |
extern link_t fs_head; |
extern link_t fs_head; /**< List of registered file systems. */ |
extern void vfs_register(ipc_callid_t rid, ipc_call_t *request); |
extern vfs_node_t *rootfs; /**< Root node of the root file system. */ |
#define MAX_PATH_LEN (64 * 1024) |
#define PLB_SIZE (2 * MAX_PATH_LEN) |
/** Each instance of this type describes one path lookup in progress. */ |
typedef struct { |
link_t plb_link; /**< Active PLB entries list link. */ |
unsigned index; /**< Index of the first character in PLB. */ |
size_t len; /**< Number of characters in this PLB entry. */ |
} plb_entry_t; |
extern atomic_t plb_futex; /**< Futex protecting plb and plb_head. */ |
extern uint8_t *plb; /**< Path Lookup Buffer */ |
extern link_t plb_head; /**< List of active PLB entries. */ |
extern void vfs_register(ipc_callid_t, ipc_call_t *); |
extern void vfs_lookup(ipc_callid_t, ipc_call_t *); |
#endif |
/** |
/trunk/uspace/srv/vfs/vfs_lookup.c |
---|
0,0 → 1,60 |
/* |
* Copyright (c) 2007 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup fs |
* @{ |
*/ |
/** |
* @file vfs.c |
* @brief VFS_LOOKUP method and Path Lookup Buffer code. |
*/ |
#include <ipc/ipc.h> |
#include <async.h> |
#include <errno.h> |
#include <stdlib.h> |
#include <string.h> |
#include <bool.h> |
#include <futex.h> |
#include <libadt/list.h> |
#include "vfs.h" |
atomic_t plb_futex = FUTEX_INITIALIZER; |
link_t plb_head; |
uint8_t *plb = NULL; |
void vfs_lookup(ipc_callid_t rid, ipc_call_t *request) |
{ |
if (!rootfs) |
ipc_answer_fast(rid, ENOENT, 0, 0); |
} |
/** |
* @} |
*/ |
/trunk/uspace/srv/vfs/Makefile |
---|
42,7 → 42,9 |
OUTPUT = vfs |
SOURCES = \ |
vfs.c \ |
vfs_register.c |
vfs_register.c \ |
vfs_lookup.c \ |
vfs_mount.c |
OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) |