Changeset View
Changeset View
Standalone View
Standalone View
stand/efi/libefi/efipart.c
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | |||||
static int efipart_initfd(void); | static int efipart_initfd(void); | ||||
static int efipart_initcd(void); | static int efipart_initcd(void); | ||||
static int efipart_inithd(void); | static int efipart_inithd(void); | ||||
static void efipart_cdinfo_add(pdinfo_t *); | static void efipart_cdinfo_add(pdinfo_t *); | ||||
static int efipart_strategy(void *, int, daddr_t, size_t, char *, size_t *); | static int efipart_strategy(void *, int, daddr_t, size_t, char *, size_t *); | ||||
static int efipart_realstrategy(void *, int, daddr_t, size_t, char *, size_t *); | static int efipart_realstrategy(void *, int, daddr_t, size_t, char *, size_t *); | ||||
static int efipart_open(struct open_file *, ...); | static int efipart_open(struct open_file *); | ||||
static int efipart_close(struct open_file *); | static int efipart_close(struct open_file *); | ||||
static int efipart_ioctl(struct open_file *, u_long, void *); | static int efipart_ioctl(struct open_file *, u_long, void *); | ||||
static int efipart_printfd(int); | static int efipart_printfd(int); | ||||
static int efipart_printcd(int); | static int efipart_printcd(int); | ||||
static int efipart_printhd(int); | static int efipart_printhd(int); | ||||
/* EISA PNP ID's for floppy controllers */ | /* EISA PNP ID's for floppy controllers */ | ||||
▲ Show 20 Lines • Show All 811 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
efipart_printhd(int verbose) | efipart_printhd(int verbose) | ||||
{ | { | ||||
return (efipart_print_common(&efipart_hddev, &hdinfo, verbose)); | return (efipart_print_common(&efipart_hddev, &hdinfo, verbose)); | ||||
} | } | ||||
static int | static int | ||||
efipart_open(struct open_file *f, ...) | efipart_open(struct open_file *f) | ||||
tsoome: f is unused | |||||
{ | { | ||||
va_list args; | struct devdesc *dev; | ||||
struct disk_devdesc *dev; | |||||
pdinfo_t *pd; | pdinfo_t *pd; | ||||
EFI_BLOCK_IO *blkio; | EFI_BLOCK_IO *blkio; | ||||
EFI_STATUS status; | EFI_STATUS status; | ||||
va_start(args, f); | dev = f->f_devdata; | ||||
dev = va_arg(args, struct disk_devdesc *); | pd = efiblk_get_pdinfo(dev); | ||||
va_end(args); | |||||
if (dev == NULL) | |||||
return (EINVAL); | |||||
pd = efiblk_get_pdinfo((struct devdesc *)dev); | |||||
if (pd == NULL) | if (pd == NULL) | ||||
return (EIO); | return (EIO); | ||||
if (pd->pd_blkio == NULL) { | if (pd->pd_blkio == NULL) { | ||||
status = OpenProtocolByHandle(pd->pd_handle, &blkio_guid, | status = OpenProtocolByHandle(pd->pd_handle, &blkio_guid, | ||||
(void **)&pd->pd_blkio); | (void **)&pd->pd_blkio); | ||||
if (EFI_ERROR(status)) | if (EFI_ERROR(status)) | ||||
return (efi_status_to_errno(status)); | return (efi_status_to_errno(status)); | ||||
} | } | ||||
blkio = pd->pd_blkio; | blkio = pd->pd_blkio; | ||||
if (!blkio->Media->MediaPresent) | if (!blkio->Media->MediaPresent) | ||||
return (EAGAIN); | return (EAGAIN); | ||||
pd->pd_open++; | pd->pd_open++; | ||||
if (pd->pd_bcache == NULL) | if (pd->pd_bcache == NULL) | ||||
pd->pd_bcache = bcache_allocate(); | pd->pd_bcache = bcache_allocate(); | ||||
if (dev->dd.d_dev->dv_type == DEVT_DISK) { | if (dev->d_dev->dv_type == DEVT_DISK) { | ||||
int rc; | int rc; | ||||
rc = disk_open(dev, | rc = disk_open((struct disk_devdesc *)dev, | ||||
blkio->Media->BlockSize * (blkio->Media->LastBlock + 1), | blkio->Media->BlockSize * (blkio->Media->LastBlock + 1), | ||||
blkio->Media->BlockSize); | blkio->Media->BlockSize); | ||||
if (rc != 0) { | if (rc != 0) { | ||||
pd->pd_open--; | pd->pd_open--; | ||||
if (pd->pd_open == 0) { | if (pd->pd_open == 0) { | ||||
pd->pd_blkio = NULL; | pd->pd_blkio = NULL; | ||||
bcache_free(pd->pd_bcache); | bcache_free(pd->pd_bcache); | ||||
pd->pd_bcache = NULL; | pd->pd_bcache = NULL; | ||||
▲ Show 20 Lines • Show All 325 Lines • Show Last 20 Lines |
f is unused