[Concept,17/33] ext4l: Have hash.c include ext4.h directly

Message ID 20260121220857.2137568-18-sjg@u-boot.org
State New
Headers
Series Reorganise ext4l compatibility stubs |

Commit Message

Simon Glass Jan. 21, 2026, 10:08 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Change hash.c to include ext4.h instead of using the EXT4_UBOOT_NO_EXT4_H
workaround. This allows removal of the duplicated dx_hash_info struct,
DX_HASH_* constants, EXT4_HTREE_EOF_* constants, and ext4_warning macros
from ext4_uboot.h since they are already defined in ext4.h.

This reduces ext4_uboot.h from 526 to 493 lines.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 fs/ext4l/ext4_uboot.h | 34 ----------------------------------
 fs/ext4l/hash.c       |  4 +---
 2 files changed, 1 insertion(+), 37 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 7356ddb6213..14b3d075dd4 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -172,40 +172,6 @@  struct path;
 
 /* QSTR_INIT and dotdot_name are now in linux/dcache.h */
 
-/*
- * Hash info structure and constants - defined in ext4.h.
- * Only defined here for files that don't include ext4.h (like hash.c).
- * This is wrapped in EXT4_UBOOT_NO_EXT4_H which hash.c defines.
- */
-#ifdef EXT4_UBOOT_NO_EXT4_H
-struct dx_hash_info {
-	u32 hash;
-	u32 minor_hash;
-	int hash_version;
-	u32 *seed;
-};
-
-/* Hash algorithm types */
-#define DX_HASH_LEGACY			0
-#define DX_HASH_HALF_MD4		1
-#define DX_HASH_TEA			2
-#define DX_HASH_LEGACY_UNSIGNED		3
-#define DX_HASH_HALF_MD4_UNSIGNED	4
-#define DX_HASH_TEA_UNSIGNED		5
-#define DX_HASH_SIPHASH			6
-#define DX_HASH_LAST			DX_HASH_SIPHASH
-
-/* EOF markers for htree */
-#define EXT4_HTREE_EOF_32BIT   ((1UL  << (32 - 1)) - 1)
-#define EXT4_HTREE_EOF_64BIT   ((1ULL << (64 - 1)) - 1)
-
-#define ext4_warning(sb, fmt, ...) \
-	do { } while (0)
-
-#define ext4_warning_inode(inode, fmt, ...) \
-	do { } while (0)
-#endif
-
 #define vfs_setpos(file, offset, maxsize)	({ (void)(file); (void)(maxsize); (offset); })
 
 #include <linux/minmax.h>
diff --git a/fs/ext4l/hash.c b/fs/ext4l/hash.c
index 58063a872d3..c033e44b2d5 100644
--- a/fs/ext4l/hash.c
+++ b/fs/ext4l/hash.c
@@ -5,9 +5,7 @@ 
  * Copyright (C) 2002 by Theodore Ts'o
  */
 
-#define EXT4_UBOOT_NO_EXT4_H
-#include "ext4_uboot.h"
-#include <linux/compiler.h>
+#include "ext4.h"
 
 #define DELTA 0x9E3779B9