]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Remove unnecessary S_ISBLK check
authorAsias He <asias.hejun@gmail.com>
Wed, 18 May 2011 08:19:12 +0000 (16:19 +0800)
committerPekka Enberg <penberg@kernel.org>
Wed, 18 May 2011 18:29:02 +0000 (21:29 +0300)
Let's do it in blkdev__probe.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/disk/core.c

index a0ccdc526b6adc20bf9a8d3f43517ba177f02fdb..6894b177a73c66f164abb123cb02071a26448409 100644 (file)
@@ -34,18 +34,22 @@ struct disk_image *disk_image__open(const char *filename, bool readonly)
        if (stat(filename, &st) < 0)
                return NULL;
 
-       if (S_ISBLK(st.st_mode))
-               return blkdev__probe(filename, &st);
+       /* blk device ?*/
+       disk            = blkdev__probe(filename, &st);
+       if (disk)
+               return disk;
 
        fd              = open(filename, readonly ? O_RDONLY : O_RDWR);
        if (fd < 0)
                return NULL;
 
-       disk = qcow_probe(fd, readonly);
+       /* qcow image ?*/
+       disk            = qcow_probe(fd, readonly);
        if (disk)
                return disk;
 
-       disk = raw_image__probe(fd, &st, readonly);
+       /* raw image ?*/
+       disk            = raw_image__probe(fd, &st, readonly);
        if (disk)
                return disk;