Changeset View
Changeset View
Standalone View
Standalone View
head/sys/boot/efi/libefi/efipart.c
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | struct devsw efipart_dev = { | ||||
.dv_ioctl = noioctl, | .dv_ioctl = noioctl, | ||||
.dv_print = efipart_print, | .dv_print = efipart_print, | ||||
.dv_cleanup = NULL | .dv_cleanup = NULL | ||||
}; | }; | ||||
/* | /* | ||||
* info structure to support bcache | * info structure to support bcache | ||||
*/ | */ | ||||
#define MAXPDDEV 31 /* see MAXDEV in libi386.h */ | struct pdinfo { | ||||
static struct pdinfo | |||||
{ | |||||
int pd_unit; /* unit number */ | int pd_unit; /* unit number */ | ||||
int pd_open; /* reference counter */ | int pd_open; /* reference counter */ | ||||
void *pd_bcache; /* buffer cache data */ | void *pd_bcache; /* buffer cache data */ | ||||
} pdinfo [MAXPDDEV]; | }; | ||||
static struct pdinfo *pdinfo; | |||||
static int npdinfo = 0; | static int npdinfo = 0; | ||||
#define PD(dev) (pdinfo[(dev)->d_unit]) | #define PD(dev) (pdinfo[(dev)->d_unit]) | ||||
static int | static int | ||||
efipart_init(void) | efipart_init(void) | ||||
{ | { | ||||
EFI_BLOCK_IO *blkio; | EFI_BLOCK_IO *blkio; | ||||
Show All 20 Lines | efipart_init(void) | ||||
/* Filter handles to only include FreeBSD partitions. */ | /* Filter handles to only include FreeBSD partitions. */ | ||||
nin = sz / sizeof(EFI_HANDLE); | nin = sz / sizeof(EFI_HANDLE); | ||||
hout = hin + nin; | hout = hin + nin; | ||||
aliases = hout + nin; | aliases = hout + nin; | ||||
nout = 0; | nout = 0; | ||||
bzero(aliases, nin * sizeof(EFI_HANDLE)); | bzero(aliases, nin * sizeof(EFI_HANDLE)); | ||||
pdinfo = malloc(nin * sizeof(*pdinfo)); | |||||
if (pdinfo == NULL) | |||||
return (ENOMEM); | |||||
for (n = 0; n < nin; n++) { | for (n = 0; n < nin; n++) { | ||||
status = BS->HandleProtocol(hin[n], &devpath_guid, | status = BS->HandleProtocol(hin[n], &devpath_guid, | ||||
(void **)&devpath); | (void **)&devpath); | ||||
if (EFI_ERROR(status)) { | if (EFI_ERROR(status)) { | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 247 Lines • Show Last 20 Lines |