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 /** Directory */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define FX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "fx_api.h"
28 #include "fx_system.h"
29 #include "fx_file.h"
30 #include "fx_utility.h"
31 #include "fx_directory.h"
32
33 #ifndef FX_NO_LOCAL_PATH
34 FX_LOCAL_PATH_SETUP
35 #endif
36
37 /**************************************************************************/
38 /* */
39 /* FUNCTION RELEASE */
40 /* */
41 /* _fx_directory_local_path_restore PORTABLE C */
42 /* 6.1.5 */
43 /* AUTHOR */
44 /* */
45 /* William E. Lamie, Microsoft Corporation */
46 /* */
47 /* DESCRIPTION */
48 /* */
49 /* This function restores the local default directory of the media to */
50 /* the previous path specified by the caller. */
51 /* */
52 /* INPUT */
53 /* */
54 /* media_ptr Media control block pointer */
55 /* local_path_ptr Local path control block ptr */
56 /* */
57 /* OUTPUT */
58 /* */
59 /* return status */
60 /* */
61 /* CALLS */
62 /* */
63 /* None */
64 /* */
65 /* CALLED BY */
66 /* */
67 /* Application Code */
68 /* */
69 /* RELEASE HISTORY */
70 /* */
71 /* DATE NAME DESCRIPTION */
72 /* */
73 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
74 /* 09-30-2020 William E. Lamie Modified comment(s), */
75 /* resulting in version 6.1 */
76 /* 03-02-2021 William E. Lamie Modified comment(s), */
77 /* resulting in version 6.1.5 */
78 /* */
79 /**************************************************************************/
_fx_directory_local_path_restore(FX_MEDIA * media_ptr,FX_LOCAL_PATH * local_path_ptr)80 UINT _fx_directory_local_path_restore(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr)
81 {
82
83
84 #ifndef FX_MEDIA_STATISTICS_DISABLE
85
86 /* Increment the number of times this service has been called. */
87 media_ptr -> fx_media_directory_local_path_restores++;
88 #endif
89
90 /* Check the media to make sure it is open. */
91 if (media_ptr -> fx_media_id != FX_MEDIA_ID)
92 {
93
94 /* Return the media not opened error. */
95 return(FX_MEDIA_NOT_OPEN);
96 }
97
98 #ifdef FX_NO_LOCAL_PATH
99
100 FX_PARAMETER_NOT_USED(local_path_ptr);
101
102 /* Error, return to caller. */
103 return(FX_NOT_IMPLEMENTED);
104 #else
105
106 /* If trace is enabled, insert this event into the trace buffer. */
107 FX_TRACE_IN_LINE_INSERT(FX_TRACE_DIRECTORY_LOCAL_PATH_RESTORE, media_ptr, local_path_ptr, 0, 0, FX_TRACE_DIRECTORY_EVENTS, 0, 0)
108
109 /* Setup thread control block to use this local path pointer. */
110 _tx_thread_current_ptr -> tx_thread_filex_ptr = (VOID *)local_path_ptr;
111
112 /* Default directory restore is complete, return status. */
113 return(FX_SUCCESS);
114 #endif
115 }
116
117