2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
15 #include <aros/config.h>
20 char FullName
[1]; /* We need to store the full pathname */
23 struct ELFNode
*FirstELF
= NULL
;
24 static struct ELFNode
*LastELF
= (struct ELFNode
*)&FirstELF
;
26 int AddKernelFile(char *name
)
30 n
= malloc(sizeof(struct ExtELFNode
) + strlen(name
) + 1);
35 strcpy(n
->FullName
, name
);
36 #if AROS_MODULES_DEBUG
37 n
->node
.Name
= n
->FullName
;
39 n
->node
.Name
= namepart(n
->FullName
);
42 LastELF
->Next
= &n
->node
;
48 void FreeKernelList(void)
50 struct ELFNode
*n
, *n2
;
52 for (n
= FirstELF
; n
; n
= n2
)
58 /* Reset list pointers. The list can ocassionally be reused (on Android, for example) */
59 LastELF
= (struct ELFNode
*)&FirstELF
;
62 void *open_file(struct ELFNode
*n
, unsigned int *err
)
66 f
= fopen(((struct ExtELFNode
*)n
)->FullName
, "rb");
72 void close_file(void *file
)
78 * read_block interface. we want to read from files here
80 int read_block(void *file
, unsigned long offset
, void *dest
, unsigned long length
)
84 err
= fseek(file
, offset
, SEEK_SET
);
88 err
= fread(dest
, length
, 1, file
);
96 * load_block also allocates the memory
98 void *load_block(void *file
, unsigned long offset
, unsigned long length
, unsigned int *err
)
100 void *dest
= malloc(length
);
104 *err
= read_block(file
, offset
, dest
, length
);
118 void free_block(void *addr
)