forked from kusumi/openbsd_hammer2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenbsd73.patch
More file actions
228 lines (208 loc) · 6.98 KB
/
Copy pathopenbsd73.patch
File metadata and controls
228 lines (208 loc) · 6.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
diff --git a/distrib/sets/lists/comp/mi b/distrib/sets/lists/comp/mi
index 85cf42336..d6c4c4035 100644
--- a/distrib/sets/lists/comp/mi
+++ b/distrib/sets/lists/comp/mi
@@ -908,6 +908,10 @@
./usr/include/getopt.h
./usr/include/glob.h
./usr/include/grp.h
+./usr/include/hammer2
+./usr/include/hammer2/hammer2_disk.h
+./usr/include/hammer2/hammer2_ioctl.h
+./usr/include/hammer2/hammer2_mount.h
./usr/include/histedit.h
./usr/include/icdb.h
./usr/include/ifaddrs.h
diff --git a/sbin/sysctl/Makefile b/sbin/sysctl/Makefile
index 6454e1dc8..ce5e90f9c 100644
--- a/sbin/sysctl/Makefile
+++ b/sbin/sysctl/Makefile
@@ -4,6 +4,7 @@ PROG= sysctl
MAN= sysctl.8
CPPFLAGS+= -D_LIBKVM
+CPPFLAGS+= -I${.CURDIR}/../../sys # XXX
afterinstall:
ln -sf ../../sbin/sysctl ${DESTDIR}/usr/sbin
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index e7ce92199..9ac03a992 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -91,6 +91,8 @@
#include <nfs/nfsproto.h>
#include <nfs/nfs.h>
+#include <hammer2/hammer2_mount.h>
+
#include <ddb/db_var.h>
#include <ctype.h>
@@ -1250,6 +1252,7 @@ struct ctlname vfsgennames[] = CTL_VFSGENCTL_NAMES;
struct ctlname ffsname[] = FFS_NAMES;
struct ctlname nfsname[] = FS_NFS_NAMES;
struct ctlname fusefsname[] = FUSEFS_NAMES;
+struct ctlname hammer2name[] = HAMMER2_NAMES;
struct list *vfsvars;
int *vfs_typenums;
@@ -1312,6 +1315,10 @@ vfsinit(void)
vfsvars[cnt].list = fusefsname;
vfsvars[cnt].size = FUSEFS_MAXID;
}
+ if (!strcmp(vfc.vfc_name, MOUNT_HAMMER2)) {
+ vfsvars[cnt].list = hammer2name;
+ vfsvars[cnt].size = HAMMER2CTL_MAXID;
+ }
vfs_typenums[cnt] = vfc.vfc_typenum;
strlcat(&names[loc], vfc.vfc_name, sizeof names - loc);
vfsname[cnt].ctl_name = &names[loc];
diff --git a/sys/conf/GENERIC b/sys/conf/GENERIC
index f7bb589c8..5e57732c5 100644
--- a/sys/conf/GENERIC
+++ b/sys/conf/GENERIC
@@ -42,6 +42,7 @@ option MSDOSFS # MS-DOS file system
option FIFO # FIFOs; RECOMMENDED
#option TMPFS # efficient memory file system
option FUSE # FUSE
+option HAMMER2 # HAMMER2 file system
option SOCKET_SPLICE # Socket Splicing for TCP and UDP
option TCP_ECN # Explicit Congestion Notification for TCP
diff --git a/sys/conf/files b/sys/conf/files
index 661140040..2bb78275c 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -804,6 +804,23 @@ file tmpfs/tmpfs_vfsops.c tmpfs
file tmpfs/tmpfs_vnops.c tmpfs
file tmpfs/tmpfs_specops.c tmpfs
file tmpfs/tmpfs_fifoops.c tmpfs & fifo
+file hammer2/hammer2_admin.c hammer2
+file hammer2/hammer2_bulkfree.c hammer2
+file hammer2/hammer2_chain.c hammer2
+file hammer2/hammer2_cluster.c hammer2
+file hammer2/hammer2_flush.c hammer2
+file hammer2/hammer2_freemap.c hammer2
+file hammer2/hammer2_inode.c hammer2
+file hammer2/hammer2_io.c hammer2
+file hammer2/hammer2_ioctl.c hammer2
+file hammer2/hammer2_lz4.c hammer2
+file hammer2/hammer2_ondisk.c hammer2
+file hammer2/hammer2_strategy.c hammer2
+file hammer2/hammer2_subr.c hammer2
+file hammer2/hammer2_vfsops.c hammer2
+file hammer2/hammer2_vnops.c hammer2
+file hammer2/hammer2_xops.c hammer2
+file hammer2/xxhash/xxhash.c hammer2
file net/art.c
file net/bpf.c bpfilter needs-count
file net/bpf_filter.c bpfilter
@@ -1041,6 +1058,7 @@ file lib/libkern/getsn.c
file lib/libkern/random.c
file lib/libkern/explicit_bzero.c
file lib/libkern/timingsafe_bcmp.c
+file lib/libkern/icrc32.c
file lib/libkern/arch/${MACHINE_ARCH}/strchr.S | lib/libkern/strchr.c
file lib/libkern/arch/${MACHINE_ARCH}/strrchr.S | lib/libkern/strrchr.c
file lib/libkern/arch/${MACHINE_ARCH}/imax.S | lib/libkern/imax.c
diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c
index 84c00f0e4..59715d5d8 100644
--- a/sys/kern/vfs_init.c
+++ b/sys/kern/vfs_init.c
@@ -100,6 +100,11 @@ static struct vfsconf vfsconflist[] = {
{ &tmpfs_vfsops, MOUNT_TMPFS, 19, 0, MNT_LOCAL,
sizeof(struct tmpfs_args) },
#endif
+
+#ifdef HAMMER2
+ { &hammer2_vfsops, "hammer2", 20, 0, MNT_LOCAL,
+ sizeof(struct hammer2_args) },
+#endif
};
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index e6a175e9f..f3c491bf3 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -517,7 +517,8 @@ vn_ioctl(struct file *fp, u_long com, caddr_t data, struct proc *p)
} else if (com == FIONBIO || com == FIOASYNC) /* XXX */
error = 0; /* XXX */
- break;
+ if (error != ENOTTY)
+ break;
case VFIFO:
case VCHR:
diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h
index 97bf9ff60..4f8b6fd6f 100644
--- a/sys/sys/malloc.h
+++ b/sys/sys/malloc.h
@@ -177,7 +177,11 @@
#define M_DRM 145 /* Direct Rendering Manager */
-#define M_LAST 146 /* Must be last type + 1 */
+#define M_HAMMER2 146 /* HAMMER2 */
+#define M_HAMMER2_RBUF 147 /* HAMMER2 read buffer */
+#define M_HAMMER2_LZ4 148 /* HAMMER2 LZ4 */
+
+#define M_LAST 149 /* Must be last type + 1 */
#define INITKMEMNAMES { \
"free", /* 0 M_FREE */ \
@@ -307,6 +311,9 @@
NULL, /* 143 free */ \
"AGP Memory", /* 144 M_AGP */ \
"DRM", /* 145 M_DRM */ \
+ "HAMMER2", /* 146 M_HAMMER2 */ \
+ "HAMMER2 read buffer", /* 147 M_HAMMER2_RBUF */ \
+ "HAMMER2 LZ4", /* 148 M_HAMMER2_LZ4 */ \
}
struct kmemstats {
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 40c12e976..d18fa04b4 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -257,6 +257,15 @@ struct fusefs_args {
int allow_other;
};
+/*
+ * Arguments to mount HAMMER2 file systems
+ */
+struct hammer2_args {
+ char *fspec;
+ struct export_args export_info; /* network export information */
+ int hflags; /* extended hammer2 mount flags */
+};
+
/*
* file system statistics
*/
@@ -273,6 +282,7 @@ union mount_info {
struct msdosfs_args msdosfs_args;
struct ntfs_args ntfs_args;
struct tmpfs_args tmpfs_args;
+ struct hammer2_args hammer2_args;
char __align[160]; /* 64-bit alignment and room to grow */
};
@@ -325,6 +335,7 @@ struct statfs {
#define MOUNT_UDF "udf" /* UDF */
#define MOUNT_TMPFS "tmpfs" /* tmpfs */
#define MOUNT_FUSEFS "fuse" /* FUSE */
+#define MOUNT_HAMMER2 "hammer2" /* HAMMER2 */
/*
* Structure per mounted file system. Each mounted file system has an
@@ -558,6 +569,7 @@ extern const struct vfsops ntfs_vfsops;
extern const struct vfsops udf_vfsops;
extern const struct vfsops fusefs_vfsops;
extern const struct vfsops tmpfs_vfsops;
+extern const struct vfsops hammer2_vfsops;
#include <net/radix.h>
#include <sys/socket.h> /* XXX for AF_MAX */
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 30787afdd..19c4fb12f 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -67,12 +67,14 @@ enum vtagtype {
VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_MSDOSFS,
VT_PORTAL, VT_PROCFS, VT_AFS, VT_ISOFS, VT_ADOSFS,
VT_EXT2FS, VT_VFS, VT_NTFS, VT_UDF, VT_FUSEFS, VT_TMPFS,
+ VT_HAMMER2,
};
#define VTAG_NAMES \
"NON", "UFS", "NFS", "MFS", "MSDOSFS", \
"unused", "unused", "unused", "ISOFS", "unused", \
- "EXT2FS", "VFS", "NTFS", "UDF", "FUSEFS", "TMPFS"
+ "EXT2FS", "VFS", "NTFS", "UDF", "FUSEFS", "TMPFS", \
+ "HAMMER2"
/*
* Each underlying filesystem allocates its own private area and hangs