summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapter/statsclient/stat_segment_api.go5
-rw-r--r--adapter/statsclient/statsclient.go4
-rw-r--r--adapter/statsclient/statseg_v1.go4
-rw-r--r--adapter/statsclient/statseg_v2.go4
4 files changed, 9 insertions, 8 deletions
diff --git a/adapter/statsclient/stat_segment_api.go b/adapter/statsclient/stat_segment_api.go
index fd7ef36..cb8b105 100644
--- a/adapter/statsclient/stat_segment_api.go
+++ b/adapter/statsclient/stat_segment_api.go
@@ -16,10 +16,11 @@ package statsclient
import (
"fmt"
- "git.fd.io/govpp.git/adapter"
"sync/atomic"
"time"
"unsafe"
+
+ "git.fd.io/govpp.git/adapter"
)
var (
@@ -77,7 +78,7 @@ type statSegment interface {
//
// Note that if the index is equal to 0, the result pointer points to
// the same memory address as the argument.
- GetStatDirOnIndex(v dirVector, index uint32) (dirSegment, dirName, dirType)
+ GetStatDirOnIndex(v dirVector, index uint32) (dirSegment, dirName, adapter.StatType)
// GetEpoch re-loads stats header and returns current epoch
//and 'inProgress' value
diff --git a/adapter/statsclient/statsclient.go b/adapter/statsclient/statsclient.go
index 6231f69..18c1266 100644
--- a/adapter/statsclient/statsclient.go
+++ b/adapter/statsclient/statsclient.go
@@ -518,7 +518,7 @@ func (sc *StatsClient) getStatEntriesOnIndex(vector dirVector, indexes ...uint32
},
Type: t,
Data: d,
- Symlink: adapter.StatType(dirType) == adapter.Symlink,
+ Symlink: dirType == adapter.Symlink,
})
}
return entries, nil
@@ -602,7 +602,7 @@ func (sc *StatsClient) updateStatOnIndex(entry *adapter.StatEntry, vector dirVec
dirPtr, dirName, dirType := sc.GetStatDirOnIndex(vector, entry.Index)
if len(dirName) == 0 ||
!bytes.Equal(dirName, entry.Name) ||
- adapter.StatType(dirType) != entry.Type ||
+ dirType != entry.Type ||
entry.Data == nil {
return nil
}
diff --git a/adapter/statsclient/statseg_v1.go b/adapter/statsclient/statseg_v1.go
index 3f15ce2..202a1b0 100644
--- a/adapter/statsclient/statseg_v1.go
+++ b/adapter/statsclient/statseg_v1.go
@@ -75,7 +75,7 @@ func (ss *statSegmentV1) getErrorVector() (unsafe.Pointer, error) {
return nil, fmt.Errorf("error vector is not defined for stats API v1")
}
-func (ss *statSegmentV1) GetStatDirOnIndex(v dirVector, index uint32) (dirSegment, dirName, dirType) {
+func (ss *statSegmentV1) GetStatDirOnIndex(v dirVector, index uint32) (dirSegment, dirName, adapter.StatType) {
statSegDir := dirSegment(uintptr(v) + uintptr(index)*unsafe.Sizeof(statSegDirectoryEntryV1{}))
dir := (*statSegDirectoryEntryV1)(statSegDir)
var name []byte
@@ -85,7 +85,7 @@ func (ss *statSegmentV1) GetStatDirOnIndex(v dirVector, index uint32) (dirSegmen
break
}
}
- return statSegDir, name, dir.directoryType
+ return statSegDir, name, getStatType(dir.directoryType, true)
}
func (ss *statSegmentV1) GetEpoch() (int64, bool) {
diff --git a/adapter/statsclient/statseg_v2.go b/adapter/statsclient/statseg_v2.go
index 11a3679..aa65a3d 100644
--- a/adapter/statsclient/statseg_v2.go
+++ b/adapter/statsclient/statseg_v2.go
@@ -72,7 +72,7 @@ func (ss *statSegmentV2) GetDirectoryVector() dirVector {
return ss.adjust(dirVector(&header.dirVector))
}
-func (ss *statSegmentV2) GetStatDirOnIndex(v dirVector, index uint32) (dirSegment, dirName, dirType) {
+func (ss *statSegmentV2) GetStatDirOnIndex(v dirVector, index uint32) (dirSegment, dirName, adapter.StatType) {
statSegDir := dirSegment(uintptr(v) + uintptr(index)*unsafe.Sizeof(statSegDirectoryEntryV2{}))
dir := (*statSegDirectoryEntryV2)(statSegDir)
var name []byte
@@ -82,7 +82,7 @@ func (ss *statSegmentV2) GetStatDirOnIndex(v dirVector, index uint32) (dirSegmen
break
}
}
- return statSegDir, name, dir.directoryType
+ return statSegDir, name, getStatType(dir.directoryType, ss.getErrorVector() != nil)
}
func (ss *statSegmentV2) GetEpoch() (int64, bool) {