Skip to content
Snippets Groups Projects
Commit 8214b94c authored by Alessandro Rubini's avatar Alessandro Rubini
Browse files

zio-dump: check ZIO version


Signed-off-by: default avatarAlessandro Rubini <rubini@gnudd.com>
Acked-by: default avatarFederico Vaga <federico.vaga@gmail.com>
parent b789751a
No related merge requests found
......@@ -20,6 +20,7 @@ char *prgname;
void read_channel(int cfd, int dfd, FILE *log)
{
int err = 0;
struct zio_control ctrl;
int i, j;
......@@ -41,6 +42,26 @@ void read_channel(int cfd, int dfd, FILE *log)
break; /* ok */
}
/* Fail badly if the version is not the right one */
if (ctrl.major_version != ZIO_MAJOR_VERSION)
err++;
if (ZIO_MAJOR_VERSION == 0 && ctrl.minor_version != ZIO_MINOR_VERSION)
err++;
if (err) {
fprintf(stderr, "%s: kernel has zio %i.%i, "
"but I'm compiled for %i.%i\n", prgname,
ctrl.major_version, ctrl.minor_version,
ZIO_MAJOR_VERSION, ZIO_MINOR_VERSION);
exit(1);
}
if (ctrl.minor_version != ZIO_MINOR_VERSION) {
static int warned;
if (!warned++)
fprintf(stderr, "%s: warning: minor version mismatch\n",
prgname);
}
printf("Ctrl: version %i.%i, trigger %.16s, dev %.16s, "
"cset %i, chan %i\n",
ctrl.major_version, ctrl.minor_version,
......
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