1 |
|
|
/**************************************************************************/ |
2 |
|
|
/* */ |
3 |
|
|
/* Copyright (c) Microsoft Corporation. All rights reserved. */ |
4 |
|
|
/* */ |
5 |
|
|
/* This software is licensed under the Microsoft Software License */ |
6 |
|
|
/* Terms for Microsoft Azure RTOS. Full text of the license can be */ |
7 |
|
|
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ |
8 |
|
|
/* and in the root directory of this software. */ |
9 |
|
|
/* */ |
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_directory.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _fx_directory_default_get PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* William E. Lamie, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function returns the pointer of the last path provided to the */ |
45 |
|
|
/* fx_directory_default_set function. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* media_ptr Media control block pointer */ |
50 |
|
|
/* return_path_name Destination string pointer */ |
51 |
|
|
/* address */ |
52 |
|
|
/* */ |
53 |
|
|
/* OUTPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* return status */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* None */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* Application Code */ |
64 |
|
|
/* */ |
65 |
|
|
/* RELEASE HISTORY */ |
66 |
|
|
/* */ |
67 |
|
|
/* DATE NAME DESCRIPTION */ |
68 |
|
|
/* */ |
69 |
|
|
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ |
70 |
|
|
/* 09-30-2020 William E. Lamie Modified comment(s), */ |
71 |
|
|
/* resulting in version 6.1 */ |
72 |
|
|
/* */ |
73 |
|
|
/**************************************************************************/ |
74 |
|
19 |
UINT _fx_directory_default_get(FX_MEDIA *media_ptr, CHAR **return_path_name) |
75 |
|
|
{ |
76 |
|
|
|
77 |
|
|
#ifndef FX_MEDIA_STATISTICS_DISABLE |
78 |
|
|
|
79 |
|
|
/* Increment the number of times this service has been called. */ |
80 |
|
19 |
media_ptr -> fx_media_directory_default_gets++; |
81 |
|
|
#endif |
82 |
|
|
|
83 |
|
|
/* Check the media to make sure it is open. */ |
84 |
✓✓ |
19 |
if (media_ptr -> fx_media_id != FX_MEDIA_ID) |
85 |
|
|
{ |
86 |
|
|
|
87 |
|
|
/* Return the media not opened error. */ |
88 |
|
3 |
return(FX_MEDIA_NOT_OPEN); |
89 |
|
|
} |
90 |
|
|
|
91 |
|
|
/* If trace is enabled, insert this event into the trace buffer. */ |
92 |
|
|
FX_TRACE_IN_LINE_INSERT(FX_TRACE_DIRECTORY_DEFAULT_GET, media_ptr, return_path_name, 0, 0, FX_TRACE_DIRECTORY_EVENTS, 0, 0) |
93 |
|
|
|
94 |
|
|
/* Protect against other threads accessing the media. */ |
95 |
|
16 |
FX_PROTECT |
96 |
|
|
|
97 |
|
|
/* Return the last pointer supplied to the set default directory function. */ |
98 |
|
16 |
*return_path_name = media_ptr -> fx_media_default_path.fx_path_string; |
99 |
|
|
|
100 |
|
|
/* Release media protection. */ |
101 |
|
16 |
FX_UNPROTECT |
102 |
|
|
|
103 |
|
|
/* Return successful status. */ |
104 |
|
16 |
return(FX_SUCCESS); |
105 |
|
|
} |
106 |
|
|
|