mirror of
https://github.com/versity/scoutfs-go.git
synced 2026-01-09 13:03:11 +00:00
update statmore and setattermore for crtime
This commit is contained in:
18
scoutfs.go
18
scoutfs.go
@@ -166,28 +166,34 @@ func FStatMore(f *os.File) (Stat, error) {
|
||||
}
|
||||
|
||||
// SetAttrMore sets special scoutfs attributes
|
||||
func SetAttrMore(path string, version, size, flags uint64, ctime time.Time) error {
|
||||
func SetAttrMore(path string, version, size, flags uint64, ctime time.Time, crtime time.Time) error {
|
||||
f, err := os.OpenFile(path, os.O_RDWR, 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
return FSetAttrMore(f, version, size, flags, ctime)
|
||||
return FSetAttrMore(f, version, size, flags, ctime, crtime)
|
||||
}
|
||||
|
||||
// FSetAttrMore sets special scoutfs attributes for file handle
|
||||
func FSetAttrMore(f *os.File, version, size, flags uint64, ctime time.Time) error {
|
||||
var nsec int32
|
||||
func FSetAttrMore(f *os.File, version, size, flags uint64, ctime time.Time, crtime time.Time) error {
|
||||
var cnsec int32
|
||||
var crnsec int32
|
||||
if ctime.UnixNano() == int64(int32(ctime.UnixNano())) {
|
||||
nsec = int32(ctime.UnixNano())
|
||||
cnsec = int32(ctime.UnixNano())
|
||||
}
|
||||
if crtime.UnixNano() == int64(int32(crtime.UnixNano())) {
|
||||
crnsec = int32(crtime.UnixNano())
|
||||
}
|
||||
s := setattrMore{
|
||||
Data_version: version,
|
||||
I_size: size,
|
||||
Flags: flags,
|
||||
Ctime_sec: uint64(ctime.Unix()),
|
||||
Ctime_nsec: uint32(nsec),
|
||||
Ctime_nsec: uint32(cnsec),
|
||||
Crtime_sec: uint64(crtime.Unix()),
|
||||
Crtime_nsec: uint32(crnsec),
|
||||
}
|
||||
|
||||
_, err := scoutfsctl(f, IOCSETATTRMORE, unsafe.Pointer(&s))
|
||||
|
||||
@@ -7,9 +7,9 @@ const IOCQUERYINODES = 0x80487301
|
||||
const IOCINOPATH = 0x80287302
|
||||
const IOCRELEASE = 0x40187303
|
||||
const IOCSTAGE = 0x40207304
|
||||
const IOCSTATMORE = 0x80307305
|
||||
const IOCSTATMORE = 0x80407305
|
||||
const IOCDATAWAITING = 0x80287306
|
||||
const IOCSETATTRMORE = 0x40287307
|
||||
const IOCSETATTRMORE = 0x40307307
|
||||
const IOCLISTXATTRHIDDEN = 0x80187308
|
||||
const IOCSEARCHXATTRS = 0x80387309
|
||||
const IOCSTATFSMORE = 0x8038730a
|
||||
@@ -69,6 +69,9 @@ type Stat struct {
|
||||
Data_version uint64
|
||||
Online_blocks uint64
|
||||
Offline_blocks uint64
|
||||
Crtime_sec uint64
|
||||
Crtime_nsec uint32
|
||||
X_pad [4]uint8
|
||||
}
|
||||
type DataWaitingEntry struct {
|
||||
Ino uint64
|
||||
@@ -98,7 +101,8 @@ type setattrMore struct {
|
||||
Flags uint64
|
||||
Ctime_sec uint64
|
||||
Ctime_nsec uint32
|
||||
X_pad [4]uint8
|
||||
Crtime_nsec uint32
|
||||
Crtime_sec uint64
|
||||
}
|
||||
type listXattrHidden struct {
|
||||
Id_pos uint64
|
||||
|
||||
Reference in New Issue
Block a user