master
h 130 lines 3.18 KB
Raw
1 /*++
2
3 Copyright (c) Microsoft. All rights reserved.
4
5 Module Name:
6
7 lxtfs.h
8
9 Abstract:
10
11 This file contains common test functions for file system tests.
12
13 --*/
14
15 #include <sys/inotify.h>
16
17 #define FS_DRVFS_PREFIX "/mnt/c"
18 #define FS_DRVFS_DRIVE "C:"
19 #define FS_DRVFS_NAME "drvfs"
20 #define FS_WSLFS_NAME "wslfs"
21 #define FS_9P_NAME "9p"
22 #define FS_VIRTIOFS_NAME "virtiofs"
23 #define INOTIFY_TEST_EVENTS_BUF_SIZE 50
24 #define INOTIFY_TEST_FILE1_NAME_ONLY "a.txt"
25 #define INOTIFY_TEST_FILE2_NAME_ONLY "b.txt"
26 #define INOTIFY_TEST_FILE3_NAME_ONLY "c.txt"
27 #define INOTIFY_TEST_FILE1_SLINK_NAME_ONLY "as.txt"
28 #define INOTIFY_TEST_FILE1_HLINK_NAME_ONLY "ah.txt"
29 #define LXT_XATTR_CASE_SENSITIVE "system.wsl_case_sensitive"
30
31 //
32 // Flags for the utime test.
33 //
34
35 #define FS_UTIME_NT_PRECISION (0x1)
36 #define FS_UTIME_FAT (0x2)
37 #define FS_UTIME_NO_SYMLINKS (0x4)
38
39 //
40 // Flags for the getdents alignment test.
41 //
42
43 #define FS_TEST_GETDENTS64 (0x1)
44
45 //
46 // Flags for the timestamp test.
47 //
48
49 #define FS_TIMESTAMP_NOATIME (0x1)
50
51 //
52 // Flags for the delete tests.
53 //
54
55 #define FS_DELETE_DRVFS (0x1)
56
57 #define FS_IS_PLAN9_CACHED() ((g_LxtFsInfo.FsType == LxtFsTypePlan9) && (g_LxtFsInfo.Flags.Cached != 0))
58
59 typedef enum _LXT_FS_TYPE
60 {
61 LxtFsTypeLxFs,
62 LxtFsTypeWslFs,
63 LxtFsTypeDrvFs,
64 LxtFsTypePlan9,
65 LxtFsTypeVirtioFs
66 } LXT_FS_TYPE,
67 *PLXT_FS_TYPE;
68
69 typedef struct _LXT_FS_INFO
70 {
71 LXT_FS_TYPE FsType;
72 union
73 {
74 struct
75 {
76 int DrvFsBehavior : 1;
77 int Cached : 1;
78 int VirtIo : 1;
79 int Dax : 1;
80 };
81
82 int AllFlags;
83 } Flags;
84 } LXT_FS_INFO, *PLXT_FS_INFO;
85
86 int LxtFsCheckDrvFsMount(const char* Source, const char* Target, const char* Options, int ParentId, const char* MountRoot);
87
88 int LxtFsCreateTestDir(char* Directory);
89
90 int LxtFsDeleteCurrentWorkingDirectoryCommon(char* BaseDir, int Flags);
91
92 int LxtFsDeleteOpenFileCommon(char* BaseDir, int Flags);
93
94 int LxtFsDeleteLoopCommon(const char* BaseDir);
95
96 int LxtFsGetDentsAlignmentCommon(const char* BaseDir, int Flags);
97
98 int LxtFsGetFsInfo(const char* Path, PLXT_FS_INFO Info);
99
100 int LxtFsInotifyEpollCommon(char* BaseDir);
101
102 int LxtFsInotifyPosixUnlinkRenameCommon(char* BaseDir);
103
104 int LxtFsInotifyReadAndProcess(int Id, char* ReadBuf, int ReadBufSize, struct inotify_event** Events, int NumEventsIn, int* NumEventsOut, int IgnoreAttribModify);
105
106 int LxtFsInotifyUnmountBindCommon(char* BaseDir);
107
108 int LxtFsMountDrvFs(const char* Source, const char* Target, const char* Options);
109
110 int LxtFsRenameAtCommon(int DirFd1, int DirFd2);
111
112 int LxtFsRenameDirCommon(char* BaseDir);
113
114 void LxtFsTestCleanup(const char* TestDir, const char* DrvFsDir, bool UseDrvFs);
115
116 int LxtFsTestSetup(PLXT_ARGS Args, const char* TestDir, const char* DrvFsDir, bool UseDrvFs);
117
118 int LxtFsTimestampCommon(const char* BaseDir, int Flags);
119
120 int LxtFsUtimeBasicCommon(const char* BaseDir, int Flags);
121
122 void LxtFsUtimeCleanupTestFiles(const char* BaseDir);
123
124 int LxtFsUtimeCreateTestFiles(const char* BaseDir, int Flags);
125
126 int LxtFsWritevCommon(char* TestFile);
127
128 int LxtFsDirSeekCommon(const char* BaseDir);
129
130 extern LXT_FS_INFO g_LxtFsInfo;