Files
opencloud/vendor/github.com/ceph/go-ceph/cephfs/file_fd.go
Jörn Friedrich Dreyer 8e30e535b0 bump reva and deps
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2026-01-07 17:15:23 +01:00

16 lines
512 B
Go

package cephfs
// Fd returns the integer open file descriptor in cephfs.
// NOTE: It doesn't make sense to consume the returned integer fd anywhere
// outside CephFS and is recommended not to do so given the undefined behaviour.
// Also, as seen with the Go standard library, the fd is only valid as long as
// the corresponding File object is intact in the sense that an fd from a closed
// File object is invalid.
func (f *File) Fd() int {
if f == nil || f.mount == nil {
return -1
}
return int(f.fd)
}