mirror of
https://github.com/versity/scoutfs-go.git
synced 2026-01-03 10:35:15 +00:00
fix statmore and query bugs
This commit is contained in:
29
examples/statmore/main.go
Normal file
29
examples/statmore/main.go
Normal 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)
|
||||||
|
}
|
||||||
@@ -131,7 +131,6 @@ func (q *Query) Next() ([]InodesEntry, error) {
|
|||||||
|
|
||||||
q.first = e
|
q.first = e
|
||||||
q.first.Ino++
|
q.first.Ino++
|
||||||
q.first.Minor++
|
|
||||||
if q.first.Ino == 0 {
|
if q.first.Ino == 0 {
|
||||||
q.first.Minor++
|
q.first.Minor++
|
||||||
if q.first.Minor == 0 {
|
if q.first.Minor == 0 {
|
||||||
@@ -150,7 +149,7 @@ func StatMore(path string) (Stat, error) {
|
|||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
var s Stat
|
s := Stat{ValidBytes: uint64(unsafe.Sizeof(Stat{}))}
|
||||||
|
|
||||||
_, err = scoutfsctl(f.Fd(), IOCSTATMORE, uintptr(unsafe.Pointer(&s)))
|
_, err = scoutfsctl(f.Fd(), IOCSTATMORE, uintptr(unsafe.Pointer(&s)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const (
|
|||||||
//IOCSTAGE scoutfs ioctl
|
//IOCSTAGE scoutfs ioctl
|
||||||
IOCSTAGE = 0x401c7306
|
IOCSTAGE = 0x401c7306
|
||||||
//IOCSTATMORE scoutfs ioctl
|
//IOCSTATMORE scoutfs ioctl
|
||||||
IOCSTATMORE = 0x40207307
|
IOCSTATMORE = 0x40307307
|
||||||
|
|
||||||
//QUERYINODESMETASEQ find inodes by metadata sequence
|
//QUERYINODESMETASEQ find inodes by metadata sequence
|
||||||
QUERYINODESMETASEQ = '\u0000'
|
QUERYINODESMETASEQ = '\u0000'
|
||||||
|
|||||||
Reference in New Issue
Block a user