netatalk  4.4.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
dbif.h
Go to the documentation of this file.
1/*
2 Copyright (C) Joerg Lenneis 2003
3 Copyright (C) Frank Lahm 2009
4 All Rights Reserved. See COPYING.
5 */
6
56
57#ifndef CNID_DBD_DBIF_H
58#define CNID_DBD_DBIF_H 1
59
60#include <db.h>
61
62#include <atalk/adouble.h>
63
64#include "db_param.h"
65
66#define DBIF_DB_CNT 4
67
68#define DBIF_CNID 0
69#define DBIF_IDX_DEVINO 1
70#define DBIF_IDX_DIDNAME 2
71#define DBIF_IDX_NAME 3
72
73#define LOCKFILENAME "lock"
74#define LOCK_FREE 0
75#define LOCK_UNLOCK 1
76#define LOCK_EXCL 2
77#define LOCK_SHRD 3
78
79/* Structures */
80typedef struct {
81 char *name;
82 DB *db;
83 uint32_t flags;
84 uint32_t openflags;
85 DBTYPE type;
86} db_table;
87
88typedef struct {
89 DB_ENV *db_env;
91 DB_TXN *db_txn;
92 DBC *db_cur;
95 FILE *db_errlog;
97} DBD;
98
99DBD *dbif_init(const char *envhome, const char *dbname);
100int dbif_env_open(DBD *dbd, struct db_param *dbp, uint32_t dbenv_oflags);
101int dbif_open(DBD *dbd, struct db_param *dbp, int reindex);
102int dbif_close(DBD *dbd);
103int dbif_env_remove(const char *path);
104
105int dbif_get(DBD *, const int, DBT *, DBT *, uint32_t);
106int dbif_pget(DBD *, const int, DBT *, DBT *, DBT *, uint32_t);
107int dbif_put(DBD *, const int, DBT *, DBT *, uint32_t);
108int dbif_del(DBD *, const int, DBT *, uint32_t);
109int dbif_count(DBD *, const int, uint32_t *);
110int dbif_search(DBD *dbd, DBT *key, char *resbuf);
111int dbif_copy_rootinfokey(DBD *srcdbd, DBD *destdbd);
112int dbif_txn_begin(DBD *);
113int dbif_txn_commit(DBD *);
114int dbif_txn_abort(DBD *);
115int dbif_txn_close(DBD *dbd, int ret);
116int dbif_txn_checkpoint(DBD *, uint32_t, uint32_t, uint32_t);
117
118int dbif_dump(DBD *dbd, int dumpindexes);
119int dbif_idwalk(DBD *dbd, cnid_t *cnid, int close);
120#endif
Part of Netatalk's AppleDouble implementatation.
uint32_t cnid_t
Definition adouble.h:156
int dbif_dump(DBD *dbd, int dumpindexes)
Definition dbif.c:1196
int dbif_env_open(DBD *dbd, struct db_param *dbp, uint32_t dbenv_oflags)
Definition dbif.c:415
int dbif_txn_commit(DBD *)
Definition dbif.c:1056
int dbif_txn_close(DBD *dbd, int ret)
Close a transaction based on ret code.
Definition dbif.c:1114
int dbif_idwalk(DBD *dbd, cnid_t *cnid, int close)
Iterates over dbd, returning cnids.
Definition dbif.c:1382
int dbif_env_remove(const char *path)
Definition dbif.c:800
int dbif_del(DBD *, const int, DBT *, uint32_t)
Definition dbif.c:934
int dbif_count(DBD *, const int, uint32_t *)
Definition dbif.c:1150
int dbif_copy_rootinfokey(DBD *srcdbd, DBD *destdbd)
Definition dbif.c:1168
int dbif_close(DBD *dbd)
Definition dbif.c:765
int dbif_search(DBD *dbd, DBT *key, char *resbuf)
Search the database by name.
Definition dbif.c:980
int dbif_pget(DBD *, const int, DBT *, DBT *, DBT *, uint32_t)
int dbif_put(DBD *, const int, DBT *, DBT *, uint32_t)
Definition dbif.c:905
int dbif_txn_abort(DBD *)
Definition dbif.c:1081
DBD * dbif_init(const char *envhome, const char *dbname)
Definition dbif.c:362
int dbif_txn_begin(DBD *)
Definition dbif.c:1031
int dbif_get(DBD *, const int, DBT *, DBT *, uint32_t)
Definition dbif.c:883
int dbif_open(DBD *dbd, struct db_param *dbp, int reindex)
Definition dbif.c:549
#define DBIF_DB_CNT
Definition dbif.h:66
int dbif_txn_checkpoint(DBD *, uint32_t, uint32_t, uint32_t)
Definition dbif.c:1135
static DBD * dbd
Definition etc/cnid_dbd/main.c:45
static struct db_param * dbp
Definition etc/cnid_dbd/main.c:49
#define key
Definition hash.c:36
Definition dbif.h:88
DB_TXN * db_txn
Definition dbif.h:91
FILE * db_errlog
Definition dbif.h:95
DB_ENV * db_env
Definition dbif.h:89
struct db_param db_param
Definition dbif.h:90
DBC * db_cur
Definition dbif.h:92
char * db_envhome
Definition dbif.h:93
db_table db_table[DBIF_DB_CNT]
Definition dbif.h:96
char * db_filename
Definition dbif.h:94
Definition db_param.h:22
Definition dbif.h:80
uint32_t openflags
Definition dbif.h:84
DBTYPE type
Definition dbif.h:85
uint32_t flags
Definition dbif.h:83
char * name
Definition dbif.h:81
DB * db
Definition dbif.h:82
Definition include/atalk/directory.h:81