1 /* alock.h - access lock header */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2005-2009 The OpenLDAP Foundation.
6 * Portions Copyright 2004-2005 Symas Corporation.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted only as authorized by the OpenLDAP
13 * A copy of this license is available in the file LICENSE in the
14 * top-level directory of the distribution or, alternatively, at
15 * <http://www.OpenLDAP.org/license.html>.
18 * This work was initially developed by Matthew Backes at Symas
19 * Corporation for inclusion in OpenLDAP Software.
27 #include <ac/unistd.h>
29 /* environment states (all the slots together) */
30 #define ALOCK_CLEAN (0)
31 #define ALOCK_RECOVER (1)
32 #define ALOCK_BUSY (2)
33 #define ALOCK_UNSTABLE (3)
35 /* lock user types and states */
36 #define ALOCK_UNLOCKED (0)
37 #define ALOCK_LOCKED (1)
38 #define ALOCK_UNIQUE (2)
39 #define ALOCK_DIRTY (3)
43 /* lock/state where recovery is not available */
44 #define ALOCK_NOSAVE 4
47 #define ALOCK_SLOT_SIZE (1024)
48 #define ALOCK_SLOT_IATTRS (4)
49 #define ALOCK_MAX_APPNAME (ALOCK_SLOT_SIZE - 8 * ALOCK_SLOT_IATTRS)
50 #define ALOCK_MAGIC (0x12345678)
54 typedef struct alock_info {
59 typedef struct alock_slot {
66 LDAP_SLAPD_F (int) alock_open LDAP_P(( alock_info_t * info, const char * appname,
67 const char * envdir, int locktype ));
68 LDAP_SLAPD_F (int) alock_scan LDAP_P(( alock_info_t * info ));
69 LDAP_SLAPD_F (int) alock_close LDAP_P(( alock_info_t * info, int nosave ));
70 LDAP_SLAPD_F (int) alock_recover LDAP_P(( alock_info_t * info ));