fix statmore and query bugs

This commit is contained in:
Ben McClelland
2018-12-03 13:37:00 -08:00
parent 67c8c3f967
commit 688e3df996
3 changed files with 31 additions and 3 deletions

29
examples/statmore/main.go Normal file
View File

@@ -0,0 +1,29 @@
// Copyright (c) 2018 Versity Software, Inc.
//
// Use of this source code is governed by a BSD-3-Clause license
// that can be found in the LICENSE file in the root of the source
// tree.
package main
import (
"fmt"
"log"
"os"
scoutfs "github.com/versity/scoutfs-go"
)
func main() {
if len(os.Args) != 2 || os.Args[1] == "-h" {
fmt.Fprintln(os.Stderr, "usage:", os.Args[0], "<filepath>")
os.Exit(1)
}
s, err := scoutfs.StatMore(os.Args[1])
if err != nil {
log.Fatalln("error statmore:", err)
}
fmt.Printf("%+v\n", s)
}

View File

@@ -131,7 +131,6 @@ func (q *Query) Next() ([]InodesEntry, error) {
q.first = e
q.first.Ino++
q.first.Minor++
if q.first.Ino == 0 {
q.first.Minor++
if q.first.Minor == 0 {
@@ -150,7 +149,7 @@ func StatMore(path string) (Stat, error) {
}
defer f.Close()
var s Stat
s := Stat{ValidBytes: uint64(unsafe.Sizeof(Stat{}))}
_, err = scoutfsctl(f.Fd(), IOCSTATMORE, uintptr(unsafe.Pointer(&s)))
if err != nil {

View File

@@ -24,7 +24,7 @@ const (
//IOCSTAGE scoutfs ioctl
IOCSTAGE = 0x401c7306
//IOCSTATMORE scoutfs ioctl
IOCSTATMORE = 0x40207307
IOCSTATMORE = 0x40307307
//QUERYINODESMETASEQ find inodes by metadata sequence
QUERYINODESMETASEQ = '\u0000'