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 /** Media */
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_media.h"
29
30
31 FX_CALLER_CHECKING_EXTERNS
32
33
34 /**************************************************************************/
35 /* */
36 /* FUNCTION RELEASE */
37 /* */
38 /* _fxe_media_format PORTABLE C */
39 /* 6.1.5 */
40 /* AUTHOR */
41 /* */
42 /* William E. Lamie, Microsoft Corporation */
43 /* */
44 /* DESCRIPTION */
45 /* */
46 /* This function checks for errors in the media format call. */
47 /* */
48 /* INPUT */
49 /* */
50 /* media_ptr Pointer to media control block*/
51 /* (does not need to be opened)*/
52 /* driver Pointer to FileX driver (must */
53 /* be able to field requests */
54 /* prior to opening) */
55 /* driver_info_ptr Optional information pointer */
56 /* memory_ptr Pointer to memory used by the */
57 /* FileX for this media. */
58 /* memory_size Size of media memory - must */
59 /* at least 512 bytes and */
60 /* one sector size. */
61 /* volume_name Name of the volume */
62 /* number_of_fats Number of FAT tables */
63 /* directory_entries Number of directory entries */
64 /* hidden_sectors Number of hidden sectors */
65 /* total_sectors Total number of sectors */
66 /* bytes_per_sector Number of bytes per sector */
67 /* sectors_per_cluster Number of sectors per cluster */
68 /* heads Number of heads */
69 /* sectors_per_track Number of sectors per track */
70 /* */
71 /* OUTPUT */
72 /* */
73 /* Completion Status */
74 /* */
75 /* CALLS */
76 /* */
77 /* _fx_media_format Actual media format service */
78 /* */
79 /* CALLED BY */
80 /* */
81 /* Application Code */
82 /* */
83 /* RELEASE HISTORY */
84 /* */
85 /* DATE NAME DESCRIPTION */
86 /* */
87 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
88 /* 09-30-2020 William E. Lamie Modified comment(s), */
89 /* resulting in version 6.1 */
90 /* 03-02-2021 William E. Lamie Modified comment(s), */
91 /* resulting in version 6.1.5 */
92 /* */
93 /**************************************************************************/
_fxe_media_format(FX_MEDIA * media_ptr,VOID (* driver)(FX_MEDIA * media),VOID * driver_info_ptr,UCHAR * memory_ptr,UINT memory_size,CHAR * volume_name,UINT number_of_fats,UINT directory_entries,UINT hidden_sectors,ULONG total_sectors,UINT bytes_per_sector,UINT sectors_per_cluster,UINT heads,UINT sectors_per_track)94 UINT _fxe_media_format(FX_MEDIA *media_ptr, VOID (*driver)(FX_MEDIA *media), VOID *driver_info_ptr, UCHAR *memory_ptr, UINT memory_size,
95 CHAR *volume_name, UINT number_of_fats, UINT directory_entries, UINT hidden_sectors,
96 ULONG total_sectors, UINT bytes_per_sector, UINT sectors_per_cluster,
97 UINT heads, UINT sectors_per_track)
98 {
99
100 UINT status;
101
102
103 /* Check for invalid input pointers. */
104 if ((media_ptr == FX_NULL) || (driver == FX_NULL) || (memory_ptr == FX_NULL))
105 {
106 return(FX_PTR_ERROR);
107 }
108
109 /* Check for a valid caller. */
110 FX_CALLER_CHECKING_CODE
111
112 /* Call actual media format service. */
113 status = _fx_media_format(media_ptr, driver, driver_info_ptr, memory_ptr, memory_size,
114 volume_name, number_of_fats, directory_entries, hidden_sectors,
115 total_sectors, bytes_per_sector, sectors_per_cluster,
116 heads, sectors_per_track);
117
118 /* Return completion status. */
119 return(status);
120 }
121
122