-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea66f98
commit 0acc17d
Showing
8 changed files
with
113 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build darwin linux | ||
// +build darwin freebsd linux | ||
|
||
/* | ||
* passthrough.go | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// +build darwin | ||
|
||
/* | ||
* struct_darwin.go | ||
* port_darwin.go | ||
* | ||
* Copyright 2017 Bill Zissimopoulos | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// +build freebsd | ||
|
||
/* | ||
* port_freebsd.go | ||
* | ||
* Copyright 2017 Bill Zissimopoulos | ||
*/ | ||
/* | ||
* This file is part of Cgofuse. | ||
* | ||
* It is licensed under the MIT license. The full license text can be found | ||
* in the License.txt file at the root of this project. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"syscall" | ||
|
||
"github.com/billziss-gh/cgofuse/fuse" | ||
) | ||
|
||
func setuidgid() func() { | ||
euid := syscall.Geteuid() | ||
if 0 == euid { | ||
uid, gid, _ := fuse.Getcontext() | ||
egid := syscall.Getegid() | ||
syscall.Setegid(int(gid)) | ||
syscall.Seteuid(int(uid)) | ||
return func() { | ||
syscall.Seteuid(euid) | ||
syscall.Setegid(egid) | ||
} | ||
} | ||
return func() { | ||
} | ||
} | ||
|
||
func copyFusestatfsFromGostatfs(dst *fuse.Statfs_t, src *syscall.Statfs_t) { | ||
*dst = fuse.Statfs_t{} | ||
dst.Bsize = uint64(src.Bsize) | ||
dst.Frsize = 1 | ||
dst.Blocks = uint64(src.Blocks) | ||
dst.Bfree = uint64(src.Bfree) | ||
dst.Bavail = uint64(src.Bavail) | ||
dst.Files = uint64(src.Files) | ||
dst.Ffree = uint64(src.Ffree) | ||
dst.Favail = uint64(src.Ffree) | ||
dst.Namemax = 255 //uint64(src.Namelen) | ||
} | ||
|
||
func copyFusestatFromGostat(dst *fuse.Stat_t, src *syscall.Stat_t) { | ||
*dst = fuse.Stat_t{} | ||
dst.Dev = uint64(src.Dev) | ||
dst.Ino = uint64(src.Ino) | ||
dst.Mode = uint32(src.Mode) | ||
dst.Nlink = uint32(src.Nlink) | ||
dst.Uid = uint32(src.Uid) | ||
dst.Gid = uint32(src.Gid) | ||
dst.Rdev = uint64(src.Rdev) | ||
dst.Size = int64(src.Size) | ||
dst.Atim.Sec, dst.Atim.Nsec = src.Atimespec.Sec, src.Atimespec.Nsec | ||
dst.Mtim.Sec, dst.Mtim.Nsec = src.Mtimespec.Sec, src.Mtimespec.Nsec | ||
dst.Ctim.Sec, dst.Ctim.Nsec = src.Ctimespec.Sec, src.Ctimespec.Nsec | ||
dst.Blksize = int64(src.Blksize) | ||
dst.Blocks = int64(src.Blocks) | ||
dst.Birthtim.Sec, dst.Birthtim.Nsec = src.Birthtimespec.Sec, src.Birthtimespec.Nsec | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// +build linux | ||
|
||
/* | ||
* struct_linux.go | ||
* port_linux.go | ||
* | ||
* Copyright 2017 Bill Zissimopoulos | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +build darwin linux | ||
// +build darwin freebsd linux | ||
|
||
/* | ||
* host_unix_test.go | ||
|