qemu-io: Clean up openfile() after commit 2e40134
				
					
				
			Commit6db9560split off the growable case so it can use bdrv_file_open() instead of bdrv_open() then. Growable BDSes become anonymous. Weird. Commit2e40134folded bdrv_file_open() back into bdrv_open() with new flag BDRV_O_PROTOCOL. We still have two bdrv_open() calls, and growable BDSes remain anonymous. Circle back to before commit 6db9560: just one call, not anonymous. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
		
							parent
							
								
									0d4cc3e715
								
							
						
					
					
						commit
						dbb651c46c
					
				
							
								
								
									
										36
									
								
								qemu-io.c
								
								
								
								
							
							
						
						
									
										36
									
								
								qemu-io.c
								
								
								
								
							| 
						 | 
				
			
			@ -58,30 +58,20 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
 | 
			
		|||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (growable) {
 | 
			
		||||
        if (bdrv_open(&qemuio_bs, name, NULL, opts, flags | BDRV_O_PROTOCOL,
 | 
			
		||||
                      NULL, &local_err))
 | 
			
		||||
        {
 | 
			
		||||
            fprintf(stderr, "%s: can't open%s%s: %s\n", progname,
 | 
			
		||||
                    name ? " device " : "", name ?: "",
 | 
			
		||||
                    error_get_pretty(local_err));
 | 
			
		||||
            error_free(local_err);
 | 
			
		||||
            return 1;
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        qemuio_bs = bdrv_new("hda", &error_abort);
 | 
			
		||||
    qemuio_bs = bdrv_new("hda", &error_abort);
 | 
			
		||||
 | 
			
		||||
        if (bdrv_open(&qemuio_bs, name, NULL, opts, flags, NULL, &local_err)
 | 
			
		||||
            < 0)
 | 
			
		||||
        {
 | 
			
		||||
            fprintf(stderr, "%s: can't open%s%s: %s\n", progname,
 | 
			
		||||
                    name ? " device " : "", name ?: "",
 | 
			
		||||
                    error_get_pretty(local_err));
 | 
			
		||||
            error_free(local_err);
 | 
			
		||||
            bdrv_unref(qemuio_bs);
 | 
			
		||||
            qemuio_bs = NULL;
 | 
			
		||||
            return 1;
 | 
			
		||||
        }
 | 
			
		||||
    if (growable) {
 | 
			
		||||
        flags |= BDRV_O_PROTOCOL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (bdrv_open(&qemuio_bs, name, NULL, opts, flags, NULL, &local_err) < 0) {
 | 
			
		||||
        fprintf(stderr, "%s: can't open%s%s: %s\n", progname,
 | 
			
		||||
                name ? " device " : "", name ?: "",
 | 
			
		||||
                error_get_pretty(local_err));
 | 
			
		||||
        error_free(local_err);
 | 
			
		||||
        bdrv_unref(qemuio_bs);
 | 
			
		||||
        qemuio_bs = NULL;
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue