Expand statfs man page a little and include in build.bash
This commit is contained in:
parent
92ae62f9cc
commit
ed230379e7
@ -5,26 +5,78 @@
|
|||||||
NAME
|
NAME
|
||||||
====
|
====
|
||||||
|
|
||||||
statfs - dump the statfs information for PATH to console in JSON format
|
statfs - dump the statfs(2) information for PATH to console in JSON format.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
========
|
========
|
||||||
|
|
||||||
#### Examine encrypted file/directory
|
|
||||||
statfs PATH
|
statfs PATH
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
===========
|
===========
|
||||||
|
|
||||||
There are no options to this command.
|
The statfs(2) system call returns information about a mounted filesystem
|
||||||
|
in a `statfs_t` structure. This tool dumps this information in JSON format.
|
||||||
|
It is developed as part of gocryptfs and written in Go.
|
||||||
|
|
||||||
|
The `statfs_t` structure is architecture-dependent. On amd64 it looks like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
type Statfs_t struct {
|
||||||
|
Type int64
|
||||||
|
Bsize int64
|
||||||
|
Blocks uint64
|
||||||
|
Bfree uint64
|
||||||
|
Bavail uint64
|
||||||
|
Files uint64
|
||||||
|
Ffree uint64
|
||||||
|
Fsid struct {
|
||||||
|
Val [2]int32
|
||||||
|
}
|
||||||
|
Namelen int64
|
||||||
|
Frsize int64
|
||||||
|
Flags int64
|
||||||
|
Spare [4]int64
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
See the statfs(2) man page for the meaning of these fields, and note
|
||||||
|
that the field names here are acc. to the Go `golang.org/x/sys/unix`
|
||||||
|
naming convention, and slightly different than in C.
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
========
|
========
|
||||||
|
|
||||||
Examine a directory entry:
|
Get the statfs(2) information for /tmp:
|
||||||
|
|
||||||
statfs myfs/mCXnISiv7nEmyc0glGuhTQ
|
```
|
||||||
|
$ statfs /tmp
|
||||||
|
{
|
||||||
|
"Type": 16914836,
|
||||||
|
"Bsize": 4096,
|
||||||
|
"Blocks": 3067428,
|
||||||
|
"Bfree": 3067411,
|
||||||
|
"Bavail": 3067411,
|
||||||
|
"Files": 3067428,
|
||||||
|
"Ffree": 3067381,
|
||||||
|
"Fsid": {
|
||||||
|
"Val": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Namelen": 255,
|
||||||
|
"Frsize": 4096,
|
||||||
|
"Flags": 38,
|
||||||
|
"Spare": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
========
|
========
|
||||||
gocryptfs(1) gocryptfs-xray(1)
|
statfs(2) gocryptfs(1)
|
||||||
|
@ -87,10 +87,11 @@ if [[ -n ${LDFLAGS:-} ]] ; then
|
|||||||
GO_LDFLAGS="$GO_LDFLAGS \"-extldflags=$LDFLAGS\""
|
GO_LDFLAGS="$GO_LDFLAGS \"-extldflags=$LDFLAGS\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Actual "go build" call
|
# Actual "go build" call for gocryptfs
|
||||||
go build "-ldflags=$GO_LDFLAGS" "-gcflags=$TRIM" "-asmflags=$TRIM" "$@"
|
go build "-ldflags=$GO_LDFLAGS" "-gcflags=$TRIM" "-asmflags=$TRIM" "$@"
|
||||||
|
# Additional binaries
|
||||||
(cd gocryptfs-xray; go build "-ldflags=$GO_LDFLAGS" "-gcflags=$TRIM" "-asmflags=$TRIM" "$@")
|
(cd gocryptfs-xray; go build "-ldflags=$GO_LDFLAGS" "-gcflags=$TRIM" "-asmflags=$TRIM" "$@")
|
||||||
|
(cd contrib/statfs; go build "-ldflags=$GO_LDFLAGS" "-gcflags=$TRIM" "-asmflags=$TRIM" "$@")
|
||||||
|
|
||||||
./gocryptfs -version
|
./gocryptfs -version
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"syscall"
|
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -23,8 +24,8 @@ func main() {
|
|||||||
flag.Usage()
|
flag.Usage()
|
||||||
}
|
}
|
||||||
path := flag.Arg(0)
|
path := flag.Arg(0)
|
||||||
var st syscall.Statfs_t
|
var st unix.Statfs_t
|
||||||
err := syscall.Statfs(path, &st)
|
err := unix.Statfs(path, &st)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "statfs syscall returned error: %v\n", err)
|
fmt.Fprintf(os.Stderr, "statfs syscall returned error: %v\n", err)
|
||||||
os.Exit(2)
|
os.Exit(2)
|
||||||
|
Loading…
Reference in New Issue
Block a user