@@ -137,14 +137,13 @@ func ReadWriteOPS(iqnPath string, tpgt string, lun string) (readmb uint64,
137
137
138
138
// GetFileioUdev is getting the actual info to build up
139
139
// the FILEIO data and match with the enable target
140
- func (fileio FILEIO ) GetFileioUdev (targetCorePath string , fileioNumber string ,
141
- objectName string ) (fio * FILEIO , err error ) {
142
-
143
- fileio .Name = "fileio_" + fileioNumber
144
- fileio .Fnumber = fileioNumber
145
- fileio .ObjectName = objectName
146
-
147
- udevPath := filepath .Join (targetCorePath , fileio .Name , fileio .ObjectName , "udev_path" )
140
+ func (fs FS ) GetFileioUdev (fileioNumber string , objectName string ) (* FILEIO , error ) {
141
+ fileio := FILEIO {
142
+ Name : "fileio_" + fileioNumber ,
143
+ Fnumber : fileioNumber ,
144
+ ObjectName : objectName ,
145
+ }
146
+ udevPath := fs .configfs .Path (targetCore , fileio .Name , fileio .ObjectName , "udev_path" )
148
147
149
148
if _ , err := os .Stat (udevPath ); os .IsNotExist (err ) {
150
149
return nil , fmt .Errorf ("iscsi: GetFileioUdev: fileio_%s is missing file name" , fileio .Fnumber )
@@ -160,14 +159,13 @@ func (fileio FILEIO) GetFileioUdev(targetCorePath string, fileioNumber string,
160
159
161
160
// GetIblockUdev is getting the actual info to build up
162
161
// the IBLOCK data and match with the enable target
163
- func (iblock IBLOCK ) GetIblockUdev (targetCorePath string , iblockNumber string ,
164
- objectName string ) (ib * IBLOCK , err error ) {
165
-
166
- iblock .Name = "iblock_" + iblockNumber
167
- iblock .Bnumber = iblockNumber
168
- iblock .ObjectName = objectName
169
-
170
- udevPath := filepath .Join (targetCorePath , iblock .Name , iblock .ObjectName , "udev_path" )
162
+ func (fs FS ) GetIblockUdev (iblockNumber string , objectName string ) (* IBLOCK , error ) {
163
+ iblock := IBLOCK {
164
+ Name : "iblock_" + iblockNumber ,
165
+ Bnumber : iblockNumber ,
166
+ ObjectName : objectName ,
167
+ }
168
+ udevPath := fs .configfs .Path (targetCore , iblock .Name , iblock .ObjectName , "udev_path" )
171
169
172
170
if _ , err := os .Stat (udevPath ); os .IsNotExist (err ) {
173
171
return nil , fmt .Errorf ("iscsi: GetIBlockUdev: iblock_%s is missing file name" , iblock .Bnumber )
@@ -183,12 +181,12 @@ func (iblock IBLOCK) GetIblockUdev(targetCorePath string, iblockNumber string,
183
181
184
182
// GetRBDMatch is getting the actual info to build up
185
183
// the RBD data and match with the enable target
186
- func (rbd RBD ) GetRBDMatch (sysDevicePath string , rbdNumber string , poolImage string ) (r * RBD , err error ) {
187
-
188
- rbd . Name = "rbd_" + rbdNumber
189
- rbd . Rnumber = rbdNumber
190
-
191
- systemRbds , err := filepath .Glob (filepath . Join ( sysDevicePath , "/devices/rbd/ [0-9]*" ))
184
+ func (fs FS ) GetRBDMatch (rbdNumber string , poolImage string ) (* RBD , error ) {
185
+ rbd := RBD {
186
+ Name : "rbd_" + rbdNumber ,
187
+ Rnumber : rbdNumber ,
188
+ }
189
+ systemRbds , err := filepath .Glob (fs . sysfs . Path ( devicePath , "[0-9]*" ))
192
190
if err != nil {
193
191
return nil , fmt .Errorf ("iscsi: GetRBDMatch: Cannot find any rbd block" )
194
192
}
@@ -228,11 +226,12 @@ func (rbd RBD) GetRBDMatch(sysDevicePath string, rbdNumber string, poolImage str
228
226
}
229
227
230
228
// GetRDMCPPath is getting the actual info to build up RDMCP data
231
- func (rdmcp RDMCP ) GetRDMCPPath (targetCorePath string , rdmcpNumber string , objectName string ) (r * RDMCP , err error ) {
232
- rdmcp .Name = "rd_mcp_" + rdmcpNumber
233
- rdmcp .ObjectName = objectName
234
-
235
- rdmcpPath := filepath .Join (targetCorePath , rdmcp .Name , rdmcp .ObjectName )
229
+ func (fs FS ) GetRDMCPPath (rdmcpNumber string , objectName string ) (* RDMCP , error ) {
230
+ rdmcp := RDMCP {
231
+ Name : "rd_mcp_" + rdmcpNumber ,
232
+ ObjectName : objectName ,
233
+ }
234
+ rdmcpPath := fs .configfs .Path (targetCore , rdmcp .Name , rdmcp .ObjectName )
236
235
237
236
if _ , err := os .Stat (rdmcpPath ); os .IsNotExist (err ) {
238
237
return nil , fmt .Errorf ("iscsi: GetRDMCPPath: %s does not exist" , rdmcpPath )
0 commit comments