2 * $Id: cnid.h,v 1.9.6.1 2003-09-09 16:42:20 didg Exp $
4 * Copyright (c) 2003 the Netatalk Team
5 * Copyright (c) 2003 Rafal Lewczuk <rlewczuk@pronet.pl>
7 * This program is free software; you can redistribute and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation version 2 of the License or later
10 * version if explicitly stated by any of above copyright holders.
15 * This file contains all generic CNID related stuff
16 * declarations. Included:
17 * - CNID factory, which retrieves (eventually instantiates)
18 * CNID objects on demand
19 * - selection of CNID backends (default, detected by volume)
20 * - full set of CNID operations needed by server core.
23 #ifndef _ATALK_CNID__H
24 #define _ATALK_CNID__H 1
26 #include <sys/cdefs.h>
27 #include <atalk/adouble.h>
28 #include <atalk/list.h>
30 /* CNID object flags */
31 #define CNID_FLAG_PERSISTENT 0x01 /* This backend implements DID persistence */
32 #define CNID_FLAG_MANGLING 0x02 /* This backend has name mangling feature. */
33 #define CNID_FLAG_SETUID 0x04 /* Set db owner to parent folder owner. */
34 #define CNID_FLAG_BLOCK 0x08 /* block signals in update. */
36 #define CNID_INVALID 0
38 #define CNID_ERR_PARAM 0x80000001
39 #define CNID_ERR_PATH 0x80000002
40 #define CNID_ERR_DB 0x80000003
41 #define CNID_ERR_CLOSE 0x80000004 /* the db was not open */
42 #define CNID_ERR_MAX 0x80000005
45 * This is instance of CNID database object.
49 u_int32_t flags; /* Flags describing some CNID backend aspects. */
50 char *volpath; /* Volume path this particular CNID db refers to. */
51 void *_private; /* back-end speficic data */
52 char *stamp[ADEDLEN_PRIVSYN];
55 cnid_t (*cnid_add)(struct _cnid_db *cdb, const struct stat *st, const cnid_t did,
56 const char *name, const int len, cnid_t hint);
57 int (*cnid_delete)(struct _cnid_db *cdb, cnid_t id);
58 cnid_t (*cnid_get)(struct _cnid_db *cdb, const cnid_t did, const char *name,
60 cnid_t (*cnid_lookup)(struct _cnid_db *cdb, const struct stat *st, const cnid_t did,
61 const char *name, const int len);
62 cnid_t (*cnid_nextid)(struct _cnid_db *cdb);
63 char *(*cnid_resolve)(struct _cnid_db *cdb, cnid_t *id, void *buffer, u_int32_t len);
64 int (*cnid_update)(struct _cnid_db *cdb, const cnid_t id, const struct stat *st,
65 const cnid_t did, const char *name, const int len);
66 void (*cnid_close)(struct _cnid_db *cdb);
67 int (*cnid_getstamp)(struct _cnid_db *cdb, void *buffer, const int len);
69 typedef struct _cnid_db cnid_db;
72 * CNID module - represents particular CNID implementation
76 struct list_head db_list; /* CNID modules are also stored on a bidirectional list. */
77 struct _cnid_db *(*cnid_open)(const char *dir, mode_t mask);
78 u_int32_t flags; /* Flags describing some CNID backend aspects. */
81 typedef struct _cnid_module cnid_module;
83 /* Registers new CNID backend module */
84 void cnid_register(struct _cnid_module *module);
86 /* This function opens a CNID database for selected volume. */
87 struct _cnid_db *cnid_open(const char *volpath, mode_t mask, char *type);
89 cnid_t cnid_add(struct _cnid_db *cdb, const struct stat *st, const cnid_t did,
90 const char *name, const int len, cnid_t hint);
92 int cnid_delete(struct _cnid_db *cdb, cnid_t id);
94 cnid_t cnid_get (struct _cnid_db *cdb, const cnid_t did, const char *name,const int len);
96 cnid_t cnid_getstamp(struct _cnid_db *cdb, void *buffer, const int len);
98 cnid_t cnid_lookup(struct _cnid_db *cdb, const struct stat *st, const cnid_t did,
99 const char *name, const int len);
101 char *cnid_resolve(struct _cnid_db *cdb, cnid_t *id, void *buffer, u_int32_t len);
103 int cnid_update (struct _cnid_db *cdb, const cnid_t id, const struct stat *st,
104 const cnid_t did, const char *name, const int len);
106 /* This function closes a CNID database and frees all resources assigned to it. */
107 void cnid_close(struct _cnid_db *db);
113 * Revision 1.9.6.1 2003-09-09 16:42:20 didg
115 * big merge for db frontend and unicode.
117 * Revision 1.9.4.2 2003/06/11 15:29:11 rlewczuk
118 * Removed obsolete parameter from cnid_add. Spotted by Didier.
120 * Revision 1.9.4.1 2003/05/29 07:53:19 rlewczuk
121 * Selectable CNIDs. Some refactoring. Propably needs more of refactoring, mainly
122 * a well designed API (current API is just an old cnid_* API enclosed in VMT).