forked from kusumi/openbsd_hammer2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openbsd74.patch
230 lines (210 loc) · 7.09 KB
/
openbsd74.patch
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
229
230
diff --git a/distrib/sets/lists/comp/mi b/distrib/sets/lists/comp/mi
index 95b91489e..f1d225c31 100644
--- a/distrib/sets/lists/comp/mi
+++ b/distrib/sets/lists/comp/mi
@@ -914,6 +914,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 c22bd4b94..e154c2c33 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>
@@ -1257,6 +1259,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;
@@ -1319,6 +1322,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 c10d1268f..1d83ac46f 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 2a05c7cd0..d03238292 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -809,6 +809,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
@@ -1047,6 +1064,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 765b70a09..c764d3469 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 81fcbcfc3..3e94ef67f 100644
--- a/sys/sys/malloc.h
+++ b/sys/sys/malloc.h
@@ -177,7 +177,12 @@
#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_WBUF 148 /* HAMMER2 write buffer */
+#define M_HAMMER2_LZ4 149 /* HAMMER2 LZ4 */
+
+#define M_LAST 150 /* Must be last type + 1 */
#define INITKMEMNAMES { \
"free", /* 0 M_FREE */ \
@@ -307,6 +312,10 @@
NULL, /* 143 free */ \
"AGP Memory", /* 144 M_AGP */ \
"DRM", /* 145 M_DRM */ \
+ "HAMMER2", /* 146 M_HAMMER2 */ \
+ "HAMMER2 read buffer", /* 147 M_HAMMER2_RBUF */ \
+ "HAMMER2 write buffer", /* 148 M_HAMMER2_WBUF */ \
+ "HAMMER2 LZ4", /* 149 M_HAMMER2_LZ4 */ \
}
struct kmemstats {
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 27bec4f26..bbbfdbfc8 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 994ceb623..fe62b86a6 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