Motr  M0
bitmap.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_LIB_BITMAP_H__
26 #define __MOTR_LIB_BITMAP_H__
27 
28 #include "lib/types.h"
29 #include "lib/assert.h"
30 #include "xcode/xcode_attr.h"
31 
42 struct m0_bitmap {
44  size_t b_nr;
46  uint64_t *b_words;
47 };
48 
51  size_t bo_size;
53  uint64_t *bo_words;
54 } M0_XCA_SEQUENCE M0_XCA_DOMAIN(conf|rpc);
55 
68 M0_INTERNAL int m0_bitmap_init(struct m0_bitmap *map, size_t nr);
69 
76 M0_INTERNAL void m0_bitmap_fini(struct m0_bitmap *map);
77 
87 M0_INTERNAL bool m0_bitmap_get(const struct m0_bitmap *map, size_t idx);
88 
95 M0_INTERNAL int m0_bitmap_ffs(const struct m0_bitmap *map);
96 
103 M0_INTERNAL int m0_bitmap_ffz(const struct m0_bitmap *map);
104 
113 M0_INTERNAL void m0_bitmap_set(struct m0_bitmap *map, size_t idx, bool val);
114 
118 M0_INTERNAL void m0_bitmap_reset(struct m0_bitmap *map);
119 
127 M0_INTERNAL void m0_bitmap_copy(struct m0_bitmap *dst,
128  const struct m0_bitmap *src);
129 
133 M0_INTERNAL size_t m0_bitmap_set_nr(const struct m0_bitmap *map);
134 
146 M0_INTERNAL int m0_bitmap_onwire_init(struct m0_bitmap_onwire *ow_map,
147  size_t nr);
154 M0_INTERNAL void m0_bitmap_onwire_fini(struct m0_bitmap_onwire *ow_map);
155 
163 M0_INTERNAL void m0_bitmap_store(const struct m0_bitmap *im_map,
164  struct m0_bitmap_onwire *ow_map);
165 
172 M0_INTERNAL void m0_bitmap_load(const struct m0_bitmap_onwire *ow_map,
173  struct m0_bitmap *im_map);
174 
175 M0_BASSERT(8 == sizeof ((struct m0_bitmap *)0)->b_words[0]);
176 
178 #endif /* __MOTR_LIB_BITMAP_H__ */
179 
180 /*
181  * Local variables:
182  * c-indentation-style: "K&R"
183  * c-basic-offset: 8
184  * tab-width: 8
185  * fill-column: 80
186  * scroll-step: 1
187  * End:
188  */
static size_t nr
Definition: dump.c:1505
M0_INTERNAL int m0_bitmap_init(struct m0_bitmap *map, size_t nr)
Definition: bitmap.c:86
M0_INTERNAL void m0_bitmap_fini(struct m0_bitmap *map)
Definition: bitmap.c:97
static struct m0_bufvec dst
Definition: xform.c:61
map
Definition: processor.c:112
Definition: idx_mock.c:52
Definition: conf.py:1
M0_INTERNAL size_t m0_bitmap_set_nr(const struct m0_bitmap *map)
Definition: bitmap.c:172
M0_INTERNAL void m0_bitmap_store(const struct m0_bitmap *im_map, struct m0_bitmap_onwire *ow_map)
Definition: bitmap.c:200
M0_INTERNAL void m0_bitmap_onwire_fini(struct m0_bitmap_onwire *ow_map)
Definition: bitmap.c:192
M0_INTERNAL int m0_bitmap_onwire_init(struct m0_bitmap_onwire *ow_map, size_t nr)
Definition: bitmap.c:182
M0_INTERNAL int m0_bitmap_ffz(const struct m0_bitmap *map)
Definition: bitmap.c:126
uint64_t * bo_words
Definition: bitmap.h:53
size_t bo_size
Definition: bitmap.h:51
M0_INTERNAL void m0_bitmap_set(struct m0_bitmap *map, size_t idx, bool val)
Definition: bitmap.c:139
M0_INTERNAL int m0_bitmap_ffs(const struct m0_bitmap *map)
Definition: bitmap.c:112
M0_INTERNAL void m0_bitmap_copy(struct m0_bitmap *dst, const struct m0_bitmap *src)
Definition: bitmap.c:158
uint64_t * b_words
Definition: bitmap.h:46
struct m0_bitmap_onwire M0_XCA_DOMAIN(conf|rpc)
M0_INTERNAL bool m0_bitmap_get(const struct m0_bitmap *map, size_t idx)
Definition: bitmap.c:105
M0_BASSERT(8==sizeof((struct m0_bitmap *) 0) ->b_words[0])
M0_INTERNAL void m0_bitmap_reset(struct m0_bitmap *map)
Definition: bitmap.c:149
size_t b_nr
Definition: bitmap.h:44
M0_INTERNAL void m0_bitmap_load(const struct m0_bitmap_onwire *ow_map, struct m0_bitmap *im_map)
Definition: bitmap.c:213
struct m0_pdclust_src_addr src
Definition: fd.c:108