Skip to content

Commit

Permalink
fix: rename v3 that remained in file c to v4
Browse files Browse the repository at this point in the history
  • Loading branch information
shirou committed May 28, 2024
1 parent 6bdbf65 commit c34d29a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion disk/disk_darwin_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error) {
var buf [C.NDRIVE]C.DriveStats
n, err := C.gopsutil_v3_readdrivestat(&buf[0], C.int(len(buf)))
n, err := C.gopsutil_v4_readdrivestat(&buf[0], C.int(len(buf)))
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion disk/iostat_darwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static int getdrivestat(io_registry_entry_t d, DriveStats *stat);
static int fillstat(io_registry_entry_t d, DriveStats *stat);

int
gopsutil_v3_readdrivestat(DriveStats a[], int n)
gopsutil_v4_readdrivestat(DriveStats a[], int n)
{
CFMutableDictionaryRef match;
io_iterator_t drives;
Expand Down
2 changes: 1 addition & 1 deletion disk/iostat_darwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ struct CPUStats {
natural_t idle;
};

extern int gopsutil_v3_readdrivestat(DriveStats a[], int n);
extern int gopsutil_v4_readdrivestat(DriveStats a[], int n);
2 changes: 1 addition & 1 deletion host/host_aix.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strconv"
"strings"

"github.com/shirou/gopsutil/v3/internal/common"
"github.com/shirou/gopsutil/v4/internal/common"
)

// from https://www.ibm.com/docs/en/aix/7.2?topic=files-utmph-file
Expand Down
6 changes: 3 additions & 3 deletions sensors/sensors_darwin_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ func TemperaturesWithContext(ctx context.Context) ([]TemperatureStat, error) {
}
var temperatures []TemperatureStat

C.gopsutil_v3_open_smc()
defer C.gopsutil_v3_close_smc()
C.gopsutil_v4_open_smc()
defer C.gopsutil_v4_close_smc()

for _, key := range temperatureKeys {
temperatures = append(temperatures, TemperatureStat{
SensorKey: key,
Temperature: float64(C.gopsutil_v3_get_temperature(C.CString(key))),
Temperature: float64(C.gopsutil_v4_get_temperature(C.CString(key))),
})
}
return temperatures, nil
Expand Down
6 changes: 3 additions & 3 deletions sensors/smc_darwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ typedef struct {
static const int SMC_KEY_SIZE = 4; // number of characters in an SMC key.
static io_connect_t conn; // our connection to the SMC.

kern_return_t gopsutil_v3_open_smc(void) {
kern_return_t gopsutil_v4_open_smc(void) {
kern_return_t result;
io_service_t service;

Expand All @@ -86,7 +86,7 @@ kern_return_t gopsutil_v3_open_smc(void) {
return result;
}

kern_return_t gopsutil_v3_close_smc(void) { return IOServiceClose(conn); }
kern_return_t gopsutil_v4_close_smc(void) { return IOServiceClose(conn); }

static uint32_t to_uint32(char *key) {
uint32_t ans = 0;
Expand Down Expand Up @@ -155,7 +155,7 @@ static kern_return_t read_smc(char *key, smc_return_t *result_smc) {
return result;
}

double gopsutil_v3_get_temperature(char *key) {
double gopsutil_v4_get_temperature(char *key) {
kern_return_t result;
smc_return_t result_smc;

Expand Down
6 changes: 3 additions & 3 deletions sensors/smc_darwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#define THUNDERBOLT_1 "TI1P"
#define WIRELESS_MODULE "TW0P"

kern_return_t gopsutil_v3_open_smc(void);
kern_return_t gopsutil_v3_close_smc(void);
double gopsutil_v3_get_temperature(char *);
kern_return_t gopsutil_v4_open_smc(void);
kern_return_t gopsutil_v4_close_smc(void);
double gopsutil_v4_get_temperature(char *);

#endif // __SMC_H__

0 comments on commit c34d29a

Please sign in to comment.