linux/include/uapi/linux/fsmap.h

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 * FS_IOC_GETFSMAP ioctl infrastructure.
 *
 * Copyright (C) 2017 Oracle.  All Rights Reserved.
 *
 * Author: Darrick J. Wong <[email protected]>
 */
#ifndef _LINUX_FSMAP_H
#define _LINUX_FSMAP_H

#include <linux/types.h>

/*
 *	Structure for FS_IOC_GETFSMAP.
 *
 *	The memory layout for this call are the scalar values defined in
 *	struct fsmap_head, followed by two struct fsmap that describe
 *	the lower and upper bound of mappings to return, followed by an
 *	array of struct fsmap mappings.
 *
 *	fmh_iflags control the output of the call, whereas fmh_oflags report
 *	on the overall record output.  fmh_count should be set to the
 *	length of the fmh_recs array, and fmh_entries will be set to the
 *	number of entries filled out during each call.  If fmh_count is
 *	zero, the number of reverse mappings will be returned in
 *	fmh_entries, though no mappings will be returned.  fmh_reserved
 *	must be set to zero.
 *
 *	The two elements in the fmh_keys array are used to constrain the
 *	output.  The first element in the array should represent the
 *	lowest disk mapping ("low key") that the user wants to learn
 *	about.  If this value is all zeroes, the filesystem will return
 *	the first entry it knows about.  For a subsequent call, the
 *	contents of fsmap_head.fmh_recs[fsmap_head.fmh_count - 1] should be
 *	copied into fmh_keys[0] to have the kernel start where it left off.
 *
 *	The second element in the fmh_keys array should represent the
 *	highest disk mapping ("high key") that the user wants to learn
 *	about.  If this value is all ones, the filesystem will not stop
 *	until it runs out of mapping to return or runs out of space in
 *	fmh_recs.
 *
 *	fmr_device can be either a 32-bit cookie representing a device, or
 *	a 32-bit dev_t if the FMH_OF_DEV_T flag is set.  fmr_physical,
 *	fmr_offset, and fmr_length are expressed in units of bytes.
 *	fmr_owner is either an inode number, or a special value if
 *	FMR_OF_SPECIAL_OWNER is set in fmr_flags.
 */
struct fsmap {};

struct fsmap_head {};

/* Size of an fsmap_head with room for nr records. */
static inline __kernel_size_t
fsmap_sizeof(
	unsigned int	nr)
{}

/* Start the next fsmap query at the end of the current query results. */
static inline void
fsmap_advance(
	struct fsmap_head	*head)
{}

/*	fmh_iflags values - set by FS_IOC_GETFSMAP caller in the header. */
/* no flags defined yet */
#define FMH_IF_VALID

/*	fmh_oflags values - returned in the header segment only. */
#define FMH_OF_DEV_T

/*	fmr_flags values - returned for each non-header segment */
#define FMR_OF_PREALLOC
#define FMR_OF_ATTR_FORK
#define FMR_OF_EXTENT_MAP
#define FMR_OF_SHARED
#define FMR_OF_SPECIAL_OWNER
#define FMR_OF_LAST

/* Each FS gets to define its own special owner codes. */
#define FMR_OWNER(type, code)
#define FMR_OWNER_TYPE(owner)
#define FMR_OWNER_CODE(owner)
#define FMR_OWN_FREE
#define FMR_OWN_UNKNOWN
#define FMR_OWN_METADATA

#define FS_IOC_GETFSMAP

#endif /* _LINUX_FSMAP_H */