scoutfs: update ioctl/struct defs for scoutfs v1 format

This commit is contained in:
Ben McClelland
2021-11-03 19:32:02 -07:00
parent 7603944156
commit 7ad9abbb27
2 changed files with 18 additions and 26 deletions

View File

@@ -156,7 +156,7 @@ func StatMore(path string) (Stat, error) {
// FStatMore returns scoutfs specific metadata for file handle
func FStatMore(f *os.File) (Stat, error) {
s := Stat{Valid_bytes: uint64(unsafe.Sizeof(Stat{}))}
s := Stat{}
_, err := scoutfsctl(f, IOCSTATMORE, unsafe.Pointer(&s))
if err != nil {
@@ -598,15 +598,12 @@ type FSID struct {
// GetIDs gets the statfs more filesystem and random id from file handle within
// scoutfs filesystem
func GetIDs(f *os.File) (FSID, error) {
stfs := statfsMore{Valid_bytes: sizeofstatfsMore}
stfs := statfsMore{}
_, err := scoutfsctl(f, IOCSTATFSMORE, unsafe.Pointer(&stfs))
if err != nil {
return FSID{}, fmt.Errorf("statfs more: %v", err)
}
if stfs.Valid_bytes != sizeofstatfsMore {
return FSID{}, fmt.Errorf("unexpected return size: %v", stfs.Valid_bytes)
}
short := fmt.Sprintf("f.%v.r.%v",
fmt.Sprintf("%016x", stfs.Fsid)[:][:6], fmt.Sprintf("%016x", stfs.Rid)[:][:6])
@@ -701,15 +698,12 @@ var metaFlag uint8 = 0x1
// GetDF returns usage data for the filesystem
func GetDF(f *os.File) (DiskUsage, error) {
stfs := statfsMore{Valid_bytes: sizeofstatfsMore}
stfs := statfsMore{}
_, err := scoutfsctl(f, IOCSTATFSMORE, unsafe.Pointer(&stfs))
if err != nil {
return DiskUsage{}, fmt.Errorf("statfs more: %v", err)
}
if stfs.Valid_bytes != sizeofstatfsMore {
return DiskUsage{}, fmt.Errorf("statfs more unexpected return size: %v", stfs.Valid_bytes)
}
nr := dfBatchCount
buf := make([]byte, int(unsafe.Sizeof(allocDetailEntry{}))*int(nr))

View File

@@ -3,20 +3,20 @@
package scoutfs
const IOCQUERYINODES = 0x80487301
const IOCINOPATH = 0x80287302
const IOCRELEASE = 0x40187303
const IOCSTAGE = 0x40207304
const IOCSTATMORE = 0x80407305
const IOCDATAWAITING = 0x80287306
const IOCSETATTRMORE = 0x40307307
const IOCLISTXATTRHIDDEN = 0x80187308
const IOCSEARCHXATTRS = 0x80387309
const IOCSTATFSMORE = 0x8038730a
const IOCDATAWAITERR = 0x8030730b
const IOCALLOCDETAIL = 0x8010730c
const IOCMOVEBLOCKS = 0x8030730d
const IOCREADXATTRTOTALS = 0x8028730f
const IOCQUERYINODES = 0x4048e801
const IOCINOPATH = 0x4028e802
const IOCRELEASE = 0x4018e803
const IOCSTAGE = 0x4020e804
const IOCSTATMORE = 0x8038e805
const IOCDATAWAITING = 0x4028e806
const IOCSETATTRMORE = 0x4030e807
const IOCLISTXATTRHIDDEN = 0xc018e808
const IOCSEARCHXATTRS = 0x4038e809
const IOCSTATFSMORE = 0x8030e80a
const IOCDATAWAITERR = 0x4030e80b
const IOCALLOCDETAIL = 0x4010e80c
const IOCMOVEBLOCKS = 0x4030e80d
const IOCREADXATTRTOTALS = 0x4028e80f
const QUERYINODESMETASEQ = 0x0
const QUERYINODESDATASEQ = 0x1
@@ -64,7 +64,6 @@ type iocStage struct {
X_pad uint32
}
type Stat struct {
Valid_bytes uint64
Meta_seq uint64
Data_seq uint64
Data_version uint64
@@ -122,7 +121,6 @@ type searchXattrs struct {
X_pad [6]uint8
}
type statfsMore struct {
Valid_bytes uint64
Fsid uint64
Rid uint64
Committed_seq uint64
@@ -160,5 +158,5 @@ type xattrTotal struct {
Count uint64
}
const sizeofstatfsMore = 0x38
const sizeofstatfsMore = 0x30
const sizeofxattrTotal = 0x28