File: cnid_tdb.h

package info (click to toggle)
netatalk 3.1.12~ds-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 14,756 kB
  • sloc: ansic: 104,976; sh: 8,247; xml: 7,394; perl: 1,936; makefile: 1,430; python: 1,342; yacc: 309; lex: 49
file content (79 lines) | stat: -rw-r--r-- 2,112 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* 
 * interface for database access to cnids. i do it this way to abstract
 * things a bit in case we want to change the underlying implementation.
 */

#ifndef _ATALK_CNID_TDB__H
#define _ATALK_CNID_TDB__H 1

#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <sys/param.h>
#include <arpa/inet.h>

#include <atalk/cnid.h>
#include <atalk/cnid_private.h>
#define STANDALONE 1

#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <signal.h>
#if USE_BUILTIN_TDB
#include <atalk/tdb.h>
#else
#include <tdb.h>
#endif

#define TDB_ERROR_LINK  1
#define TDB_ERROR_DEV   2
#define TDB_ERROR_INODE 4

struct _cnid_tdb_private {
    dev_t  st_dev;
    int    st_set;
    int    error;
    int    flags;
    TDB_CONTEXT *tdb_cnid;
    TDB_CONTEXT *tdb_didname;
    TDB_CONTEXT *tdb_devino;

};

/* cnid_open.c */
extern struct _cnid_module cnid_tdb_module;
extern struct _cnid_db *cnid_tdb_open (struct cnid_open_args *args);

/* cnid_close.c */
extern void cnid_tdb_close (struct _cnid_db *);

/* cnid_add.c */
extern cnid_t cnid_tdb_add (struct _cnid_db *, const struct stat *, cnid_t,
                            const char *, size_t, cnid_t);

/* cnid_get.c */
extern cnid_t cnid_tdb_get (struct _cnid_db *, cnid_t, const char *, size_t);
extern char *cnid_tdb_resolve (struct _cnid_db *, cnid_t *, void *, size_t);
extern cnid_t cnid_tdb_lookup (struct _cnid_db *, const struct stat *, cnid_t, const char *, size_t);

/* cnid_update.c */
extern int cnid_tdb_update (struct _cnid_db *, cnid_t, const struct stat *,
                            cnid_t, const char *, size_t);

/* cnid_delete.c */
extern int cnid_tdb_delete (struct _cnid_db *, const cnid_t);

/* cnid_nextid.c */
extern cnid_t cnid_tdb_nextid (struct _cnid_db *);

/* construct db_cnid data. NOTE: this is not re-entrant.  */
extern unsigned char *make_tdb_data(uint32_t flags, const struct stat *st, const cnid_t did, const char *name, const size_t len);

#endif /* include/atalk/cnid_tdb.h */