[Concept,12/15] ext4l: Add mmp.c to the build
Commit Message
From: Simon Glass <simon.glass@canonical.com>
Add support for multi-mount protection.
Use ext4_uboot.h compatibility layer and add stubs for:
- init_utsname() - returns static node name "u-boot"
- sb_start_write/sb_end_write - no-op stubs
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
fs/ext4l/Makefile | 2 +-
fs/ext4l/ext4_uboot.h | 17 ++++++++++++++++-
fs/ext4l/mmp.c | 6 +-----
fs/ext4l/stub.c | 11 ++---------
4 files changed, 20 insertions(+), 16 deletions(-)
@@ -8,7 +8,7 @@ obj-y := interface.o stub.o
obj-y += balloc.o bitmap.o block_validity.o dir.o ext4_jbd2.o extents.o \
extents_status.o file.o fsync.o hash.o ialloc.o \
indirect.o inline.o inode.o mballoc.o migrate.o \
- namei.o page-io.o readpage.o \
+ mmp.o namei.o page-io.o readpage.o \
super.o symlink.o xattr.o \
xattr_hurd.o xattr_trusted.o \
xattr_user.o fast_commit.o orphan.o
@@ -2271,10 +2271,11 @@ int is_power_of_2(unsigned long n);
/* Superblock write operations */
#define sb_start_write_trylock(sb) ({ (void)(sb); 1; })
+#define sb_start_write(sb) do { } while (0)
#define sb_end_write(sb) do { } while (0)
/* Scheduler stubs */
-#define schedule_timeout_interruptible(t) do { } while (0)
+#define schedule_timeout_interruptible(t) ({ (void)(t); 0; })
/* Page allocation - declarations for stub.c */
unsigned long get_zeroed_page(gfp_t gfp);
@@ -2928,4 +2929,18 @@ loff_t seq_lseek(struct file *f, loff_t o, int w);
/* Ratelimited printk for journal.c */
#define pr_notice_ratelimited(fmt, ...) pr_notice(fmt, ##__VA_ARGS__)
+/*
+ * Stubs for mmp.c
+ */
+
+/* init_utsname - returns pointer to system name structure */
+struct new_utsname {
+ char nodename[65];
+};
+static inline struct new_utsname *init_utsname(void)
+{
+ static struct new_utsname uts = { .nodename = "u-boot" };
+ return &uts;
+}
+
#endif /* __EXT4_UBOOT_H__ */
@@ -1,10 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
-#include <linux/fs.h>
-#include <linux/random.h>
-#include <linux/buffer_head.h>
-#include <linux/utsname.h>
-#include <linux/kthread.h>
+#include "ext4_uboot.h"
#include "ext4.h"
/* Checksumming functions */
@@ -461,10 +461,7 @@ int dquot_suspend(void *sb, int flags)
return 0;
}
-/* MMP daemon */
-void ext4_stop_mmpd(void *sbi)
-{
-}
+/* MMP daemon - now in mmp.c */
/* Sysfs */
void ext4_unregister_sysfs(void *sb)
@@ -552,11 +549,7 @@ u64 sb_bdev_nr_blocks(struct super_block *sb)
/* bdev_can_atomic_write is now a macro in ext4_uboot.h */
/* bdev_atomic_write_unit_max_bytes is now a macro in ext4_uboot.h */
-/* Multi-mount protection */
-int ext4_multi_mount_protect(void *sb, unsigned long long mmp_block)
-{
- return 0;
-}
+/* Multi-mount protection - now in mmp.c */
/* Generic dentry ops */
void generic_set_sb_d_ops(struct super_block *sb)