PERFORCE change 108939 for review
Marcel Moolenaar
marcel at FreeBSD.org
Wed Nov 1 19:45:16 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=108939
Change 108939 by marcel at marcel_cluster on 2006/11/01 19:44:13
Export efi_status_to_errno(). It's too useful to leep it
as a static function in efifs.c.
Affected files ...
.. //depot/projects/ia64/sys/boot/efi/include/efilib.h#8 edit
.. //depot/projects/ia64/sys/boot/efi/libefi/Makefile#14 edit
.. //depot/projects/ia64/sys/boot/efi/libefi/efifs.c#14 edit
.. //depot/projects/ia64/sys/boot/efi/libefi/errno.c#1 add
Differences ...
==== //depot/projects/ia64/sys/boot/efi/include/efilib.h#8 (text+ko) ====
@@ -37,14 +37,14 @@
extern struct devsw efifs_dev;
extern struct fs_ops efifs_fsops;
+extern struct devsw efinet_dev;
extern struct netif_driver efinetif;
void *efi_get_table(EFI_GUID *tbl);
void efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table);
+int efi_status_to_errno(EFI_STATUS);
time_t efi_time(EFI_TIME *);
-EFI_PHYSICAL_ADDRESS efimd_va2pa(EFI_VIRTUAL_ADDRESS);
-
EFI_STATUS main(int argc, CHAR16 *argv[]);
void exit(EFI_STATUS status);
==== //depot/projects/ia64/sys/boot/efi/libefi/Makefile#14 (text+ko) ====
@@ -3,7 +3,7 @@
LIB= efi
INTERNALLIB=
-SRCS= delay.c efi_console.c efifs.c efinet.c libefi.c module.c time.c
+SRCS= delay.c efi_console.c efifs.c efinet.c errno.c libefi.c module.c time.c
CFLAGS+= -I${.CURDIR}/../include
CFLAGS+= -I${.CURDIR}/../include/${MACHINE_ARCH:S/amd64/i386/}
==== //depot/projects/ia64/sys/boot/efi/libefi/efifs.c#14 (text+ko) ====
@@ -55,27 +55,6 @@
static int fs_handle_count;
static int
-status_to_errno(EFI_STATUS status)
-{
-
- switch (status) {
- case EFI_ACCESS_DENIED: return (EPERM);
- case EFI_BUFFER_TOO_SMALL: return (EOVERFLOW);
- case EFI_DEVICE_ERROR: return (EIO);
- case EFI_INVALID_PARAMETER: return (EINVAL);
- case EFI_MEDIA_CHANGED: return (ESTALE);
- case EFI_NO_MEDIA: return (ENXIO);
- case EFI_NOT_FOUND: return (ENOENT);
- case EFI_OUT_OF_RESOURCES: return (ENOMEM);
- case EFI_UNSUPPORTED: return (ENODEV);
- case EFI_VOLUME_CORRUPTED: return (EIO);
- case EFI_VOLUME_FULL: return (ENOSPC);
- case EFI_WRITE_PROTECTED: return (EACCES);
- }
- return (EDOOFUS);
-}
-
-static int
efifs_open(const char *upath, struct open_file *f)
{
struct devdesc *dev = f->f_devdata;
@@ -91,12 +70,12 @@
status = BS->HandleProtocol(fs_handles[dev->d_unit], &sfs_guid,
(VOID **)&fsif);
if (EFI_ERROR(status))
- return (status_to_errno(status));
+ return (efi_status_to_errno(status));
/* Get the root directory. */
status = fsif->OpenVolume(fsif, &root);
if (EFI_ERROR(status))
- return (status_to_errno(status));
+ return (efi_status_to_errno(status));
while (*upath == '/')
upath++;
@@ -134,7 +113,7 @@
free(path);
root->Close(root);
if (EFI_ERROR(status))
- return (status_to_errno(status));
+ return (efi_status_to_errno(status));
f->f_fsdata = file;
return (0);
@@ -171,7 +150,7 @@
sz = EFI_BLOCK_SIZE;
status = file->Read(file, &sz, bufp);
if (EFI_ERROR(status))
- return (status_to_errno(status));
+ return (efi_status_to_errno(status));
if (sz == 0)
break;
size -= sz;
@@ -200,7 +179,7 @@
sz = EFI_BLOCK_SIZE;
status = file->Write(file, &sz, bufp);
if (EFI_ERROR(status))
- return (status_to_errno(status));
+ return (efi_status_to_errno(status));
if (sz == 0)
break;
size -= sz;
@@ -264,7 +243,7 @@
sz = sizeof(fi);
status = file->GetInfo(file, &fi_guid, &sz, &fi);
if (EFI_ERROR(status))
- return (status_to_errno(status));
+ return (efi_status_to_errno(status));
sb->st_mode = S_IRUSR | S_IRGRP | S_IROTH;
if ((fi.info.Attribute & EFI_FILE_READ_ONLY) == 0)
@@ -299,7 +278,7 @@
sz = sizeof(fi);
status = file->Read(file, &sz, &fi);
if (EFI_ERROR(status))
- return (status_to_errno(status));
+ return (efi_status_to_errno(status));
if (sz == 0)
return (ENOENT);
@@ -356,7 +335,7 @@
}
}
if (EFI_ERROR(status))
- return (status_to_errno(status));
+ return (efi_status_to_errno(status));
fs_handle_count = sz / sizeof(EFI_HANDLE);
return (0);
}
@@ -413,7 +392,7 @@
err:
sprintf(line, "[--] error %d: unable to obtain information\n",
- status_to_errno(status));
+ efi_status_to_errno(status));
pager_output(line);
}
}
More information about the p4-projects
mailing list