-----Original Message----- From: Jordan Crouse [mailto:jordan.crouse@amd.com] Sent: Wednesday, May 14, 2008 5:08 PM To: Myles Watson Cc: coreboot@coreboot.org Subject: Re: libpayload: Add larfptr function
On 14/05/08 10:11 -0600, Myles Watson wrote:
-----Original Message----- From: coreboot-bounces@coreboot.org [mailto:coreboot-
bounces@coreboot.org]
On Behalf Of jordan.crouse@amd.com Sent: Tuesday, May 13, 2008 5:34 PM To: coreboot@coreboot.org Cc: Jordan Crouse Subject: [coreboot] [patch 3/5] libpayload: Add larfptr function
Add a function to get a pointer to the start of a LAR entry.
Signed-off-by: Jordan Crouse jordan.crouse@amd.com Index: libpayload/include/libpayload.h =================================================================== --- libpayload.orig/include/libpayload.h 2008-05-13
13:40:12.000000000 -
0600 +++ libpayload/include/libpayload.h 2008-05-13
15:23:18.000000000 -
0600
@@ -247,6 +247,7 @@ struct larent *readlar(struct LAR *lar); void rewindlar(struct LAR *lar); int larstat(struct LAR *lar, const char *path, struct larstat *buf); +void *larfptr(struct LAR *lar, const char *filename); struct LFILE * lfopen(struct LAR *lar, const char *filename); int lfread(void *ptr, size_t size, size_t nmemb, struct LFILE
*stream);
Index: libpayload/libc/lar.c
--- libpayload.orig/libc/lar.c 2008-05-13 13:40:12.000000000 -0600 +++ libpayload/libc/lar.c 2008-05-13 13:42:59.000000000 -0600 @@ -218,6 +218,16 @@ return 0; }
+void * larfptr(struct LAR *lar, const char *filename) +{
- struct lar_header *header = get_header_by_name(lar, filename);
- if (header == NULL)
return NULL;
- return (void *) ((u8 *) header + ntohl(header->offset));
+}
Why do we want it to return a void*?
I tend to to use void when I can because its is maliable, but I can be convinced to use u8 * or unsigned long *.
Because anything larger than u8 needs ntohl, I'd vote for u8*.
Acked-by: Myles Watson mylesgw@gmail.com
Thanks, Myles
Jordan
-- Jordan Crouse Systems Software Development Engineer Advanced Micro Devices, Inc.