36 memset(glob, 0,
sizeof(glob_t));
38 glob->gl_pathv = (
char**) calloc(glob->gl_offs,
sizeof(
char*));
44 if (glob->gl_pathc >= glob->gl_offs) {
46 glob->gl_pathv = realloc(glob->gl_pathv,
47 glob->gl_offs *
sizeof(
char*));
49 glob->gl_pathv[glob->gl_pathc] = strdup(path);
58 for (i = 0; i < glob->gl_pathc; i += 1)
59 free(glob->gl_pathv[i]);
66 static char buff[128];
72 strncpy(buff, path,
sizeof(buff) - 1);
99 s = alloca(strlen(options) + 1);
101 for (token = strtok(s,
"|"); token != NULL; token = strtok(NULL,
"|")) {
102 colon = strstr(token,
":");
106 found = sscanf(token,
OPTION_FMT, option.key, option.value);
#define DRV_ERR_NOT_IMPLEMENTED
const struct driver *const curr_driver
const int GLOB_CHUNK_SIZE
Interface to the userspace drivers.
const char *const OPTION_FMT
#define DRV_ERR_BAD_OPTION
void glob_t_init(glob_t *glob)
int default_drvctl(unsigned int fd, void *arg)
void glob_t_add_path(glob_t *glob, const char *path)
int drv_handle_options(const char *options)
int(*const drvctl_func)(unsigned int cmd, void *arg)
int default_open(const char *path)
#define DRVCTL_SET_OPTION
#define log_info(fmt,...)
void glob_t_free(glob_t *glob)