File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44#include <stdatomic.h>
55#include <stdio.h>
66
7+ enum msg_head_flag {
8+ MSG_HEAD_FLAG_RESERVED = 1 ,
9+ MSG_HEAD_FLAG_COMMITED ,
10+ MSG_HEAD_FLAG_DISCARDED ,
11+ };
12+
13+ struct msg_head {
14+ unsigned total_size ;
15+ atomic_uint flags ;
16+
17+ char data [];
18+ };
19+
720/* todo: optimize page size macro */
821#define PAGE_SIZE 4096
922
@@ -62,4 +75,9 @@ static inline unsigned int fifo_unused(struct fifo *fifo)
6275 return fifo_size (fifo ) - fifo_used (fifo );
6376}
6477
78+ static inline unsigned int msg_head_size (void )
79+ {
80+ return sizeof (struct msg_head );
81+ }
82+
6583#endif
Original file line number Diff line number Diff line change 33
44#include <pthread.h>
55#include <stdalign.h>
6- #include <stdatomic.h>
76#include <stddef.h>
87
98#define container_of (ptr , type , member ) ((type *)((char *)(ptr) - offsetof(type, member)))
@@ -26,19 +25,6 @@ enum _msg_cmd {
2625 MSG_CMD_FLUSH ,
2726};
2827
29- enum msg_head_flag {
30- MSG_HEAD_FLAG_RESERVED = 1 ,
31- MSG_HEAD_FLAG_COMMITED ,
32- MSG_HEAD_FLAG_DISCARDED ,
33- };
34-
35- struct msg_head {
36- unsigned total_size ;
37- atomic_uint flags ;
38-
39- char data [];
40- };
41-
4228struct msg_type {
4329 unsigned long val ;
4430};
@@ -83,11 +69,6 @@ struct zlog_output_data {
8369 } time_str ;
8470};
8571
86- static inline unsigned int msg_head_size (void )
87- {
88- return sizeof (struct msg_head );
89- }
90-
9172static inline unsigned int msg_usr_str_size (void )
9273{
9374 return sizeof (struct msg_usr_str );
You can’t perform that action at this time.
0 commit comments