wasmer_journal/concrete/
archived.rs

1use num_enum::{IntoPrimitive, TryFromPrimitive};
2use rkyv::rancor::Fallible;
3use rkyv::ser::{Allocator, Writer};
4use rkyv::{
5    Archive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize, api::serialize_using,
6};
7use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
8use std::time::{Duration, SystemTime};
9
10use super::*;
11
12pub const JOURNAL_MAGIC_NUMBER: u64 = 0x310d6dd027362979;
13pub const JOURNAL_MAGIC_NUMBER_BYTES: [u8; 8] = JOURNAL_MAGIC_NUMBER.to_be_bytes();
14
15#[repr(u16)]
16#[derive(
17    Debug,
18    Clone,
19    Copy,
20    PartialEq,
21    Eq,
22    IntoPrimitive,
23    TryFromPrimitive,
24    RkyvSerialize,
25    RkyvDeserialize,
26    Archive,
27)]
28#[rkyv(derive(Debug))]
29pub enum JournalEntryRecordType {
30    InitModuleV1 = 1,
31    ProcessExitV1 = 2,
32    SetThreadV1 = 3,
33    CloseThreadV1 = 4,
34    FileDescriptorSeekV1 = 5,
35    FileDescriptorWriteV1 = 6,
36    UpdateMemoryRegionV1 = 7,
37    SetClockTimeV1 = 9,
38    OpenFileDescriptorV1 = 10,
39    CloseFileDescriptorV1 = 11,
40    RenumberFileDescriptorV1 = 12,
41    DuplicateFileDescriptorV1 = 13,
42    CreateDirectoryV1 = 14,
43    RemoveDirectoryV1 = 15,
44    PathSetTimesV1 = 16,
45    FileDescriptorSetTimesV1 = 17,
46    FileDescriptorSetSizeV1 = 18,
47    FileDescriptorSetFlagsV1 = 19,
48    FileDescriptorSetRightsV1 = 20,
49    FileDescriptorAdviseV1 = 21,
50    FileDescriptorAllocateV1 = 22,
51    CreateHardLinkV1 = 23,
52    CreateSymbolicLinkV1 = 24,
53    UnlinkFileV1 = 25,
54    PathRenameV1 = 26,
55    ChangeDirectoryV1 = 27,
56    EpollCreateV1 = 28,
57    EpollCtlV1 = 29,
58    TtySetV1 = 30,
59    CreatePipeV1 = 31,
60    CreateEventV1 = 32,
61    PortAddAddrV1 = 33,
62    PortDelAddrV1 = 34,
63    PortAddrClearV1 = 35,
64    PortBridgeV1 = 36,
65    PortUnbridgeV1 = 37,
66    PortDhcpAcquireV1 = 38,
67    PortGatewaySetV1 = 39,
68    PortRouteAddV1 = 40,
69    PortRouteClearV1 = 41,
70    PortRouteDelV1 = 42,
71    SocketOpenV1 = 43,
72    SocketListenV1 = 44,
73    SocketBindV1 = 45,
74    SocketConnectedV1 = 46,
75    SocketAcceptedV1 = 47,
76    SocketJoinIpv4MulticastV1 = 48,
77    SocketJoinIpv6MulticastV1 = 49,
78    SocketLeaveIpv4MulticastV1 = 50,
79    SocketLeaveIpv6MulticastV1 = 51,
80    SocketSendFileV1 = 52,
81    SocketSendToV1 = 53,
82    SocketSendV1 = 54,
83    SocketSetOptFlagV1 = 55,
84    SocketSetOptSizeV1 = 56,
85    SocketSetOptTimeV1 = 57,
86    SocketShutdownV1 = 58,
87    SnapshotV1 = 59,
88    ClearEtherealV1 = 60,
89    OpenFileDescriptorV2 = 61,
90    DuplicateFileDescriptorV2 = 62,
91    FileDescriptorSetFdFlagsV1 = 63,
92    SocketPairV1 = 64,
93}
94
95impl JournalEntryRecordType {
96    /// # Safety
97    ///
98    /// `rykv` makes direct memory references to achieve high performance
99    /// however this does mean care must be taken that the data itself
100    /// can not be manipulated or corrupted.
101    pub unsafe fn deserialize_archive(self, data: &[u8]) -> anyhow::Result<JournalEntry<'_>> {
102        match self {
103            JournalEntryRecordType::InitModuleV1 => {
104                ArchivedJournalEntry::InitModuleV1(unsafe { rkyv::access_unchecked(data) })
105            }
106            JournalEntryRecordType::ClearEtherealV1 => {
107                ArchivedJournalEntry::ClearEtherealV1(unsafe { rkyv::access_unchecked(data) })
108            }
109            JournalEntryRecordType::ProcessExitV1 => {
110                ArchivedJournalEntry::ProcessExitV1(unsafe { rkyv::access_unchecked(data) })
111            }
112            JournalEntryRecordType::SetThreadV1 => {
113                ArchivedJournalEntry::SetThreadV1(unsafe { rkyv::access_unchecked(data) })
114            }
115            JournalEntryRecordType::CloseThreadV1 => {
116                ArchivedJournalEntry::CloseThreadV1(unsafe { rkyv::access_unchecked(data) })
117            }
118            JournalEntryRecordType::FileDescriptorSeekV1 => {
119                ArchivedJournalEntry::FileDescriptorSeekV1(unsafe { rkyv::access_unchecked(data) })
120            }
121            JournalEntryRecordType::FileDescriptorWriteV1 => {
122                ArchivedJournalEntry::FileDescriptorWriteV1(unsafe { rkyv::access_unchecked(data) })
123            }
124            JournalEntryRecordType::UpdateMemoryRegionV1 => {
125                ArchivedJournalEntry::UpdateMemoryRegionV1(unsafe { rkyv::access_unchecked(data) })
126            }
127            JournalEntryRecordType::SetClockTimeV1 => {
128                ArchivedJournalEntry::SetClockTimeV1(unsafe { rkyv::access_unchecked(data) })
129            }
130            JournalEntryRecordType::OpenFileDescriptorV1 => {
131                ArchivedJournalEntry::OpenFileDescriptorV1(unsafe { rkyv::access_unchecked(data) })
132            }
133            JournalEntryRecordType::OpenFileDescriptorV2 => {
134                ArchivedJournalEntry::OpenFileDescriptorV2(unsafe { rkyv::access_unchecked(data) })
135            }
136            JournalEntryRecordType::CloseFileDescriptorV1 => {
137                ArchivedJournalEntry::CloseFileDescriptorV1(unsafe { rkyv::access_unchecked(data) })
138            }
139            JournalEntryRecordType::RenumberFileDescriptorV1 => {
140                ArchivedJournalEntry::RenumberFileDescriptorV1(unsafe {
141                    rkyv::access_unchecked(data)
142                })
143            }
144            JournalEntryRecordType::DuplicateFileDescriptorV1 => {
145                ArchivedJournalEntry::DuplicateFileDescriptorV1(unsafe {
146                    rkyv::access_unchecked(data)
147                })
148            }
149            JournalEntryRecordType::DuplicateFileDescriptorV2 => {
150                ArchivedJournalEntry::DuplicateFileDescriptorV2(unsafe {
151                    rkyv::access_unchecked(data)
152                })
153            }
154            JournalEntryRecordType::CreateDirectoryV1 => {
155                ArchivedJournalEntry::CreateDirectoryV1(unsafe { rkyv::access_unchecked(data) })
156            }
157            JournalEntryRecordType::RemoveDirectoryV1 => {
158                ArchivedJournalEntry::RemoveDirectoryV1(unsafe { rkyv::access_unchecked(data) })
159            }
160            JournalEntryRecordType::PathSetTimesV1 => {
161                ArchivedJournalEntry::PathSetTimesV1(unsafe { rkyv::access_unchecked(data) })
162            }
163            JournalEntryRecordType::FileDescriptorSetTimesV1 => {
164                ArchivedJournalEntry::FileDescriptorSetTimesV1(unsafe {
165                    rkyv::access_unchecked(data)
166                })
167            }
168            JournalEntryRecordType::FileDescriptorSetSizeV1 => {
169                ArchivedJournalEntry::FileDescriptorSetSizeV1(unsafe {
170                    rkyv::access_unchecked(data)
171                })
172            }
173            JournalEntryRecordType::FileDescriptorSetFdFlagsV1 => {
174                ArchivedJournalEntry::FileDescriptorSetFdFlagsV1(unsafe {
175                    rkyv::access_unchecked(data)
176                })
177            }
178            JournalEntryRecordType::FileDescriptorSetFlagsV1 => {
179                ArchivedJournalEntry::FileDescriptorSetFlagsV1(unsafe {
180                    rkyv::access_unchecked(data)
181                })
182            }
183            JournalEntryRecordType::FileDescriptorSetRightsV1 => {
184                ArchivedJournalEntry::FileDescriptorSetRightsV1(unsafe {
185                    rkyv::access_unchecked(data)
186                })
187            }
188            JournalEntryRecordType::FileDescriptorAdviseV1 => {
189                ArchivedJournalEntry::FileDescriptorAdviseV1(unsafe {
190                    rkyv::access_unchecked(data)
191                })
192            }
193            JournalEntryRecordType::FileDescriptorAllocateV1 => {
194                ArchivedJournalEntry::FileDescriptorAllocateV1(unsafe {
195                    rkyv::access_unchecked(data)
196                })
197            }
198            JournalEntryRecordType::CreateHardLinkV1 => {
199                ArchivedJournalEntry::CreateHardLinkV1(unsafe { rkyv::access_unchecked(data) })
200            }
201            JournalEntryRecordType::CreateSymbolicLinkV1 => {
202                ArchivedJournalEntry::CreateSymbolicLinkV1(unsafe { rkyv::access_unchecked(data) })
203            }
204            JournalEntryRecordType::UnlinkFileV1 => {
205                ArchivedJournalEntry::UnlinkFileV1(unsafe { rkyv::access_unchecked(data) })
206            }
207            JournalEntryRecordType::PathRenameV1 => {
208                ArchivedJournalEntry::PathRenameV1(unsafe { rkyv::access_unchecked(data) })
209            }
210            JournalEntryRecordType::ChangeDirectoryV1 => {
211                ArchivedJournalEntry::ChangeDirectoryV1(unsafe { rkyv::access_unchecked(data) })
212            }
213            JournalEntryRecordType::EpollCreateV1 => {
214                ArchivedJournalEntry::EpollCreateV1(unsafe { rkyv::access_unchecked(data) })
215            }
216            JournalEntryRecordType::EpollCtlV1 => {
217                ArchivedJournalEntry::EpollCtlV1(unsafe { rkyv::access_unchecked(data) })
218            }
219            JournalEntryRecordType::TtySetV1 => {
220                ArchivedJournalEntry::TtySetV1(unsafe { rkyv::access_unchecked(data) })
221            }
222            JournalEntryRecordType::CreatePipeV1 => {
223                ArchivedJournalEntry::CreatePipeV1(unsafe { rkyv::access_unchecked(data) })
224            }
225            JournalEntryRecordType::CreateEventV1 => {
226                ArchivedJournalEntry::CreateEventV1(unsafe { rkyv::access_unchecked(data) })
227            }
228            JournalEntryRecordType::PortAddAddrV1 => {
229                ArchivedJournalEntry::PortAddAddrV1(unsafe { rkyv::access_unchecked(data) })
230            }
231            JournalEntryRecordType::PortDelAddrV1 => {
232                ArchivedJournalEntry::PortDelAddrV1(unsafe { rkyv::access_unchecked(data) })
233            }
234            JournalEntryRecordType::PortAddrClearV1 => return Ok(JournalEntry::PortAddrClearV1),
235            JournalEntryRecordType::PortBridgeV1 => {
236                ArchivedJournalEntry::PortBridgeV1(unsafe { rkyv::access_unchecked(data) })
237            }
238            JournalEntryRecordType::PortUnbridgeV1 => return Ok(JournalEntry::PortUnbridgeV1),
239            JournalEntryRecordType::PortDhcpAcquireV1 => {
240                return Ok(JournalEntry::PortDhcpAcquireV1);
241            }
242            JournalEntryRecordType::PortGatewaySetV1 => {
243                ArchivedJournalEntry::PortGatewaySetV1(unsafe { rkyv::access_unchecked(data) })
244            }
245            JournalEntryRecordType::PortRouteAddV1 => {
246                ArchivedJournalEntry::PortRouteAddV1(unsafe { rkyv::access_unchecked(data) })
247            }
248            JournalEntryRecordType::PortRouteClearV1 => return Ok(JournalEntry::PortRouteClearV1),
249            JournalEntryRecordType::PortRouteDelV1 => {
250                ArchivedJournalEntry::PortRouteDelV1(unsafe { rkyv::access_unchecked(data) })
251            }
252            JournalEntryRecordType::SocketOpenV1 => {
253                ArchivedJournalEntry::SocketOpenV1(unsafe { rkyv::access_unchecked(data) })
254            }
255            JournalEntryRecordType::SocketPairV1 => {
256                ArchivedJournalEntry::SocketPairV1(unsafe { rkyv::access_unchecked(data) })
257            }
258            JournalEntryRecordType::SocketListenV1 => {
259                ArchivedJournalEntry::SocketListenV1(unsafe { rkyv::access_unchecked(data) })
260            }
261            JournalEntryRecordType::SocketBindV1 => {
262                ArchivedJournalEntry::SocketBindV1(unsafe { rkyv::access_unchecked(data) })
263            }
264            JournalEntryRecordType::SocketConnectedV1 => {
265                ArchivedJournalEntry::SocketConnectedV1(unsafe { rkyv::access_unchecked(data) })
266            }
267            JournalEntryRecordType::SocketAcceptedV1 => {
268                ArchivedJournalEntry::SocketAcceptedV1(unsafe { rkyv::access_unchecked(data) })
269            }
270            JournalEntryRecordType::SocketJoinIpv4MulticastV1 => {
271                ArchivedJournalEntry::SocketJoinIpv4MulticastV1(unsafe {
272                    rkyv::access_unchecked(data)
273                })
274            }
275            JournalEntryRecordType::SocketJoinIpv6MulticastV1 => {
276                ArchivedJournalEntry::SocketJoinIpv6MulticastV1(unsafe {
277                    rkyv::access_unchecked(data)
278                })
279            }
280            JournalEntryRecordType::SocketLeaveIpv4MulticastV1 => {
281                ArchivedJournalEntry::SocketLeaveIpv4MulticastV1(unsafe {
282                    rkyv::access_unchecked(data)
283                })
284            }
285            JournalEntryRecordType::SocketLeaveIpv6MulticastV1 => {
286                ArchivedJournalEntry::SocketLeaveIpv6MulticastV1(unsafe {
287                    rkyv::access_unchecked(data)
288                })
289            }
290            JournalEntryRecordType::SocketSendFileV1 => {
291                ArchivedJournalEntry::SocketSendFileV1(unsafe { rkyv::access_unchecked(data) })
292            }
293            JournalEntryRecordType::SocketSendToV1 => {
294                ArchivedJournalEntry::SocketSendToV1(unsafe { rkyv::access_unchecked(data) })
295            }
296            JournalEntryRecordType::SocketSendV1 => {
297                ArchivedJournalEntry::SocketSendV1(unsafe { rkyv::access_unchecked(data) })
298            }
299            JournalEntryRecordType::SocketSetOptFlagV1 => {
300                ArchivedJournalEntry::SocketSetOptFlagV1(unsafe { rkyv::access_unchecked(data) })
301            }
302            JournalEntryRecordType::SocketSetOptSizeV1 => {
303                ArchivedJournalEntry::SocketSetOptSizeV1(unsafe { rkyv::access_unchecked(data) })
304            }
305            JournalEntryRecordType::SocketSetOptTimeV1 => {
306                ArchivedJournalEntry::SocketSetOptTimeV1(unsafe { rkyv::access_unchecked(data) })
307            }
308            JournalEntryRecordType::SocketShutdownV1 => {
309                ArchivedJournalEntry::SocketShutdownV1(unsafe { rkyv::access_unchecked(data) })
310            }
311            JournalEntryRecordType::SnapshotV1 => {
312                ArchivedJournalEntry::SnapshotV1(unsafe { rkyv::access_unchecked(data) })
313            }
314        }
315        .try_into()
316    }
317}
318
319impl JournalEntry<'_> {
320    pub fn archive_record_type(&self) -> JournalEntryRecordType {
321        match self {
322            Self::InitModuleV1 { .. } => JournalEntryRecordType::InitModuleV1,
323            Self::ClearEtherealV1 { .. } => JournalEntryRecordType::ClearEtherealV1,
324            Self::UpdateMemoryRegionV1 { .. } => JournalEntryRecordType::UpdateMemoryRegionV1,
325            Self::ProcessExitV1 { .. } => JournalEntryRecordType::ProcessExitV1,
326            Self::SetThreadV1 { .. } => JournalEntryRecordType::SetThreadV1,
327            Self::CloseThreadV1 { .. } => JournalEntryRecordType::CloseThreadV1,
328            Self::FileDescriptorSeekV1 { .. } => JournalEntryRecordType::FileDescriptorSeekV1,
329            Self::FileDescriptorWriteV1 { .. } => JournalEntryRecordType::FileDescriptorWriteV1,
330            Self::SetClockTimeV1 { .. } => JournalEntryRecordType::SetClockTimeV1,
331            Self::CloseFileDescriptorV1 { .. } => JournalEntryRecordType::CloseFileDescriptorV1,
332            Self::OpenFileDescriptorV1 { .. } => JournalEntryRecordType::OpenFileDescriptorV1,
333            Self::OpenFileDescriptorV2 { .. } => JournalEntryRecordType::OpenFileDescriptorV2,
334            Self::RenumberFileDescriptorV1 { .. } => {
335                JournalEntryRecordType::RenumberFileDescriptorV1
336            }
337            Self::DuplicateFileDescriptorV1 { .. } => {
338                JournalEntryRecordType::DuplicateFileDescriptorV1
339            }
340            Self::DuplicateFileDescriptorV2 { .. } => {
341                JournalEntryRecordType::DuplicateFileDescriptorV2
342            }
343            Self::CreateDirectoryV1 { .. } => JournalEntryRecordType::CreateDirectoryV1,
344            Self::RemoveDirectoryV1 { .. } => JournalEntryRecordType::RemoveDirectoryV1,
345            Self::PathSetTimesV1 { .. } => JournalEntryRecordType::PathSetTimesV1,
346            Self::FileDescriptorSetTimesV1 { .. } => {
347                JournalEntryRecordType::FileDescriptorSetTimesV1
348            }
349            Self::FileDescriptorSetFdFlagsV1 { .. } => {
350                JournalEntryRecordType::FileDescriptorSetFdFlagsV1
351            }
352            Self::FileDescriptorSetFlagsV1 { .. } => {
353                JournalEntryRecordType::FileDescriptorSetFlagsV1
354            }
355            Self::FileDescriptorSetRightsV1 { .. } => {
356                JournalEntryRecordType::FileDescriptorSetRightsV1
357            }
358            Self::FileDescriptorSetSizeV1 { .. } => JournalEntryRecordType::FileDescriptorSetSizeV1,
359            Self::FileDescriptorAdviseV1 { .. } => JournalEntryRecordType::FileDescriptorAdviseV1,
360            Self::FileDescriptorAllocateV1 { .. } => {
361                JournalEntryRecordType::FileDescriptorAllocateV1
362            }
363            Self::CreateHardLinkV1 { .. } => JournalEntryRecordType::CreateHardLinkV1,
364            Self::CreateSymbolicLinkV1 { .. } => JournalEntryRecordType::CreateSymbolicLinkV1,
365            Self::UnlinkFileV1 { .. } => JournalEntryRecordType::UnlinkFileV1,
366            Self::PathRenameV1 { .. } => JournalEntryRecordType::PathRenameV1,
367            Self::ChangeDirectoryV1 { .. } => JournalEntryRecordType::ChangeDirectoryV1,
368            Self::EpollCreateV1 { .. } => JournalEntryRecordType::EpollCreateV1,
369            Self::EpollCtlV1 { .. } => JournalEntryRecordType::EpollCtlV1,
370            Self::TtySetV1 { .. } => JournalEntryRecordType::TtySetV1,
371            Self::CreatePipeV1 { .. } => JournalEntryRecordType::CreatePipeV1,
372            Self::CreateEventV1 { .. } => JournalEntryRecordType::CreateEventV1,
373            Self::PortAddAddrV1 { .. } => JournalEntryRecordType::PortAddAddrV1,
374            Self::PortDelAddrV1 { .. } => JournalEntryRecordType::PortDelAddrV1,
375            Self::PortAddrClearV1 => JournalEntryRecordType::PortAddrClearV1,
376            Self::PortBridgeV1 { .. } => JournalEntryRecordType::PortBridgeV1,
377            Self::PortUnbridgeV1 => JournalEntryRecordType::PortUnbridgeV1,
378            Self::PortDhcpAcquireV1 => JournalEntryRecordType::PortDhcpAcquireV1,
379            Self::PortGatewaySetV1 { .. } => JournalEntryRecordType::PortGatewaySetV1,
380            Self::PortRouteAddV1 { .. } => JournalEntryRecordType::PortRouteAddV1,
381            Self::PortRouteClearV1 => JournalEntryRecordType::PortRouteClearV1,
382            Self::PortRouteDelV1 { .. } => JournalEntryRecordType::PortRouteDelV1,
383            Self::SocketOpenV1 { .. } => JournalEntryRecordType::SocketOpenV1,
384            Self::SocketPairV1 { .. } => JournalEntryRecordType::SocketPairV1,
385            Self::SocketListenV1 { .. } => JournalEntryRecordType::SocketListenV1,
386            Self::SocketBindV1 { .. } => JournalEntryRecordType::SocketBindV1,
387            Self::SocketConnectedV1 { .. } => JournalEntryRecordType::SocketConnectedV1,
388            Self::SocketAcceptedV1 { .. } => JournalEntryRecordType::SocketAcceptedV1,
389            Self::SocketJoinIpv4MulticastV1 { .. } => {
390                JournalEntryRecordType::SocketJoinIpv4MulticastV1
391            }
392            Self::SocketJoinIpv6MulticastV1 { .. } => {
393                JournalEntryRecordType::SocketJoinIpv6MulticastV1
394            }
395            Self::SocketLeaveIpv4MulticastV1 { .. } => {
396                JournalEntryRecordType::SocketLeaveIpv4MulticastV1
397            }
398            Self::SocketLeaveIpv6MulticastV1 { .. } => {
399                JournalEntryRecordType::SocketLeaveIpv6MulticastV1
400            }
401            Self::SocketSendFileV1 { .. } => JournalEntryRecordType::SocketSendFileV1,
402            Self::SocketSendToV1 { .. } => JournalEntryRecordType::SocketSendToV1,
403            Self::SocketSendV1 { .. } => JournalEntryRecordType::SocketSendV1,
404            Self::SocketSetOptFlagV1 { .. } => JournalEntryRecordType::SocketSetOptFlagV1,
405            Self::SocketSetOptSizeV1 { .. } => JournalEntryRecordType::SocketSetOptSizeV1,
406            Self::SocketSetOptTimeV1 { .. } => JournalEntryRecordType::SocketSetOptTimeV1,
407            Self::SocketShutdownV1 { .. } => JournalEntryRecordType::SocketShutdownV1,
408            Self::SnapshotV1 { .. } => JournalEntryRecordType::SnapshotV1,
409        }
410    }
411
412    pub fn serialize_archive<T: Fallible + Writer + Allocator>(
413        self,
414        serializer: &mut T,
415    ) -> anyhow::Result<usize>
416    where
417        T::Error: rkyv::rancor::Source,
418    {
419        let amt = match self {
420            JournalEntry::InitModuleV1 { wasm_hash } => {
421                serialize_using(&JournalEntryInitModuleV1 { wasm_hash }, serializer)
422            }
423            JournalEntry::ClearEtherealV1 => {
424                serialize_using(&JournalEntryClearEtherealV1 {}, serializer)
425            }
426            JournalEntry::UpdateMemoryRegionV1 {
427                region,
428                compressed_data,
429            } => serialize_using(
430                &JournalEntryUpdateMemoryRegionV1 {
431                    start: region.start,
432                    end: region.end,
433                    compressed_data: compressed_data.into(),
434                },
435                serializer,
436            ),
437            JournalEntry::ProcessExitV1 { exit_code } => serialize_using(
438                &JournalEntryProcessExitV1 {
439                    exit_code: exit_code.map(|e| e.into()),
440                },
441                serializer,
442            ),
443            JournalEntry::SetThreadV1 {
444                id,
445                call_stack,
446                memory_stack,
447                store_data,
448                is_64bit,
449                start,
450                layout,
451            } => serialize_using(
452                &JournalEntrySetThreadV1 {
453                    id,
454                    call_stack: call_stack.into(),
455                    memory_stack: memory_stack.into(),
456                    store_data: store_data.into(),
457                    start: start.into(),
458                    layout: layout.into(),
459                    is_64bit,
460                },
461                serializer,
462            ),
463            JournalEntry::CloseThreadV1 { id, exit_code } => serialize_using(
464                &JournalEntryCloseThreadV1 {
465                    id,
466                    exit_code: exit_code.map(|e| e.into()),
467                },
468                serializer,
469            ),
470            JournalEntry::FileDescriptorSeekV1 { fd, offset, whence } => serialize_using(
471                &JournalEntryFileDescriptorSeekV1 {
472                    fd,
473                    offset,
474                    whence: whence.into(),
475                },
476                serializer,
477            ),
478            JournalEntry::FileDescriptorWriteV1 {
479                fd,
480                offset,
481                data,
482                is_64bit,
483            } => serialize_using(
484                &JournalEntryFileDescriptorWriteV1 {
485                    fd,
486                    offset,
487                    data: data.into(),
488                    is_64bit,
489                },
490                serializer,
491            ),
492            JournalEntry::SetClockTimeV1 { clock_id, time } => serialize_using(
493                &JournalEntrySetClockTimeV1 {
494                    clock_id: clock_id.into(),
495                    time,
496                },
497                serializer,
498            ),
499            JournalEntry::CloseFileDescriptorV1 { fd } => {
500                serialize_using(&JournalEntryCloseFileDescriptorV1 { fd }, serializer)
501            }
502            JournalEntry::OpenFileDescriptorV1 {
503                fd,
504                dirfd,
505                dirflags,
506                path,
507                o_flags,
508                fs_rights_base,
509                fs_rights_inheriting,
510                fs_flags,
511            } => serialize_using(
512                &JournalEntryOpenFileDescriptorV1 {
513                    fd,
514                    dirfd,
515                    dirflags,
516                    path: path.into(),
517                    o_flags: o_flags.bits(),
518                    fs_rights_base: fs_rights_base.bits(),
519                    fs_rights_inheriting: fs_rights_inheriting.bits(),
520                    fs_flags: fs_flags.bits(),
521                },
522                serializer,
523            ),
524            JournalEntry::OpenFileDescriptorV2 {
525                fd,
526                dirfd,
527                dirflags,
528                path,
529                o_flags,
530                fs_rights_base,
531                fs_rights_inheriting,
532                fs_flags,
533                fd_flags,
534            } => serialize_using(
535                &JournalEntryOpenFileDescriptorV2 {
536                    fd,
537                    dirfd,
538                    dirflags,
539                    path: path.into(),
540                    o_flags: o_flags.bits(),
541                    fs_rights_base: fs_rights_base.bits(),
542                    fs_rights_inheriting: fs_rights_inheriting.bits(),
543                    fs_flags: fs_flags.bits(),
544                    fd_flags: fd_flags.bits(),
545                },
546                serializer,
547            ),
548            JournalEntry::RenumberFileDescriptorV1 { old_fd, new_fd } => serialize_using(
549                &JournalEntryRenumberFileDescriptorV1 { old_fd, new_fd },
550                serializer,
551            ),
552            JournalEntry::DuplicateFileDescriptorV1 {
553                original_fd,
554                copied_fd,
555            } => serialize_using(
556                &JournalEntryDuplicateFileDescriptorV1 {
557                    original_fd,
558                    copied_fd,
559                },
560                serializer,
561            ),
562            JournalEntry::DuplicateFileDescriptorV2 {
563                original_fd,
564                copied_fd,
565                cloexec,
566            } => serialize_using(
567                &JournalEntryDuplicateFileDescriptorV2 {
568                    original_fd,
569                    copied_fd,
570                    cloexec,
571                },
572                serializer,
573            ),
574            JournalEntry::CreateDirectoryV1 { fd, path } => serialize_using(
575                &JournalEntryCreateDirectoryV1 {
576                    fd,
577                    path: path.into(),
578                },
579                serializer,
580            ),
581            JournalEntry::RemoveDirectoryV1 { fd, path } => serialize_using(
582                &JournalEntryRemoveDirectoryV1 {
583                    fd,
584                    path: path.into(),
585                },
586                serializer,
587            ),
588            JournalEntry::PathSetTimesV1 {
589                fd,
590                flags,
591                path,
592                st_atim,
593                st_mtim,
594                fst_flags,
595            } => serialize_using(
596                &JournalEntryPathSetTimesV1 {
597                    fd,
598                    flags,
599                    path: path.into(),
600                    st_atim,
601                    st_mtim,
602                    fst_flags: fst_flags.bits(),
603                },
604                serializer,
605            ),
606            JournalEntry::FileDescriptorSetTimesV1 {
607                fd,
608                st_atim,
609                st_mtim,
610                fst_flags,
611            } => serialize_using(
612                &JournalEntryFileDescriptorSetTimesV1 {
613                    fd,
614                    st_atim,
615                    st_mtim,
616                    fst_flags: fst_flags.bits(),
617                },
618                serializer,
619            ),
620            JournalEntry::FileDescriptorSetFdFlagsV1 { fd, flags } => serialize_using(
621                &JournalEntryFileDescriptorSetFdFlagsV1 {
622                    fd,
623                    flags: flags.bits(),
624                },
625                serializer,
626            ),
627            JournalEntry::FileDescriptorSetFlagsV1 { fd, flags } => serialize_using(
628                &JournalEntryFileDescriptorSetFlagsV1 {
629                    fd,
630                    flags: flags.bits(),
631                },
632                serializer,
633            ),
634            JournalEntry::FileDescriptorSetRightsV1 {
635                fd,
636                fs_rights_base,
637                fs_rights_inheriting,
638            } => serialize_using(
639                &JournalEntryFileDescriptorSetRightsV1 {
640                    fd,
641                    fs_rights_base: fs_rights_base.bits(),
642                    fs_rights_inheriting: fs_rights_inheriting.bits(),
643                },
644                serializer,
645            ),
646            JournalEntry::FileDescriptorSetSizeV1 { fd, st_size } => serialize_using(
647                &JournalEntryFileDescriptorSetSizeV1 { fd, st_size },
648                serializer,
649            ),
650            JournalEntry::FileDescriptorAdviseV1 {
651                fd,
652                offset,
653                len,
654                advice,
655            } => serialize_using(
656                &JournalEntryFileDescriptorAdviseV1 {
657                    fd,
658                    offset,
659                    len,
660                    advice: advice.into(),
661                },
662                serializer,
663            ),
664            JournalEntry::FileDescriptorAllocateV1 { fd, offset, len } => serialize_using(
665                &JournalEntryFileDescriptorAllocateV1 { fd, offset, len },
666                serializer,
667            ),
668            JournalEntry::CreateHardLinkV1 {
669                old_fd,
670                old_path,
671                old_flags,
672                new_fd,
673                new_path,
674            } => serialize_using(
675                &JournalEntryCreateHardLinkV1 {
676                    old_fd,
677                    old_path: old_path.into(),
678                    old_flags,
679                    new_fd,
680                    new_path: new_path.into(),
681                },
682                serializer,
683            ),
684            JournalEntry::CreateSymbolicLinkV1 {
685                old_path,
686                fd,
687                new_path,
688            } => serialize_using(
689                &JournalEntryCreateSymbolicLinkV1 {
690                    old_path: old_path.into(),
691                    fd,
692                    new_path: new_path.into(),
693                },
694                serializer,
695            ),
696            JournalEntry::UnlinkFileV1 { fd, path } => serialize_using(
697                &JournalEntryUnlinkFileV1 {
698                    fd,
699                    path: path.into(),
700                },
701                serializer,
702            ),
703            JournalEntry::PathRenameV1 {
704                old_fd,
705                old_path,
706                new_fd,
707                new_path,
708            } => serialize_using(
709                &JournalEntryPathRenameV1 {
710                    old_fd,
711                    old_path: old_path.into(),
712                    new_fd,
713                    new_path: new_path.into(),
714                },
715                serializer,
716            ),
717            JournalEntry::ChangeDirectoryV1 { path } => serialize_using(
718                &JournalEntryChangeDirectoryV1 { path: path.into() },
719                serializer,
720            ),
721            JournalEntry::EpollCreateV1 { fd } => {
722                serialize_using(&JournalEntryEpollCreateV1 { fd }, serializer)
723            }
724            JournalEntry::EpollCtlV1 {
725                epfd,
726                op,
727                fd,
728                event,
729            } => serialize_using(
730                &JournalEntryEpollCtlV1 {
731                    epfd,
732                    op: op.into(),
733                    fd,
734                    event: event.map(|e| e.into()),
735                },
736                serializer,
737            ),
738            JournalEntry::TtySetV1 { tty, line_feeds } => serialize_using(
739                &JournalEntryTtySetV1 {
740                    cols: tty.cols,
741                    rows: tty.rows,
742                    width: tty.width,
743                    height: tty.height,
744                    stdin_tty: tty.stdin_tty,
745                    stdout_tty: tty.stdout_tty,
746                    stderr_tty: tty.stderr_tty,
747                    echo: tty.echo,
748                    line_buffered: tty.line_buffered,
749                    line_feeds,
750                },
751                serializer,
752            ),
753            JournalEntry::CreatePipeV1 { read_fd, write_fd } => {
754                serialize_using(&JournalEntryCreatePipeV1 { read_fd, write_fd }, serializer)
755            }
756            JournalEntry::CreateEventV1 {
757                initial_val,
758                flags,
759                fd,
760            } => serialize_using(
761                &JournalEntryCreateEventV1 {
762                    initial_val,
763                    flags,
764                    fd,
765                },
766                serializer,
767            ),
768            JournalEntry::PortAddAddrV1 { cidr } => {
769                serialize_using(&JournalEntryPortAddAddrV1 { cidr: cidr.into() }, serializer)
770            }
771            JournalEntry::PortDelAddrV1 { addr } => {
772                serialize_using(&JournalEntryPortDelAddrV1 { addr }, serializer)
773            }
774            JournalEntry::PortAddrClearV1 => serialize_using(&(), serializer),
775            JournalEntry::PortBridgeV1 {
776                network,
777                token,
778                security,
779            } => serialize_using(
780                &JournalEntryPortBridgeV1 {
781                    network: network.into(),
782                    token: token.into(),
783                    security: security.into(),
784                },
785                serializer,
786            ),
787            JournalEntry::PortUnbridgeV1 => serialize_using(&(), serializer),
788            JournalEntry::PortDhcpAcquireV1 => serialize_using(&(), serializer),
789            JournalEntry::PortGatewaySetV1 { ip } => {
790                serialize_using(&JournalEntryPortGatewaySetV1 { ip }, serializer)
791            }
792            JournalEntry::PortRouteAddV1 {
793                cidr,
794                via_router,
795                preferred_until,
796                expires_at,
797            } => serialize_using(
798                &JournalEntryPortRouteAddV1 {
799                    cidr: cidr.into(),
800                    via_router,
801                    preferred_until,
802                    expires_at,
803                },
804                serializer,
805            ),
806            JournalEntry::PortRouteClearV1 => serialize_using(&(), serializer),
807            JournalEntry::PortRouteDelV1 { ip } => {
808                serialize_using(&JournalEntryPortRouteDelV1 { ip }, serializer)
809            }
810            JournalEntry::SocketOpenV1 { af, ty, pt, fd } => serialize_using(
811                &JournalEntrySocketOpenV1 {
812                    af: af.into(),
813                    ty: ty.into(),
814                    pt: pt.into(),
815                    fd,
816                },
817                serializer,
818            ),
819            JournalEntry::SocketPairV1 { fd1, fd2 } => {
820                serialize_using(&JournalEntrySocketPairV1 { fd1, fd2 }, serializer)
821            }
822            JournalEntry::SocketListenV1 { fd, backlog } => {
823                serialize_using(&JournalEntrySocketListenV1 { fd, backlog }, serializer)
824            }
825            JournalEntry::SocketBindV1 { fd, addr } => {
826                serialize_using(&JournalEntrySocketBindV1 { fd, addr }, serializer)
827            }
828            JournalEntry::SocketConnectedV1 {
829                fd,
830                local_addr,
831                peer_addr,
832            } => serialize_using(
833                &JournalEntrySocketConnectedV1 {
834                    fd,
835                    local_addr,
836                    peer_addr,
837                },
838                serializer,
839            ),
840            JournalEntry::SocketAcceptedV1 {
841                listen_fd,
842                fd,
843                local_addr: addr,
844                peer_addr,
845                fd_flags,
846                non_blocking: nonblocking,
847            } => serialize_using(
848                &JournalEntrySocketAcceptedV1 {
849                    listen_fd,
850                    fd,
851                    local_addr: addr,
852                    peer_addr,
853                    fd_flags: fd_flags.bits(),
854                    nonblocking,
855                },
856                serializer,
857            ),
858            JournalEntry::SocketJoinIpv4MulticastV1 {
859                fd,
860                multiaddr,
861                iface,
862            } => serialize_using(
863                &JournalEntrySocketJoinIpv4MulticastV1 {
864                    fd,
865                    multiaddr,
866                    iface,
867                },
868                serializer,
869            ),
870            JournalEntry::SocketJoinIpv6MulticastV1 {
871                fd,
872                multi_addr: multiaddr,
873                iface,
874            } => serialize_using(
875                &JournalEntrySocketJoinIpv6MulticastV1 {
876                    fd,
877                    multiaddr,
878                    iface,
879                },
880                serializer,
881            ),
882            JournalEntry::SocketLeaveIpv4MulticastV1 {
883                fd,
884                multi_addr: multiaddr,
885                iface,
886            } => serialize_using(
887                &JournalEntrySocketLeaveIpv4MulticastV1 {
888                    fd,
889                    multiaddr,
890                    iface,
891                },
892                serializer,
893            ),
894            JournalEntry::SocketLeaveIpv6MulticastV1 {
895                fd,
896                multi_addr: multiaddr,
897                iface,
898            } => serialize_using(
899                &JournalEntrySocketLeaveIpv6MulticastV1 {
900                    fd,
901                    multiaddr,
902                    iface,
903                },
904                serializer,
905            ),
906            JournalEntry::SocketSendFileV1 {
907                socket_fd,
908                file_fd,
909                offset,
910                count,
911            } => serialize_using(
912                &JournalEntrySocketSendFileV1 {
913                    socket_fd,
914                    file_fd,
915                    offset,
916                    count,
917                },
918                serializer,
919            ),
920            JournalEntry::SocketSendToV1 {
921                fd,
922                data,
923                flags,
924                addr,
925                is_64bit,
926            } => serialize_using(
927                &JournalEntrySocketSendToV1 {
928                    fd,
929                    data: data.into(),
930                    flags,
931                    addr,
932                    is_64bit,
933                },
934                serializer,
935            ),
936            JournalEntry::SocketSendV1 {
937                fd,
938                data,
939                flags,
940                is_64bit,
941            } => serialize_using(
942                &JournalEntrySocketSendV1 {
943                    fd,
944                    data: data.into(),
945                    flags,
946                    is_64bit,
947                },
948                serializer,
949            ),
950            JournalEntry::SocketSetOptFlagV1 { fd, opt, flag } => serialize_using(
951                &JournalEntrySocketSetOptFlagV1 {
952                    fd,
953                    opt: opt.into(),
954                    flag,
955                },
956                serializer,
957            ),
958            JournalEntry::SocketSetOptSizeV1 { fd, opt, size } => serialize_using(
959                &JournalEntrySocketSetOptSizeV1 {
960                    fd,
961                    opt: opt.into(),
962                    size,
963                },
964                serializer,
965            ),
966            JournalEntry::SocketSetOptTimeV1 { fd, ty, time } => serialize_using(
967                &JournalEntrySocketSetOptTimeV1 {
968                    fd,
969                    ty: ty.into(),
970                    time,
971                },
972                serializer,
973            ),
974            JournalEntry::SocketShutdownV1 { fd, how } => serialize_using(
975                &JournalEntrySocketShutdownV1 {
976                    fd,
977                    how: how.into(),
978                },
979                serializer,
980            ),
981            JournalEntry::SnapshotV1 { when, trigger } => serialize_using(
982                &JournalEntrySnapshotV1 {
983                    since_epoch: when
984                        .duration_since(SystemTime::UNIX_EPOCH)
985                        .unwrap_or(Duration::ZERO),
986                    trigger: trigger.into(),
987                },
988                serializer,
989            ),
990        }
991        .map_err(|err| anyhow::format_err!("failed to serialize journal record - {err}"))?;
992        Ok(amt)
993    }
994}
995
996/// The journal log entries are serializable which
997/// allows them to be written directly to a file
998///
999/// Note: This structure is versioned which allows for
1000/// changes to the journal entry types without having to
1001/// worry about backward and forward compatibility
1002#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1003#[rkyv(derive(Debug))]
1004pub(crate) struct JournalEntryHeader {
1005    pub record_type: u16,
1006    pub record_size: u64,
1007}
1008
1009pub enum ArchivedJournalEntry<'a> {
1010    InitModuleV1(&'a ArchivedJournalEntryInitModuleV1),
1011    ClearEtherealV1(&'a ArchivedJournalEntryClearEtherealV1),
1012    ProcessExitV1(&'a ArchivedJournalEntryProcessExitV1),
1013    SetThreadV1(&'a ArchivedJournalEntrySetThreadV1<'a>),
1014    CloseThreadV1(&'a ArchivedJournalEntryCloseThreadV1),
1015    FileDescriptorSeekV1(&'a ArchivedJournalEntryFileDescriptorSeekV1),
1016    FileDescriptorWriteV1(&'a ArchivedJournalEntryFileDescriptorWriteV1<'a>),
1017    UpdateMemoryRegionV1(&'a ArchivedJournalEntryUpdateMemoryRegionV1<'a>),
1018    SetClockTimeV1(&'a ArchivedJournalEntrySetClockTimeV1),
1019    OpenFileDescriptorV1(&'a ArchivedJournalEntryOpenFileDescriptorV1<'a>),
1020    OpenFileDescriptorV2(&'a ArchivedJournalEntryOpenFileDescriptorV2<'a>),
1021    CloseFileDescriptorV1(&'a ArchivedJournalEntryCloseFileDescriptorV1),
1022    RenumberFileDescriptorV1(&'a ArchivedJournalEntryRenumberFileDescriptorV1),
1023    DuplicateFileDescriptorV1(&'a ArchivedJournalEntryDuplicateFileDescriptorV1),
1024    DuplicateFileDescriptorV2(&'a ArchivedJournalEntryDuplicateFileDescriptorV2),
1025    CreateDirectoryV1(&'a ArchivedJournalEntryCreateDirectoryV1<'a>),
1026    RemoveDirectoryV1(&'a ArchivedJournalEntryRemoveDirectoryV1<'a>),
1027    PathSetTimesV1(&'a ArchivedJournalEntryPathSetTimesV1<'a>),
1028    FileDescriptorSetTimesV1(&'a ArchivedJournalEntryFileDescriptorSetTimesV1),
1029    FileDescriptorSetSizeV1(&'a ArchivedJournalEntryFileDescriptorSetSizeV1),
1030    FileDescriptorSetFdFlagsV1(&'a ArchivedJournalEntryFileDescriptorSetFdFlagsV1),
1031    FileDescriptorSetFlagsV1(&'a ArchivedJournalEntryFileDescriptorSetFlagsV1),
1032    FileDescriptorSetRightsV1(&'a ArchivedJournalEntryFileDescriptorSetRightsV1),
1033    FileDescriptorAdviseV1(&'a ArchivedJournalEntryFileDescriptorAdviseV1),
1034    FileDescriptorAllocateV1(&'a ArchivedJournalEntryFileDescriptorAllocateV1),
1035    CreateHardLinkV1(&'a ArchivedJournalEntryCreateHardLinkV1<'a>),
1036    CreateSymbolicLinkV1(&'a ArchivedJournalEntryCreateSymbolicLinkV1<'a>),
1037    UnlinkFileV1(&'a ArchivedJournalEntryUnlinkFileV1<'a>),
1038    PathRenameV1(&'a ArchivedJournalEntryPathRenameV1<'a>),
1039    ChangeDirectoryV1(&'a ArchivedJournalEntryChangeDirectoryV1<'a>),
1040    EpollCreateV1(&'a ArchivedJournalEntryEpollCreateV1),
1041    EpollCtlV1(&'a ArchivedJournalEntryEpollCtlV1),
1042    TtySetV1(&'a ArchivedJournalEntryTtySetV1),
1043    CreatePipeV1(&'a ArchivedJournalEntryCreatePipeV1),
1044    CreateEventV1(&'a ArchivedJournalEntryCreateEventV1),
1045    PortAddAddrV1(&'a ArchivedJournalEntryPortAddAddrV1),
1046    PortDelAddrV1(&'a ArchivedJournalEntryPortDelAddrV1),
1047    PortAddrClearV1,
1048    PortBridgeV1(&'a ArchivedJournalEntryPortBridgeV1<'a>),
1049    PortUnbridgeV1,
1050    PortDhcpAcquireV1,
1051    PortGatewaySetV1(&'a ArchivedJournalEntryPortGatewaySetV1),
1052    PortRouteAddV1(&'a ArchivedJournalEntryPortRouteAddV1),
1053    PortRouteClearV1,
1054    PortRouteDelV1(&'a ArchivedJournalEntryPortRouteDelV1),
1055    SocketOpenV1(&'a ArchivedJournalEntrySocketOpenV1),
1056    SocketPairV1(&'a ArchivedJournalEntrySocketPairV1),
1057    SocketListenV1(&'a ArchivedJournalEntrySocketListenV1),
1058    SocketBindV1(&'a ArchivedJournalEntrySocketBindV1),
1059    SocketConnectedV1(&'a ArchivedJournalEntrySocketConnectedV1),
1060    SocketAcceptedV1(&'a ArchivedJournalEntrySocketAcceptedV1),
1061    SocketJoinIpv4MulticastV1(&'a ArchivedJournalEntrySocketJoinIpv4MulticastV1),
1062    SocketJoinIpv6MulticastV1(&'a ArchivedJournalEntrySocketJoinIpv6MulticastV1),
1063    SocketLeaveIpv4MulticastV1(&'a ArchivedJournalEntrySocketLeaveIpv4MulticastV1),
1064    SocketLeaveIpv6MulticastV1(&'a ArchivedJournalEntrySocketLeaveIpv6MulticastV1),
1065    SocketSendFileV1(&'a ArchivedJournalEntrySocketSendFileV1),
1066    SocketSendToV1(&'a ArchivedJournalEntrySocketSendToV1<'a>),
1067    SocketSendV1(&'a ArchivedJournalEntrySocketSendV1<'a>),
1068    SocketSetOptFlagV1(&'a ArchivedJournalEntrySocketSetOptFlagV1),
1069    SocketSetOptSizeV1(&'a ArchivedJournalEntrySocketSetOptSizeV1),
1070    SocketSetOptTimeV1(&'a ArchivedJournalEntrySocketSetOptTimeV1),
1071    SocketShutdownV1(&'a ArchivedJournalEntrySocketShutdownV1),
1072    SnapshotV1(&'a ArchivedJournalEntrySnapshotV1),
1073}
1074
1075#[repr(C)]
1076#[repr(align(8))]
1077#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1078#[rkyv(derive(Debug), attr(repr(align(8))))]
1079pub struct JournalEntryInitModuleV1 {
1080    pub wasm_hash: Box<[u8]>,
1081}
1082
1083#[repr(C)]
1084#[repr(align(8))]
1085#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1086#[rkyv(derive(Debug), attr(repr(align(8))))]
1087pub struct JournalEntryClearEtherealV1 {}
1088
1089#[repr(C)]
1090#[repr(align(8))]
1091#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1092#[rkyv(derive(Debug), attr(repr(align(8))))]
1093pub struct JournalEntryProcessExitV1 {
1094    pub exit_code: Option<JournalExitCodeV1>,
1095}
1096
1097#[repr(C)]
1098#[repr(align(8))]
1099#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1100#[rkyv(attr(repr(align(8))))]
1101pub struct JournalEntrySetThreadV1<'a> {
1102    pub id: u32,
1103    pub call_stack: AlignedCowVec<'a, u8>,
1104    pub memory_stack: AlignedCowVec<'a, u8>,
1105    pub store_data: AlignedCowVec<'a, u8>,
1106    pub start: JournalThreadStartTypeV1,
1107    pub layout: JournalWasiMemoryLayout,
1108    pub is_64bit: bool,
1109}
1110
1111#[repr(C)]
1112#[repr(align(8))]
1113#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1114#[rkyv(attr(repr(align(8))))]
1115pub struct JournalEntryCloseThreadV1 {
1116    pub id: u32,
1117    pub exit_code: Option<JournalExitCodeV1>,
1118}
1119
1120#[repr(C)]
1121#[repr(align(8))]
1122#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1123#[rkyv(derive(Debug), attr(repr(align(8))))]
1124pub struct JournalEntryFileDescriptorSeekV1 {
1125    pub fd: u32,
1126    pub whence: JournalWhenceV1,
1127    pub offset: i64,
1128}
1129
1130/// WARNING!!!! Do not change this structure without updating
1131/// "/lib/cli/src/commands/journal/mount/fs.rs"
1132///
1133/// The code over there assumes that the aligned vector is the
1134/// first item in the serialized entry
1135#[repr(C)]
1136#[repr(align(8))]
1137#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1138#[rkyv(attr(repr(align(8))))]
1139pub struct JournalEntryFileDescriptorWriteV1<'a> {
1140    /// DO NOT MOVE!
1141    pub data: AlignedCowVec<'a, u8>,
1142    pub offset: u64,
1143    pub fd: u32,
1144    pub is_64bit: bool,
1145}
1146
1147#[repr(C)]
1148#[repr(align(8))]
1149#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1150#[rkyv(attr(repr(align(8))))]
1151pub struct JournalEntryUpdateMemoryRegionV1<'a> {
1152    pub compressed_data: AlignedCowVec<'a, u8>,
1153    pub start: u64,
1154    pub end: u64,
1155}
1156
1157#[repr(C)]
1158#[repr(align(8))]
1159#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1160#[rkyv(derive(Debug), attr(repr(align(8))))]
1161pub struct JournalEntrySetClockTimeV1 {
1162    pub clock_id: JournalSnapshot0ClockidV1,
1163    pub time: u64,
1164}
1165
1166#[repr(C)]
1167#[repr(align(8))]
1168#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1169#[rkyv(attr(repr(align(8))))]
1170pub struct JournalEntryOpenFileDescriptorV1<'a> {
1171    pub fd: u32,
1172    pub dirfd: u32,
1173    pub dirflags: u32,
1174    pub fs_flags: u16,
1175    pub o_flags: u16,
1176    pub fs_rights_base: u64,
1177    pub fs_rights_inheriting: u64,
1178    pub path: AlignedCowStr<'a>,
1179}
1180
1181#[repr(C)]
1182#[repr(align(8))]
1183#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1184#[rkyv(attr(repr(align(8))))]
1185pub struct JournalEntryOpenFileDescriptorV2<'a> {
1186    pub fd: u32,
1187    pub dirfd: u32,
1188    pub dirflags: u32,
1189    pub fs_flags: u16,
1190    pub fd_flags: u16,
1191    pub o_flags: u16,
1192    pub fs_rights_base: u64,
1193    pub fs_rights_inheriting: u64,
1194    pub path: AlignedCowStr<'a>,
1195}
1196
1197#[repr(C)]
1198#[repr(align(8))]
1199#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1200#[rkyv(derive(Debug), attr(repr(align(8))))]
1201pub struct JournalEntryCloseFileDescriptorV1 {
1202    pub fd: u32,
1203}
1204
1205#[repr(C)]
1206#[repr(align(8))]
1207#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1208#[rkyv(derive(Debug), attr(repr(align(8))))]
1209pub struct JournalEntryRenumberFileDescriptorV1 {
1210    pub old_fd: u32,
1211    pub new_fd: u32,
1212}
1213
1214#[repr(C)]
1215#[repr(align(8))]
1216#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1217#[rkyv(derive(Debug), attr(repr(align(8))))]
1218pub struct JournalEntryDuplicateFileDescriptorV1 {
1219    pub original_fd: u32,
1220    pub copied_fd: u32,
1221}
1222
1223#[repr(C)]
1224#[repr(align(8))]
1225#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1226#[rkyv(derive(Debug), attr(repr(align(8))))]
1227pub struct JournalEntryDuplicateFileDescriptorV2 {
1228    pub original_fd: u32,
1229    pub copied_fd: u32,
1230    pub cloexec: bool,
1231}
1232
1233#[repr(C)]
1234#[repr(align(8))]
1235#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1236#[rkyv(attr(repr(align(8))))]
1237pub struct JournalEntryCreateDirectoryV1<'a> {
1238    pub fd: u32,
1239    pub path: AlignedCowStr<'a>,
1240}
1241
1242#[repr(C)]
1243#[repr(align(8))]
1244#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1245#[rkyv(attr(repr(align(8))))]
1246pub struct JournalEntryRemoveDirectoryV1<'a> {
1247    pub fd: u32,
1248    pub path: AlignedCowStr<'a>,
1249}
1250
1251#[repr(C)]
1252#[repr(align(8))]
1253#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1254#[rkyv(attr(repr(align(8))))]
1255pub struct JournalEntryPathSetTimesV1<'a> {
1256    pub fd: u32,
1257    pub flags: u32,
1258    pub path: AlignedCowStr<'a>,
1259    pub st_atim: u64,
1260    pub st_mtim: u64,
1261    pub fst_flags: u16,
1262}
1263
1264#[repr(C)]
1265#[repr(align(8))]
1266#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1267#[rkyv(derive(Debug), attr(repr(align(8))))]
1268pub struct JournalEntryFileDescriptorSetTimesV1 {
1269    pub fd: u32,
1270    pub fst_flags: u16,
1271    pub st_atim: u64,
1272    pub st_mtim: u64,
1273}
1274
1275#[repr(C)]
1276#[repr(align(8))]
1277#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1278#[rkyv(derive(Debug), attr(repr(align(8))))]
1279pub struct JournalEntryFileDescriptorSetSizeV1 {
1280    pub fd: u32,
1281    pub st_size: u64,
1282}
1283
1284#[repr(C)]
1285#[repr(align(8))]
1286#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1287#[rkyv(derive(Debug), attr(repr(align(8))))]
1288pub struct JournalEntryFileDescriptorSetFdFlagsV1 {
1289    pub fd: u32,
1290    pub flags: u16,
1291}
1292
1293#[repr(C)]
1294#[repr(align(8))]
1295#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1296#[rkyv(derive(Debug), attr(repr(align(8))))]
1297pub struct JournalEntryFileDescriptorSetFlagsV1 {
1298    pub fd: u32,
1299    pub flags: u16,
1300}
1301
1302#[repr(C)]
1303#[repr(align(8))]
1304#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1305#[rkyv(derive(Debug), attr(repr(align(8))))]
1306pub struct JournalEntryFileDescriptorSetRightsV1 {
1307    pub fd: u32,
1308    pub fs_rights_base: u64,
1309    pub fs_rights_inheriting: u64,
1310}
1311
1312#[repr(C)]
1313#[repr(align(8))]
1314#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1315#[rkyv(derive(Debug), attr(repr(align(8))))]
1316pub struct JournalEntryFileDescriptorAdviseV1 {
1317    pub fd: u32,
1318    pub offset: u64,
1319    pub len: u64,
1320    pub advice: JournalAdviceV1,
1321}
1322
1323#[repr(C)]
1324#[repr(align(8))]
1325#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1326#[rkyv(derive(Debug), attr(repr(align(8))))]
1327pub struct JournalEntryFileDescriptorAllocateV1 {
1328    pub fd: u32,
1329    pub offset: u64,
1330    pub len: u64,
1331}
1332
1333#[repr(C)]
1334#[repr(align(8))]
1335#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1336#[rkyv(attr(repr(align(8))))]
1337pub struct JournalEntryCreateHardLinkV1<'a> {
1338    pub old_fd: u32,
1339    pub old_path: AlignedCowStr<'a>,
1340    pub old_flags: u32,
1341    pub new_fd: u32,
1342    pub new_path: AlignedCowStr<'a>,
1343}
1344
1345#[repr(C)]
1346#[repr(align(8))]
1347#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1348#[rkyv(attr(repr(align(8))))]
1349pub struct JournalEntryCreateSymbolicLinkV1<'a> {
1350    pub fd: u32,
1351    pub old_path: AlignedCowStr<'a>,
1352    pub new_path: AlignedCowStr<'a>,
1353}
1354
1355#[repr(C)]
1356#[repr(align(8))]
1357#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1358#[rkyv(attr(repr(align(8))))]
1359pub struct JournalEntryUnlinkFileV1<'a> {
1360    pub fd: u32,
1361    pub path: AlignedCowStr<'a>,
1362}
1363
1364#[repr(C)]
1365#[repr(align(8))]
1366#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1367#[rkyv(attr(repr(align(8))))]
1368pub struct JournalEntryPathRenameV1<'a> {
1369    pub old_fd: u32,
1370    pub old_path: AlignedCowStr<'a>,
1371    pub new_fd: u32,
1372    pub new_path: AlignedCowStr<'a>,
1373}
1374
1375#[repr(C)]
1376#[repr(align(8))]
1377#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1378#[rkyv(attr(repr(align(8))))]
1379pub struct JournalEntryChangeDirectoryV1<'a> {
1380    pub path: AlignedCowStr<'a>,
1381}
1382
1383#[repr(C)]
1384#[repr(align(8))]
1385#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1386#[rkyv(derive(Debug), attr(repr(align(8))))]
1387pub struct JournalEntryEpollCreateV1 {
1388    pub fd: u32,
1389}
1390
1391#[repr(C)]
1392#[repr(align(8))]
1393#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1394#[rkyv(derive(Debug), attr(repr(align(8))))]
1395pub struct JournalEntryEpollCtlV1 {
1396    pub epfd: u32,
1397    pub op: JournalEpollCtlV1,
1398    pub fd: u32,
1399    pub event: Option<JournalEpollEventCtlV1>,
1400}
1401
1402#[repr(C)]
1403#[repr(align(8))]
1404#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1405#[rkyv(derive(Debug), attr(repr(align(8))))]
1406pub struct JournalEntryTtySetV1 {
1407    pub cols: u32,
1408    pub rows: u32,
1409    pub width: u32,
1410    pub height: u32,
1411    pub stdin_tty: bool,
1412    pub stdout_tty: bool,
1413    pub stderr_tty: bool,
1414    pub echo: bool,
1415    pub line_buffered: bool,
1416    pub line_feeds: bool,
1417}
1418
1419#[repr(C)]
1420#[repr(align(8))]
1421#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1422#[rkyv(derive(Debug), attr(repr(align(8))))]
1423pub struct JournalEntryCreatePipeV1 {
1424    pub read_fd: u32,
1425    pub write_fd: u32,
1426}
1427
1428#[repr(C)]
1429#[repr(align(8))]
1430#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1431#[rkyv(derive(Debug), attr(repr(align(8))))]
1432pub struct JournalEntryCreateEventV1 {
1433    pub initial_val: u64,
1434    pub flags: u16,
1435    pub fd: u32,
1436}
1437
1438#[repr(C)]
1439#[repr(align(8))]
1440#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1441#[rkyv(derive(Debug), attr(repr(align(8))))]
1442pub struct JournalEntryPortAddAddrV1 {
1443    pub cidr: JournalIpCidrV1,
1444}
1445
1446#[repr(C)]
1447#[repr(align(8))]
1448#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1449#[rkyv(derive(Debug), attr(repr(align(8))))]
1450pub struct JournalEntryPortDelAddrV1 {
1451    pub addr: IpAddr,
1452}
1453
1454#[repr(C)]
1455#[repr(align(8))]
1456#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1457#[rkyv(attr(repr(align(8))))]
1458pub struct JournalEntryPortBridgeV1<'a> {
1459    pub network: AlignedCowStr<'a>,
1460    pub token: AlignedCowStr<'a>,
1461    pub security: JournalStreamSecurityV1,
1462}
1463
1464#[repr(C)]
1465#[repr(align(8))]
1466#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1467#[rkyv(derive(Debug), attr(repr(align(8))))]
1468pub struct JournalEntryPortGatewaySetV1 {
1469    pub ip: IpAddr,
1470}
1471
1472#[repr(C)]
1473#[repr(align(8))]
1474#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1475#[rkyv(derive(Debug), attr(repr(align(8))))]
1476pub struct JournalEntryPortRouteAddV1 {
1477    pub cidr: JournalIpCidrV1,
1478    pub via_router: IpAddr,
1479    pub preferred_until: Option<Duration>,
1480    pub expires_at: Option<Duration>,
1481}
1482
1483#[repr(C)]
1484#[repr(align(8))]
1485#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1486#[rkyv(derive(Debug), attr(repr(align(8))))]
1487pub struct JournalEntryPortRouteDelV1 {
1488    pub ip: IpAddr,
1489}
1490
1491#[repr(C)]
1492#[repr(align(8))]
1493#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1494#[rkyv(derive(Debug), attr(repr(align(8))))]
1495pub struct JournalEntrySocketOpenV1 {
1496    pub af: JournalAddressfamilyV1,
1497    pub ty: JournalSocktypeV1,
1498    pub pt: u16,
1499    pub fd: u32,
1500}
1501
1502#[repr(align(8))]
1503#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1504#[rkyv(derive(Debug), attr(repr(align(8))))]
1505pub struct JournalEntrySocketPairV1 {
1506    pub fd1: u32,
1507    pub fd2: u32,
1508}
1509
1510#[repr(C)]
1511#[repr(align(8))]
1512#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1513#[rkyv(derive(Debug), attr(repr(align(8))))]
1514pub struct JournalEntrySocketListenV1 {
1515    pub fd: u32,
1516    pub backlog: u32,
1517}
1518
1519#[repr(C)]
1520#[repr(align(8))]
1521#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1522#[rkyv(derive(Debug), attr(repr(align(8))))]
1523pub struct JournalEntrySocketBindV1 {
1524    pub fd: u32,
1525    pub addr: SocketAddr,
1526}
1527
1528#[repr(C)]
1529#[repr(align(8))]
1530#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1531#[rkyv(derive(Debug), attr(repr(align(8))))]
1532pub struct JournalEntrySocketConnectedV1 {
1533    pub fd: u32,
1534    pub local_addr: SocketAddr,
1535    pub peer_addr: SocketAddr,
1536}
1537
1538#[repr(C)]
1539#[repr(align(8))]
1540#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1541#[rkyv(derive(Debug), attr(repr(align(8))))]
1542pub struct JournalEntrySocketAcceptedV1 {
1543    pub listen_fd: u32,
1544    pub fd: u32,
1545    pub local_addr: SocketAddr,
1546    pub peer_addr: SocketAddr,
1547    pub fd_flags: u16,
1548    pub nonblocking: bool,
1549}
1550
1551#[repr(C)]
1552#[repr(align(8))]
1553#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1554#[rkyv(derive(Debug), attr(repr(align(8))))]
1555pub struct JournalEntrySocketJoinIpv4MulticastV1 {
1556    pub fd: u32,
1557    pub multiaddr: Ipv4Addr,
1558    pub iface: Ipv4Addr,
1559}
1560
1561#[repr(C)]
1562#[repr(align(8))]
1563#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1564#[rkyv(derive(Debug), attr(repr(align(8))))]
1565pub struct JournalEntrySocketJoinIpv6MulticastV1 {
1566    pub fd: u32,
1567    pub multiaddr: Ipv6Addr,
1568    pub iface: u32,
1569}
1570
1571#[repr(C)]
1572#[repr(align(8))]
1573#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1574#[rkyv(derive(Debug), attr(repr(align(8))))]
1575pub struct JournalEntrySocketLeaveIpv4MulticastV1 {
1576    pub fd: u32,
1577    pub multiaddr: Ipv4Addr,
1578    pub iface: Ipv4Addr,
1579}
1580
1581#[repr(C)]
1582#[repr(align(8))]
1583#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1584#[rkyv(derive(Debug), attr(repr(align(8))))]
1585pub struct JournalEntrySocketLeaveIpv6MulticastV1 {
1586    pub fd: u32,
1587    pub multiaddr: Ipv6Addr,
1588    pub iface: u32,
1589}
1590
1591#[repr(C)]
1592#[repr(align(8))]
1593#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1594#[rkyv(derive(Debug), attr(repr(align(8))))]
1595pub struct JournalEntrySocketSendFileV1 {
1596    pub socket_fd: u32,
1597    pub file_fd: u32,
1598    pub offset: u64,
1599    pub count: u64,
1600}
1601
1602#[repr(C)]
1603#[repr(align(8))]
1604#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1605#[rkyv(attr(repr(align(8))))]
1606pub struct JournalEntrySocketSendToV1<'a> {
1607    pub fd: u32,
1608    pub data: AlignedCowVec<'a, u8>,
1609    pub flags: u16,
1610    pub addr: SocketAddr,
1611    pub is_64bit: bool,
1612}
1613
1614#[repr(C)]
1615#[repr(align(8))]
1616#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1617#[rkyv(attr(repr(align(8))))]
1618pub struct JournalEntrySocketSendV1<'a> {
1619    pub fd: u32,
1620    pub data: AlignedCowVec<'a, u8>,
1621    pub flags: u16,
1622    pub is_64bit: bool,
1623}
1624
1625#[repr(C)]
1626#[repr(align(8))]
1627#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1628#[rkyv(derive(Debug), attr(repr(align(8))))]
1629pub struct JournalEntrySocketSetOptFlagV1 {
1630    pub fd: u32,
1631    pub opt: JournalSockoptionV1,
1632    pub flag: bool,
1633}
1634
1635#[repr(C)]
1636#[repr(align(8))]
1637#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1638#[rkyv(derive(Debug), attr(repr(align(8))))]
1639pub struct JournalEntrySocketSetOptSizeV1 {
1640    pub fd: u32,
1641    pub opt: JournalSockoptionV1,
1642    pub size: u64,
1643}
1644
1645#[repr(C)]
1646#[repr(align(8))]
1647#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1648#[rkyv(derive(Debug), attr(repr(align(8))))]
1649pub struct JournalEntrySocketSetOptTimeV1 {
1650    pub fd: u32,
1651    pub ty: JournalTimeTypeV1,
1652    pub time: Option<Duration>,
1653}
1654
1655#[repr(C)]
1656#[repr(align(8))]
1657#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1658#[rkyv(derive(Debug), attr(repr(align(8))))]
1659pub struct JournalEntrySocketShutdownV1 {
1660    pub fd: u32,
1661    pub how: JournalSocketShutdownV1,
1662}
1663
1664#[repr(C)]
1665#[repr(align(8))]
1666#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1667#[rkyv(derive(Debug), attr(repr(align(8))))]
1668pub struct JournalEntrySnapshotV1 {
1669    pub since_epoch: Duration,
1670    pub trigger: JournalSnapshotTriggerV1,
1671}
1672
1673#[repr(C)]
1674#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1675#[rkyv(derive(Debug))]
1676pub enum JournalSnapshot0ClockidV1 {
1677    Realtime,
1678    Monotonic,
1679    ProcessCputimeId,
1680    ThreadCputimeId,
1681    Unknown = 255,
1682}
1683
1684#[repr(C)]
1685#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1686#[rkyv(derive(Debug))]
1687pub enum JournalWhenceV1 {
1688    Set,
1689    Cur,
1690    End,
1691    Unknown = 255,
1692}
1693
1694#[repr(C)]
1695#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1696#[rkyv(derive(Debug))]
1697pub enum JournalAdviceV1 {
1698    Normal,
1699    Sequential,
1700    Random,
1701    Willneed,
1702    Dontneed,
1703    Noreuse,
1704    Unknown = 255,
1705}
1706
1707#[repr(C)]
1708#[repr(align(8))]
1709#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1710#[rkyv(derive(Debug))]
1711pub struct JournalIpCidrV1 {
1712    pub ip: IpAddr,
1713    pub prefix: u8,
1714}
1715
1716#[repr(C)]
1717#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1718#[rkyv(derive(Debug))]
1719pub enum JournalExitCodeV1 {
1720    Errno(u16),
1721    Other(i32),
1722}
1723
1724#[repr(C)]
1725#[derive(
1726    Debug,
1727    Clone,
1728    Copy,
1729    PartialEq,
1730    Eq,
1731    PartialOrd,
1732    Ord,
1733    Hash,
1734    RkyvSerialize,
1735    RkyvDeserialize,
1736    Archive,
1737)]
1738#[rkyv(derive(Debug))]
1739pub enum JournalSnapshotTriggerV1 {
1740    Idle,
1741    Listen,
1742    Environ,
1743    Stdin,
1744    Timer,
1745    Sigint,
1746    Sigalrm,
1747    Sigtstp,
1748    Sigstop,
1749    NonDeterministicCall,
1750    Bootstrap,
1751    Transaction,
1752    Explicit,
1753}
1754
1755#[repr(C)]
1756#[derive(
1757    Debug,
1758    Clone,
1759    Copy,
1760    PartialEq,
1761    Eq,
1762    PartialOrd,
1763    Ord,
1764    Hash,
1765    RkyvSerialize,
1766    RkyvDeserialize,
1767    Archive,
1768)]
1769#[rkyv(derive(Debug))]
1770pub enum JournalEpollCtlV1 {
1771    Add,
1772    Mod,
1773    Del,
1774    Unknown,
1775}
1776
1777#[repr(C)]
1778#[repr(align(8))]
1779#[derive(Debug, Clone, RkyvSerialize, RkyvDeserialize, Archive)]
1780#[rkyv(derive(Debug))]
1781pub struct JournalEpollEventCtlV1 {
1782    pub events: u32,
1783    pub ptr: u64,
1784    pub fd: u32,
1785    pub data1: u32,
1786    pub data2: u64,
1787}
1788
1789#[repr(C)]
1790#[derive(
1791    Debug,
1792    Clone,
1793    Copy,
1794    PartialEq,
1795    Eq,
1796    PartialOrd,
1797    Ord,
1798    Hash,
1799    RkyvSerialize,
1800    RkyvDeserialize,
1801    Archive,
1802)]
1803#[rkyv(derive(Debug))]
1804pub enum JournalStreamSecurityV1 {
1805    Unencrypted,
1806    AnyEncryption,
1807    ClassicEncryption,
1808    DoubleEncryption,
1809    Unknown,
1810}
1811
1812#[repr(C)]
1813#[derive(
1814    Debug,
1815    Clone,
1816    Copy,
1817    PartialEq,
1818    Eq,
1819    PartialOrd,
1820    Ord,
1821    Hash,
1822    RkyvSerialize,
1823    RkyvDeserialize,
1824    Archive,
1825)]
1826#[rkyv(derive(Debug))]
1827pub enum JournalAddressfamilyV1 {
1828    Unspec,
1829    Inet4,
1830    Inet6,
1831    Unix,
1832}
1833
1834#[repr(C)]
1835#[derive(
1836    Debug,
1837    Clone,
1838    Copy,
1839    PartialEq,
1840    Eq,
1841    PartialOrd,
1842    Ord,
1843    Hash,
1844    RkyvSerialize,
1845    RkyvDeserialize,
1846    Archive,
1847)]
1848#[rkyv(derive(Debug))]
1849pub enum JournalSocktypeV1 {
1850    Unknown,
1851    Stream,
1852    Dgram,
1853    Raw,
1854    Seqpacket,
1855}
1856
1857#[repr(C)]
1858#[derive(
1859    Debug,
1860    Clone,
1861    Copy,
1862    PartialEq,
1863    Eq,
1864    PartialOrd,
1865    Ord,
1866    Hash,
1867    RkyvSerialize,
1868    RkyvDeserialize,
1869    Archive,
1870)]
1871#[rkyv(derive(Debug))]
1872pub enum JournalSockoptionV1 {
1873    Noop,
1874    ReusePort,
1875    ReuseAddr,
1876    NoDelay,
1877    DontRoute,
1878    OnlyV6,
1879    Broadcast,
1880    MulticastLoopV4,
1881    MulticastLoopV6,
1882    Promiscuous,
1883    Listening,
1884    LastError,
1885    KeepAlive,
1886    Linger,
1887    OobInline,
1888    RecvBufSize,
1889    SendBufSize,
1890    RecvLowat,
1891    SendLowat,
1892    RecvTimeout,
1893    SendTimeout,
1894    ConnectTimeout,
1895    AcceptTimeout,
1896    Ttl,
1897    MulticastTtlV4,
1898    Type,
1899    Proto,
1900}
1901
1902#[repr(C)]
1903#[derive(
1904    Debug,
1905    Clone,
1906    Copy,
1907    PartialEq,
1908    Eq,
1909    PartialOrd,
1910    Ord,
1911    Hash,
1912    RkyvSerialize,
1913    RkyvDeserialize,
1914    Archive,
1915)]
1916#[rkyv(derive(Debug))]
1917pub enum JournalTimeTypeV1 {
1918    ReadTimeout,
1919    WriteTimeout,
1920    AcceptTimeout,
1921    ConnectTimeout,
1922    BindTimeout,
1923    Linger,
1924}
1925
1926#[repr(C)]
1927#[derive(
1928    Debug,
1929    Clone,
1930    Copy,
1931    PartialEq,
1932    Eq,
1933    PartialOrd,
1934    Ord,
1935    Hash,
1936    RkyvSerialize,
1937    RkyvDeserialize,
1938    Archive,
1939)]
1940#[rkyv(derive(Debug))]
1941pub enum JournalSocketShutdownV1 {
1942    Read,
1943    Write,
1944    Both,
1945}
1946
1947#[repr(C)]
1948#[repr(align(8))]
1949#[derive(
1950    Debug,
1951    Clone,
1952    Copy,
1953    RkyvSerialize,
1954    RkyvDeserialize,
1955    Archive,
1956    PartialOrd,
1957    Ord,
1958    PartialEq,
1959    Eq,
1960    Hash,
1961)]
1962#[rkyv(derive(Debug), attr(repr(align(8))))]
1963pub enum JournalThreadStartTypeV1 {
1964    MainThread,
1965    ThreadSpawn { start_ptr: u64 },
1966}
1967
1968#[repr(C)]
1969#[repr(align(8))]
1970#[derive(Debug, Clone, Copy, RkyvSerialize, RkyvDeserialize, Archive, PartialEq, Eq, Hash)]
1971#[rkyv(derive(Debug), attr(repr(align(8))))]
1972pub struct JournalWasiMemoryLayout {
1973    pub stack_upper: u64,
1974    pub stack_lower: u64,
1975    pub guard_size: u64,
1976    pub stack_size: u64,
1977}