Lines Matching refs:path
43 const char *path;
46 static bool clone_attach_nbd(const char *nbd, const char *path);
49 static void nbd_detach(const char *path);
51 static bool wait_for_partition(const char *path);
55 char *orig = alloca(strlen(src)+1), *p, path[50];
59 /* if path is followed by a partition, drop that for now */
64 sprintf(path, "/dev/nbd%d", i);
65 if (!file_exists(path))
71 if (!clone_attach_nbd(path, orig))
81 char path[50];
83 ret = snprintf(path, 50, "/dev/nbd%d", idx);
87 nbd_detach(path);
108 int nbd_detect(const char *path)
110 if (strncmp(path, "nbd:", 4) == 0)
118 char path[50];
130 ret = snprintf(path, 50, "/dev/nbd%dp%d", bdev->nbd_idx,
133 ret = snprintf(path, 50, "/dev/nbd%d", bdev->nbd_idx);
135 ERROR("Error setting up nbd device path");
141 if (!wait_for_partition(path))
144 ret = mount_unknown_fs(path, bdev->dest, bdev->mntopts);
163 bool requires_nbd(const char *path)
165 if (strncmp(path, "nbd:", 4) == 0)
173 const char *nbd, *path;
185 path = data->path;
231 execlp("qemu-nbd", "qemu-nbd", "-c", nbd, path, (char *)NULL);
236 static bool clone_attach_nbd(const char *nbd, const char *path)
242 data.path = path;
252 char path[100];
255 ret = snprintf(path, 100, "/sys/block/nbd%d/pid", idx);
258 return file_exists(path);
261 static void nbd_detach(const char *path)
276 execlp("qemu-nbd", "qemu-nbd", "-d", path, (char *)NULL);
300 static bool wait_for_partition(const char *path)
304 if (file_exists(path))
309 ERROR("Device %s did not show up after 5 seconds", path);