authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-30 14:26:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-30 14:29:11-07:00
log8635275202d4c6404a6e795f186e9aa4b260f869
tree1a3e49073becfdda450b59f595418a84dddbcc8b
parent51df63a44e6d6f78676e0d43b6723d21e1cb9235

remove linux header files that have case conflicts

similar commit from the past: c73cd05468fba4bba5762a654aacdd9d90ecd272 This also modifies tools/update-linux-headers.zig to remove these same files for next time to prevent a regression. closes #10249

9 files changed, 33 insertions(+), 172 deletions(-)

lib/libc/include/any-linux-any/linux/netfilter/xt_CONNMARK.h deleted-7
......@@ -1,7 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _XT_CONNMARK_H_target
3#define _XT_CONNMARK_H_target
4
5#include <linux/netfilter/xt_connmark.h>
6
7#endif /*_XT_CONNMARK_H_target*/
\ No newline at end of file
lib/libc/include/any-linux-any/linux/netfilter/xt_DSCP.h deleted-27
......@@ -1,27 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/* x_tables module for setting the IPv4/IPv6 DSCP field
3 *
4 * (C) 2002 Harald Welte <laforge@gnumonks.org>
5 * based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <mgm@paktronix.com>
6 * This software is distributed under GNU GPL v2, 1991
7 *
8 * See RFC2474 for a description of the DSCP field within the IP Header.
9 *
10 * xt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp
11*/
12#ifndef _XT_DSCP_TARGET_H
13#define _XT_DSCP_TARGET_H
14#include <linux/netfilter/xt_dscp.h>
15#include <linux/types.h>
16
17/* target info */
18struct xt_DSCP_info {
19 __u8 dscp;
20};
21
22struct xt_tos_target_info {
23 __u8 tos_value;
24 __u8 tos_mask;
25};
26
27#endif /* _XT_DSCP_TARGET_H */
\ No newline at end of file
lib/libc/include/any-linux-any/linux/netfilter/xt_MARK.h deleted-7
......@@ -1,7 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _XT_MARK_H_target
3#define _XT_MARK_H_target
4
5#include <linux/netfilter/xt_mark.h>
6
7#endif /*_XT_MARK_H_target */
\ No newline at end of file
lib/libc/include/any-linux-any/linux/netfilter/xt_RATEEST.h deleted-17
......@@ -1,17 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _XT_RATEEST_TARGET_H
3#define _XT_RATEEST_TARGET_H
4
5#include <linux/types.h>
6#include <linux/if.h>
7
8struct xt_rateest_target_info {
9 char name[IFNAMSIZ];
10 __s8 interval;
11 __u8 ewma_log;
12
13 /* Used internally by the kernel */
14 struct xt_rateest *est __attribute__((aligned(8)));
15};
16
17#endif /* _XT_RATEEST_TARGET_H */
\ No newline at end of file
lib/libc/include/any-linux-any/linux/netfilter/xt_TCPMSS.h deleted-13
......@@ -1,13 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _XT_TCPMSS_H
3#define _XT_TCPMSS_H
4
5#include <linux/types.h>
6
7struct xt_tcpmss_info {
8 __u16 mss;
9};
10
11#define XT_TCPMSS_CLAMP_PMTU 0xffff
12
13#endif /* _XT_TCPMSS_H */
\ No newline at end of file
lib/libc/include/any-linux-any/linux/netfilter_ipv4/ipt_ECN.h deleted-34
......@@ -1,34 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/* Header file for iptables ipt_ECN target
3 *
4 * (C) 2002 by Harald Welte <laforge@gnumonks.org>
5 *
6 * This software is distributed under GNU GPL v2, 1991
7 *
8 * ipt_ECN.h,v 1.3 2002/05/29 12:17:40 laforge Exp
9*/
10#ifndef _IPT_ECN_TARGET_H
11#define _IPT_ECN_TARGET_H
12
13#include <linux/types.h>
14#include <linux/netfilter/xt_DSCP.h>
15
16#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
17
18#define IPT_ECN_OP_SET_IP 0x01 /* set ECN bits of IPv4 header */
19#define IPT_ECN_OP_SET_ECE 0x10 /* set ECE bit of TCP header */
20#define IPT_ECN_OP_SET_CWR 0x20 /* set CWR bit of TCP header */
21
22#define IPT_ECN_OP_MASK 0xce
23
24struct ipt_ECN_info {
25 __u8 operation; /* bitset of operations */
26 __u8 ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */
27 union {
28 struct {
29 __u8 ece:1, cwr:1; /* TCP ECT bits */
30 } tcp;
31 } proto;
32};
33
34#endif /* _IPT_ECN_TARGET_H */
\ No newline at end of file
lib/libc/include/any-linux-any/linux/netfilter_ipv4/ipt_TTL.h deleted-24
......@@ -1,24 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/* TTL modification module for IP tables
3 * (C) 2000 by Harald Welte <laforge@netfilter.org> */
4
5#ifndef _IPT_TTL_H
6#define _IPT_TTL_H
7
8#include <linux/types.h>
9
10enum {
11 IPT_TTL_SET = 0,
12 IPT_TTL_INC,
13 IPT_TTL_DEC
14};
15
16#define IPT_TTL_MAXMODE IPT_TTL_DEC
17
18struct ipt_TTL_info {
19 __u8 mode;
20 __u8 ttl;
21};
22
23
24#endif
\ No newline at end of file
lib/libc/include/any-linux-any/linux/netfilter_ipv6/ip6t_HL.h deleted-25
......@@ -1,25 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/* Hop Limit modification module for ip6tables
3 * Maciej Soltysiak <solt@dns.toxicfilms.tv>
4 * Based on HW's TTL module */
5
6#ifndef _IP6T_HL_H
7#define _IP6T_HL_H
8
9#include <linux/types.h>
10
11enum {
12 IP6T_HL_SET = 0,
13 IP6T_HL_INC,
14 IP6T_HL_DEC
15};
16
17#define IP6T_HL_MAXMODE IP6T_HL_DEC
18
19struct ip6t_HL_info {
20 __u8 mode;
21 __u8 hop_limit;
22};
23
24
25#endif
\ No newline at end of file
tools/update-linux-headers.zig+33-18
......@@ -130,10 +130,10 @@ const TargetToHash = std.ArrayHashMap(DestTarget, []const u8, DestTarget.HashCon
130130const PathTable = std.StringHashMap(*TargetToHash);
131131
132132pub fn main() !void {
133 var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
134 const allocator = &arena.allocator;
135 const args = try std.process.argsAlloc(allocator);
136 var search_paths = std.ArrayList([]const u8).init(allocator);
133 var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator);
134 const arena = &arena_state.allocator;
135 const args = try std.process.argsAlloc(arena);
136 var search_paths = std.ArrayList([]const u8).init(arena);
137137 var opt_out_dir: ?[]const u8 = null;
138138
139139 var arg_i: usize = 1;
......@@ -161,8 +161,8 @@ pub fn main() !void {
161161 const out_dir = opt_out_dir orelse usageAndExit(args[0]);
162162 const generic_name = "any-linux-any";
163163
164 var path_table = PathTable.init(allocator);
165 var hash_to_contents = HashToContents.init(allocator);
164 var path_table = PathTable.init(arena);
165 var hash_to_contents = HashToContents.init(arena);
166166 var max_bytes_saved: usize = 0;
167167 var total_bytes: usize = 0;
168168
......@@ -173,10 +173,10 @@ pub fn main() !void {
173173 .arch = linux_target.arch,
174174 };
175175 search: for (search_paths.items) |search_path| {
176 const target_include_dir = try std.fs.path.join(allocator, &.{
176 const target_include_dir = try std.fs.path.join(arena, &.{
177177 search_path, linux_target.name, "include",
178178 });
179 var dir_stack = std.ArrayList([]const u8).init(allocator);
179 var dir_stack = std.ArrayList([]const u8).init(arena);
180180 try dir_stack.append(target_include_dir);
181181
182182 while (dir_stack.popOrNull()) |full_dir_name| {
......@@ -190,16 +190,16 @@ pub fn main() !void {
190190 var dir_it = dir.iterate();
191191
192192 while (try dir_it.next()) |entry| {
193 const full_path = try std.fs.path.join(allocator, &[_][]const u8{ full_dir_name, entry.name });
193 const full_path = try std.fs.path.join(arena, &[_][]const u8{ full_dir_name, entry.name });
194194 switch (entry.kind) {
195195 .Directory => try dir_stack.append(full_path),
196196 .File => {
197 const rel_path = try std.fs.path.relative(allocator, target_include_dir, full_path);
197 const rel_path = try std.fs.path.relative(arena, target_include_dir, full_path);
198198 const max_size = 2 * 1024 * 1024 * 1024;
199 const raw_bytes = try std.fs.cwd().readFileAlloc(allocator, full_path, max_size);
199 const raw_bytes = try std.fs.cwd().readFileAlloc(arena, full_path, max_size);
200200 const trimmed = std.mem.trim(u8, raw_bytes, " \r\n\t");
201201 total_bytes += raw_bytes.len;
202 const hash = try allocator.alloc(u8, 32);
202 const hash = try arena.alloc(u8, 32);
203203 hasher = Blake3.init(.{});
204204 hasher.update(rel_path);
205205 hasher.update(trimmed);
......@@ -223,8 +223,8 @@ pub fn main() !void {
223223 }
224224 const path_gop = try path_table.getOrPut(rel_path);
225225 const target_to_hash = if (path_gop.found_existing) path_gop.value_ptr.* else blk: {
226 const ptr = try allocator.create(TargetToHash);
227 ptr.* = TargetToHash.init(allocator);
226 const ptr = try arena.create(TargetToHash);
227 ptr.* = TargetToHash.init(arena);
228228 path_gop.value_ptr.* = ptr;
229229 break :blk ptr;
230230 };
......@@ -251,7 +251,7 @@ pub fn main() !void {
251251 // gets their header in a separate arch directory.
252252 var path_it = path_table.iterator();
253253 while (path_it.next()) |path_kv| {
254 var contents_list = std.ArrayList(*Contents).init(allocator);
254 var contents_list = std.ArrayList(*Contents).init(arena);
255255 {
256256 var hash_it = path_kv.value_ptr.*.iterator();
257257 while (hash_it.next()) |hash_kv| {
......@@ -263,7 +263,7 @@ pub fn main() !void {
263263 const best_contents = contents_list.popOrNull().?;
264264 if (best_contents.hit_count > 1) {
265265 // worth it to make it generic
266 const full_path = try std.fs.path.join(allocator, &[_][]const u8{ out_dir, generic_name, path_kv.key_ptr.* });
266 const full_path = try std.fs.path.join(arena, &[_][]const u8{ out_dir, generic_name, path_kv.key_ptr.* });
267267 try std.fs.cwd().makePath(std.fs.path.dirname(full_path).?);
268268 try std.fs.cwd().writeFile(full_path, best_contents.bytes);
269269 best_contents.is_generic = true;
......@@ -288,12 +288,27 @@ pub fn main() !void {
288288 .specific => |a| @tagName(a),
289289 else => @tagName(dest_target.arch),
290290 };
291 const out_subpath = try std.fmt.allocPrint(allocator, "{s}-linux-any", .{arch_name});
292 const full_path = try std.fs.path.join(allocator, &[_][]const u8{ out_dir, out_subpath, path_kv.key_ptr.* });
291 const out_subpath = try std.fmt.allocPrint(arena, "{s}-linux-any", .{arch_name});
292 const full_path = try std.fs.path.join(arena, &[_][]const u8{ out_dir, out_subpath, path_kv.key_ptr.* });
293293 try std.fs.cwd().makePath(std.fs.path.dirname(full_path).?);
294294 try std.fs.cwd().writeFile(full_path, contents.bytes);
295295 }
296296 }
297
298 const bad_files = [_][]const u8{
299 "any-linux-any/linux/netfilter/xt_CONNMARK.h",
300 "any-linux-any/linux/netfilter/xt_DSCP.h",
301 "any-linux-any/linux/netfilter/xt_MARK.h",
302 "any-linux-any/linux/netfilter/xt_RATEEST.h",
303 "any-linux-any/linux/netfilter/xt_TCPMSS.h",
304 "any-linux-any/linux/netfilter_ipv4/ipt_ECN.h",
305 "any-linux-any/linux/netfilter_ipv4/ipt_TTL.h",
306 "any-linux-any/linux/netfilter_ipv6/ip6t_HL.h",
307 };
308 for (bad_files) |bad_file| {
309 const full_path = try std.fs.path.join(arena, &[_][]const u8{ out_dir, bad_file });
310 try std.fs.cwd().deleteFile(full_path);
311 }
297312}
298313
299314fn usageAndExit(arg0: []const u8) noreturn {