summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-04-02 20:01:14 -0600
committerTom Rini <[email protected]>2025-04-02 20:01:14 -0600
commit0a174922c6b292237846a75bbbfd3e97b29cb497 (patch)
tree9bbb8c0fb164568424c938404ca411879397bd73 /include
parent177d73dd17705e77b1830a7354425636f617666d (diff)
parent8d0cc62a60b5b92a010f75fd61d9eb9cb8299567 (diff)
Merge patch series "fs: exfat: Add exfat port based on exfat-fuse"
Marek Vasut <[email protected]> says: Import exfat-fuse libexfat, add U-Boot filesystem layer porting glue code and wire exfat support into generic filesystem support code. This adds exfat support to U-Boot. Fill in generic filesystem interface for mkdir and rm commands. Make filesystem tests test the generic interface as well as exfat, to make sure this code does not fall apart. Link: https://github.com/relan/exfat/commits/0b41c6d3560d ("CI: bump FreeBSD to 13.1.") Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'include')
-rw-r--r--include/exfat.h24
-rw-r--r--include/fs.h3
-rw-r--r--include/fs_internal.h2
-rw-r--r--include/linux/stat.h45
4 files changed, 63 insertions, 11 deletions
diff --git a/include/exfat.h b/include/exfat.h
new file mode 100644
index 00000000000..7e43beeb348
--- /dev/null
+++ b/include/exfat.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _EXFAT_H_
+#define _EXFAT_H_
+
+struct disk_partition;
+
+int exfat_fs_opendir(const char *filename, struct fs_dir_stream **dirsp);
+int exfat_fs_readdir(struct fs_dir_stream *dirs, struct fs_dirent **dentp);
+int exfat_fs_ls(const char *dirname);
+int exfat_fs_probe(struct blk_desc *fs_dev_desc,
+ struct disk_partition *fs_partition);
+int exfat_fs_read(const char *filename, void *buf, loff_t offset,
+ loff_t len, loff_t *actread);
+int exfat_fs_size(const char *filename, loff_t *size);
+int exfat_fs_exists(const char *filename);
+void exfat_fs_close(void);
+void exfat_fs_closedir(struct fs_dir_stream *dirs);
+
+int exfat_fs_unlink(const char *filename);
+int exfat_fs_mkdir(const char *dirname);
+int exfat_fs_write(const char *filename, void *buf, loff_t offset,
+ loff_t len, loff_t *actwrite);
+
+#endif /* _EXFAT_H */
diff --git a/include/fs.h b/include/fs.h
index 54449faf2e5..731aaa02637 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -18,6 +18,7 @@ struct cmd_tbl;
#define FS_TYPE_SQUASHFS 6
#define FS_TYPE_EROFS 7
#define FS_TYPE_SEMIHOSTING 8
+#define FS_TYPE_EXFAT 9
struct blk_desc;
@@ -173,7 +174,7 @@ int fs_write(const char *filename, ulong addr, loff_t offset, loff_t len,
#define FS_DT_REG 8 /* regular file */
#define FS_DT_LNK 10 /* symbolic link */
-#define FS_DIRENT_NAME_LEN 256
+#define FS_DIRENT_NAME_LEN CONFIG_IS_ENABLED(FS_EXFAT, (1024), (256))
/**
* struct fs_dirent - directory entry
diff --git a/include/fs_internal.h b/include/fs_internal.h
index 07f6bc5ea40..351582db61a 100644
--- a/include/fs_internal.h
+++ b/include/fs_internal.h
@@ -12,5 +12,7 @@
int fs_devread(struct blk_desc *, struct disk_partition *, lbaint_t, int, int,
char *);
+int fs_devwrite(struct blk_desc *, struct disk_partition *, lbaint_t, int, int,
+ const char *);
#endif /* __U_BOOT_FS_INTERNAL_H__ */
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 5eba6334e60..b65bff7e97d 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -65,9 +65,7 @@ struct stat {
unsigned long __unused5;
};
-#endif /* __PPC__ */
-
-#if defined (__ARM__) || defined (__I386__) || defined (__M68K__) || defined (__bfin__) ||\
+#elif defined (__ARM__) || defined (__I386__) || defined (__M68K__) || defined (__bfin__) ||\
defined (__microblaze__) || defined (__nios2__)
struct stat {
@@ -93,9 +91,7 @@ struct stat {
unsigned long __unused5;
};
-#endif /* __ARM__ */
-
-#if defined (__MIPS__)
+#elif defined (__MIPS__)
struct stat {
dev_t st_dev;
@@ -124,9 +120,7 @@ struct stat {
long st_pad4[14];
};
-#endif /* __MIPS__ */
-
-#if defined(__SH__) || defined(__XTENSA__)
+#elif defined(__SH__) || defined(__XTENSA__)
struct stat {
unsigned long st_dev;
@@ -149,7 +143,38 @@ struct stat {
unsigned long __unused5;
};
-#endif /* __SH__ || __XTENSA__ */
+#else
+
+/*
+ * Everybody gets this wrong and has to stick with it for all
+ * eternity. Hopefully, this version gets used by new architectures
+ * so they don't fall into the same traps.
+ *
+ */
+struct stat {
+ unsigned long st_dev; /* Device. */
+ unsigned long st_ino; /* File serial number. */
+ unsigned int st_mode; /* File mode. */
+ unsigned int st_nlink; /* Link count. */
+ unsigned int st_uid; /* User ID of the file's owner. */
+ unsigned int st_gid; /* Group ID of the file's group. */
+ unsigned long st_rdev; /* Device number, if device. */
+ unsigned long __pad1;
+ long st_size; /* Size of file, in bytes. */
+ int st_blksize; /* Optimal block size for I/O. */
+ int __pad2;
+ long st_blocks; /* Number 512-byte blocks allocated. */
+ long st_atime; /* Time of last access. */
+ unsigned long st_atime_nsec;
+ long st_mtime; /* Time of last modification. */
+ unsigned long st_mtime_nsec;
+ long st_ctime; /* Time of last status change. */
+ unsigned long st_ctime_nsec;
+ unsigned int __unused4;
+ unsigned int __unused5;
+};
+
+#endif
#ifdef __cplusplus
}