|
@@ -58,55 +58,48 @@ pub enum FcntlCommand {
|
|
|
SetFileRwHint = F_LINUX_SPECIFIC_BASE + 14,
|
|
|
}
|
|
|
|
|
|
-/// The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS is
|
|
|
-/// meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to
|
|
|
-/// unlinkat. The two functions do completely different things and therefore,
|
|
|
-/// the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to
|
|
|
-/// faccessat would be undefined behavior and thus treating it equivalent to
|
|
|
-/// AT_EACCESS is valid undefined behavior.
|
|
|
-#[derive(Debug, Copy, Clone, Eq, PartialEq, FromPrimitive, ToPrimitive)]
|
|
|
-#[allow(non_camel_case_types)]
|
|
|
-pub enum AtFlags {
|
|
|
- /// 特殊值,用于指示openat应使用当前工作目录。
|
|
|
- AtFdCwd = -100,
|
|
|
- /// 不要跟随符号链接。
|
|
|
- /// AT_SYMLINK_NOFOLLOW: 0x100
|
|
|
- AtSymlinkNoFollow = 0x100,
|
|
|
- /// AtEAccess: 使用有效ID进行访问测试,而不是实际ID。
|
|
|
- /// AtRemoveDir: 删除目录而不是取消链接文件。
|
|
|
- /// AT_EACCESS: 0x200
|
|
|
- /// AT_REMOVEDIR: 0x200
|
|
|
- AtEAccess_OR_AtRemoveDir = 0x200,
|
|
|
+bitflags! {
|
|
|
|
|
|
- /// 跟随符号链接。
|
|
|
- /// AT_SYMLINK_FOLLOW: 0x400
|
|
|
- AtSymlinkFollow = 0x400,
|
|
|
- /// 禁止终端自动挂载遍历。
|
|
|
- /// AT_NO_AUTOMOUNT: 0x800
|
|
|
- AtNoAutomount = 0x800,
|
|
|
- /// 允许空的相对路径名。
|
|
|
- /// AT_EMPTY_PATH: 0x1000
|
|
|
- AtEmptyPath = 0x1000,
|
|
|
- /// statx()所需的同步类型。
|
|
|
- /// AT_STATX_SYNC_TYPE: 0x6000
|
|
|
- AtStatxSyncType = 0x6000,
|
|
|
- /// 执行与stat()相同的操作。
|
|
|
- /// AT_STATX_SYNC_AS_STAT: 0x0000
|
|
|
- AtStatxSyncAsStat = 0x0000,
|
|
|
- /// 强制将属性与服务器同步。
|
|
|
- /// AT_STATX_FORCE_SYNC: 0x2000
|
|
|
- AtStatxForceSync = 0x2000,
|
|
|
- /// 不要将属性与服务器同步。
|
|
|
- /// AT_STATX_DONT_SYNC: 0x4000
|
|
|
- AtStatxDontSync = 0x4000,
|
|
|
- /// 应用于整个子树。
|
|
|
- /// AT_RECURSIVE: 0x8000
|
|
|
- AtRecursive = 0x8000,
|
|
|
-}
|
|
|
+ /// The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS is
|
|
|
+ /// meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to
|
|
|
+ /// unlinkat. The two functions do completely different things and therefore,
|
|
|
+ /// the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to
|
|
|
+ /// faccessat would be undefined behavior and thus treating it equivalent to
|
|
|
+ /// AT_EACCESS is valid undefined behavior.
|
|
|
+ pub struct AtFlags: i32 {
|
|
|
+ /// 特殊值,用于指示openat应使用当前工作目录。
|
|
|
+ const AT_FDCWD = -100;
|
|
|
+ /// 不要跟随符号链接。
|
|
|
+ const AT_SYMLINK_NOFOLLOW = 0x100;
|
|
|
+ /// AtEAccess: 使用有效ID进行访问测试,而不是实际ID。
|
|
|
+ const AT_EACCESS = 0x200;
|
|
|
+ /// AtRemoveDir: 删除目录而不是取消链接文件。
|
|
|
+ const AT_REMOVEDIR = 0x200;
|
|
|
|
|
|
-impl Into<i32> for AtFlags {
|
|
|
- fn into(self) -> i32 {
|
|
|
- self as i32
|
|
|
+ /// 跟随符号链接。
|
|
|
+ /// AT_SYMLINK_FOLLOW: 0x400
|
|
|
+ const AT_SYMLINK_FOLLOW = 0x400;
|
|
|
+ /// 禁止终端自动挂载遍历。
|
|
|
+ /// AT_NO_AUTOMOUNT: 0x800
|
|
|
+ const AT_NO_AUTOMOUNT = 0x800;
|
|
|
+ /// 允许空的相对路径名。
|
|
|
+ /// AT_EMPTY_PATH: 0x1000
|
|
|
+ const AT_EMPTY_PATH = 0x1000;
|
|
|
+ /// statx()所需的同步类型。
|
|
|
+ /// AT_STATX_SYNC_TYPE: 0x6000
|
|
|
+ const AT_STATX_SYNC_TYPE = 0x6000;
|
|
|
+ /// 执行与stat()相同的操作。
|
|
|
+ /// AT_STATX_SYNC_AS_STAT: 0x0000
|
|
|
+ const AT_STATX_SYNC_AS_STAT = 0x0000;
|
|
|
+ /// 强制将属性与服务器同步。
|
|
|
+ /// AT_STATX_FORCE_SYNC: 0x2000
|
|
|
+ const AT_STATX_FORCE_SYNC = 0x2000;
|
|
|
+ /// 不要将属性与服务器同步。
|
|
|
+ /// AT_STATX_DONT_SYNC: 0x4000
|
|
|
+ const AT_STATX_DONT_SYNC = 0x4000;
|
|
|
+ /// 应用于整个子树。
|
|
|
+ /// AT_RECURSIVE: 0x8000
|
|
|
+ const AT_RECURSIVE = 0x8000;
|
|
|
}
|
|
|
}
|
|
|
|