netatalk 4.4.3
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
cnid.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2003 the Netatalk Team
3 * Copyright (c) 2003 Rafal Lewczuk <rlewczuk@pronet.pl>
4 * Copyright (c) 2010 Frank Lahm
5 *
6 * This program is free software; you can redistribute and/or modify
7 * it under the terms of the GNU General Public License as published
8 * by the Free Software Foundation version 2 of the License or later
9 * version if explicitly stated by any of above copyright holders.
10 *
11 * 2024/07/05: Rafal Lewczuk gave permission to change the license
12 * to a later verion of the GNU GPL in
13 * https://github.com/Netatalk/netatalk/issues/1193
14 *
15 */
16
26
27#ifndef _ATALK_CNID__H
28#define _ATALK_CNID__H 1
29
30#include <atalk/adouble.h>
31#include <atalk/list.h>
32#include <atalk/uuid.h>
33
34/* CNID object flags */
35#define CNID_FLAG_PERSISTENT 0x01
36#define CNID_FLAG_MANGLING 0x02
37#define CNID_FLAG_SETUID 0x04
38#define CNID_FLAG_BLOCK 0x08
39#define CNID_FLAG_NODEV 0x10
40#define CNID_FLAG_LAZY_INIT 0x20
41#define CNID_FLAG_INODE 0x80
42
43#define CNID_INVALID 0
44#define CNID_START 17
45
46#define CNID_ERR_PARAM 0x80000001
47#define CNID_ERR_PATH 0x80000002
48#define CNID_ERR_DB 0x80000003
49#define CNID_ERR_CLOSE 0x80000004
50#define CNID_ERR_MAX 0x80000005
51
55 typedef struct _cnid_db {
56 /* Flags describing some CNID backend aspects. */
57 uint32_t cnid_db_flags;
58 struct vol *cnid_db_vol;
59 /* back-end speficic data */
60 void *cnid_db_private;
61
62 cnid_t (*cnid_add)(struct _cnid_db *cdb, const struct stat *st, cnid_t did,
63 const char *name, size_t, cnid_t hint);
64 int (*cnid_delete)(struct _cnid_db *cdb, cnid_t id);
65 cnid_t (*cnid_get)(struct _cnid_db *cdb, cnid_t did, const char *name,
66 size_t);
67 cnid_t (*cnid_lookup)(struct _cnid_db *cdb, const struct stat *st,
68 cnid_t did, const char *name, size_t);
69 cnid_t (*cnid_nextid)(struct _cnid_db *cdb);
70 char *(*cnid_resolve)(struct _cnid_db *cdb, cnid_t *id, void *buffer,
71 size_t len);
72 int (*cnid_update)(struct _cnid_db *cdb, cnid_t id, const struct stat *st,
73 cnid_t did, const char *name, size_t len);
74 void (*cnid_close)(struct _cnid_db *cdb);
75 int (*cnid_getstamp)(struct _cnid_db *cdb, void *buffer, const size_t len);
76 cnid_t (*cnid_rebuild_add)(struct _cnid_db *, const struct stat *, cnid_t,
77 const char *, size_t, cnid_t);
78 int (*cnid_find)(struct _cnid_db *cdb, const char *name, size_t namelen,
79 void *buffer, size_t buflen);
80 int (*cnid_wipe)(struct _cnid_db *cdb);
81} cnid_db;
82
83/*
84 * Consolidation of args passed from main cnid_open to modules cnid_XXX_open, so
85 * that it's easier to add aditional args as required.
86 */
87 struct cnid_open_args {
88 uint32_t cnid_args_flags;
89 struct vol *cnid_args_vol;
90};
91
92/*
93 * CNID module - represents particular CNID implementation
94 */
95 struct _cnid_module {
96 char *name;
97 /* CNID modules are also stored on a bidirectional list. */
98 struct list_head db_list;
99 struct _cnid_db *(*cnid_open)(struct cnid_open_args *args);
100 /* Flags describing some CNID backend aspects. */
101 uint32_t flags;
102};
103
104 typedef struct _cnid_module cnid_module;
105
106/* Inititalize the CNID backends */
107 void cnid_init(void);
108
109/* Registers new CNID backend module */
110 void cnid_register(struct _cnid_module *module);
111
112/* This function opens a CNID database for selected volume. */
113 struct _cnid_db *cnid_open(struct vol *vol, char *type, int flags);
114 cnid_t cnid_add(struct _cnid_db *cdb, const struct stat *st, const cnid_t did,
115 const char *name, const size_t len, cnid_t hint);
116 int cnid_delete(struct _cnid_db *cdb, cnid_t id);
117 cnid_t cnid_get(struct _cnid_db *cdb, const cnid_t did, char *name,
118 const size_t len);
119 int cnid_getstamp(struct _cnid_db *cdb, void *buffer, const size_t len);
120 cnid_t cnid_lookup(struct _cnid_db *cdb, const struct stat *st,
121 const cnid_t did, char *name, const size_t len);
122 char *cnid_resolve(struct _cnid_db *cdb, cnid_t *id, void *buffer,
123 size_t len);
124 int cnid_update(struct _cnid_db *cdb, const cnid_t id,
125 const struct stat *st, const cnid_t did, char *name,
126 const size_t len);
127 cnid_t cnid_rebuild_add(struct _cnid_db *cdb, const struct stat *st,
128 const cnid_t did, char *name, const size_t len,
129 cnid_t hint);
130 int cnid_find(struct _cnid_db *cdb, const char *name, size_t namelen,
131 void *buffer, size_t buflen);
132 int cnid_wipe(struct _cnid_db *cdb);
133 void cnid_close(struct _cnid_db *db);
134
135#endif
adouble.h
Part of Netatalk's AppleDouble implementatation.
cnid_t
uint32_t cnid_t
Definition adouble.h:156
flags
static dbd_flags_t flags
Definition cmd_dbd.c:45
cnid_db
struct _cnid_db cnid_db
cnid_update
int cnid_update(struct _cnid_db *cdb, const cnid_t id, const struct stat *st, const cnid_t did, char *name, const size_t len)
Definition cnid/cnid.c:359
cnid_add
cnid_t cnid_add(struct _cnid_db *cdb, const struct stat *st, const cnid_t did, const char *name, const size_t len, cnid_t hint)
Definition cnid/cnid.c:251
cnid_lookup
cnid_t cnid_lookup(struct _cnid_db *cdb, const struct stat *st, const cnid_t did, char *name, const size_t len)
Definition cnid/cnid.c:314
cnid_get
cnid_t cnid_get(struct _cnid_db *cdb, const cnid_t did, char *name, const size_t len)
Definition cnid/cnid.c:278
cnid_init
void cnid_init(void)
Definition cnid_init.c:53
cnid_register
void cnid_register(struct _cnid_module *module)
Definition cnid/cnid.c:47
cnid_wipe
int cnid_wipe(struct _cnid_db *cdb)
Definition cnid/cnid.c:382
cnid_module
struct _cnid_module cnid_module
Definition cnid.h:104
cnid_delete
int cnid_delete(struct _cnid_db *cdb, cnid_t id)
Definition cnid/cnid.c:267
cnid_rebuild_add
cnid_t cnid_rebuild_add(struct _cnid_db *cdb, const struct stat *st, const cnid_t did, char *name, const size_t len, cnid_t hint)
Definition cnid/cnid.c:370
cnid_close
void cnid_close(struct _cnid_db *db)
Definition cnid/cnid.c:234
cnid_getstamp
int cnid_getstamp(struct _cnid_db *cdb, void *buffer, const size_t len)
Definition cnid/cnid.c:289
cnid_find
int cnid_find(struct _cnid_db *cdb, const char *name, size_t namelen, void *buffer, size_t buflen)
Definition cnid/cnid.c:326
cnid_open
struct _cnid_db * cnid_open(struct vol *vol, char *type, int flags)
Definition cnid/cnid.c:104
cnid_resolve
char * cnid_resolve(struct _cnid_db *cdb, cnid_t *id, void *buffer, size_t len)
Definition cnid/cnid.c:343
list.h
Simple doubly linked list implementation.
did
cnid_t did
Definition nad_cp.c:93
type
static enum op type
Definition nad_cp.c:96
buffer
char buffer[MAXPATHLEN+2]
Definition netacnv.c:35
_cnid_db
Definition cnid.h:55
_cnid_db::cnid_getstamp
int(* cnid_getstamp)(struct _cnid_db *cdb, void *buffer, const size_t len)
Definition cnid.h:75
_cnid_db::cnid_find
int(* cnid_find)(struct _cnid_db *cdb, const char *name, size_t namelen, void *buffer, size_t buflen)
Definition cnid.h:78
_cnid_db::cnid_db_flags
uint32_t cnid_db_flags
Definition cnid.h:57
_cnid_db::cnid_add
cnid_t(* cnid_add)(struct _cnid_db *cdb, const struct stat *st, cnid_t did, const char *name, size_t, cnid_t hint)
Definition cnid.h:62
_cnid_db::cnid_close
void(* cnid_close)(struct _cnid_db *cdb)
Definition cnid.h:74
_cnid_db::cnid_rebuild_add
cnid_t(* cnid_rebuild_add)(struct _cnid_db *, const struct stat *, cnid_t, const char *, size_t, cnid_t)
Definition cnid.h:76
_cnid_db::cnid_db_vol
struct vol * cnid_db_vol
Definition cnid.h:58
_cnid_db::cnid_delete
int(* cnid_delete)(struct _cnid_db *cdb, cnid_t id)
Definition cnid.h:64
_cnid_db::cnid_get
cnid_t(* cnid_get)(struct _cnid_db *cdb, cnid_t did, const char *name, size_t)
Definition cnid.h:65
_cnid_db::cnid_update
int(* cnid_update)(struct _cnid_db *cdb, cnid_t id, const struct stat *st, cnid_t did, const char *name, size_t len)
Definition cnid.h:72
_cnid_db::cnid_wipe
int(* cnid_wipe)(struct _cnid_db *cdb)
Definition cnid.h:80
_cnid_db::cnid_lookup
cnid_t(* cnid_lookup)(struct _cnid_db *cdb, const struct stat *st, cnid_t did, const char *name, size_t)
Definition cnid.h:67
_cnid_db::cnid_nextid
cnid_t(* cnid_nextid)(struct _cnid_db *cdb)
Definition cnid.h:69
_cnid_db::cnid_db_private
void * cnid_db_private
Definition cnid.h:60
_cnid_module
Definition cnid.h:95
_cnid_module::db_list
struct list_head db_list
Definition cnid.h:98
_cnid_module::flags
uint32_t flags
Definition cnid.h:101
_cnid_module::name
char * name
Definition cnid.h:96
cnid_open_args
Definition cnid.h:87
cnid_open_args::cnid_args_flags
uint32_t cnid_args_flags
Definition cnid.h:88
cnid_open_args::cnid_args_vol
struct vol * cnid_args_vol
Definition cnid.h:89
list_head
Definition include/atalk/list.h:18
vol
Definition include/atalk/volume.h:30
args
static char * args[]
Definition test.c:48
uuid.h