mirror of
https://github.com/ksherlock/mpw.git
synced 2024-11-29 15:49:31 +00:00
linux.
This commit is contained in:
parent
b77bbac3c4
commit
bc491d8d58
@ -31,16 +31,19 @@
|
|||||||
#define XATTR_FILETYPE_NAME "user.prodos.FileType"
|
#define XATTR_FILETYPE_NAME "user.prodos.FileType"
|
||||||
#define XATTR_AUXTYPE_NAME "user.prodos.AuxType"
|
#define XATTR_AUXTYPE_NAME "user.prodos.AuxType"
|
||||||
|
|
||||||
|
|
||||||
|
#include "native_internal.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/xattr.h>
|
#include <sys/xattr.h>
|
||||||
|
|
||||||
#include "file.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <macos/errors.h>
|
#include <macos/errors.h>
|
||||||
|
|
||||||
|
|
||||||
using MacOS::tool_return;
|
using MacOS::tool_return;
|
||||||
using MacOS::macos_error;
|
using MacOS::macos_error;
|
||||||
using MacOS::macos_error_from_errno;
|
using MacOS::macos_error_from_errno;
|
||||||
@ -53,12 +56,12 @@ namespace {
|
|||||||
~xattr_file();
|
~xattr_file();
|
||||||
|
|
||||||
|
|
||||||
tool_return<size_t> read(void *out_buffer, size_t count) override;
|
virtual tool_return<size_t> read(void *out_buffer, size_t count) override;
|
||||||
tool_return<size_t> write(const void *in_buffer, size_t count) override;
|
virtual tool_return<size_t> write(void *in_buffer, size_t count) override;
|
||||||
tool_return<size_t> get_mark() override;
|
virtual tool_return<size_t> get_mark() override;
|
||||||
tool_return<void> set_mark(ssize_t new_mark) override;
|
virtual tool_return<size_t> set_mark(ssize_t new_mark) override;
|
||||||
tool_return<size_t> get_eof() override;
|
virtual tool_return<size_t> get_eof() override;
|
||||||
tool_return<void> set_eof(ssize_t new_eof) override;
|
virtual tool_return<size_t> set_eof(ssize_t new_eof) override;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -134,6 +137,7 @@ namespace {
|
|||||||
tool_return<void> xattr_file::set_mark(ssize_t new_mark) {
|
tool_return<void> xattr_file::set_mark(ssize_t new_mark) {
|
||||||
if (new_mark < 0) return MacOS::paramErr;
|
if (new_mark < 0) return MacOS::paramErr;
|
||||||
_displacement = new_mark;
|
_displacement = new_mark;
|
||||||
|
return new_mark;
|
||||||
}
|
}
|
||||||
|
|
||||||
tool_return<size_t> xattr_file::get_eof() {
|
tool_return<size_t> xattr_file::get_eof() {
|
||||||
@ -157,7 +161,7 @@ namespace {
|
|||||||
buffer.resize(new_eof, 0);
|
buffer.resize(new_eof, 0);
|
||||||
int ok = fsetxattr(_fd, XATTR_RESOURCEFORK_NAME, buffer->data(), buffer.size(), 0);
|
int ok = fsetxattr(_fd, XATTR_RESOURCEFORK_NAME, buffer->data(), buffer.size(), 0);
|
||||||
if (ok < 0) return macos_error_from_errno();
|
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;
|
if (links > 65535) links = 65535;
|
||||||
|
|
||||||
fi.entry_count = links;
|
fi.entry_count = links;
|
||||||
return noErr;
|
return MacOS::noErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo -- get actual block size instead of assuming 512. oh well!
|
// todo -- get actual block size instead of assuming 512. oh well!
|
||||||
@ -232,7 +236,7 @@ namespace native {
|
|||||||
fi.resource_logical_size = (rsize + 511) & ~511;
|
fi.resource_logical_size = (rsize + 511) & ~511;
|
||||||
}
|
}
|
||||||
|
|
||||||
return noErr;
|
return MacOS::noErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user