ref: 7a464a86ffcd8466d357d22675ff2bff70d045e6
parent: 8ae635d95a0fe029ecb6b17b3dfc8b433e71fc9d
author: rodri <rgl@antares-labs.eu>
date: Sat Mar 1 12:18:28 EST 2025
add mixfs support.
--- a/volume.c
+++ b/volume.c
@@ -46,7 +46,10 @@
if((n = pread(vfd, buf, sizeof(buf)-1, 0)) <= 0)
sysfatal("pread: %r");
buf[n] = 0;
- strtok(buf, " ");
+ s = strstr(buf, ismixfs? "mix": "master");
+ if(s == nil)
+ sysfatal("unknown volume device");
+ strtok(s, " ");
s = strtok(nil, " ");
volume = strtol(s, nil, 0);
}
@@ -67,13 +70,13 @@
Point p;
double rad;
int Etimer, key, d;
- char buf[3];
+ char buf[32];
vfd = open("/dev/volume", ORDWR);
if(vfd < 0)
sysfatal("open: %r");
read(vfd, buf, sizeof buf);
- ismixfs = strncmp(buf, "mix", 3) == 0;
+ ismixfs = strstr(buf, "mix") != nil;
update();
if(initdraw(0, 0, "volume") < 0)
sysfatal("initdraw: %r");