* grub-core/kern/err.c (GRUB_MAX_ERRMSG): Move to ...
* include/grub/err.h (GRUB_MAX_ERRMSG): ... here. * include/grub/err.h (grub_error_saved): New struct. (grub_errmsg): Make array size explicit. * include/grub/misc.h (grub_error_save): New function. (grub_error_load): Likewise. * grub-core/kern/err.c (grub_error_stack_items): Use grub_error_saved. (grub_error_push): Update `errno' member name. (grub_error_pop): Likewise * grub-core/net/tftp.c (tftp_data): New member save_err. (tftp_receive): Save error. (tftp_open): Restore error.
This commit is contained in:
parent
a51dab1328
commit
aca002f7e4
5 changed files with 54 additions and 11 deletions
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#define GRUB_MAX_ERRMSG 256
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GRUB_ERR_NONE = 0,
|
||||
|
@ -70,8 +72,14 @@ typedef enum
|
|||
}
|
||||
grub_err_t;
|
||||
|
||||
struct grub_error_saved
|
||||
{
|
||||
grub_err_t grub_errno;
|
||||
char errmsg[GRUB_MAX_ERRMSG];
|
||||
};
|
||||
|
||||
extern grub_err_t EXPORT_VAR(grub_errno);
|
||||
extern char EXPORT_VAR(grub_errmsg)[];
|
||||
extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...);
|
||||
void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn));
|
||||
|
|
|
@ -424,4 +424,19 @@ extern int EXPORT_VAR(grub_no_autoload);
|
|||
#define grub_no_autoload 0
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
grub_error_save (struct grub_error_saved *save)
|
||||
{
|
||||
grub_memcpy (save->errmsg, grub_errmsg, sizeof (save->errmsg));
|
||||
save->grub_errno = grub_errno;
|
||||
save->grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_error_load (const struct grub_error_saved *save)
|
||||
{
|
||||
grub_memcpy (grub_errmsg, save->errmsg, sizeof (grub_errmsg));
|
||||
grub_errno = save->grub_errno;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_MISC_HEADER */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue