fx_media_volume_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 | // Portions of this file were generated with AI assistance. | ||
| 13 | |||
| 14 | |||
| 15 | /**************************************************************************/ | ||
| 16 | /**************************************************************************/ | ||
| 17 | /** */ | ||
| 18 | /** FileX Component */ | ||
| 19 | /** */ | ||
| 20 | /** Media */ | ||
| 21 | /** */ | ||
| 22 | /**************************************************************************/ | ||
| 23 | /**************************************************************************/ | ||
| 24 | |||
| 25 | #define FX_SOURCE_CODE | ||
| 26 | |||
| 27 | |||
| 28 | /* Include necessary system files. */ | ||
| 29 | |||
| 30 | #include "fx_api.h" | ||
| 31 | #include "fx_system.h" | ||
| 32 | #include "fx_directory.h" | ||
| 33 | #include "fx_media.h" | ||
| 34 | #include "fx_utility.h" | ||
| 35 | |||
| 36 | |||
| 37 | /* DEPRECATION NOTICE | ||
| 38 | * fx_media_volume_get() is deprecated. Do not use it in new code. | ||
| 39 | * | ||
| 40 | * WHY: Does not accept a volume-name buffer length; writes up to 12 bytes regardless of the caller's buffer size, risking a buffer overrun. | ||
| 41 | * | ||
| 42 | * WHAT TO DO: replace calls with fx_media_volume_get_extended(), passing the actual | ||
| 43 | * destination buffer size as an additional argument. | ||
| 44 | */ | ||
| 45 | #pragma message("fx_media_volume_get() is deprecated. " \ | ||
| 46 | "Use fx_media_volume_get_extended() and pass the actual buffer size.") | ||
| 47 | |||
| 48 | /**************************************************************************/ | ||
| 49 | /* */ | ||
| 50 | /* FUNCTION RELEASE */ | ||
| 51 | /* */ | ||
| 52 | /* _fx_media_volume_get PORTABLE C */ | ||
| 53 | /* 6.1 */ | ||
| 54 | /* AUTHOR */ | ||
| 55 | /* */ | ||
| 56 | /* William E. Lamie, Microsoft Corporation */ | ||
| 57 | /* */ | ||
| 58 | /* DESCRIPTION */ | ||
| 59 | /* */ | ||
| 60 | /* This function reads the volume name stored in the media's boot */ | ||
| 61 | /* record or root directory. */ | ||
| 62 | /* */ | ||
| 63 | /* DEPRECATED. Use fx_media_volume_get_extended() instead, passing the */ | ||
| 64 | /* actual destination buffer length. This function takes no buffer */ | ||
| 65 | /* length and writes up to 12 bytes whatever the size of the caller's */ | ||
| 66 | /* buffer, risking an overrun. */ | ||
| 67 | /* */ | ||
| 68 | /* INPUT */ | ||
| 69 | /* */ | ||
| 70 | /* media_ptr Media control block pointer */ | ||
| 71 | /* volume_name Pointer to destination for */ | ||
| 72 | /* the volume name (maximum */ | ||
| 73 | /* 11 characters + NULL) */ | ||
| 74 | /* volume_source Source of volume */ | ||
| 75 | /* */ | ||
| 76 | /* OUTPUT */ | ||
| 77 | /* */ | ||
| 78 | /* return status */ | ||
| 79 | /* */ | ||
| 80 | /* CALLS */ | ||
| 81 | /* */ | ||
| 82 | /* _fx_media_volume_get_extended Actual media volume get */ | ||
| 83 | /* service */ | ||
| 84 | /* */ | ||
| 85 | /* CALLED BY */ | ||
| 86 | /* */ | ||
| 87 | /* Application Code */ | ||
| 88 | /* */ | ||
| 89 | /**************************************************************************/ | ||
| 90 | 9189 | UINT _fx_media_volume_get(FX_MEDIA *media_ptr, CHAR *volume_name, UINT volume_source) | |
| 91 | { | ||
| 92 | |||
| 93 | /* Call the extended version with 12 bytes volume name length. */ | ||
| 94 | 9189 | return(_fx_media_volume_get_extended(media_ptr, volume_name, 12, volume_source)); | |
| 95 | } | ||
| 96 | |||
| 97 |