+static void handle_swapfiles(bool on)
+{
+ struct stat s;
+ struct mount *m;
+ struct blkid_struct_probe *pr;
+
+ vlist_for_each_element(&mounts, m, node)
+ {
+ if (m->type != TYPE_SWAP || !m->target)
+ continue;
+
+ fprintf(stderr, "swapfile: %s\n", m->target);
+
+ if (stat(m->target, &s) || !S_ISREG(s.st_mode))
+ continue;
+
+ pr = _probe_path(m->target);
+
+ if (!pr)
+ continue;
+
+ fprintf(stderr, "probe: %p\n", pr);
+
+ if (!strcmp(pr->id->name, "swap")) {
+ if (on)
+ swapon(pr->dev, m->prio);
+ else
+ swapoff(pr->dev);
+ }
+
+ free(pr);
+ }
+}
+