| author | |
| committer | |
| log | 8f5f8090c5a58c41bf0ae7cec282c0949f459d2f |
| tree | ddf8c6e5ed89fecb8448db30e0095045f45978f4 |
| parent | 41502c6aa53a3da31b276c23c4db74db7d04796b |
| parent | ba35eeb417e4d54ce4c559871b9330bc95afc053 |
| signature |
std: Snake-case some public facing enums16 files changed, 266 insertions(+), 262 deletions(-)
lib/std/Build/Cache.zig+3-3| ... | @@ -408,7 +408,7 @@ pub const Manifest = struct { | ... | @@ -408,7 +408,7 @@ pub const Manifest = struct { |
| 408 | if (self.cache.manifest_dir.createFile(&manifest_file_path, .{ | 408 | if (self.cache.manifest_dir.createFile(&manifest_file_path, .{ |
| 409 | .read = true, | 409 | .read = true, |
| 410 | .truncate = false, | 410 | .truncate = false, |
| 411 | .lock = .Exclusive, | 411 | .lock = .exclusive, |
| 412 | .lock_nonblocking = self.want_shared_lock, | 412 | .lock_nonblocking = self.want_shared_lock, |
| 413 | })) |manifest_file| { | 413 | })) |manifest_file| { |
| 414 | self.manifest_file = manifest_file; | 414 | self.manifest_file = manifest_file; |
| ... | @@ -418,7 +418,7 @@ pub const Manifest = struct { | ... | @@ -418,7 +418,7 @@ pub const Manifest = struct { |
| 418 | error.WouldBlock => { | 418 | error.WouldBlock => { |
| 419 | self.manifest_file = try self.cache.manifest_dir.openFile(&manifest_file_path, .{ | 419 | self.manifest_file = try self.cache.manifest_dir.openFile(&manifest_file_path, .{ |
| 420 | .mode = .read_write, | 420 | .mode = .read_write, |
| 421 | .lock = .Shared, | 421 | .lock = .shared, |
| 422 | }); | 422 | }); |
| 423 | break; | 423 | break; |
| 424 | }, | 424 | }, |
| ... | @@ -885,7 +885,7 @@ pub const Manifest = struct { | ... | @@ -885,7 +885,7 @@ pub const Manifest = struct { |
| 885 | // Here we intentionally have a period where the lock is released, in case there are | 885 | // Here we intentionally have a period where the lock is released, in case there are |
| 886 | // other processes holding a shared lock. | 886 | // other processes holding a shared lock. |
| 887 | manifest_file.unlock(); | 887 | manifest_file.unlock(); |
| 888 | try manifest_file.lock(.Exclusive); | 888 | try manifest_file.lock(.exclusive); |
| 889 | } | 889 | } |
| 890 | self.have_exclusive_lock = true; | 890 | self.have_exclusive_lock = true; |
| 891 | return true; | 891 | return true; |
lib/std/Build/Step/InstallDir.zig+2-2| ... | @@ -80,8 +80,8 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { | ... | @@ -80,8 +80,8 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 80 | const cwd = fs.cwd(); | 80 | const cwd = fs.cwd(); |
| 81 | 81 | ||
| 82 | switch (entry.kind) { | 82 | switch (entry.kind) { |
| 83 | .Directory => try cwd.makePath(dest_path), | 83 | .directory => try cwd.makePath(dest_path), |
| 84 | .File => { | 84 | .file => { |
| 85 | for (self.options.blank_extensions) |ext| { | 85 | for (self.options.blank_extensions) |ext| { |
| 86 | if (mem.endsWith(u8, entry.path, ext)) { | 86 | if (mem.endsWith(u8, entry.path, ext)) { |
| 87 | try dest_builder.truncateFile(dest_path); | 87 | try dest_builder.truncateFile(dest_path); |
lib/std/crypto/Certificate/Bundle.zig+1-1| ... | @@ -169,7 +169,7 @@ pub fn addCertsFromDir(cb: *Bundle, gpa: Allocator, iterable_dir: fs.IterableDir | ... | @@ -169,7 +169,7 @@ pub fn addCertsFromDir(cb: *Bundle, gpa: Allocator, iterable_dir: fs.IterableDir |
| 169 | var it = iterable_dir.iterate(); | 169 | var it = iterable_dir.iterate(); |
| 170 | while (try it.next()) |entry| { | 170 | while (try it.next()) |entry| { |
| 171 | switch (entry.kind) { | 171 | switch (entry.kind) { |
| 172 | .File, .SymLink => {}, | 172 | .file, .sym_link => {}, |
| 173 | else => continue, | 173 | else => continue, |
| 174 | } | 174 | } |
| 175 | 175 |
lib/std/event/loop.zig+38-38| ... | @@ -62,9 +62,9 @@ pub const Loop = struct { | ... | @@ -62,9 +62,9 @@ pub const Loop = struct { |
| 62 | pub const Overlapped = @TypeOf(overlapped_init); | 62 | pub const Overlapped = @TypeOf(overlapped_init); |
| 63 | 63 | ||
| 64 | pub const Id = enum { | 64 | pub const Id = enum { |
| 65 | Basic, | 65 | basic, |
| 66 | Stop, | 66 | stop, |
| 67 | EventFd, | 67 | event_fd, |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | pub const EventFd = switch (builtin.os.tag) { | 70 | pub const EventFd = switch (builtin.os.tag) { |
| ... | @@ -165,11 +165,11 @@ pub const Loop = struct { | ... | @@ -165,11 +165,11 @@ pub const Loop = struct { |
| 165 | .available_eventfd_resume_nodes = std.atomic.Stack(ResumeNode.EventFd).init(), | 165 | .available_eventfd_resume_nodes = std.atomic.Stack(ResumeNode.EventFd).init(), |
| 166 | .eventfd_resume_nodes = undefined, | 166 | .eventfd_resume_nodes = undefined, |
| 167 | .final_resume_node = ResumeNode{ | 167 | .final_resume_node = ResumeNode{ |
| 168 | .id = ResumeNode.Id.Stop, | 168 | .id = .stop, |
| 169 | .handle = undefined, | 169 | .handle = undefined, |
| 170 | .overlapped = ResumeNode.overlapped_init, | 170 | .overlapped = ResumeNode.overlapped_init, |
| 171 | }, | 171 | }, |
| 172 | .fs_end_request = .{ .data = .{ .msg = .end, .finish = .NoAction } }, | 172 | .fs_end_request = .{ .data = .{ .msg = .end, .finish = .no_action } }, |
| 173 | .fs_queue = std.atomic.Queue(Request).init(), | 173 | .fs_queue = std.atomic.Queue(Request).init(), |
| 174 | .fs_thread = undefined, | 174 | .fs_thread = undefined, |
| 175 | .fs_thread_wakeup = .{}, | 175 | .fs_thread_wakeup = .{}, |
| ... | @@ -224,7 +224,7 @@ pub const Loop = struct { | ... | @@ -224,7 +224,7 @@ pub const Loop = struct { |
| 224 | eventfd_node.* = std.atomic.Stack(ResumeNode.EventFd).Node{ | 224 | eventfd_node.* = std.atomic.Stack(ResumeNode.EventFd).Node{ |
| 225 | .data = ResumeNode.EventFd{ | 225 | .data = ResumeNode.EventFd{ |
| 226 | .base = ResumeNode{ | 226 | .base = ResumeNode{ |
| 227 | .id = .EventFd, | 227 | .id = .event_fd, |
| 228 | .handle = undefined, | 228 | .handle = undefined, |
| 229 | .overlapped = ResumeNode.overlapped_init, | 229 | .overlapped = ResumeNode.overlapped_init, |
| 230 | }, | 230 | }, |
| ... | @@ -282,7 +282,7 @@ pub const Loop = struct { | ... | @@ -282,7 +282,7 @@ pub const Loop = struct { |
| 282 | eventfd_node.* = std.atomic.Stack(ResumeNode.EventFd).Node{ | 282 | eventfd_node.* = std.atomic.Stack(ResumeNode.EventFd).Node{ |
| 283 | .data = ResumeNode.EventFd{ | 283 | .data = ResumeNode.EventFd{ |
| 284 | .base = ResumeNode{ | 284 | .base = ResumeNode{ |
| 285 | .id = ResumeNode.Id.EventFd, | 285 | .id = .event_fd, |
| 286 | .handle = undefined, | 286 | .handle = undefined, |
| 287 | .overlapped = ResumeNode.overlapped_init, | 287 | .overlapped = ResumeNode.overlapped_init, |
| 288 | }, | 288 | }, |
| ... | @@ -347,7 +347,7 @@ pub const Loop = struct { | ... | @@ -347,7 +347,7 @@ pub const Loop = struct { |
| 347 | eventfd_node.* = std.atomic.Stack(ResumeNode.EventFd).Node{ | 347 | eventfd_node.* = std.atomic.Stack(ResumeNode.EventFd).Node{ |
| 348 | .data = ResumeNode.EventFd{ | 348 | .data = ResumeNode.EventFd{ |
| 349 | .base = ResumeNode{ | 349 | .base = ResumeNode{ |
| 350 | .id = ResumeNode.Id.EventFd, | 350 | .id = .event_fd, |
| 351 | .handle = undefined, | 351 | .handle = undefined, |
| 352 | .overlapped = ResumeNode.overlapped_init, | 352 | .overlapped = ResumeNode.overlapped_init, |
| 353 | }, | 353 | }, |
| ... | @@ -413,7 +413,7 @@ pub const Loop = struct { | ... | @@ -413,7 +413,7 @@ pub const Loop = struct { |
| 413 | eventfd_node.* = std.atomic.Stack(ResumeNode.EventFd).Node{ | 413 | eventfd_node.* = std.atomic.Stack(ResumeNode.EventFd).Node{ |
| 414 | .data = ResumeNode.EventFd{ | 414 | .data = ResumeNode.EventFd{ |
| 415 | .base = ResumeNode{ | 415 | .base = ResumeNode{ |
| 416 | .id = ResumeNode.Id.EventFd, | 416 | .id = .event_fd, |
| 417 | .handle = undefined, | 417 | .handle = undefined, |
| 418 | .overlapped = ResumeNode.overlapped_init, | 418 | .overlapped = ResumeNode.overlapped_init, |
| 419 | }, | 419 | }, |
| ... | @@ -503,7 +503,7 @@ pub const Loop = struct { | ... | @@ -503,7 +503,7 @@ pub const Loop = struct { |
| 503 | assert(flags & os.linux.EPOLL.ONESHOT == os.linux.EPOLL.ONESHOT); | 503 | assert(flags & os.linux.EPOLL.ONESHOT == os.linux.EPOLL.ONESHOT); |
| 504 | var resume_node = ResumeNode.Basic{ | 504 | var resume_node = ResumeNode.Basic{ |
| 505 | .base = ResumeNode{ | 505 | .base = ResumeNode{ |
| 506 | .id = .Basic, | 506 | .id = .basic, |
| 507 | .handle = @frame(), | 507 | .handle = @frame(), |
| 508 | .overlapped = ResumeNode.overlapped_init, | 508 | .overlapped = ResumeNode.overlapped_init, |
| 509 | }, | 509 | }, |
| ... | @@ -590,7 +590,7 @@ pub const Loop = struct { | ... | @@ -590,7 +590,7 @@ pub const Loop = struct { |
| 590 | pub fn bsdWaitKev(self: *Loop, ident: usize, filter: i16, flags: u16) void { | 590 | pub fn bsdWaitKev(self: *Loop, ident: usize, filter: i16, flags: u16) void { |
| 591 | var resume_node = ResumeNode.Basic{ | 591 | var resume_node = ResumeNode.Basic{ |
| 592 | .base = ResumeNode{ | 592 | .base = ResumeNode{ |
| 593 | .id = ResumeNode.Id.Basic, | 593 | .id = .basic, |
| 594 | .handle = @frame(), | 594 | .handle = @frame(), |
| 595 | .overlapped = ResumeNode.overlapped_init, | 595 | .overlapped = ResumeNode.overlapped_init, |
| 596 | }, | 596 | }, |
| ... | @@ -1019,7 +1019,7 @@ pub const Loop = struct { | ... | @@ -1019,7 +1019,7 @@ pub const Loop = struct { |
| 1019 | .result = undefined, | 1019 | .result = undefined, |
| 1020 | }, | 1020 | }, |
| 1021 | }, | 1021 | }, |
| 1022 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1022 | .finish = .{ .tick_node = .{ .data = @frame() } }, |
| 1023 | }, | 1023 | }, |
| 1024 | }; | 1024 | }; |
| 1025 | suspend { | 1025 | suspend { |
| ... | @@ -1041,7 +1041,7 @@ pub const Loop = struct { | ... | @@ -1041,7 +1041,7 @@ pub const Loop = struct { |
| 1041 | .result = undefined, | 1041 | .result = undefined, |
| 1042 | }, | 1042 | }, |
| 1043 | }, | 1043 | }, |
| 1044 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1044 | .finish = .{ .tick_node = .{ .data = @frame() } }, |
| 1045 | }, | 1045 | }, |
| 1046 | }; | 1046 | }; |
| 1047 | suspend { | 1047 | suspend { |
| ... | @@ -1055,7 +1055,7 @@ pub const Loop = struct { | ... | @@ -1055,7 +1055,7 @@ pub const Loop = struct { |
| 1055 | var req_node = Request.Node{ | 1055 | var req_node = Request.Node{ |
| 1056 | .data = .{ | 1056 | .data = .{ |
| 1057 | .msg = .{ .close = .{ .fd = fd } }, | 1057 | .msg = .{ .close = .{ .fd = fd } }, |
| 1058 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1058 | .finish = .{ .tick_node = .{ .data = @frame() } }, |
| 1059 | }, | 1059 | }, |
| 1060 | }; | 1060 | }; |
| 1061 | suspend { | 1061 | suspend { |
| ... | @@ -1076,7 +1076,7 @@ pub const Loop = struct { | ... | @@ -1076,7 +1076,7 @@ pub const Loop = struct { |
| 1076 | .result = undefined, | 1076 | .result = undefined, |
| 1077 | }, | 1077 | }, |
| 1078 | }, | 1078 | }, |
| 1079 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1079 | .finish = .{ .tick_node = .{ .data = @frame() } }, |
| 1080 | }, | 1080 | }, |
| 1081 | }; | 1081 | }; |
| 1082 | suspend { | 1082 | suspend { |
| ... | @@ -1109,7 +1109,7 @@ pub const Loop = struct { | ... | @@ -1109,7 +1109,7 @@ pub const Loop = struct { |
| 1109 | .result = undefined, | 1109 | .result = undefined, |
| 1110 | }, | 1110 | }, |
| 1111 | }, | 1111 | }, |
| 1112 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1112 | .finish = .{ .tick_node = .{ .data = @frame() } }, |
| 1113 | }, | 1113 | }, |
| 1114 | }; | 1114 | }; |
| 1115 | suspend { | 1115 | suspend { |
| ... | @@ -1143,7 +1143,7 @@ pub const Loop = struct { | ... | @@ -1143,7 +1143,7 @@ pub const Loop = struct { |
| 1143 | .result = undefined, | 1143 | .result = undefined, |
| 1144 | }, | 1144 | }, |
| 1145 | }, | 1145 | }, |
| 1146 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1146 | .finish = .{ .tick_node = .{ .data = @frame() } }, |
| 1147 | }, | 1147 | }, |
| 1148 | }; | 1148 | }; |
| 1149 | suspend { | 1149 | suspend { |
| ... | @@ -1177,7 +1177,7 @@ pub const Loop = struct { | ... | @@ -1177,7 +1177,7 @@ pub const Loop = struct { |
| 1177 | .result = undefined, | 1177 | .result = undefined, |
| 1178 | }, | 1178 | }, |
| 1179 | }, | 1179 | }, |
| 1180 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1180 | .finish = .{ .tick_node = .{ .data = @frame() } }, |
| 1181 | }, | 1181 | }, |
| 1182 | }; | 1182 | }; |
| 1183 | suspend { | 1183 | suspend { |
| ... | @@ -1210,7 +1210,7 @@ pub const Loop = struct { | ... | @@ -1210,7 +1210,7 @@ pub const Loop = struct { |
| 1210 | .result = undefined, | 1210 | .result = undefined, |
| 1211 | }, | 1211 | }, |
| 1212 | }, | 1212 | }, |
| 1213 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1213 | .finish = .{ .tick_node = .{ .data = @frame() } }, |
| 1214 | }, | 1214 | }, |
| 1215 | }; | 1215 | }; |
| 1216 | suspend { | 1216 | suspend { |
| ... | @@ -1243,7 +1243,7 @@ pub const Loop = struct { | ... | @@ -1243,7 +1243,7 @@ pub const Loop = struct { |
| 1243 | .result = undefined, | 1243 | .result = undefined, |
| 1244 | }, | 1244 | }, |
| 1245 | }, | 1245 | }, |
| 1246 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1246 | .finish = .{ .tick_node = .{ .data = @frame() } }, |
| 1247 | }, | 1247 | }, |
| 1248 | }; | 1248 | }; |
| 1249 | suspend { | 1249 | suspend { |
| ... | @@ -1277,7 +1277,7 @@ pub const Loop = struct { | ... | @@ -1277,7 +1277,7 @@ pub const Loop = struct { |
| 1277 | .result = undefined, | 1277 | .result = undefined, |
| 1278 | }, | 1278 | }, |
| 1279 | }, | 1279 | }, |
| 1280 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1280 | .finish = .{ .tick_node = .{ .data = @frame() } }, |
| 1281 | }, | 1281 | }, |
| 1282 | }; | 1282 | }; |
| 1283 | suspend { | 1283 | suspend { |
| ... | @@ -1311,7 +1311,7 @@ pub const Loop = struct { | ... | @@ -1311,7 +1311,7 @@ pub const Loop = struct { |
| 1311 | .result = undefined, | 1311 | .result = undefined, |
| 1312 | }, | 1312 | }, |
| 1313 | }, | 1313 | }, |
| 1314 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1314 | .finish = .{ .tick_node = .{ .data = @frame() } }, |
| 1315 | }, | 1315 | }, |
| 1316 | }; | 1316 | }; |
| 1317 | suspend { | 1317 | suspend { |
| ... | @@ -1391,7 +1391,7 @@ pub const Loop = struct { | ... | @@ -1391,7 +1391,7 @@ pub const Loop = struct { |
| 1391 | .result = undefined, | 1391 | .result = undefined, |
| 1392 | }, | 1392 | }, |
| 1393 | }, | 1393 | }, |
| 1394 | .finish = .{ .TickNode = .{ .data = @frame() } }, | 1394 | .finish = .{ .tick_node = .{ .data = @frame() } }, |
| 1395 | }, | 1395 | }, |
| 1396 | }; | 1396 | }; |
| 1397 | suspend { | 1397 | suspend { |
| ... | @@ -1419,9 +1419,9 @@ pub const Loop = struct { | ... | @@ -1419,9 +1419,9 @@ pub const Loop = struct { |
| 1419 | const handle = resume_node.handle; | 1419 | const handle = resume_node.handle; |
| 1420 | const resume_node_id = resume_node.id; | 1420 | const resume_node_id = resume_node.id; |
| 1421 | switch (resume_node_id) { | 1421 | switch (resume_node_id) { |
| 1422 | .Basic => {}, | 1422 | .basic => {}, |
| 1423 | .Stop => return, | 1423 | .stop => return, |
| 1424 | .EventFd => { | 1424 | .event_fd => { |
| 1425 | const event_fd_node = @fieldParentPtr(ResumeNode.EventFd, "base", resume_node); | 1425 | const event_fd_node = @fieldParentPtr(ResumeNode.EventFd, "base", resume_node); |
| 1426 | event_fd_node.epoll_op = os.linux.EPOLL.CTL_MOD; | 1426 | event_fd_node.epoll_op = os.linux.EPOLL.CTL_MOD; |
| 1427 | const stack_node = @fieldParentPtr(std.atomic.Stack(ResumeNode.EventFd).Node, "data", event_fd_node); | 1427 | const stack_node = @fieldParentPtr(std.atomic.Stack(ResumeNode.EventFd).Node, "data", event_fd_node); |
| ... | @@ -1429,7 +1429,7 @@ pub const Loop = struct { | ... | @@ -1429,7 +1429,7 @@ pub const Loop = struct { |
| 1429 | }, | 1429 | }, |
| 1430 | } | 1430 | } |
| 1431 | resume handle; | 1431 | resume handle; |
| 1432 | if (resume_node_id == ResumeNode.Id.EventFd) { | 1432 | if (resume_node_id == .event_fd) { |
| 1433 | self.finishOneEvent(); | 1433 | self.finishOneEvent(); |
| 1434 | } | 1434 | } |
| 1435 | } | 1435 | } |
| ... | @@ -1443,19 +1443,19 @@ pub const Loop = struct { | ... | @@ -1443,19 +1443,19 @@ pub const Loop = struct { |
| 1443 | const handle = resume_node.handle; | 1443 | const handle = resume_node.handle; |
| 1444 | const resume_node_id = resume_node.id; | 1444 | const resume_node_id = resume_node.id; |
| 1445 | switch (resume_node_id) { | 1445 | switch (resume_node_id) { |
| 1446 | .Basic => { | 1446 | .basic => { |
| 1447 | const basic_node = @fieldParentPtr(ResumeNode.Basic, "base", resume_node); | 1447 | const basic_node = @fieldParentPtr(ResumeNode.Basic, "base", resume_node); |
| 1448 | basic_node.kev = ev; | 1448 | basic_node.kev = ev; |
| 1449 | }, | 1449 | }, |
| 1450 | .Stop => return, | 1450 | .stop => return, |
| 1451 | .EventFd => { | 1451 | .event_fd => { |
| 1452 | const event_fd_node = @fieldParentPtr(ResumeNode.EventFd, "base", resume_node); | 1452 | const event_fd_node = @fieldParentPtr(ResumeNode.EventFd, "base", resume_node); |
| 1453 | const stack_node = @fieldParentPtr(std.atomic.Stack(ResumeNode.EventFd).Node, "data", event_fd_node); | 1453 | const stack_node = @fieldParentPtr(std.atomic.Stack(ResumeNode.EventFd).Node, "data", event_fd_node); |
| 1454 | self.available_eventfd_resume_nodes.push(stack_node); | 1454 | self.available_eventfd_resume_nodes.push(stack_node); |
| 1455 | }, | 1455 | }, |
| 1456 | } | 1456 | } |
| 1457 | resume handle; | 1457 | resume handle; |
| 1458 | if (resume_node_id == ResumeNode.Id.EventFd) { | 1458 | if (resume_node_id == .event_fd) { |
| 1459 | self.finishOneEvent(); | 1459 | self.finishOneEvent(); |
| 1460 | } | 1460 | } |
| 1461 | } | 1461 | } |
| ... | @@ -1477,9 +1477,9 @@ pub const Loop = struct { | ... | @@ -1477,9 +1477,9 @@ pub const Loop = struct { |
| 1477 | const handle = resume_node.handle; | 1477 | const handle = resume_node.handle; |
| 1478 | const resume_node_id = resume_node.id; | 1478 | const resume_node_id = resume_node.id; |
| 1479 | switch (resume_node_id) { | 1479 | switch (resume_node_id) { |
| 1480 | .Basic => {}, | 1480 | .basic => {}, |
| 1481 | .Stop => return, | 1481 | .stop => return, |
| 1482 | .EventFd => { | 1482 | .event_fd => { |
| 1483 | const event_fd_node = @fieldParentPtr(ResumeNode.EventFd, "base", resume_node); | 1483 | const event_fd_node = @fieldParentPtr(ResumeNode.EventFd, "base", resume_node); |
| 1484 | const stack_node = @fieldParentPtr(std.atomic.Stack(ResumeNode.EventFd).Node, "data", event_fd_node); | 1484 | const stack_node = @fieldParentPtr(std.atomic.Stack(ResumeNode.EventFd).Node, "data", event_fd_node); |
| 1485 | self.available_eventfd_resume_nodes.push(stack_node); | 1485 | self.available_eventfd_resume_nodes.push(stack_node); |
| ... | @@ -1549,8 +1549,8 @@ pub const Loop = struct { | ... | @@ -1549,8 +1549,8 @@ pub const Loop = struct { |
| 1549 | .close => |*msg| os.close(msg.fd), | 1549 | .close => |*msg| os.close(msg.fd), |
| 1550 | } | 1550 | } |
| 1551 | switch (node.data.finish) { | 1551 | switch (node.data.finish) { |
| 1552 | .TickNode => |*tick_node| self.onNextTick(tick_node), | 1552 | .tick_node => |*tick_node| self.onNextTick(tick_node), |
| 1553 | .NoAction => {}, | 1553 | .no_action => {}, |
| 1554 | } | 1554 | } |
| 1555 | self.finishOneEvent(); | 1555 | self.finishOneEvent(); |
| 1556 | } | 1556 | } |
| ... | @@ -1586,8 +1586,8 @@ pub const Loop = struct { | ... | @@ -1586,8 +1586,8 @@ pub const Loop = struct { |
| 1586 | pub const Node = std.atomic.Queue(Request).Node; | 1586 | pub const Node = std.atomic.Queue(Request).Node; |
| 1587 | 1587 | ||
| 1588 | pub const Finish = union(enum) { | 1588 | pub const Finish = union(enum) { |
| 1589 | TickNode: Loop.NextTickNode, | 1589 | tick_node: Loop.NextTickNode, |
| 1590 | NoAction, | 1590 | no_action, |
| 1591 | }; | 1591 | }; |
| 1592 | 1592 | ||
| 1593 | pub const Msg = union(enum) { | 1593 | pub const Msg = union(enum) { |
lib/std/fmt.zig+18-18| ... | @@ -14,15 +14,15 @@ const expectFmt = std.testing.expectFmt; | ... | @@ -14,15 +14,15 @@ const expectFmt = std.testing.expectFmt; |
| 14 | pub const default_max_depth = 3; | 14 | pub const default_max_depth = 3; |
| 15 | 15 | ||
| 16 | pub const Alignment = enum { | 16 | pub const Alignment = enum { |
| 17 | Left, | 17 | left, |
| 18 | Center, | 18 | center, |
| 19 | Right, | 19 | right, |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | pub const FormatOptions = struct { | 22 | pub const FormatOptions = struct { |
| 23 | precision: ?usize = null, | 23 | precision: ?usize = null, |
| 24 | width: ?usize = null, | 24 | width: ?usize = null, |
| 25 | alignment: Alignment = .Right, | 25 | alignment: Alignment = .right, |
| 26 | fill: u8 = ' ', | 26 | fill: u8 = ' ', |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| ... | @@ -252,11 +252,11 @@ pub const Placeholder = struct { | ... | @@ -252,11 +252,11 @@ pub const Placeholder = struct { |
| 252 | else => {}, | 252 | else => {}, |
| 253 | } | 253 | } |
| 254 | break :init switch (ch) { | 254 | break :init switch (ch) { |
| 255 | '<' => .Left, | 255 | '<' => .left, |
| 256 | '^' => .Center, | 256 | '^' => .center, |
| 257 | else => .Right, | 257 | else => .right, |
| 258 | }; | 258 | }; |
| 259 | } else .Right; | 259 | } else .right; |
| 260 | 260 | ||
| 261 | // Parse the width parameter | 261 | // Parse the width parameter |
| 262 | const width = comptime parser.specifier() catch |err| | 262 | const width = comptime parser.specifier() catch |err| |
| ... | @@ -1034,18 +1034,18 @@ pub fn formatBuf( | ... | @@ -1034,18 +1034,18 @@ pub fn formatBuf( |
| 1034 | return writer.writeAll(buf); | 1034 | return writer.writeAll(buf); |
| 1035 | 1035 | ||
| 1036 | switch (options.alignment) { | 1036 | switch (options.alignment) { |
| 1037 | .Left => { | 1037 | .left => { |
| 1038 | try writer.writeAll(buf); | 1038 | try writer.writeAll(buf); |
| 1039 | try writer.writeByteNTimes(options.fill, padding); | 1039 | try writer.writeByteNTimes(options.fill, padding); |
| 1040 | }, | 1040 | }, |
| 1041 | .Center => { | 1041 | .center => { |
| 1042 | const left_padding = padding / 2; | 1042 | const left_padding = padding / 2; |
| 1043 | const right_padding = (padding + 1) / 2; | 1043 | const right_padding = (padding + 1) / 2; |
| 1044 | try writer.writeByteNTimes(options.fill, left_padding); | 1044 | try writer.writeByteNTimes(options.fill, left_padding); |
| 1045 | try writer.writeAll(buf); | 1045 | try writer.writeAll(buf); |
| 1046 | try writer.writeByteNTimes(options.fill, right_padding); | 1046 | try writer.writeByteNTimes(options.fill, right_padding); |
| 1047 | }, | 1047 | }, |
| 1048 | .Right => { | 1048 | .right => { |
| 1049 | try writer.writeByteNTimes(options.fill, padding); | 1049 | try writer.writeByteNTimes(options.fill, padding); |
| 1050 | try writer.writeAll(buf); | 1050 | try writer.writeAll(buf); |
| 1051 | }, | 1051 | }, |
| ... | @@ -1742,9 +1742,9 @@ pub fn Formatter(comptime format_fn: anytype) type { | ... | @@ -1742,9 +1742,9 @@ pub fn Formatter(comptime format_fn: anytype) type { |
| 1742 | /// See also `parseUnsigned`. | 1742 | /// See also `parseUnsigned`. |
| 1743 | pub fn parseInt(comptime T: type, buf: []const u8, radix: u8) ParseIntError!T { | 1743 | pub fn parseInt(comptime T: type, buf: []const u8, radix: u8) ParseIntError!T { |
| 1744 | if (buf.len == 0) return error.InvalidCharacter; | 1744 | if (buf.len == 0) return error.InvalidCharacter; |
| 1745 | if (buf[0] == '+') return parseWithSign(T, buf[1..], radix, .Pos); | 1745 | if (buf[0] == '+') return parseWithSign(T, buf[1..], radix, .pos); |
| 1746 | if (buf[0] == '-') return parseWithSign(T, buf[1..], radix, .Neg); | 1746 | if (buf[0] == '-') return parseWithSign(T, buf[1..], radix, .neg); |
| 1747 | return parseWithSign(T, buf, radix, .Pos); | 1747 | return parseWithSign(T, buf, radix, .pos); |
| 1748 | } | 1748 | } |
| 1749 | 1749 | ||
| 1750 | test "parseInt" { | 1750 | test "parseInt" { |
| ... | @@ -1805,7 +1805,7 @@ fn parseWithSign( | ... | @@ -1805,7 +1805,7 @@ fn parseWithSign( |
| 1805 | comptime T: type, | 1805 | comptime T: type, |
| 1806 | buf: []const u8, | 1806 | buf: []const u8, |
| 1807 | radix: u8, | 1807 | radix: u8, |
| 1808 | comptime sign: enum { Pos, Neg }, | 1808 | comptime sign: enum { pos, neg }, |
| 1809 | ) ParseIntError!T { | 1809 | ) ParseIntError!T { |
| 1810 | if (buf.len == 0) return error.InvalidCharacter; | 1810 | if (buf.len == 0) return error.InvalidCharacter; |
| 1811 | 1811 | ||
| ... | @@ -1835,8 +1835,8 @@ fn parseWithSign( | ... | @@ -1835,8 +1835,8 @@ fn parseWithSign( |
| 1835 | } | 1835 | } |
| 1836 | 1836 | ||
| 1837 | const add = switch (sign) { | 1837 | const add = switch (sign) { |
| 1838 | .Pos => math.add, | 1838 | .pos => math.add, |
| 1839 | .Neg => math.sub, | 1839 | .neg => math.sub, |
| 1840 | }; | 1840 | }; |
| 1841 | 1841 | ||
| 1842 | var x: T = 0; | 1842 | var x: T = 0; |
| ... | @@ -1866,7 +1866,7 @@ fn parseWithSign( | ... | @@ -1866,7 +1866,7 @@ fn parseWithSign( |
| 1866 | /// Ignores '_' character in `buf`. | 1866 | /// Ignores '_' character in `buf`. |
| 1867 | /// See also `parseInt`. | 1867 | /// See also `parseInt`. |
| 1868 | pub fn parseUnsigned(comptime T: type, buf: []const u8, radix: u8) ParseIntError!T { | 1868 | pub fn parseUnsigned(comptime T: type, buf: []const u8, radix: u8) ParseIntError!T { |
| 1869 | return parseWithSign(T, buf, radix, .Pos); | 1869 | return parseWithSign(T, buf, radix, .pos); |
| 1870 | } | 1870 | } |
| 1871 | 1871 | ||
| 1872 | test "parseUnsigned" { | 1872 | test "parseUnsigned" { |
lib/std/fs.zig+86-86| ... | @@ -385,16 +385,16 @@ pub const IterableDir = struct { | ... | @@ -385,16 +385,16 @@ pub const IterableDir = struct { |
| 385 | continue :start_over; | 385 | continue :start_over; |
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | const entry_kind = switch (darwin_entry.d_type) { | 388 | const entry_kind: Entry.Kind = switch (darwin_entry.d_type) { |
| 389 | os.DT.BLK => Entry.Kind.BlockDevice, | 389 | os.DT.BLK => .block_device, |
| 390 | os.DT.CHR => Entry.Kind.CharacterDevice, | 390 | os.DT.CHR => .character_device, |
| 391 | os.DT.DIR => Entry.Kind.Directory, | 391 | os.DT.DIR => .directory, |
| 392 | os.DT.FIFO => Entry.Kind.NamedPipe, | 392 | os.DT.FIFO => .named_pipe, |
| 393 | os.DT.LNK => Entry.Kind.SymLink, | 393 | os.DT.LNK => .sym_link, |
| 394 | os.DT.REG => Entry.Kind.File, | 394 | os.DT.REG => .file, |
| 395 | os.DT.SOCK => Entry.Kind.UnixDomainSocket, | 395 | os.DT.SOCK => .unix_domain_socket, |
| 396 | os.DT.WHT => Entry.Kind.Whiteout, | 396 | os.DT.WHT => .whiteout, |
| 397 | else => Entry.Kind.Unknown, | 397 | else => .unknown, |
| 398 | }; | 398 | }; |
| 399 | return Entry{ | 399 | return Entry{ |
| 400 | .name = name, | 400 | .name = name, |
| ... | @@ -442,17 +442,17 @@ pub const IterableDir = struct { | ... | @@ -442,17 +442,17 @@ pub const IterableDir = struct { |
| 442 | error.FileNotFound => unreachable, // lost the race | 442 | error.FileNotFound => unreachable, // lost the race |
| 443 | else => |e| return e, | 443 | else => |e| return e, |
| 444 | }; | 444 | }; |
| 445 | const entry_kind = switch (stat_info.mode & os.S.IFMT) { | 445 | const entry_kind: Entry.Kind = switch (stat_info.mode & os.S.IFMT) { |
| 446 | os.S.IFIFO => Entry.Kind.NamedPipe, | 446 | os.S.IFIFO => .named_pipe, |
| 447 | os.S.IFCHR => Entry.Kind.CharacterDevice, | 447 | os.S.IFCHR => .character_device, |
| 448 | os.S.IFDIR => Entry.Kind.Directory, | 448 | os.S.IFDIR => .directory, |
| 449 | os.S.IFBLK => Entry.Kind.BlockDevice, | 449 | os.S.IFBLK => .block_device, |
| 450 | os.S.IFREG => Entry.Kind.File, | 450 | os.S.IFREG => .file, |
| 451 | os.S.IFLNK => Entry.Kind.SymLink, | 451 | os.S.IFLNK => .sym_link, |
| 452 | os.S.IFSOCK => Entry.Kind.UnixDomainSocket, | 452 | os.S.IFSOCK => .unix_domain_socket, |
| 453 | os.S.IFDOOR => Entry.Kind.Door, | 453 | os.S.IFDOOR => .door, |
| 454 | os.S.IFPORT => Entry.Kind.EventPort, | 454 | os.S.IFPORT => .event_port, |
| 455 | else => Entry.Kind.Unknown, | 455 | else => .unknown, |
| 456 | }; | 456 | }; |
| 457 | return Entry{ | 457 | return Entry{ |
| 458 | .name = name, | 458 | .name = name, |
| ... | @@ -501,16 +501,16 @@ pub const IterableDir = struct { | ... | @@ -501,16 +501,16 @@ pub const IterableDir = struct { |
| 501 | continue :start_over; | 501 | continue :start_over; |
| 502 | } | 502 | } |
| 503 | 503 | ||
| 504 | const entry_kind = switch (bsd_entry.d_type) { | 504 | const entry_kind: Entry.Kind = switch (bsd_entry.d_type) { |
| 505 | os.DT.BLK => Entry.Kind.BlockDevice, | 505 | os.DT.BLK => .block_device, |
| 506 | os.DT.CHR => Entry.Kind.CharacterDevice, | 506 | os.DT.CHR => .character_device, |
| 507 | os.DT.DIR => Entry.Kind.Directory, | 507 | os.DT.DIR => .directory, |
| 508 | os.DT.FIFO => Entry.Kind.NamedPipe, | 508 | os.DT.FIFO => .named_pipe, |
| 509 | os.DT.LNK => Entry.Kind.SymLink, | 509 | os.DT.LNK => .sym_link, |
| 510 | os.DT.REG => Entry.Kind.File, | 510 | os.DT.REG => .file, |
| 511 | os.DT.SOCK => Entry.Kind.UnixDomainSocket, | 511 | os.DT.SOCK => .unix_domain_socket, |
| 512 | os.DT.WHT => Entry.Kind.Whiteout, | 512 | os.DT.WHT => .whiteout, |
| 513 | else => Entry.Kind.Unknown, | 513 | else => .unknown, |
| 514 | }; | 514 | }; |
| 515 | return Entry{ | 515 | return Entry{ |
| 516 | .name = name, | 516 | .name = name, |
| ... | @@ -595,14 +595,14 @@ pub const IterableDir = struct { | ... | @@ -595,14 +595,14 @@ pub const IterableDir = struct { |
| 595 | } | 595 | } |
| 596 | const statmode = stat_info.mode & os.S.IFMT; | 596 | const statmode = stat_info.mode & os.S.IFMT; |
| 597 | 597 | ||
| 598 | const entry_kind = switch (statmode) { | 598 | const entry_kind: Entry.Kind = switch (statmode) { |
| 599 | os.S.IFDIR => Entry.Kind.Directory, | 599 | os.S.IFDIR => .directory, |
| 600 | os.S.IFBLK => Entry.Kind.BlockDevice, | 600 | os.S.IFBLK => .block_device, |
| 601 | os.S.IFCHR => Entry.Kind.CharacterDevice, | 601 | os.S.IFCHR => .character_device, |
| 602 | os.S.IFLNK => Entry.Kind.SymLink, | 602 | os.S.IFLNK => .sym_link, |
| 603 | os.S.IFREG => Entry.Kind.File, | 603 | os.S.IFREG => .file, |
| 604 | os.S.IFIFO => Entry.Kind.NamedPipe, | 604 | os.S.IFIFO => .named_pipe, |
| 605 | else => Entry.Kind.Unknown, | 605 | else => .unknown, |
| 606 | }; | 606 | }; |
| 607 | 607 | ||
| 608 | return Entry{ | 608 | return Entry{ |
| ... | @@ -679,15 +679,15 @@ pub const IterableDir = struct { | ... | @@ -679,15 +679,15 @@ pub const IterableDir = struct { |
| 679 | continue :start_over; | 679 | continue :start_over; |
| 680 | } | 680 | } |
| 681 | 681 | ||
| 682 | const entry_kind = switch (linux_entry.d_type) { | 682 | const entry_kind: Entry.Kind = switch (linux_entry.d_type) { |
| 683 | linux.DT.BLK => Entry.Kind.BlockDevice, | 683 | linux.DT.BLK => .block_device, |
| 684 | linux.DT.CHR => Entry.Kind.CharacterDevice, | 684 | linux.DT.CHR => .character_device, |
| 685 | linux.DT.DIR => Entry.Kind.Directory, | 685 | linux.DT.DIR => .directory, |
| 686 | linux.DT.FIFO => Entry.Kind.NamedPipe, | 686 | linux.DT.FIFO => .named_pipe, |
| 687 | linux.DT.LNK => Entry.Kind.SymLink, | 687 | linux.DT.LNK => .sym_link, |
| 688 | linux.DT.REG => Entry.Kind.File, | 688 | linux.DT.REG => .file, |
| 689 | linux.DT.SOCK => Entry.Kind.UnixDomainSocket, | 689 | linux.DT.SOCK => .unix_domain_socket, |
| 690 | else => Entry.Kind.Unknown, | 690 | else => .unknown, |
| 691 | }; | 691 | }; |
| 692 | return Entry{ | 692 | return Entry{ |
| 693 | .name = name, | 693 | .name = name, |
| ... | @@ -761,11 +761,11 @@ pub const IterableDir = struct { | ... | @@ -761,11 +761,11 @@ pub const IterableDir = struct { |
| 761 | // Trust that Windows gives us valid UTF-16LE | 761 | // Trust that Windows gives us valid UTF-16LE |
| 762 | const name_utf8_len = std.unicode.utf16leToUtf8(self.name_data[0..], name_utf16le) catch unreachable; | 762 | const name_utf8_len = std.unicode.utf16leToUtf8(self.name_data[0..], name_utf16le) catch unreachable; |
| 763 | const name_utf8 = self.name_data[0..name_utf8_len]; | 763 | const name_utf8 = self.name_data[0..name_utf8_len]; |
| 764 | const kind = blk: { | 764 | const kind: Entry.Kind = blk: { |
| 765 | const attrs = dir_info.FileAttributes; | 765 | const attrs = dir_info.FileAttributes; |
| 766 | if (attrs & w.FILE_ATTRIBUTE_DIRECTORY != 0) break :blk Entry.Kind.Directory; | 766 | if (attrs & w.FILE_ATTRIBUTE_DIRECTORY != 0) break :blk .directory; |
| 767 | if (attrs & w.FILE_ATTRIBUTE_REPARSE_POINT != 0) break :blk Entry.Kind.SymLink; | 767 | if (attrs & w.FILE_ATTRIBUTE_REPARSE_POINT != 0) break :blk .sym_link; |
| 768 | break :blk Entry.Kind.File; | 768 | break :blk .file; |
| 769 | }; | 769 | }; |
| 770 | return Entry{ | 770 | return Entry{ |
| 771 | .name = name_utf8, | 771 | .name = name_utf8, |
| ... | @@ -850,14 +850,14 @@ pub const IterableDir = struct { | ... | @@ -850,14 +850,14 @@ pub const IterableDir = struct { |
| 850 | continue :start_over; | 850 | continue :start_over; |
| 851 | } | 851 | } |
| 852 | 852 | ||
| 853 | const entry_kind = switch (entry.d_type) { | 853 | const entry_kind: Entry.Kind = switch (entry.d_type) { |
| 854 | .BLOCK_DEVICE => Entry.Kind.BlockDevice, | 854 | .BLOCK_DEVICE => .block_device, |
| 855 | .CHARACTER_DEVICE => Entry.Kind.CharacterDevice, | 855 | .CHARACTER_DEVICE => .character_device, |
| 856 | .DIRECTORY => Entry.Kind.Directory, | 856 | .DIRECTORY => .directory, |
| 857 | .SYMBOLIC_LINK => Entry.Kind.SymLink, | 857 | .SYMBOLIC_LINK => .sym_link, |
| 858 | .REGULAR_FILE => Entry.Kind.File, | 858 | .REGULAR_FILE => .file, |
| 859 | .SOCKET_STREAM, .SOCKET_DGRAM => Entry.Kind.UnixDomainSocket, | 859 | .SOCKET_STREAM, .SOCKET_DGRAM => .unix_domain_socket, |
| 860 | else => Entry.Kind.Unknown, | 860 | else => .unknown, |
| 861 | }; | 861 | }; |
| 862 | return Entry{ | 862 | return Entry{ |
| 863 | .name = name, | 863 | .name = name, |
| ... | @@ -964,7 +964,7 @@ pub const IterableDir = struct { | ... | @@ -964,7 +964,7 @@ pub const IterableDir = struct { |
| 964 | dirname_len += 1; | 964 | dirname_len += 1; |
| 965 | } | 965 | } |
| 966 | try self.name_buffer.appendSlice(base.name); | 966 | try self.name_buffer.appendSlice(base.name); |
| 967 | if (base.kind == .Directory) { | 967 | if (base.kind == .directory) { |
| 968 | var new_dir = top.iter.dir.openIterableDir(base.name, .{}) catch |err| switch (err) { | 968 | var new_dir = top.iter.dir.openIterableDir(base.name, .{}) catch |err| switch (err) { |
| 969 | error.NameTooLong => unreachable, // no path sep in base.name | 969 | error.NameTooLong => unreachable, // no path sep in base.name |
| 970 | else => |e| return e, | 970 | else => |e| return e, |
| ... | @@ -1157,9 +1157,9 @@ pub const Dir = struct { | ... | @@ -1157,9 +1157,9 @@ pub const Dir = struct { |
| 1157 | else | 1157 | else |
| 1158 | 0; | 1158 | 0; |
| 1159 | os_flags |= switch (flags.lock) { | 1159 | os_flags |= switch (flags.lock) { |
| 1160 | .None => @as(u32, 0), | 1160 | .none => @as(u32, 0), |
| 1161 | .Shared => os.O.SHLOCK | nonblocking_lock_flag, | 1161 | .shared => os.O.SHLOCK | nonblocking_lock_flag, |
| 1162 | .Exclusive => os.O.EXLOCK | nonblocking_lock_flag, | 1162 | .exclusive => os.O.EXLOCK | nonblocking_lock_flag, |
| 1163 | }; | 1163 | }; |
| 1164 | } | 1164 | } |
| 1165 | if (@hasDecl(os.O, "LARGEFILE")) { | 1165 | if (@hasDecl(os.O, "LARGEFILE")) { |
| ... | @@ -1182,13 +1182,13 @@ pub const Dir = struct { | ... | @@ -1182,13 +1182,13 @@ pub const Dir = struct { |
| 1182 | // WASI doesn't have os.flock so we intetinally check OS prior to the inner if block | 1182 | // WASI doesn't have os.flock so we intetinally check OS prior to the inner if block |
| 1183 | // since it is not compiltime-known and we need to avoid undefined symbol in Wasm. | 1183 | // since it is not compiltime-known and we need to avoid undefined symbol in Wasm. |
| 1184 | if (builtin.target.os.tag != .wasi) { | 1184 | if (builtin.target.os.tag != .wasi) { |
| 1185 | if (!has_flock_open_flags and flags.lock != .None) { | 1185 | if (!has_flock_open_flags and flags.lock != .none) { |
| 1186 | // TODO: integrate async I/O | 1186 | // TODO: integrate async I/O |
| 1187 | const lock_nonblocking = if (flags.lock_nonblocking) os.LOCK.NB else @as(i32, 0); | 1187 | const lock_nonblocking = if (flags.lock_nonblocking) os.LOCK.NB else @as(i32, 0); |
| 1188 | try os.flock(fd, switch (flags.lock) { | 1188 | try os.flock(fd, switch (flags.lock) { |
| 1189 | .None => unreachable, | 1189 | .none => unreachable, |
| 1190 | .Shared => os.LOCK.SH | lock_nonblocking, | 1190 | .shared => os.LOCK.SH | lock_nonblocking, |
| 1191 | .Exclusive => os.LOCK.EX | lock_nonblocking, | 1191 | .exclusive => os.LOCK.EX | lock_nonblocking, |
| 1192 | }); | 1192 | }); |
| 1193 | } | 1193 | } |
| 1194 | } | 1194 | } |
| ... | @@ -1241,9 +1241,9 @@ pub const Dir = struct { | ... | @@ -1241,9 +1241,9 @@ pub const Dir = struct { |
| 1241 | const range_off: w.LARGE_INTEGER = 0; | 1241 | const range_off: w.LARGE_INTEGER = 0; |
| 1242 | const range_len: w.LARGE_INTEGER = 1; | 1242 | const range_len: w.LARGE_INTEGER = 1; |
| 1243 | const exclusive = switch (flags.lock) { | 1243 | const exclusive = switch (flags.lock) { |
| 1244 | .None => return file, | 1244 | .none => return file, |
| 1245 | .Shared => false, | 1245 | .shared => false, |
| 1246 | .Exclusive => true, | 1246 | .exclusive => true, |
| 1247 | }; | 1247 | }; |
| 1248 | try w.LockFile( | 1248 | try w.LockFile( |
| 1249 | file.handle, | 1249 | file.handle, |
| ... | @@ -1320,9 +1320,9 @@ pub const Dir = struct { | ... | @@ -1320,9 +1320,9 @@ pub const Dir = struct { |
| 1320 | else | 1320 | else |
| 1321 | 0; | 1321 | 0; |
| 1322 | const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) { | 1322 | const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) { |
| 1323 | .None => @as(u32, 0), | 1323 | .none => @as(u32, 0), |
| 1324 | .Shared => os.O.SHLOCK | nonblocking_lock_flag, | 1324 | .shared => os.O.SHLOCK | nonblocking_lock_flag, |
| 1325 | .Exclusive => os.O.EXLOCK | nonblocking_lock_flag, | 1325 | .exclusive => os.O.EXLOCK | nonblocking_lock_flag, |
| 1326 | } else 0; | 1326 | } else 0; |
| 1327 | 1327 | ||
| 1328 | const O_LARGEFILE = if (@hasDecl(os.O, "LARGEFILE")) os.O.LARGEFILE else 0; | 1328 | const O_LARGEFILE = if (@hasDecl(os.O, "LARGEFILE")) os.O.LARGEFILE else 0; |
| ... | @@ -1339,13 +1339,13 @@ pub const Dir = struct { | ... | @@ -1339,13 +1339,13 @@ pub const Dir = struct { |
| 1339 | // WASI doesn't have os.flock so we intetinally check OS prior to the inner if block | 1339 | // WASI doesn't have os.flock so we intetinally check OS prior to the inner if block |
| 1340 | // since it is not compiltime-known and we need to avoid undefined symbol in Wasm. | 1340 | // since it is not compiltime-known and we need to avoid undefined symbol in Wasm. |
| 1341 | if (builtin.target.os.tag != .wasi) { | 1341 | if (builtin.target.os.tag != .wasi) { |
| 1342 | if (!has_flock_open_flags and flags.lock != .None) { | 1342 | if (!has_flock_open_flags and flags.lock != .none) { |
| 1343 | // TODO: integrate async I/O | 1343 | // TODO: integrate async I/O |
| 1344 | const lock_nonblocking = if (flags.lock_nonblocking) os.LOCK.NB else @as(i32, 0); | 1344 | const lock_nonblocking = if (flags.lock_nonblocking) os.LOCK.NB else @as(i32, 0); |
| 1345 | try os.flock(fd, switch (flags.lock) { | 1345 | try os.flock(fd, switch (flags.lock) { |
| 1346 | .None => unreachable, | 1346 | .none => unreachable, |
| 1347 | .Shared => os.LOCK.SH | lock_nonblocking, | 1347 | .shared => os.LOCK.SH | lock_nonblocking, |
| 1348 | .Exclusive => os.LOCK.EX | lock_nonblocking, | 1348 | .exclusive => os.LOCK.EX | lock_nonblocking, |
| 1349 | }); | 1349 | }); |
| 1350 | } | 1350 | } |
| 1351 | } | 1351 | } |
| ... | @@ -1402,9 +1402,9 @@ pub const Dir = struct { | ... | @@ -1402,9 +1402,9 @@ pub const Dir = struct { |
| 1402 | const range_off: w.LARGE_INTEGER = 0; | 1402 | const range_off: w.LARGE_INTEGER = 0; |
| 1403 | const range_len: w.LARGE_INTEGER = 1; | 1403 | const range_len: w.LARGE_INTEGER = 1; |
| 1404 | const exclusive = switch (flags.lock) { | 1404 | const exclusive = switch (flags.lock) { |
| 1405 | .None => return file, | 1405 | .none => return file, |
| 1406 | .Shared => false, | 1406 | .shared => false, |
| 1407 | .Exclusive => true, | 1407 | .exclusive => true, |
| 1408 | }; | 1408 | }; |
| 1409 | try w.LockFile( | 1409 | try w.LockFile( |
| 1410 | file.handle, | 1410 | file.handle, |
| ... | @@ -2106,7 +2106,7 @@ pub const Dir = struct { | ... | @@ -2106,7 +2106,7 @@ pub const Dir = struct { |
| 2106 | /// this function recursively removes its entries and then tries again. | 2106 | /// this function recursively removes its entries and then tries again. |
| 2107 | /// This operation is not atomic on most file systems. | 2107 | /// This operation is not atomic on most file systems. |
| 2108 | pub fn deleteTree(self: Dir, sub_path: []const u8) DeleteTreeError!void { | 2108 | pub fn deleteTree(self: Dir, sub_path: []const u8) DeleteTreeError!void { |
| 2109 | var initial_iterable_dir = (try self.deleteTreeOpenInitialSubpath(sub_path, .File)) orelse return; | 2109 | var initial_iterable_dir = (try self.deleteTreeOpenInitialSubpath(sub_path, .file)) orelse return; |
| 2110 | 2110 | ||
| 2111 | const StackItem = struct { | 2111 | const StackItem = struct { |
| 2112 | name: []const u8, | 2112 | name: []const u8, |
| ... | @@ -2130,7 +2130,7 @@ pub const Dir = struct { | ... | @@ -2130,7 +2130,7 @@ pub const Dir = struct { |
| 2130 | process_stack: while (stack.len != 0) { | 2130 | process_stack: while (stack.len != 0) { |
| 2131 | var top = &(stack.slice()[stack.len - 1]); | 2131 | var top = &(stack.slice()[stack.len - 1]); |
| 2132 | while (try top.iter.next()) |entry| { | 2132 | while (try top.iter.next()) |entry| { |
| 2133 | var treat_as_dir = entry.kind == .Directory; | 2133 | var treat_as_dir = entry.kind == .directory; |
| 2134 | handle_entry: while (true) { | 2134 | handle_entry: while (true) { |
| 2135 | if (treat_as_dir) { | 2135 | if (treat_as_dir) { |
| 2136 | if (stack.ensureUnusedCapacity(1)) { | 2136 | if (stack.ensureUnusedCapacity(1)) { |
| ... | @@ -2291,7 +2291,7 @@ pub const Dir = struct { | ... | @@ -2291,7 +2291,7 @@ pub const Dir = struct { |
| 2291 | /// Like `deleteTree`, but only keeps one `Iterator` active at a time to minimize the function's stack size. | 2291 | /// Like `deleteTree`, but only keeps one `Iterator` active at a time to minimize the function's stack size. |
| 2292 | /// This is slower than `deleteTree` but uses less stack space. | 2292 | /// This is slower than `deleteTree` but uses less stack space. |
| 2293 | pub fn deleteTreeMinStackSize(self: Dir, sub_path: []const u8) DeleteTreeError!void { | 2293 | pub fn deleteTreeMinStackSize(self: Dir, sub_path: []const u8) DeleteTreeError!void { |
| 2294 | return self.deleteTreeMinStackSizeWithKindHint(sub_path, .File); | 2294 | return self.deleteTreeMinStackSizeWithKindHint(sub_path, .file); |
| 2295 | } | 2295 | } |
| 2296 | 2296 | ||
| 2297 | fn deleteTreeMinStackSizeWithKindHint(self: Dir, sub_path: []const u8, kind_hint: File.Kind) DeleteTreeError!void { | 2297 | fn deleteTreeMinStackSizeWithKindHint(self: Dir, sub_path: []const u8, kind_hint: File.Kind) DeleteTreeError!void { |
| ... | @@ -2316,7 +2316,7 @@ pub const Dir = struct { | ... | @@ -2316,7 +2316,7 @@ pub const Dir = struct { |
| 2316 | scan_dir: while (true) { | 2316 | scan_dir: while (true) { |
| 2317 | var dir_it = iterable_dir.iterateAssumeFirstIteration(); | 2317 | var dir_it = iterable_dir.iterateAssumeFirstIteration(); |
| 2318 | dir_it: while (try dir_it.next()) |entry| { | 2318 | dir_it: while (try dir_it.next()) |entry| { |
| 2319 | var treat_as_dir = entry.kind == .Directory; | 2319 | var treat_as_dir = entry.kind == .directory; |
| 2320 | handle_entry: while (true) { | 2320 | handle_entry: while (true) { |
| 2321 | if (treat_as_dir) { | 2321 | if (treat_as_dir) { |
| 2322 | const new_dir = iterable_dir.dir.openIterableDir(entry.name, .{ .no_follow = true }) catch |err| switch (err) { | 2322 | const new_dir = iterable_dir.dir.openIterableDir(entry.name, .{ .no_follow = true }) catch |err| switch (err) { |
| ... | @@ -2407,7 +2407,7 @@ pub const Dir = struct { | ... | @@ -2407,7 +2407,7 @@ pub const Dir = struct { |
| 2407 | fn deleteTreeOpenInitialSubpath(self: Dir, sub_path: []const u8, kind_hint: File.Kind) !?IterableDir { | 2407 | fn deleteTreeOpenInitialSubpath(self: Dir, sub_path: []const u8, kind_hint: File.Kind) !?IterableDir { |
| 2408 | return iterable_dir: { | 2408 | return iterable_dir: { |
| 2409 | // Treat as a file by default | 2409 | // Treat as a file by default |
| 2410 | var treat_as_dir = kind_hint == .Directory; | 2410 | var treat_as_dir = kind_hint == .directory; |
| 2411 | 2411 | ||
| 2412 | handle_entry: while (true) { | 2412 | handle_entry: while (true) { |
| 2413 | if (treat_as_dir) { | 2413 | if (treat_as_dir) { |
lib/std/fs/file.zig+79-75| ... | @@ -35,17 +35,17 @@ pub const File = struct { | ... | @@ -35,17 +35,17 @@ pub const File = struct { |
| 35 | pub const Gid = os.gid_t; | 35 | pub const Gid = os.gid_t; |
| 36 | 36 | ||
| 37 | pub const Kind = enum { | 37 | pub const Kind = enum { |
| 38 | BlockDevice, | 38 | block_device, |
| 39 | CharacterDevice, | 39 | character_device, |
| 40 | Directory, | 40 | directory, |
| 41 | NamedPipe, | 41 | named_pipe, |
| 42 | SymLink, | 42 | sym_link, |
| 43 | File, | 43 | file, |
| 44 | UnixDomainSocket, | 44 | unix_domain_socket, |
| 45 | Whiteout, | 45 | whiteout, |
| 46 | Door, | 46 | door, |
| 47 | EventPort, | 47 | event_port, |
| 48 | Unknown, | 48 | unknown, |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | /// This is the default mode given to POSIX operating systems for creating | 51 | /// This is the default mode given to POSIX operating systems for creating |
| ... | @@ -81,7 +81,11 @@ pub const File = struct { | ... | @@ -81,7 +81,11 @@ pub const File = struct { |
| 81 | read_write, | 81 | read_write, |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | pub const Lock = enum { None, Shared, Exclusive }; | 84 | pub const Lock = enum { |
| 85 | none, | ||
| 86 | shared, | ||
| 87 | exclusive, | ||
| 88 | }; | ||
| 85 | 89 | ||
| 86 | pub const OpenFlags = struct { | 90 | pub const OpenFlags = struct { |
| 87 | mode: OpenMode = .read_only, | 91 | mode: OpenMode = .read_only, |
| ... | @@ -110,7 +114,7 @@ pub const File = struct { | ... | @@ -110,7 +114,7 @@ pub const File = struct { |
| 110 | /// * Windows | 114 | /// * Windows |
| 111 | /// | 115 | /// |
| 112 | /// [1]: https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt | 116 | /// [1]: https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt |
| 113 | lock: Lock = .None, | 117 | lock: Lock = .none, |
| 114 | 118 | ||
| 115 | /// Sets whether or not to wait until the file is locked to return. If set to true, | 119 | /// Sets whether or not to wait until the file is locked to return. If set to true, |
| 116 | /// `error.WouldBlock` will be returned. Otherwise, the file will wait until the file | 120 | /// `error.WouldBlock` will be returned. Otherwise, the file will wait until the file |
| ... | @@ -174,7 +178,7 @@ pub const File = struct { | ... | @@ -174,7 +178,7 @@ pub const File = struct { |
| 174 | /// * Windows | 178 | /// * Windows |
| 175 | /// | 179 | /// |
| 176 | /// [1]: https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt | 180 | /// [1]: https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt |
| 177 | lock: Lock = .None, | 181 | lock: Lock = .none, |
| 178 | 182 | ||
| 179 | /// Sets whether or not to wait until the file is locked to return. If set to true, | 183 | /// Sets whether or not to wait until the file is locked to return. If set to true, |
| 180 | /// `error.WouldBlock` will be returned. Otherwise, the file will wait until the file | 184 | /// `error.WouldBlock` will be returned. Otherwise, the file will wait until the file |
| ... | @@ -329,32 +333,32 @@ pub const File = struct { | ... | @@ -329,32 +333,32 @@ pub const File = struct { |
| 329 | const mtime = st.mtime(); | 333 | const mtime = st.mtime(); |
| 330 | const ctime = st.ctime(); | 334 | const ctime = st.ctime(); |
| 331 | const kind: Kind = if (builtin.os.tag == .wasi and !builtin.link_libc) switch (st.filetype) { | 335 | const kind: Kind = if (builtin.os.tag == .wasi and !builtin.link_libc) switch (st.filetype) { |
| 332 | .BLOCK_DEVICE => Kind.BlockDevice, | 336 | .BLOCK_DEVICE => .block_device, |
| 333 | .CHARACTER_DEVICE => Kind.CharacterDevice, | 337 | .CHARACTER_DEVICE => .character_device, |
| 334 | .DIRECTORY => Kind.Directory, | 338 | .DIRECTORY => .directory, |
| 335 | .SYMBOLIC_LINK => Kind.SymLink, | 339 | .SYMBOLIC_LINK => .sym_link, |
| 336 | .REGULAR_FILE => Kind.File, | 340 | .REGULAR_FILE => .file, |
| 337 | .SOCKET_STREAM, .SOCKET_DGRAM => Kind.UnixDomainSocket, | 341 | .SOCKET_STREAM, .SOCKET_DGRAM => .unix_domain_socket, |
| 338 | else => Kind.Unknown, | 342 | else => .unknown, |
| 339 | } else blk: { | 343 | } else blk: { |
| 340 | const m = st.mode & os.S.IFMT; | 344 | const m = st.mode & os.S.IFMT; |
| 341 | switch (m) { | 345 | switch (m) { |
| 342 | os.S.IFBLK => break :blk Kind.BlockDevice, | 346 | os.S.IFBLK => break :blk .block_device, |
| 343 | os.S.IFCHR => break :blk Kind.CharacterDevice, | 347 | os.S.IFCHR => break :blk .character_device, |
| 344 | os.S.IFDIR => break :blk Kind.Directory, | 348 | os.S.IFDIR => break :blk .directory, |
| 345 | os.S.IFIFO => break :blk Kind.NamedPipe, | 349 | os.S.IFIFO => break :blk .named_pipe, |
| 346 | os.S.IFLNK => break :blk Kind.SymLink, | 350 | os.S.IFLNK => break :blk .sym_link, |
| 347 | os.S.IFREG => break :blk Kind.File, | 351 | os.S.IFREG => break :blk .file, |
| 348 | os.S.IFSOCK => break :blk Kind.UnixDomainSocket, | 352 | os.S.IFSOCK => break :blk .unix_domain_socket, |
| 349 | else => {}, | 353 | else => {}, |
| 350 | } | 354 | } |
| 351 | if (builtin.os.tag == .solaris) switch (m) { | 355 | if (builtin.os.tag == .solaris) switch (m) { |
| 352 | os.S.IFDOOR => break :blk Kind.Door, | 356 | os.S.IFDOOR => break :blk .door, |
| 353 | os.S.IFPORT => break :blk Kind.EventPort, | 357 | os.S.IFPORT => break :blk .event_port, |
| 354 | else => {}, | 358 | else => {}, |
| 355 | }; | 359 | }; |
| 356 | 360 | ||
| 357 | break :blk .Unknown; | 361 | break :blk .unknown; |
| 358 | }; | 362 | }; |
| 359 | 363 | ||
| 360 | return Stat{ | 364 | return Stat{ |
| ... | @@ -391,7 +395,7 @@ pub const File = struct { | ... | @@ -391,7 +395,7 @@ pub const File = struct { |
| 391 | .inode = info.InternalInformation.IndexNumber, | 395 | .inode = info.InternalInformation.IndexNumber, |
| 392 | .size = @bitCast(u64, info.StandardInformation.EndOfFile), | 396 | .size = @bitCast(u64, info.StandardInformation.EndOfFile), |
| 393 | .mode = 0, | 397 | .mode = 0, |
| 394 | .kind = if (info.StandardInformation.Directory == 0) .File else .Directory, | 398 | .kind = if (info.StandardInformation.Directory == 0) .file else .directory, |
| 395 | .atime = windows.fromSysTime(info.BasicInformation.LastAccessTime), | 399 | .atime = windows.fromSysTime(info.BasicInformation.LastAccessTime), |
| 396 | .mtime = windows.fromSysTime(info.BasicInformation.LastWriteTime), | 400 | .mtime = windows.fromSysTime(info.BasicInformation.LastWriteTime), |
| 397 | .ctime = windows.fromSysTime(info.BasicInformation.CreationTime), | 401 | .ctime = windows.fromSysTime(info.BasicInformation.CreationTime), |
| ... | @@ -609,7 +613,7 @@ pub const File = struct { | ... | @@ -609,7 +613,7 @@ pub const File = struct { |
| 609 | } | 613 | } |
| 610 | 614 | ||
| 611 | /// Returns the `Kind` of file. | 615 | /// Returns the `Kind` of file. |
| 612 | /// On Windows, can only return: `.File`, `.Directory`, `.SymLink` or `.Unknown` | 616 | /// On Windows, can only return: `.file`, `.directory`, `.sym_link` or `.unknown` |
| 613 | pub fn kind(self: Self) Kind { | 617 | pub fn kind(self: Self) Kind { |
| 614 | return self.inner.kind(); | 618 | return self.inner.kind(); |
| 615 | } | 619 | } |
| ... | @@ -652,35 +656,35 @@ pub const File = struct { | ... | @@ -652,35 +656,35 @@ pub const File = struct { |
| 652 | /// Returns the `Kind` of the file | 656 | /// Returns the `Kind` of the file |
| 653 | pub fn kind(self: Self) Kind { | 657 | pub fn kind(self: Self) Kind { |
| 654 | if (builtin.os.tag == .wasi and !builtin.link_libc) return switch (self.stat.filetype) { | 658 | if (builtin.os.tag == .wasi and !builtin.link_libc) return switch (self.stat.filetype) { |
| 655 | .BLOCK_DEVICE => Kind.BlockDevice, | 659 | .BLOCK_DEVICE => .block_device, |
| 656 | .CHARACTER_DEVICE => Kind.CharacterDevice, | 660 | .CHARACTER_DEVICE => .character_device, |
| 657 | .DIRECTORY => Kind.Directory, | 661 | .DIRECTORY => .directory, |
| 658 | .SYMBOLIC_LINK => Kind.SymLink, | 662 | .SYMBOLIC_LINK => .sym_link, |
| 659 | .REGULAR_FILE => Kind.File, | 663 | .REGULAR_FILE => .file, |
| 660 | .SOCKET_STREAM, .SOCKET_DGRAM => Kind.UnixDomainSocket, | 664 | .SOCKET_STREAM, .SOCKET_DGRAM => .unix_domain_socket, |
| 661 | else => Kind.Unknown, | 665 | else => .unknown, |
| 662 | }; | 666 | }; |
| 663 | 667 | ||
| 664 | const m = self.stat.mode & os.S.IFMT; | 668 | const m = self.stat.mode & os.S.IFMT; |
| 665 | 669 | ||
| 666 | switch (m) { | 670 | switch (m) { |
| 667 | os.S.IFBLK => return Kind.BlockDevice, | 671 | os.S.IFBLK => return .block_device, |
| 668 | os.S.IFCHR => return Kind.CharacterDevice, | 672 | os.S.IFCHR => return .character_device, |
| 669 | os.S.IFDIR => return Kind.Directory, | 673 | os.S.IFDIR => return .directory, |
| 670 | os.S.IFIFO => return Kind.NamedPipe, | 674 | os.S.IFIFO => return .named_pipe, |
| 671 | os.S.IFLNK => return Kind.SymLink, | 675 | os.S.IFLNK => return .sym_link, |
| 672 | os.S.IFREG => return Kind.File, | 676 | os.S.IFREG => return .file, |
| 673 | os.S.IFSOCK => return Kind.UnixDomainSocket, | 677 | os.S.IFSOCK => return .unix_domain_socket, |
| 674 | else => {}, | 678 | else => {}, |
| 675 | } | 679 | } |
| 676 | 680 | ||
| 677 | if (builtin.os.tag == .solaris) switch (m) { | 681 | if (builtin.os.tag == .solaris) switch (m) { |
| 678 | os.S.IFDOOR => return Kind.Door, | 682 | os.S.IFDOOR => return .door, |
| 679 | os.S.IFPORT => return Kind.EventPort, | 683 | os.S.IFPORT => return .event_port, |
| 680 | else => {}, | 684 | else => {}, |
| 681 | }; | 685 | }; |
| 682 | 686 | ||
| 683 | return .Unknown; | 687 | return .unknown; |
| 684 | } | 688 | } |
| 685 | 689 | ||
| 686 | /// Returns the last time the file was accessed in nanoseconds since UTC 1970-01-01 | 690 | /// Returns the last time the file was accessed in nanoseconds since UTC 1970-01-01 |
| ... | @@ -738,17 +742,17 @@ pub const File = struct { | ... | @@ -738,17 +742,17 @@ pub const File = struct { |
| 738 | const m = self.statx.mode & os.S.IFMT; | 742 | const m = self.statx.mode & os.S.IFMT; |
| 739 | 743 | ||
| 740 | switch (m) { | 744 | switch (m) { |
| 741 | os.S.IFBLK => return Kind.BlockDevice, | 745 | os.S.IFBLK => return .block_device, |
| 742 | os.S.IFCHR => return Kind.CharacterDevice, | 746 | os.S.IFCHR => return .character_device, |
| 743 | os.S.IFDIR => return Kind.Directory, | 747 | os.S.IFDIR => return .directory, |
| 744 | os.S.IFIFO => return Kind.NamedPipe, | 748 | os.S.IFIFO => return .named_pipe, |
| 745 | os.S.IFLNK => return Kind.SymLink, | 749 | os.S.IFLNK => return .sym_link, |
| 746 | os.S.IFREG => return Kind.File, | 750 | os.S.IFREG => return .file, |
| 747 | os.S.IFSOCK => return Kind.UnixDomainSocket, | 751 | os.S.IFSOCK => return .unix_domain_socket, |
| 748 | else => {}, | 752 | else => {}, |
| 749 | } | 753 | } |
| 750 | 754 | ||
| 751 | return .Unknown; | 755 | return .unknown; |
| 752 | } | 756 | } |
| 753 | 757 | ||
| 754 | /// Returns the last time the file was accessed in nanoseconds since UTC 1970-01-01 | 758 | /// Returns the last time the file was accessed in nanoseconds since UTC 1970-01-01 |
| ... | @@ -790,18 +794,18 @@ pub const File = struct { | ... | @@ -790,18 +794,18 @@ pub const File = struct { |
| 790 | } | 794 | } |
| 791 | 795 | ||
| 792 | /// Returns the `Kind` of the file. | 796 | /// Returns the `Kind` of the file. |
| 793 | /// Can only return: `.File`, `.Directory`, `.SymLink` or `.Unknown` | 797 | /// Can only return: `.file`, `.directory`, `.sym_link` or `.unknown` |
| 794 | pub fn kind(self: Self) Kind { | 798 | pub fn kind(self: Self) Kind { |
| 795 | if (self.attributes & windows.FILE_ATTRIBUTE_REPARSE_POINT != 0) { | 799 | if (self.attributes & windows.FILE_ATTRIBUTE_REPARSE_POINT != 0) { |
| 796 | if (self.reparse_tag & 0x20000000 != 0) { | 800 | if (self.reparse_tag & 0x20000000 != 0) { |
| 797 | return .SymLink; | 801 | return .sym_link; |
| 798 | } | 802 | } |
| 799 | } else if (self.attributes & windows.FILE_ATTRIBUTE_DIRECTORY != 0) { | 803 | } else if (self.attributes & windows.FILE_ATTRIBUTE_DIRECTORY != 0) { |
| 800 | return .Directory; | 804 | return .directory; |
| 801 | } else { | 805 | } else { |
| 802 | return .File; | 806 | return .file; |
| 803 | } | 807 | } |
| 804 | return .Unknown; | 808 | return .unknown; |
| 805 | } | 809 | } |
| 806 | 810 | ||
| 807 | /// Returns the last time the file was accessed in nanoseconds since UTC 1970-01-01 | 811 | /// Returns the last time the file was accessed in nanoseconds since UTC 1970-01-01 |
| ... | @@ -1465,9 +1469,9 @@ pub const File = struct { | ... | @@ -1465,9 +1469,9 @@ pub const File = struct { |
| 1465 | if (is_windows) { | 1469 | if (is_windows) { |
| 1466 | var io_status_block: windows.IO_STATUS_BLOCK = undefined; | 1470 | var io_status_block: windows.IO_STATUS_BLOCK = undefined; |
| 1467 | const exclusive = switch (l) { | 1471 | const exclusive = switch (l) { |
| 1468 | .None => return, | 1472 | .none => return, |
| 1469 | .Shared => false, | 1473 | .shared => false, |
| 1470 | .Exclusive => true, | 1474 | .exclusive => true, |
| 1471 | }; | 1475 | }; |
| 1472 | return windows.LockFile( | 1476 | return windows.LockFile( |
| 1473 | file.handle, | 1477 | file.handle, |
| ... | @@ -1486,9 +1490,9 @@ pub const File = struct { | ... | @@ -1486,9 +1490,9 @@ pub const File = struct { |
| 1486 | }; | 1490 | }; |
| 1487 | } else { | 1491 | } else { |
| 1488 | return os.flock(file.handle, switch (l) { | 1492 | return os.flock(file.handle, switch (l) { |
| 1489 | .None => os.LOCK.UN, | 1493 | .none => os.LOCK.UN, |
| 1490 | .Shared => os.LOCK.SH, | 1494 | .shared => os.LOCK.SH, |
| 1491 | .Exclusive => os.LOCK.EX, | 1495 | .exclusive => os.LOCK.EX, |
| 1492 | }) catch |err| switch (err) { | 1496 | }) catch |err| switch (err) { |
| 1493 | error.WouldBlock => unreachable, // non-blocking=false | 1497 | error.WouldBlock => unreachable, // non-blocking=false |
| 1494 | else => |e| return e, | 1498 | else => |e| return e, |
| ... | @@ -1532,9 +1536,9 @@ pub const File = struct { | ... | @@ -1532,9 +1536,9 @@ pub const File = struct { |
| 1532 | if (is_windows) { | 1536 | if (is_windows) { |
| 1533 | var io_status_block: windows.IO_STATUS_BLOCK = undefined; | 1537 | var io_status_block: windows.IO_STATUS_BLOCK = undefined; |
| 1534 | const exclusive = switch (l) { | 1538 | const exclusive = switch (l) { |
| 1535 | .None => return, | 1539 | .none => return, |
| 1536 | .Shared => false, | 1540 | .shared => false, |
| 1537 | .Exclusive => true, | 1541 | .exclusive => true, |
| 1538 | }; | 1542 | }; |
| 1539 | windows.LockFile( | 1543 | windows.LockFile( |
| 1540 | file.handle, | 1544 | file.handle, |
| ... | @@ -1553,9 +1557,9 @@ pub const File = struct { | ... | @@ -1553,9 +1557,9 @@ pub const File = struct { |
| 1553 | }; | 1557 | }; |
| 1554 | } else { | 1558 | } else { |
| 1555 | os.flock(file.handle, switch (l) { | 1559 | os.flock(file.handle, switch (l) { |
| 1556 | .None => os.LOCK.UN, | 1560 | .none => os.LOCK.UN, |
| 1557 | .Shared => os.LOCK.SH | os.LOCK.NB, | 1561 | .shared => os.LOCK.SH | os.LOCK.NB, |
| 1558 | .Exclusive => os.LOCK.EX | os.LOCK.NB, | 1562 | .exclusive => os.LOCK.EX | os.LOCK.NB, |
| 1559 | }) catch |err| switch (err) { | 1563 | }) catch |err| switch (err) { |
| 1560 | error.WouldBlock => return false, | 1564 | error.WouldBlock => return false, |
| 1561 | else => |e| return e, | 1565 | else => |e| return e, |
lib/std/fs/test.zig+21-21| ... | @@ -179,8 +179,8 @@ test "Dir.Iterator" { | ... | @@ -179,8 +179,8 @@ test "Dir.Iterator" { |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | try testing.expect(entries.items.len == 2); // note that the Iterator skips '.' and '..' | 181 | try testing.expect(entries.items.len == 2); // note that the Iterator skips '.' and '..' |
| 182 | try testing.expect(contains(&entries, .{ .name = "some_file", .kind = .File })); | 182 | try testing.expect(contains(&entries, .{ .name = "some_file", .kind = .file })); |
| 183 | try testing.expect(contains(&entries, .{ .name = "some_dir", .kind = .Directory })); | 183 | try testing.expect(contains(&entries, .{ .name = "some_dir", .kind = .directory })); |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | test "Dir.Iterator many entries" { | 186 | test "Dir.Iterator many entries" { |
| ... | @@ -214,7 +214,7 @@ test "Dir.Iterator many entries" { | ... | @@ -214,7 +214,7 @@ test "Dir.Iterator many entries" { |
| 214 | i = 0; | 214 | i = 0; |
| 215 | while (i < num) : (i += 1) { | 215 | while (i < num) : (i += 1) { |
| 216 | const name = try std.fmt.bufPrint(&buf, "{}", .{i}); | 216 | const name = try std.fmt.bufPrint(&buf, "{}", .{i}); |
| 217 | try testing.expect(contains(&entries, .{ .name = name, .kind = .File })); | 217 | try testing.expect(contains(&entries, .{ .name = name, .kind = .file })); |
| 218 | } | 218 | } |
| 219 | } | 219 | } |
| 220 | 220 | ||
| ... | @@ -246,8 +246,8 @@ test "Dir.Iterator twice" { | ... | @@ -246,8 +246,8 @@ test "Dir.Iterator twice" { |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | try testing.expect(entries.items.len == 2); // note that the Iterator skips '.' and '..' | 248 | try testing.expect(entries.items.len == 2); // note that the Iterator skips '.' and '..' |
| 249 | try testing.expect(contains(&entries, .{ .name = "some_file", .kind = .File })); | 249 | try testing.expect(contains(&entries, .{ .name = "some_file", .kind = .file })); |
| 250 | try testing.expect(contains(&entries, .{ .name = "some_dir", .kind = .Directory })); | 250 | try testing.expect(contains(&entries, .{ .name = "some_dir", .kind = .directory })); |
| 251 | } | 251 | } |
| 252 | } | 252 | } |
| 253 | 253 | ||
| ... | @@ -280,8 +280,8 @@ test "Dir.Iterator reset" { | ... | @@ -280,8 +280,8 @@ test "Dir.Iterator reset" { |
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | try testing.expect(entries.items.len == 2); // note that the Iterator skips '.' and '..' | 282 | try testing.expect(entries.items.len == 2); // note that the Iterator skips '.' and '..' |
| 283 | try testing.expect(contains(&entries, .{ .name = "some_file", .kind = .File })); | 283 | try testing.expect(contains(&entries, .{ .name = "some_file", .kind = .file })); |
| 284 | try testing.expect(contains(&entries, .{ .name = "some_dir", .kind = .Directory })); | 284 | try testing.expect(contains(&entries, .{ .name = "some_dir", .kind = .directory })); |
| 285 | 285 | ||
| 286 | iter.reset(); | 286 | iter.reset(); |
| 287 | } | 287 | } |
| ... | @@ -336,7 +336,7 @@ test "Dir.realpath smoke test" { | ... | @@ -336,7 +336,7 @@ test "Dir.realpath smoke test" { |
| 336 | var tmp_dir = tmpDir(.{}); | 336 | var tmp_dir = tmpDir(.{}); |
| 337 | defer tmp_dir.cleanup(); | 337 | defer tmp_dir.cleanup(); |
| 338 | 338 | ||
| 339 | var file = try tmp_dir.dir.createFile("test_file", .{ .lock = File.Lock.Shared }); | 339 | var file = try tmp_dir.dir.createFile("test_file", .{ .lock = .shared }); |
| 340 | // We need to close the file immediately as otherwise on Windows we'll end up | 340 | // We need to close the file immediately as otherwise on Windows we'll end up |
| 341 | // with a sharing violation. | 341 | // with a sharing violation. |
| 342 | file.close(); | 342 | file.close(); |
| ... | @@ -428,7 +428,7 @@ test "directory operations on files" { | ... | @@ -428,7 +428,7 @@ test "directory operations on files" { |
| 428 | // ensure the file still exists and is a file as a sanity check | 428 | // ensure the file still exists and is a file as a sanity check |
| 429 | file = try tmp_dir.dir.openFile(test_file_name, .{}); | 429 | file = try tmp_dir.dir.openFile(test_file_name, .{}); |
| 430 | const stat = try file.stat(); | 430 | const stat = try file.stat(); |
| 431 | try testing.expect(stat.kind == .File); | 431 | try testing.expect(stat.kind == .file); |
| 432 | file.close(); | 432 | file.close(); |
| 433 | } | 433 | } |
| 434 | 434 | ||
| ... | @@ -664,7 +664,7 @@ test "renameAbsolute" { | ... | @@ -664,7 +664,7 @@ test "renameAbsolute" { |
| 664 | try testing.expectError(error.FileNotFound, tmp_dir.dir.openFile(test_file_name, .{})); | 664 | try testing.expectError(error.FileNotFound, tmp_dir.dir.openFile(test_file_name, .{})); |
| 665 | file = try tmp_dir.dir.openFile(renamed_test_file_name, .{}); | 665 | file = try tmp_dir.dir.openFile(renamed_test_file_name, .{}); |
| 666 | const stat = try file.stat(); | 666 | const stat = try file.stat(); |
| 667 | try testing.expect(stat.kind == .File); | 667 | try testing.expect(stat.kind == .file); |
| 668 | file.close(); | 668 | file.close(); |
| 669 | 669 | ||
| 670 | // Renaming directories | 670 | // Renaming directories |
| ... | @@ -1035,10 +1035,10 @@ test "open file with exclusive nonblocking lock twice" { | ... | @@ -1035,10 +1035,10 @@ test "open file with exclusive nonblocking lock twice" { |
| 1035 | var tmp = tmpDir(.{}); | 1035 | var tmp = tmpDir(.{}); |
| 1036 | defer tmp.cleanup(); | 1036 | defer tmp.cleanup(); |
| 1037 | 1037 | ||
| 1038 | const file1 = try tmp.dir.createFile(filename, .{ .lock = .Exclusive, .lock_nonblocking = true }); | 1038 | const file1 = try tmp.dir.createFile(filename, .{ .lock = .exclusive, .lock_nonblocking = true }); |
| 1039 | defer file1.close(); | 1039 | defer file1.close(); |
| 1040 | 1040 | ||
| 1041 | const file2 = tmp.dir.createFile(filename, .{ .lock = .Exclusive, .lock_nonblocking = true }); | 1041 | const file2 = tmp.dir.createFile(filename, .{ .lock = .exclusive, .lock_nonblocking = true }); |
| 1042 | try testing.expectError(error.WouldBlock, file2); | 1042 | try testing.expectError(error.WouldBlock, file2); |
| 1043 | } | 1043 | } |
| 1044 | 1044 | ||
| ... | @@ -1050,10 +1050,10 @@ test "open file with shared and exclusive nonblocking lock" { | ... | @@ -1050,10 +1050,10 @@ test "open file with shared and exclusive nonblocking lock" { |
| 1050 | var tmp = tmpDir(.{}); | 1050 | var tmp = tmpDir(.{}); |
| 1051 | defer tmp.cleanup(); | 1051 | defer tmp.cleanup(); |
| 1052 | 1052 | ||
| 1053 | const file1 = try tmp.dir.createFile(filename, .{ .lock = .Shared, .lock_nonblocking = true }); | 1053 | const file1 = try tmp.dir.createFile(filename, .{ .lock = .shared, .lock_nonblocking = true }); |
| 1054 | defer file1.close(); | 1054 | defer file1.close(); |
| 1055 | 1055 | ||
| 1056 | const file2 = tmp.dir.createFile(filename, .{ .lock = .Exclusive, .lock_nonblocking = true }); | 1056 | const file2 = tmp.dir.createFile(filename, .{ .lock = .exclusive, .lock_nonblocking = true }); |
| 1057 | try testing.expectError(error.WouldBlock, file2); | 1057 | try testing.expectError(error.WouldBlock, file2); |
| 1058 | } | 1058 | } |
| 1059 | 1059 | ||
| ... | @@ -1065,10 +1065,10 @@ test "open file with exclusive and shared nonblocking lock" { | ... | @@ -1065,10 +1065,10 @@ test "open file with exclusive and shared nonblocking lock" { |
| 1065 | var tmp = tmpDir(.{}); | 1065 | var tmp = tmpDir(.{}); |
| 1066 | defer tmp.cleanup(); | 1066 | defer tmp.cleanup(); |
| 1067 | 1067 | ||
| 1068 | const file1 = try tmp.dir.createFile(filename, .{ .lock = .Exclusive, .lock_nonblocking = true }); | 1068 | const file1 = try tmp.dir.createFile(filename, .{ .lock = .exclusive, .lock_nonblocking = true }); |
| 1069 | defer file1.close(); | 1069 | defer file1.close(); |
| 1070 | 1070 | ||
| 1071 | const file2 = tmp.dir.createFile(filename, .{ .lock = .Shared, .lock_nonblocking = true }); | 1071 | const file2 = tmp.dir.createFile(filename, .{ .lock = .shared, .lock_nonblocking = true }); |
| 1072 | try testing.expectError(error.WouldBlock, file2); | 1072 | try testing.expectError(error.WouldBlock, file2); |
| 1073 | } | 1073 | } |
| 1074 | 1074 | ||
| ... | @@ -1085,13 +1085,13 @@ test "open file with exclusive lock twice, make sure second lock waits" { | ... | @@ -1085,13 +1085,13 @@ test "open file with exclusive lock twice, make sure second lock waits" { |
| 1085 | var tmp = tmpDir(.{}); | 1085 | var tmp = tmpDir(.{}); |
| 1086 | defer tmp.cleanup(); | 1086 | defer tmp.cleanup(); |
| 1087 | 1087 | ||
| 1088 | const file = try tmp.dir.createFile(filename, .{ .lock = .Exclusive }); | 1088 | const file = try tmp.dir.createFile(filename, .{ .lock = .exclusive }); |
| 1089 | errdefer file.close(); | 1089 | errdefer file.close(); |
| 1090 | 1090 | ||
| 1091 | const S = struct { | 1091 | const S = struct { |
| 1092 | fn checkFn(dir: *fs.Dir, started: *std.Thread.ResetEvent, locked: *std.Thread.ResetEvent) !void { | 1092 | fn checkFn(dir: *fs.Dir, started: *std.Thread.ResetEvent, locked: *std.Thread.ResetEvent) !void { |
| 1093 | started.set(); | 1093 | started.set(); |
| 1094 | const file1 = try dir.createFile(filename, .{ .lock = .Exclusive }); | 1094 | const file1 = try dir.createFile(filename, .{ .lock = .exclusive }); |
| 1095 | 1095 | ||
| 1096 | locked.set(); | 1096 | locked.set(); |
| 1097 | file1.close(); | 1097 | file1.close(); |
| ... | @@ -1138,12 +1138,12 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" { | ... | @@ -1138,12 +1138,12 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" { |
| 1138 | defer gpa.free(filename); | 1138 | defer gpa.free(filename); |
| 1139 | 1139 | ||
| 1140 | const file1 = try fs.createFileAbsolute(filename, .{ | 1140 | const file1 = try fs.createFileAbsolute(filename, .{ |
| 1141 | .lock = .Exclusive, | 1141 | .lock = .exclusive, |
| 1142 | .lock_nonblocking = true, | 1142 | .lock_nonblocking = true, |
| 1143 | }); | 1143 | }); |
| 1144 | 1144 | ||
| 1145 | const file2 = fs.createFileAbsolute(filename, .{ | 1145 | const file2 = fs.createFileAbsolute(filename, .{ |
| 1146 | .lock = .Exclusive, | 1146 | .lock = .exclusive, |
| 1147 | .lock_nonblocking = true, | 1147 | .lock_nonblocking = true, |
| 1148 | }); | 1148 | }); |
| 1149 | file1.close(); | 1149 | file1.close(); |
| ... | @@ -1348,7 +1348,7 @@ test "File.Metadata" { | ... | @@ -1348,7 +1348,7 @@ test "File.Metadata" { |
| 1348 | defer file.close(); | 1348 | defer file.close(); |
| 1349 | 1349 | ||
| 1350 | const metadata = try file.metadata(); | 1350 | const metadata = try file.metadata(); |
| 1351 | try testing.expect(metadata.kind() == .File); | 1351 | try testing.expect(metadata.kind() == .file); |
| 1352 | try testing.expect(metadata.size() == 0); | 1352 | try testing.expect(metadata.size() == 0); |
| 1353 | _ = metadata.accessed(); | 1353 | _ = metadata.accessed(); |
| 1354 | _ = metadata.modified(); | 1354 | _ = metadata.modified(); |
src/Module.zig+4-4| ... | @@ -3618,7 +3618,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void { | ... | @@ -3618,7 +3618,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void { |
| 3618 | file.sub_file_path, want_local_cache, &digest, | 3618 | file.sub_file_path, want_local_cache, &digest, |
| 3619 | }); | 3619 | }); |
| 3620 | 3620 | ||
| 3621 | break :lock .Shared; | 3621 | break :lock .shared; |
| 3622 | }, | 3622 | }, |
| 3623 | .parse_failure, .astgen_failure, .success_zir => lock: { | 3623 | .parse_failure, .astgen_failure, .success_zir => lock: { |
| 3624 | const unchanged_metadata = | 3624 | const unchanged_metadata = |
| ... | @@ -3633,7 +3633,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void { | ... | @@ -3633,7 +3633,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void { |
| 3633 | 3633 | ||
| 3634 | log.debug("metadata changed: {s}", .{file.sub_file_path}); | 3634 | log.debug("metadata changed: {s}", .{file.sub_file_path}); |
| 3635 | 3635 | ||
| 3636 | break :lock .Exclusive; | 3636 | break :lock .exclusive; |
| 3637 | }, | 3637 | }, |
| 3638 | }; | 3638 | }; |
| 3639 | 3639 | ||
| ... | @@ -3715,11 +3715,11 @@ pub fn astGenFile(mod: *Module, file: *File) !void { | ... | @@ -3715,11 +3715,11 @@ pub fn astGenFile(mod: *Module, file: *File) !void { |
| 3715 | } | 3715 | } |
| 3716 | 3716 | ||
| 3717 | // If we already have the exclusive lock then it is our job to update. | 3717 | // If we already have the exclusive lock then it is our job to update. |
| 3718 | if (builtin.os.tag == .wasi or lock == .Exclusive) break; | 3718 | if (builtin.os.tag == .wasi or lock == .exclusive) break; |
| 3719 | // Otherwise, unlock to give someone a chance to get the exclusive lock | 3719 | // Otherwise, unlock to give someone a chance to get the exclusive lock |
| 3720 | // and then upgrade to an exclusive lock. | 3720 | // and then upgrade to an exclusive lock. |
| 3721 | cache_file.unlock(); | 3721 | cache_file.unlock(); |
| 3722 | lock = .Exclusive; | 3722 | lock = .exclusive; |
| 3723 | try cache_file.lock(lock); | 3723 | try cache_file.lock(lock); |
| 3724 | } | 3724 | } |
| 3725 | 3725 |
src/Package.zig+2-2| ... | @@ -651,8 +651,8 @@ fn computePackageHash( | ... | @@ -651,8 +651,8 @@ fn computePackageHash( |
| 651 | 651 | ||
| 652 | while (try walker.next()) |entry| { | 652 | while (try walker.next()) |entry| { |
| 653 | switch (entry.kind) { | 653 | switch (entry.kind) { |
| 654 | .Directory => continue, | 654 | .directory => continue, |
| 655 | .File => {}, | 655 | .file => {}, |
| 656 | else => return error.IllegalFileTypeInPackage, | 656 | else => return error.IllegalFileTypeInPackage, |
| 657 | } | 657 | } |
| 658 | const hashed_file = try arena.create(HashedFile); | 658 | const hashed_file = try arena.create(HashedFile); |
src/main.zig+3-3| ... | @@ -4830,11 +4830,11 @@ fn fmtPathDir( | ... | @@ -4830,11 +4830,11 @@ fn fmtPathDir( |
| 4830 | 4830 | ||
| 4831 | var dir_it = iterable_dir.iterate(); | 4831 | var dir_it = iterable_dir.iterate(); |
| 4832 | while (try dir_it.next()) |entry| { | 4832 | while (try dir_it.next()) |entry| { |
| 4833 | const is_dir = entry.kind == .Directory; | 4833 | const is_dir = entry.kind == .directory; |
| 4834 | 4834 | ||
| 4835 | if (is_dir and (mem.eql(u8, entry.name, "zig-cache") or mem.eql(u8, entry.name, "zig-out"))) continue; | 4835 | if (is_dir and (mem.eql(u8, entry.name, "zig-cache") or mem.eql(u8, entry.name, "zig-out"))) continue; |
| 4836 | 4836 | ||
| 4837 | if (is_dir or entry.kind == .File and (mem.endsWith(u8, entry.name, ".zig") or mem.endsWith(u8, entry.name, ".zon"))) { | 4837 | if (is_dir or entry.kind == .file and (mem.endsWith(u8, entry.name, ".zig") or mem.endsWith(u8, entry.name, ".zon"))) { |
| 4838 | const full_path = try fs.path.join(fmt.gpa, &[_][]const u8{ file_path, entry.name }); | 4838 | const full_path = try fs.path.join(fmt.gpa, &[_][]const u8{ file_path, entry.name }); |
| 4839 | defer fmt.gpa.free(full_path); | 4839 | defer fmt.gpa.free(full_path); |
| 4840 | 4840 | ||
| ... | @@ -4864,7 +4864,7 @@ fn fmtPathFile( | ... | @@ -4864,7 +4864,7 @@ fn fmtPathFile( |
| 4864 | 4864 | ||
| 4865 | const stat = try source_file.stat(); | 4865 | const stat = try source_file.stat(); |
| 4866 | 4866 | ||
| 4867 | if (stat.kind == .Directory) | 4867 | if (stat.kind == .directory) |
| 4868 | return error.IsDir; | 4868 | return error.IsDir; |
| 4869 | 4869 | ||
| 4870 | const gpa = fmt.gpa; | 4870 | const gpa = fmt.gpa; |
test/src/Cases.zig+2-2| ... | @@ -349,7 +349,7 @@ fn addFromDirInner( | ... | @@ -349,7 +349,7 @@ fn addFromDirInner( |
| 349 | var filenames = std.ArrayList([]const u8).init(ctx.arena); | 349 | var filenames = std.ArrayList([]const u8).init(ctx.arena); |
| 350 | 350 | ||
| 351 | while (try it.next()) |entry| { | 351 | while (try it.next()) |entry| { |
| 352 | if (entry.kind != .File) continue; | 352 | if (entry.kind != .file) continue; |
| 353 | 353 | ||
| 354 | // Ignore stuff such as .swp files | 354 | // Ignore stuff such as .swp files |
| 355 | switch (Compilation.classifyFileExt(entry.basename)) { | 355 | switch (Compilation.classifyFileExt(entry.basename)) { |
| ... | @@ -1039,7 +1039,7 @@ pub fn main() !void { | ... | @@ -1039,7 +1039,7 @@ pub fn main() !void { |
| 1039 | const stem = case_file_path[case_dirname.len + 1 .. case_file_path.len - "0.zig".len]; | 1039 | const stem = case_file_path[case_dirname.len + 1 .. case_file_path.len - "0.zig".len]; |
| 1040 | var it = iterable_dir.iterate(); | 1040 | var it = iterable_dir.iterate(); |
| 1041 | while (try it.next()) |entry| { | 1041 | while (try it.next()) |entry| { |
| 1042 | if (entry.kind != .File) continue; | 1042 | if (entry.kind != .file) continue; |
| 1043 | if (!std.mem.startsWith(u8, entry.name, stem)) continue; | 1043 | if (!std.mem.startsWith(u8, entry.name, stem)) continue; |
| 1044 | try filenames.append(try std.fs.path.join(arena, &.{ case_dirname, entry.name })); | 1044 | try filenames.append(try std.fs.path.join(arena, &.{ case_dirname, entry.name })); |
| 1045 | } | 1045 | } |
tools/process_headers.zig+2-2| ... | @@ -393,8 +393,8 @@ pub fn main() !void { | ... | @@ -393,8 +393,8 @@ pub fn main() !void { |
| 393 | while (try dir_it.next()) |entry| { | 393 | while (try dir_it.next()) |entry| { |
| 394 | const full_path = try std.fs.path.join(allocator, &[_][]const u8{ full_dir_name, entry.name }); | 394 | const full_path = try std.fs.path.join(allocator, &[_][]const u8{ full_dir_name, entry.name }); |
| 395 | switch (entry.kind) { | 395 | switch (entry.kind) { |
| 396 | .Directory => try dir_stack.append(full_path), | 396 | .directory => try dir_stack.append(full_path), |
| 397 | .File => { | 397 | .file => { |
| 398 | const rel_path = try std.fs.path.relative(allocator, target_include_dir, full_path); | 398 | const rel_path = try std.fs.path.relative(allocator, target_include_dir, full_path); |
| 399 | const max_size = 2 * 1024 * 1024 * 1024; | 399 | const max_size = 2 * 1024 * 1024 * 1024; |
| 400 | const raw_bytes = try std.fs.cwd().readFileAlloc(allocator, full_path, max_size); | 400 | const raw_bytes = try std.fs.cwd().readFileAlloc(allocator, full_path, max_size); |
tools/update-linux-headers.zig+2-2| ... | @@ -193,8 +193,8 @@ pub fn main() !void { | ... | @@ -193,8 +193,8 @@ pub fn main() !void { |
| 193 | while (try dir_it.next()) |entry| { | 193 | while (try dir_it.next()) |entry| { |
| 194 | const full_path = try std.fs.path.join(arena, &[_][]const u8{ full_dir_name, entry.name }); | 194 | const full_path = try std.fs.path.join(arena, &[_][]const u8{ full_dir_name, entry.name }); |
| 195 | switch (entry.kind) { | 195 | switch (entry.kind) { |
| 196 | .Directory => try dir_stack.append(full_path), | 196 | .directory => try dir_stack.append(full_path), |
| 197 | .File => { | 197 | .file => { |
| 198 | const rel_path = try std.fs.path.relative(arena, target_include_dir, full_path); | 198 | const rel_path = try std.fs.path.relative(arena, target_include_dir, full_path); |
| 199 | const max_size = 2 * 1024 * 1024 * 1024; | 199 | const max_size = 2 * 1024 * 1024 * 1024; |
| 200 | const raw_bytes = try std.fs.cwd().readFileAlloc(arena, full_path, max_size); | 200 | const raw_bytes = try std.fs.cwd().readFileAlloc(arena, full_path, max_size); |
tools/update_glibc.zig+2-2| ... | @@ -57,7 +57,7 @@ pub fn main() !void { | ... | @@ -57,7 +57,7 @@ pub fn main() !void { |
| 57 | defer walker.deinit(); | 57 | defer walker.deinit(); |
| 58 | 58 | ||
| 59 | walk: while (try walker.next()) |entry| { | 59 | walk: while (try walker.next()) |entry| { |
| 60 | if (entry.kind != .File) continue; | 60 | if (entry.kind != .file) continue; |
| 61 | if (mem.startsWith(u8, entry.basename, ".")) continue; | 61 | if (mem.startsWith(u8, entry.basename, ".")) continue; |
| 62 | for (exempt_files) |p| { | 62 | for (exempt_files) |p| { |
| 63 | if (mem.eql(u8, entry.path, p)) continue :walk; | 63 | if (mem.eql(u8, entry.path, p)) continue :walk; |
| ... | @@ -98,7 +98,7 @@ pub fn main() !void { | ... | @@ -98,7 +98,7 @@ pub fn main() !void { |
| 98 | defer walker.deinit(); | 98 | defer walker.deinit(); |
| 99 | 99 | ||
| 100 | walk: while (try walker.next()) |entry| { | 100 | walk: while (try walker.next()) |entry| { |
| 101 | if (entry.kind != .File) continue; | 101 | if (entry.kind != .file) continue; |
| 102 | if (mem.startsWith(u8, entry.basename, ".")) continue; | 102 | if (mem.startsWith(u8, entry.basename, ".")) continue; |
| 103 | for (exempt_files) |p| { | 103 | for (exempt_files) |p| { |
| 104 | if (mem.eql(u8, entry.path, p)) continue :walk; | 104 | if (mem.eql(u8, entry.path, p)) continue :walk; |
tools/update_spirv_features.zig+1-1| ... | @@ -227,7 +227,7 @@ fn gather_extensions(allocator: Allocator, spirv_registry_root: []const u8) ![]c | ... | @@ -227,7 +227,7 @@ fn gather_extensions(allocator: Allocator, spirv_registry_root: []const u8) ![]c |
| 227 | 227 | ||
| 228 | var vendor_it = extensions_dir.iterate(); | 228 | var vendor_it = extensions_dir.iterate(); |
| 229 | while (try vendor_it.next()) |vendor_entry| { | 229 | while (try vendor_it.next()) |vendor_entry| { |
| 230 | std.debug.assert(vendor_entry.kind == .Directory); // If this fails, the structure of SPIRV-Registry has changed. | 230 | std.debug.assert(vendor_entry.kind == .directory); // If this fails, the structure of SPIRV-Registry has changed. |
| 231 | 231 | ||
| 232 | const vendor_dir = try extensions_dir.dir.openIterableDir(vendor_entry.name, .{}); | 232 | const vendor_dir = try extensions_dir.dir.openIterableDir(vendor_entry.name, .{}); |
| 233 | var ext_it = vendor_dir.iterate(); | 233 | var ext_it = vendor_dir.iterate(); |