Changeset View
Changeset View
Standalone View
Standalone View
stand/common/vdisk.c
Show All 32 Lines | |||||
#include <sys/disk.h> | #include <sys/disk.h> | ||||
#include <sys/errno.h> | #include <sys/errno.h> | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <disk.h> | #include <disk.h> | ||||
static int vdisk_init(void); | static int vdisk_init(void); | ||||
static int vdisk_strategy(void *, int, daddr_t, size_t, char *, size_t *); | static int vdisk_strategy(void *, int, daddr_t, size_t, char *, size_t *); | ||||
static int vdisk_open(struct open_file *, ...); | static int vdisk_open(struct open_file *, struct devdesc *); | ||||
static int vdisk_close(struct open_file *); | static int vdisk_close(struct open_file *); | ||||
static int vdisk_ioctl(struct open_file *, u_long, void *); | static int vdisk_ioctl(struct open_file *, u_long, void *); | ||||
static int vdisk_print(int); | static int vdisk_print(int); | ||||
struct devsw vdisk_dev = { | struct devsw vdisk_dev = { | ||||
.dv_name = "vdisk", | .dv_name = "vdisk", | ||||
.dv_type = DEVT_DISK, | .dv_type = DEVT_DISK, | ||||
.dv_init = vdisk_init, | .dv_init = vdisk_init, | ||||
▲ Show 20 Lines • Show All 236 Lines • ▼ Show 20 Lines | vdisk_strategy(void *devdata, int rw, daddr_t blk, size_t size, | ||||
if (errno == 0 && rsize != NULL) { | if (errno == 0 && rsize != NULL) { | ||||
*rsize = rv; | *rsize = rv; | ||||
} | } | ||||
return (errno); | return (errno); | ||||
} | } | ||||
static int | static int | ||||
vdisk_open(struct open_file *f, ...) | vdisk_open(struct open_file *f, struct devdesc *dev) | ||||
tsoome: f is unused | |||||
{ | { | ||||
va_list args; | |||||
struct disk_devdesc *dev; | |||||
vdisk_info_t *vd; | vdisk_info_t *vd; | ||||
int rc = 0; | int rc = 0; | ||||
va_start(args, f); | vd = vdisk_get_info(dev); | ||||
dev = va_arg(args, struct disk_devdesc *); | |||||
va_end(args); | |||||
if (dev == NULL) | |||||
return (EINVAL); | |||||
vd = vdisk_get_info((struct devdesc *)dev); | |||||
if (vd == NULL) | if (vd == NULL) | ||||
return (EINVAL); | return (EINVAL); | ||||
if (dev->dd.d_dev->dv_type == DEVT_DISK) { | if (dev->d_dev->dv_type == DEVT_DISK) { | ||||
rc = disk_open(dev, vd->vdisk_size, vd->vdisk_sectorsz); | rc = disk_open((struct disk_devdesc *)dev, vd->vdisk_size, | ||||
vd->vdisk_sectorsz); | |||||
} | } | ||||
if (rc == 0) | if (rc == 0) | ||||
vd->vdisk_open++; | vd->vdisk_open++; | ||||
return (rc); | return (rc); | ||||
} | } | ||||
static int | static int | ||||
vdisk_close(struct open_file *f) | vdisk_close(struct open_file *f) | ||||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |
f is unused