18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * fs/epfs/epfs.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2022 Huawei Technologies Co., Ltd.
68c2ecf20Sopenharmony_ci * Author: weilongping@huawei.com
78c2ecf20Sopenharmony_ci * Create: 2022-06-10
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#ifndef __FS_EPFS_H__
108c2ecf20Sopenharmony_ci#define __FS_EPFS_H__
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/ioctl.h>
138c2ecf20Sopenharmony_ci#include <linux/printk.h>
148c2ecf20Sopenharmony_ci#include <linux/types.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define EPFS_MAX_RANGES 127
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistruct __attribute__((__packed__)) epfs_range {
198c2ecf20Sopenharmony_ci	__u64 num;
208c2ecf20Sopenharmony_ci	__u64 reserved;
218c2ecf20Sopenharmony_ci	struct {
228c2ecf20Sopenharmony_ci		__u64 begin;
238c2ecf20Sopenharmony_ci		__u64 end;
248c2ecf20Sopenharmony_ci	} range[0];
258c2ecf20Sopenharmony_ci};
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define EPFS_IOCTL_MAGIC 0x71
288c2ecf20Sopenharmony_ci#define IOC_SET_ORIGIN_FD _IOW(EPFS_IOCTL_MAGIC, 1, __s32)
298c2ecf20Sopenharmony_ci#define IOC_SET_EPFS_RANGE _IOW(EPFS_IOCTL_MAGIC, 2, struct epfs_range)
308c2ecf20Sopenharmony_ci#define EPFS_IOCTL_MAXNR 3
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define EPFS_TAG "Epfs"
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define epfs_err(fmt, ...)						\
358c2ecf20Sopenharmony_ci	pr_err("%s:%s:%d: " fmt, EPFS_TAG, __func__, __LINE__, ##__VA_ARGS__)
368c2ecf20Sopenharmony_ci#define epfs_info(fmt, ...)						\
378c2ecf20Sopenharmony_ci	pr_info("%s:%s:%d: " fmt, EPFS_TAG, __func__, __LINE__, ##__VA_ARGS__)
388c2ecf20Sopenharmony_ci#define epfs_warn(fmt, ...)						\
398c2ecf20Sopenharmony_ci	pr_warn("%s:%s:%d: " fmt, EPFS_TAG, __func__, __LINE__, ##__VA_ARGS__)
408c2ecf20Sopenharmony_ci#define epfs_debug(fmt, ...)						\
418c2ecf20Sopenharmony_ci	pr_debug("%s:%s:%d: " fmt, EPFS_TAG, __func__, __LINE__, ##__VA_ARGS__)
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#endif // __FS_EPFS_H__
44