Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KOAXG-00010C-2S for qemu-devel@nongnu.org; Wed, 30 Jul 2008 08:12:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KOAXF-0000zr-7l for qemu-devel@nongnu.org; Wed, 30 Jul 2008 08:12:05 -0400 Received: from [199.232.76.173] (port=56238 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KOAXF-0000zo-4q for qemu-devel@nongnu.org; Wed, 30 Jul 2008 08:12:05 -0400 Received: from ecfrec.frec.bull.fr ([129.183.4.8]:55781) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KOAXE-00087n-Dk for qemu-devel@nongnu.org; Wed, 30 Jul 2008 08:12:04 -0400 Received: from localhost (localhost [127.0.0.1]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id 1FC541A192B for ; Wed, 30 Jul 2008 14:12:38 +0200 (CEST) Received: from ecfrec.frec.bull.fr ([127.0.0.1]) by localhost (ecfrec.frec.bull.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12332-03 for ; Wed, 30 Jul 2008 14:12:33 +0200 (CEST) Received: from cyclope.frec.bull.fr (cyclope.frec.bull.fr [129.183.4.9]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id 735101A18FB for ; Wed, 30 Jul 2008 14:12:18 +0200 (CEST) Received: from [129.183.101.63] (frecb007144.frec.bull.fr [129.183.101.63]) by cyclope.frec.bull.fr (Postfix) with ESMTP id 403B32728D for ; Wed, 30 Jul 2008 14:12:15 +0200 (CEST) From: Laurent Vivier Content-Type: multipart/mixed; boundary="=-984hdgzgtu/xY2T2HrIf" Date: Wed, 30 Jul 2008 14:11:41 +0200 Message-Id: <1217419901.3883.18.camel@frecb07144> Mime-Version: 1.0 Subject: [Qemu-devel] [PATCH] qemu-img: set encrypted disk image password Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "qemu-devel@nongnu.org" --=-984hdgzgtu/xY2T2HrIf Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable This patch modify qemu-img to ask and set a password when an encrypted disk image is created. Laurent --=20 ----------------- Laurent.Vivier@bull.net ------------------ "La perfection est atteinte non quand il ne reste rien =C3=A0 ajouter mais quand il ne reste rien =C3=A0 enlever." Saint Exup=C3=A9ry --=-984hdgzgtu/xY2T2HrIf Content-Disposition: attachment; filename=qemu-img-encrypted.patch Content-Type: text/x-patch; name=qemu-img-encrypted.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Signed-off-by: Laurent Vivier --- qemu-img.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) Index: qemu/qemu-img.c =================================================================== --- qemu.orig/qemu-img.c 2008-07-30 14:06:23.000000000 +0200 +++ qemu/qemu-img.c 2008-07-30 14:07:58.000000000 +0200 @@ -208,6 +208,7 @@ static int img_create(int argc, char **a uint64_t size; const char *p; BlockDriver *drv; + BlockDriverState *bs; flags = 0; for(;;) { @@ -237,7 +238,6 @@ static int img_create(int argc, char **a filename = argv[optind++]; size = 0; if (base_filename) { - BlockDriverState *bs; bs = bdrv_new_open(base_filename, NULL); bdrv_get_geometry(bs, &size); size *= 512; @@ -279,6 +279,9 @@ static int img_create(int argc, char **a error("Error while formatting"); } } + /* to set password */ + bs = bdrv_new_open(filename, NULL); + bdrv_delete(bs); return 0; } --=-984hdgzgtu/xY2T2HrIf--