00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #ifndef __PROPS_H__
00010 #define __PROPS_H__
00011 
00016 #include <sys/types.h>
00017 
00018 #include "global.h"
00019 #include "hash_ops.h"
00020 
00031 int prp__open_byname(char *wcfile, int gdbm_mode, hash_t *db);
00033 int prp__open_byestat(struct estat *sts, int gdbm_mode, hash_t *db);
00037 int prp__set(hash_t db, const char *name, const char *data, int datalen);
00039 inline int prp__set_svnstr(hash_t db, 
00040         const char *name, 
00041         const svn_string_t *utf8_value);
00042 
00043 
00045 enum prp__set_from_aprhash_e {
00046     DEFAULT=0,
00047     STORE_IN_FS=1,
00048     ONLY_KEEP_USERDEF=2,
00049 };
00050 
00053 int prp__set_from_aprhash(struct estat *sts, 
00054         apr_hash_t *props,
00055         enum prp__set_from_aprhash_e flags,
00056         hash_t *props_db,
00057         apr_pool_t *pool);
00058 
00062 int prp__db_open_byname(char *wcfile, int flags, char *name, 
00063         hash_t *db);
00066 int prp__get(hash_t db, char *keycp, datum *value);
00068 int prp__store(hash_t db, datum key, datum value);
00070 static inline int prp__first(hash_t db, datum *key)
00071 {
00072   int status;
00073     status=hsh__first(db, key);
00074 #ifdef ENABLE_DEBUG
00075     if (!status) 
00076         BUG_ON(key->dptr[key->dsize-1] != 0, "Not terminated!");
00077 #endif
00078     return status;
00079 }
00081 static inline int prp__next(hash_t db, datum *key, const datum *oldkey)
00082 {
00083   int status;
00084     status=hsh__next(db, key, oldkey);
00085 #ifdef ENABLE_DEBUG
00086     if (!status) 
00087         BUG_ON(key->dptr[key->dsize-1] != 0, "Not terminated!");
00088 #endif
00089     return status;
00090 }
00092 static inline int prp__fetch(hash_t db, datum key, datum *value)
00093 {
00094     int status;
00095 
00096     if (!db) return ENOENT;
00097 
00098     status=hsh__fetch(db, key, value);
00099 #ifdef ENABLE_DEBUG
00100     if (!status)
00101         BUG_ON(value->dptr[value->dsize-1] != 0, "Not terminated!");
00102 #endif
00103     DEBUGP("read property %s=%s", key.dptr, value->dptr);
00104 
00105     return status;
00106 }
00107 
00110 int prp__open_get_close(struct estat *sts, char *name, 
00111         char **data, int *len);
00112 
00113 int prp__unlink_db_for_estat(struct estat *sts);
00118 work_t prp__g_work;
00120 work_t prp__s_work;
00122 work_t prp__l_work;
00123 
00124 
00126 extern const char prp___to_be_removed_value[];
00128 static inline int prp__prop_will_be_removed(datum data)
00129 {
00130     return strcmp(data.dptr, prp___to_be_removed_value) == 0;
00131 }
00132 
00133 
00134 #endif
00135