]> arthur.barton.de Git - netatalk.git/blob - libatalk/locking/locking.c
Merge master
[netatalk.git] / libatalk / locking / locking.c
1 /*
2  * Copyright (c) 2011 Frank Lahm
3  * All Rights Reserved.  See COPYRIGHT.
4  */
5
6 #ifdef HAVE_CONFIG_H
7 #include "config.h"
8 #endif /* HAVE_CONFIG_H */
9
10 #include <stdlib.h>
11 #include <stdio.h>
12 #include <string.h>
13 #include <errno.h>
14 #include <pthread.h>
15
16 #include <atalk/logger.h>
17 #include <atalk/errchk.h>
18 #include <atalk/locking.h>
19 #include <atalk/cnid.h>
20 #define AFP_LOCKTABLE_SIZE (8*1024*1024)
21
22 /* 
23  * Struct for building the the main database of file locks.
24  * vid + cnid build the primary key for database access.
25  */
26 struct afp_lock {
27     /* Keys */
28     uint32_t vid;
29     cnid_t cnid;
30
31     /* Refcounting access and deny modes */
32     uint16_t amode_r;
33     uint16_t amode_w;
34     uint16_t dmode_r;
35     uint16_t dmode_w;
36 };
37
38 /* 
39  * Structure for building a table which provides the way to find locks by pid
40  */
41 struct pid_lock {
42     /* Key */
43     pid_t pid;
44
45     /* Key for afp_lock */
46     uint32_t vid;
47     cnid_t cnid;
48 };
49
50 /***************************************************************************
51  * Public functios
52  ***************************************************************************/
53
54 int locktable_init(void)
55 {
56     EC_INIT;
57
58
59 EC_CLEANUP:
60     EC_EXIT;
61 }
62