Skip to content

Commit

Permalink
Use MNT_* consts from golang.org/x/sys/unix on freebsd and openbsd
Browse files Browse the repository at this point in the history
Update vendored version of golang.org/x/sys/unix and use the MNT_*
constants there to replace the locally generated ones.
  • Loading branch information
tklauser committed Dec 23, 2019
1 parent c141152 commit 214c5bd
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 234 deletions.
4 changes: 2 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions disk/disk_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,64 +23,64 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
var ret []PartitionStat

// get length
count, err := unix.Getfsstat(nil, MNT_WAIT)
count, err := unix.Getfsstat(nil, unix.MNT_WAIT)
if err != nil {
return ret, err
}

fs := make([]Statfs, count)
if _, err = Getfsstat(fs, MNT_WAIT); err != nil {
if _, err = Getfsstat(fs, unix.MNT_WAIT); err != nil {
return ret, err
}

for _, stat := range fs {
opts := "rw"
if stat.Flags&MNT_RDONLY != 0 {
if stat.Flags&unix.MNT_RDONLY != 0 {
opts = "ro"
}
if stat.Flags&MNT_SYNCHRONOUS != 0 {
if stat.Flags&unix.MNT_SYNCHRONOUS != 0 {
opts += ",sync"
}
if stat.Flags&MNT_NOEXEC != 0 {
if stat.Flags&unix.MNT_NOEXEC != 0 {
opts += ",noexec"
}
if stat.Flags&MNT_NOSUID != 0 {
if stat.Flags&unix.MNT_NOSUID != 0 {
opts += ",nosuid"
}
if stat.Flags&MNT_UNION != 0 {
if stat.Flags&unix.MNT_UNION != 0 {
opts += ",union"
}
if stat.Flags&MNT_ASYNC != 0 {
if stat.Flags&unix.MNT_ASYNC != 0 {
opts += ",async"
}
if stat.Flags&MNT_SUIDDIR != 0 {
if stat.Flags&unix.MNT_SUIDDIR != 0 {
opts += ",suiddir"
}
if stat.Flags&MNT_SOFTDEP != 0 {
if stat.Flags&unix.MNT_SOFTDEP != 0 {
opts += ",softdep"
}
if stat.Flags&MNT_NOSYMFOLLOW != 0 {
if stat.Flags&unix.MNT_NOSYMFOLLOW != 0 {
opts += ",nosymfollow"
}
if stat.Flags&MNT_GJOURNAL != 0 {
if stat.Flags&unix.MNT_GJOURNAL != 0 {
opts += ",gjounalc"
}
if stat.Flags&MNT_MULTILABEL != 0 {
if stat.Flags&unix.MNT_MULTILABEL != 0 {
opts += ",multilabel"
}
if stat.Flags&MNT_ACLS != 0 {
if stat.Flags&unix.MNT_ACLS != 0 {
opts += ",acls"
}
if stat.Flags&MNT_NOATIME != 0 {
if stat.Flags&unix.MNT_NOATIME != 0 {
opts += ",noattime"
}
if stat.Flags&MNT_NOCLUSTERR != 0 {
if stat.Flags&unix.MNT_NOCLUSTERR != 0 {
opts += ",nocluster"
}
if stat.Flags&MNT_NOCLUSTERW != 0 {
if stat.Flags&unix.MNT_NOCLUSTERW != 0 {
opts += ",noclusterw"
}
if stat.Flags&MNT_NFS4ACLS != 0 {
if stat.Flags&unix.MNT_NFS4ACLS != 0 {
opts += ",nfs4acls"
}

Expand Down
22 changes: 0 additions & 22 deletions disk/disk_freebsd_386.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,6 @@ const (
DEVSTAT_READ = 0x01
DEVSTAT_WRITE = 0x02
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 (
Expand Down
22 changes: 0 additions & 22 deletions disk/disk_freebsd_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,6 @@ const (
DEVSTAT_READ = 0x01
DEVSTAT_WRITE = 0x02
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 (
Expand Down
22 changes: 0 additions & 22 deletions disk/disk_freebsd_arm.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,6 @@ const (
DEVSTAT_READ = 0x01
DEVSTAT_WRITE = 0x02
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 (
Expand Down
144 changes: 61 additions & 83 deletions disk/disk_freebsd_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 214c5bd

Please sign in to comment.