[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH libguestfs 03/23] change almost all uses: s/IS_DEVICE/RESOLVE_DEVICE/



From: Jim Meyering <meyering redhat com>

Use this command:
  git grep -l -w IS_DEVICE|xargs perl -pi -e \
    's/\b(?:IS_DEVICE)\b( \(.*?,) (.*?)\)/RESOLVE_DEVICE$1 return $2)/'
---
 daemon/blockdev.c  |    2 +-
 daemon/devsparts.c |    2 +-
 daemon/ext2.c      |   14 +++++++-------
 daemon/file.c      |    2 +-
 daemon/fsck.c      |    2 +-
 daemon/grub.c      |    2 +-
 daemon/lvm.c       |   12 ++++++------
 daemon/mount.c     |    4 ++--
 daemon/ntfs.c      |    2 +-
 daemon/scrub.c     |    2 +-
 daemon/sfdisk.c    |    4 ++--
 daemon/swap.c      |   10 +++++-----
 daemon/upload.c    |    2 +-
 daemon/zero.c      |    2 +-
 daemon/zerofree.c  |    2 +-
 15 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/daemon/blockdev.c b/daemon/blockdev.c
index 35d14bf..a5f7691 100644
--- a/daemon/blockdev.c
+++ b/daemon/blockdev.c
@@ -46,7 +46,7 @@ call_blockdev (char *device, char *switc, int extraarg, int prints)
   };
   char buf[64];

