From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O5IS8-0000D5-GF for qemu-devel@nongnu.org; Fri, 23 Apr 2010 08:57:52 -0400 Received: from [140.186.70.92] (port=50170 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O5IS7-0000CI-0c for qemu-devel@nongnu.org; Fri, 23 Apr 2010 08:57:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O5IS4-0004po-IU for qemu-devel@nongnu.org; Fri, 23 Apr 2010 08:57:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4891) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O5IS4-0004pa-9G for qemu-devel@nongnu.org; Fri, 23 Apr 2010 08:57:48 -0400 Message-ID: <4BD1992E.8080702@redhat.com> Date: Fri, 23 Apr 2010 14:57:18 +0200 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] One more thing about block device locking References: <4BD12B10.1060304@msgid.tls.msk.ru> <20100423080025.GA1639@amd.home.annexia.org> In-Reply-To: <20100423080025.GA1639@amd.home.annexia.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Richard W.M. Jones" Cc: Michael Tokarev , qemu-devel Am 23.04.2010 10:00, schrieb Richard W.M. Jones: > On Fri, Apr 23, 2010 at 09:07:28AM +0400, Michael Tokarev wrote: >> So we'll have to either >> trial and error, or open "normally", check >> if it's a block device and re-open with that >> flag set. > > Perhaps I'm missing something, but why can't you stat(2) the name > first to see if it's a block device (ie. S_ISBLK(st_mode)) then add > the O_EXCL flag or not as appropriate? We already have two different open functions for regular files and devices (and yes, the detection uses stat). Kevin