mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
Coding style fixes, from running 'indent' (trivial).
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@227 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
e0ae018002
commit
c0a20a2003
2 changed files with 37 additions and 35 deletions
29
lib/clog2.c
29
lib/clog2.c
|
@ -47,20 +47,19 @@
|
|||
|
||||
int log2(unsigned int n)
|
||||
{
|
||||
int log2 = 0;
|
||||
int log2 = 0;
|
||||
|
||||
if (n & (n-1))
|
||||
log2++;
|
||||
if (n >> 16)
|
||||
log2 += 16, n >>= 16;
|
||||
if (n >> 8)
|
||||
log2 += 8, n >>= 8;
|
||||
if (n >> 4)
|
||||
log2 += 4, n >>= 4;
|
||||
if (n >> 2)
|
||||
log2 += 2, n >>= 2;
|
||||
if (n >> 1)
|
||||
log2++;
|
||||
return log2;
|
||||
if (n & (n - 1))
|
||||
log2++;
|
||||
if (n >> 16)
|
||||
log2 += 16, n >>= 16;
|
||||
if (n >> 8)
|
||||
log2 += 8, n >>= 8;
|
||||
if (n >> 4)
|
||||
log2 += 4, n >>= 4;
|
||||
if (n >> 2)
|
||||
log2 += 2, n >>= 2;
|
||||
if (n >> 1)
|
||||
log2++;
|
||||
return log2;
|
||||
}
|
||||
|
||||
|
|
43
lib/lar.c
43
lib/lar.c
|
@ -33,29 +33,32 @@
|
|||
|
||||
int find_file(struct mem_file *archive, char *filename, struct mem_file *result)
|
||||
{
|
||||
char * walk, *fullname;
|
||||
struct lar_header * header;
|
||||
char *walk, *fullname;
|
||||
struct lar_header *header;
|
||||
|
||||
printk(BIOS_INFO, "LAR: Attempting to open '%s'.\n", filename);
|
||||
printk(BIOS_SPEW, "LAR: Start 0x%x len 0x%x\n", archive->start, archive->len);
|
||||
for (walk = archive->start; walk < (char *)archive->start +
|
||||
archive->len - 1; walk+=16) {
|
||||
if(strcmp(walk, MAGIC)!=0)
|
||||
printk(BIOS_SPEW, "LAR: Start 0x%x len 0x%x\n", archive->start,
|
||||
archive->len);
|
||||
|
||||
for (walk = archive->start;
|
||||
walk < (char *)archive->start + archive->len - 1; walk += 16) {
|
||||
if (strcmp(walk, MAGIC) != 0)
|
||||
continue;
|
||||
|
||||
header=(struct lar_header *)walk;
|
||||
fullname=walk+sizeof(struct lar_header);
|
||||
header = (struct lar_header *)walk;
|
||||
fullname = walk + sizeof(struct lar_header);
|
||||
|
||||
printk(BIOS_SPEW, "LAR: current filename is %s\n", fullname);
|
||||
// FIXME: check checksum
|
||||
|
||||
if(strcmp(fullname, filename)==0) {
|
||||
result->start=walk + ntohl(header->offset);
|
||||
result->len=ntohl(header->len);
|
||||
|
||||
if (strcmp(fullname, filename) == 0) {
|
||||
result->start = walk + ntohl(header->offset);
|
||||
result->len = ntohl(header->len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// skip file
|
||||
walk += ( ntohl(header->len) + ntohl(header->offset) -1 ) & 0xfffffff0;
|
||||
walk += (ntohl(header->len) + ntohl(header->offset) -
|
||||
1) & 0xfffffff0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -67,7 +70,8 @@ int copy_file(struct mem_file *archive, char *filename, void *where)
|
|||
|
||||
ret = find_file(archive, filename, &result);
|
||||
if (ret) {
|
||||
printk(BIOS_INFO, "LAR: copy_file: No such file '%s'\n", filename);
|
||||
printk(BIOS_INFO, "LAR: copy_file: No such file '%s'\n",
|
||||
filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -76,17 +80,16 @@ int copy_file(struct mem_file *archive, char *filename, void *where)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int run_file(struct mem_file *archive, char *filename, void *where)
|
||||
{
|
||||
int (*v)(void);
|
||||
int (*v) (void);
|
||||
|
||||
if (copy_file(archive, filename, where)){
|
||||
printk(BIOS_INFO, "LAR: Run file %s failed: ENOENT\n", filename);
|
||||
if (copy_file(archive, filename, where)) {
|
||||
printk(BIOS_INFO, "LAR: Run file %s failed: ENOENT\n",
|
||||
filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
v = where;
|
||||
return v();
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue