Branch data Line data Source code
1 : : #include <stdlib.h>
2 : : #include <unistd.h>
3 : :
4 : : #include <sys/types.h>
5 : : #include <sys/stat.h>
6 : :
7 : : #include <fcntl.h>
8 : : #include <arpa/inet.h>
9 : : #include <ctype.h>
10 : :
11 : : #include "asm/types.h"
12 : :
13 : : #include "compiler.h"
14 : : #include "log.h"
15 : :
16 : : #include "protobuf-desc.h"
17 : :
18 : : #include "protobuf/inventory.pb-c.h"
19 : : #include "protobuf/stats.pb-c.h"
20 : : #include "protobuf/regfile.pb-c.h"
21 : : #include "protobuf/ext-file.pb-c.h"
22 : : #include "protobuf/ns.pb-c.h"
23 : : #include "protobuf/eventfd.pb-c.h"
24 : : #include "protobuf/eventpoll.pb-c.h"
25 : : #include "protobuf/signalfd.pb-c.h"
26 : : #include "protobuf/fsnotify.pb-c.h"
27 : : #include "protobuf/core.pb-c.h"
28 : : #include "protobuf/mm.pb-c.h"
29 : : #include "protobuf/pipe.pb-c.h"
30 : : #include "protobuf/fifo.pb-c.h"
31 : : #include "protobuf/fdinfo.pb-c.h"
32 : : #include "protobuf/pipe-data.pb-c.h"
33 : : #include "protobuf/pstree.pb-c.h"
34 : : #include "protobuf/sa.pb-c.h"
35 : : #include "protobuf/sk-unix.pb-c.h"
36 : : #include "protobuf/sk-inet.pb-c.h"
37 : : #include "protobuf/packet-sock.pb-c.h"
38 : : #include "protobuf/sk-packet.pb-c.h"
39 : : #include "protobuf/creds.pb-c.h"
40 : : #include "protobuf/timer.pb-c.h"
41 : : #include "protobuf/utsns.pb-c.h"
42 : : #include "protobuf/ipc-var.pb-c.h"
43 : : #include "protobuf/ipc-shm.pb-c.h"
44 : : #include "protobuf/ipc-msg.pb-c.h"
45 : : #include "protobuf/ipc-sem.pb-c.h"
46 : : #include "protobuf/fs.pb-c.h"
47 : : #include "protobuf/remap-file-path.pb-c.h"
48 : : #include "protobuf/ghost-file.pb-c.h"
49 : : #include "protobuf/mnt.pb-c.h"
50 : : #include "protobuf/netdev.pb-c.h"
51 : : #include "protobuf/tcp-stream.pb-c.h"
52 : : #include "protobuf/tty.pb-c.h"
53 : : #include "protobuf/file-lock.pb-c.h"
54 : : #include "protobuf/rlimit.pb-c.h"
55 : : #include "protobuf/pagemap.pb-c.h"
56 : : #include "protobuf/siginfo.pb-c.h"
57 : : #include "protobuf/sk-netlink.pb-c.h"
58 : : #include "protobuf/vma.pb-c.h"
59 : : #include "protobuf/tun.pb-c.h"
60 : :
61 : : struct cr_pb_message_desc cr_pb_descs[PB_MAX];
62 : :
63 : : #define CR_PB_DESC(__type, __vtype, __ftype) \
64 : : CR_PB_MDESC_INIT(cr_pb_descs[PB_##__type], \
65 : : __vtype##Entry, \
66 : : __ftype##_entry)
67 : :
68 : : #define PB_PACK_TYPECHECK(__o, __fn) ({ if (0) __fn##__pack(__o, NULL); (pb_pack_t)&__fn##__pack; })
69 : : #define PB_GPS_TYPECHECK(__o, __fn) ({ if (0) __fn##__get_packed_size(__o); (pb_getpksize_t)&__fn##__get_packed_size; })
70 : : #define PB_UNPACK_TYPECHECK(__op, __fn) ({ if (0) *__op = __fn##__unpack(NULL, 0, NULL); (pb_unpack_t)&__fn##__unpack; })
71 : : #define PB_FREE_TYPECHECK(__o, __fn) ({ if (0) __fn##__free_unpacked(__o, NULL); (pb_free_t)&__fn##__free_unpacked; })
72 : :
73 : : /*
74 : : * This should be explicitly "called" to do type-checking
75 : : */
76 : :
77 : : #define CR_PB_MDESC_INIT(__var, __type, __name) \
78 : : do { \
79 : : __var.getpksize = PB_GPS_TYPECHECK((__type *)NULL, __name); \
80 : : __var.pack = PB_PACK_TYPECHECK((__type *)NULL, __name); \
81 : : __var.unpack = PB_UNPACK_TYPECHECK((__type **)NULL, __name); \
82 : : __var.free = PB_FREE_TYPECHECK((__type *)NULL, __name); \
83 : : __var.pb_desc = &__name##__descriptor; \
84 : : } while (0)
85 : :
86 : 3703 : void cr_pb_init(void)
87 : : {
88 : 3703 : CR_PB_DESC(IDS, TaskKobjIds, task_kobj_ids);
89 : 3703 : CR_PB_DESC(SIGACT, Sa, sa);
90 : 3703 : CR_PB_DESC(SK_QUEUES, SkPacket, sk_packet);
91 : 3703 : CR_PB_MDESC_INIT(cr_pb_descs[PB_IPCNS_MSG], IpcMsg, ipc_msg);
92 : 3703 : CR_PB_DESC(IPCNS_MSG_ENT, IpcMsg, ipc_msg);
93 : 3703 : CR_PB_DESC(REMAP_FPATH, RemapFilePath, remap_file_path);
94 : 3703 : CR_PB_DESC(NETDEV, NetDevice, net_device);
95 : 3703 : CR_PB_MDESC_INIT(cr_pb_descs[PB_PAGEMAP_HEAD], PagemapHead, pagemap_head);
96 : :
97 : : #include "protobuf-desc-gen.h"
98 : 3703 : }
|