00001 /* 00002 ** ramfsvar.h for lseos in lseos-srv/fs/ramfs 00003 ** 00004 ** Copyright(c)2004 Vianney Rancurel 00005 ** Login <vianney@epita.fr> 00006 ** 00007 ** Started on Tue Feb 17 17:14:41 2004 Vianney Rancurel 00008 ** Last update Mon Dec 6 11:54:46 2004 Vianney Rancurel 00009 */ 00010 #ifndef __RAMFSVAR_H__ 00011 #define __RAMFSVAR_H__ 1 00012 #include <libc.h> 00013 00014 typedef struct s_ramfsstat 00015 { 00016 int nwrites; 00017 int nreads; 00018 } t_ramfsstat; 00019 00020 struct s_file; 00021 LIST_HEAD(s_file_list, s_file); 00022 typedef struct s_file_list t_file_list; 00023 00024 typedef struct s_file 00025 { 00026 LIST_ENTRY(s_file) list; 00027 00028 char *name; 00029 struct s_ramfs_entry *entry; 00030 } t_file; 00031 00032 typedef struct s_ramfs_entry 00033 { 00034 u_int refcnt; 00035 00036 t_file_list file_list; 00038 uid_t uid; 00039 gid_t gid; 00040 size_t size; 00041 int flags; 00042 mode_t mode; 00043 00044 char *buf; 00045 } t_ramfs_entry; 00046 00047 typedef struct s_ramfs 00048 { 00049 u_int32_t avail:1; 00050 00051 #define MAXHOLDER 10 00052 pid_t holders[MAXHOLDER]; 00053 uid_t uid; 00054 00055 t_ramfs_entry *entry; 00056 t_file *cur; 00057 off_t off; 00059 t_ramfsstat stat; 00060 } t_ramfs; 00061 00062 typedef struct s_ramfs_info 00063 { 00064 t_ramfs_entry root_entry; 00065 pid_t notify_pid; 00066 00067 __cpu_simple_lock_t lock; 00068 } t_ramfs_info; 00069 00070 typedef enum 00071 { 00072 RAMFS_TOO_MANY_HOLDERS = 100, 00073 RAMFS_HOLDER_DOESNT_EXIST, 00074 } t_ramfs_suberrno_codes; 00075 00076 #endif