[Concept,12/21] isofs: Replace Linux includes in source files

Message ID 20260416165733.2923423-13-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 Linux kernel isofs source files include kernel-specific headers
(<linux/gfp.h>, <linux/slab.h>, <linux/cdrom.h>, etc.) that are not
available in U-Boot. Replace these with the single internal isofs.h
header, which pulls in the U-Boot compatibility layer.

The only modification to each file is replacing the Linux includes
with #include "isofs.h" and adding a "Ported to U-Boot" comment.

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

 fs/isofs/dir.c    |  4 ++--
 fs/isofs/inode.c  | 18 ++----------------
 fs/isofs/joliet.c |  4 ++--
 fs/isofs/namei.c  |  3 ++-
 fs/isofs/rock.c   |  5 ++---
 fs/isofs/util.c   |  3 +--
 6 files changed, 11 insertions(+), 26 deletions(-)
  

Patch

diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index 2ca16c3fe5e..e40cdb68ff5 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -10,9 +10,9 @@ 
  *  (stephen@askone.demon.co.uk)      : 21st June 1996
  *
  *  isofs directory handling functions
+ *
+ * Ported to U-Boot with minimal modifications.
  */
-#include <linux/gfp.h>
-#include <linux/filelock.h>
 #include "isofs.h"
 
 int isofs_name_translate(struct iso_directory_record *de, char *new, struct inode *inode)
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 5c01536c5e8..4d0c83eb5df 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -10,24 +10,10 @@ 
  *	1998  Eric Lammerts - ISO 9660 Level 3
  *	2004  Paul Serice - Inode Support pushed out from 4GB to 128GB
  *	2004  Paul Serice - NFS Export Operations
+ *
+ * Ported to U-Boot with minimal modifications.
  */
 
-#include <linux/init.h>
-#include <linux/module.h>
-
-#include <linux/slab.h>
-#include <linux/cred.h>
-#include <linux/nls.h>
-#include <linux/ctype.h>
-#include <linux/statfs.h>
-#include <linux/cdrom.h>
-#include <linux/mpage.h>
-#include <linux/user_namespace.h>
-#include <linux/seq_file.h>
-#include <linux/blkdev.h>
-#include <linux/fs_context.h>
-#include <linux/fs_parser.h>
-
 #include "isofs.h"
 #include "zisofs.h"
 
diff --git a/fs/isofs/joliet.c b/fs/isofs/joliet.c
index c0f04a1e7f6..793621fd97f 100644
--- a/fs/isofs/joliet.c
+++ b/fs/isofs/joliet.c
@@ -5,10 +5,10 @@ 
  *  (C) 1996 Gordon Chaffee
  *
  *  Joliet: Microsoft's Unicode extensions to iso9660
+ *
+ * Ported to U-Boot with minimal modifications.
  */
 
-#include <linux/types.h>
-#include <linux/nls.h>
 #include "isofs.h"
 
 /*
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index 58f80e1b3ac..b44cd0ea73c 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -5,9 +5,10 @@ 
  *  (C) 1992  Eric Youngdale Modified for ISO 9660 filesystem.
  *
  *  (C) 1991  Linus Torvalds - minix filesystem
+ *
+ * Ported to U-Boot with minimal modifications.
  */
 
-#include <linux/gfp.h>
 #include "isofs.h"
 
 /*
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index 6fe6dbd0c74..7232f3ec124 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -5,11 +5,10 @@ 
  *  (C) 1992, 1993  Eric Youngdale
  *
  *  Rock Ridge Extensions to iso9660
+ *
+ * Ported to U-Boot with minimal modifications.
  */
 
-#include <linux/slab.h>
-#include <linux/pagemap.h>
-
 #include "isofs.h"
 #include "rock.h"
 
diff --git a/fs/isofs/util.c b/fs/isofs/util.c
index 42f479da0b2..2e77932664a 100644
--- a/fs/isofs/util.c
+++ b/fs/isofs/util.c
@@ -3,7 +3,6 @@ 
  *  linux/fs/isofs/util.c
  */
 
-#include <linux/time.h>
 #include "isofs.h"
 
 /* 
@@ -52,7 +51,7 @@  struct timespec64 iso_date(u8 *p, int flags)
 
 		/* sign extend */
 		if (tz & 0x80)
-			tz |= (-1 << 8);
+			tz |= ~0U << 8;
 
 		/* 
 		 * The timezone offset is unreliable on some disks,