@@ -28,36 +28,36 @@ import (
2828const fibrechannelClassPath = "class/fc_host"
2929
3030type FibreChannelCounters struct {
31- DumpedFrames uint64 // /sys/class/fc_host/<Name>/statistics/dumped_frames
32- ErrorFrames uint64 // /sys/class/fc_host/<Name>/statistics/error_frames
33- InvalidCRCCount uint64 // /sys/class/fc_host/<Name>/statistics/invalid_crc_count
34- RXFrames uint64 // /sys/class/fc_host/<Name>/statistics/rx_frames
35- RXWords uint64 // /sys/class/fc_host/<Name>/statistics/rx_words
36- TXFrames uint64 // /sys/class/fc_host/<Name>/statistics/tx_frames
37- TXWords uint64 // /sys/class/fc_host/<Name>/statistics/tx_words
38- SecondsSinceLastReset uint64 // /sys/class/fc_host/<Name>/statistics/seconds_since_last_reset
39- InvalidTXWordCount uint64 // /sys/class/fc_host/<Name>/statistics/invalid_tx_word_count
40- LinkFailureCount uint64 // /sys/class/fc_host/<Name>/statistics/link_failure_count
41- LossOfSyncCount uint64 // /sys/class/fc_host/<Name>/statistics/loss_of_sync_count
42- LossOfSignalCount uint64 // /sys/class/fc_host/<Name>/statistics/loss_of_signal_count
43- NosCount uint64 // /sys/class/fc_host/<Name>/statistics/nos_count
44- FCPPacketAborts uint64 // / sys/class/fc_host/<Name>/statistics/fcp_packet_aborts
31+ DumpedFrames * uint64 // /sys/class/fc_host/<Name>/statistics/dumped_frames
32+ ErrorFrames * uint64 // /sys/class/fc_host/<Name>/statistics/error_frames
33+ InvalidCRCCount * uint64 // /sys/class/fc_host/<Name>/statistics/invalid_crc_count
34+ RXFrames * uint64 // /sys/class/fc_host/<Name>/statistics/rx_frames
35+ RXWords * uint64 // /sys/class/fc_host/<Name>/statistics/rx_words
36+ TXFrames * uint64 // /sys/class/fc_host/<Name>/statistics/tx_frames
37+ TXWords * uint64 // /sys/class/fc_host/<Name>/statistics/tx_words
38+ SecondsSinceLastReset * uint64 // /sys/class/fc_host/<Name>/statistics/seconds_since_last_reset
39+ InvalidTXWordCount * uint64 // /sys/class/fc_host/<Name>/statistics/invalid_tx_word_count
40+ LinkFailureCount * uint64 // /sys/class/fc_host/<Name>/statistics/link_failure_count
41+ LossOfSyncCount * uint64 // /sys/class/fc_host/<Name>/statistics/loss_of_sync_count
42+ LossOfSignalCount * uint64 // /sys/class/fc_host/<Name>/statistics/loss_of_signal_count
43+ NosCount * uint64 // /sys/class/fc_host/<Name>/statistics/nos_count
44+ FCPPacketAborts * uint64 // /sys/class/fc_host/<Name>/statistics/fcp_packet_aborts
4545}
4646
4747type FibreChannelHost struct {
48- Name string // /sys/class/fc_host/<Name>
49- Speed string // /sys/class/fc_host/<Name>/speed
50- PortState string // /sys/class/fc_host/<Name>/port_state
51- PortType string // /sys/class/fc_host/<Name>/port_type
52- SymbolicName string // /sys/class/fc_host/<Name>/symbolic_name
53- NodeName string // /sys/class/fc_host/<Name>/node_name
54- PortID string // /sys/class/fc_host/<Name>/port_id
55- PortName string // /sys/class/fc_host/<Name>/port_name
56- FabricName string // /sys/class/fc_host/<Name>/fabric_name
57- DevLossTMO string // /sys/class/fc_host/<Name>/dev_loss_tmo
58- SupportedClasses string // /sys/class/fc_host/<Name>/supported_classes
59- SupportedSpeeds string // /sys/class/fc_host/<Name>/supported_speeds
60- Counters FibreChannelCounters // /sys/class/fc_host/<Name>/statistics/*
48+ Name * string // /sys/class/fc_host/<Name>
49+ Speed * string // /sys/class/fc_host/<Name>/speed
50+ PortState * string // /sys/class/fc_host/<Name>/port_state
51+ PortType * string // /sys/class/fc_host/<Name>/port_type
52+ SymbolicName * string // /sys/class/fc_host/<Name>/symbolic_name
53+ NodeName * string // /sys/class/fc_host/<Name>/node_name
54+ PortID * string // /sys/class/fc_host/<Name>/port_id
55+ PortName * string // /sys/class/fc_host/<Name>/port_name
56+ FabricName * string // /sys/class/fc_host/<Name>/fabric_name
57+ DevLossTMO * string // /sys/class/fc_host/<Name>/dev_loss_tmo
58+ SupportedClasses * string // /sys/class/fc_host/<Name>/supported_classes
59+ SupportedSpeeds * string // /sys/class/fc_host/<Name>/supported_speeds
60+ Counters * FibreChannelCounters // /sys/class/fc_host/<Name>/statistics/*
6161}
6262
6363type FibreChannelClass map [string ]FibreChannelHost
@@ -78,7 +78,7 @@ func (fs FS) FibreChannelClass() (FibreChannelClass, error) {
7878 return nil , err
7979 }
8080
81- fcc [host .Name ] = * host
81+ fcc [* host .Name ] = * host
8282 }
8383
8484 return fcc , nil
@@ -87,7 +87,7 @@ func (fs FS) FibreChannelClass() (FibreChannelClass, error) {
8787// Parse a single FC host.
8888func (fs FS ) parseFibreChannelHost (name string ) (* FibreChannelHost , error ) {
8989 path := fs .sys .Path (fibrechannelClassPath , name )
90- host := FibreChannelHost {Name : name }
90+ host := FibreChannelHost {Name : & name }
9191
9292 for _ , f := range [... ]string {"speed" , "port_state" , "port_type" , "node_name" , "port_id" , "port_name" , "fabric_name" , "dev_loss_tmo" , "symbolic_name" , "supported_classes" , "supported_speeds" } {
9393 name := filepath .Join (path , f )
@@ -103,47 +103,47 @@ func (fs FS) parseFibreChannelHost(name string) (*FibreChannelHost, error) {
103103
104104 switch f {
105105 case "speed" :
106- host .Speed = value
106+ host .Speed = & value
107107 case "port_state" :
108- host .PortState = value
108+ host .PortState = & value
109109 case "port_type" :
110- host .PortType = value
110+ host .PortType = & value
111111 case "node_name" :
112112 if len (value ) > 2 {
113113 value = value [2 :]
114114 }
115- host .NodeName = value
115+ host .NodeName = & value
116116 case "port_id" :
117117 if len (value ) > 2 {
118118 value = value [2 :]
119119 }
120- host .PortID = value
120+ host .PortID = & value
121121 case "port_name" :
122122 if len (value ) > 2 {
123123 value = value [2 :]
124124 }
125- host .PortName = value
125+ host .PortName = & value
126126 case "fabric_name" :
127127 if len (value ) > 2 {
128128 value = value [2 :]
129129 }
130- host .FabricName = value
130+ host .FabricName = & value
131131 case "dev_loss_tmo" :
132- host .DevLossTMO = value
132+ host .DevLossTMO = & value
133133 case "supported_classes" :
134- host .SupportedClasses = value
134+ host .SupportedClasses = & value
135135 case "supported_speeds" :
136- host .SupportedSpeeds = value
136+ host .SupportedSpeeds = & value
137137 case "symbolic_name" :
138- host .SymbolicName = value
138+ host .SymbolicName = & value
139139 }
140140 }
141141
142142 counters , err := parseFibreChannelStatistics (path )
143143 if err != nil {
144144 return nil , err
145145 }
146- host .Counters = * counters
146+ host .Counters = counters
147147
148148 return & host , nil
149149}
@@ -178,9 +178,9 @@ func parseFibreChannelStatistics(hostPath string) (*FibreChannelCounters, error)
178178 // Below switch was automatically generated. Don't need everything in there yet, so the unwanted bits are commented out.
179179 switch f .Name () {
180180 case "dumped_frames" :
181- counters .DumpedFrames = * vp .PUInt64 ()
181+ counters .DumpedFrames = vp .PUInt64 ()
182182 case "error_frames" :
183- counters .ErrorFrames = * vp .PUInt64 ()
183+ counters .ErrorFrames = vp .PUInt64 ()
184184 /*
185185 case "fc_no_free_exch":
186186 counters.FcNoFreeExch = *vp.PUInt64()
@@ -208,41 +208,41 @@ func parseFibreChannelStatistics(hostPath string) (*FibreChannelCounters, error)
208208 counters.FcpOutputRequests = *vp.PUInt64()
209209 */
210210 case "fcp_packet_aborts" :
211- counters .FCPPacketAborts = * vp .PUInt64 ()
211+ counters .FCPPacketAborts = vp .PUInt64 ()
212212 /*
213213 case "fcp_packet_alloc_failures":
214214 counters.FcpPacketAllocFailures = *vp.PUInt64()
215215 */
216216 case "invalid_tx_word_count" :
217- counters .InvalidTXWordCount = * vp .PUInt64 ()
217+ counters .InvalidTXWordCount = vp .PUInt64 ()
218218 case "invalid_crc_count" :
219- counters .InvalidCRCCount = * vp .PUInt64 ()
219+ counters .InvalidCRCCount = vp .PUInt64 ()
220220 case "link_failure_count" :
221- counters .LinkFailureCount = * vp .PUInt64 ()
221+ counters .LinkFailureCount = vp .PUInt64 ()
222222 /*
223223 case "lip_count":
224224 counters.LipCount = *vp.PUInt64()
225225 */
226226 case "loss_of_signal_count" :
227- counters .LossOfSignalCount = * vp .PUInt64 ()
227+ counters .LossOfSignalCount = vp .PUInt64 ()
228228 case "loss_of_sync_count" :
229- counters .LossOfSyncCount = * vp .PUInt64 ()
229+ counters .LossOfSyncCount = vp .PUInt64 ()
230230 case "nos_count" :
231- counters .NosCount = * vp .PUInt64 ()
231+ counters .NosCount = vp .PUInt64 ()
232232 /*
233233 case "prim_seq_protocol_err_count":
234234 counters.PrimSeqProtocolErrCount = *vp.PUInt64()
235235 */
236236 case "rx_frames" :
237- counters .RXFrames = * vp .PUInt64 ()
237+ counters .RXFrames = vp .PUInt64 ()
238238 case "rx_words" :
239- counters .RXWords = * vp .PUInt64 ()
239+ counters .RXWords = vp .PUInt64 ()
240240 case "seconds_since_last_reset" :
241- counters .SecondsSinceLastReset = * vp .PUInt64 ()
241+ counters .SecondsSinceLastReset = vp .PUInt64 ()
242242 case "tx_frames" :
243- counters .TXFrames = * vp .PUInt64 ()
243+ counters .TXFrames = vp .PUInt64 ()
244244 case "tx_words" :
245- counters .TXWords = * vp .PUInt64 ()
245+ counters .TXWords = vp .PUInt64 ()
246246 }
247247
248248 if err := vp .Err (); err != nil {
0 commit comments