You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.6 KiB

GPL license update (same change as was done for all files in 5.1). storage/maria/Makefile.am: GPL license update storage/maria/ft_maria.c: GPL license update storage/maria/ha_maria.cc: GPL license update storage/maria/ha_maria.h: GPL license update storage/maria/lockman.c: GPL license update storage/maria/lockman.h: GPL license update storage/maria/ma_bitmap.c: GPL license update storage/maria/ma_blockrec.c: GPL license update storage/maria/ma_blockrec.h: GPL license update storage/maria/ma_cache.c: GPL license update storage/maria/ma_changed.c: GPL license update storage/maria/ma_check.c: GPL license update storage/maria/ma_checkpoint.c: GPL license update storage/maria/ma_checkpoint.h: GPL license update storage/maria/ma_checksum.c: GPL license update storage/maria/ma_close.c: GPL license update storage/maria/ma_control_file.c: GPL license update storage/maria/ma_control_file.h: GPL license update storage/maria/ma_create.c: GPL license update storage/maria/ma_dbug.c: GPL license update storage/maria/ma_delete.c: GPL license update storage/maria/ma_delete_all.c: GPL license update storage/maria/ma_delete_table.c: GPL license update storage/maria/ma_dynrec.c: GPL license update storage/maria/ma_extra.c: GPL license update storage/maria/ma_ft_boolean_search.c: GPL license update storage/maria/ma_ft_eval.c: GPL license update storage/maria/ma_ft_eval.h: GPL license update storage/maria/ma_ft_nlq_search.c: GPL license update storage/maria/ma_ft_parser.c: GPL license update storage/maria/ma_ft_stem.c: GPL license update storage/maria/ma_ft_test1.c: GPL license update storage/maria/ma_ft_test1.h: GPL license update storage/maria/ma_ft_update.c: GPL license update storage/maria/ma_ftdefs.h: GPL license update storage/maria/ma_fulltext.h: GPL license update storage/maria/ma_info.c: GPL license update storage/maria/ma_init.c: GPL license update storage/maria/ma_key.c: GPL license update storage/maria/ma_keycache.c: GPL license update storage/maria/ma_least_recently_dirtied.c: GPL license update storage/maria/ma_least_recently_dirtied.h: GPL license update storage/maria/ma_locking.c: GPL license update storage/maria/ma_open.c: GPL license update storage/maria/ma_packrec.c: GPL license update storage/maria/ma_page.c: GPL license update storage/maria/ma_panic.c: GPL license update storage/maria/ma_preload.c: GPL license update storage/maria/ma_range.c: GPL license update storage/maria/ma_recovery.c: GPL license update storage/maria/ma_recovery.h: GPL license update storage/maria/ma_rename.c: GPL license update storage/maria/ma_rfirst.c: GPL license update storage/maria/ma_rkey.c: GPL license update storage/maria/ma_rlast.c: GPL license update storage/maria/ma_rnext.c: GPL license update storage/maria/ma_rnext_same.c: GPL license update storage/maria/ma_rprev.c: GPL license update storage/maria/ma_rrnd.c: GPL license update storage/maria/ma_rsame.c: GPL license update storage/maria/ma_rsamepos.c: GPL license update storage/maria/ma_rt_index.c: GPL license update storage/maria/ma_rt_index.h: GPL license update storage/maria/ma_rt_key.c: GPL license update storage/maria/ma_rt_key.h: GPL license update storage/maria/ma_rt_mbr.c: GPL license update storage/maria/ma_rt_mbr.h: GPL license update storage/maria/ma_rt_split.c: GPL license update storage/maria/ma_rt_test.c: GPL license update storage/maria/ma_scan.c: GPL license update storage/maria/ma_search.c: GPL license update storage/maria/ma_sort.c: GPL license update storage/maria/ma_sp_defs.h: GPL license update storage/maria/ma_sp_key.c: GPL license update storage/maria/ma_sp_test.c: GPL license update storage/maria/ma_static.c: GPL license update storage/maria/ma_statrec.c: GPL license update storage/maria/ma_test1.c: GPL license update storage/maria/ma_test2.c: GPL license update storage/maria/ma_test3.c: GPL license update storage/maria/ma_unique.c: GPL license update storage/maria/ma_update.c: GPL license update storage/maria/ma_write.c: GPL license update storage/maria/maria_chk.c: GPL license update storage/maria/maria_def.h: GPL license update storage/maria/maria_ftdump.c: GPL license update storage/maria/maria_pack.c: GPL license update storage/maria/tablockman.c: GPL license update storage/maria/tablockman.h: GPL license update storage/maria/trnman.c: GPL license update storage/maria/trnman.h: GPL license update
19 years ago
  1. /* Copyright (C) 2006 MySQL AB
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  12. #ifndef _lockman_h
  13. #define _lockman_h
  14. /*
  15. Lock levels:
  16. ^^^^^^^^^^^
  17. N - "no lock", not a lock, used sometimes internally to simplify the code
  18. S - Shared
  19. X - eXclusive
  20. IS - Intention Shared
  21. IX - Intention eXclusive
  22. SIX - Shared + Intention eXclusive
  23. LS - Loose Shared
  24. LX - Loose eXclusive
  25. SLX - Shared + Loose eXclusive
  26. LSIX - Loose Shared + Intention eXclusive
  27. */
  28. enum lockman_lock_type { N, S, X, IS, IX, SIX, LS, LX, SLX, LSIX, LOCK_TYPE_LAST };
  29. struct lockman_lock;
  30. typedef struct st_lock_owner LOCK_OWNER;
  31. struct st_lock_owner {
  32. LF_PINS *pins; /* must be allocated from lockman's pinbox */
  33. struct lockman_lock *all_locks; /* a LIFO */
  34. LOCK_OWNER *waiting_for;
  35. pthread_cond_t *cond; /* transactions waiting for this, wait on 'cond' */
  36. pthread_mutex_t *mutex; /* mutex is required to use 'cond' */
  37. uint16 loid;
  38. };
  39. typedef LOCK_OWNER *loid_to_lo_func(uint16);
  40. typedef struct {
  41. LF_DYNARRAY array; /* hash itself */
  42. LF_ALLOCATOR alloc; /* allocator for elements */
  43. int32 volatile size; /* size of array */
  44. int32 volatile count; /* number of elements in the hash */
  45. uint lock_timeout;
  46. loid_to_lo_func *loid_to_lo;
  47. } LOCKMAN;
  48. #define DIDNT_GET_THE_LOCK 0
  49. enum lockman_getlock_result {
  50. NO_MEMORY_FOR_LOCK=1, DEADLOCK, LOCK_TIMEOUT,
  51. GOT_THE_LOCK,
  52. GOT_THE_LOCK_NEED_TO_LOCK_A_SUBRESOURCE,
  53. GOT_THE_LOCK_NEED_TO_INSTANT_LOCK_A_SUBRESOURCE
  54. };
  55. void lockman_init(LOCKMAN *, loid_to_lo_func *, uint);
  56. void lockman_destroy(LOCKMAN *);
  57. enum lockman_getlock_result lockman_getlock(LOCKMAN *lm, LOCK_OWNER *lo,
  58. uint64 resource,
  59. enum lockman_lock_type lock);
  60. int lockman_release_locks(LOCKMAN *, LOCK_OWNER *);
  61. #ifdef EXTRA_DEBUG
  62. void print_lockhash(LOCKMAN *lm);
  63. #endif
  64. #endif