LICK
 All Data Structures Files Functions Variables Enumerations Enumerator
distro.h
Go to the documentation of this file.
1 
6 // TODO: more distributions
7 
8 #pragma once
9 
10 #include "llist.h"
11 
15 typedef enum {
16  DISTRO_PUPPY = 1,
17  DISTRO_FATDOG = 2,
18 } distro_e;
19 
23 typedef struct {
25  char *name;
27  char *kernel;
29  char *initrd;
31  char *options;
33  char *full_text;
35 
36 typedef node_t *(*distro_info_f)(node_t *files, const char *dst,
37  const char *name); // TODO: menu type
38 typedef int (*distro_filter_f)(const char *f);
39 
43 typedef struct {
47  const char *key;
49  const char *name;
51  distro_info_f info;
53  distro_filter_f filter;
54 } distro_t;
55 
73 distro_t *get_distro_by_key(const char *key);
74 
78 void free_distro(distro_t *d);
82 void free_distro_list(node_t *n);
97 char *menu_path(char *path);
const char * key
a string identifier
Definition: distro.h:47
distro_e id
a numeric identifier
Definition: distro.h:45
A linked list node.
Definition: llist.h:19
void free_distro_info_list(node_t *n)
Free all distro_info_t in a list.
Definition: distro.c:60
char * initrd
the path to the initrd
Definition: distro.h:29
char * name
a human-readable name
Definition: distro.h:25
node_t * get_all_distros()
Get all distributions.
Definition: distro.c:10
char * menu_path(char *path)
converts path to a grub-friendly path
Definition: distro.c:64
Information about a distribution.
Definition: distro.h:43
distro_t * get_distro_by_key(const char *key)
Get a distro_t from its string identifier.
Definition: distro.c:31
distro_info_f info
hook for getting menu entry information
Definition: distro.h:51
char * options
options to pass to the kernel
Definition: distro.h:31
Information taken from a list of files.
Definition: distro.h:23
distro_filter_f filter
hook for filtering files
Definition: distro.h:53
char * kernel
the path to the kernel
Definition: distro.h:27
void free_distro(distro_t *d)
Free a distro_t and all resources associated with it.
Definition: distro.c:40
char * full_text
if a more advanced setup is needed, put the entire menu section here
Definition: distro.h:33
A linked list library.
const char * name
a human-readable name
Definition: distro.h:49
distro_t * get_distro(distro_e distro)
Get a distro_t from its numberic id.
Definition: distro.c:20
distro_e
Distribuion IDs.
Definition: distro.h:15
void free_distro_info(distro_info_t *d)
Free a distro_info_t and all resources associated with it.
Definition: distro.c:48
void free_distro_list(node_t *n)
Free all distro_t in a list.
Definition: distro.c:44