GCC Code Coverage Report


Directory: common/src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 7 / 0 / 7
Functions: 100.0% 1 / 0 / 1
Branches: 100.0% 4 / 0 / 4

fx_fault_tolerant_transaction_fail.c
Line Branch Exec Source
1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 * Copyright (c) 2026-present Eclipse ThreadX contributors
4 *
5 * This program and the accompanying materials are made available under the
6 * terms of the MIT License which is available at
7 * https://opensource.org/licenses/MIT.
8 *
9 * SPDX-License-Identifier: MIT
10 **************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** FileX Component */
17 /** */
18 /** Fault Tolerant */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23 #define FX_SOUCE_CODE
24
25 #include "fx_api.h"
26 #include "fx_fault_tolerant.h"
27
28 #if defined(FX_ENABLE_FAULT_TOLERANT) && defined(FX_FAULT_TOLERANT_TRANSACTION_FAIL_FUNCTION)
29 /**************************************************************************/
30 /* */
31 /* FUNCTION RELEASE */
32 /* */
33 /* _fx_fault_tolerant_transaction_fail PORTABLE C */
34 /* 6.1 */
35 /* AUTHOR */
36 /* */
37 /* William E. Lamie, Microsoft Corporation */
38 /* */
39 /* DESCRIPTION */
40 /* */
41 /* This function cleans up resources created by fault tolerant when */
42 /* transaction fails. */
43 /* */
44 /* INPUT */
45 /* */
46 /* media_ptr Media control block pointer */
47 /* */
48 /* OUTPUT */
49 /* */
50 /* return status */
51 /* */
52 /* CALLS */
53 /* */
54 /* None */
55 /* */
56 /* CALLED BY */
57 /* */
58 /* _fx_directory_attributes_set */
59 /* _fx_directory_create */
60 /* _fx_directory_delete */
61 /* _fx_directory_rename */
62 /* _fx_file_allocate */
63 /* _fx_file_attributes_set */
64 /* _fx_file_best_effort_allocate */
65 /* _fx_file_create */
66 /* _fx_file_delete */
67 /* _fx_file_rename */
68 /* _fx_file_truncate */
69 /* _fx_file_truncate_release */
70 /* _fx_file_write */
71 /* _fx_unicode_directory_create */
72 /* _fx_unicode_file_create */
73 /* */
74 /**************************************************************************/
75 220525 UINT _fx_fault_tolerant_transaction_fail(FX_MEDIA *media_ptr)
76 {
77
78 /* Check whether fault tolerant is enabled or not. */
79
2/2
✓ Branch 2 → 3 taken 697 times.
✓ Branch 2 → 6 taken 219828 times.
220525 if (media_ptr -> fx_media_fault_tolerant_enabled == FX_TRUE)
80 {
81
82 /* Yes. Decrease the counter for transaction. */
83 697 media_ptr -> fx_media_fault_tolerant_transaction_count--;
84
85 /* Is this the last transaction? */
86
2/2
✓ Branch 3 → 4 taken 493 times.
✓ Branch 3 → 6 taken 204 times.
697 if (media_ptr -> fx_media_fault_tolerant_transaction_count == 0)
87 {
88
89 /* Yes. Perform recover and reset the log file. */
90 493 _fx_fault_tolerant_recover(media_ptr);
91 493 _fx_fault_tolerant_reset_log_file(media_ptr);
92 }
93 }
94
95 220525 return(FX_SUCCESS);
96 }
97 #endif
98