-
Notifications
You must be signed in to change notification settings - Fork 296
FreeBSD support #998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
FreeBSD support #998
Changes from 8 commits
903fc9d
8d8fb15
3a56754
a298101
d6242d9
b15f00f
4891ccf
8412954
232206e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #!/bin/bash | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -eu | ||
| cd "$(dirname "$0")" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| #!/bin/bash -eu | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -eu | ||
|
|
||
| cd "$(dirname "$0")" | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #!/bin/bash | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Find out the maximum supported filename length and print it. | ||
| # | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package fusefrontend | ||
|
|
||
| import ( | ||
| "golang.org/x/sys/unix" | ||
|
|
||
| "github.com/hanwen/go-fuse/v2/fuse" | ||
| ) | ||
|
|
||
| const noSuchAttributeError = unix.ENOATTR | ||
|
|
||
| func filterXattrSetFlags(flags int) int { | ||
| return flags | ||
| } | ||
|
|
||
| func (n *Node) getXAttr(cAttr string) (out []byte, errno unix.Errno) { | ||
| // TODO | ||
| return nil, unix.EOPNOTSUPP | ||
| } | ||
|
|
||
| func (n *Node) setXAttr(context *fuse.Context, cAttr string, cData []byte, flags uint32) (errno unix.Errno) { | ||
| // TODO | ||
| return unix.EOPNOTSUPP | ||
| } | ||
|
|
||
| func (n *Node) removeXAttr(cAttr string) (errno unix.Errno) { | ||
| // TODO | ||
| return unix.EOPNOTSUPP | ||
| } | ||
|
|
||
| func (n *Node) listXAttr() (out []string, errno unix.Errno) { | ||
| // TODO | ||
| return nil, unix.EOPNOTSUPP | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package fusefrontend_reverse | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
||
| "golang.org/x/sys/unix" | ||
|
|
||
| "github.com/hanwen/go-fuse/v2/fs" | ||
|
|
||
| "github.com/rfjakob/gocryptfs/v2/internal/syscallcompat" | ||
| ) | ||
|
|
||
| const noSuchAttributeError = unix.ENOATTR | ||
|
|
||
| func (n *Node) getXAttr(cAttr string) (out []byte, errno unix.Errno) { | ||
| d, errno := n.prepareAtSyscall("") | ||
| if errno != 0 { | ||
| return | ||
| } | ||
| defer unix.Close(d.dirfd) | ||
|
|
||
| procPath := fmt.Sprintf("/proc/self/fd/%d/%s", d.dirfd, d.pName) | ||
| pData, err := syscallcompat.Lgetxattr(procPath, cAttr) | ||
| if err != nil { | ||
| return nil, fs.ToErrno(err) | ||
| } | ||
| return pData, 0 | ||
| } | ||
|
|
||
| func (n *Node) listXAttr() (out []string, errno unix.Errno) { | ||
| d, errno := n.prepareAtSyscall("") | ||
| if errno != 0 { | ||
| return | ||
| } | ||
| defer unix.Close(d.dirfd) | ||
|
|
||
| procPath := fmt.Sprintf("/proc/self/fd/%d/%s", d.dirfd, d.pName) | ||
| pNames, err := syscallcompat.Llistxattr(procPath) | ||
| if err != nil { | ||
| return nil, fs.ToErrno(err) | ||
| } | ||
| return pNames, 0 | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #!/bin/bash | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -eu | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #!/bin/bash | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -eu | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| #!/bin/bash | ||
| #!/usr/bin/env bash | ||
|
|
||
| exec ../speed/benchmark.bash |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package syscallcompat | ||
|
|
||
| import ( | ||
| "github.com/hanwen/go-fuse/v2/fuse" | ||
| ) | ||
|
|
||
| // asUser runs `f()` under the effective uid, gid, groups specified | ||
| // in `context`. | ||
| // | ||
| // If `context` is nil, `f()` is executed directly without switching user id. | ||
| // | ||
| // WARNING this function is not complete, and always runs f() as if context is nil. | ||
| // FreeBSD does not support changing uid/gid per thread. | ||
| func asUser(f func() (int, error), context *fuse.Context) (int, error) { | ||
| return f() | ||
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| //go:build darwin | ||
|
||
|
|
||
| package syscallcompat | ||
|
|
||
| import ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| //go:build darwin | ||
|
||
| package syscallcompat | ||
|
|
||
| import ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package syscallcompat | ||
|
|
||
| import ( | ||
| "golang.org/x/sys/unix" | ||
|
|
||
| "github.com/rfjakob/gocryptfs/v2/internal/tlog" | ||
| ) | ||
|
|
||
| // DetectQuirks decides if there are known quirks on the backing filesystem | ||
| // that need to be workarounded. | ||
| // | ||
| // Tested by tests/root_test.TestBtrfsQuirks | ||
| func DetectQuirks(cipherdir string) (q uint64) { | ||
| var st unix.Statfs_t | ||
| err := unix.Statfs(cipherdir, &st) | ||
| if err != nil { | ||
| tlog.Warn.Printf("DetectQuirks: Statfs on %q failed: %v", cipherdir, err) | ||
| return 0 | ||
| } | ||
|
|
||
| return q | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not make sense on freebsd. Please fix or just stub it with EOPNOTSUPP.
Same for the other functions in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Functions in this file have been stubbed in the latest commit.