mirror of
https://github.com/versity/scoutfs-go.git
synced 2026-01-06 11:46:20 +00:00
rename constants for private use
This commit is contained in:
12
syscall.go
12
syscall.go
@@ -7,10 +7,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// SYS_OPENBYHANDLEAT linux system call
|
// sysOpenByHandleAt linux system call
|
||||||
SYS_OPENBYHANDLEAT = 304
|
sysOpenByHandleAt = 304
|
||||||
// FILEID_SCOUTFS for scoutfs file handle
|
// fileIDScoutfs for scoutfs file handle
|
||||||
FILEID_SCOUTFS = 0x81
|
fileIDScoutfs = 0x81
|
||||||
)
|
)
|
||||||
|
|
||||||
type fileID struct {
|
type fileID struct {
|
||||||
@@ -31,14 +31,14 @@ type fileHandle struct {
|
|||||||
func OpenByHandle(dirfd *os.File, ino uint64, flags int) (uintptr, error) {
|
func OpenByHandle(dirfd *os.File, ino uint64, flags int) (uintptr, error) {
|
||||||
h := &fileHandle{
|
h := &fileHandle{
|
||||||
FidSize: uint32(unsafe.Sizeof(fileID{})),
|
FidSize: uint32(unsafe.Sizeof(fileID{})),
|
||||||
HandleType: FILEID_SCOUTFS,
|
HandleType: fileIDScoutfs,
|
||||||
FID: fileID{Ino: ino},
|
FID: fileID{Ino: ino},
|
||||||
}
|
}
|
||||||
return openbyhandleat(dirfd.Fd(), h, flags)
|
return openbyhandleat(dirfd.Fd(), h, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
func openbyhandleat(dirfd uintptr, handle *fileHandle, flags int) (uintptr, error) {
|
func openbyhandleat(dirfd uintptr, handle *fileHandle, flags int) (uintptr, error) {
|
||||||
fd, _, e1 := syscall.Syscall6(SYS_OPENBYHANDLEAT, dirfd, uintptr(unsafe.Pointer(handle)), uintptr(flags), 0, 0, 0)
|
fd, _, e1 := syscall.Syscall6(sysOpenByHandleAt, dirfd, uintptr(unsafe.Pointer(handle)), uintptr(flags), 0, 0, 0)
|
||||||
var err error
|
var err error
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|||||||
Reference in New Issue
Block a user