1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #if !defined(DLL_EXPORT) && !defined(USE_STATIC_LIB)
20 #  define USE_STATIC_LIB
21 #endif
22 
23 #include "zk_adaptor.h"
24 #include <stdlib.h>
25 #include <time.h>
26 
zoo_lock_auth(zhandle_t * zh)27 int zoo_lock_auth(zhandle_t *zh)
28 {
29     return 0;
30 }
zoo_unlock_auth(zhandle_t * zh)31 int zoo_unlock_auth(zhandle_t *zh)
32 {
33     return 0;
34 }
lock_buffer_list(buffer_head_t * l)35 int lock_buffer_list(buffer_head_t *l)
36 {
37     return 0;
38 }
unlock_buffer_list(buffer_head_t * l)39 int unlock_buffer_list(buffer_head_t *l)
40 {
41     return 0;
42 }
lock_completion_list(completion_head_t * l)43 int lock_completion_list(completion_head_t *l)
44 {
45     return 0;
46 }
unlock_completion_list(completion_head_t * l)47 int unlock_completion_list(completion_head_t *l)
48 {
49     return 0;
50 }
process_async(int outstanding_sync)51 int process_async(int outstanding_sync)
52 {
53     return outstanding_sync == 0;
54 }
55 
adaptor_init(zhandle_t * zh)56 int adaptor_init(zhandle_t *zh)
57 {
58     return 0;
59 }
60 
adaptor_finish(zhandle_t * zh)61 void adaptor_finish(zhandle_t *zh){}
62 
adaptor_destroy(zhandle_t * zh)63 void adaptor_destroy(zhandle_t *zh){}
64 
65 int flush_send_queue(zhandle_t *, int);
66 
adaptor_send_queue(zhandle_t * zh,int timeout)67 int adaptor_send_queue(zhandle_t *zh, int timeout)
68 {
69     return flush_send_queue(zh, timeout);
70 }
71 
inc_ref_counter(zhandle_t * zh,int i)72 int32_t inc_ref_counter(zhandle_t* zh,int i)
73 {
74     zh->ref_counter+=(i<0?-1:(i>0?1:0));
75     return zh->ref_counter;
76 }
77 
get_xid()78 int32_t get_xid()
79 {
80     static int32_t xid = -1;
81     if (xid == -1) {
82         xid = time(0);
83     }
84     return xid++;
85 }
86 
lock_reconfig(struct _zhandle * zh)87 int lock_reconfig(struct _zhandle *zh)
88 {
89     return 0;
90 }
91 
unlock_reconfig(struct _zhandle * zh)92 int unlock_reconfig(struct _zhandle *zh)
93 {
94     return 0;
95 }
96 
lock_watchers(struct _zhandle * zh)97 int lock_watchers(struct _zhandle *zh)
98 {
99     return 0;
100 }
101 
unlock_watchers(struct _zhandle * zh)102 int unlock_watchers(struct _zhandle *zh)
103 {
104     return 0;
105 }
106 
enter_critical(zhandle_t * zh)107 int enter_critical(zhandle_t* zh)
108 {
109     return 0;
110 }
111 
leave_critical(zhandle_t * zh)112 int leave_critical(zhandle_t* zh)
113 {
114     return 0;
115 }
116