Remove prio_list.

* include/grub/list.h (grub_prio_list): Removed.
	(GRUB_PRIO_LIST_PRIO_MASK): Removed. All users switched to
	GRUB_COMMAND_PRIO_MASK.
	(GRUB_PRIO_LIST_FLAG_ACTIVE): Removed. All users switched to
	GRUB_COMMAND_FLAG_ACTIVE.
	(grub_prio_list_insert): Removed.
	(grub_prio_list_remove): Likewise.
	(GRUB_AS_PRIO_LIST): Likewise.
	(GRUB_AS_PRIO_LIST_P): Likewise.
	* include/grub/command.h (GRUB_COMMAND_PRIO_MASK): New define.
	(GRUB_COMMAND_FLAG_ACTIVE): Likewise.
	* grub-core/kern/list.c (grub_prio_list_insert): Remove.
	* grub-core/kern/command.c (grub_register_command_prio): Inline
	the prio_list code.
	(grub_unregister_command): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-26 22:49:24 +01:00
commit eece3349ea
8 changed files with 61 additions and 83 deletions

View file

@ -44,6 +44,9 @@ struct grub_command;
typedef grub_err_t (*grub_command_func_t) (struct grub_command *cmd,
int argc, char **argv);
#define GRUB_COMMAND_PRIO_MASK 0xff
#define GRUB_COMMAND_FLAG_ACTIVE 0x100
/* The command description. */
struct grub_command
{

View file

@ -84,43 +84,4 @@ void * EXPORT_FUNC(grub_named_list_find) (grub_named_list_t head,
&& GRUB_FIELD_MATCH (*pptr, grub_named_list_t, name))? \
(grub_named_list_t *) (void *) pptr : (grub_named_list_t *) grub_bad_type_cast ())
#define GRUB_PRIO_LIST_PRIO_MASK 0xff
#define GRUB_PRIO_LIST_FLAG_ACTIVE 0x100
struct grub_prio_list
{
struct grub_prio_list *next;
struct grub_prio_list **prev;
char *name;
int prio;
};
typedef struct grub_prio_list *grub_prio_list_t;
void EXPORT_FUNC(grub_prio_list_insert) (grub_prio_list_t *head,
grub_prio_list_t item);
static inline void
grub_prio_list_remove (grub_prio_list_t item)
{
if ((item->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) && (item->next))
item->next->prio |= GRUB_PRIO_LIST_FLAG_ACTIVE;
grub_list_remove (GRUB_AS_LIST (item));
}
#define GRUB_AS_PRIO_LIST(ptr) \
((GRUB_FIELD_MATCH (ptr, grub_prio_list_t, next) \
&& GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prev) \
&& GRUB_FIELD_MATCH (ptr, grub_prio_list_t, name) \
&& GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prio))? \
(grub_prio_list_t) ptr \
: (grub_prio_list_t) grub_bad_type_cast ())
#define GRUB_AS_PRIO_LIST_P(pptr) \
((GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, next) \
&& GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prev) \
&& GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, name) \
&& GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prio)) ? \
(grub_prio_list_t *) (void *) pptr \
: (grub_prio_list_t *) grub_bad_type_cast ())
#endif /* ! GRUB_LIST_HEADER */