stackglue.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* -*- mode: c; c-basic-offset: 8; -*-
  2. * vim: noexpandtab sw=8 ts=8 sts=0:
  3. *
  4. * stackglue.c
  5. *
  6. * Code which implements an OCFS2 specific interface to underlying
  7. * cluster stacks.
  8. *
  9. * Copyright (C) 2007 Oracle. All rights reserved.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public
  13. * License as published by the Free Software Foundation, version 2.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. */
  20. #include <linux/types.h>
  21. #include <linux/list.h>
  22. #include "dlm/dlmapi.h"
  23. #include "stackglue.h"
  24. static struct ocfs2_locking_protocol *lproto;
  25. enum dlm_status ocfs2_dlm_lock(struct dlm_ctxt *dlm,
  26. int mode,
  27. struct dlm_lockstatus *lksb,
  28. u32 flags,
  29. void *name,
  30. unsigned int namelen,
  31. void *astarg)
  32. {
  33. BUG_ON(lproto == NULL);
  34. return dlmlock(dlm, mode, lksb, flags, name, namelen,
  35. lproto->lp_lock_ast, astarg,
  36. lproto->lp_blocking_ast);
  37. }
  38. enum dlm_status ocfs2_dlm_unlock(struct dlm_ctxt *dlm,
  39. struct dlm_lockstatus *lksb,
  40. u32 flags,
  41. void *astarg)
  42. {
  43. BUG_ON(lproto == NULL);
  44. return dlmunlock(dlm, lksb, flags, lproto->lp_unlock_ast, astarg);
  45. }
  46. void o2cb_get_stack(struct ocfs2_locking_protocol *proto)
  47. {
  48. BUG_ON(proto == NULL);
  49. lproto = proto;
  50. }
  51. void o2cb_put_stack(void)
  52. {
  53. lproto = NULL;
  54. }