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 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  COMPONENT DEFINITION                                   RELEASE        */
26 /*                                                                        */
27 /*    fx_directory.h                                      PORTABLE C      */
28 /*                                                           6.1          */
29 /*  AUTHOR                                                                */
30 /*                                                                        */
31 /*    William E. Lamie, Microsoft Corporation                             */
32 /*                                                                        */
33 /*  DESCRIPTION                                                           */
34 /*                                                                        */
35 /*    This file defines the FileX Directory component constants, data     */
36 /*    definitions, and external references.  It is assumed that fx_api.h  */
37 /*    (and fx_port.h) have already been included.                         */
38 /*                                                                        */
39 /*  RELEASE HISTORY                                                       */
40 /*                                                                        */
41 /*    DATE              NAME                      DESCRIPTION             */
42 /*                                                                        */
43 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
44 /*  09-30-2020     William E. Lamie         Modified comment(s),          */
45 /*                                            resulting in version 6.1    */
46 /*                                                                        */
47 /**************************************************************************/
48 
49 #ifndef FX_DIRECTORY_H
50 #define FX_DIRECTORY_H
51 
52 
53 /* Define the external Directory component function prototypes.  */
54 
55 UINT _fx_directory_attributes_read(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes_ptr);
56 UINT _fx_directory_attributes_set(FX_MEDIA *media_ptr, CHAR *directory_name, UINT attributes);
57 UINT _fx_directory_create(FX_MEDIA *media_ptr, CHAR *directory_name);
58 UINT _fx_directory_default_get(FX_MEDIA *media_ptr, CHAR **return_path_name);
59 UINT _fx_directory_default_get_copy(FX_MEDIA *media_ptr, CHAR *return_path_name_buffer, UINT return_path_name_buffer_size);
60 UINT _fx_directory_default_set(FX_MEDIA *media_ptr, CHAR *new_path_name);
61 UINT _fx_directory_delete(FX_MEDIA *media_ptr, CHAR *directory_name);
62 UINT _fx_directory_entry_read_FAT(FX_MEDIA *media_ptr, FX_DIR_ENTRY *source_dir, ULONG *entry_ptr,
63                                   FX_DIR_ENTRY *destination_ptr);
64 UINT _fx_directory_first_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name);
65 UINT _fx_directory_first_full_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes,
66                                          ULONG *size, UINT *year, UINT *month, UINT *day, UINT *hour, UINT *minute, UINT *second);
67 UINT _fx_directory_information_get(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes, ULONG *size,
68                                    UINT *year, UINT *month, UINT *day, UINT *hour, UINT *minute, UINT *second);
69 UINT _fx_directory_local_path_clear(FX_MEDIA *media_ptr);
70 UINT _fx_directory_local_path_get(FX_MEDIA *media_ptr, CHAR **return_path_name);
71 UINT _fx_directory_local_path_get_copy(FX_MEDIA *media_ptr, CHAR *return_path_name_buffer, UINT return_path_name_buffer_size);
72 UINT _fx_directory_local_path_restore(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr);
73 UINT _fx_directory_local_path_set(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr, CHAR *new_path_name);
74 UINT _fx_directory_long_name_get(FX_MEDIA *media_ptr, CHAR *short_file_name, CHAR *long_file_name);
75 UINT _fx_directory_long_name_get_extended(FX_MEDIA *media_ptr, CHAR *short_file_name, CHAR *long_file_name, UINT long_file_name_buffer_length);
76 UINT _fx_directory_name_test(FX_MEDIA *media_ptr, CHAR *directory_name);
77 UINT _fx_directory_next_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name);
78 UINT _fx_directory_next_full_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes,
79                                         ULONG *size, UINT *year, UINT *month, UINT *day, UINT *hour, UINT *minute, UINT *second);
80 UINT _fx_directory_rename(FX_MEDIA *media_ptr, CHAR *old_directory_name, CHAR *new_directory_name);
81 UINT _fx_directory_short_name_get(FX_MEDIA *media_ptr, CHAR *long_file_name, CHAR *short_file_name);
82 UINT _fx_directory_short_name_get_extended(FX_MEDIA *media_ptr, CHAR *long_file_name, CHAR *short_file_name, UINT short_file_name_length);
83 
84 UINT _fxe_directory_attributes_read(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes_ptr);
85 UINT _fxe_directory_attributes_set(FX_MEDIA *media_ptr, CHAR *directory_name, UINT attributes);
86 UINT _fxe_directory_create(FX_MEDIA *media_ptr, CHAR *directory_name);
87 UINT _fxe_directory_default_get(FX_MEDIA *media_ptr, CHAR **return_path_name);
88 UINT _fxe_directory_default_get_copy(FX_MEDIA *media_ptr, CHAR *return_path_name_buffer, UINT return_path_name_buffer_size);
89 UINT _fxe_directory_default_set(FX_MEDIA *media_ptr, CHAR *new_path_name);
90 UINT _fxe_directory_delete(FX_MEDIA *media_ptr, CHAR *directory_name);
91 UINT _fxe_directory_first_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name);
92 UINT _fxe_directory_first_full_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes,
93                                           ULONG *size, UINT *year, UINT *month, UINT *day, UINT *hour, UINT *minute, UINT *second);
94 UINT _fxe_directory_information_get(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes, ULONG *size,
95                                     UINT *year, UINT *month, UINT *day, UINT *hour, UINT *minute, UINT *second);
96 UINT _fxe_directory_local_path_clear(FX_MEDIA *media_ptr);
97 UINT _fxe_directory_local_path_get(FX_MEDIA *media_ptr, CHAR **return_path_name);
98 UINT _fxe_directory_local_path_get_copy(FX_MEDIA *media_ptr, CHAR *return_path_name_buffer, UINT return_path_name_buffer_size);
99 UINT _fxe_directory_local_path_restore(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr);
100 UINT _fxe_directory_local_path_set(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr, CHAR *new_path_name, UINT local_path_control_block_size);
101 UINT _fxe_directory_long_name_get(FX_MEDIA *media_ptr, CHAR *short_file_name, CHAR *long_file_name);
102 UINT _fxe_directory_long_name_get_extended(FX_MEDIA *media_ptr, CHAR *short_file_name, CHAR *long_file_name, UINT long_file_name_buffer_length);
103 UINT _fxe_directory_name_test(FX_MEDIA *media_ptr, CHAR *directory_name);
104 UINT _fxe_directory_next_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name);
105 UINT _fxe_directory_next_full_entry_find(FX_MEDIA *media_ptr, CHAR *directory_name, UINT *attributes,
106                                          ULONG *size, UINT *year, UINT *month, UINT *day, UINT *hour, UINT *minute, UINT *second);
107 UINT _fxe_directory_rename(FX_MEDIA *media_ptr, CHAR *old_directory_name, CHAR *new_directory_name);
108 UINT _fxe_directory_short_name_get(FX_MEDIA *media_ptr, CHAR *long_file_name, CHAR *short_file_name);
109 UINT _fxe_directory_short_name_get_extended(FX_MEDIA *media_ptr, CHAR *long_file_name, CHAR *short_file_name, UINT short_file_name_length);
110 
111 
112 /* Define the internal Directory component function prototypes.  */
113 
114 UINT  _fx_directory_entry_read(FX_MEDIA *media_ptr, FX_DIR_ENTRY *source_dir, ULONG *entry, FX_DIR_ENTRY *destination_ptr);
115 UINT  _fx_directory_entry_write(FX_MEDIA *media_ptr, FX_DIR_ENTRY *entry_ptr);
116 UINT  _fx_directory_free_search(FX_MEDIA *media_ptr, FX_DIR_ENTRY *directory_ptr, FX_DIR_ENTRY *entry_ptr);
117 CHAR *_fx_directory_name_extract(CHAR *source_ptr, CHAR *dest_ptr);
118 UINT  _fx_directory_search(FX_MEDIA *media_ptr, CHAR *name_ptr, FX_DIR_ENTRY *entry_ptr, FX_DIR_ENTRY *last_dir_ptr, CHAR **last_name_ptr);
119 
120 #endif
121 
122