[tip:tools/kvm] kvm tools: Remove unnecessary S_ISBLK check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  429e1c70e2a2040d67fd191c9800ee19ea68978f
Gitweb:     http://git.kernel.org/tip/429e1c70e2a2040d67fd191c9800ee19ea68978f
Author:     Asias He <asias.hejun@xxxxxxxxx>
AuthorDate: Wed, 18 May 2011 16:19:12 +0800
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Wed, 18 May 2011 21:29:02 +0300

kvm tools: Remove unnecessary S_ISBLK check

Let's do it in blkdev__probe.

Signed-off-by: Asias He <asias.hejun@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/disk/core.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/kvm/disk/core.c b/tools/kvm/disk/core.c
index a0ccdc5..6894b17 100644
--- a/tools/kvm/disk/core.c
+++ b/tools/kvm/disk/core.c
@@ -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;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux