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% 2 / 0 / 2

fx_directory_local_path_restore.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_restore PORTABLE C */
43 /* 6.1.5 */
44 /* AUTHOR */
45 /* */
46 /* William E. Lamie, Microsoft Corporation */
47 /* */
48 /* DESCRIPTION */
49 /* */
50 /* This function restores the local default directory of the media to */
51 /* the previous path specified by the caller. */
52 /* */
53 /* INPUT */
54 /* */
55 /* media_ptr Media control block pointer */
56 /* local_path_ptr Local path control block ptr */
57 /* */
58 /* OUTPUT */
59 /* */
60 /* return status */
61 /* */
62 /* CALLS */
63 /* */
64 /* None */
65 /* */
66 /* CALLED BY */
67 /* */
68 /* Application Code */
69 /* */
70 /**************************************************************************/
71 3290 UINT _fx_directory_local_path_restore(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr)
72 {
73
74
75 #ifndef FX_MEDIA_STATISTICS_DISABLE
76
77 /* Increment the number of times this service has been called. */
78 3290 media_ptr -> fx_media_directory_local_path_restores++;
79 #endif
80
81 /* Check the media to make sure it is open. */
82
2/2
✓ Branch 2 → 3 taken 5 times.
✓ Branch 2 → 4 taken 3285 times.
3290 if (media_ptr -> fx_media_id != FX_MEDIA_ID)
83 {
84
85 /* Return the media not opened error. */
86 5 return(FX_MEDIA_NOT_OPEN);
87 }
88
89 #ifdef FX_NO_LOCAL_PATH
90
91 FX_PARAMETER_NOT_USED(local_path_ptr);
92
93 /* Error, return to caller. */
94 4 return(FX_NOT_IMPLEMENTED);
95 #else
96
97 /* If trace is enabled, insert this event into the trace buffer. */
98 FX_TRACE_IN_LINE_INSERT(FX_TRACE_DIRECTORY_LOCAL_PATH_RESTORE, media_ptr, local_path_ptr, 0, 0, FX_TRACE_DIRECTORY_EVENTS, 0, 0)
99
100 /* Setup thread control block to use this local path pointer. */
101 3281 _tx_thread_current_ptr -> tx_thread_filex_ptr = (VOID *)local_path_ptr;
102
103 /* Default directory restore is complete, return status. */
104 3281 return(FX_SUCCESS);
105 #endif
106 }
107
108