39 static char buff[128];
45 strncpy(buff, path,
sizeof(buff) - 1);
72 if (options == NULL || strlen(options) == 0)
74 s = alloca(strlen(options) + 1);
76 for (token = strtok(s,
"|"); token != NULL; token = strtok(NULL,
"|")) {
77 colon = strstr(token,
":");
81 found = sscanf(token,
OPTION_FMT, option.key, option.value);
Argument for DRV_SET_OPTION.
int default_close(void)
For now, a placeholder.
#define DRV_ERR_NOT_IMPLEMENTED
drvctl definitions
int fd
Set by the driver after init().
const struct driver *const curr_driver
Read-only access to drv for client code.
Interface to the userspace drivers.
const char *const OPTION_FMT
sscanf format to parse option_t.
#define DRV_ERR_BAD_OPTION
drvctl error: cmd is bad
logchannel_t
Log channels used to filter messages.
struct driver drv
The global driver data that drivers etc are accessing.
int default_drvctl(unsigned int fd, void *arg)
Return DRV_ERR_NOTIMPLEMENTED.
The data the driver exports i.
int drv_handle_options(const char *options)
Parse an option string "key:value;key:value..." and invoke drvctl DRV_SET_OPTION as appropriate...
int(*const drvctl_func)(unsigned int cmd, void *arg)
Generic driver control function with semantics as defined by driver Returns 0 on success, else a positive error code.
int default_open(const char *path)
Stores path in drv.device if non-null.
#define DRVCTL_SET_OPTION
Drvctl cmd: Set driver options.
int get_server_version(void)
Return numeric server version, m.v.r => 10000 * m + 100 * v + r.
const char * device
Name of the device (string).
#define log_info(fmt,...)
Log an info message.