~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

Viewing changes to include/grub/misc.h

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Robert Millan, Updated translations
  • Date: 2010-11-22 12:24:56 UTC
  • mfrom: (1.26.4 upstream) (17.3.36 sid)
  • mto: (17.3.43 sid)
  • mto: This revision was merged to the branch mainline in revision 89.
  • Revision ID: james.westby@ubuntu.com-20101122122456-y82z3sfb7k4zfdcc
Tags: 1.99~20101122-1
[ Colin Watson ]
* New Bazaar snapshot.  Too many changes to list in full, but some of the
  more user-visible ones are as follows:
  - GRUB script:
    + Function parameters, "break", "continue", "shift", "setparams",
      "return", and "!".
    + "export" command supports multiple variable names.
    + Multi-line quoted strings support.
    + Wildcard expansion.
  - sendkey support.
  - USB hotunplugging and USB serial support.
  - Rename CD-ROM to cd on BIOS.
  - Add new --boot-directory option to grub-install, grub-reboot, and
    grub-set-default; the old --root-directory option is still accepted
    but was often confusing.
  - Basic btrfs detection/UUID support (but no file reading yet).
  - bash-completion for utilities.
  - If a device is listed in device.map, always assume that it is
    BIOS-visible rather than using extra layers such as LVM or RAID.
  - Add grub-mknetdir script (closes: #550658).
  - Remove deprecated "root" command.
  - Handle RAID devices containing virtio components.
  - GRUB Legacy configuration file support (via grub-menulst2cfg).
  - Keyboard layout support (via grub-mklayout and grub-kbdcomp).
  - Check generated grub.cfg for syntax errors before saving.
  - Pause execution for at most ten seconds if any errors are displayed,
    so that the user has a chance to see them.
  - Support submenus.
  - Write embedding zone using Reed-Solomon, so that it's robust against
    being partially overwritten (closes: #550702, #591416, #593347).
  - GRUB_DISABLE_LINUX_RECOVERY and GRUB_DISABLE_NETBSD_RECOVERY merged
    into a single GRUB_DISABLE_RECOVERY variable.
  - Fix loader memory allocation failure (closes: #551627).
  - Don't call savedefault on recovery entries (closes: #589325).
  - Support triple-indirect blocks on ext2 (closes: #543924).
  - Recognise DDF1 fake RAID (closes: #603354).

[ Robert Millan ]
* Use dpkg architecture wildcards.

[ Updated translations ]
* Slovenian (Vanja Cvelbar).  Closes: #604003
* Dzongkha (dawa pemo via Tenzin Dendup).  Closes: #604102

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
#define ALIGN_UP(addr, align) \
45
45
        ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
 
46
#define ALIGN_DOWN(addr, align) \
 
47
        ((addr) & ~((typeof (addr)) align - 1))
46
48
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
47
49
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
48
50
 
49
 
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(__FILE__, __LINE__, condition, fmt, ## args)
 
51
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, fmt, ## args)
50
52
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy.  */
51
53
#define grub_memcpy(d,s,n)      grub_memmove ((d), (s), (n))
52
54
 
231
233
    }
232
234
}
233
235
 
234
 
char *EXPORT_FUNC(grub_strdup) (const char *s);
235
 
char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n);
 
236
char *EXPORT_FUNC(grub_strdup) (const char *s) __attribute__ ((warn_unused_result));
 
237
char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n) __attribute__ ((warn_unused_result));
236
238
void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n);
237
 
grub_size_t EXPORT_FUNC(grub_strlen) (const char *s);
 
239
grub_size_t EXPORT_FUNC(grub_strlen) (const char *s) __attribute__ ((warn_unused_result));
238
240
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
239
241
int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
240
 
int EXPORT_FUNC(grub_puts) (const char *s);
 
242
 
 
243
extern void (*EXPORT_VAR (grub_xputs)) (const char *str);
 
244
 
 
245
static inline int
 
246
grub_puts (const char *s)
 
247
{
 
248
  const char nl[2] = "\n";
 
249
  grub_xputs (s);
 
250
  grub_xputs (nl);
 
251
 
 
252
  return 1;     /* Cannot fail.  */
 
253
}
 
254
 
241
255
int EXPORT_FUNC(grub_puts_) (const char *s);
242
256
void EXPORT_FUNC(grub_real_dprintf) (const char *file,
243
257
                                     const int line,
249
263
int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt,
250
264
                                 va_list args);
251
265
char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
252
 
     __attribute__ ((format (printf, 1, 2)));
253
 
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args);
 
266
     __attribute__ ((format (printf, 1, 2))) __attribute__ ((warn_unused_result));
 
267
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) __attribute__ ((warn_unused_result));
254
268
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
255
269
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
256
 
grub_size_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest,
257
 
                                            grub_size_t destsize,
258
 
                                            const grub_uint8_t *src,
259
 
                                            grub_size_t srcsize,
260
 
                                            const grub_uint8_t **srcend);
261
270
grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
262
271
                                          grub_uint32_t d, grub_uint32_t *r);
263
272
 
264
 
#ifdef NEED_ENABLE_EXECUTE_STACK
 
273
#if NEED_ENABLE_EXECUTE_STACK && !defined(GRUB_UTIL)
265
274
void EXPORT_FUNC(__enable_execute_stack) (void *addr);
266
275
#endif
267
276
 
 
277
#if NEED_REGISTER_FRAME_INFO && !defined(GRUB_UTIL)
 
278
void EXPORT_FUNC (__register_frame_info) (void);
 
279
void EXPORT_FUNC (__deregister_frame_info) (void);
 
280
#endif
 
281
 
268
282
/* Inline functions.  */
269
283
 
270
284
static inline unsigned int
277
291
}
278
292
 
279
293
static inline long
 
294
grub_min (long x, long y)
 
295
{
 
296
  if (x < y)
 
297
    return x;
 
298
  else
 
299
    return y;
 
300
}
 
301
 
 
302
static inline long
280
303
grub_max (long x, long y)
281
304
{
282
305
  if (x > y)
293
316
}
294
317
 
295
318
/* Reboot the machine.  */
296
 
void EXPORT_FUNC (grub_reboot) (void);
297
 
 
298
 
#ifndef GRUB_MACHINE_PCBIOS
299
 
void EXPORT_FUNC (grub_halt) (void);
 
319
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
 
320
 
 
321
#ifdef GRUB_MACHINE_PCBIOS
 
322
/* Halt the system, using APM if possible. If NO_APM is true, don't
 
323
 * use APM even if it is available.  */
 
324
void grub_halt (int no_apm) __attribute__ ((noreturn));
 
325
#else
 
326
void grub_halt (void) __attribute__ ((noreturn));
 
327
#endif
 
328
 
 
329
#ifdef GRUB_MACHINE_EMU
 
330
/* Flag to control module autoloading in normal mode.  */
 
331
extern int EXPORT_VAR(grub_no_autoload);
 
332
#else
 
333
#define grub_no_autoload 0
300
334
#endif
301
335
 
302
336
#endif /* ! GRUB_MISC_HEADER */