Commit 38c4b7ab authored by Alessandro Rubini's avatar Alessandro Rubini

lib,tools: fixed globbing for new system version

The previous "glob" expressions in user space programs didn't cover
the whole range of of naming, over the various versions of the kernel
and udev we run.

Also, remove some inclusion of <glob.h> that were not needed.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 9b8863c0
......@@ -43,9 +43,11 @@ int fdelay_init(void)
/* Look for boards in /dev: old and new pathnames: only one matches */
glob("/dev/fd-*-0-0-ctrl", 0, NULL, &glob_dev);
glob("/dev/zio/fd-*-0-0-ctrl", GLOB_APPEND, NULL, &glob_dev);
glob("/dev/zio/zio-fd-*-0-0-ctrl", GLOB_APPEND, NULL, &glob_dev);
/* And look in /sys as well */
glob("/sys/bus/zio/devices/fd-*",0 , NULL, &glob_sys);
glob("/sys/bus/zio/devices/fd-*", 0, NULL, &glob_sys);
glob("/sys/bus/zio/devices/zio-fd-*", GLOB_APPEND , NULL, &glob_sys);
assert(glob_dev.gl_pathc == glob_sys.gl_pathc);
/* Allocate as needed */
......
......@@ -13,7 +13,6 @@
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <glob.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
......
......@@ -13,7 +13,6 @@
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <glob.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
......
......@@ -164,6 +164,8 @@ int main(int argc, char **argv)
glob("/dev/fd-*-0-0-ctrl", GLOB_DOOFFS, NULL, &glob_buf);
glob("/dev/zio/fd-*-0-0-ctrl",
GLOB_DOOFFS | GLOB_APPEND, NULL, &glob_buf);
glob("/dev/zio/zio-fd-*-0-0-ctrl",
GLOB_DOOFFS | GLOB_APPEND, NULL, &glob_buf);
glob_buf.gl_pathv[0] = argv[0];
argv = glob_buf.gl_pathv;
argc = glob_buf.gl_pathc + glob_buf.gl_offs;
......
......@@ -38,6 +38,7 @@ int main(int argc, char **argv)
/* glob to find the device; use the first */
glob("/dev/fd-*-1-0-ctrl", 0, NULL, &glob_buf);
glob("/dev/zio/fd-*-1-0-ctrl", GLOB_APPEND, NULL, &glob_buf);
glob("/dev/zio/zio-fd-*-1-0-ctrl", GLOB_APPEND, NULL, &glob_buf);
if (glob_buf.gl_pathc != 1) {
fprintf(stderr, "%s: found %i devices, need 1 only\n",
......
......@@ -148,6 +148,8 @@ int main(int argc, char **argv)
glob("/dev/fd-*-0-0-ctrl", GLOB_DOOFFS, NULL, &glob_buf);
glob("/dev/zio/fd-*-0-0-ctrl",
GLOB_DOOFFS | GLOB_APPEND, NULL, &glob_buf);
glob("/dev/zio/zio-fd-*-0-0-ctrl",
GLOB_DOOFFS | GLOB_APPEND, NULL, &glob_buf);
glob_buf.gl_pathv[0] = argv[0];
argv = glob_buf.gl_pathv;
argc = glob_buf.gl_pathc + glob_buf.gl_offs;
......
......@@ -13,7 +13,6 @@
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <glob.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
......
......@@ -13,7 +13,6 @@
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <glob.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment