GCC Code Coverage Report


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

fxe_file_extended_best_effort_allocate.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 /** File */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23 #define FX_SOURCE_CODE
24
25
26 /* Include necessary system files. */
27
28 #include "fx_api.h"
29 #include "fx_file.h"
30
31 FX_CALLER_CHECKING_EXTERNS
32
33
34 /**************************************************************************/
35 /* */
36 /* FUNCTION RELEASE */
37 /* */
38 /* _fxe_file_extended_best_effort_allocate PORTABLE C */
39 /* 6.1 */
40 /* AUTHOR */
41 /* */
42 /* William E. Lamie, Microsoft Corporation */
43 /* */
44 /* DESCRIPTION */
45 /* */
46 /* This function checks for errors in the file best effort allocate */
47 /* service. */
48 /* */
49 /* INPUT */
50 /* */
51 /* file_ptr File control block pointer */
52 /* size Number of bytes to allocate */
53 /* actual_size_allocated Number of bytes allocated */
54 /* */
55 /* OUTPUT */
56 /* */
57 /* return status */
58 /* */
59 /* CALLS */
60 /* */
61 /* _fx_file_extended_best_effort_allocate Actual best effort file */
62 /* allocate service */
63 /* */
64 /* CALLED BY */
65 /* */
66 /* Application Code */
67 /* */
68 /**************************************************************************/
69 2974 UINT _fxe_file_extended_best_effort_allocate(FX_FILE *file_ptr, ULONG64 size, ULONG64 *actual_size_allocated)
70 {
71
72 UINT status;
73
74
75 /* Check for a null file pointer. */
76
4/4
✓ Branch 2 → 3 taken 2966 times.
✓ Branch 2 → 4 taken 8 times.
✓ Branch 3 → 4 taken 690 times.
✓ Branch 3 → 5 taken 2276 times.
2974 if ((file_ptr == FX_NULL) || (actual_size_allocated == FX_NULL))
77 {
78 698 return(FX_PTR_ERROR);
79 }
80
81 /* Check for a valid caller. */
82
6/6
✓ Branch 5 → 6 taken 1483 times.
✓ Branch 5 → 8 taken 690 times.
✓ Branch 6 → 7 taken 793 times.
✓ Branch 6 → 8 taken 690 times.
✓ Branch 7 → 8 taken 690 times.
✓ Branch 7 → 9 taken 103 times.
2173 FX_CALLER_CHECKING_CODE
83
84 /* Call actual best effort file allocate service. */
85 206 status = _fx_file_extended_best_effort_allocate(file_ptr, size, actual_size_allocated);
86
87 /* Return status to the caller. */
88 206 return(status);
89 }
90
91