linux: Add compatibility headers for ext4l extents_status
Add Linux compatibility header stubs needed to compile extents_status.c: - backing-dev.h: Backing device info stub - dax.h: Direct Access (DAX) stubs - iomap.h: I/O mapping operations and structures - mman.h: Memory mapping flags - mount.h: VFS mount structures - pagevec.h: Page vector batching - pfn_t.h: Page frame number type - posix_acl_xattr.h: POSIX ACL xattr definitions - proc_fs.h: Proc filesystem stub - uio.h: User I/O vector definitions - xattr.h: Extended attributes - trace/events/ext4.h: Trace event stubs Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
25
include/linux/backing-dev.h
Normal file
25
include/linux/backing-dev.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* include/linux/backing-dev.h
|
||||
*
|
||||
* low-level device information and state which is propagated up through
|
||||
* to high-level code.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_BACKING_DEV_H
|
||||
#define _LINUX_BACKING_DEV_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct backing_dev_info {
|
||||
unsigned long ra_pages;
|
||||
unsigned long io_pages;
|
||||
};
|
||||
|
||||
/* Stub for inode_to_bdi - returns NULL since we don't use backing dev */
|
||||
static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* _LINUX_BACKING_DEV_H */
|
||||
53
include/linux/dax.h
Normal file
53
include/linux/dax.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_DAX_H
|
||||
#define _LINUX_DAX_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/pfn_t.h>
|
||||
|
||||
struct address_space;
|
||||
struct dax_device;
|
||||
struct vm_area_struct;
|
||||
struct iomap_ops;
|
||||
struct kiocb;
|
||||
struct iov_iter;
|
||||
struct vm_fault;
|
||||
|
||||
typedef unsigned int vm_fault_t;
|
||||
|
||||
#define VM_FAULT_SIGBUS 0x0002
|
||||
#define VM_FAULT_NOPAGE 0x0100
|
||||
|
||||
/* DAX is not supported in U-Boot - provide stubs */
|
||||
static inline ssize_t
|
||||
dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
|
||||
const struct iomap_ops *ops)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline vm_fault_t
|
||||
dax_iomap_fault(struct vm_fault *vmf, unsigned int order, pfn_t *pfnp,
|
||||
int *errp, const struct iomap_ops *ops)
|
||||
{
|
||||
return VM_FAULT_SIGBUS;
|
||||
}
|
||||
|
||||
static inline vm_fault_t
|
||||
dax_finish_sync_fault(struct vm_fault *vmf, unsigned int order, pfn_t pfn)
|
||||
{
|
||||
return VM_FAULT_SIGBUS;
|
||||
}
|
||||
|
||||
static inline bool dax_mapping(struct address_space *mapping)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool daxdev_mapping_supported(struct vm_area_struct *vma,
|
||||
struct dax_device *dax_dev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif /* _LINUX_DAX_H */
|
||||
92
include/linux/iomap.h
Normal file
92
include/linux/iomap.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef LINUX_IOMAP_H
|
||||
#define LINUX_IOMAP_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct bio;
|
||||
struct inode;
|
||||
struct iomap_iter;
|
||||
struct kiocb;
|
||||
struct iov_iter;
|
||||
struct vm_fault;
|
||||
|
||||
/* iomap type values */
|
||||
#define IOMAP_HOLE 0
|
||||
#define IOMAP_DELALLOC 1
|
||||
#define IOMAP_MAPPED 2
|
||||
#define IOMAP_UNWRITTEN 3
|
||||
#define IOMAP_INLINE 4
|
||||
|
||||
/* iomap flags */
|
||||
#define IOMAP_F_NEW (1U << 0)
|
||||
#define IOMAP_F_DIRTY (1U << 1)
|
||||
#define IOMAP_F_SHARED (1U << 2)
|
||||
#define IOMAP_F_MERGED (1U << 3)
|
||||
#define IOMAP_F_BUFFER_HEAD (1U << 4)
|
||||
#define IOMAP_F_ZONE_APPEND (1U << 5)
|
||||
#define IOMAP_F_PRIVATE (1U << 12)
|
||||
|
||||
/* Flags for iomap_begin */
|
||||
#define IOMAP_WRITE (1 << 0)
|
||||
#define IOMAP_ZERO (1 << 1)
|
||||
#define IOMAP_REPORT (1 << 2)
|
||||
#define IOMAP_FAULT (1 << 3)
|
||||
#define IOMAP_DIRECT (1 << 4)
|
||||
#define IOMAP_NOWAIT (1 << 5)
|
||||
#define IOMAP_OVERWRITE_ONLY (1 << 6)
|
||||
#define IOMAP_UNSHARE (1 << 7)
|
||||
#define IOMAP_DAX (1 << 8)
|
||||
|
||||
struct iomap {
|
||||
u64 addr;
|
||||
loff_t offset;
|
||||
u64 length;
|
||||
u16 type;
|
||||
u16 flags;
|
||||
struct block_device *bdev;
|
||||
struct dax_device *dax_dev;
|
||||
void *inline_data;
|
||||
};
|
||||
|
||||
struct iomap_ops {
|
||||
int (*iomap_begin)(struct inode *inode, loff_t pos, loff_t length,
|
||||
unsigned int flags, struct iomap *iomap,
|
||||
struct iomap *srcmap);
|
||||
int (*iomap_end)(struct inode *inode, loff_t pos, loff_t length,
|
||||
ssize_t written, unsigned int flags,
|
||||
struct iomap *iomap);
|
||||
};
|
||||
|
||||
struct iomap_dio_ops {
|
||||
int (*end_io)(struct kiocb *iocb, ssize_t size, int error,
|
||||
unsigned int flags);
|
||||
void (*submit_io)(const struct iomap_iter *iter, struct bio *bio,
|
||||
loff_t file_offset);
|
||||
struct bio_set *bio_set;
|
||||
};
|
||||
|
||||
struct iomap_iter;
|
||||
|
||||
/* Stubs for U-Boot - these are not actually used in read-only mode */
|
||||
static inline ssize_t
|
||||
iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
|
||||
const struct iomap_ops *ops, const struct iomap_dio_ops *dops,
|
||||
unsigned int dio_flags, void *private, size_t done_before)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline loff_t
|
||||
iomap_seek_hole(struct inode *inode, loff_t pos, const struct iomap_ops *ops)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline loff_t
|
||||
iomap_seek_data(struct inode *inode, loff_t pos, const struct iomap_ops *ops)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
#endif /* LINUX_IOMAP_H */
|
||||
16
include/linux/mman.h
Normal file
16
include/linux/mman.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_MMAN_H
|
||||
#define _LINUX_MMAN_H
|
||||
|
||||
/* Memory mapping flags - minimal set for ext4l */
|
||||
#define PROT_READ 0x1
|
||||
#define PROT_WRITE 0x2
|
||||
#define PROT_EXEC 0x4
|
||||
#define PROT_NONE 0x0
|
||||
|
||||
#define MAP_SHARED 0x01
|
||||
#define MAP_PRIVATE 0x02
|
||||
#define MAP_FIXED 0x10
|
||||
#define MAP_ANONYMOUS 0x20
|
||||
|
||||
#endif /* _LINUX_MMAN_H */
|
||||
19
include/linux/mount.h
Normal file
19
include/linux/mount.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
*
|
||||
* Definitions for mount interface. This describes the in the kernel build
|
||||
* linkedlist with mounted filesystems.
|
||||
*
|
||||
* Author: Marco van Wieringen <mvw@planets.elm.net>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_MOUNT_H
|
||||
#define _LINUX_MOUNT_H
|
||||
|
||||
struct vfsmount {
|
||||
struct dentry *mnt_root;
|
||||
struct super_block *mnt_sb;
|
||||
};
|
||||
|
||||
#endif /* _LINUX_MOUNT_H */
|
||||
46
include/linux/pagevec.h
Normal file
46
include/linux/pagevec.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* include/linux/pagevec.h
|
||||
*
|
||||
* In many places it is efficient to batch an operation up against multiple
|
||||
* folios. A folio_batch is a container which is used for that.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_PAGEVEC_H
|
||||
#define _LINUX_PAGEVEC_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* Minimal stub - pagevec is used for batching page operations */
|
||||
|
||||
#define PAGEVEC_SIZE 16
|
||||
|
||||
struct folio;
|
||||
|
||||
struct folio_batch {
|
||||
unsigned char nr;
|
||||
unsigned char i;
|
||||
bool percpu_pvec_drained;
|
||||
struct folio *folios[PAGEVEC_SIZE];
|
||||
};
|
||||
|
||||
static inline void folio_batch_init(struct folio_batch *fbatch)
|
||||
{
|
||||
fbatch->nr = 0;
|
||||
fbatch->i = 0;
|
||||
fbatch->percpu_pvec_drained = false;
|
||||
}
|
||||
|
||||
static inline unsigned int folio_batch_count(struct folio_batch *fbatch)
|
||||
{
|
||||
return fbatch->nr;
|
||||
}
|
||||
|
||||
static inline unsigned int folio_batch_add(struct folio_batch *fbatch,
|
||||
struct folio *folio)
|
||||
{
|
||||
fbatch->folios[fbatch->nr++] = folio;
|
||||
return PAGEVEC_SIZE - fbatch->nr;
|
||||
}
|
||||
|
||||
#endif /* _LINUX_PAGEVEC_H */
|
||||
31
include/linux/pfn_t.h
Normal file
31
include/linux/pfn_t.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_PFN_T_H
|
||||
#define _LINUX_PFN_T_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/*
|
||||
* pfn_t is a type that encapsulates a page frame number along with
|
||||
* flags about how it should be used. For U-Boot, we just need a
|
||||
* minimal definition.
|
||||
*/
|
||||
typedef struct {
|
||||
u64 val;
|
||||
} pfn_t;
|
||||
|
||||
#define PFN_DEV (1ULL << 56)
|
||||
#define PFN_MAP (1ULL << 57)
|
||||
|
||||
static inline pfn_t pfn_to_pfn_t(unsigned long pfn)
|
||||
{
|
||||
pfn_t pfn_t = { .val = pfn };
|
||||
|
||||
return pfn_t;
|
||||
}
|
||||
|
||||
static inline unsigned long pfn_t_to_pfn(pfn_t pfn)
|
||||
{
|
||||
return pfn.val & ~(PFN_DEV | PFN_MAP);
|
||||
}
|
||||
|
||||
#endif /* _LINUX_PFN_T_H */
|
||||
69
include/linux/posix_acl_xattr.h
Normal file
69
include/linux/posix_acl_xattr.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
File: linux/posix_acl_xattr.h
|
||||
|
||||
Extended attribute system call representation of Access Control Lists.
|
||||
|
||||
Copyright (C) 2000 by Andreas Gruenbacher <a.gruenbacher@computer.org>
|
||||
Copyright (C) 2002 SGI - Silicon Graphics, Inc <linux-xfs@oss.sgi.com>
|
||||
*/
|
||||
#ifndef _POSIX_ACL_XATTR_H
|
||||
#define _POSIX_ACL_XATTR_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* ACL entry structure for on-disk format */
|
||||
struct posix_acl_xattr_entry {
|
||||
__le16 e_tag;
|
||||
__le16 e_perm;
|
||||
__le32 e_id;
|
||||
};
|
||||
|
||||
struct posix_acl_xattr_header {
|
||||
__le32 a_version;
|
||||
};
|
||||
|
||||
/* POSIX ACL in-memory structure */
|
||||
struct posix_acl_entry {
|
||||
short e_tag;
|
||||
unsigned short e_perm;
|
||||
union {
|
||||
kuid_t e_uid;
|
||||
kgid_t e_gid;
|
||||
};
|
||||
};
|
||||
|
||||
struct posix_acl {
|
||||
int a_count;
|
||||
struct posix_acl_entry a_entries[];
|
||||
};
|
||||
|
||||
/* ACL extended attribute names */
|
||||
#define XATTR_NAME_POSIX_ACL_ACCESS "system.posix_acl_access"
|
||||
#define XATTR_NAME_POSIX_ACL_DEFAULT "system.posix_acl_default"
|
||||
|
||||
/* ACL tag types */
|
||||
#define ACL_UNDEFINED_TAG (0x00)
|
||||
#define ACL_USER_OBJ (0x01)
|
||||
#define ACL_USER (0x02)
|
||||
#define ACL_GROUP_OBJ (0x04)
|
||||
#define ACL_GROUP (0x08)
|
||||
#define ACL_MASK (0x10)
|
||||
#define ACL_OTHER (0x20)
|
||||
|
||||
/* ACL permissions */
|
||||
#define ACL_READ (0x04)
|
||||
#define ACL_WRITE (0x02)
|
||||
#define ACL_EXECUTE (0x01)
|
||||
|
||||
/* Stubs for U-Boot */
|
||||
static inline struct posix_acl *get_inode_acl(struct inode *inode, int type)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void posix_acl_release(struct posix_acl *acl)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* _POSIX_ACL_XATTR_H */
|
||||
13
include/linux/proc_fs.h
Normal file
13
include/linux/proc_fs.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* The proc filesystem constants/structures
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_PROC_FS_H
|
||||
#define _LINUX_PROC_FS_H
|
||||
|
||||
/* proc_fs is not used in U-Boot - provide empty stubs */
|
||||
|
||||
struct proc_dir_entry;
|
||||
|
||||
#endif /* _LINUX_PROC_FS_H */
|
||||
@@ -11,8 +11,9 @@ struct seq_file {
|
||||
void *private;
|
||||
};
|
||||
|
||||
#define seq_printf(m, fmt, ...) do { } while (0)
|
||||
#define seq_puts(m, s) do { } while (0)
|
||||
#define seq_putc(m, c) do { } while (0)
|
||||
#define seq_printf(m, fmt, ...) \
|
||||
do { (void)(m); (void)(fmt); } while (0)
|
||||
#define seq_puts(m, s) do { (void)(m); (void)(s); } while (0)
|
||||
#define seq_putc(m, c) do { (void)(m); (void)(c); } while (0)
|
||||
|
||||
#endif /* _LINUX_SEQ_FILE_H */
|
||||
|
||||
66
include/linux/uio.h
Normal file
66
include/linux/uio.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* Berkeley style UIO structures - Alan Cox 1994.
|
||||
*/
|
||||
#ifndef __LINUX_UIO_H
|
||||
#define __LINUX_UIO_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct kvec {
|
||||
void *iov_base;
|
||||
size_t iov_len;
|
||||
};
|
||||
|
||||
struct iovec {
|
||||
void __user *iov_base;
|
||||
size_t iov_len;
|
||||
};
|
||||
|
||||
enum iter_type {
|
||||
ITER_UBUF,
|
||||
ITER_IOVEC,
|
||||
ITER_BVEC,
|
||||
ITER_KVEC,
|
||||
ITER_XARRAY,
|
||||
ITER_DISCARD,
|
||||
};
|
||||
|
||||
struct iov_iter {
|
||||
u8 iter_type;
|
||||
bool nofault;
|
||||
bool data_source;
|
||||
size_t iov_offset;
|
||||
union {
|
||||
size_t count;
|
||||
};
|
||||
union {
|
||||
const struct iovec *__iov;
|
||||
const struct kvec *kvec;
|
||||
const struct bio_vec *bvec;
|
||||
struct xarray *xarray;
|
||||
void __user *ubuf;
|
||||
};
|
||||
union {
|
||||
unsigned long nr_segs;
|
||||
loff_t xarray_start;
|
||||
};
|
||||
};
|
||||
|
||||
static inline size_t iov_iter_count(const struct iov_iter *i)
|
||||
{
|
||||
return i->count;
|
||||
}
|
||||
|
||||
static inline void iov_iter_truncate(struct iov_iter *i, size_t count)
|
||||
{
|
||||
if (i->count > count)
|
||||
i->count = count;
|
||||
}
|
||||
|
||||
static inline size_t iov_iter_alignment(const struct iov_iter *i)
|
||||
{
|
||||
return 0; /* Stub - assume aligned */
|
||||
}
|
||||
|
||||
#endif /* __LINUX_UIO_H */
|
||||
57
include/linux/xattr.h
Normal file
57
include/linux/xattr.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
File: linux/xattr.h
|
||||
|
||||
Extended attributes handling.
|
||||
|
||||
Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org>
|
||||
Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
|
||||
Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_XATTR_H
|
||||
#define _LINUX_XATTR_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* XATTR namespace prefixes */
|
||||
#define XATTR_USER_PREFIX "user."
|
||||
#define XATTR_USER_PREFIX_LEN 5
|
||||
|
||||
#define XATTR_TRUSTED_PREFIX "trusted."
|
||||
#define XATTR_TRUSTED_PREFIX_LEN 8
|
||||
|
||||
#define XATTR_SECURITY_PREFIX "security."
|
||||
#define XATTR_SECURITY_PREFIX_LEN 9
|
||||
|
||||
#define XATTR_SYSTEM_PREFIX "system."
|
||||
#define XATTR_SYSTEM_PREFIX_LEN 7
|
||||
|
||||
/* Maximum size of an xattr value */
|
||||
#define XATTR_SIZE_MAX 65536
|
||||
|
||||
/* Maximum length of an xattr name */
|
||||
#define XATTR_NAME_MAX 255
|
||||
|
||||
/* Maximum size of a listxattr buffer */
|
||||
#define XATTR_LIST_MAX 65536
|
||||
|
||||
struct xattr_handler {
|
||||
const char *name;
|
||||
const char *prefix;
|
||||
int flags;
|
||||
bool (*list)(struct dentry *dentry);
|
||||
int (*get)(const struct xattr_handler *handler,
|
||||
struct dentry *dentry, struct inode *inode,
|
||||
const char *name, void *buffer, size_t size);
|
||||
int (*set)(const struct xattr_handler *handler,
|
||||
struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct inode *inode, const char *name, const void *value,
|
||||
size_t size, int flags);
|
||||
};
|
||||
|
||||
/* Common flags */
|
||||
#define XATTR_CREATE 0x1
|
||||
#define XATTR_REPLACE 0x2
|
||||
|
||||
#endif /* _LINUX_XATTR_H */
|
||||
19
include/trace/events/ext4.h
Normal file
19
include/trace/events/ext4.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _TRACE_EXT4_H
|
||||
#define _TRACE_EXT4_H
|
||||
|
||||
/* Trace stubs - empty macros for all ext4 trace points */
|
||||
#define trace_ext4_es_find_extent_range_enter(...) do { } while (0)
|
||||
#define trace_ext4_es_find_extent_range_exit(...) do { } while (0)
|
||||
#define trace_ext4_es_insert_extent(...) do { } while (0)
|
||||
#define trace_ext4_es_cache_extent(...) do { } while (0)
|
||||
#define trace_ext4_es_lookup_extent_enter(...) do { } while (0)
|
||||
#define trace_ext4_es_lookup_extent_exit(...) do { } while (0)
|
||||
#define trace_ext4_es_remove_extent(...) do { } while (0)
|
||||
#define trace_ext4_es_shrink(...) do { } while (0)
|
||||
#define trace_ext4_es_shrink_count(...) do { } while (0)
|
||||
#define trace_ext4_es_shrink_scan_enter(...) do { } while (0)
|
||||
#define trace_ext4_es_shrink_scan_exit(...) do { } while (0)
|
||||
#define trace_ext4_es_insert_delayed_extent(...) do { } while (0)
|
||||
|
||||
#endif /* _TRACE_EXT4_H */
|
||||
Reference in New Issue
Block a user