17c2aad20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
27c2aad20Sopenharmony_ci#ifndef _UAPI_LINUX_FCNTL_H
37c2aad20Sopenharmony_ci#define _UAPI_LINUX_FCNTL_H
47c2aad20Sopenharmony_ci
57c2aad20Sopenharmony_ci#include <asm/fcntl.h>
67c2aad20Sopenharmony_ci#include <linux/openat2.h>
77c2aad20Sopenharmony_ci
87c2aad20Sopenharmony_ci#define F_SETLEASE	(F_LINUX_SPECIFIC_BASE + 0)
97c2aad20Sopenharmony_ci#define F_GETLEASE	(F_LINUX_SPECIFIC_BASE + 1)
107c2aad20Sopenharmony_ci
117c2aad20Sopenharmony_ci/*
127c2aad20Sopenharmony_ci * Cancel a blocking posix lock; internal use only until we expose an
137c2aad20Sopenharmony_ci * asynchronous lock api to userspace:
147c2aad20Sopenharmony_ci */
157c2aad20Sopenharmony_ci#define F_CANCELLK	(F_LINUX_SPECIFIC_BASE + 5)
167c2aad20Sopenharmony_ci
177c2aad20Sopenharmony_ci/* Create a file descriptor with FD_CLOEXEC set. */
187c2aad20Sopenharmony_ci#define F_DUPFD_CLOEXEC	(F_LINUX_SPECIFIC_BASE + 6)
197c2aad20Sopenharmony_ci
207c2aad20Sopenharmony_ci/*
217c2aad20Sopenharmony_ci * Request nofications on a directory.
227c2aad20Sopenharmony_ci * See below for events that may be notified.
237c2aad20Sopenharmony_ci */
247c2aad20Sopenharmony_ci#define F_NOTIFY	(F_LINUX_SPECIFIC_BASE+2)
257c2aad20Sopenharmony_ci
267c2aad20Sopenharmony_ci/*
277c2aad20Sopenharmony_ci * Set and get of pipe page size array
287c2aad20Sopenharmony_ci */
297c2aad20Sopenharmony_ci#define F_SETPIPE_SZ	(F_LINUX_SPECIFIC_BASE + 7)
307c2aad20Sopenharmony_ci#define F_GETPIPE_SZ	(F_LINUX_SPECIFIC_BASE + 8)
317c2aad20Sopenharmony_ci
327c2aad20Sopenharmony_ci/*
337c2aad20Sopenharmony_ci * Set/Get seals
347c2aad20Sopenharmony_ci */
357c2aad20Sopenharmony_ci#define F_ADD_SEALS	(F_LINUX_SPECIFIC_BASE + 9)
367c2aad20Sopenharmony_ci#define F_GET_SEALS	(F_LINUX_SPECIFIC_BASE + 10)
377c2aad20Sopenharmony_ci
387c2aad20Sopenharmony_ci/*
397c2aad20Sopenharmony_ci * Types of seals
407c2aad20Sopenharmony_ci */
417c2aad20Sopenharmony_ci#define F_SEAL_SEAL	0x0001	/* prevent further seals from being set */
427c2aad20Sopenharmony_ci#define F_SEAL_SHRINK	0x0002	/* prevent file from shrinking */
437c2aad20Sopenharmony_ci#define F_SEAL_GROW	0x0004	/* prevent file from growing */
447c2aad20Sopenharmony_ci#define F_SEAL_WRITE	0x0008	/* prevent writes */
457c2aad20Sopenharmony_ci#define F_SEAL_FUTURE_WRITE	0x0010  /* prevent future writes while mapped */
467c2aad20Sopenharmony_ci#define F_SEAL_EXEC	0x0020  /* prevent chmod modifying exec bits */
477c2aad20Sopenharmony_ci/* (1U << 31) is reserved for signed error codes */
487c2aad20Sopenharmony_ci
497c2aad20Sopenharmony_ci/*
507c2aad20Sopenharmony_ci * Set/Get write life time hints. {GET,SET}_RW_HINT operate on the
517c2aad20Sopenharmony_ci * underlying inode, while {GET,SET}_FILE_RW_HINT operate only on
527c2aad20Sopenharmony_ci * the specific file.
537c2aad20Sopenharmony_ci */
547c2aad20Sopenharmony_ci#define F_GET_RW_HINT		(F_LINUX_SPECIFIC_BASE + 11)
557c2aad20Sopenharmony_ci#define F_SET_RW_HINT		(F_LINUX_SPECIFIC_BASE + 12)
567c2aad20Sopenharmony_ci#define F_GET_FILE_RW_HINT	(F_LINUX_SPECIFIC_BASE + 13)
577c2aad20Sopenharmony_ci#define F_SET_FILE_RW_HINT	(F_LINUX_SPECIFIC_BASE + 14)
587c2aad20Sopenharmony_ci
597c2aad20Sopenharmony_ci/*
607c2aad20Sopenharmony_ci * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be
617c2aad20Sopenharmony_ci * used to clear any hints previously set.
627c2aad20Sopenharmony_ci */
637c2aad20Sopenharmony_ci#define RWH_WRITE_LIFE_NOT_SET	0
647c2aad20Sopenharmony_ci#define RWH_WRITE_LIFE_NONE	1
657c2aad20Sopenharmony_ci#define RWH_WRITE_LIFE_SHORT	2
667c2aad20Sopenharmony_ci#define RWH_WRITE_LIFE_MEDIUM	3
677c2aad20Sopenharmony_ci#define RWH_WRITE_LIFE_LONG	4
687c2aad20Sopenharmony_ci#define RWH_WRITE_LIFE_EXTREME	5
697c2aad20Sopenharmony_ci
707c2aad20Sopenharmony_ci/*
717c2aad20Sopenharmony_ci * The originally introduced spelling is remained from the first
727c2aad20Sopenharmony_ci * versions of the patch set that introduced the feature, see commit
737c2aad20Sopenharmony_ci * v4.13-rc1~212^2~51.
747c2aad20Sopenharmony_ci */
757c2aad20Sopenharmony_ci#define RWF_WRITE_LIFE_NOT_SET	RWH_WRITE_LIFE_NOT_SET
767c2aad20Sopenharmony_ci
777c2aad20Sopenharmony_ci/*
787c2aad20Sopenharmony_ci * Types of directory notifications that may be requested.
797c2aad20Sopenharmony_ci */
807c2aad20Sopenharmony_ci#define DN_ACCESS	0x00000001	/* File accessed */
817c2aad20Sopenharmony_ci#define DN_MODIFY	0x00000002	/* File modified */
827c2aad20Sopenharmony_ci#define DN_CREATE	0x00000004	/* File created */
837c2aad20Sopenharmony_ci#define DN_DELETE	0x00000008	/* File removed */
847c2aad20Sopenharmony_ci#define DN_RENAME	0x00000010	/* File renamed */
857c2aad20Sopenharmony_ci#define DN_ATTRIB	0x00000020	/* File changed attibutes */
867c2aad20Sopenharmony_ci#define DN_MULTISHOT	0x80000000	/* Don't remove notifier */
877c2aad20Sopenharmony_ci
887c2aad20Sopenharmony_ci/*
897c2aad20Sopenharmony_ci * The constants AT_REMOVEDIR and AT_EACCESS have the same value.  AT_EACCESS is
907c2aad20Sopenharmony_ci * meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to
917c2aad20Sopenharmony_ci * unlinkat.  The two functions do completely different things and therefore,
927c2aad20Sopenharmony_ci * the flags can be allowed to overlap.  For example, passing AT_REMOVEDIR to
937c2aad20Sopenharmony_ci * faccessat would be undefined behavior and thus treating it equivalent to
947c2aad20Sopenharmony_ci * AT_EACCESS is valid undefined behavior.
957c2aad20Sopenharmony_ci */
967c2aad20Sopenharmony_ci#define AT_FDCWD		-100    /* Special value used to indicate
977c2aad20Sopenharmony_ci                                           openat should use the current
987c2aad20Sopenharmony_ci                                           working directory. */
997c2aad20Sopenharmony_ci#define AT_SYMLINK_NOFOLLOW	0x100   /* Do not follow symbolic links.  */
1007c2aad20Sopenharmony_ci#define AT_EACCESS		0x200	/* Test access permitted for
1017c2aad20Sopenharmony_ci                                           effective IDs, not real IDs.  */
1027c2aad20Sopenharmony_ci#define AT_REMOVEDIR		0x200   /* Remove directory instead of
1037c2aad20Sopenharmony_ci                                           unlinking file.  */
1047c2aad20Sopenharmony_ci#define AT_SYMLINK_FOLLOW	0x400   /* Follow symbolic links.  */
1057c2aad20Sopenharmony_ci#define AT_NO_AUTOMOUNT		0x800	/* Suppress terminal automount traversal */
1067c2aad20Sopenharmony_ci#define AT_EMPTY_PATH		0x1000	/* Allow empty relative pathname */
1077c2aad20Sopenharmony_ci
1087c2aad20Sopenharmony_ci#define AT_STATX_SYNC_TYPE	0x6000	/* Type of synchronisation required from statx() */
1097c2aad20Sopenharmony_ci#define AT_STATX_SYNC_AS_STAT	0x0000	/* - Do whatever stat() does */
1107c2aad20Sopenharmony_ci#define AT_STATX_FORCE_SYNC	0x2000	/* - Force the attributes to be sync'd with the server */
1117c2aad20Sopenharmony_ci#define AT_STATX_DONT_SYNC	0x4000	/* - Don't sync attributes with the server */
1127c2aad20Sopenharmony_ci
1137c2aad20Sopenharmony_ci#define AT_RECURSIVE		0x8000	/* Apply to the entire subtree */
1147c2aad20Sopenharmony_ci
1157c2aad20Sopenharmony_ci/* Flags for name_to_handle_at(2). We reuse AT_ flag space to save bits... */
1167c2aad20Sopenharmony_ci#define AT_HANDLE_FID		AT_REMOVEDIR	/* file handle is needed to
1177c2aad20Sopenharmony_ci					compare object identity and may not
1187c2aad20Sopenharmony_ci					be usable to open_by_handle_at(2) */
1197c2aad20Sopenharmony_ci
1207c2aad20Sopenharmony_ci#endif /* _UAPI_LINUX_FCNTL_H */
121