# --- T2-COPYRIGHT-BEGIN ---
# t2/package/*/arcload/fix-xfs-alignment.patch
# Copyright (C) 2025 The T2 SDE Project
# SPDX-License-Identifier: GPL-2.0 or patched project license
# --- T2-COPYRIGHT-END ---

--- arcload-0.5/arcgrub/grub/arcgrub.h.vanilla	2025-05-02 14:10:02.996273150 +0200
+++ arcload-0.5/arcgrub/grub/arcgrub.h	2025-05-02 14:11:06.046897838 +0200
@@ -12,8 +12,8 @@
 typedef int64_t grub_int64_t;
 typedef uint8_t grub_uint8_t;
 typedef uint16_t grub_uint16_t;
-typedef uint32_t grub_uint32_t;
-typedef uint64_t grub_uint64_t;
+typedef uint32_t __attribute__((packed, aligned(1))) grub_uint32_t;
+typedef uint64_t __attribute__((packed, aligned(1))) grub_uint64_t;
 typedef long grub_ssize_t;
 typedef unsigned long grub_size_t;
 #define grub_be_to_cpu16(x) x
--- arcload-0.5/arcgrub/xfs.c.vanilla	2025-05-02 11:45:11.484777457 +0200
+++ arcload-0.5/arcgrub/xfs.c	2025-05-02 14:12:31.757262400 +0200
@@ -333,7 +339,7 @@
     {
     case XFS_INODE_FORMAT_INO:
       {
-	struct grub_xfs_dir_entry *de = &diro->inode.data.dir.direntry[0];
+	struct __attribute__((packed, aligned(1))) grub_xfs_dir_entry *de = &diro->inode.data.dir.direntry[0];
 	int smallino = !diro->inode.data.dir.dirhead.smallino;
 	int i;
 	grub_uint64_t parent;
@@ -365,7 +371,6@@
 	    if (smallino)
 	      {
 		ino = grub_be_to_cpu32 (*(grub_uint32_t *) inopos);
-		ino = grub_cpu_to_be64 (ino);
 	      }
 	    else
 	      ino = *(grub_uint64_t *) inopos;
@@ -472,7 +483,7 @@
 
     default:
       grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-		  "xfs does not support inode format %d yet",
+		  "xfs does not support inode format %u yet",
 		  diro->inode.format);
     }
   return 0;