-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   if (extraarg > 0) {
     snprintf (buf, sizeof buf, "%d", extraarg);
diff --git a/daemon/devsparts.c b/daemon/devsparts.c
index e9c5e8f..c3b9756 100644
--- a/daemon/devsparts.c
+++ b/daemon/devsparts.c
@@ -193,7 +193,7 @@ do_mkfs (char *fstype, char *device)
   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) {
diff --git a/daemon/ext2.c b/daemon/ext2.c
index 0f7a66c..d2304bd 100644
--- a/daemon/ext2.c
+++ b/daemon/ext2.c
@@ -36,7 +36,7 @@ do_tune2fs_l (char *device)
   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) {
@@ -122,7 +122,7 @@ do_set_e2label (char *device, char *label)
   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) {
@@ -141,7 +141,7 @@ do_get_e2label (char *device)
   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) {
@@ -167,7 +167,7 @@ do_set_e2uuid (char *device, char *uuid)
   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) {
@@ -186,7 +186,7 @@ do_get_e2uuid (char *device)
   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
@@ -249,7 +249,7 @@ do_resize2fs (char *device)
   char *err;
   int r;

-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   r = command (NULL, &err, "/sbin/resize2fs", device, NULL);
   if (r == -1) {
@@ -268,7 +268,7 @@ do_e2fsck_f (char *device)
   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) {
diff --git a/daemon/file.c b/daemon/file.c
index cd477e5..d2ada99 100644
--- a/daemon/file.c
+++ b/daemon/file.c
@@ -391,7 +391,7 @@ do_file (char *path)
   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;
diff --git a/daemon/fsck.c b/daemon/fsck.c
index f1a9dc5..907c117 100644
--- a/daemon/fsck.c
+++ b/daemon/fsck.c
@@ -32,7 +32,7 @@ do_fsck (char *fstype, char *device)
   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) {
diff --git a/daemon/grub.c b/daemon/grub.c
index 86e812e..118771f 100644
--- a/daemon/grub.c
+++ b/daemon/grub.c
@@ -34,7 +34,7 @@ do_grub_install (char *root, char *device)

   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");
diff --git a/daemon/lvm.c b/daemon/lvm.c
index 624dcf3..8f575c4 100644
--- a/daemon/lvm.c
+++ b/daemon/lvm.c
@@ -176,7 +176,7 @@ do_pvcreate (char *device)
   char *err;
   int r;

-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   r = command (NULL, &err,
                "/sbin/lvm", "pvcreate", device, NULL);
@@ -202,7 +202,7 @@ do_vgcreate (char *volgroup, char **physvols)

   /* 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));
@@ -262,7 +262,7 @@ do_lvresize (char *logvol, int mbytes)
   int r;
   char size[64];

-  IS_DEVICE (logvol, -1);
+  RESOLVE_DEVICE (logvol, return -1);

   snprintf (size, sizeof size, "%d", mbytes);

@@ -352,7 +352,7 @@ do_lvremove (char *device)
   char *err;
   int r;

-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   r = command (NULL, &err,
                "/sbin/lvm", "lvremove", "-f", device, NULL);
@@ -396,7 +396,7 @@ do_pvremove (char *device)
   char *err;
   int r;

-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   r = command (NULL, &err,
                "/sbin/lvm", "pvremove", "-ff", device, NULL);
@@ -419,7 +419,7 @@ do_pvresize (char *device)
   char *err;
   int r;

-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   r = command (NULL, &err,
                "/sbin/lvm", "pvresize", device, NULL);
diff --git a/daemon/mount.c b/daemon/mount.c
index 9754ca9..6c30304 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -48,7 +48,7 @@ do_mount_vfs (char *options, char *vfstype,
   char *mp;
   char *error;

-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   is_root = strcmp (mountpoint, "/") == 0;

@@ -113,7 +113,7 @@ do_umount (char *pathordevice)

   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) {
diff --git a/daemon/ntfs.c b/daemon/ntfs.c
index 26c8d50..8cb4f6f 100644
--- a/daemon/ntfs.c
+++ b/daemon/ntfs.c
@@ -33,7 +33,7 @@ do_ntfs_3g_probe (int rw, char *device)
   int r;
   const char *rw_flag;

-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   rw_flag = rw ? "-w" : "-r";

diff --git a/daemon/scrub.c b/daemon/scrub.c
index 6e205a0..3c22b66 100644
--- a/daemon/scrub.c
+++ b/daemon/scrub.c
@@ -33,7 +33,7 @@ do_scrub_device (char *device)
   char *err;
   int r;

-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   r = command (NULL, &err, "scrub", device, NULL);
   if (r == -1) {
diff --git a/daemon/sfdisk.c b/daemon/sfdisk.c
index e06d0bf..693e89a 100644
--- a/daemon/sfdisk.c
+++ b/daemon/sfdisk.c
@@ -38,7 +38,7 @@ sfdisk (char *device, int n, int cyls, int heads, int sectors,
   char buf[256];
   int i;

-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   strcpy (buf, "/sbin/sfdisk");

@@ -111,7 +111,7 @@ sfdisk_flag (char *device, const char *flag)
   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) {
diff --git a/daemon/swap.c b/daemon/swap.c
index 3ebdef6..c9104e1 100644
--- a/daemon/swap.c
+++ b/daemon/swap.c
@@ -52,7 +52,7 @@ mkswap (char *device, const char *flag, const char *value)
 int
 do_mkswap (char *device)
 {
-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   return mkswap (device, NULL, NULL);
 }
@@ -60,7 +60,7 @@ do_mkswap (char *device)
 int
 do_mkswap_L (char *label, char *device)
 {
-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   return mkswap (device, "-L", label);
 }
@@ -68,7 +68,7 @@ do_mkswap_L (char *label, char *device)
 int
 do_mkswap_U (char *uuid, char *device)
 {
-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   return mkswap (device, "-U", uuid);
 }
@@ -118,7 +118,7 @@ swaponoff (const char *cmd, const char *flag, const char *value)
 int
 do_swapon_device (char *device)
 {
-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   return swaponoff ("/sbin/swapon", NULL, device);
 }
@@ -126,7 +126,7 @@ do_swapon_device (char *device)
 int
 do_swapoff_device (char *device)
 {
-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   return swaponoff ("/sbin/swapoff", NULL, device);
 }
diff --git a/daemon/upload.c b/daemon/upload.c
index 6c5f6dc..7815e23 100644
--- a/daemon/upload.c
+++ b/daemon/upload.c
@@ -93,7 +93,7 @@ do_download (char *filename)
   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;

diff --git a/daemon/zero.c b/daemon/zero.c
index 9c803d8..ba87e68 100644
--- a/daemon/zero.c
+++ b/daemon/zero.c
@@ -33,7 +33,7 @@ do_zero (char *device)
   int fd, i;
   char buf[4096];

-  IS_DEVICE (device, -1);
+  RESOLVE_DEVICE (device, return -1);

   fd = open (device, O_WRONLY);
   if (fd == -1) {
diff --git a/daemon/zerofree.c b/daemon/zerofree.c
index 8000bb3..27ef692 100644
--- a/daemon/zerofree.c
+++ b/daemon/zerofree.c
@@ -33,7 +33,7 @@ do_zerofree (char *device)
   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) {
-- 
1.6.4.337.g5420e


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]