From bc491d8d58eb0228627d9fa88989c12587cf4d60 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Fri, 4 Nov 2016 16:14:51 -0400 Subject: [PATCH] linux. --- native/Linux.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/native/Linux.cpp b/native/Linux.cpp index 3c79757..7ad8d1b 100644 --- a/native/Linux.cpp +++ b/native/Linux.cpp @@ -31,16 +31,19 @@ #define XATTR_FILETYPE_NAME "user.prodos.FileType" #define XATTR_AUXTYPE_NAME "user.prodos.AuxType" + +#include "native_internal.h" + #include #include #include -#include "file.h" #include #include #include + using MacOS::tool_return; using MacOS::macos_error; using MacOS::macos_error_from_errno; @@ -53,12 +56,12 @@ namespace { ~xattr_file(); - tool_return read(void *out_buffer, size_t count) override; - tool_return write(const void *in_buffer, size_t count) override; - tool_return get_mark() override; - tool_return set_mark(ssize_t new_mark) override; - tool_return get_eof() override; - tool_return set_eof(ssize_t new_eof) override; + virtual tool_return read(void *out_buffer, size_t count) override; + virtual tool_return write(void *in_buffer, size_t count) override; + virtual tool_return get_mark() override; + virtual tool_return set_mark(ssize_t new_mark) override; + virtual tool_return get_eof() override; + virtual tool_return set_eof(ssize_t new_eof) override; private: @@ -134,6 +137,7 @@ namespace { tool_return xattr_file::set_mark(ssize_t new_mark) { if (new_mark < 0) return MacOS::paramErr; _displacement = new_mark; + return new_mark; } tool_return xattr_file::get_eof() { @@ -157,7 +161,7 @@ namespace { buffer.resize(new_eof, 0); int ok = fsetxattr(_fd, XATTR_RESOURCEFORK_NAME, buffer->data(), buffer.size(), 0); if (ok < 0) return macos_error_from_errno(); - return MacOS::noErr; + return new_eof; } @@ -213,7 +217,7 @@ namespace native { if (links > 65535) links = 65535; fi.entry_count = links; - return noErr; + return MacOS::noErr; } // todo -- get actual block size instead of assuming 512. oh well! @@ -232,7 +236,7 @@ namespace native { fi.resource_logical_size = (rsize + 511) & ~511; } - return noErr; + return MacOS::noErr; }