st_adaptor.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright 2008, Yahoo! Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef DLL_EXPORT
  17. # define USE_STATIC_LIB
  18. #endif
  19. #include "zk_adaptor.h"
  20. #include <stdlib.h>
  21. #include <time.h>
  22. void lock_buffer_list(buffer_head_t *l)
  23. {
  24. }
  25. void unlock_buffer_list(buffer_head_t *l)
  26. {
  27. }
  28. void lock_completion_list(completion_head_t *l)
  29. {
  30. }
  31. void unlock_completion_list(completion_head_t *l)
  32. {
  33. }
  34. struct sync_completion *alloc_sync_completion(void)
  35. {
  36. return (struct sync_completion*)calloc(1, sizeof(struct sync_completion));
  37. }
  38. int wait_sync_completion(struct sync_completion *sc)
  39. {
  40. return 0;
  41. }
  42. void free_sync_completion(struct sync_completion *sc)
  43. {
  44. free(sc);
  45. }
  46. void notify_sync_completion(struct sync_completion *sc)
  47. {
  48. }
  49. int process_async(int outstanding_sync)
  50. {
  51. return outstanding_sync == 0;
  52. }
  53. int adaptor_init(zhandle_t *zh)
  54. {
  55. return 0;
  56. }
  57. void adaptor_finish(zhandle_t *zh){}
  58. void adaptor_destroy(zhandle_t *zh){}
  59. int flush_send_queue(zhandle_t *, int);
  60. int adaptor_send_queue(zhandle_t *zh, int timeout)
  61. {
  62. return flush_send_queue(zh, timeout);
  63. }
  64. int32_t inc_ref_counter(zhandle_t* zh,int i)
  65. {
  66. zh->ref_counter+=(i<0?-1:(i>0?1:0));
  67. return zh->ref_counter;
  68. }
  69. int32_t get_xid()
  70. {
  71. static int32_t xid = -1;
  72. if (xid == -1) {
  73. xid = time(0);
  74. }
  75. return xid++;
  76. }
  77. void enter_critical(zhandle_t* zh){}
  78. void leave_critical(zhandle_t* zh){}