};
char buf[64];
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
if (extraarg > 0) {
snprintf (buf, sizeof buf, "%d", extraarg);
char *err;
int r;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
r = command (NULL, &err, "/sbin/mkfs", "-t", fstype, device, NULL);
if (r == -1) {
char **ret = NULL;
int size = 0, alloc = 0;
- IS_DEVICE (device, NULL);
+ RESOLVE_DEVICE (device, return NULL);
r = command (&out, &err, "/sbin/tune2fs", "-l", device, NULL);
if (r == -1) {
int r;
char *err;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
r = command (NULL, &err, "/sbin/e2label", device, label, NULL);
if (r == -1) {
int r, len;
char *out, *err;
- IS_DEVICE (device, NULL);
+ RESOLVE_DEVICE (device, return NULL);
r = command (&out, &err, "/sbin/e2label", device, NULL);
if (r == -1) {
int r;
char *err;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
r = command (NULL, &err, "/sbin/tune2fs", "-U", uuid, device, NULL);
if (r == -1) {
int r;
char *out, *err, *p, *q;
- IS_DEVICE (device, NULL);
+ RESOLVE_DEVICE (device, return NULL);
/* It's not so straightforward to get the volume UUID. We have
* to use tune2fs -l and then look for a particular string in
char *err;
int r;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
r = command (NULL, &err, "/sbin/resize2fs", device, NULL);
if (r == -1) {
char *err;
int r;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
r = command (NULL, &err, "/sbin/e2fsck", "-p", "-f", device, NULL);
if (r == -1) {
char *buf;
int len;
- NEED_ROOT_OR_IS_DEVICE (path, NULL);
+ NEED_ROOT_OR_IS_DEVICE (path, return NULL);
if (strncmp (path, "/dev/", 5) == 0)
buf = (char *) path;
char *err;
int r;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
r = commandr (NULL, &err, "/sbin/fsck", "-a", "-t", fstype, device, NULL);
if (r == -1) {
NEED_ROOT (-1);
ABS_PATH (root, -1);
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
if (asprintf_nowarn (&buf, "--root-directory=%R", root) == -1) {
reply_with_perror ("asprintf");
char *err;
int r;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
r = command (NULL, &err,
"/sbin/lvm", "pvcreate", device, NULL);
/* Check they are devices and also do device name translation. */
for (i = 0; physvols[i] != NULL; ++i)
- IS_DEVICE (physvols[i], -1);
+ RESOLVE_DEVICE (physvols[i], return -1);
argc = count_strings (physvols) + 3;
argv = malloc (sizeof (char *) * (argc + 1));
int r;
char size[64];
- IS_DEVICE (logvol, -1);
+ RESOLVE_DEVICE (logvol, return -1);
snprintf (size, sizeof size, "%d", mbytes);
char *err;
int r;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
r = command (NULL, &err,
"/sbin/lvm", "lvremove", "-f", device, NULL);
char *err;
int r;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
r = command (NULL, &err,
"/sbin/lvm", "pvremove", "-ff", device, NULL);
char *err;
int r;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
r = command (NULL, &err,
"/sbin/lvm", "pvresize", device, NULL);
char *mp;
char *error;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
is_root = strcmp (mountpoint, "/") == 0;
if (strncmp (pathordevice, "/dev/", 5) == 0) {
buf = pathordevice;
- IS_DEVICE (buf, -1);
+ RESOLVE_DEVICE (buf, return -1);
} else {
buf = sysroot_path (pathordevice);
if (buf == NULL) {
int r;
const char *rw_flag;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
rw_flag = rw ? "-w" : "-r";
char *err;
int r;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
r = command (NULL, &err, "scrub", device, NULL);
if (r == -1) {
char buf[256];
int i;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
strcpy (buf, "/sbin/sfdisk");
char *out, *err;
int r;
- IS_DEVICE (device, NULL);
+ RESOLVE_DEVICE (device, return NULL);
r = command (&out, &err, "/sbin/sfdisk", flag, device, NULL);
if (r == -1) {
int
do_mkswap (char *device)
{
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
return mkswap (device, NULL, NULL);
}
int
do_mkswap_L (char *label, char *device)
{
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
return mkswap (device, "-L", label);
}
int
do_mkswap_U (char *uuid, char *device)
{
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
return mkswap (device, "-U", uuid);
}
int
do_swapon_device (char *device)
{
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
return swaponoff ("/sbin/swapon", NULL, device);
}
int
do_swapoff_device (char *device)
{
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
return swaponoff ("/sbin/swapoff", NULL, device);
}
int fd, r, is_dev;
char buf[GUESTFS_MAX_CHUNK_SIZE];
- NEED_ROOT_OR_IS_DEVICE (filename, -1);
+ NEED_ROOT_OR_IS_DEVICE (filename, return -1);
is_dev = strncmp (filename, "/dev/", 5) == 0;
int fd, i;
char buf[4096];
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
fd = open (device, O_WRONLY);
if (fd == -1) {
char *err;
int r;
- IS_DEVICE (device, -1);
+ RESOLVE_DEVICE (device, return -1);
r = command (NULL, &err, "/usr/sbin/zerofree", device, NULL);
if (r == -1) {