fx_directory_local_path_clear.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 | /* */ | ||
| 41 | /* FUNCTION RELEASE */ | ||
| 42 | /* */ | ||
| 43 | /* _fx_directory_local_path_clear PORTABLE C */ | ||
| 44 | /* 6.1 */ | ||
| 45 | /* AUTHOR */ | ||
| 46 | /* */ | ||
| 47 | /* William E. Lamie, Microsoft Corporation */ | ||
| 48 | /* */ | ||
| 49 | /* DESCRIPTION */ | ||
| 50 | /* */ | ||
| 51 | /* This function clears the local default directory of the media so */ | ||
| 52 | /* any path relative operations will start using the media's global */ | ||
| 53 | /* default path again. */ | ||
| 54 | /* */ | ||
| 55 | /* INPUT */ | ||
| 56 | /* */ | ||
| 57 | /* media_ptr Media control block pointer */ | ||
| 58 | /* */ | ||
| 59 | /* OUTPUT */ | ||
| 60 | /* */ | ||
| 61 | /* return status */ | ||
| 62 | /* */ | ||
| 63 | /* CALLS */ | ||
| 64 | /* */ | ||
| 65 | /* None */ | ||
| 66 | /* */ | ||
| 67 | /* CALLED BY */ | ||
| 68 | /* */ | ||
| 69 | /* Application Code */ | ||
| 70 | /* */ | ||
| 71 | /**************************************************************************/ | ||
| 72 | 3492 | UINT _fx_directory_local_path_clear(FX_MEDIA *media_ptr) | |
| 73 | { | ||
| 74 | |||
| 75 | |||
| 76 | #ifndef FX_MEDIA_STATISTICS_DISABLE | ||
| 77 | |||
| 78 | /* Increment the number of times this service has been called. */ | ||
| 79 | 3492 | media_ptr -> fx_media_directory_local_path_clears++; | |
| 80 | #endif | ||
| 81 | |||
| 82 | /* Check the media to make sure it is open. */ | ||
| 83 |
2/2✓ Branch 2 → 3 taken 5 times.
✓ Branch 2 → 4 taken 3487 times.
|
3492 | if (media_ptr -> fx_media_id != FX_MEDIA_ID) |
| 84 | { | ||
| 85 | |||
| 86 | /* Return the media not opened error. */ | ||
| 87 | 5 | return(FX_MEDIA_NOT_OPEN); | |
| 88 | } | ||
| 89 | |||
| 90 | #ifdef FX_NO_LOCAL_PATH | ||
| 91 | |||
| 92 | /* Error, return to caller. */ | ||
| 93 | 4 | return(FX_NOT_IMPLEMENTED); | |
| 94 | #else | ||
| 95 | |||
| 96 | /* If trace is enabled, insert this event into the trace buffer. */ | ||
| 97 | FX_TRACE_IN_LINE_INSERT(FX_TRACE_DIRECTORY_LOCAL_PATH_CLEAR, media_ptr, 0, 0, 0, FX_TRACE_DIRECTORY_EVENTS, 0, 0) | ||
| 98 | |||
| 99 | /* Clear this thread's local path pointer. */ | ||
| 100 | 3483 | _tx_thread_current_ptr -> tx_thread_filex_ptr = FX_NULL; | |
| 101 | |||
| 102 | /* Local default directory clear is complete, return status. */ | ||
| 103 | 3483 | return(FX_SUCCESS); | |
| 104 | #endif | ||
| 105 | } | ||
| 106 | |||
| 107 |