Motr  M0
misc.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_USER_SPACE_MISC_H__
26 #define __MOTR_LIB_USER_SPACE_MISC_H__
27 
28 #ifndef offsetof
29 #define offsetof(typ,memb) __builtin_offsetof(typ, memb)
30 #endif
31 
32 #ifndef container_of
33 #define container_of(ptr, type, member) \
34  ((type *)((char *)(ptr)-(char *)(&((type *)0)->member)))
35 #endif
36 
37 #ifndef NULL
38 #define NULL ((void *)0)
39 #endif
40 
44 #ifndef ARRAY_SIZE
45 #define ARRAY_SIZE(a) ((sizeof (a)) / (sizeof (a)[0]))
46 #endif
47 
48 #define M0_EXPORTED(s)
49 
53 M0_INTERNAL int m0_host_resolve(const char *name, char *buf, size_t bufsiz);
54 
60 M0_INTERNAL void m0_performance_counters(char *buf, size_t buf_len);
61 
62 #endif /* __MOTR_LIB_USER_SPACE_MISC_H__ */
63 
64 /*
65  * Local variables:
66  * c-indentation-style: "K&R"
67  * c-basic-offset: 8
68  * tab-width: 8
69  * fill-column: 80
70  * scroll-step: 1
71  * End:
72  */
Definition: sock.c:887
M0_INTERNAL void m0_performance_counters(char *buf, size_t buf_len)
Definition: umisc.c:82
const char * name
Definition: trace.c:110
M0_INTERNAL int m0_host_resolve(const char *name, char *buf, size_t bufsiz)
Definition: umisc.c:49