Changeset View
Changeset View
Standalone View
Standalone View
stand/libofw/ofw_disk.c
Show All 39 Lines | |||||
#include <sys/disk.h> | #include <sys/disk.h> | ||||
#include "bootstrap.h" | #include "bootstrap.h" | ||||
#include "libofw.h" | #include "libofw.h" | ||||
static int ofwd_init(void); | static int ofwd_init(void); | ||||
static int ofwd_strategy(void *devdata, int flag, daddr_t dblk, | static int ofwd_strategy(void *devdata, int flag, daddr_t dblk, | ||||
size_t size, char *buf, size_t *rsize); | size_t size, char *buf, size_t *rsize); | ||||
static int ofwd_open(struct open_file *f, ...); | static int ofwd_open(struct open_file *f, struct devdesc *d); | ||||
static int ofwd_close(struct open_file *f); | static int ofwd_close(struct open_file *f); | ||||
static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data); | static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data); | ||||
static int ofwd_print(int verbose); | static int ofwd_print(int verbose); | ||||
struct devsw ofwdisk = { | struct devsw ofwdisk = { | ||||
"block", | "block", | ||||
DEVT_DISK, | DEVT_DISK, | ||||
ofwd_init, | ofwd_init, | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | do { | ||||
if (n < 0 && n != -2) | if (n < 0 && n != -2) | ||||
return (EIO); | return (EIO); | ||||
} while (n == -2); | } while (n == -2); | ||||
*rsize = size; | *rsize = size; | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
ofwd_open(struct open_file *f, ...) | ofwd_open(struct open_file *f, struct devdesc *d) | ||||
tsoome: f is __unused | |||||
{ | { | ||||
struct ofw_devdesc *dp; | struct ofw_devdesc *dp; | ||||
va_list vl; | |||||
va_start(vl, f); | dp = (struct ofw_devdesc *)d; | ||||
Not Done Inline Actionssimilar comments about an assert here, which is why a wrapper to get the devdesc from f might be useful to have that assert buried in... But more just idle thoughts than a request for you to change this already longer than ideal size patch imp: similar comments about an assert here, which is why a wrapper to get the devdesc from f might… | |||||
Done Inline ActionsThe problem with a macro for that in particular is that we can only rely on f->f_devdata being the devdesc during dv_open(). Most drivers won't replace it with their own devdata, but one or two off in efi/ land will. It's probably OK, it just needs a bit of care. kevans: The problem with a macro for that in particular is that we can only rely on `f->f_devdata`… | |||||
dp = va_arg(vl, struct ofw_devdesc *); | |||||
va_end(vl); | |||||
if (dp != kdp) { | if (dp != kdp) { | ||||
if (kdp != NULL) { | if (kdp != NULL) { | ||||
OF_close(kdp->d_handle); | OF_close(kdp->d_handle); | ||||
kdp = NULL; | kdp = NULL; | ||||
} | } | ||||
if ((dp->d_handle = OF_open(dp->d_path)) == -1) { | if ((dp->d_handle = OF_open(dp->d_path)) == -1) { | ||||
printf("%s: Could not open %s\n", __func__, | printf("%s: Could not open %s\n", __func__, | ||||
dp->d_path); | dp->d_path); | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |
f is __unused