1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright (c) 2017 Rob Clark
10 #include <efi_loader.h>
17 /* GUID for file system information */
18 const efi_guid_t efi_file_system_info_guid = EFI_FILE_SYSTEM_INFO_GUID;
20 /* GUID to obtain the volume label */
21 const efi_guid_t efi_system_volume_label_id = EFI_FILE_SYSTEM_VOLUME_LABEL_ID;
24 struct efi_simple_file_system_protocol base;
25 struct efi_device_path *dp;
26 struct blk_desc *desc;
29 #define to_fs(x) container_of(x, struct file_system, base)
32 struct efi_file_handle base;
33 struct file_system *fs;
34 loff_t offset; /* current file position/cursor */
38 /* for reading a directory: */
39 struct fs_dir_stream *dirs;
40 struct fs_dirent *dent;
44 #define to_fh(x) container_of(x, struct file_handle, base)
46 static const struct efi_file_handle efi_file_handle_protocol;
48 static char *basename(struct file_handle *fh)
50 char *s = strrchr(fh->path, '/');
56 static int set_blk_dev(struct file_handle *fh)
58 return fs_set_blk_dev_with_part(fh->fs->desc, fh->fs->part);
62 * is_dir() - check if file handle points to directory
64 * We assume that set_blk_dev(fh) has been called already.
67 * Return: true if file handle points to a directory
69 static int is_dir(struct file_handle *fh)
71 struct fs_dir_stream *dirs;
73 dirs = fs_opendir(fh->path);
83 * Normalize a path which may include either back or fwd slashes,
84 * double slashes, . or .. entries in the path, etc.
86 static int sanitize_path(char *path)
90 /* backslash to slash: */
92 while ((p = strchr(p, '\\')))
95 /* handle double-slashes: */
97 while ((p = strstr(p, "//"))) {
99 memmove(p, src, strlen(src) + 1);
102 /* handle extra /.'s */
104 while ((p = strstr(p, "/."))) {
106 * You'd be tempted to do this *after* handling ".."s
107 * below to avoid having to check if "/." is start of
108 * a "/..", but that won't have the correct results..
109 * for example, "/foo/./../bar" would get resolved to
110 * "/foo/bar" if you did these two passes in the other
118 memmove(p, src, strlen(src) + 1);
121 /* handle extra /..'s: */
123 while ((p = strstr(p, "/.."))) {
128 /* find beginning of previous path entry: */
137 memmove(p, src, strlen(src) + 1);
144 * efi_create_file() - create file or directory
147 * @attributes: attributes for newly created file
148 * Returns: 0 for success
150 static int efi_create_file(struct file_handle *fh, u64 attributes)
153 void *buffer = &actwrite;
155 if (attributes & EFI_FILE_DIRECTORY)
156 return fs_mkdir(fh->path);
158 return fs_write(fh->path, map_to_sysmem(buffer), 0, 0,
163 * file_open() - open a file handle
166 * @parent: directory relative to which the file is to be opened
167 * @file_name: path of the file to be opened. '\', '.', or '..' may
168 * be used as modifiers. A leading backslash indicates an
170 * @open_mode: bit mask indicating the access mode (read, write,
172 * @attributes: attributes for newly created file
173 * Returns: handle to the opened file or NULL
175 static struct efi_file_handle *file_open(struct file_system *fs,
176 struct file_handle *parent, u16 *file_name, u64 open_mode,
179 struct file_handle *fh;
180 char f0[MAX_UTF8_PER_UTF16] = {0};
185 utf16_to_utf8((u8 *)f0, file_name, 1);
186 flen = u16_strlen(file_name);
189 /* we could have a parent, but also an absolute path: */
193 plen = strlen(parent->path) + 1;
196 /* +2 is for null and '/' */
197 fh = calloc(1, sizeof(*fh) + plen + (flen * MAX_UTF8_PER_UTF16) + 2);
199 fh->open_mode = open_mode;
200 fh->base = efi_file_handle_protocol;
208 strcpy(p, parent->path);
213 utf16_to_utf8((u8 *)p, file_name, flen);
215 if (sanitize_path(fh->path))
218 /* check if file exists: */
222 exists = fs_exists(fh->path);
223 /* fs_exists() calls fs_close(), so open file system again */
228 if (!(open_mode & EFI_FILE_MODE_CREATE) ||
229 efi_create_file(fh, attributes))
235 /* figure out if file is a directory: */
236 fh->isdir = is_dir(fh);
239 strcpy(fh->path, "");
249 static efi_status_t efi_file_open_int(struct efi_file_handle *this,
250 struct efi_file_handle **new_handle,
251 u16 *file_name, u64 open_mode,
254 struct file_handle *fh = to_fh(this);
257 /* Check parameters */
258 if (!this || !new_handle || !file_name) {
259 ret = EFI_INVALID_PARAMETER;
262 if (open_mode != EFI_FILE_MODE_READ &&
263 open_mode != (EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE) &&
264 open_mode != (EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE |
265 EFI_FILE_MODE_CREATE)) {
266 ret = EFI_INVALID_PARAMETER;
270 * The UEFI spec requires that attributes are only set in create mode.
271 * The SCT does not care about this and sets EFI_FILE_DIRECTORY in
272 * read mode. EDK2 does not check that attributes are zero if not in
275 * So here we only check attributes in create mode and do not check
276 * that they are zero otherwise.
278 if ((open_mode & EFI_FILE_MODE_CREATE) &&
279 (attributes & (EFI_FILE_READ_ONLY | ~EFI_FILE_VALID_ATTR))) {
280 ret = EFI_INVALID_PARAMETER;
285 *new_handle = file_open(fh->fs, fh, file_name, open_mode, attributes);
287 EFI_PRINT("file handle %p\n", *new_handle);
299 * This function implements the Open service of the File Protocol.
300 * See the UEFI spec for details.
302 * @this: EFI_FILE_PROTOCOL instance
303 * @new_handle: on return pointer to file handle
304 * @file_name: file name
305 * @open_mode: mode to open the file (read, read/write, create/read/write)
306 * @attributes: attributes for newly created file
308 static efi_status_t EFIAPI efi_file_open(struct efi_file_handle *this,
309 struct efi_file_handle **new_handle,
310 u16 *file_name, u64 open_mode,
315 EFI_ENTRY("%p, %p, \"%ls\", %llx, %llu", this, new_handle,
316 file_name, open_mode, attributes);
318 ret = efi_file_open_int(this, new_handle, file_name, open_mode,
321 return EFI_EXIT(ret);
325 * efi_file_open_ex() - open file asynchronously
327 * This function implements the OpenEx service of the File Protocol.
328 * See the UEFI spec for details.
330 * @this: EFI_FILE_PROTOCOL instance
331 * @new_handle: on return pointer to file handle
332 * @file_name: file name
333 * @open_mode: mode to open the file (read, read/write, create/read/write)
334 * @attributes: attributes for newly created file
335 * @token: transaction token
337 static efi_status_t EFIAPI efi_file_open_ex(struct efi_file_handle *this,
338 struct efi_file_handle **new_handle,
339 u16 *file_name, u64 open_mode,
341 struct efi_file_io_token *token)
345 EFI_ENTRY("%p, %p, \"%ls\", %llx, %llu, %p", this, new_handle,
346 file_name, open_mode, attributes, token);
349 ret = EFI_INVALID_PARAMETER;
353 ret = efi_file_open_int(this, new_handle, file_name, open_mode,
356 if (ret == EFI_SUCCESS && token->event) {
357 token->status = EFI_SUCCESS;
358 efi_signal_event(token->event);
362 return EFI_EXIT(ret);
365 static efi_status_t file_close(struct file_handle *fh)
367 fs_closedir(fh->dirs);
372 static efi_status_t EFIAPI efi_file_close(struct efi_file_handle *file)
374 struct file_handle *fh = to_fh(file);
375 EFI_ENTRY("%p", file);
376 return EFI_EXIT(file_close(fh));
379 static efi_status_t EFIAPI efi_file_delete(struct efi_file_handle *file)
381 struct file_handle *fh = to_fh(file);
382 efi_status_t ret = EFI_SUCCESS;
384 EFI_ENTRY("%p", file);
386 if (set_blk_dev(fh) || fs_unlink(fh->path))
387 ret = EFI_WARN_DELETE_FAILURE;
390 return EFI_EXIT(ret);
394 * efi_get_file_size() - determine the size of a file
397 * @file_size: pointer to receive file size
398 * Return: status code
400 static efi_status_t efi_get_file_size(struct file_handle *fh,
404 return EFI_DEVICE_ERROR;
406 if (fs_size(fh->path, file_size))
407 return EFI_DEVICE_ERROR;
412 static efi_status_t file_read(struct file_handle *fh, u64 *buffer_size,
420 ret = EFI_INVALID_PARAMETER;
424 ret = efi_get_file_size(fh, &file_size);
425 if (ret != EFI_SUCCESS)
427 if (file_size < fh->offset) {
428 ret = EFI_DEVICE_ERROR;
433 return EFI_DEVICE_ERROR;
434 if (fs_read(fh->path, map_to_sysmem(buffer), fh->offset,
435 *buffer_size, &actread))
436 return EFI_DEVICE_ERROR;
438 *buffer_size = actread;
439 fh->offset += actread;
444 static efi_status_t dir_read(struct file_handle *fh, u64 *buffer_size,
447 struct efi_file_info *info = buffer;
448 struct fs_dirent *dent;
453 return EFI_DEVICE_ERROR;
456 assert(fh->offset == 0);
457 fh->dirs = fs_opendir(fh->path);
459 return EFI_DEVICE_ERROR;
464 * So this is a bit awkward. Since fs layer is stateful and we
465 * can't rewind an entry, in the EFI_BUFFER_TOO_SMALL case below
466 * we might have to return without consuming the dent.. so we
467 * have to stash it for next call.
472 dent = fs_readdir(fh->dirs);
476 /* no more files in directory */
481 /* check buffer size: */
482 required_size = sizeof(*info) +
483 2 * (utf8_utf16_strlen(dent->name) + 1);
484 if (*buffer_size < required_size) {
485 *buffer_size = required_size;
487 return EFI_BUFFER_TOO_SMALL;
490 return EFI_INVALID_PARAMETER;
493 *buffer_size = required_size;
494 memset(info, 0, required_size);
496 info->size = required_size;
497 info->file_size = dent->size;
498 info->physical_size = dent->size;
500 if (dent->type == FS_DT_DIR)
501 info->attribute |= EFI_FILE_DIRECTORY;
503 dst = info->file_name;
504 utf8_utf16_strcpy(&dst, dent->name);
511 static efi_status_t efi_file_read_int(struct efi_file_handle *this,
512 efi_uintn_t *buffer_size, void *buffer)
514 struct file_handle *fh = to_fh(this);
515 efi_status_t ret = EFI_SUCCESS;
518 if (!this || !buffer_size || !buffer)
519 return EFI_INVALID_PARAMETER;
523 ret = dir_read(fh, &bs, buffer);
525 ret = file_read(fh, &bs, buffer);
529 *buffer_size = SIZE_MAX;
535 * efi_file_read() - read file
537 * This function implements the Read() service of the EFI_FILE_PROTOCOL.
539 * See the Unified Extensible Firmware Interface (UEFI) specification for
542 * @this: file protocol instance
543 * @buffer_size: number of bytes to read
544 * @buffer: read buffer
545 * Return: status code
547 static efi_status_t EFIAPI efi_file_read(struct efi_file_handle *this,
548 efi_uintn_t *buffer_size, void *buffer)
552 EFI_ENTRY("%p, %p, %p", this, buffer_size, buffer);
554 ret = efi_file_read_int(this, buffer_size, buffer);
556 return EFI_EXIT(ret);
560 * efi_file_read_ex() - read file asynchonously
562 * This function implements the ReadEx() service of the EFI_FILE_PROTOCOL.
564 * See the Unified Extensible Firmware Interface (UEFI) specification for
567 * @this: file protocol instance
568 * @token: transaction token
569 * Return: status code
571 static efi_status_t EFIAPI efi_file_read_ex(struct efi_file_handle *this,
572 struct efi_file_io_token *token)
576 EFI_ENTRY("%p, %p", this, token);
579 ret = EFI_INVALID_PARAMETER;
583 ret = efi_file_read_int(this, &token->buffer_size, token->buffer);
585 if (ret == EFI_SUCCESS && token->event) {
586 token->status = EFI_SUCCESS;
587 efi_signal_event(token->event);
591 return EFI_EXIT(ret);
594 static efi_status_t efi_file_write_int(struct efi_file_handle *this,
595 efi_uintn_t *buffer_size, void *buffer)
597 struct file_handle *fh = to_fh(this);
598 efi_status_t ret = EFI_SUCCESS;
601 if (!this || !buffer_size || !buffer) {
602 ret = EFI_INVALID_PARAMETER;
606 ret = EFI_UNSUPPORTED;
609 if (!(fh->open_mode & EFI_FILE_MODE_WRITE)) {
610 ret = EFI_ACCESS_DENIED;
617 if (set_blk_dev(fh)) {
618 ret = EFI_DEVICE_ERROR;
621 if (fs_write(fh->path, map_to_sysmem(buffer), fh->offset, *buffer_size,
623 ret = EFI_DEVICE_ERROR;
626 *buffer_size = actwrite;
627 fh->offset += actwrite;
634 * efi_file_write() - write to file
636 * This function implements the Write() service of the EFI_FILE_PROTOCOL.
638 * See the Unified Extensible Firmware Interface (UEFI) specification for
641 * @this: file protocol instance
642 * @buffer_size: number of bytes to write
643 * @buffer: buffer with the bytes to write
644 * Return: status code
646 static efi_status_t EFIAPI efi_file_write(struct efi_file_handle *this,
647 efi_uintn_t *buffer_size,
652 EFI_ENTRY("%p, %p, %p", this, buffer_size, buffer);
654 ret = efi_file_write_int(this, buffer_size, buffer);
656 return EFI_EXIT(ret);
660 * efi_file_write_ex() - write to file
662 * This function implements the WriteEx() service of the EFI_FILE_PROTOCOL.
664 * See the Unified Extensible Firmware Interface (UEFI) specification for
667 * @this: file protocol instance
668 * @token: transaction token
669 * Return: status code
671 static efi_status_t EFIAPI efi_file_write_ex(struct efi_file_handle *this,
672 struct efi_file_io_token *token)
676 EFI_ENTRY("%p, %p", this, token);
679 ret = EFI_INVALID_PARAMETER;
683 ret = efi_file_write_int(this, &token->buffer_size, token->buffer);
685 if (ret == EFI_SUCCESS && token->event) {
686 token->status = EFI_SUCCESS;
687 efi_signal_event(token->event);
691 return EFI_EXIT(ret);
695 * efi_file_getpos() - get current position in file
697 * This function implements the GetPosition service of the EFI file protocol.
698 * See the UEFI spec for details.
701 * @pos: pointer to file position
702 * Return: status code
704 static efi_status_t EFIAPI efi_file_getpos(struct efi_file_handle *file,
707 efi_status_t ret = EFI_SUCCESS;
708 struct file_handle *fh = to_fh(file);
710 EFI_ENTRY("%p, %p", file, pos);
713 ret = EFI_UNSUPPORTED;
719 return EFI_EXIT(ret);
723 * efi_file_setpos() - set current position in file
725 * This function implements the SetPosition service of the EFI file protocol.
726 * See the UEFI spec for details.
729 * @pos: new file position
730 * Return: status code
732 static efi_status_t EFIAPI efi_file_setpos(struct efi_file_handle *file,
735 struct file_handle *fh = to_fh(file);
736 efi_status_t ret = EFI_SUCCESS;
738 EFI_ENTRY("%p, %llu", file, pos);
742 ret = EFI_UNSUPPORTED;
745 fs_closedir(fh->dirs);
752 ret = efi_get_file_size(fh, &file_size);
753 if (ret != EFI_SUCCESS)
761 return EFI_EXIT(ret);
764 static efi_status_t EFIAPI efi_file_getinfo(struct efi_file_handle *file,
765 const efi_guid_t *info_type,
766 efi_uintn_t *buffer_size,
769 struct file_handle *fh = to_fh(file);
770 efi_status_t ret = EFI_SUCCESS;
773 EFI_ENTRY("%p, %pUl, %p, %p", file, info_type, buffer_size, buffer);
775 if (!file || !info_type || !buffer_size ||
776 (*buffer_size && !buffer)) {
777 ret = EFI_INVALID_PARAMETER;
781 if (!guidcmp(info_type, &efi_file_info_guid)) {
782 struct efi_file_info *info = buffer;
783 char *filename = basename(fh);
784 unsigned int required_size;
787 /* check buffer size: */
788 required_size = sizeof(*info) +
789 2 * (utf8_utf16_strlen(filename) + 1);
790 if (*buffer_size < required_size) {
791 *buffer_size = required_size;
792 ret = EFI_BUFFER_TOO_SMALL;
796 ret = efi_get_file_size(fh, &file_size);
797 if (ret != EFI_SUCCESS)
800 memset(info, 0, required_size);
802 info->size = required_size;
803 info->file_size = file_size;
804 info->physical_size = file_size;
807 info->attribute |= EFI_FILE_DIRECTORY;
809 dst = info->file_name;
810 utf8_utf16_strcpy(&dst, filename);
811 } else if (!guidcmp(info_type, &efi_file_system_info_guid)) {
812 struct efi_file_system_info *info = buffer;
813 struct disk_partition part;
814 efi_uintn_t required_size;
817 if (fh->fs->part >= 1)
818 r = part_get_info(fh->fs->desc, fh->fs->part, &part);
820 r = part_get_info_whole_disk(fh->fs->desc, &part);
822 ret = EFI_DEVICE_ERROR;
825 required_size = sizeof(*info) + 2;
826 if (*buffer_size < required_size) {
827 *buffer_size = required_size;
828 ret = EFI_BUFFER_TOO_SMALL;
832 memset(info, 0, required_size);
834 info->size = required_size;
836 * TODO: We cannot determine if the volume can be written to.
838 info->read_only = false;
839 info->volume_size = part.size * part.blksz;
841 * TODO: We currently have no function to determine the free
842 * space. The volume size is the best upper bound we have.
844 info->free_space = info->volume_size;
845 info->block_size = part.blksz;
847 * TODO: The volume label is not available in U-Boot.
849 info->volume_label[0] = 0;
850 } else if (!guidcmp(info_type, &efi_system_volume_label_id)) {
851 if (*buffer_size < 2) {
853 ret = EFI_BUFFER_TOO_SMALL;
858 ret = EFI_UNSUPPORTED;
862 return EFI_EXIT(ret);
865 static efi_status_t EFIAPI efi_file_setinfo(struct efi_file_handle *file,
866 const efi_guid_t *info_type,
867 efi_uintn_t buffer_size,
870 struct file_handle *fh = to_fh(file);
871 efi_status_t ret = EFI_UNSUPPORTED;
873 EFI_ENTRY("%p, %pUl, %zu, %p", file, info_type, buffer_size, buffer);
875 if (!guidcmp(info_type, &efi_file_info_guid)) {
876 struct efi_file_info *info = (struct efi_file_info *)buffer;
877 char *filename = basename(fh);
878 char *new_file_name, *pos;
881 /* The buffer will always contain a file name. */
882 if (buffer_size < sizeof(struct efi_file_info) + 2 ||
883 buffer_size < info->size) {
884 ret = EFI_BAD_BUFFER_SIZE;
887 /* We cannot change the directory attribute */
888 if (!fh->isdir != !(info->attribute & EFI_FILE_DIRECTORY)) {
889 ret = EFI_ACCESS_DENIED;
892 /* Check for renaming */
893 new_file_name = malloc(utf16_utf8_strlen(info->file_name) + 1);
894 if (!new_file_name) {
895 ret = EFI_OUT_OF_RESOURCES;
899 utf16_utf8_strcpy(&pos, info->file_name);
900 if (strcmp(new_file_name, filename)) {
901 /* TODO: we do not support renaming */
902 EFI_PRINT("Renaming not supported\n");
904 ret = EFI_ACCESS_DENIED;
908 /* Check for truncation */
909 ret = efi_get_file_size(fh, &file_size);
910 if (ret != EFI_SUCCESS)
912 if (file_size != info->file_size) {
913 /* TODO: we do not support truncation */
914 EFI_PRINT("Truncation not supported\n");
915 ret = EFI_ACCESS_DENIED;
919 * We do not care for the other attributes
920 * TODO: Support read only
924 /* TODO: We do not support changing the volume label */
925 ret = EFI_UNSUPPORTED;
928 return EFI_EXIT(ret);
932 * efi_file_flush_int() - flush file
934 * This is the internal implementation of the Flush() and FlushEx() services of
935 * the EFI_FILE_PROTOCOL.
937 * @this: file protocol instance
938 * Return: status code
940 static efi_status_t efi_file_flush_int(struct efi_file_handle *this)
942 struct file_handle *fh = to_fh(this);
945 return EFI_INVALID_PARAMETER;
947 if (!(fh->open_mode & EFI_FILE_MODE_WRITE))
948 return EFI_ACCESS_DENIED;
950 /* TODO: flush for file position after end of file */
955 * efi_file_flush() - flush file
957 * This function implements the Flush() service of the EFI_FILE_PROTOCOL.
959 * See the Unified Extensible Firmware Interface (UEFI) specification for
962 * @this: file protocol instance
963 * Return: status code
965 static efi_status_t EFIAPI efi_file_flush(struct efi_file_handle *this)
969 EFI_ENTRY("%p", this);
971 ret = efi_file_flush_int(this);
973 return EFI_EXIT(ret);
977 * efi_file_flush_ex() - flush file
979 * This function implements the FlushEx() service of the EFI_FILE_PROTOCOL.
981 * See the Unified Extensible Firmware Interface (UEFI) specification for
984 * @this: file protocol instance
985 * @token: transaction token
986 * Return: status code
988 static efi_status_t EFIAPI efi_file_flush_ex(struct efi_file_handle *this,
989 struct efi_file_io_token *token)
993 EFI_ENTRY("%p, %p", this, token);
996 ret = EFI_INVALID_PARAMETER;
1000 ret = efi_file_flush_int(this);
1002 if (ret == EFI_SUCCESS && token->event) {
1003 token->status = EFI_SUCCESS;
1004 efi_signal_event(token->event);
1008 return EFI_EXIT(ret);
1011 static const struct efi_file_handle efi_file_handle_protocol = {
1012 .rev = EFI_FILE_PROTOCOL_REVISION2,
1013 .open = efi_file_open,
1014 .close = efi_file_close,
1015 .delete = efi_file_delete,
1016 .read = efi_file_read,
1017 .write = efi_file_write,
1018 .getpos = efi_file_getpos,
1019 .setpos = efi_file_setpos,
1020 .getinfo = efi_file_getinfo,
1021 .setinfo = efi_file_setinfo,
1022 .flush = efi_file_flush,
1023 .open_ex = efi_file_open_ex,
1024 .read_ex = efi_file_read_ex,
1025 .write_ex = efi_file_write_ex,
1026 .flush_ex = efi_file_flush_ex,
1030 * efi_file_from_path() - open file via device path
1033 * @return: EFI_FILE_PROTOCOL for the file or NULL
1035 struct efi_file_handle *efi_file_from_path(struct efi_device_path *fp)
1037 struct efi_simple_file_system_protocol *v;
1038 struct efi_file_handle *f;
1041 v = efi_fs_from_path(fp);
1045 EFI_CALL(ret = v->open_volume(v, &f));
1046 if (ret != EFI_SUCCESS)
1049 /* Skip over device-path nodes before the file path. */
1050 while (fp && !EFI_DP_TYPE(fp, MEDIA_DEVICE, FILE_PATH))
1051 fp = efi_dp_next(fp);
1054 * Step through the nodes of the directory path until the actual file
1055 * node is reached which is the final node in the device path.
1058 struct efi_device_path_file_path *fdp =
1059 container_of(fp, struct efi_device_path_file_path, dp);
1060 struct efi_file_handle *f2;
1063 if (!EFI_DP_TYPE(fp, MEDIA_DEVICE, FILE_PATH)) {
1064 printf("bad file path!\n");
1069 filename = u16_strdup(fdp->str);
1072 EFI_CALL(ret = f->open(f, &f2, filename,
1073 EFI_FILE_MODE_READ, 0));
1075 if (ret != EFI_SUCCESS)
1078 fp = efi_dp_next(fp);
1080 EFI_CALL(f->close(f));
1087 static efi_status_t EFIAPI
1088 efi_open_volume(struct efi_simple_file_system_protocol *this,
1089 struct efi_file_handle **root)
1091 struct file_system *fs = to_fs(this);
1093 EFI_ENTRY("%p, %p", this, root);
1095 *root = file_open(fs, NULL, NULL, 0, 0);
1097 return EFI_EXIT(EFI_SUCCESS);
1100 struct efi_simple_file_system_protocol *
1101 efi_simple_file_system(struct blk_desc *desc, int part,
1102 struct efi_device_path *dp)
1104 struct file_system *fs;
1106 fs = calloc(1, sizeof(*fs));
1107 fs->base.rev = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION;
1108 fs->base.open_volume = efi_open_volume;