},
};
-static ssize_t hc_tag_show_u32(const u8 *pld, u16 pld_len, char *buf)
-{
- char *out = buf;
- u32 data; // cpu-endian
-
- /* Caller ensures pld_len > 0 */
- if (pld_len % sizeof(data))
- return -EINVAL;
-
- data = *(u32 *)pld;
-
- do {
- out += sprintf(out, "0x%08x\n", data);
- data++;
- } while ((pld_len -= sizeof(data)));
-
- return out - buf;
-}
-
/*
* The MAC is stored network-endian on all devices, in 2 32-bit segments:
* <XX:XX:XX:XX> <XX:XX:00:00>. Kernel print has us covered.
} hc_attrs[] = {
{
.tag_id = RB_ID_FLASH_INFO,
- .tshow = hc_tag_show_u32,
+ .tshow = routerboot_tag_show_u32s,
.kattr = __ATTR(flash_info, S_IRUSR, hc_attr_show, NULL),
}, {
.tag_id = RB_ID_MAC_ADDRESS_PACK,
.kattr = __ATTR(board_serial, S_IRUSR, hc_attr_show, NULL),
}, {
.tag_id = RB_ID_MEMORY_SIZE,
- .tshow = hc_tag_show_u32,
+ .tshow = routerboot_tag_show_u32s,
.kattr = __ATTR(mem_size, S_IRUSR, hc_attr_show, NULL),
}, {
.tag_id = RB_ID_MAC_ADDRESS_COUNT,
- .tshow = hc_tag_show_u32,
+ .tshow = routerboot_tag_show_u32s,
.kattr = __ATTR(mac_count, S_IRUSR, hc_attr_show, NULL),
}, {
.tag_id = RB_ID_HW_OPTIONS,
return scnprintf(buf, pld_len+1, "%s\n", pld);
}
+ssize_t routerboot_tag_show_u32s(const u8 *pld, u16 pld_len, char *buf)
+{
+ char *out = buf;
+ u32 data; // cpu-endian
+
+ /* Caller ensures pld_len > 0 */
+ if (pld_len % sizeof(data))
+ return -EINVAL;
+
+ data = *(u32 *)pld;
+
+ do {
+ out += sprintf(out, "0x%08x\n", data);
+ data++;
+ } while ((pld_len -= sizeof(data)));
+
+ return out - buf;
+}
+
module_init(routerboot_init);
module_exit(routerboot_exit);