Changeset View
Changeset View
Standalone View
Standalone View
stand/efi/libefi/efihttp.c
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
static EFI_GUID httpsb_guid = EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID; | static EFI_GUID httpsb_guid = EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID; | ||||
static EFI_GUID ip4config2_guid = EFI_IP4_CONFIG2_PROTOCOL_GUID; | static EFI_GUID ip4config2_guid = EFI_IP4_CONFIG2_PROTOCOL_GUID; | ||||
static bool efihttp_init_done = false; | static bool efihttp_init_done = false; | ||||
static int efihttp_dev_init(void); | static int efihttp_dev_init(void); | ||||
static int efihttp_dev_strategy(void *devdata, int rw, daddr_t blk, size_t size, | static int efihttp_dev_strategy(void *devdata, int rw, daddr_t blk, size_t size, | ||||
char *buf, size_t *rsize); | char *buf, size_t *rsize); | ||||
static int efihttp_dev_open(struct open_file *f, ...); | static int efihttp_dev_open(struct open_file *f); | ||||
static int efihttp_dev_close(struct open_file *f); | static int efihttp_dev_close(struct open_file *f); | ||||
static int efihttp_fs_open(const char *path, struct open_file *f); | static int efihttp_fs_open(const char *path, struct open_file *f); | ||||
static int efihttp_fs_close(struct open_file *f); | static int efihttp_fs_close(struct open_file *f); | ||||
static int efihttp_fs_read(struct open_file *f, void *buf, size_t size, | static int efihttp_fs_read(struct open_file *f, void *buf, size_t size, | ||||
size_t *resid); | size_t *resid); | ||||
static int efihttp_fs_write(struct open_file *f, const void *buf, size_t size, | static int efihttp_fs_write(struct open_file *f, const void *buf, size_t size, | ||||
size_t *resid); | size_t *resid); | ||||
▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | |||||
efihttp_dev_strategy(void *devdata __unused, int rw __unused, | efihttp_dev_strategy(void *devdata __unused, int rw __unused, | ||||
daddr_t blk __unused, size_t size __unused, char *buf __unused, | daddr_t blk __unused, size_t size __unused, char *buf __unused, | ||||
size_t *rsize __unused) | size_t *rsize __unused) | ||||
{ | { | ||||
return (EIO); | return (EIO); | ||||
} | } | ||||
static int | static int | ||||
efihttp_dev_open(struct open_file *f, ...) | efihttp_dev_open(struct open_file *f) | ||||
tsoome: f is unused.. | |||||
{ | { | ||||
struct devdesc *dev; | |||||
EFI_HTTP_CONFIG_DATA config; | EFI_HTTP_CONFIG_DATA config; | ||||
EFI_HTTPv4_ACCESS_POINT config_access; | EFI_HTTPv4_ACCESS_POINT config_access; | ||||
DNS_DEVICE_PATH *dns; | DNS_DEVICE_PATH *dns; | ||||
EFI_DEVICE_PATH *devpath, *imgpath; | EFI_DEVICE_PATH *devpath, *imgpath; | ||||
EFI_SERVICE_BINDING_PROTOCOL *sb; | EFI_SERVICE_BINDING_PROTOCOL *sb; | ||||
IPv4_DEVICE_PATH *ipv4; | IPv4_DEVICE_PATH *ipv4; | ||||
MAC_ADDR_DEVICE_PATH *mac; | MAC_ADDR_DEVICE_PATH *mac; | ||||
URI_DEVICE_PATH *uri; | URI_DEVICE_PATH *uri; | ||||
struct devdesc *dev; | |||||
struct open_efihttp *oh; | struct open_efihttp *oh; | ||||
char *c; | char *c; | ||||
EFI_HANDLE handle; | EFI_HANDLE handle; | ||||
EFI_STATUS status; | EFI_STATUS status; | ||||
int err, len; | int err, len; | ||||
dev = f->f_devdata; | |||||
if (!efihttp_init_done) | if (!efihttp_init_done) | ||||
return (ENXIO); | return (ENXIO); | ||||
imgpath = efi_lookup_image_devpath(IH); | imgpath = efi_lookup_image_devpath(IH); | ||||
if (imgpath == NULL) | if (imgpath == NULL) | ||||
return (ENXIO); | return (ENXIO); | ||||
devpath = imgpath; | devpath = imgpath; | ||||
status = BS->LocateDevicePath(&httpsb_guid, &devpath, &handle); | status = BS->LocateDevicePath(&httpsb_guid, &devpath, &handle); | ||||
Show All 31 Lines | efihttp_dev_open(struct open_file *f) | ||||
err = setup_ipv4_config2(handle, mac, ipv4, dns); | err = setup_ipv4_config2(handle, mac, ipv4, dns); | ||||
if (err) | if (err) | ||||
return (err); | return (err); | ||||
oh = calloc(1, sizeof(struct open_efihttp)); | oh = calloc(1, sizeof(struct open_efihttp)); | ||||
if (!oh) | if (!oh) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
oh->dev_handle = handle; | oh->dev_handle = handle; | ||||
dev = (struct devdesc *)f->f_devdata; | |||||
dev->d_opendata = oh; | dev->d_opendata = oh; | ||||
status = BS->OpenProtocol(handle, &httpsb_guid, (void **)&sb, IH, NULL, | status = BS->OpenProtocol(handle, &httpsb_guid, (void **)&sb, IH, NULL, | ||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL); | EFI_OPEN_PROTOCOL_GET_PROTOCOL); | ||||
if (EFI_ERROR(status)) { | if (EFI_ERROR(status)) { | ||||
err = efi_status_to_errno(status); | err = efi_status_to_errno(status); | ||||
goto end; | goto end; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 497 Lines • Show Last 20 Lines |
f is unused..