Initial commit

Proof-of-concept implementation. Bugs will occur.
This commit is contained in:
2026-02-12 01:18:46 +03:00
commit 13ac06c14b
553 changed files with 253003 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
// Copyright 2024 the Go-FUSE Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package xattr
import "golang.org/x/sys/unix"
// ENOATTR indicates that an extended attribute was not present.
const ENOATTR = unix.ENODATA

View File

@@ -0,0 +1,11 @@
//go:build !linux
// Copyright 2024 the Go-FUSE Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package xattr
import "golang.org/x/sys/unix"
const ENOATTR = unix.ENOATTR

View File

@@ -0,0 +1,9 @@
// Copyright 2024 the Go-FUSE Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package xattr
func ParseAttrNames(buf []byte) [][]byte {
return parseAttrNames(buf)
}

View File

@@ -0,0 +1,20 @@
// Copyright 2024 the Go-FUSE Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package xattr
// BSDs syscall use different convention of data buf retrieved
// through syscall `unix.Listxattr`.
// Ref: extattr_list_file(2)
func parseAttrNames(buf []byte) [][]byte {
var attrList [][]byte
for p := 0; p < len(buf); {
attrNameLen := int(buf[p])
p++
attrName := buf[p : p+attrNameLen]
attrList = append(attrList, attrName)
p += attrNameLen
}
return attrList
}

View File

@@ -0,0 +1,13 @@
//go:build !freebsd
// Copyright 2024 the Go-FUSE Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package xattr
import "bytes"
func parseAttrNames(buf []byte) [][]byte {
return bytes.Split(buf, []byte{0})
}