diff --git a/dongle.c b/dongle.c index 45aebbb5c253bce756f76b03315a596e8e8569db..a4b238a709b4f6cb8d3f799429f17eeded76e219 100644 --- a/dongle.c +++ b/dongle.c @@ -8,7 +8,7 @@ struct ubus_context *ctx; int debug; -struct uloop_timeout timeout = { .cb = status }; +struct uloop_timeout timeout = { .cb = devices_status }; static struct option long_options[] = { {"debug", required_argument, NULL, 'd'}, diff --git a/dongle_infrastructure.c b/dongle_infrastructure.c index 78fc8d1f07bda05004cd567e87a807ffbe90f85d..4508b3e4341b5a1957eb30ad05e1dd44a396a0fe 100644 --- a/dongle_infrastructure.c +++ b/dongle_infrastructure.c @@ -58,10 +58,9 @@ int add_device(char *name, char *ip) { struct device *dev; - /* Either do this here, or send an ENUM {FIND, FIND_INCREMENT} flag to search? */ dev = search_list(name); if (dev) { - dev->current_pass = true; + dev->present = true; goto fail; } dev = malloc(sizeof(struct device)); @@ -71,7 +70,7 @@ int add_device(char *name, char *ip) goto fail; } - dev->current_pass = true; + dev->present = true; dev->name = name; dev->ip = ip; list_add(&dev->list, &devices); @@ -188,7 +187,7 @@ int get_devices(void) } while ((de = readdir(dr)) != NULL) { - if(strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0) + if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0) continue; if (fstatat(dirfd(dr), de->d_name, &st, 0) < 0) { diff --git a/dongle_infrastructure.h b/dongle_infrastructure.h index 3fd022ed2f46268351e7a37b38db46b67ea376b0..e7e2cc14784a6f4a27cde4757dfb8afa30f8523d 100644 --- a/dongle_infrastructure.h +++ b/dongle_infrastructure.h @@ -12,9 +12,9 @@ struct device { int expose_infrastructure_object(struct ubus_context *ctx); int get_devices(void); -int status(struct uloop_timeout *t); +int devices_status(struct uloop_timeout *t); char *get_device_ip(char *device_name); -int find_missing_devices(void); +int tag_missing_devices(void); int add_device(char *name, char *ip); int delete_device_by_name(char *name); int delete_device_by_obj(struct device *dev);