Skip to content

Commit

Permalink
Merge pull request #975 from shirou/feature/remove_disk_partition_arg…
Browse files Browse the repository at this point in the history
…s_on_bsds

Feature/remove disk partition args on bsds
  • Loading branch information
shirou authored Oct 24, 2020
2 parents 3202231 + f258441 commit cf222ab
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 18 deletions.
54 changes: 54 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package:cpu:
- cpu/*
package:disk:
- disk/*
package:docker:
- docker/*
package:host:
- host/*
package:load:
- load/*
package:mem:
- mem/*
package:net:
- net/*
package:process:
- process/*
package:winservices:
- winservices/*
os:linux:
- ./**/*_linux.go
- ./**/*_linux_mips64.go
- ./**/*_linux_386.go
- ./**/*_linux_test.go
- ./**/*_linux_s390x.go
- ./**/*_linux_amd64.go
- ./**/*_posix.go
os:freebsd:
- ./**/*_freebsd.go
- ./**/*_freebsd_386.go
- ./**/*_freebsd_test.go
- ./**/*_freebsd_amd64.go
- ./**/*_bsd.go
- ./**/*_posix.go
os:darwin:
- ./**/*_darwin.go
- ./**/*_darwin_386.go
- ./**/*_darwin_test.go
- ./**/*_darwin_amd64.go
- ./**/*_posix.go
os:openbsd:
- ./**/*_openbsd.go
- ./**/*_openbsd_386.go
- ./**/*_openbsd_test.go
- ./**/*_openbsd_amd64.go
- ./**/*_bsd.go
- ./**/*_posix.go
os:windows:
- ./**/*_windows.go
- ./**/*_windows_386.go
- ./**/*_windows_test.go
- ./**/*_windows_amd64.go
os:solaris:
- ./**/*_solaris.go
- ./**/*_posix.go
11 changes: 11 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "Pull Request Labeler"
on:
- pull_request

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
8 changes: 2 additions & 6 deletions disk/disk_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package disk

import (
"context"
"path"

"github.com/shirou/gopsutil/internal/common"
"golang.org/x/sys/unix"
Expand All @@ -14,6 +13,8 @@ func Partitions(all bool) ([]PartitionStat, error) {
return PartitionsWithContext(context.Background(), all)
}

// PartitionsWithContext returns disk partition.
// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
var ret []PartitionStat

Expand Down Expand Up @@ -69,11 +70,6 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
Fstype: common.ByteToString(stat.Fstypename[:]),
Opts: opts,
}
if all == false {
if !path.IsAbs(d.Device) || !common.PathExists(d.Device) {
continue
}
}

ret = append(ret, d)
}
Expand Down
8 changes: 2 additions & 6 deletions disk/disk_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"bytes"
"context"
"encoding/binary"
"path"
"strconv"

"golang.org/x/sys/unix"
Expand All @@ -18,6 +17,8 @@ func Partitions(all bool) ([]PartitionStat, error) {
return PartitionsWithContext(context.Background(), all)
}

// PartitionsWithContext returns disk partition.
// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
var ret []PartitionStat

Expand Down Expand Up @@ -89,11 +90,6 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
Fstype: common.ByteToString(stat.Fstypename[:]),
Opts: opts,
}
if all == false {
if !path.IsAbs(d.Device) || !common.PathExists(d.Device) {
continue
}
}

ret = append(ret, d)
}
Expand Down
8 changes: 2 additions & 6 deletions disk/disk_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"bytes"
"context"
"encoding/binary"
"path"

"github.com/shirou/gopsutil/internal/common"
"golang.org/x/sys/unix"
Expand All @@ -16,6 +15,8 @@ func Partitions(all bool) ([]PartitionStat, error) {
return PartitionsWithContext(context.Background(), all)
}

// PartitionsWithContext returns disk partition.
// 'all' argument is ignored, see: https://github.com/giampaolo/psutil/issues/906
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
var ret []PartitionStat

Expand Down Expand Up @@ -66,11 +67,6 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
Fstype: common.IntToString(stat.F_fstypename[:]),
Opts: opts,
}
if all == false {
if !path.IsAbs(d.Device) || !common.PathExists(d.Device) {
continue
}
}

ret = append(ret, d)
}
Expand Down

0 comments on commit cf222ab

Please sign in to comment.