@@ -68,8 +68,8 @@ type SMBStatusFileID struct {
68
68
Extid int32 `json:"extid"`
69
69
}
70
70
71
- // SMBStatusLockedFile represents a locked -file output field
72
- type SMBStatusLockedFile struct {
71
+ // SMBStatusOpenFile represents a open -file output field
72
+ type SMBStatusOpenFile struct {
73
73
ServicePath string `json:"service_path"`
74
74
Filename string `json:"filename"`
75
75
FileID SMBStatusFileID `json:"fileid"`
@@ -78,20 +78,20 @@ type SMBStatusLockedFile struct {
78
78
79
79
// SMBStatus represents output of 'smbstatus --json'
80
80
type SMBStatus struct {
81
- Timestamp string `json:"timestamp"`
82
- Version string `json:"version"`
83
- SmbConf string `json:"smb_conf"`
84
- Sessions map [string ]SMBStatusSession `json:"sessions"`
85
- TCons map [string ]SMBStatusTreeCon `json:"tcons"`
86
- LockedFiles map [string ]SMBStatusLockedFile `json:"locked_files "`
81
+ Timestamp string `json:"timestamp"`
82
+ Version string `json:"version"`
83
+ SmbConf string `json:"smb_conf"`
84
+ Sessions map [string ]SMBStatusSession `json:"sessions"`
85
+ TCons map [string ]SMBStatusTreeCon `json:"tcons"`
86
+ OpenFiles map [string ]SMBStatusOpenFile `json:"open_files "`
87
87
}
88
88
89
89
// SMBStatusLocks represents output of 'smbstatus -L --json'
90
90
type SMBStatusLocks struct {
91
- Timestamp string `json:"timestamp"`
92
- Version string `json:"version"`
93
- SmbConf string `json:"smb_conf"`
94
- OpenFiles map [string ]SMBStatusLockedFile `json:"open_files"`
91
+ Timestamp string `json:"timestamp"`
92
+ Version string `json:"version"`
93
+ SmbConf string `json:"smb_conf"`
94
+ OpenFiles map [string ]SMBStatusOpenFile `json:"open_files"`
95
95
}
96
96
97
97
// LocateSMBStatus finds the local executable of 'smbstatus' on host.
@@ -155,16 +155,16 @@ func parseSMBStatusTreeCons(dat string) ([]SMBStatusTreeCon, error) {
155
155
}
156
156
157
157
// RunSMBStatusLocks executes 'smbstatus --locks --json' on host
158
- func RunSMBStatusLocks () ([]SMBStatusLockedFile , error ) {
158
+ func RunSMBStatusLocks () ([]SMBStatusOpenFile , error ) {
159
159
dat , err := executeSMBStatusCommand ("--locks --json" )
160
160
if err != nil {
161
- return []SMBStatusLockedFile {}, err
161
+ return []SMBStatusOpenFile {}, err
162
162
}
163
163
return parseSMBStatusLockedFiles (dat )
164
164
}
165
165
166
- func parseSMBStatusLockedFiles (dat string ) ([]SMBStatusLockedFile , error ) {
167
- lockedFiles := []SMBStatusLockedFile {}
166
+ func parseSMBStatusLockedFiles (dat string ) ([]SMBStatusOpenFile , error ) {
167
+ lockedFiles := []SMBStatusOpenFile {}
168
168
res , err := parseSMBStatusLocks (dat )
169
169
if err != nil {
170
170
return lockedFiles , err
@@ -230,12 +230,12 @@ func parseSMBStatusLocks(data string) (*SMBStatusLocks, error) {
230
230
// NewSMBStatus returns non-populated SMBStatus object
231
231
func NewSMBStatus () * SMBStatus {
232
232
smbStatus := SMBStatus {
233
- Timestamp : "" ,
234
- Version : "" ,
235
- SmbConf : "" ,
236
- Sessions : map [string ]SMBStatusSession {},
237
- TCons : map [string ]SMBStatusTreeCon {},
238
- LockedFiles : map [string ]SMBStatusLockedFile {},
233
+ Timestamp : "" ,
234
+ Version : "" ,
235
+ SmbConf : "" ,
236
+ Sessions : map [string ]SMBStatusSession {},
237
+ TCons : map [string ]SMBStatusTreeCon {},
238
+ OpenFiles : map [string ]SMBStatusOpenFile {},
239
239
}
240
240
return & smbStatus
241
241
}
0 commit comments