Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/uboot/lib/disk.c
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
#define SI(dev) (stor_info[(dev)->d_unit]) | #define SI(dev) (stor_info[(dev)->d_unit]) | ||||
static int stor_info_no = 0; | static int stor_info_no = 0; | ||||
static int stor_opendev(struct disk_devdesc *); | static int stor_opendev(struct disk_devdesc *); | ||||
static int stor_readdev(struct disk_devdesc *, daddr_t, size_t, char *); | static int stor_readdev(struct disk_devdesc *, daddr_t, size_t, char *); | ||||
/* devsw I/F */ | /* devsw I/F */ | ||||
static int stor_init(void); | static int stor_init(void); | ||||
static int stor_strategy(void *, int, daddr_t, size_t, char *, size_t *); | static int stor_strategy(void *, int, daddr_t, size_t, size_t, char *, | ||||
size_t *); | |||||
static int stor_open(struct open_file *, ...); | static int stor_open(struct open_file *, ...); | ||||
static int stor_close(struct open_file *); | static int stor_close(struct open_file *); | ||||
static int stor_ioctl(struct open_file *f, u_long cmd, void *data); | static int stor_ioctl(struct open_file *f, u_long cmd, void *data); | ||||
static void stor_print(int); | static void stor_print(int); | ||||
static void stor_cleanup(void); | static void stor_cleanup(void); | ||||
struct devsw uboot_storage = { | struct devsw uboot_storage = { | ||||
"disk", | "disk", | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | stor_cleanup(void) | ||||
for (i = 0; i < stor_info_no; i++) | for (i = 0; i < stor_info_no; i++) | ||||
if (stor_info[i].opened > 0) | if (stor_info[i].opened > 0) | ||||
ub_dev_close(stor_info[i].handle); | ub_dev_close(stor_info[i].handle); | ||||
disk_cleanup(&uboot_storage); | disk_cleanup(&uboot_storage); | ||||
} | } | ||||
static int | static int | ||||
stor_strategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, | stor_strategy(void *devdata, int rw, daddr_t blk, size_t offset, size_t size, | ||||
size_t *rsize) | char *buf, size_t *rsize) | ||||
{ | { | ||||
struct disk_devdesc *dev = (struct disk_devdesc *)devdata; | struct disk_devdesc *dev = (struct disk_devdesc *)devdata; | ||||
daddr_t bcount; | daddr_t bcount; | ||||
int err; | int err; | ||||
if (rw != F_READ) { | if (rw != F_READ) { | ||||
stor_printf("write attempt, operation not supported!\n"); | stor_printf("write attempt, operation not supported!\n"); | ||||
return (EROFS); | return (EROFS); | ||||
▲ Show 20 Lines • Show All 149 Lines • Show Last 20 Lines |