aboutsummaryrefslogtreecommitdiffstats
path: root/Library/UefiShellUfmCommandLib/dir.h
blob: 912b00fc3cde34e17e1a2b486bf59110b05eb06f (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
45
46
47
48
49
50
51
52
53
54
#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);

/*
 * Gets the data stored in the specified node of directory linked list
 *
 * dl: the pointer to the directory list
 * n: the node number (starts with 1)
 *
 * return: A pointer to the EFI_SHELL_FILE_INFO or NULL if search fails
*/
EFI_SHELL_FILE_INFO *dirl_getn(struct dir_list *dl, UINTN n);

#endif /* UFM_DIR_H */