1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** FileX Component                                                       */
16 /**                                                                       */
17 /**   Trace                                                               */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #ifndef FX_SOURCE_CODE
23 #define FX_SOURCE_CODE
24 #endif
25 
26 #include "fx_api.h"
27 
28 #ifdef TX_ENABLE_EVENT_TRACE
29 
30 
31 /* Include necessary system files.  */
32 
33 
34 
35 /**************************************************************************/
36 /*                                                                        */
37 /*  FUNCTION                                               RELEASE        */
38 /*                                                                        */
39 /*    _fx_trace_event_update                              PORTABLE C      */
40 /*                                                           6.1          */
41 /*  AUTHOR                                                                */
42 /*                                                                        */
43 /*    William E. Lamie, Microsoft Corporation                             */
44 /*                                                                        */
45 /*  DESCRIPTION                                                           */
46 /*                                                                        */
47 /*    This function inserts a FileX event into the current trace buffer.  */
48 /*                                                                        */
49 /*  INPUT                                                                 */
50 /*                                                                        */
51 /*    event                                 Event pointer                 */
52 /*    timestamp                             Timestamp of the event        */
53 /*    event_id                              User Event ID                 */
54 /*    info_field_1                          First information field       */
55 /*    info_field_2                          First information field       */
56 /*    info_field_3                          First information field       */
57 /*    info_field_4                          First information field       */
58 /*                                                                        */
59 /*  OUTPUT                                                                */
60 /*                                                                        */
61 /*    None                                                                */
62 /*                                                                        */
63 /*  CALLS                                                                 */
64 /*                                                                        */
65 /*    None                                                                */
66 /*                                                                        */
67 /*  CALLED BY                                                             */
68 /*                                                                        */
69 /*    Internal FileX Functions                                            */
70 /*                                                                        */
71 /*  RELEASE HISTORY                                                       */
72 /*                                                                        */
73 /*    DATE              NAME                      DESCRIPTION             */
74 /*                                                                        */
75 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
76 /*  09-30-2020     William E. Lamie         Modified comment(s),          */
77 /*                                            resulting in version 6.1    */
78 /*                                                                        */
79 /**************************************************************************/
_fx_trace_event_update(TX_TRACE_BUFFER_ENTRY * event,ULONG timestamp,ULONG event_id,ULONG info_field_1,ULONG info_field_2,ULONG info_field_3,ULONG info_field_4)80 VOID  _fx_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4)
81 {
82 
83 TX_INTERRUPT_SAVE_AREA
84 
85 
86     /* Disable interrupts.  */
87     TX_DISABLE
88 
89     /* Determine if the event exists and is still the event originally inserted into the trace.  */
90     if ((event) && (event -> tx_trace_buffer_entry_event_id == event_id) && (event -> tx_trace_buffer_entry_time_stamp == timestamp))
91     {
92 
93         /* Yes, update this trace entry based on the info input parameters.  */
94 
95         /* Check for info field 1 update.  */
96         if (info_field_1)
97         {
98 
99             /* Yes, update info field 1.  */
100             event -> tx_trace_buffer_entry_information_field_1 =  info_field_1;
101         }
102 
103         /* Check for info field 2 update.  */
104         if (info_field_2)
105         {
106 
107             /* Yes, update info field 2.  */
108             event -> tx_trace_buffer_entry_information_field_2 =  info_field_2;
109         }
110 
111         /* Check for info field 3 update.  */
112         if (info_field_3)
113         {
114 
115             /* Yes, update info field 3.  */
116             event -> tx_trace_buffer_entry_information_field_3 =  info_field_3;
117         }
118 
119         /* Check for info field 4 update.  */
120         if (info_field_4)
121         {
122 
123             /* Yes, update info field 4.  */
124             event -> tx_trace_buffer_entry_information_field_4 =  info_field_4;
125         }
126     }
127     /* Restore interrupts.  */
128     TX_RESTORE
129 }
130 
131 
132 #endif /* TX_ENABLE_EVENT_TRACE */
133 
134