Add super.c to the ext4l Makefile and provide the infrastructure needed to compile it: - Add stubs for block device operations (bdev_file_open_by_dev, bdev_fput, bdev_getblk, submit_bh, trylock_buffer) - Add stubs for NFS export helpers (generic_fh_to_dentry/parent) - Add stubs for filesystem operations (sync_filesystem, dquot_suspend) - Add stubs for string operations (strreplace, strtomem_pad) - Add stubs for memory allocation (alloc_inode_sb, kvzalloc) - Add stubs for ratelimit, workqueue, and trace functions - Add fs_context and fs_parameter structures for mount options - Add blk_holder_ops structure for block device holder operations - Add pragma to suppress unused function/variable warnings - Add __maybe_unused to __init/__exit macros in init.h The only change to super.c itself is replacing the Linux kernel includes with the U-Boot compatibility header ext4_uboot.h. Series-to: concept Cover-letter: ext4l: Add more ext4 files to the build (part D) This series continues the ext4l port by adding super.c to the build. The super.c file contains the superblock operations and filesystem registration code from the kernel's ext4 driver. To support this effort compilation, this series adds numerous stubs and compatibility shims for Linux kernel interfaces not available in U-Boot, including block device operations, filesystem context handling, NFS export helpers, and various utility functions. In particular, fs/ext4l/ext4_uboot.h contains a lot of U-Boot specific declarations and stubs, with fs/ext4l/stub.c containing various others. The goal is to eventually have a fully functional ext4 implementation ported from Linux that can be used for both reading and writing ext4 filesystems in U-Boot. END Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com>
116 lines
2.4 KiB
C
116 lines
2.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Written by Mark Hemment, 1996 (markhe@nextd.demon.co.uk).
|
|
*
|
|
* (C) SGI 2006, Christoph Lameter
|
|
* Cleaned up and restructured to ease the addition of alternative
|
|
* implementations of SLAB allocators.
|
|
* (C) Linux Foundation 2008-2013
|
|
* Unified interface for all slab allocators
|
|
*
|
|
* Memory allocation functions for Linux kernel compatibility.
|
|
* These map to U-Boot's malloc/free infrastructure.
|
|
*/
|
|
#ifndef _LINUX_SLAB_H
|
|
#define _LINUX_SLAB_H
|
|
|
|
#include <malloc.h>
|
|
#include <linux/types.h>
|
|
#include <linux/string.h>
|
|
|
|
#ifndef GFP_ATOMIC
|
|
#define GFP_ATOMIC ((gfp_t)0)
|
|
#endif
|
|
#ifndef GFP_KERNEL
|
|
#define GFP_KERNEL ((gfp_t)0)
|
|
#endif
|
|
#ifndef GFP_NOFS
|
|
#define GFP_NOFS ((gfp_t)0)
|
|
#endif
|
|
#ifndef GFP_USER
|
|
#define GFP_USER ((gfp_t)0)
|
|
#endif
|
|
#ifndef GFP_NOWAIT
|
|
#define GFP_NOWAIT ((gfp_t)0)
|
|
#endif
|
|
#ifndef __GFP_NOWARN
|
|
#define __GFP_NOWARN ((gfp_t)0)
|
|
#endif
|
|
#ifndef __GFP_ZERO
|
|
#define __GFP_ZERO ((__force gfp_t)0x8000u)
|
|
#endif
|
|
#ifndef __GFP_NOFAIL
|
|
#define __GFP_NOFAIL ((gfp_t)0)
|
|
#endif
|
|
|
|
void *kmalloc(size_t size, gfp_t flags);
|
|
|
|
static inline void *kzalloc(size_t size, gfp_t flags)
|
|
{
|
|
return kmalloc(size, flags | __GFP_ZERO);
|
|
}
|
|
|
|
static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
|
|
{
|
|
if (size != 0 && n > SIZE_MAX / size)
|
|
return NULL;
|
|
return kmalloc(n * size, flags | __GFP_ZERO);
|
|
}
|
|
|
|
static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
|
|
{
|
|
return kmalloc_array(n, size, flags | __GFP_ZERO);
|
|
}
|
|
|
|
static inline void kfree(const void *block)
|
|
{
|
|
free((void *)block);
|
|
}
|
|
|
|
static inline void kvfree(const void *addr)
|
|
{
|
|
kfree(addr);
|
|
}
|
|
|
|
static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
|
|
{
|
|
return kmalloc_array(n, size, flags);
|
|
}
|
|
|
|
static inline void *krealloc(const void *p, size_t new_size, gfp_t flags)
|
|
{
|
|
return realloc((void *)p, new_size);
|
|
}
|
|
|
|
void *kmemdup(const void *src, size_t len, gfp_t gfp);
|
|
|
|
/* kmem_cache stubs */
|
|
struct kmem_cache {
|
|
int sz;
|
|
};
|
|
|
|
struct kmem_cache *get_mem(int element_sz);
|
|
#define kmem_cache_create(a, sz, c, d, e) ({ (void)(e); get_mem(sz); })
|
|
void *kmem_cache_alloc(struct kmem_cache *obj, gfp_t flag);
|
|
|
|
static inline void *kmem_cache_zalloc(struct kmem_cache *obj, gfp_t flags)
|
|
{
|
|
void *ret = kmem_cache_alloc(obj, flags);
|
|
|
|
if (ret)
|
|
memset(ret, 0, obj->sz);
|
|
return ret;
|
|
}
|
|
|
|
static inline void kmem_cache_free(struct kmem_cache *cachep, void *obj)
|
|
{
|
|
free(obj);
|
|
}
|
|
|
|
static inline void kmem_cache_destroy(struct kmem_cache *cachep)
|
|
{
|
|
free(cachep);
|
|
}
|
|
|
|
#endif /* _LINUX_SLAB_H */
|