source: bootcd/isolinux/syslinux-6.03/com32/lib/syslinux/setup_data.c

Last change on this file was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 998 bytes
RevLine 
[e16e8f2]1#include <stdlib.h>
2#include <syslinux/linux.h>
3#include <syslinux/loadfile.h>
4
5struct setup_data *setup_data_init(void)
6{
7    struct setup_data *setup_data;
8
9    setup_data = zalloc(sizeof(*setup_data));
10    if (!setup_data)
11        return NULL;
12
13    setup_data->prev = setup_data->next = setup_data;
14    return setup_data;
15}
16
17int setup_data_add(struct setup_data *head, uint32_t type,
18                   const void *data, size_t data_len)
19{
20        struct setup_data *setup_data;
21
22        setup_data = zalloc(sizeof(*setup_data));
23        if (!setup_data)
24            return -1;
25
26        setup_data->data     = data;
27        setup_data->hdr.len  = data_len;
28        setup_data->hdr.type = type;
29        setup_data->prev     = head->prev;
30        setup_data->next     = head;
31        head->prev->next     = setup_data;
32        head->prev           = setup_data;
33
34        return 0;
35}
36
37int setup_data_load(struct setup_data *head, uint32_t type,
38                    const char *filename)
39{
40        void *data;
41        size_t len;
42
43        if (loadfile(filename, &data, &len))
44                return -1;
45
46        return setup_data_add(head, type, data, len);
47}
Note: See TracBrowser for help on using the repository browser.