From: Vladimir 'phcoder' Serbinenko Date: Thu, 15 Dec 2011 19:51:35 +0000 (+0100) Subject: merge mainline into net X-Git-Tag: 2.00~851^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd67ad0f703166f4f9dda180a2f9797fd4368f63;p=thirdparty%2Fgrub.git merge mainline into net --- bd67ad0f703166f4f9dda180a2f9797fd4368f63 diff --cc grub-core/net/bootp.c index b83b343c8,ba6a29020..f84d4ff66 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@@ -547,8 -520,11 +547,8 @@@ voi grub_bootp_init (void) { cmd_bootp = grub_register_command ("net_bootp", grub_cmd_bootp, - "[CARD]", + N_("[CARD]"), N_("perform a bootp autoconfiguration")); - cmd_dhcp = grub_register_command ("net_dhcp", grub_cmd_bootp, - N_("[CARD]"), - N_("perform a bootp autoconfiguration")); cmd_getdhcp = grub_register_command ("net_get_dhcp_option", grub_cmd_dhcpopt, N_("VAR INTERFACE NUMBER DESCRIPTION"), N_("retrieve DHCP option and save it into VAR. If VAR is - then print the value.")); diff --cc grub-core/net/net.c index 269786fd8,d4e445e71..ed6229807 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@@ -1468,21 -946,16 +1468,21 @@@ static grub_command_t cmd_lsaddr, cmd_s GRUB_MOD_INIT(net) { cmd_addaddr = grub_register_command ("net_add_addr", grub_cmd_addaddr, - "SHORTNAME CARD ADDRESS [HWADDRESS]", + N_("SHORTNAME CARD ADDRESS [HWADDRESS]"), N_("Add a network address.")); + cmd_slaac = grub_register_command ("net_ipv6_autoconf", + grub_cmd_ipv6_autoconf, + "[CARD [HWADDRESS]]", + N_("Perform an IPV6 autoconfiguration")); + cmd_deladdr = grub_register_command ("net_del_addr", grub_cmd_deladdr, - "SHORTNAME", + N_("SHORTNAME"), N_("Delete a network address.")); cmd_addroute = grub_register_command ("net_add_route", grub_cmd_addroute, - "SHORTNAME NET [INTERFACE| gw GATEWAY]", + N_("SHORTNAME NET [INTERFACE| gw GATEWAY]"), N_("Add a network route.")); cmd_delroute = grub_register_command ("net_del_route", grub_cmd_delroute, - "SHORTNAME", + N_("SHORTNAME"), N_("Delete a network route.")); cmd_lsroutes = grub_register_command ("net_ls_routes", grub_cmd_listroutes, "", N_("list network routes")); diff --cc grub-core/net/netbuff.c index cb6106fc7,bee207f90..242b154e0 --- a/grub-core/net/netbuff.c +++ b/grub-core/net/netbuff.c @@@ -84,9 -87,10 +86,10 @@@ grub_netbuff_alloc (grub_size_t len data = grub_memalign (NETBUFF_ALIGN, len + sizeof (*nb)); if (!data) return NULL; - nb = (struct grub_net_buff *) ((grub_uint8_t *) data + len); + nb = (struct grub_net_buff *) ((grub_properly_aligned_t *) data + + len / sizeof (grub_properly_aligned_t)); nb->head = nb->data = nb->tail = data; - nb->end = (char *) nb; + nb->end = (grub_uint8_t *) nb; return nb; } diff --cc include/grub/types.h index 68f28d01d,f8059c1ab..89c1697d2 --- a/include/grub/types.h +++ b/include/grub/types.h @@@ -116,9 -114,12 +116,13 @@@ typedef grub_int32_t grub_ssize_t # define PRIxGRUB_SIZE "x" # define PRIxGRUB_ADDR "x" # define PRIuGRUB_SIZE "u" +# define PRIdGRUB_SSIZE "d" #endif + #define GRUB_UCHAR_MAX 0xFF + #define GRUB_USHRT_MAX 65535 + #define GRUB_UINT_MAX 4294967295U + #if GRUB_CPU_SIZEOF_LONG == 8 # define GRUB_ULONG_MAX 18446744073709551615UL # define GRUB_LONG_MAX 9223372036854775807L @@@ -233,13 -212,61 +231,66 @@@ static inline grub_uint64_t grub_swap_b # define grub_be_to_cpu16(x) grub_swap_bytes16(x) # define grub_be_to_cpu32(x) grub_swap_bytes32(x) # define grub_be_to_cpu64(x) grub_swap_bytes64(x) +# define grub_cpu_to_be16_compile_time(x) grub_swap_bytes16_compile_time(x) +# define grub_cpu_to_be32_compile_time(x) grub_swap_bytes32_compile_time(x) +# define grub_cpu_to_be64_compile_time(x) grub_swap_bytes64_compile_time(x) +# define grub_be_to_cpu64_compile_time(x) grub_swap_bytes64_compile_time(x) # define grub_cpu_to_le16_compile_time(x) ((grub_uint16_t) (x)) # define grub_cpu_to_le32_compile_time(x) ((grub_uint32_t) (x)) + #endif /* ! WORDS_BIGENDIAN */ + static inline grub_uint16_t grub_get_unaligned16 (const void *ptr) + { + struct grub_unaligned_uint16_t + { + grub_uint16_t d; + } __attribute__ ((packed)); + const struct grub_unaligned_uint16_t *dd + = (const struct grub_unaligned_uint16_t *) ptr; + return dd->d; + } + + static inline void grub_set_unaligned16 (void *ptr, grub_uint16_t val) + { + struct grub_unaligned_uint16_t + { + grub_uint16_t d; + } __attribute__ ((packed)); + struct grub_unaligned_uint16_t *dd = (struct grub_unaligned_uint16_t *) ptr; + dd->d = val; + } + + static inline grub_uint32_t grub_get_unaligned32 (const void *ptr) + { + struct grub_unaligned_uint32_t + { + grub_uint32_t d; + } __attribute__ ((packed)); + const struct grub_unaligned_uint32_t *dd + = (const struct grub_unaligned_uint32_t *) ptr; + return dd->d; + } + + static inline void grub_set_unaligned32 (void *ptr, grub_uint32_t val) + { + struct grub_unaligned_uint32_t + { + grub_uint32_t d; + } __attribute__ ((packed)); + struct grub_unaligned_uint32_t *dd = (struct grub_unaligned_uint32_t *) ptr; + dd->d = val; + } + + static inline grub_uint64_t grub_get_unaligned64 (const void *ptr) + { + struct grub_unaligned_uint64_t + { + grub_uint64_t d; + } __attribute__ ((packed)); + const struct grub_unaligned_uint64_t *dd + = (const struct grub_unaligned_uint64_t *)ptr; + return dd->d; + } + #endif /* ! GRUB_TYPES_HEADER */