File: fileops.h

package info (click to toggle)
elilo 3.8-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,164 kB
  • ctags: 3,003
  • sloc: ansic: 13,327; sh: 700; asm: 533; makefile: 227; perl: 44
file content (127 lines) | stat: -rw-r--r-- 4,353 bytes parent folder | download | duplicates (5)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 *  Copyright (C) 2001-2003 Hewlett-Packard Co.
 *	Contributed by Stephane Eranian <eranian@hpl.hp.com>
 *
 * This file is part of the ELILO, the EFI Linux boot loader.
 *
 *  GNU EFI is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  GNU EFI is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with GNU EFI; see the file COPYING.  If not, write to the Free
 *  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 *  02111-1307, USA.
 *
 * Please check out the elilo.txt for complete documentation on how
 * to use this program.
 */

#ifndef __FILEOPS_H__
#define __FILEOPS_H__

#define FILEOPS_NAME_MAXLEN	32	/* length of filesystem name */

/*
 * upper-level interface used by the bootloader
 */
typedef UINTN	fops_fd_t;

/* Forward declaration: */
struct config_file;

extern EFI_STATUS fops_open(CHAR16 *name, fops_fd_t *fd);
extern EFI_STATUS fops_read(fops_fd_t fd,VOID *buf, UINTN *size);
extern EFI_STATUS fops_close(fops_fd_t fd);
extern EFI_STATUS fops_infosize(fops_fd_t fd, UINT64 *size);
extern EFI_STATUS fops_seek(fops_fd_t fd, UINT64 newpos);
extern EFI_STATUS fops_setdefaults(struct config_file *defconf, CHAR16 *kname, UINTN maxlen, CHAR16 *devpath);
extern EFI_STATUS fops_getdefault_path(CHAR16 *path, UINTN maxlen);
extern CHAR16     *fops_bootdev_name(VOID);


/*
 * fileops interface used by underlying filesystems layer
 */

typedef EFI_STATUS (*fops_open_t)(VOID *intf, CHAR16 *name, fops_fd_t *fd);
typedef EFI_STATUS (*fops_read_t)(VOID *intf, fops_fd_t fd, VOID *buf, UINTN *size);
typedef	EFI_STATUS (*fops_close_t)(VOID *intf, fops_fd_t fd);
typedef	EFI_STATUS (*fops_infosize_t)(VOID *intf, fops_fd_t fd, UINT64 *size);
typedef	EFI_STATUS (*fops_seek_t)(VOID *intf, fops_fd_t fd, UINT64 newpos);
typedef	EFI_STATUS (*fops_setdefaults_t)(VOID *intf, struct config_file *defconfs, CHAR16 *kname, UINTN maxlen, CHAR16 *devpath);
typedef	EFI_STATUS (*fops_getdefault_path_t)(CHAR16 *path, UINTN maxlen);

typedef struct {
	VOID *intf;	/* pointer to underlying interface */

	fops_open_t		open;
	fops_read_t		read;
	fops_close_t		close;
	fops_infosize_t		infosize;
	fops_seek_t		seek;
	fops_setdefaults_t	setdefaults;
	fops_getdefault_path_t	getdefault_path;

	EFI_HANDLE dev;	/* handle on device on which proto is installed */
	CHAR16 name[FILEOPS_NAME_MAXLEN];
} fileops_t;

/* 
 * used to register a new filsystem
 */
typedef INTN (*fops_fs_glue_t)(fileops_t *this, VOID *intf);
typedef EFI_STATUS (*fops_fs_install_t)(VOID);
typedef EFI_STATUS (*fops_fs_uninstall_t)(VOID);

typedef struct {
	EFI_GUID		proto;	   /* GUID of filesystem */
	fops_fs_glue_t		glue;	   /* glue routine */
	fops_fs_install_t	install;   /* to go away with real EFI drivers */
	fops_fs_uninstall_t	uninstall; /* to go away with real EFI drivers */
} fileops_fs_t;


/*
 * device description
 */
#define FILEOPS_DEVNAME_MAXLEN	16

typedef struct {
	EFI_HANDLE  		dev;
	fileops_t		*fops;
	CHAR16	    		name[FILEOPS_DEVNAME_MAXLEN];
} device_t;

extern INTN init_devices(EFI_HANDLE boot_handle);
extern INTN close_devices(VOID);
extern VOID print_devices(VOID);
extern EFI_STATUS fops_get_next_device(UINTN pidx, CHAR16 *type, UINTN maxlen, UINTN *idx, CHAR16 *name, EFI_HANDLE *dev);
extern INTN fops_split_path(CHAR16 *path, CHAR16 *dev);
extern EFI_STATUS fops_get_device_handle(CHAR16 *name, EFI_HANDLE *dev);

/*
 * device naming schemes
 *
 * Interface:
 * 	the scheme() function arguments are:
 * 		- the list of detected bootable device
 * 		- the number of entries in that table as argument
 *
 * 	There is no expected return value. If the scheme() cannot perform
 * 	its tasks, then IT MUST NOT OVERWRITE the generic naming scheme (devXXX) that
 * 	is ALWAYS installed by default. Partial modifications are possible, although
 * 	not recommended.
 */
typedef struct {
	CHAR16	*name;
	INTN	(*install_scheme)(device_t *tab, UINTN ndev);
} devname_scheme_t;

#endif /* __FILEOPS_H__ */