Blob Blame History Raw
From 756e6cd77aa2fe0089f3ae66696b467d86996883 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 8 Oct 2013 10:00:33 +0100
Subject: [PATCH] blockdev: Deprecate blockdev_setbsz and make it do nothing
 (RHBZ#624334).

This call never did anything.  Don't use it.  Also I have submitted a
patch upstream to remove the corresponding option from blockdev.

See RHBZ#1002825 for an explanation of why this call was always
useless.

Thanks: Masayoshi Mizuma
(cherry picked from commit 4fc44a0157a1bcd4c618e0eb8afd7c553ed0f31d)
---
 daemon/blockdev.c    |  7 ++-----
 generator/actions.ml | 17 ++++++++++-------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/daemon/blockdev.c b/daemon/blockdev.c
index 04cede9..8a7b1a8 100644
--- a/daemon/blockdev.c
+++ b/daemon/blockdev.c
@@ -121,11 +121,8 @@ do_blockdev_getbsz (const char *device)
 int
 do_blockdev_setbsz (const char *device, int blocksize)
 {
-  if (blocksize <= 0 /* || blocksize >= what? */) {
-    reply_with_error ("blocksize must be > 0");
-    return -1;
-  }
-  return (int) call_blockdev (device, "--setbsz", blocksize, 0);
+  /* Do nothing.  See https://bugzilla.redhat.com/show_bug.cgi?id=1002825 */
+  return 0;
 }
 
 int64_t
diff --git a/generator/actions.ml b/generator/actions.ml
index 8bc37de..24f4468 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -4265,8 +4265,11 @@ This uses the L<blockdev(8)> command." };
     longdesc = "\
 This returns the block size of a device.
 
-(Note this is different from both I<size in blocks> and
-I<filesystem block size>).
+Note: this is different from both I<size in blocks> and
+I<filesystem block size>.  Also this setting is not really
+used by anything.  You should probably not use it for
+anything.  Filesystems have their own idea about what
+block size to choose.
 
 This uses the L<blockdev(8)> command." };
 
@@ -4274,14 +4277,14 @@ This uses the L<blockdev(8)> command." };
     name = "blockdev_setbsz";
     style = RErr, [Device "device"; Int "blocksize"], [];
     proc_nr = Some 61;
+    deprecated_by = Some "mkfs";
     shortdesc = "set blocksize of block device";
     longdesc = "\
-This sets the block size of a device.
-
-(Note this is different from both I<size in blocks> and
-I<filesystem block size>).
+This call does nothing and has never done anything
+because of a bug in blockdev.  B<Do not use it.>
 
-This uses the L<blockdev(8)> command." };
+If you need to set the filesystem block size, use the
+C<blocksize> option of C<guestfs_mkfs>." };
 
   { defaults with
     name = "blockdev_getsz";
-- 
1.8.3.1