xref: /freebsd/sys/contrib/openzfs/tests/zfs-tests/cmd/linux_dos_attributes/dos_attributes.h (revision 716fd348e01c5f2ba125f878a634a753436c2994)
1 // SPDX-License-Identifier: 0BSD
2 
3 #include <inttypes.h>
4 
5 
6 #define	U_APPEND_SHORT		"uappnd"
7 #define	U_APPEND_FULL		"uappend"
8 #define	SU_APPEND_SHORT		"sappnd"
9 #define	SU_APPEND_FULL		"sappend"
10 
11 #define	U_ARCH_SHORT		"uarch"
12 #define	U_ARCH_FULL		"uarchive"
13 #define	SU_ARCH_SHORT		"arch"
14 #define	SU_ARCH_FULL		"archived"
15 
16 #define	U_HIDDEN_SHORT		"hidden"
17 #define	U_HIDDEN_FULL		"uhidden"
18 
19 #define	SU_IMMUTABLE_FULL	"simmutable"
20 #define	SU_IMMUTABLE_SHORT	"schange"
21 #define	SU_IMMUTABLE		"schg"
22 #define	U_IMMUTABLE_FULL	"uimmutable"
23 #define	U_IMMUTABLE_SHORT	"uchange"
24 #define	U_IMMUTABLE		"uchg"
25 
26 #define	SU_NODUMP		"nodump"
27 #define	UNSET_NODUMP		"dump"
28 
29 #define	U_UNLINK_SHORT		"uunlnk"
30 #define	U_UNLINK_FULL		"uunlink"
31 #define	SU_UNLINK_SHORT		"sunlnk"
32 #define	SU_UNLINK_FULL		"sunlink"
33 
34 #define	U_OFFLINE_SHORT		"offline"
35 #define	U_OFFLINE_FULL		"uoffline"
36 
37 #define	U_RDONLY		"rdonly"
38 #define	U_RDONLY_SHORT		"urdonly"
39 #define	U_RDONLY_FULL		"readonly"
40 
41 #define	U_REPARSE_SHORT		"reparse"
42 #define	U_REPARSE_FULL		"ureparse"
43 
44 #define	U_SPARSE_SHORT		"sparse"
45 #define	U_SPARSE_FULL		"usparse"
46 
47 #define	U_SYSTEM_SHORT		"system"
48 #define	U_SYSTEM_FULL		"usystem"
49 
50 
51 static const uint64_t all_dos_attributes[] = {
52 	ZFS_ARCHIVE,
53 	ZFS_APPENDONLY,
54 	ZFS_IMMUTABLE,
55 	ZFS_NOUNLINK,
56 	ZFS_NODUMP,
57 	ZFS_HIDDEN,
58 	ZFS_OFFLINE,
59 	ZFS_READONLY,
60 	ZFS_SPARSE,
61 	ZFS_SYSTEM,
62 	ZFS_REPARSE,
63 };
64 
65 static const char *const all_dos_attribute_names[][7] = {
66 	{U_ARCH_SHORT, U_ARCH_FULL, SU_ARCH_SHORT, SU_ARCH_FULL},
67 	{U_APPEND_SHORT, U_APPEND_FULL, SU_APPEND_SHORT, SU_APPEND_FULL},
68 	{SU_IMMUTABLE_FULL, SU_IMMUTABLE_SHORT, SU_IMMUTABLE,
69 	    U_IMMUTABLE_FULL, U_IMMUTABLE_SHORT, U_IMMUTABLE},
70 	{U_UNLINK_SHORT, U_UNLINK_FULL, SU_UNLINK_FULL, SU_UNLINK_SHORT},
71 	{SU_NODUMP, /* UNSET_NODUMP */},
72 	{U_HIDDEN_SHORT, U_HIDDEN_FULL},
73 	{U_OFFLINE_SHORT, U_OFFLINE_FULL},
74 	{U_RDONLY, U_RDONLY_SHORT, U_RDONLY_FULL},
75 	{U_SPARSE_SHORT, U_SPARSE_FULL},
76 	{U_SYSTEM_SHORT, U_SYSTEM_FULL},
77 	{U_REPARSE_SHORT, U_REPARSE_FULL},
78 };
79 
80 _Static_assert(
81     ARRAY_SIZE(all_dos_attributes) == ARRAY_SIZE(all_dos_attribute_names),
82 	"attribute list length mismatch");
83