[Concept,11/21] isofs: Add include guards and U-Boot compat to headers

Message ID 20260416165733.2923423-12-sjg@u-boot.org
State New
Headers
Series fs: Add ISO 9660 filesystem driver ported from Linux |

Commit Message

Simon Glass April 16, 2026, 4:57 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

The isofs internal headers lack include guards, which can cause
issues with multiple inclusion. Also, isofs.h references Linux
kernel headers that are not available in U-Boot.

Add include guards to isofs.h, rock.h, and zisofs.h. Replace the
Linux kernel includes in isofs.h with the U-Boot compatibility
shim (isofs_uboot.h). Replace zisofs.h with a stub since U-Boot
does not support transparent decompression. Fix minor whitespace
and formatting issues in isofs.h (trailing whitespace on blank
lines, pointer declaration style).

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 fs/isofs/isofs.h  | 21 ++++++++++++++-------
 fs/isofs/rock.h   |  4 ++++
 fs/isofs/zisofs.h | 20 ++++++++------------
 3 files changed, 26 insertions(+), 19 deletions(-)
  

Patch

diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h
index 50655583753..66a21648623 100644
--- a/fs/isofs/isofs.h
+++ b/fs/isofs/isofs.h
@@ -1,16 +1,21 @@ 
 /* SPDX-License-Identifier: GPL-2.0 */
-#include <linux/fs.h>
-#include <linux/buffer_head.h>
-#include <linux/exportfs.h>
+#ifndef _ISOFS_ISOFS_H
+#define _ISOFS_ISOFS_H
+/*
+ * isofs internal header - based on Linux 6.18
+ *
+ * Modifications for U-Boot:
+ * - Replace includes with isofs_uboot.h
+ */
+#include "isofs_uboot.h"
 #include <linux/iso_fs.h>
-#include <linux/unaligned.h>
 
 enum isofs_file_format {
 	isofs_file_normal = 0,
 	isofs_file_sparse = 1,
 	isofs_file_compressed = 2,
 };
-	
+
 /*
  * iso fs inode data in memory
  */
@@ -35,7 +40,7 @@  struct isofs_sb_info {
 	unsigned long s_firstdatazone;
 	unsigned long s_log_zone_size;
 	unsigned long s_max_size;
-	
+
 	int           s_rock_offset; /* offset of SUSP fields within SU area */
 	s32           s_sbsector;
 	unsigned char s_joliet_level;
@@ -185,7 +190,7 @@  static inline unsigned long isofs_get_ino(unsigned long block,
  * affected making it safe to call even for non-directory file
  * types. */
 static inline void
-isofs_normalize_block_and_offset(struct iso_directory_record* de,
+isofs_normalize_block_and_offset(struct iso_directory_record *de,
 				 unsigned long *block,
 				 unsigned long *offset)
 {
@@ -201,3 +206,5 @@  extern const struct inode_operations isofs_dir_inode_operations;
 extern const struct file_operations isofs_dir_operations;
 extern const struct address_space_operations isofs_symlink_aops;
 extern const struct export_operations isofs_export_ops;
+
+#endif /* _ISOFS_ISOFS_H */
diff --git a/fs/isofs/rock.h b/fs/isofs/rock.h
index c0856fa9bb6..18e84bdf081 100644
--- a/fs/isofs/rock.h
+++ b/fs/isofs/rock.h
@@ -1,4 +1,6 @@ 
 /* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ISOFS_ROCK_H
+#define _ISOFS_ROCK_H
 /*
  * These structs are used by the system-use-sharing protocol, in which the
  * Rock Ridge extensions are embedded.  It is quite possible that other
@@ -117,3 +119,5 @@  struct rock_ridge {
 #define RR_PL 32		/* Parent link */
 #define RR_RE 64		/* Relocation directory */
 #define RR_TF 128		/* Timestamps */
+
+#endif /* _ISOFS_ROCK_H */
diff --git a/fs/isofs/zisofs.h b/fs/isofs/zisofs.h
index 70f1a218fc9..65c3c39fa6d 100644
--- a/fs/isofs/zisofs.h
+++ b/fs/isofs/zisofs.h
@@ -1,16 +1,12 @@ 
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/* ----------------------------------------------------------------------- *
- *   
- *   Copyright 2001 H. Peter Anvin - All Rights Reserved
- *
- * ----------------------------------------------------------------------- */
-
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
- * Prototypes for functions exported from the compressed isofs subsystem
+ * ZISOFS stub header for U-Boot
+ * Transparent decompression not supported in U-Boot.
  */
+#ifndef _ISOFS_ZISOFS_H
+#define _ISOFS_ZISOFS_H
+
+static inline int zisofs_init(void) { return 0; }
+static inline void zisofs_cleanup(void) { }
 
-#ifdef CONFIG_ZISOFS
-extern const struct address_space_operations zisofs_aops;
-extern int __init zisofs_init(void);
-extern void zisofs_cleanup(void);
 #endif