commit c8d66f11253d86b2264a19075143cfa5aa4d451e
parent f86f82297ea85f91ba16d6d1e33d1a52a0e0f206
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 4 Sep 2022 10:42:23 +0200
os::errno_to_fs: style
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
2 files changed, 38 insertions(+), 34 deletions(-)
diff --git a/os/+freebsd/dirfdfs.ha b/os/+freebsd/dirfdfs.ha
@@ -70,23 +70,25 @@ export fn dirfile(fs: *fs::fs) io::file = {
return fs.dirfd;
};
-fn errno_to_fs(err: rt::errno) fs::error = switch (err) {
-case rt::ENOENT =>
- yield errors::noentry;
-case rt::EEXIST =>
- yield errors::exists;
-case rt::EACCES =>
- yield errors::noaccess;
-case rt::EBUSY =>
- yield errors::busy;
-case rt::ENOTDIR =>
- yield fs::wrongtype;
-case rt::EOPNOTSUPP, rt::ENOSYS =>
- yield errors::unsupported;
-case rt::EXDEV =>
- yield fs::cannotrename;
-case =>
- yield errors::errno(err);
+fn errno_to_fs(err: rt::errno) fs::error = {
+ switch (err) {
+ case rt::ENOENT =>
+ return errors::noentry;
+ case rt::EEXIST =>
+ return errors::exists;
+ case rt::EACCES =>
+ return errors::noaccess;
+ case rt::EBUSY =>
+ return errors::busy;
+ case rt::ENOTDIR =>
+ return fs::wrongtype;
+ case rt::EOPNOTSUPP, rt::ENOSYS =>
+ return errors::unsupported;
+ case rt::EXDEV =>
+ return fs::cannotrename;
+ case =>
+ return errors::errno(err);
+ };
};
fn _fs_open(
diff --git a/os/+linux/dirfdfs.ha b/os/+linux/dirfdfs.ha
@@ -121,23 +121,25 @@ export fn dirfile(fs: *fs::fs) io::file = {
return fs.dirfd;
};
-fn errno_to_fs(err: rt::errno) fs::error = switch (err) {
-case rt::ENOENT =>
- yield errors::noentry;
-case rt::EEXIST =>
- yield errors::exists;
-case rt::EACCES =>
- yield errors::noaccess;
-case rt::EBUSY =>
- yield errors::busy;
-case rt::ENOTDIR =>
- yield fs::wrongtype;
-case rt::EOPNOTSUPP, rt::ENOSYS =>
- yield errors::unsupported;
-case rt::EXDEV =>
- yield fs::cannotrename;
-case =>
- yield errors::errno(err);
+fn errno_to_fs(err: rt::errno) fs::error = {
+ switch (err) {
+ case rt::ENOENT =>
+ return errors::noentry;
+ case rt::EEXIST =>
+ return errors::exists;
+ case rt::EACCES =>
+ return errors::noaccess;
+ case rt::EBUSY =>
+ return errors::busy;
+ case rt::ENOTDIR =>
+ return fs::wrongtype;
+ case rt::EOPNOTSUPP, rt::ENOSYS =>
+ return errors::unsupported;
+ case rt::EXDEV =>
+ return fs::cannotrename;
+ case =>
+ return errors::errno(err);
+ };
};
fn _fs_open(