From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOVh4-00059n-LU for qemu-devel@nongnu.org; Mon, 23 May 2011 10:01:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOVh3-0001Og-OW for qemu-devel@nongnu.org; Mon, 23 May 2011 10:01:14 -0400 Received: from va3ehsobe003.messaging.microsoft.com ([216.32.180.13]:50227 helo=VA3EHSOBE003.bigfish.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOVh3-0001Oc-M4 for qemu-devel@nongnu.org; Mon, 23 May 2011 10:01:13 -0400 Message-ID: <4DDA65D8.3020506@amd.com> Date: Mon, 23 May 2011 15:49:12 +0200 From: Christoph Egger MIME-Version: 1.0 References: <4DDA5442.30801@amd.com> <20110523134258.GA18354@lst.de> In-Reply-To: <20110523134258.GA18354@lst.de> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] block/raw-posix: use a character device if a block device is given List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: "qemu-devel@nongnu.org" On 05/23/11 15:42, Christoph Hellwig wrote: >> + if (lstat(filename,&sb)< 0) { >> + fprintf(stderr, "%s: stat failed: %s\n", filename, >> strerror(errno)); >> + return -errno; >> + } >> + >> + if (S_ISBLK(sb.st_mode)) >> + filename = raw_get_rawdevice(filename); > > Please move the lstat and S_ISBLK check into raw_get_rawdevice. Why? What raw_get_rawdevice() does is only relevant to block devices and this hunk makes that clear. Christoph > Also it might be worth to rename it to something like raw_normalize_devicepath. -- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85689 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632