Motr  M0
ufid.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * For any questions about this software or licensing,
17  * please email opensource@seagate.com or cortx-questions@seagate.com.
18  *
19  */
20 
21 
22 #pragma once
23 
24 #ifndef __MOTR_HELPERS_UFID_H__
25 #define __MOTR_HELPERS_UFID_H__
26 
27 #include "motr/client.h"
28 
130 enum {
138  M0_UFID_BASE_TS = 1514764800L,
139 
142 
145 };
146 
154 };
155 
159 };
160 
168 };
169 
170 #define UFID_MASK(N) ((1UL << N) - 1UL)
171 #define M0_UFID_GENID_MASK UFID_MASK(M0_UFID_GENID_BITS)
172 #define M0_UFID_GENID_HI_MASK UFID_MASK(M0_UFID_GENID_HI_BITS)
173 #define M0_UFID_GENID_LO_MASK UFID_MASK(M0_UFID_GENID_LO_BITS)
174 #define M0_UFID_SALT_MASK UFID_MASK(M0_UFID_SALT_BITS)
175 #define M0_UFID_SEQID_MASK UFID_MASK(M0_UFID_SEQID_BITS)
176 #define M0_UFID_PROCID_MASK UFID_MASK(M0_UFID_PROCID_BITS)
177 #define M0_UFID_RESERVED_MASK UFID_MASK(M0_UFID_RESERVED_BITS)
178 
179 #define M0_UFID_HI_RESERVED \
180  (UINT64_MAX << (64UL - M0_UFID_RESERVED_BITS))
181 #define M0_UFID_SEQID_MAX (1UL << M0_UFID_SEQID_BITS)
182 #define M0_UFID_PROCID_MAX (1UL << M0_UFID_PROCID_BITS)
183 
184 struct m0_ufid {
185  uint64_t uf_reserved; /* 37 bits reserver by MOTR */
186  uint32_t uf_salt; /* 11 bit random salt */
187  uint32_t uf_gen_id; /* 31 bit generation timestamp */
188  uint32_t uf_proc_id; /* 29 bit service uid */
189  uint32_t uf_seq_id; /* 20 bit Sequence No */
190 };
191 
209 };
210 
211 #endif /* __MOTR_HELPERS_UFID_H__ */
212 
213 /*
214  * Local variables:
215  * c-indentation-style: "K&R"
216  * c-basic-offset: 8
217  * tab-width: 8
218  * fill-column: 80
219  * scroll-step: 1
220  * End:
221  */
222 /*
223  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
224  */
uint32_t uf_seq_id
Definition: ufid.h:189
struct m0_mutex ufg_lock
Definition: ufid.h:207
struct m0_ufid ufg_ufid_cur
Definition: ufid.h:208
Definition: ufid.h:184
m0_ufid_gen_id_format
Definition: ufid.h:156
m0_ufid_procid_format
Definition: ufid.h:165
uint32_t uf_salt
Definition: ufid.h:186
uint64_t uf_reserved
Definition: ufid.h:185
m0_ufid_format
Definition: ufid.h:147
bool ufg_is_initialised
Definition: ufid.h:202
uint32_t uf_proc_id
Definition: ufid.h:188
struct m0_client * ufg_m0c
Definition: ufid.h:201
Definition: mutex.h:47
uint32_t uf_gen_id
Definition: ufid.h:187