Files
u-boot/include/linux/cred.h
Simon Glass 66a84bd92f ext4l: Add some stub headers for Linux code
Add stub headers for Linux kernel interfaces that ext4 code expects:

- capability.h: stub capability checks (always return true)
- cred.h: stub credential types and macros
- file.h: stub file descriptor helpers
- path.h: basic path structure definition
- security.h: stub LSM hooks (no-ops)
- seq_file.h: stub seq_file interface

These provide minimal definitions to allow ext4 code to compile.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-17 14:01:22 +00:00

54 lines
1.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
/* Credentials management - see Documentation/security/credentials.rst
*
* Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*/
#ifndef _LINUX_CRED_H
#define _LINUX_CRED_H
#include <linux/types.h>
/*
* Stub definitions for Linux kernel credentials.
* U-Boot doesn't implement user credentials.
*/
typedef struct {
uid_t val;
} kuid_t;
typedef struct {
gid_t val;
} kgid_t;
struct cred {
kuid_t uid;
kgid_t gid;
kuid_t fsuid;
kgid_t fsgid;
};
#define current_cred() NULL
#define current_uid() ((kuid_t){0})
#define current_gid() ((kgid_t){0})
#define current_fsuid() ((kuid_t){0})
#define current_fsgid() ((kgid_t){0})
#define from_kuid(ns, uid) ((uid).val)
#define from_kgid(ns, gid) ((gid).val)
#define make_kuid(ns, uid) ((kuid_t){uid})
#define make_kgid(ns, gid) ((kgid_t){gid})
#define uid_eq(a, b) ((a).val == (b).val)
#define gid_eq(a, b) ((a).val == (b).val)
#define uid_valid(uid) ((uid).val != (uid_t)-1)
#define gid_valid(gid) ((gid).val != (gid_t)-1)
#define GLOBAL_ROOT_UID ((kuid_t){0})
#define GLOBAL_ROOT_GID ((kgid_t){0})
#define INVALID_UID ((kuid_t){-1})
#define INVALID_GID ((kgid_t){-1})
#endif /* _LINUX_CRED_H */