From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NaV24-00032j-HS for qemu-devel@nongnu.org; Thu, 28 Jan 2010 09:07:40 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NaV20-00030k-Jp for qemu-devel@nongnu.org; Thu, 28 Jan 2010 09:07:40 -0500 Received: from [199.232.76.173] (port=44065 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NaV20-00030e-Eq for qemu-devel@nongnu.org; Thu, 28 Jan 2010 09:07:36 -0500 Received: from e35.co.us.ibm.com ([32.97.110.153]:51688) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NaV1z-00022Y-P3 for qemu-devel@nongnu.org; Thu, 28 Jan 2010 09:07:36 -0500 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e35.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id o0SDrVlo014125 for ; Thu, 28 Jan 2010 06:53:31 -0700 Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o0SE7M8n080844 for ; Thu, 28 Jan 2010 07:07:25 -0700 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o0SE7ITp002361 for ; Thu, 28 Jan 2010 07:07:18 -0700 Message-ID: <4B619A14.3020807@linux.vnet.ibm.com> Date: Thu, 28 Jan 2010 08:07:16 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH v2 2/2] block: kill BDRV_O_CREAT References: <20100120171342.GB8811@lst.de> <20100128124415.GB32288@lst.de> In-Reply-To: <20100128124415.GB32288@lst.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: qemu-devel@nongnu.org On 01/28/2010 06:44 AM, Christoph Hellwig wrote: > Anthony, any reason you didn't pick this one up? Is the -C option > important enough to reimplement is using bdrv_create? > I did. See below. commit 9a2d77ad0dd6b3e93669543b846a75c02878eba7 Author: Christoph Hellwig Date: Wed Jan 20 18:13:42 2010 +0100 block: kill BDRV_O_CREAT The BDRV_O_CREAT option is unused inside qemu and partially duplicates the bdrv_create method. Remove it, and the -C option to qemu-io which isn't used in qemu-iotests anyway. Signed-off-by: Christoph Hellwig Signed-off-by: Anthony Liguori Regards, Anthony Liguori > On Wed, Jan 20, 2010 at 06:13:42PM +0100, Christoph Hellwig wrote: > >> The BDRV_O_CREAT option is unused inside qemu and partially duplicates >> the bdrv_create method. Remove it, and the -C option to qemu-io which >> isn't used in qemu-iotests anyway. >> >> Signed-off-by: Christoph Hellwig >> >> Index: qemu/block.h >> =================================================================== >> --- qemu.orig/block.h 2010-01-20 17:59:51.890004764 +0100 >> +++ qemu/block.h 2010-01-20 18:10:42.077256041 +0100 >> @@ -28,7 +28,6 @@ typedef struct QEMUSnapshotInfo { >> } QEMUSnapshotInfo; >> >> #define BDRV_O_RDWR 0x0002 >> -#define BDRV_O_CREAT 0x0004 /* create an empty file */ >> #define BDRV_O_SNAPSHOT 0x0008 /* open the file read only and save writes in a snapshot */ >> #define BDRV_O_FILE 0x0010 /* open as a raw file (do not try to >> use a disk image format on top of >> Index: qemu/block/nbd.c >> =================================================================== >> --- qemu.orig/block/nbd.c 2010-01-20 17:43:11.456004048 +0100 >> +++ qemu/block/nbd.c 2010-01-20 18:09:38.781003541 +0100 >> @@ -49,9 +49,6 @@ static int nbd_open(BlockDriverState *bs >> size_t blocksize; >> int ret; >> >> - if ((flags& BDRV_O_CREAT)) >> - return -EINVAL; >> - >> if (!strstart(filename, "nbd:",&host)) >> return -EINVAL; >> >> Index: qemu/block/raw-posix.c >> =================================================================== >> --- qemu.orig/block/raw-posix.c 2010-01-20 17:43:11.463004312 +0100 >> +++ qemu/block/raw-posix.c 2010-01-20 18:09:38.782004157 +0100 >> @@ -205,13 +205,9 @@ out_close: >> static int raw_open(BlockDriverState *bs, const char *filename, int flags) >> { >> BDRVRawState *s = bs->opaque; >> - int open_flags = 0; >> >> s->type = FTYPE_FILE; >> - if (flags& BDRV_O_CREAT) >> - open_flags = O_CREAT | O_TRUNC; >> - >> - return raw_open_common(bs, filename, flags, open_flags); >> + return raw_open_common(bs, filename, flags, 0); >> } >> >> /* XXX: use host sector size if necessary with: >> Index: qemu/block/raw-win32.c >> =================================================================== >> --- qemu.orig/block/raw-win32.c 2010-01-20 17:43:11.471022722 +0100 >> +++ qemu/block/raw-win32.c 2010-01-20 18:09:38.782004157 +0100 >> @@ -76,7 +76,7 @@ static int set_sparse(int fd) >> static int raw_open(BlockDriverState *bs, const char *filename, int flags) >> { >> BDRVRawState *s = bs->opaque; >> - int access_flags, create_flags; >> + int access_flags; >> DWORD overlapped; >> >> s->type = FTYPE_FILE; >> @@ -86,11 +86,7 @@ static int raw_open(BlockDriverState *bs >> } else { >> access_flags = GENERIC_READ; >> } >> - if (flags& BDRV_O_CREAT) { >> - create_flags = CREATE_ALWAYS; >> - } else { >> - create_flags = OPEN_EXISTING; >> - } >> + >> overlapped = FILE_ATTRIBUTE_NORMAL; >> if ((flags& BDRV_O_NOCACHE)) >> overlapped |= FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH; >> @@ -98,7 +94,7 @@ static int raw_open(BlockDriverState *bs >> overlapped |= FILE_FLAG_WRITE_THROUGH; >> s->hfile = CreateFile(filename, access_flags, >> FILE_SHARE_READ, NULL, >> - create_flags, overlapped, NULL); >> + OPEN_EXISTING, overlapped, NULL); >> if (s->hfile == INVALID_HANDLE_VALUE) { >> int err = GetLastError(); >> >> Index: qemu/qemu-io.c >> =================================================================== >> --- qemu.orig/qemu-io.c 2010-01-20 17:43:11.478254090 +0100 >> +++ qemu/qemu-io.c 2010-01-20 18:09:38.783003935 +0100 >> @@ -1307,7 +1307,6 @@ open_help(void) >> " 'open -Cn /tmp/data' - creates/opens data file read-write and uncached\n" >> "\n" >> " Opens a file for subsequent use by all of the other qemu-io commands.\n" >> -" -C, -- create new file if it doesn't exist\n" >> " -r, -- open file read-only\n" >> " -s, -- use snapshot file\n" >> " -n, -- disable host cache\n" >> @@ -1337,7 +1336,7 @@ open_f(int argc, char **argv) >> int growable = 0; >> int c; >> >> - while ((c = getopt(argc, argv, "snCrg")) != EOF) { >> + while ((c = getopt(argc, argv, "snrg")) != EOF) { >> switch (c) { >> case 's': >> flags |= BDRV_O_SNAPSHOT; >> @@ -1345,9 +1344,6 @@ open_f(int argc, char **argv) >> case 'n': >> flags |= BDRV_O_NOCACHE; >> break; >> - case 'C': >> - flags |= BDRV_O_CREAT; >> - break; >> case 'r': >> readonly = 1; >> break; >> @@ -1395,10 +1391,9 @@ init_check_command( >> static void usage(const char *name) >> { >> printf( >> -"Usage: %s [-h] [-V] [-Crsnm] [-c cmd] ... [file]\n" >> +"Usage: %s [-h] [-V] [-rsnm] [-c cmd] ... [file]\n" >> "QEMU Disk exerciser\n" >> "\n" >> -" -C, --create create new file if it doesn't exist\n" >> " -c, --cmd command to execute\n" >> " -r, --read-only export read-only\n" >> " -s, --snapshot use snapshot file\n" >> @@ -1417,13 +1412,12 @@ int main(int argc, char **argv) >> { >> int readonly = 0; >> int growable = 0; >> - const char *sopt = "hVc:Crsnmgk"; >> + const char *sopt = "hVc:rsnmgk"; >> const struct option lopt[] = { >> { "help", 0, NULL, 'h' }, >> { "version", 0, NULL, 'V' }, >> { "offset", 1, NULL, 'o' }, >> { "cmd", 1, NULL, 'c' }, >> - { "create", 0, NULL, 'C' }, >> { "read-only", 0, NULL, 'r' }, >> { "snapshot", 0, NULL, 's' }, >> { "nocache", 0, NULL, 'n' }, >> @@ -1449,9 +1443,6 @@ int main(int argc, char **argv) >> case 'c': >> add_user_command(optarg); >> break; >> - case 'C': >> - flags |= BDRV_O_CREAT; >> - break; >> case 'r': >> readonly = 1; >> break; >> >> > ---end quoted text--- >