tmpfs.h

00001 /*
00002  * Copyright (c) 2008 Jakub Jermar
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00033 #ifndef TMPFS_TMPFS_H_
00034 #define TMPFS_TMPFS_H_
00035 
00036 #include <libfs.h>
00037 #include <atomic.h>
00038 #include <sys/types.h>
00039 #include <bool.h>
00040 #include <adt/hash_table.h>
00041 
00042 #define TMPFS_NODE(node)        ((node) ? (tmpfs_node_t *)(node)->data : NULL)
00043 #define FS_NODE(node)           ((node) ? (node)->bp : NULL)
00044 
00045 typedef enum {
00046         TMPFS_NONE,
00047         TMPFS_FILE,
00048         TMPFS_DIRECTORY
00049 } tmpfs_dentry_type_t;
00050 
00051 /* forward declaration */
00052 struct tmpfs_node;
00053 
00054 typedef struct tmpfs_dentry {
00055         link_t link;            
00056         struct tmpfs_node *node;
00057         char *name;             
00058 } tmpfs_dentry_t;
00059 
00060 typedef struct tmpfs_node {
00061         fs_node_t *bp;          
00062         fs_index_t index;       
00063         devmap_handle_t devmap_handle;
00064         link_t nh_link;         
00065         tmpfs_dentry_type_t type;
00066         unsigned lnkcnt;        
00067         size_t size;            
00068         void *data;             
00069         link_t cs_head;         
00070 } tmpfs_node_t;
00071 
00072 extern fs_reg_t tmpfs_reg;
00073 
00074 extern libfs_ops_t tmpfs_libfs_ops;
00075 
00076 extern bool tmpfs_init(void);
00077 
00078 extern void tmpfs_mounted(ipc_callid_t, ipc_call_t *);
00079 extern void tmpfs_mount(ipc_callid_t, ipc_call_t *);
00080 extern void tmpfs_unmounted(ipc_callid_t, ipc_call_t *);
00081 extern void tmpfs_unmount(ipc_callid_t, ipc_call_t *);
00082 extern void tmpfs_lookup(ipc_callid_t, ipc_call_t *);
00083 extern void tmpfs_read(ipc_callid_t, ipc_call_t *);
00084 extern void tmpfs_write(ipc_callid_t, ipc_call_t *);
00085 extern void tmpfs_truncate(ipc_callid_t, ipc_call_t *);
00086 extern void tmpfs_stat(ipc_callid_t, ipc_call_t *);
00087 extern void tmpfs_close(ipc_callid_t, ipc_call_t *);
00088 extern void tmpfs_destroy(ipc_callid_t, ipc_call_t *);
00089 extern void tmpfs_open_node(ipc_callid_t, ipc_call_t *);
00090 extern void tmpfs_sync(ipc_callid_t, ipc_call_t *);
00091 
00092 extern bool tmpfs_restore(devmap_handle_t);
00093 
00094 #endif
00095 

Generated on Thu Jun 2 07:45:49 2011 for HelenOS/USB by  doxygen 1.4.7