aboutsummaryrefslogtreecommitdiffstats
path: root/Library/UefiShellUfmCommandLib/dir.h
blob: 94ad6016b7bf2bef98e2a129081413bec08e1b6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef UFM_DIR_H
#define UFM_DIR_H

#include <Uefi.h>

struct dir_list {
	EFI_SHELL_FILE_INFO *list_head;
	int len; // number of elements in list
};

/*
 * Opens a directory and gets all its entries
 *
 * search_path: the pointer to path string
 * attr: required file attributes
 *
 * return: A pointer to the allocated structure or NULL if allocation fails
*/
struct dir_list *dirl_alloc(CHAR16 *search_path, CONST UINT64 attr);

/*
 * Deletes the directory list, frees the structure
 *
 * dl: the pointer to the directory list
 *
 * return: VOID
*/
VOID dirl_release(struct dir_list *dl);

/*
 * Opens a directory and gets all its matching entries. This function 
 * supports wildcards and will process '?' and '*' as such
 * P.S: it's frontend function of dirl_alloc()
 *
 * search_path: the pointer to path string
 * wildcard: the pointer to wildcard string
 * attr: required file attributes
 *
 * return: A pointer to the allocated structure or NULL if allocation fails
*/
struct dir_list *scandir(CONST CHAR16 *search_path, CONST CHAR16 *wildcard,
    CONST UINT64 attr);

#endif /* UFM_DIR_H */