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> Acked-by: Myles Watson <mylesgw@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3337 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
@ -247,6 +247,7 @@ int closelar(struct LAR *lar);
|
|||||||
struct larent *readlar(struct LAR *lar);
|
struct larent *readlar(struct LAR *lar);
|
||||||
void rewindlar(struct LAR *lar);
|
void rewindlar(struct LAR *lar);
|
||||||
int larstat(struct LAR *lar, const char *path, struct larstat *buf);
|
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);
|
struct LFILE * lfopen(struct LAR *lar, const char *filename);
|
||||||
int lfread(void *ptr, size_t size, size_t nmemb, struct LFILE *stream);
|
int lfread(void *ptr, size_t size, size_t nmemb, struct LFILE *stream);
|
||||||
|
|
||||||
|
@ -218,6 +218,16 @@ int larstat(struct LAR *lar, const char *path, struct larstat *buf)
|
|||||||
return 0;
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
struct LFILE * lfopen(struct LAR *lar, const char *filename)
|
struct LFILE * lfopen(struct LAR *lar, const char *filename)
|
||||||
{
|
{
|
||||||
struct LFILE *file;
|
struct LFILE *file;
|
||||||
|
Reference in New Issue
Block a user