2 * Copyright (c) 2011 Frank Lahm
3 * All Rights Reserved. See COPYRIGHT.
8 #endif /* HAVE_CONFIG_H */
16 #include <atalk/logger.h>
17 #include <atalk/errchk.h>
18 #include <atalk/locking.h>
19 #include <atalk/cnid.h>
20 #include <atalk/paths.h>
22 #include "smb_share_modes.h"
24 /***************************************************************************
25 * structures and defines
26 ***************************************************************************/
28 #define LOCKTABLE_PATH "/tmp/netatalk-afp-locks.tdb"
31 * Struct for building the the main database of file locks.
32 * vid + cnid build the primary key for database access.
34 typedef struct afp_lock {
41 /* pid holding the lock, also secondary key */
44 /* Refcounting access and deny modes */
51 #define PACKED_AFP_LOCK_SIZE \
52 sizeof(((afp_lock_t *)0)->l_vid) + \
53 sizeof(((afp_lock_t *)0)->l_cnid) + \
54 sizeof(((afp_lock_t *)0)->l_dev) + \
55 sizeof(((afp_lock_t *)0)->l_ino) + \
56 sizeof(((afp_lock_t *)0)->l_pid) + \
57 sizeof(((afp_lock_t *)0)->l_amode_r) + \
58 sizeof(((afp_lock_t *)0)->l_amode_w) + \
59 sizeof(((afp_lock_t *)0)->l_dmode_r) + \
60 sizeof(((afp_lock_t *)0)->l_dmode_r)
62 /***************************************************************************
64 ***************************************************************************/
66 static struct smbdb_ctx *tdb;
68 /***************************************************************************
70 ***************************************************************************/
72 /***************************************************************************
74 ***************************************************************************/
77 * Open locktable from path
79 int locktable_init(const char *path)
83 EC_NULL_LOG(tdb = smb_share_mode_db_open(path));