From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LzstR-0000St-ED for mharc-grub-devel@gnu.org; Fri, 01 May 2009 09:35:09 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LzstP-0000R7-1F for grub-devel@gnu.org; Fri, 01 May 2009 09:35:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LzstK-0000Q7-Lk for grub-devel@gnu.org; Fri, 01 May 2009 09:35:06 -0400 Received: from [199.232.76.173] (port=54599 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LzstK-0000Q4-CB for grub-devel@gnu.org; Fri, 01 May 2009 09:35:02 -0400 Received: from mail-ew0-f162.google.com ([209.85.219.162]:64486) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LzstJ-0002Jj-Sq for grub-devel@gnu.org; Fri, 01 May 2009 09:35:02 -0400 Received: by ewy6 with SMTP id 6so2551461ewy.42 for ; Fri, 01 May 2009 06:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=WDQRxWAhuVYrxES4EhViL5FDuwfD5Ld9TGrw5ccpREA=; b=ZkLPz6gmdxcvWBTzCnIl0HdKiMy9XvlFm8VbiCbsV7FxxyzG7JniV0E3AeRg/QDp1k Up8EYPURZ+wVjAU1P+OC475sEPEYO70h2H8qSkg/UwW8jMgoyjhVifDoaM1RKqIVGckc s1pOzJPejTH7dU2OJ74uk+YyL9889CKX3meZ4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=OW0kJTkuyzNVHVI9hurM+BV/mbhHsYMJ/bp7RIxa31Cyww7h65Rkn7JoT9TDBx/FwJ f+MgwX2xvMb1b5MJY4TKTymH6yLNBh7f72uwIcM57OLXxuXkx83ma+tq18m94BWq3+Ly 5T3vicTM6xIrkt5L9lzh19jNEFryeTQ95X9QI= Received: by 10.210.81.10 with SMTP id e10mr530355ebb.46.1241184900563; Fri, 01 May 2009 06:35:00 -0700 (PDT) Received: from ?192.168.1.10? (AToulon-151-1-13-233.w83-197.abo.wanadoo.fr [83.197.70.233]) by mx.google.com with ESMTPS id 5sm5864614eyf.34.2009.05.01.06.34.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 01 May 2009 06:34:59 -0700 (PDT) Message-ID: <49FAFA82.8000003@gmail.com> Date: Fri, 01 May 2009 15:34:58 +0200 From: Michel Hermier User-Agent: Thunderbird 2.0.0.21 (X11/20090324) MIME-Version: 1.0 To: grub-devel@gnu.org Content-Type: multipart/mixed; boundary="------------070203030905090104070809" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Fwd: [PATCH] Some pxe fixes.] X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2009 13:35:07 -0000 This is a multi-part message in MIME format. --------------070203030905090104070809 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I was toying with pxe and noticed some errors in the code small errors in the code. In the file read method it is possible to return error codes instead of amount read. This patch fix that by setting the error and returning -1 instead. It also fix some coding style by removing tabs and use UNUSED macro. Michel --------------070203030905090104070809 Content-Type: text/plain; name="pxe.diff" Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="pxe.diff" Index: ChangeLog =================================================================== --- ChangeLog (révision 2154) +++ ChangeLog (copie de travail) @@ -1,3 +1,9 @@ +2009-05-01 Michel Hermier + + * fs/i386/pc/pxe.c (grub_pxefs_read): Fix returned values. + Returning error codes as grub_size_t is a bad idea. Fixing + indent style and use UNUSED macro while at it. + 2009-04-30 David S. Miller * util/hostdisk.c (device_is_wholedisk): New function. Index: fs/i386/pc/pxe.c =================================================================== --- fs/i386/pc/pxe.c (révision 2154) +++ fs/i386/pc/pxe.c (copie de travail) @@ -72,24 +72,24 @@ } static void -grub_pxe_close (grub_disk_t disk __attribute((unused))) +grub_pxe_close (grub_disk_t disk UNUSED) { } static grub_err_t -grub_pxe_read (grub_disk_t disk __attribute((unused)), - grub_disk_addr_t sector __attribute((unused)), - grub_size_t size __attribute((unused)), - char *buf __attribute((unused))) +grub_pxe_read (grub_disk_t disk UNUSED, + grub_disk_addr_t sector UNUSED, + grub_size_t size UNUSED, + char *buf UNUSED) { return GRUB_ERR_OUT_OF_RANGE; } static grub_err_t -grub_pxe_write (grub_disk_t disk __attribute((unused)), - grub_disk_addr_t sector __attribute((unused)), - grub_size_t size __attribute((unused)), - const char *buf __attribute((unused))) +grub_pxe_write (grub_disk_t disk UNUSED, + grub_disk_addr_t sector UNUSED, + grub_size_t size UNUSED, + const char *buf UNUSED) { return GRUB_ERR_OUT_OF_RANGE; } @@ -108,8 +108,8 @@ static grub_err_t grub_pxefs_dir (grub_device_t device UNUSED, const char *path UNUSED, - int (*hook) (const char *filename, - const struct grub_dirhook_info *info) UNUSED) + int (*hook) (const char *filename, + const struct grub_dirhook_info *info) UNUSED) { return GRUB_ERR_NONE; } @@ -189,8 +189,11 @@ pn = grub_divmod64 (file->offset, data->block_size, &r); if (r) - return grub_error (GRUB_ERR_BAD_FS, - "read access must be aligned to packet size"); + { + grub_error (GRUB_ERR_BAD_FS, + "read access must be aligned to packet size"); + return -1; + } if ((curr_file != file) || (data->packet_number > pn)) { @@ -206,7 +209,10 @@ o.packet_size = data->block_size; grub_pxe_call (GRUB_PXENV_TFTP_OPEN, &o); if (o.status) - return grub_error (GRUB_ERR_BAD_FS, "open fails"); + { + grub_error (GRUB_ERR_BAD_FS, "open fails"); + return -1; + } data->packet_number = 0; curr_file = file; } @@ -246,8 +252,8 @@ } static grub_err_t -grub_pxefs_label (grub_device_t device __attribute ((unused)), - char **label __attribute ((unused))) +grub_pxefs_label (grub_device_t device UNUSED, + char **label UNUSED) { *label = 0; return GRUB_ERR_NONE; --------------070203030905090104070809--