mirror of
https://github.com/ceph/go-ceph
synced 2024-12-23 14:45:42 +00:00
d4079e3949
Add a Statx wrapper for ceph_statx. Add a type wrapping the statx status info that exposes the various fields from the C-struct. Add a type wrapping struct timespec, based on golang's x/sys, for the time fields in the struct. Note that the ceph struct is not the same as the linux statx struct. Signed-off-by: John Mulligan <jmulligan@redhat.com>
23 lines
427 B
Go
23 lines
427 B
Go
package cephfs
|
|
|
|
/*
|
|
#include <time.h>
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// Timespec behaves similarly to C's struct timespec.
|
|
// Timespec is used to retain fidelity to the C based file systems
|
|
// apis that could be lossy with the use of Go time types.
|
|
type Timespec unix.Timespec
|
|
|
|
func cStructToTimespec(t C.struct_timespec) Timespec {
|
|
return Timespec{
|
|
Sec: int64(t.tv_sec),
|
|
Nsec: int64(t.tv_nsec),
|
|
}
|
|
}
|