GCC Code Coverage Report


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

fx_directory_local_path_get.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 /** Directory */
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_system.h"
30 #include "fx_file.h"
31 #include "fx_utility.h"
32 #include "fx_directory.h"
33
34 #ifndef FX_NO_LOCAL_PATH
35 FX_LOCAL_PATH_SETUP
36 #endif
37
38 /**************************************************************************/
39 /* */
40 /* FUNCTION RELEASE */
41 /* */
42 /* _fx_directory_local_path_get PORTABLE C */
43 /* 6.1.5 */
44 /* AUTHOR */
45 /* */
46 /* William E. Lamie, Microsoft Corporation */
47 /* */
48 /* DESCRIPTION */
49 /* */
50 /* This function returns a pointer to the local default directory */
51 /* for this thread. */
52 /* */
53 /* INPUT */
54 /* */
55 /* media_ptr Media control block pointer */
56 /* return_path_name Return local path name */
57 /* */
58 /* OUTPUT */
59 /* */
60 /* return status */
61 /* */
62 /* CALLS */
63 /* */
64 /* None */
65 /* */
66 /* CALLED BY */
67 /* */
68 /* Application Code */
69 /* */
70 /**************************************************************************/
71 39 UINT _fx_directory_local_path_get(FX_MEDIA *media_ptr, CHAR **return_path_name)
72 {
73
74
75 #ifndef FX_MEDIA_STATISTICS_DISABLE
76
77 /* Increment the number of times this service has been called. */
78 39 media_ptr -> fx_media_directory_local_path_gets++;
79 #endif
80
81 /* Check the media to make sure it is open. */
82
2/2
✓ Branch 2 → 3 taken 10 times.
✓ Branch 2 → 4 taken 29 times.
39 if (media_ptr -> fx_media_id != FX_MEDIA_ID)
83 {
84
85 /* Return the media not opened error. */
86 10 return(FX_MEDIA_NOT_OPEN);
87 }
88
89 #ifdef FX_NO_LOCAL_PATH
90
91 FX_PARAMETER_NOT_USED(return_path_name);
92
93 /* Error, return to caller. */
94 4 return(FX_NOT_IMPLEMENTED);
95 #else
96
97 /* Determine if there is a local path. */
98
2/2
✓ Branch 4 → 5 taken 15 times.
✓ Branch 4 → 6 taken 10 times.
25 if (_tx_thread_current_ptr -> tx_thread_filex_ptr)
99 {
100
101 /* Return a pointer to the current local directory path string. */
102 15 *return_path_name = ((FX_LOCAL_PATH *)_tx_thread_current_ptr -> tx_thread_filex_ptr) -> fx_path_string;
103 }
104 else
105 {
106
107 /* Just set the return value to FX_NULL to indicate there is no
108 local path setup. */
109 10 *return_path_name = FX_NULL;
110 }
111
112 /* If trace is enabled, insert this event into the trace buffer. */
113 FX_TRACE_IN_LINE_INSERT(FX_TRACE_DIRECTORY_LOCAL_PATH_GET, media_ptr, return_path_name, 0, 0, FX_TRACE_DIRECTORY_EVENTS, 0, 0)
114
115 /* Local default directory has been returned, return status. */
116 25 return(FX_SUCCESS);
117 #endif
118 }
119
120