00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef DAZUKO_XP_H
00036 #define DAZUKO_XP_H
00037
00038 #define VERSION "2.0.5"
00039
00040 #include "dazukoio_xp.h"
00041
00042
00043 #define SET_ACCESS_MASK 0
00044 #define ADD_INCLUDE_PATH 1
00045 #define ADD_EXCLUDE_PATH 2
00046 #define REGISTER 3
00047 #define REMOVE_ALL_PATHS 4
00048 #define UNREGISTER 5
00049 #define GET_AN_ACCESS 6
00050 #define RETURN_AN_ACCESS 7
00051
00052
00053 #define DAZUKO_FREE 0
00054 #define DAZUKO_READY 1
00055 #define DAZUKO_WAITING 2
00056 #define DAZUKO_WORKING 3
00057 #define DAZUKO_DONE 4
00058 #define DAZUKO_BROKEN 5
00059
00060
00061 #define DAZUKO_NONE 0
00062 #define DAZUKO_REGULAR 1
00063 #define DAZUKO_DIRECTORY 2
00064 #define DAZUKO_LINK 3
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 struct event_properties
00087 {
00088 int thrown;
00089
00090 int flags;
00091 char set_flags;
00092 int mode;
00093 char set_mode;
00094 int uid;
00095 char set_uid;
00096 int pid;
00097 char set_pid;
00098 };
00099
00100 struct file_properties
00101 {
00102 unsigned long size;
00103 char set_size;
00104 int uid;
00105 char set_uid;
00106 int gid;
00107 char set_gid;
00108 int mode;
00109 char set_mode;
00110 int device_type;
00111 char set_device_type;
00112 int type;
00113 char set_type;
00114 };
00115
00116 struct dazuko_file_listnode
00117 {
00118 char *filename;
00119 int filename_length;
00120 struct dazuko_file_listnode *next;
00121 };
00122
00123 struct dazuko_file_struct
00124 {
00125
00126
00127
00128
00129 int should_scan;
00130 char *filename;
00131 int filename_length;
00132 struct dazuko_file_listnode *aliases;
00133 struct file_properties file_p;
00134 struct xp_file_struct *extra_data;
00135 };
00136
00137
00138
00139
00140
00141
00142
00143 int xp_init_mutex(struct xp_mutex *mutex);
00144 int xp_down(struct xp_mutex *mutex);
00145 int xp_up(struct xp_mutex *mutex);
00146 int xp_destroy_mutex(struct xp_mutex *mutex);
00147
00148
00149 int xp_init_rwlock(struct xp_rwlock *rwlock);
00150 int xp_write_lock(struct xp_rwlock *rwlock);
00151 int xp_write_unlock(struct xp_rwlock *rwlock);
00152 int xp_read_lock(struct xp_rwlock *rlock);
00153 int xp_read_unlock(struct xp_rwlock *rlock);
00154 int xp_destroy_rwlock(struct xp_rwlock *rwlock);
00155
00156
00157 int xp_init_queue(struct xp_queue *queue);
00158 int xp_wait_until_condition(struct xp_queue *queue, int (*cfunction)(void *), void *cparam, int allow_interrupt);
00159 int xp_notify(struct xp_queue *queue);
00160 int xp_destroy_queue(struct xp_queue *queue);
00161
00162
00163 void* xp_malloc(size_t size);
00164 int xp_free(void *ptr);
00165 int xp_copyin(const void *user_src, void *kernel_dest, size_t size);
00166 int xp_copyout(const void *kernel_src, void *user_dest, size_t size);
00167 int xp_verify_user_writable(const void *user_ptr, size_t size);
00168 int xp_verify_user_readable(const void *user_ptr, size_t size);
00169
00170
00171 int xp_is_absolute_path(const char *path);
00172
00173
00174 int xp_atomic_set(struct xp_atomic *atomic, int value);
00175 int xp_atomic_inc(struct xp_atomic *atomic);
00176 int xp_atomic_dec(struct xp_atomic *atomic);
00177 int xp_atomic_read(struct xp_atomic *atomic);
00178
00179
00180 int xp_copy_file(struct xp_file *dest, struct xp_file *src);
00181 int xp_compare_file(struct xp_file *file1, struct xp_file *file2);
00182
00183
00184 int xp_sys_hook(void);
00185 int xp_sys_unhook(void);
00186
00187
00188 int xp_fill_file_struct(struct dazuko_file_struct *dfs);
00189
00190
00191 int xp_id_compare(struct xp_daemon_id *id1, struct xp_daemon_id *id2);
00192 int xp_id_free(struct xp_daemon_id *id);
00193 struct xp_daemon_id* xp_id_copy(struct xp_daemon_id *id);
00194
00195
00196 int xp_print(const char *fmt, ...);
00197
00198
00199 #ifdef DEBUG
00200 #define DPRINT(fmt) xp_print fmt
00201 #else
00202 #define DPRINT(fmt)
00203 #endif
00204
00205
00206
00207
00208
00209
00210 int dazuko_vsnprintf(char *str, size_t size, const char *format, va_list ap);
00211 int dazuko_snprintf(char *str, size_t size, const char *format, ...);
00212 int dazuko_is_our_daemon(struct xp_daemon_id *xp_id);
00213 int dazuko_get_value(const char *key, const char *string, char **value);
00214 int dazuko_unregister_daemon(struct xp_daemon_id *xp_id);
00215 int dazuko_handle_user_request(struct dazuko_request *user_request, struct xp_daemon_id *xp_id);
00216 int dazuko_handle_user_request_compat12(void *ptr, int cmd, struct xp_daemon_id *xp_id);
00217 int dazuko_get_filename_length(char *filename);
00218 void dazuko_bzero(void *p, int len);
00219 int dazuko_sys_check(unsigned long event, int daemon_is_allowed, struct xp_daemon_id *xp_id);
00220 int dazuko_sys_pre(unsigned long event, struct dazuko_file_struct *kfs, struct xp_file *file, struct event_properties *event_p);
00221 int dazuko_sys_post(unsigned long event, struct dazuko_file_struct *kfs, struct xp_file *file, struct event_properties *event_p);
00222 int dazuko_init(void);
00223 int dazuko_exit(void);
00224
00225 #endif