PostgreSQL Source Code: src/include/lib/ilist.h File Reference (original) (raw)

Go to the source code of this file.
| Data Structures | |
|---|---|
| struct | dlist_node |
| struct | dlist_head |
| struct | dlist_iter |
| struct | dlist_mutable_iter |
| struct | dclist_head |
| struct | slist_node |
| struct | slist_head |
| struct | slist_iter |
| struct | slist_mutable_iter |
| Typedefs | |
|---|---|
| typedef struct dlist_node | dlist_node |
| typedef struct dlist_head | dlist_head |
| typedef struct dlist_iter | dlist_iter |
| typedef struct dlist_mutable_iter | dlist_mutable_iter |
| typedef struct dclist_head | dclist_head |
| typedef struct slist_node | slist_node |
| typedef struct slist_head | slist_head |
| typedef struct slist_iter | slist_iter |
| typedef struct slist_mutable_iter | slist_mutable_iter |
◆ dclist_container
Definition at line 947 of file ilist.h.
986{
987 head->head.next = NULL;
988}
989
990
991
992
993static inline bool
995{
997
999}
1000
1001
1002
1003
1004static inline void
1006{
1009
1011}
1012
1013
1014
1015
1016static inline void
1018{
1021}
1022
1023
1024
1025
1028{
1030
1035 return node;
1036}
1037
1038
1039
1040
1041static inline bool
1043{
1045
1047}
1048
1049
1050
1051
1054{
1056 return node->next;
1057}
1058
1059
1060static inline void *
1062{
1064 return (char *) head->head.next - off;
1065}
1066
1067
1068
1069
1072{
1074}
1075
1076
1077
1078
1079
1080
1081
1082static inline void
1084{
1085
1086
1087
1088
1089
1091
1092
1093
1094
1095
1097}
1098
1099
1100
1101
1102
1103
1104
1105#define slist_container(type, membername, ptr) \
1106 (StaticAssertVariableIsOfTypeMacro(ptr, slist_node *), \
1107 StaticAssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node), \
1108 ((type *) ((char *) (ptr) - offsetof(type, membername))))
1109
1110
1111
1112
1113
1114
1115#define slist_head_element(type, membername, lhead) \
1116 (StaticAssertVariableIsOfTypeMacro(((type *) NULL)->membername, slist_node), \
1117 (type *) slist_head_element_off(lhead, offsetof(type, membername)))
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131#define slist_foreach(iter, lhead) \
1132 for (StaticAssertVariableIsOfTypeMacro(iter, slist_iter), \
1133 StaticAssertVariableIsOfTypeMacro(lhead, slist_head *), \
1134 (iter).cur = (lhead)->head.next; \
1135 (iter).cur != NULL; \
1136 (iter).cur = (iter).cur->next)
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147#define slist_foreach_modify(iter, lhead) \
1148 for (StaticAssertVariableIsOfTypeMacro(iter, slist_mutable_iter), \
1149 StaticAssertVariableIsOfTypeMacro(lhead, slist_head *), \
1150 (iter).prev = &(lhead)->head, \
1151 (iter).cur = (iter).prev->next, \
1152 (iter).next = (iter).cur ? (iter).cur->next : NULL; \
1153 (iter).cur != NULL; \
1154 (iter).prev = (iter).cur, \
1155 (iter).cur = (iter).next, \
1156 (iter).next = (iter).next ? (iter).next->next : NULL)
1157
1158#endif
#define Assert(condition)
static void slist_delete_current(slist_mutable_iter *iter)
static void * slist_head_element_off(slist_head *head, size_t off)
static bool slist_is_empty(const slist_head *head)
static slist_node * slist_next_node(slist_head *head, slist_node *node)
static void slist_insert_after(slist_node *after, slist_node *node)
static void slist_push_head(slist_head *head, slist_node *node)
#define slist_check(head)
static bool slist_has_next(const slist_head *head, const slist_node *node)
static slist_node * slist_pop_head_node(slist_head *head)
static slist_node * slist_head_node(slist_head *head)
◆ dclist_foreach
◆ dclist_foreach_modify
◆ dclist_head_element
Value:
#define StaticAssertVariableIsOfTypeMacro(varname, typename)
static void * dclist_head_element_off(dclist_head *head, size_t off)
Definition at line 955 of file ilist.h.
◆ dclist_reverse_foreach
◆ DCLIST_STATIC_INIT
◆ dclist_tail_element
Value:
static void * dclist_tail_element_off(dclist_head *head, size_t off)
Definition at line 964 of file ilist.h.
◆ dlist_check
◆ dlist_container
◆ dlist_foreach
Value:
(iter).end = &(lhead)->head, \
(iter).cur = (iter).end->next ? (iter).end->next : (iter).end; \
(iter).cur != (iter).end; \
(iter).cur = (iter).cur->next)
Definition at line 623 of file ilist.h.
627 : (iter).end; \
628 (iter).cur != (iter).end; \
629 (iter).cur = (iter).cur->next)
◆ dlist_foreach_modify
Value:
(iter).end = &(lhead)->head, \
(iter).cur = (iter).end->next ? (iter).end->next : (iter).end, \
(iter).cur != (iter).end; \
Definition at line 640 of file ilist.h.
644 : (iter).end, \
645 (iter).next = (iter).cur->next; \
646 (iter).cur != (iter).end; \
647 (iter).cur = (iter).next, (iter).next = (iter).cur->next)
◆ dlist_head_element
Value:
static void * dlist_head_element_off(dlist_head *head, size_t off)
Definition at line 603 of file ilist.h.
◆ dlist_member_check
| #define dlist_member_check | ( | | head, | | ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | | ----- | | | node | | | | | ) | ((void) (head)) | | |
◆ dlist_reverse_foreach
Value:
(iter).end = &(lhead)->head, \
(iter).cur = (iter).end->prev ? (iter).end->prev : (iter).end; \
(iter).cur != (iter).end; \
(iter).cur = (iter).cur->prev)
Definition at line 654 of file ilist.h.
658 : (iter).end; \
659 (iter).cur != (iter).end; \
660 (iter).cur = (iter).cur->prev)
◆ DLIST_STATIC_INIT
◆ dlist_tail_element
Value:
static void * dlist_tail_element_off(dlist_head *head, size_t off)
Definition at line 612 of file ilist.h.
◆ slist_check
◆ slist_container
◆ slist_foreach
◆ slist_foreach_modify
Value:
(iter).prev = &(lhead)->head, \
(iter).cur = (iter).prev->next, \
(iter).next = (iter).cur ? (iter).cur->next : NULL; \
(iter).prev = (iter).cur, \
Definition at line 1148 of file ilist.h.
1155 (iter).prev = (iter).cur, \
1156 (iter).cur = (iter).next, \
◆ slist_head_element
◆ SLIST_STATIC_INIT
◆ dclist_head
◆ dlist_head
◆ dlist_iter
◆ dlist_mutable_iter
◆ dlist_node
◆ slist_head
◆ slist_iter
◆ slist_mutable_iter
◆ slist_node
◆ dclist_count()
Definition at line 932 of file ilist.h.
933{
935
936 return head->count;
937}
static bool dlist_is_empty(const dlist_head *head)
References Assert, dclist_head::count, dclist_head::dlist, and dlist_is_empty().
Referenced by AtEOSubXact_PgStat_DroppedStats(), AtEOXact_PgStat_DroppedStats(), av_worker_available(), DeadLockCheck(), ExpandConstraints(), GetSingleProcBlockerStatusData(), InvalidateConstraintCacheCallBack(), logical_heap_rewrite_flush_mappings(), mXactCachePut(), pgaio_closing_fd(), pgaio_io_wait_for_free(), pgaio_shutdown(), pgstat_get_transactional_drops(), ReorderBufferGetCatalogChangesXacts(), SlabAllocFromNewBlock(), SlabFree(), SlabStats(), SnapBuildSerialize(), and TopoSort().
◆ dclist_delete_from()
Definition at line 763 of file ilist.h.
764{
766
769}
static void dlist_delete_from(dlist_head *head, dlist_node *node)
References Assert, dclist_head::count, dclist_head::dlist, and dlist_delete_from().
Referenced by AtEOSubXact_PgStat_DroppedStats(), AtEOXact_PgStat_DroppedStats(), InvalidateConstraintCacheCallBack(), logical_heap_rewrite_flush_mappings(), mXactCachePut(), pgaio_io_reclaim(), ReorderBufferCleanupTXN(), and SlabReset().
◆ dclist_delete_from_thoroughly()
◆ dclist_has_next()
◆ dclist_has_prev()
◆ dclist_head_element_off()
◆ dclist_head_node()
◆ dclist_init()
Definition at line 671 of file ilist.h.
672{
675}
static void dlist_init(dlist_head *head)
References dclist_head::count, dclist_head::dlist, and dlist_init().
Referenced by AioShmemInit(), AtEOXact_MultiXact(), AutoVacuumShmemInit(), dclist_push_head(), dclist_push_tail(), DeadLockCheck(), lock_twophase_recover(), logical_rewrite_log_mapping(), pgstat_get_xact_stack_level(), PostPrepare_MultiXact(), ReorderBufferAllocate(), SetupLockInTable(), and SlabContextCreate().
◆ dclist_insert_after()
◆ dclist_insert_before()
◆ dclist_is_empty()
Definition at line 682 of file ilist.h.
683{
685 return (head->count == 0);
686}
References Assert, dclist_head::count, dclist_head::dlist, and dlist_is_empty().
Referenced by dclist_head_element_off(), dclist_tail_element_off(), JoinWaitQueue(), pgaio_closing_fd(), pgaio_io_acquire_nb(), pgaio_io_wait_for_free(), pgaio_shutdown(), ProcLockWakeup(), and RemoveFromWaitQueue().
◆ dclist_move_head()
◆ dclist_move_tail()
◆ dclist_next_node()
◆ dclist_pop_head_node()
◆ dclist_prev_node()
◆ dclist_push_head()
Definition at line 693 of file ilist.h.
694{
695 if (head->dlist.head.next == NULL)
697
700
702}
static void dlist_push_head(dlist_head *head, dlist_node *node)
static void dclist_init(dclist_head *head)
References Assert, dclist_head::count, dclist_init(), dclist_head::dlist, dlist_push_head(), fb(), dlist_head::head, and dlist_node::next.
Referenced by AutoVacLauncherMain(), AutoVacuumShmemInit(), FreeWorkerInfo(), mXactCachePut(), pgaio_io_reclaim(), and SlabFree().
◆ dclist_push_tail()
Definition at line 709 of file ilist.h.
710{
711 if (head->dlist.head.next == NULL)
713
716
718}
static void dlist_push_tail(dlist_head *head, dlist_node *node)
References Assert, dclist_head::count, dclist_init(), dclist_head::dlist, dlist_push_tail(), fb(), dlist_head::head, and dlist_node::next.
Referenced by AioShmemInit(), AtEOSubXact_PgStat_DroppedStats(), create_drop_transactional_internal(), DeadLockCheck(), JoinWaitQueue(), logical_rewrite_log_mapping(), pgaio_io_prepare_submit(), ReorderBufferXidSetCatalogChanges(), and ri_LoadConstraintInfo().
◆ dclist_tail_element_off()
◆ dclist_tail_node()
◆ dlist_delete()
Definition at line 405 of file ilist.h.
References dlist_node::next, and dlist_node::prev.
Referenced by _gin_build_tuple(), BumpBlockFree(), CatCacheRemoveCList(), CatCacheRemoveCTup(), CheckTargetForConflictsIn(), CleanUpLock(), ClearOldPredicateLocks(), DeleteChildTargetLocks(), DeleteLockTarget(), DestroyParallelContext(), dlist_delete_from(), dlist_move_head(), dlist_move_tail(), dlist_pop_head_node(), DropAllPredicateLocksFromTable(), DropCachedPlan(), dsm_create(), dsm_detach(), ForgetBackgroundWorker(), ForgetManyTestResources(), FreeCachedExpression(), FreeWorkerInfo(), GenerationBlockFree(), get_flush_position(), leafRepackItems(), LockAcquireExtended(), pgstat_delete_pending_entry(), PostPrepare_Locks(), ProcKill(), RehashCatCache(), RehashCatCacheLists(), ReleaseManyTestResource(), ReleaseOneSerializableXact(), ReleasePostmasterChildSlot(), ReleasePredXact(), ReleaseRWConflict(), remove_cache_entry(), RemoveGUCFromLists(), ReorderBufferAssignChild(), ReorderBufferCleanupTXN(), ReorderBufferIterTXNNext(), ReorderBufferProcessTXN(), ReorderBufferRestoreChanges(), ReorderBufferSerializeTXN(), ReorderBufferToastReset(), ReorderBufferTransferSnapToParent(), ReorderBufferTruncateTXN(), set_guc_source(), SetPossibleUnsafeConflict(), SetRWConflict(), SlabReset(), smgrdestroy(), smgrpin(), TransferPredicateLocksToNewTarget(), XLogPrefetcherAddFilter(), and XLogPrefetcherCompleteFilters().
◆ dlist_delete_from()
◆ dlist_delete_from_thoroughly()
◆ dlist_delete_thoroughly()
◆ dlist_has_next()
◆ dlist_has_prev()
◆ dlist_head_element_off()
◆ dlist_head_node()
◆ dlist_init()
Definition at line 314 of file ilist.h.
References dlist_head::head, dlist_node::next, and dlist_node::prev.
Referenced by _gin_build_tuple(), AutoVacLauncherMain(), AutoVacuumShmemInit(), BumpContextCreate(), cache_purge_all(), CreatePredicateLock(), dclist_init(), disassembleLeaf(), dlist_push_head(), dlist_push_tail(), DropAllPredicateLocksFromTable(), ExecInitMemoize(), GenerationContextCreate(), GetSerializableTransactionSnapshotInt(), InitManyTestResourceKind(), InitPostmasterChildSlots(), InitProcGlobal(), lock_twophase_recover(), MarkAsPreparingGuts(), pgstat_shutdown_hook(), predicatelock_twophase_recover(), PredicateLockShmemInit(), rebuild_database_list(), ReleaseOneSerializableXact(), ReorderBufferAllocate(), ReorderBufferAllocTXN(), ReorderBufferIterTXNInit(), ReorderBufferToastAppendChunk(), ResourceOwnerCreate(), SetupLockInTable(), SlabContextCreate(), smgropen(), TransferPredicateLocksToNewTarget(), WalSndShmemInit(), and XLogPrefetcherAllocate().
◆ dlist_insert_after()
◆ dlist_insert_before()
◆ dlist_is_empty()
Definition at line 336 of file ilist.h.
337{
339
341}
#define dlist_check(head)
References dlist_check, fb(), dlist_head::head, and dlist_node::next.
Referenced by addItemsToLeaf(), AssignPostmasterChildSlot(), AtEOSubXact_Parallel(), AtEOXact_Parallel(), AutoVacLauncherMain(), BumpReset(), CheckForSerializableConflictOut(), CleanUpLock(), CreatePredXact(), dataBeginPlaceToPageLeaf(), dclist_count(), dclist_is_empty(), dlist_head_element_off(), dlist_pop_head_node(), dlist_tail_element_off(), dsm_backend_shutdown(), dsm_detach_all(), ForgetManyTestResources(), GenerationReset(), get_flush_position(), GetSafeSnapshot(), GetSerializableTransactionSnapshotInt(), InitAuxiliaryProcess(), InitProcess(), launcher_determine_sleep(), lock_twophase_recover(), LockReleaseAll(), LogicalRepApplyLoop(), ParallelContextActive(), pgstat_flush_pending_entries(), pgstat_report_stat(), pgstat_shutdown_hook(), PostPrepare_Locks(), ProcKill(), ReleasePredicateLocks(), RemoveTargetIfNoLongerUsed(), ReorderBufferBuildTupleCidHash(), ReorderBufferGetOldestTXN(), ReorderBufferGetOldestXmin(), ReorderBufferIterTXNFinish(), ReorderBufferIterTXNNext(), ReorderBufferRestoreChanges(), ReorderBufferSerializeTXN(), ReorderBufferStreamTXN(), ResourceOwnerReleaseInternal(), RWConflictExists(), SetPossibleUnsafeConflict(), SetRWConflict(), SetupLockInTable(), SlabAlloc(), SlabAllocFromNewBlock(), SlabFindNextBlockListIndex(), SlabFree(), SummarizeOldestCommittedSxact(), TransferPredicateLocksToNewTarget(), XLogPrefetcherCompleteFilters(), and XLogPrefetcherIsFiltered().
◆ dlist_move_head()
◆ dlist_move_tail()
◆ dlist_next_node()
◆ dlist_node_init()
◆ dlist_node_is_detached()
Definition at line 525 of file ilist.h.
References Assert, fb(), dlist_node::next, and dlist_node::prev.
Referenced by CheckDeadLock(), FindLockCycleRecurse(), LockErrorCleanup(), ProcWakeup(), RemoveFromWaitQueue(), SyncRepCancelWait(), SyncRepCleanupAtProcExit(), and SyncRepWaitForLSN().
◆ dlist_pop_head_node()
◆ dlist_prev_node()
◆ dlist_push_head()
Definition at line 347 of file ilist.h.
References dlist_check, dlist_init(), fb(), dlist_head::head, dlist_node::next, and dlist_node::prev.
Referenced by AllocDeadEndChild(), AssignPostmasterChildSlot(), AutoVacWorkerMain(), BackgroundWorkerStateChange(), BecomeLockGroupLeader(), BumpAllocFromNewBlock(), BumpContextCreate(), CatalogCacheCreateEntry(), CreateParallelContext(), dclist_push_head(), dlist_move_head(), dsm_create_descriptor(), GenerationAllocFromNewBlock(), GenerationAllocLarge(), GenerationContextCreate(), ProcKill(), rebuild_database_list(), RegisterBackgroundWorker(), ReleasePostmasterChildSlot(), SearchCatCacheList(), SlabAlloc(), SlabAllocFromNewBlock(), SlabFree(), SyncRepQueueInsert(), and XLogPrefetcherAddFilter().
◆ dlist_push_tail()
Definition at line 364 of file ilist.h.
References dlist_check, dlist_init(), fb(), dlist_head::head, dlist_node::next, and dlist_node::prev.
Referenced by _gin_build_tuple(), addItemsToLeaf(), BecomeLockGroupMember(), BumpAllocLarge(), cache_lookup(), CreatePredicateLock(), CreatePredXact(), dclist_push_tail(), disassembleLeaf(), dlist_move_tail(), DropAllPredicateLocksFromTable(), GetCachedExpression(), InitPostmasterChildSlots(), InitProcGlobal(), lock_twophase_recover(), pgstat_prep_pending_entry(), PostPrepare_Locks(), PredicateLockShmemInit(), ProcKill(), RehashCatCache(), RehashCatCacheLists(), ReleaseOneSerializableXact(), ReleasePredicateLocks(), ReleasePredXact(), ReleaseRWConflict(), RememberManyTestResources(), ReorderBufferAddNewTupleCids(), ReorderBufferAssignChild(), ReorderBufferIterTXNNext(), ReorderBufferQueueChange(), ReorderBufferRestoreChange(), ReorderBufferSetBaseSnapshot(), ReorderBufferToastAppendChunk(), ReorderBufferTXNByXid(), ResourceOwnerRememberAioHandle(), SaveCachedPlan(), set_guc_source(), SetPossibleUnsafeConflict(), SetRWConflict(), SetupLockInTable(), smgropen(), smgrunpin(), store_flush_position(), and TransferPredicateLocksToNewTarget().
◆ dlist_tail_element_off()
◆ dlist_tail_node()
◆ slist_delete()
◆ slist_delete_current()
◆ slist_has_next()
◆ slist_head_element_off()
◆ slist_head_node()
◆ slist_init()
◆ slist_insert_after()
◆ slist_is_empty()
◆ slist_next_node()
◆ slist_pop_head_node()
◆ slist_push_head()
Definition at line 1006 of file ilist.h.
References slist_head::head, slist_node::next, and slist_check.
Referenced by AtEOXact_GUC(), element_alloc(), EventTriggerSQLDropAddObject(), InitCatCache(), on_dsm_detach(), push_old_value(), ResetAllOptions(), set_config_with_handle(), and spi_dest_startup().