/*
 * SPDX-License-Identifier: BSD-3-Clause
 *
 * Copyright © 2026 Keith Packard
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above
 *    copyright notice, this list of conditions and the following
 *    disclaimer in the documentation and/or other materials provided
 *    with the distribution.
 *
 * 3. Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _LINUX_DIRENT64_STRUCT_H_
#define _LINUX_DIRENT64_STRUCT_H_

struct __kernel_dirent64 {
    __uint64_t d_ino;
    __int64_t  d_off;
    __uint16_t d_reclen;
    __uint8_t  d_type;
    __int8_t   d_name[256];
    __uint8_t  __adjust_275[1];
};

#define SIMPLE_MAP_DIRENT64(_t, _f)                    \
    do {                                               \
        (_t)->d_ino = (_f)->d_ino;                     \
        (_t)->d_off = (_f)->d_off;                     \
        (_t)->d_reclen = (_f)->d_reclen;               \
        (_t)->d_type = (_f)->d_type;                   \
        {                                              \
            unsigned __i;                              \
            for (__i = 0; i < 256; i++)                \
                (_t)->d_name[__i] = (_f)->d_name[__i]; \
        }                                              \
    } while (0)

#endif /* _LINUX_DIRENT64_STRUCT_H_ */
