Use MNT_* consts from golang.org/x/sys/unix on freebsd and openbsd

Update vendored version of golang.org/x/sys/unix and use the MNT_*
constants there to replace the locally generated ones.
pull/807/head
Tobias Klauser 5 years ago
parent c141152a7b
commit 214c5bdb50

4
Gopkg.lock generated

@ -49,7 +49,7 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:8da06ec4e3ad93b1315e59fa31393e43ae1b7e6d2111f12383e21b74bd29493f" digest = "1:945b127fc2488b7efd24553b270158847219fd9fa32d6fd2bece3bac81d02d7e"
name = "golang.org/x/sys" name = "golang.org/x/sys"
packages = [ packages = [
"unix", "unix",
@ -58,7 +58,7 @@
"windows/svc/mgr", "windows/svc/mgr",
] ]
pruneopts = "UT" pruneopts = "UT"
revision = "ac6580df4449443a05718fd7858c1f91ad5f8d20" revision = "0732a990476f7f2f5f7200b39ba4ab730c0f09f8"
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"

@ -23,64 +23,64 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
var ret []PartitionStat var ret []PartitionStat
// get length // get length
count, err := unix.Getfsstat(nil, MNT_WAIT) count, err := unix.Getfsstat(nil, unix.MNT_WAIT)
if err != nil { if err != nil {
return ret, err return ret, err
} }
fs := make([]Statfs, count) fs := make([]Statfs, count)
if _, err = Getfsstat(fs, MNT_WAIT); err != nil { if _, err = Getfsstat(fs, unix.MNT_WAIT); err != nil {
return ret, err return ret, err
} }
for _, stat := range fs { for _, stat := range fs {
opts := "rw" opts := "rw"
if stat.Flags&MNT_RDONLY != 0 { if stat.Flags&unix.MNT_RDONLY != 0 {
opts = "ro" opts = "ro"
} }
if stat.Flags&MNT_SYNCHRONOUS != 0 { if stat.Flags&unix.MNT_SYNCHRONOUS != 0 {
opts += ",sync" opts += ",sync"
} }
if stat.Flags&MNT_NOEXEC != 0 { if stat.Flags&unix.MNT_NOEXEC != 0 {
opts += ",noexec" opts += ",noexec"
} }
if stat.Flags&MNT_NOSUID != 0 { if stat.Flags&unix.MNT_NOSUID != 0 {
opts += ",nosuid" opts += ",nosuid"
} }
if stat.Flags&MNT_UNION != 0 { if stat.Flags&unix.MNT_UNION != 0 {
opts += ",union" opts += ",union"
} }
if stat.Flags&MNT_ASYNC != 0 { if stat.Flags&unix.MNT_ASYNC != 0 {
opts += ",async" opts += ",async"
} }
if stat.Flags&MNT_SUIDDIR != 0 { if stat.Flags&unix.MNT_SUIDDIR != 0 {
opts += ",suiddir" opts += ",suiddir"
} }
if stat.Flags&MNT_SOFTDEP != 0 { if stat.Flags&unix.MNT_SOFTDEP != 0 {
opts += ",softdep" opts += ",softdep"
} }
if stat.Flags&MNT_NOSYMFOLLOW != 0 { if stat.Flags&unix.MNT_NOSYMFOLLOW != 0 {
opts += ",nosymfollow" opts += ",nosymfollow"
} }
if stat.Flags&MNT_GJOURNAL != 0 { if stat.Flags&unix.MNT_GJOURNAL != 0 {
opts += ",gjounalc" opts += ",gjounalc"
} }
if stat.Flags&MNT_MULTILABEL != 0 { if stat.Flags&unix.MNT_MULTILABEL != 0 {
opts += ",multilabel" opts += ",multilabel"
} }
if stat.Flags&MNT_ACLS != 0 { if stat.Flags&unix.MNT_ACLS != 0 {
opts += ",acls" opts += ",acls"
} }
if stat.Flags&MNT_NOATIME != 0 { if stat.Flags&unix.MNT_NOATIME != 0 {
opts += ",noattime" opts += ",noattime"
} }
if stat.Flags&MNT_NOCLUSTERR != 0 { if stat.Flags&unix.MNT_NOCLUSTERR != 0 {
opts += ",nocluster" opts += ",nocluster"
} }
if stat.Flags&MNT_NOCLUSTERW != 0 { if stat.Flags&unix.MNT_NOCLUSTERW != 0 {
opts += ",noclusterw" opts += ",noclusterw"
} }
if stat.Flags&MNT_NFS4ACLS != 0 { if stat.Flags&unix.MNT_NFS4ACLS != 0 {
opts += ",nfs4acls" opts += ",nfs4acls"
} }

@ -15,28 +15,6 @@ const (
DEVSTAT_READ = 0x01 DEVSTAT_READ = 0x01
DEVSTAT_WRITE = 0x02 DEVSTAT_WRITE = 0x02
DEVSTAT_FREE = 0x03 DEVSTAT_FREE = 0x03
MNT_RDONLY = 0x00000001
MNT_SYNCHRONOUS = 0x00000002
MNT_NOEXEC = 0x00000004
MNT_NOSUID = 0x00000008
MNT_UNION = 0x00000020
MNT_ASYNC = 0x00000040
MNT_SUIDDIR = 0x00100000
MNT_SOFTDEP = 0x00200000
MNT_NOSYMFOLLOW = 0x00400000
MNT_GJOURNAL = 0x02000000
MNT_MULTILABEL = 0x04000000
MNT_ACLS = 0x08000000
MNT_NOATIME = 0x10000000
MNT_NOCLUSTERR = 0x40000000
MNT_NOCLUSTERW = 0x80000000
MNT_NFS4ACLS = 0x00000010
MNT_WAIT = 1
MNT_NOWAIT = 2
MNT_LAZY = 3
MNT_SUSPEND = 4
) )
const ( const (

@ -15,28 +15,6 @@ const (
DEVSTAT_READ = 0x01 DEVSTAT_READ = 0x01
DEVSTAT_WRITE = 0x02 DEVSTAT_WRITE = 0x02
DEVSTAT_FREE = 0x03 DEVSTAT_FREE = 0x03
MNT_RDONLY = 0x00000001
MNT_SYNCHRONOUS = 0x00000002
MNT_NOEXEC = 0x00000004
MNT_NOSUID = 0x00000008
MNT_UNION = 0x00000020
MNT_ASYNC = 0x00000040
MNT_SUIDDIR = 0x00100000
MNT_SOFTDEP = 0x00200000
MNT_NOSYMFOLLOW = 0x00400000
MNT_GJOURNAL = 0x02000000
MNT_MULTILABEL = 0x04000000
MNT_ACLS = 0x08000000
MNT_NOATIME = 0x10000000
MNT_NOCLUSTERR = 0x40000000
MNT_NOCLUSTERW = 0x80000000
MNT_NFS4ACLS = 0x00000010
MNT_WAIT = 1
MNT_NOWAIT = 2
MNT_LAZY = 3
MNT_SUSPEND = 4
) )
const ( const (

@ -15,28 +15,6 @@ const (
DEVSTAT_READ = 0x01 DEVSTAT_READ = 0x01
DEVSTAT_WRITE = 0x02 DEVSTAT_WRITE = 0x02
DEVSTAT_FREE = 0x03 DEVSTAT_FREE = 0x03
MNT_RDONLY = 0x00000001
MNT_SYNCHRONOUS = 0x00000002
MNT_NOEXEC = 0x00000004
MNT_NOSUID = 0x00000008
MNT_UNION = 0x00000020
MNT_ASYNC = 0x00000040
MNT_SUIDDIR = 0x00100000
MNT_SOFTDEP = 0x00200000
MNT_NOSYMFOLLOW = 0x00400000
MNT_GJOURNAL = 0x02000000
MNT_MULTILABEL = 0x04000000
MNT_ACLS = 0x08000000
MNT_NOATIME = 0x10000000
MNT_NOCLUSTERR = 0x40000000
MNT_NOCLUSTERW = 0x80000000
MNT_NFS4ACLS = 0x00000010
MNT_WAIT = 1
MNT_NOWAIT = 2
MNT_LAZY = 3
MNT_SUSPEND = 4
) )
const ( const (

@ -6,39 +6,17 @@
package disk package disk
const ( const (
sizeofPtr = 0x8 sizeofPtr = 0x8
sizeofShort = 0x2 sizeofShort = 0x2
sizeofInt = 0x4 sizeofInt = 0x4
sizeofLong = 0x8 sizeofLong = 0x8
sizeofLongLong = 0x8 sizeofLongLong = 0x8
sizeofLongDouble = 0x8 sizeofLongDouble = 0x8
DEVSTAT_NO_DATA = 0x00 DEVSTAT_NO_DATA = 0x00
DEVSTAT_READ = 0x01 DEVSTAT_READ = 0x01
DEVSTAT_WRITE = 0x02 DEVSTAT_WRITE = 0x02
DEVSTAT_FREE = 0x03 DEVSTAT_FREE = 0x03
MNT_RDONLY = 0x00000001
MNT_SYNCHRONOUS = 0x00000002
MNT_NOEXEC = 0x00000004
MNT_NOSUID = 0x00000008
MNT_UNION = 0x00000020
MNT_ASYNC = 0x00000040
MNT_SUIDDIR = 0x00100000
MNT_SOFTDEP = 0x00200000
MNT_NOSYMFOLLOW = 0x00400000
MNT_GJOURNAL = 0x02000000
MNT_MULTILABEL = 0x04000000
MNT_ACLS = 0x08000000
MNT_NOATIME = 0x10000000
MNT_NOCLUSTERR = 0x40000000
MNT_NOCLUSTERW = 0x80000000
MNT_NFS4ACLS = 0x00000010
MNT_WAIT = 1
MNT_NOWAIT = 2
MNT_LAZY = 3
MNT_SUSPEND = 4
) )
const ( const (
@ -46,68 +24,68 @@ const (
) )
type ( type (
_C_short int16 _C_short int16
_C_int int32 _C_int int32
_C_long int64 _C_long int64
_C_long_long int64 _C_long_long int64
_C_long_double int64 _C_long_double int64
) )
type Statfs struct { type Statfs struct {
Version uint32 Version uint32
Type uint32 Type uint32
Flags uint64 Flags uint64
Bsize uint64 Bsize uint64
Iosize uint64 Iosize uint64
Blocks uint64 Blocks uint64
Bfree uint64 Bfree uint64
Bavail int64 Bavail int64
Files uint64 Files uint64
Ffree int64 Ffree int64
Syncwrites uint64 Syncwrites uint64
Asyncwrites uint64 Asyncwrites uint64
Syncreads uint64 Syncreads uint64
Asyncreads uint64 Asyncreads uint64
Spare [10]uint64 Spare [10]uint64
Namemax uint32 Namemax uint32
Owner uint32 Owner uint32
Fsid Fsid Fsid Fsid
Charspare [80]uint8 Charspare [80]uint8
Fstypename [16]int8 Fstypename [16]int8
Mntfromname [1024]int8 Mntfromname [1024]int8
Mntonname [1024]int8 Mntonname [1024]int8
} }
type Fsid struct { type Fsid struct {
Val [2]int32 Val [2]int32
} }
type Devstat struct { type Devstat struct {
Sequence0 uint32 Sequence0 uint32
Allocated int32 Allocated int32
Start_count uint32 Start_count uint32
End_count uint32 End_count uint32
Busy_from Bintime Busy_from Bintime
Dev_links _Ctype_struct___0 Dev_links _Ctype_struct___0
Device_number uint32 Device_number uint32
Device_name [16]int8 Device_name [16]int8
Unit_number int32 Unit_number int32
Bytes [4]uint64 Bytes [4]uint64
Operations [4]uint64 Operations [4]uint64
Duration [4]Bintime Duration [4]Bintime
Busy_time Bintime Busy_time Bintime
Creation_time Bintime Creation_time Bintime
Block_size uint32 Block_size uint32
Tag_types [3]uint64 Tag_types [3]uint64
Flags uint32 Flags uint32
Device_type uint32 Device_type uint32
Priority uint32 Priority uint32
Id *byte Id *byte
Sequence1 uint32 Sequence1 uint32
Pad_cgo_0 [4]byte Pad_cgo_0 [4]byte
} }
type Bintime struct { type Bintime struct {
Sec int64 Sec int64
Frac uint64 Frac uint64
} }
type _Ctype_struct___0 struct { type _Ctype_struct___0 struct {

@ -21,34 +21,34 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
var ret []PartitionStat var ret []PartitionStat
// get length // get length
count, err := unix.Getfsstat(nil, MNT_WAIT) count, err := unix.Getfsstat(nil, unix.MNT_WAIT)
if err != nil { if err != nil {
return ret, err return ret, err
} }
fs := make([]Statfs, count) fs := make([]Statfs, count)
if _, err = Getfsstat(fs, MNT_WAIT); err != nil { if _, err = Getfsstat(fs, unix.MNT_WAIT); err != nil {
return ret, err return ret, err
} }
for _, stat := range fs { for _, stat := range fs {
opts := "rw" opts := "rw"
if stat.F_flags&MNT_RDONLY != 0 { if stat.F_flags&unix.MNT_RDONLY != 0 {
opts = "ro" opts = "ro"
} }
if stat.F_flags&MNT_SYNCHRONOUS != 0 { if stat.F_flags&unix.MNT_SYNCHRONOUS != 0 {
opts += ",sync" opts += ",sync"
} }
if stat.F_flags&MNT_NOEXEC != 0 { if stat.F_flags&unix.MNT_NOEXEC != 0 {
opts += ",noexec" opts += ",noexec"
} }
if stat.F_flags&MNT_NOSUID != 0 { if stat.F_flags&unix.MNT_NOSUID != 0 {
opts += ",nosuid" opts += ",nosuid"
} }
if stat.F_flags&MNT_NODEV != 0 { if stat.F_flags&unix.MNT_NODEV != 0 {
opts += ",nodev" opts += ",nodev"
} }
if stat.F_flags&MNT_ASYNC != 0 { if stat.F_flags&unix.MNT_ASYNC != 0 {
opts += ",async" opts += ",async"
} }

@ -15,17 +15,6 @@ const (
DEVSTAT_READ = 0x01 DEVSTAT_READ = 0x01
DEVSTAT_WRITE = 0x02 DEVSTAT_WRITE = 0x02
DEVSTAT_FREE = 0x03 DEVSTAT_FREE = 0x03
MNT_RDONLY = 0x00000001
MNT_SYNCHRONOUS = 0x00000002
MNT_NOEXEC = 0x00000004
MNT_NOSUID = 0x00000008
MNT_NODEV = 0x00000010
MNT_ASYNC = 0x00000040
MNT_WAIT = 1
MNT_NOWAIT = 2
MNT_LAZY = 3
) )
const ( const (

@ -15,17 +15,6 @@ const (
DEVSTAT_READ = 0x01 DEVSTAT_READ = 0x01
DEVSTAT_WRITE = 0x02 DEVSTAT_WRITE = 0x02
DEVSTAT_FREE = 0x03 DEVSTAT_FREE = 0x03
MNT_RDONLY = 0x00000001
MNT_SYNCHRONOUS = 0x00000002
MNT_NOEXEC = 0x00000004
MNT_NOSUID = 0x00000008
MNT_NODEV = 0x00000010
MNT_ASYNC = 0x00000040
MNT_WAIT = 1
MNT_NOWAIT = 2
MNT_LAZY = 3
) )
const ( const (

@ -42,29 +42,6 @@ const (
DEVSTAT_READ = 0x01 DEVSTAT_READ = 0x01
DEVSTAT_WRITE = 0x02 DEVSTAT_WRITE = 0x02
DEVSTAT_FREE = 0x03 DEVSTAT_FREE = 0x03
// from sys/mount.h
MNT_RDONLY = 0x00000001 /* read only filesystem */
MNT_SYNCHRONOUS = 0x00000002 /* filesystem written synchronously */
MNT_NOEXEC = 0x00000004 /* can't exec from filesystem */
MNT_NOSUID = 0x00000008 /* don't honor setuid bits on fs */
MNT_UNION = 0x00000020 /* union with underlying filesystem */
MNT_ASYNC = 0x00000040 /* filesystem written asynchronously */
MNT_SUIDDIR = 0x00100000 /* special handling of SUID on dirs */
MNT_SOFTDEP = 0x00200000 /* soft updates being done */
MNT_NOSYMFOLLOW = 0x00400000 /* do not follow symlinks */
MNT_GJOURNAL = 0x02000000 /* GEOM journal support enabled */
MNT_MULTILABEL = 0x04000000 /* MAC support for individual objects */
MNT_ACLS = 0x08000000 /* ACL support enabled */
MNT_NOATIME = 0x10000000 /* disable update of file access time */
MNT_NOCLUSTERR = 0x40000000 /* disable cluster read */
MNT_NOCLUSTERW = 0x80000000 /* disable cluster write */
MNT_NFS4ACLS = 0x00000010
MNT_WAIT = 1 /* synchronously wait for I/O to complete */
MNT_NOWAIT = 2 /* start all I/O, but do not wait for it */
MNT_LAZY = 3 /* push data not written by filesystem syncer */
MNT_SUSPEND = 4 /* Suspend file system after sync */
) )
const ( const (

@ -33,18 +33,6 @@ const (
DEVSTAT_READ = 0x01 DEVSTAT_READ = 0x01
DEVSTAT_WRITE = 0x02 DEVSTAT_WRITE = 0x02
DEVSTAT_FREE = 0x03 DEVSTAT_FREE = 0x03
// from sys/mount.h
MNT_RDONLY = 0x00000001 /* read only filesystem */
MNT_SYNCHRONOUS = 0x00000002 /* filesystem written synchronously */
MNT_NOEXEC = 0x00000004 /* can't exec from filesystem */
MNT_NOSUID = 0x00000008 /* don't honor setuid bits on fs */
MNT_NODEV = 0x00000010 /* don't interpret special files */
MNT_ASYNC = 0x00000040 /* filesystem written asynchronously */
MNT_WAIT = 1 /* synchronously wait for I/O to complete */
MNT_NOWAIT = 2 /* start all I/O, but do not wait for it */
MNT_LAZY = 3 /* push data not written by filesystem syncer */
) )
const ( const (

Loading…
Cancel
Save