From patchwork Mon May 17 16:45:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 100006 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4H35QrF020596 for ; Mon, 17 May 2010 03:05:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752523Ab0EQDFY (ORCPT ); Sun, 16 May 2010 23:05:24 -0400 Received: from smtp101.sbc.mail.gq1.yahoo.com ([67.195.15.60]:29472 "HELO smtp101.sbc.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752289Ab0EQDFX (ORCPT ); Sun, 16 May 2010 23:05:23 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 17 May 2010 03:05:26 +0000 (UTC) X-Greylist: delayed 400 seconds by postgrey-1.27 at vger.kernel.org; Sun, 16 May 2010 23:05:23 EDT Received: (qmail 91936 invoked from network); 17 May 2010 02:58:42 -0000 Received: from adsl-70-231-246-220.dsl.snfc21.sbcglobal.net (nab@70.231.246.220 with login) by smtp101.sbc.mail.gq1.yahoo.com with SMTP; 16 May 2010 19:58:42 -0700 PDT X-Yahoo-SMTP: fzDSGlOswBCWnIOrNw7KwwK1j9PqyNbe5PtLKiS4dDU.UNl_t6bdEZu9tTLW X-YMail-OSG: R3sWeWEVM1lHC_oFhjPnANzPDnhLndyIPUDgtbNJBnAmp3CofQyXtr1JaTZgJtNUE3cGGTCr7RggyncCpVlI6kDWrMNLWAb9PTbTAtSvEYCMpi_vtGf5aUVEF_ySoOtW1GCzw6_W1H9sM1UuV3BhnfSXA2P.YgVs0P76JqLkB3E0rIPMjhIBmRQHC0taVjOtTdfjtuSwP8D40vBPD5GwMFlRn3CQzrqLV_V_LnVr1HY7aJRhccXK5nngF_N3mEXi9iB62M5mBFq4PCcddZKCZfQWT6DUhYP2HKUAvcRJGdXsYPhd7PE3H0l96wRkKlyVbGBJdzdYdMOTmA3fMTKHS0da3mIITXnhgqOchOZ8PyNaJg-- X-Yahoo-Newman-Property: ymail-3 From: "Nicholas A. Bellinger" To: Kevin Wolf , Christoph Hellwig , Gerd Hoffmann , Hannes Reinecke , kvm-devel , qemu-devel Cc: Nicholas Bellinger Subject: [PATCH 1/2] [block]: Make find_image_format() return 'raw' BlockDriver for SG_IO devices Date: Mon, 17 May 2010 09:45:57 -0700 Message-Id: <1274114757-27954-1-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.5.6.5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/block.c b/block.c index 48305b7..f419ee6 100644 --- a/block.c +++ b/block.c @@ -332,6 +332,11 @@ static BlockDriver *find_image_format(const char *filename) ret = bdrv_file_open(&bs, filename, 0); if (ret < 0) return NULL; + + /* Return the raw BlockDriver * to scsi-generic devices */ + if (bs->sg) + return bdrv_find_format("raw"); + ret = bdrv_pread(bs, 0, buf, sizeof(buf)); bdrv_delete(bs); if (ret < 0) {