Whamcloud - gitweb
Branch: HEAD
[fs/lustre-release.git] / lustre / sec / gks / gks_internal.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4
5 #ifndef _GKS_INTERNAL_H
6 #define _GKS_INTERNAL_H
7
8 #define GKS_SERVICE_WATCHDOG_TIMEOUT 30000
9 struct mdc_rpc_lock {
10         struct semaphore rpcl_sem;
11         struct lookup_intent *rpcl_it;
12 };
13
14 static inline void gkc_init_rpc_lock(struct mdc_rpc_lock *lck)
15 {
16         sema_init(&lck->rpcl_sem, 1);
17         lck->rpcl_it = NULL;
18 }
19
20 static inline void gkc_get_rpc_lock(struct mdc_rpc_lock *lck,
21                                     struct lookup_intent *it)
22 {
23         ENTRY;
24         down(&lck->rpcl_sem);
25         if (it) {
26                 lck->rpcl_it = it;
27         }
28 }
29
30 static inline void gkc_put_rpc_lock(struct mdc_rpc_lock *lck,
31                                     struct lookup_intent *it)
32 {
33         EXIT;
34         if (it == NULL) {
35                 LASSERT(it == lck->rpcl_it);
36                 up(&lck->rpcl_sem);
37                 return;
38         }
39         if (it) {
40                 LASSERT(it == lck->rpcl_it);
41                 lck->rpcl_it = NULL;
42                 up(&lck->rpcl_sem);
43         }
44 }
45
46 #endif /* _GKS_INTERNAL_H */