37 memset(glob, 0,
sizeof(glob_t));
39 glob->gl_pathv = (
char**) calloc(glob->gl_offs,
sizeof(
char*));
45 if (glob->gl_pathc >= glob->gl_offs) {
47 glob->gl_pathv = realloc(glob->gl_pathv,
48 glob->gl_offs *
sizeof(
char*));
50 glob->gl_pathv[glob->gl_pathc] = strdup(path);
59 for (i = 0; i < glob->gl_pathc; i += 1)
60 free(glob->gl_pathv[i]);
67 static char buff[128];
73 strncpy(buff, path,
sizeof(buff) - 1);
100 s = alloca(strlen(options) + 1);
102 for (token = strtok(s,
"|"); token != NULL; token = strtok(NULL,
"|")) {
103 colon = strstr(token,
":");
107 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)