Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/usb/storage/umass_loader.c
Show First 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | umass_disk_open(struct open_file *f,...) | ||||
if (umass_uaa.device == NULL) | if (umass_uaa.device == NULL) | ||||
return (ENXIO); | return (ENXIO); | ||||
if (dev->d_unit != 0) | if (dev->d_unit != 0) | ||||
return (EIO); | return (EIO); | ||||
return (umass_disk_open_sub(dev)); | return (umass_disk_open_sub(dev)); | ||||
} | } | ||||
static int | static int | ||||
umass_disk_ioctl(struct open_file *f __unused, u_long cmd, void *buf) | umass_disk_ioctl(struct open_file *f, u_long cmd, void *buf) | ||||
{ | { | ||||
struct disk_devdesc *dev; | |||||
uint32_t nblock; | uint32_t nblock; | ||||
uint32_t blocksize; | uint32_t blocksize; | ||||
int rc; | |||||
dev = (struct disk_devdesc *)(f->f_devdata); | |||||
if (dev == NULL) | |||||
return (EINVAL); | |||||
rc = disk_ioctl(dev, cmd, buf); | |||||
if (rc != ENOTTY) | |||||
return (rc); | |||||
switch (cmd) { | switch (cmd) { | ||||
case DIOCGSECTORSIZE: | case DIOCGSECTORSIZE: | ||||
case DIOCGMEDIASIZE: | case DIOCGMEDIASIZE: | ||||
if (usb_msc_read_capacity(umass_uaa.device, 0, | if (usb_msc_read_capacity(umass_uaa.device, 0, | ||||
&nblock, &blocksize) != 0) | &nblock, &blocksize) != 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |