]> git.proxmox.com Git - ceph.git/blob - ceph/src/pmdk/src/libpmemobj/list.h
import ceph 16.2.7
[ceph.git] / ceph / src / pmdk / src / libpmemobj / list.h
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright 2015-2020, Intel Corporation */
3
4 /*
5 * list.h -- internal definitions for persistent atomic lists module
6 */
7
8 #ifndef LIBPMEMOBJ_LIST_H
9 #define LIBPMEMOBJ_LIST_H 1
10
11 #include <stddef.h>
12 #include <stdint.h>
13 #include <sys/types.h>
14
15 #include "libpmemobj.h"
16 #include "lane.h"
17 #include "pmalloc.h"
18 #include "ulog.h"
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 struct list_entry {
25 PMEMoid pe_next;
26 PMEMoid pe_prev;
27 };
28
29 struct list_head {
30 PMEMoid pe_first;
31 PMEMmutex lock;
32 };
33
34 int list_insert_new_user(PMEMobjpool *pop,
35 size_t pe_offset, struct list_head *user_head, PMEMoid dest, int before,
36 size_t size, uint64_t type_num, palloc_constr constructor, void *arg,
37 PMEMoid *oidp);
38
39 int list_insert(PMEMobjpool *pop,
40 ssize_t pe_offset, struct list_head *head, PMEMoid dest, int before,
41 PMEMoid oid);
42
43 int list_remove_free_user(PMEMobjpool *pop,
44 size_t pe_offset, struct list_head *user_head,
45 PMEMoid *oidp);
46
47 int list_remove(PMEMobjpool *pop,
48 ssize_t pe_offset, struct list_head *head,
49 PMEMoid oid);
50
51 int list_move(PMEMobjpool *pop,
52 size_t pe_offset_old, struct list_head *head_old,
53 size_t pe_offset_new, struct list_head *head_new,
54 PMEMoid dest, int before, PMEMoid oid);
55
56 void list_move_oob(PMEMobjpool *pop,
57 struct list_head *head_old, struct list_head *head_new,
58 PMEMoid oid);
59
60 #ifdef __cplusplus
61 }
62 #endif
63
64 #endif