diff options
author | Hank Janssen <hjanssen@microsoft.com> | 2010-12-06 15:26:49 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-12-06 19:11:09 -0500 |
commit | f638859e3203d1ae933e7f2114cca68f1ac407db (patch) | |
tree | e2b2d68f11b460591f8d75dd79b54c35613a7231 /drivers/staging | |
parent | 02e37db7148a5ee98a742a0ff2f7e3acc406049b (diff) |
staging: hv: Convert camel case local variables in storvsc.c to lowercase
Convert camel case local variables in storvsc.c to lowercase
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/hv/storvsc.c | 496 |
1 files changed, 249 insertions, 247 deletions
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c index 6643038aa24..9295113e09b 100644 --- a/drivers/staging/hv/storvsc.c +++ b/drivers/staging/hv/storvsc.c | |||
@@ -50,7 +50,7 @@ struct storvsc_device { | |||
50 | /* 0 indicates the device is being destroyed */ | 50 | /* 0 indicates the device is being destroyed */ |
51 | atomic_t ref_count; | 51 | atomic_t ref_count; |
52 | 52 | ||
53 | atomic_t num_outstanding_requests; | 53 | atomic_t num_outstanding_req; |
54 | 54 | ||
55 | /* | 55 | /* |
56 | * Each unique Port/Path/Target represents 1 channel ie scsi | 56 | * Each unique Port/Path/Target represents 1 channel ie scsi |
@@ -81,119 +81,119 @@ static const struct hv_guid gStorVscDeviceType = { | |||
81 | }; | 81 | }; |
82 | 82 | ||
83 | 83 | ||
84 | static inline struct storvsc_device *alloc_stor_device(struct hv_device *Device) | 84 | static inline struct storvsc_device *alloc_stor_device(struct hv_device *device) |
85 | { | 85 | { |
86 | struct storvsc_device *storDevice; | 86 | struct storvsc_device *stor_device; |
87 | 87 | ||
88 | storDevice = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL); | 88 | stor_device = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL); |
89 | if (!storDevice) | 89 | if (!stor_device) |
90 | return NULL; | 90 | return NULL; |
91 | 91 | ||
92 | /* Set to 2 to allow both inbound and outbound traffics */ | 92 | /* Set to 2 to allow both inbound and outbound traffics */ |
93 | /* (ie get_stor_device() and must_get_stor_device()) to proceed. */ | 93 | /* (ie get_stor_device() and must_get_stor_device()) to proceed. */ |
94 | atomic_cmpxchg(&storDevice->ref_count, 0, 2); | 94 | atomic_cmpxchg(&stor_device->ref_count, 0, 2); |
95 | 95 | ||
96 | storDevice->device = Device; | 96 | stor_device->device = device; |
97 | Device->Extension = storDevice; | 97 | device->Extension = stor_device; |
98 | 98 | ||
99 | return storDevice; | 99 | return stor_device; |
100 | } | 100 | } |
101 | 101 | ||
102 | static inline void free_stor_device(struct storvsc_device *Device) | 102 | static inline void free_stor_device(struct storvsc_device *device) |
103 | { | 103 | { |
104 | /* ASSERT(atomic_read(&Device->ref_count) == 0); */ | 104 | /* ASSERT(atomic_read(&device->ref_count) == 0); */ |
105 | kfree(Device); | 105 | kfree(device); |
106 | } | 106 | } |
107 | 107 | ||
108 | /* Get the stordevice object iff exists and its refcount > 1 */ | 108 | /* Get the stordevice object iff exists and its refcount > 1 */ |
109 | static inline struct storvsc_device *get_stor_device(struct hv_device *Device) | 109 | static inline struct storvsc_device *get_stor_device(struct hv_device *device) |
110 | { | 110 | { |
111 | struct storvsc_device *storDevice; | 111 | struct storvsc_device *stor_device; |
112 | 112 | ||
113 | storDevice = (struct storvsc_device *)Device->Extension; | 113 | stor_device = (struct storvsc_device *)device->Extension; |
114 | if (storDevice && atomic_read(&storDevice->ref_count) > 1) | 114 | if (stor_device && atomic_read(&stor_device->ref_count) > 1) |
115 | atomic_inc(&storDevice->ref_count); | 115 | atomic_inc(&stor_device->ref_count); |
116 | else | 116 | else |
117 | storDevice = NULL; | 117 | stor_device = NULL; |
118 | 118 | ||
119 | return storDevice; | 119 | return stor_device; |
120 | } | 120 | } |
121 | 121 | ||
122 | /* Get the stordevice object iff exists and its refcount > 0 */ | 122 | /* Get the stordevice object iff exists and its refcount > 0 */ |
123 | static inline struct storvsc_device *must_get_stor_device( | 123 | static inline struct storvsc_device *must_get_stor_device( |
124 | struct hv_device *Device) | 124 | struct hv_device *device) |
125 | { | 125 | { |
126 | struct storvsc_device *storDevice; | 126 | struct storvsc_device *stor_device; |
127 | 127 | ||
128 | storDevice = (struct storvsc_device *)Device->Extension; | 128 | stor_device = (struct storvsc_device *)device->Extension; |
129 | if (storDevice && atomic_read(&storDevice->ref_count)) | 129 | if (stor_device && atomic_read(&stor_device->ref_count)) |
130 | atomic_inc(&storDevice->ref_count); | 130 | atomic_inc(&stor_device->ref_count); |
131 | else | 131 | else |
132 | storDevice = NULL; | 132 | stor_device = NULL; |
133 | 133 | ||
134 | return storDevice; | 134 | return stor_device; |
135 | } | 135 | } |
136 | 136 | ||
137 | static inline void put_stor_device(struct hv_device *Device) | 137 | static inline void put_stor_device(struct hv_device *device) |
138 | { | 138 | { |
139 | struct storvsc_device *storDevice; | 139 | struct storvsc_device *stor_device; |
140 | 140 | ||
141 | storDevice = (struct storvsc_device *)Device->Extension; | 141 | stor_device = (struct storvsc_device *)device->Extension; |
142 | /* ASSERT(storDevice); */ | 142 | /* ASSERT(stor_device); */ |
143 | 143 | ||
144 | atomic_dec(&storDevice->ref_count); | 144 | atomic_dec(&stor_device->ref_count); |
145 | /* ASSERT(atomic_read(&storDevice->ref_count)); */ | 145 | /* ASSERT(atomic_read(&stor_device->ref_count)); */ |
146 | } | 146 | } |
147 | 147 | ||
148 | /* Drop ref count to 1 to effectively disable get_stor_device() */ | 148 | /* Drop ref count to 1 to effectively disable get_stor_device() */ |
149 | static inline struct storvsc_device *release_stor_device( | 149 | static inline struct storvsc_device *release_stor_device( |
150 | struct hv_device *Device) | 150 | struct hv_device *device) |
151 | { | 151 | { |
152 | struct storvsc_device *storDevice; | 152 | struct storvsc_device *stor_device; |
153 | 153 | ||
154 | storDevice = (struct storvsc_device *)Device->Extension; | 154 | stor_device = (struct storvsc_device *)device->Extension; |
155 | /* ASSERT(storDevice); */ | 155 | /* ASSERT(stor_device); */ |
156 | 156 | ||
157 | /* Busy wait until the ref drop to 2, then set it to 1 */ | 157 | /* Busy wait until the ref drop to 2, then set it to 1 */ |
158 | while (atomic_cmpxchg(&storDevice->ref_count, 2, 1) != 2) | 158 | while (atomic_cmpxchg(&stor_device->ref_count, 2, 1) != 2) |
159 | udelay(100); | 159 | udelay(100); |
160 | 160 | ||
161 | return storDevice; | 161 | return stor_device; |
162 | } | 162 | } |
163 | 163 | ||
164 | /* Drop ref count to 0. No one can use StorDevice object. */ | 164 | /* Drop ref count to 0. No one can use stor_device object. */ |
165 | static inline struct storvsc_device *final_release_stor_device( | 165 | static inline struct storvsc_device *final_release_stor_device( |
166 | struct hv_device *Device) | 166 | struct hv_device *device) |
167 | { | 167 | { |
168 | struct storvsc_device *storDevice; | 168 | struct storvsc_device *stor_device; |
169 | 169 | ||
170 | storDevice = (struct storvsc_device *)Device->Extension; | 170 | stor_device = (struct storvsc_device *)device->Extension; |
171 | /* ASSERT(storDevice); */ | 171 | /* ASSERT(stor_device); */ |
172 | 172 | ||
173 | /* Busy wait until the ref drop to 1, then set it to 0 */ | 173 | /* Busy wait until the ref drop to 1, then set it to 0 */ |
174 | while (atomic_cmpxchg(&storDevice->ref_count, 1, 0) != 1) | 174 | while (atomic_cmpxchg(&stor_device->ref_count, 1, 0) != 1) |
175 | udelay(100); | 175 | udelay(100); |
176 | 176 | ||
177 | Device->Extension = NULL; | 177 | device->Extension = NULL; |
178 | return storDevice; | 178 | return stor_device; |
179 | } | 179 | } |
180 | 180 | ||
181 | static int stor_vsc_channel_init(struct hv_device *Device) | 181 | static int stor_vsc_channel_init(struct hv_device *device) |
182 | { | 182 | { |
183 | struct storvsc_device *storDevice; | 183 | struct storvsc_device *stor_device; |
184 | struct storvsc_request_extension *request; | 184 | struct storvsc_request_extension *request; |
185 | struct vstor_packet *vstorPacket; | 185 | struct vstor_packet *vstor_packet; |
186 | int ret; | 186 | int ret; |
187 | 187 | ||
188 | storDevice = get_stor_device(Device); | 188 | stor_device = get_stor_device(device); |
189 | if (!storDevice) { | 189 | if (!stor_device) { |
190 | DPRINT_ERR(STORVSC, "unable to get stor device..." | 190 | DPRINT_ERR(STORVSC, "unable to get stor device..." |
191 | "device being destroyed?"); | 191 | "device being destroyed?"); |
192 | return -1; | 192 | return -1; |
193 | } | 193 | } |
194 | 194 | ||
195 | request = &storDevice->init_request; | 195 | request = &stor_device->init_request; |
196 | vstorPacket = &request->vstor_packet; | 196 | vstor_packet = &request->vstor_packet; |
197 | 197 | ||
198 | /* | 198 | /* |
199 | * Now, initiate the vsc/vsp initialization protocol on the open | 199 | * Now, initiate the vsc/vsp initialization protocol on the open |
@@ -206,8 +206,8 @@ static int stor_vsc_channel_init(struct hv_device *Device) | |||
206 | goto nomem; | 206 | goto nomem; |
207 | } | 207 | } |
208 | 208 | ||
209 | vstorPacket->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION; | 209 | vstor_packet->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION; |
210 | vstorPacket->flags = REQUEST_COMPLETION_FLAG; | 210 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; |
211 | 211 | ||
212 | /*SpinlockAcquire(gDriverExt.packetListLock); | 212 | /*SpinlockAcquire(gDriverExt.packetListLock); |
213 | INSERT_TAIL_LIST(&gDriverExt.packetList, &packet->listEntry.entry); | 213 | INSERT_TAIL_LIST(&gDriverExt.packetList, &packet->listEntry.entry); |
@@ -215,7 +215,7 @@ static int stor_vsc_channel_init(struct hv_device *Device) | |||
215 | 215 | ||
216 | DPRINT_INFO(STORVSC, "BEGIN_INITIALIZATION_OPERATION..."); | 216 | DPRINT_INFO(STORVSC, "BEGIN_INITIALIZATION_OPERATION..."); |
217 | 217 | ||
218 | ret = vmbus_sendpacket(Device->channel, vstorPacket, | 218 | ret = vmbus_sendpacket(device->channel, vstor_packet, |
219 | sizeof(struct vstor_packet), | 219 | sizeof(struct vstor_packet), |
220 | (unsigned long)request, | 220 | (unsigned long)request, |
221 | VmbusPacketTypeDataInBand, | 221 | VmbusPacketTypeDataInBand, |
@@ -228,25 +228,25 @@ static int stor_vsc_channel_init(struct hv_device *Device) | |||
228 | 228 | ||
229 | osd_waitevent_wait(request->wait_event); | 229 | osd_waitevent_wait(request->wait_event); |
230 | 230 | ||
231 | if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO || | 231 | if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO || |
232 | vstorPacket->status != 0) { | 232 | vstor_packet->status != 0) { |
233 | DPRINT_ERR(STORVSC, "BEGIN_INITIALIZATION_OPERATION failed " | 233 | DPRINT_ERR(STORVSC, "BEGIN_INITIALIZATION_OPERATION failed " |
234 | "(op %d status 0x%x)", | 234 | "(op %d status 0x%x)", |
235 | vstorPacket->operation, vstorPacket->status); | 235 | vstor_packet->operation, vstor_packet->status); |
236 | goto Cleanup; | 236 | goto Cleanup; |
237 | } | 237 | } |
238 | 238 | ||
239 | DPRINT_INFO(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION..."); | 239 | DPRINT_INFO(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION..."); |
240 | 240 | ||
241 | /* reuse the packet for version range supported */ | 241 | /* reuse the packet for version range supported */ |
242 | memset(vstorPacket, 0, sizeof(struct vstor_packet)); | 242 | memset(vstor_packet, 0, sizeof(struct vstor_packet)); |
243 | vstorPacket->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; | 243 | vstor_packet->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; |
244 | vstorPacket->flags = REQUEST_COMPLETION_FLAG; | 244 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; |
245 | 245 | ||
246 | vstorPacket->version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT; | 246 | vstor_packet->version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT; |
247 | FILL_VMSTOR_REVISION(vstorPacket->version.revision); | 247 | FILL_VMSTOR_REVISION(vstor_packet->version.revision); |
248 | 248 | ||
249 | ret = vmbus_sendpacket(Device->channel, vstorPacket, | 249 | ret = vmbus_sendpacket(device->channel, vstor_packet, |
250 | sizeof(struct vstor_packet), | 250 | sizeof(struct vstor_packet), |
251 | (unsigned long)request, | 251 | (unsigned long)request, |
252 | VmbusPacketTypeDataInBand, | 252 | VmbusPacketTypeDataInBand, |
@@ -260,24 +260,24 @@ static int stor_vsc_channel_init(struct hv_device *Device) | |||
260 | osd_waitevent_wait(request->wait_event); | 260 | osd_waitevent_wait(request->wait_event); |
261 | 261 | ||
262 | /* TODO: Check returned version */ | 262 | /* TODO: Check returned version */ |
263 | if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO || | 263 | if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO || |
264 | vstorPacket->status != 0) { | 264 | vstor_packet->status != 0) { |
265 | DPRINT_ERR(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION failed " | 265 | DPRINT_ERR(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION failed " |
266 | "(op %d status 0x%x)", | 266 | "(op %d status 0x%x)", |
267 | vstorPacket->operation, vstorPacket->status); | 267 | vstor_packet->operation, vstor_packet->status); |
268 | goto Cleanup; | 268 | goto Cleanup; |
269 | } | 269 | } |
270 | 270 | ||
271 | /* Query channel properties */ | 271 | /* Query channel properties */ |
272 | DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION..."); | 272 | DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION..."); |
273 | 273 | ||
274 | memset(vstorPacket, 0, sizeof(struct vstor_packet)); | 274 | memset(vstor_packet, 0, sizeof(struct vstor_packet)); |
275 | vstorPacket->operation = VSTOR_OPERATION_QUERY_PROPERTIES; | 275 | vstor_packet->operation = VSTOR_OPERATION_QUERY_PROPERTIES; |
276 | vstorPacket->flags = REQUEST_COMPLETION_FLAG; | 276 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; |
277 | vstorPacket->storage_channel_properties.port_number = | 277 | vstor_packet->storage_channel_properties.port_number = |
278 | storDevice->port_number; | 278 | stor_device->port_number; |
279 | 279 | ||
280 | ret = vmbus_sendpacket(Device->channel, vstorPacket, | 280 | ret = vmbus_sendpacket(device->channel, vstor_packet, |
281 | sizeof(struct vstor_packet), | 281 | sizeof(struct vstor_packet), |
282 | (unsigned long)request, | 282 | (unsigned long)request, |
283 | VmbusPacketTypeDataInBand, | 283 | VmbusPacketTypeDataInBand, |
@@ -292,29 +292,29 @@ static int stor_vsc_channel_init(struct hv_device *Device) | |||
292 | osd_waitevent_wait(request->wait_event); | 292 | osd_waitevent_wait(request->wait_event); |
293 | 293 | ||
294 | /* TODO: Check returned version */ | 294 | /* TODO: Check returned version */ |
295 | if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO || | 295 | if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO || |
296 | vstorPacket->status != 0) { | 296 | vstor_packet->status != 0) { |
297 | DPRINT_ERR(STORVSC, "QUERY_PROPERTIES_OPERATION failed " | 297 | DPRINT_ERR(STORVSC, "QUERY_PROPERTIES_OPERATION failed " |
298 | "(op %d status 0x%x)", | 298 | "(op %d status 0x%x)", |
299 | vstorPacket->operation, vstorPacket->status); | 299 | vstor_packet->operation, vstor_packet->status); |
300 | goto Cleanup; | 300 | goto Cleanup; |
301 | } | 301 | } |
302 | 302 | ||
303 | storDevice->path_id = vstorPacket->storage_channel_properties.path_id; | 303 | stor_device->path_id = vstor_packet->storage_channel_properties.path_id; |
304 | storDevice->target_id | 304 | stor_device->target_id |
305 | = vstorPacket->storage_channel_properties.target_id; | 305 | = vstor_packet->storage_channel_properties.target_id; |
306 | 306 | ||
307 | DPRINT_DBG(STORVSC, "channel flag 0x%x, max xfer len 0x%x", | 307 | DPRINT_DBG(STORVSC, "channel flag 0x%x, max xfer len 0x%x", |
308 | vstorPacket->storage_channel_properties.flags, | 308 | vstor_packet->storage_channel_properties.flags, |
309 | vstorPacket->storage_channel_properties.max_transfer_bytes); | 309 | vstor_packet->storage_channel_properties.max_transfer_bytes); |
310 | 310 | ||
311 | DPRINT_INFO(STORVSC, "END_INITIALIZATION_OPERATION..."); | 311 | DPRINT_INFO(STORVSC, "END_INITIALIZATION_OPERATION..."); |
312 | 312 | ||
313 | memset(vstorPacket, 0, sizeof(struct vstor_packet)); | 313 | memset(vstor_packet, 0, sizeof(struct vstor_packet)); |
314 | vstorPacket->operation = VSTOR_OPERATION_END_INITIALIZATION; | 314 | vstor_packet->operation = VSTOR_OPERATION_END_INITIALIZATION; |
315 | vstorPacket->flags = REQUEST_COMPLETION_FLAG; | 315 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; |
316 | 316 | ||
317 | ret = vmbus_sendpacket(Device->channel, vstorPacket, | 317 | ret = vmbus_sendpacket(device->channel, vstor_packet, |
318 | sizeof(struct vstor_packet), | 318 | sizeof(struct vstor_packet), |
319 | (unsigned long)request, | 319 | (unsigned long)request, |
320 | VmbusPacketTypeDataInBand, | 320 | VmbusPacketTypeDataInBand, |
@@ -328,11 +328,11 @@ static int stor_vsc_channel_init(struct hv_device *Device) | |||
328 | 328 | ||
329 | osd_waitevent_wait(request->wait_event); | 329 | osd_waitevent_wait(request->wait_event); |
330 | 330 | ||
331 | if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO || | 331 | if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO || |
332 | vstorPacket->status != 0) { | 332 | vstor_packet->status != 0) { |
333 | DPRINT_ERR(STORVSC, "END_INITIALIZATION_OPERATION failed " | 333 | DPRINT_ERR(STORVSC, "END_INITIALIZATION_OPERATION failed " |
334 | "(op %d status 0x%x)", | 334 | "(op %d status 0x%x)", |
335 | vstorPacket->operation, vstorPacket->status); | 335 | vstor_packet->operation, vstor_packet->status); |
336 | goto Cleanup; | 336 | goto Cleanup; |
337 | } | 337 | } |
338 | 338 | ||
@@ -342,82 +342,82 @@ Cleanup: | |||
342 | kfree(request->wait_event); | 342 | kfree(request->wait_event); |
343 | request->wait_event = NULL; | 343 | request->wait_event = NULL; |
344 | nomem: | 344 | nomem: |
345 | put_stor_device(Device); | 345 | put_stor_device(device); |
346 | return ret; | 346 | return ret; |
347 | } | 347 | } |
348 | 348 | ||
349 | static void stor_vsc_on_io_completion(struct hv_device *Device, | 349 | static void stor_vsc_on_io_completion(struct hv_device *device, |
350 | struct vstor_packet *VStorPacket, | 350 | struct vstor_packet *vstor_packet, |
351 | struct storvsc_request_extension *RequestExt) | 351 | struct storvsc_request_extension *request_ext) |
352 | { | 352 | { |
353 | struct hv_storvsc_request *request; | 353 | struct hv_storvsc_request *request; |
354 | struct storvsc_device *storDevice; | 354 | struct storvsc_device *stor_device; |
355 | 355 | ||
356 | storDevice = must_get_stor_device(Device); | 356 | stor_device = must_get_stor_device(device); |
357 | if (!storDevice) { | 357 | if (!stor_device) { |
358 | DPRINT_ERR(STORVSC, "unable to get stor device..." | 358 | DPRINT_ERR(STORVSC, "unable to get stor device..." |
359 | "device being destroyed?"); | 359 | "device being destroyed?"); |
360 | return; | 360 | return; |
361 | } | 361 | } |
362 | 362 | ||
363 | DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION - request extension %p " | 363 | DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION - request extension %p " |
364 | "completed bytes xfer %u", RequestExt, | 364 | "completed bytes xfer %u", request_ext, |
365 | VStorPacket->vm_srb.data_transfer_length); | 365 | vstor_packet->vm_srb.data_transfer_length); |
366 | 366 | ||
367 | /* ASSERT(RequestExt != NULL); */ | 367 | /* ASSERT(request_ext != NULL); */ |
368 | /* ASSERT(RequestExt->Request != NULL); */ | 368 | /* ASSERT(request_ext->request != NULL); */ |
369 | 369 | ||
370 | request = RequestExt->request; | 370 | request = request_ext->request; |
371 | 371 | ||
372 | /* ASSERT(request->OnIOCompletion != NULL); */ | 372 | /* ASSERT(request->OnIOCompletion != NULL); */ |
373 | 373 | ||
374 | /* Copy over the status...etc */ | 374 | /* Copy over the status...etc */ |
375 | request->status = VStorPacket->vm_srb.scsi_status; | 375 | request->status = vstor_packet->vm_srb.scsi_status; |
376 | 376 | ||
377 | if (request->status != 0 || VStorPacket->vm_srb.srb_status != 1) { | 377 | if (request->status != 0 || vstor_packet->vm_srb.srb_status != 1) { |
378 | DPRINT_WARN(STORVSC, | 378 | DPRINT_WARN(STORVSC, |
379 | "cmd 0x%x scsi status 0x%x srb status 0x%x\n", | 379 | "cmd 0x%x scsi status 0x%x srb status 0x%x\n", |
380 | request->cdb[0], VStorPacket->vm_srb.scsi_status, | 380 | request->cdb[0], vstor_packet->vm_srb.scsi_status, |
381 | VStorPacket->vm_srb.srb_status); | 381 | vstor_packet->vm_srb.srb_status); |
382 | } | 382 | } |
383 | 383 | ||
384 | if ((request->status & 0xFF) == 0x02) { | 384 | if ((request->status & 0xFF) == 0x02) { |
385 | /* CHECK_CONDITION */ | 385 | /* CHECK_CONDITION */ |
386 | if (VStorPacket->vm_srb.srb_status & 0x80) { | 386 | if (vstor_packet->vm_srb.srb_status & 0x80) { |
387 | /* autosense data available */ | 387 | /* autosense data available */ |
388 | DPRINT_WARN(STORVSC, "storvsc pkt %p autosense data " | 388 | DPRINT_WARN(STORVSC, "storvsc pkt %p autosense data " |
389 | "valid - len %d\n", RequestExt, | 389 | "valid - len %d\n", request_ext, |
390 | VStorPacket->vm_srb.sense_info_length); | 390 | vstor_packet->vm_srb.sense_info_length); |
391 | 391 | ||
392 | /* ASSERT(VStorPacket->vm_srb.sense_info_length <= */ | 392 | /* ASSERT(vstor_packet->vm_srb.sense_info_length <= */ |
393 | /* request->SenseBufferSize); */ | 393 | /* request->SenseBufferSize); */ |
394 | memcpy(request->sense_buffer, | 394 | memcpy(request->sense_buffer, |
395 | VStorPacket->vm_srb.sense_data, | 395 | vstor_packet->vm_srb.sense_data, |
396 | VStorPacket->vm_srb.sense_info_length); | 396 | vstor_packet->vm_srb.sense_info_length); |
397 | 397 | ||
398 | request->sense_buffer_size = | 398 | request->sense_buffer_size = |
399 | VStorPacket->vm_srb.sense_info_length; | 399 | vstor_packet->vm_srb.sense_info_length; |
400 | } | 400 | } |
401 | } | 401 | } |
402 | 402 | ||
403 | /* TODO: */ | 403 | /* TODO: */ |
404 | request->bytes_xfer = VStorPacket->vm_srb.data_transfer_length; | 404 | request->bytes_xfer = vstor_packet->vm_srb.data_transfer_length; |
405 | 405 | ||
406 | request->on_io_completion(request); | 406 | request->on_io_completion(request); |
407 | 407 | ||
408 | atomic_dec(&storDevice->num_outstanding_requests); | 408 | atomic_dec(&stor_device->num_outstanding_req); |
409 | 409 | ||
410 | put_stor_device(Device); | 410 | put_stor_device(device); |
411 | } | 411 | } |
412 | 412 | ||
413 | static void stor_vsc_on_receive(struct hv_device *Device, | 413 | static void stor_vsc_on_receive(struct hv_device *device, |
414 | struct vstor_packet *VStorPacket, | 414 | struct vstor_packet *vstor_packet, |
415 | struct storvsc_request_extension *RequestExt) | 415 | struct storvsc_request_extension *request_ext) |
416 | { | 416 | { |
417 | switch (VStorPacket->operation) { | 417 | switch (vstor_packet->operation) { |
418 | case VSTOR_OPERATION_COMPLETE_IO: | 418 | case VSTOR_OPERATION_COMPLETE_IO: |
419 | DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION"); | 419 | DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION"); |
420 | stor_vsc_on_io_completion(Device, VStorPacket, RequestExt); | 420 | stor_vsc_on_io_completion(device, vstor_packet, request_ext); |
421 | break; | 421 | break; |
422 | case VSTOR_OPERATION_REMOVE_DEVICE: | 422 | case VSTOR_OPERATION_REMOVE_DEVICE: |
423 | DPRINT_INFO(STORVSC, "REMOVE_DEVICE_OPERATION"); | 423 | DPRINT_INFO(STORVSC, "REMOVE_DEVICE_OPERATION"); |
@@ -426,7 +426,7 @@ static void stor_vsc_on_receive(struct hv_device *Device, | |||
426 | 426 | ||
427 | default: | 427 | default: |
428 | DPRINT_INFO(STORVSC, "Unknown operation received - %d", | 428 | DPRINT_INFO(STORVSC, "Unknown operation received - %d", |
429 | VStorPacket->operation); | 429 | vstor_packet->operation); |
430 | break; | 430 | break; |
431 | } | 431 | } |
432 | } | 432 | } |
@@ -434,17 +434,17 @@ static void stor_vsc_on_receive(struct hv_device *Device, | |||
434 | static void stor_vsc_on_channel_callback(void *context) | 434 | static void stor_vsc_on_channel_callback(void *context) |
435 | { | 435 | { |
436 | struct hv_device *device = (struct hv_device *)context; | 436 | struct hv_device *device = (struct hv_device *)context; |
437 | struct storvsc_device *storDevice; | 437 | struct storvsc_device *stor_device; |
438 | u32 bytesRecvd; | 438 | u32 bytes_recvd; |
439 | u64 requestId; | 439 | u64 request_id; |
440 | unsigned char packet[ALIGN_UP(sizeof(struct vstor_packet), 8)]; | 440 | unsigned char packet[ALIGN_UP(sizeof(struct vstor_packet), 8)]; |
441 | struct storvsc_request_extension *request; | 441 | struct storvsc_request_extension *request; |
442 | int ret; | 442 | int ret; |
443 | 443 | ||
444 | /* ASSERT(device); */ | 444 | /* ASSERT(device); */ |
445 | 445 | ||
446 | storDevice = must_get_stor_device(device); | 446 | stor_device = must_get_stor_device(device); |
447 | if (!storDevice) { | 447 | if (!stor_device) { |
448 | DPRINT_ERR(STORVSC, "unable to get stor device..." | 448 | DPRINT_ERR(STORVSC, "unable to get stor device..." |
449 | "device being destroyed?"); | 449 | "device being destroyed?"); |
450 | return; | 450 | return; |
@@ -453,25 +453,26 @@ static void stor_vsc_on_channel_callback(void *context) | |||
453 | do { | 453 | do { |
454 | ret = vmbus_recvpacket(device->channel, packet, | 454 | ret = vmbus_recvpacket(device->channel, packet, |
455 | ALIGN_UP(sizeof(struct vstor_packet), 8), | 455 | ALIGN_UP(sizeof(struct vstor_packet), 8), |
456 | &bytesRecvd, &requestId); | 456 | &bytes_recvd, &request_id); |
457 | if (ret == 0 && bytesRecvd > 0) { | 457 | if (ret == 0 && bytes_recvd > 0) { |
458 | DPRINT_DBG(STORVSC, "receive %d bytes - tid %llx", | 458 | DPRINT_DBG(STORVSC, "receive %d bytes - tid %llx", |
459 | bytesRecvd, requestId); | 459 | bytes_recvd, request_id); |
460 | 460 | ||
461 | /* ASSERT(bytesRecvd == sizeof(struct vstor_packet)); */ | 461 | /* ASSERT(bytes_recvd == |
462 | sizeof(struct vstor_packet)); */ | ||
462 | 463 | ||
463 | request = (struct storvsc_request_extension *) | 464 | request = (struct storvsc_request_extension *) |
464 | (unsigned long)requestId; | 465 | (unsigned long)request_id; |
465 | /* ASSERT(request);c */ | 466 | /* ASSERT(request);c */ |
466 | 467 | ||
467 | /* if (vstorPacket.Flags & SYNTHETIC_FLAG) */ | 468 | /* if (vstor_packet.Flags & SYNTHETIC_FLAG) */ |
468 | if ((request == &storDevice->init_request) || | 469 | if ((request == &stor_device->init_request) || |
469 | (request == &storDevice->reset_request)) { | 470 | (request == &stor_device->reset_request)) { |
470 | /* DPRINT_INFO(STORVSC, | 471 | /* DPRINT_INFO(STORVSC, |
471 | * "reset completion - operation " | 472 | * "reset completion - operation " |
472 | * "%u status %u", | 473 | * "%u status %u", |
473 | * vstorPacket.Operation, | 474 | * vstor_packet.Operation, |
474 | * vstorPacket.Status); */ | 475 | * vstor_packet.Status); */ |
475 | 476 | ||
476 | memcpy(&request->vstor_packet, packet, | 477 | memcpy(&request->vstor_packet, packet, |
477 | sizeof(struct vstor_packet)); | 478 | sizeof(struct vstor_packet)); |
@@ -492,22 +493,22 @@ static void stor_vsc_on_channel_callback(void *context) | |||
492 | return; | 493 | return; |
493 | } | 494 | } |
494 | 495 | ||
495 | static int stor_vsc_connect_to_vsp(struct hv_device *Device) | 496 | static int stor_vsc_connect_to_vsp(struct hv_device *device) |
496 | { | 497 | { |
497 | struct vmstorage_channel_properties props; | 498 | struct vmstorage_channel_properties props; |
498 | struct storvsc_driver_object *storDriver; | 499 | struct storvsc_driver_object *stor_driver; |
499 | int ret; | 500 | int ret; |
500 | 501 | ||
501 | storDriver = (struct storvsc_driver_object *)Device->Driver; | 502 | stor_driver = (struct storvsc_driver_object *)device->Driver; |
502 | memset(&props, 0, sizeof(struct vmstorage_channel_properties)); | 503 | memset(&props, 0, sizeof(struct vmstorage_channel_properties)); |
503 | 504 | ||
504 | /* Open the channel */ | 505 | /* Open the channel */ |
505 | ret = vmbus_open(Device->channel, | 506 | ret = vmbus_open(device->channel, |
506 | storDriver->ring_buffer_size, | 507 | stor_driver->ring_buffer_size, |
507 | storDriver->ring_buffer_size, | 508 | stor_driver->ring_buffer_size, |
508 | (void *)&props, | 509 | (void *)&props, |
509 | sizeof(struct vmstorage_channel_properties), | 510 | sizeof(struct vmstorage_channel_properties), |
510 | stor_vsc_on_channel_callback, Device); | 511 | stor_vsc_on_channel_callback, device); |
511 | 512 | ||
512 | DPRINT_DBG(STORVSC, "storage props: path id %d, tgt id %d, max xfer %d", | 513 | DPRINT_DBG(STORVSC, "storage props: path id %d, tgt id %d, max xfer %d", |
513 | props.path_id, props.target_id, props.max_transfer_bytes); | 514 | props.path_id, props.target_id, props.max_transfer_bytes); |
@@ -517,7 +518,7 @@ static int stor_vsc_connect_to_vsp(struct hv_device *Device) | |||
517 | return -1; | 518 | return -1; |
518 | } | 519 | } |
519 | 520 | ||
520 | ret = stor_vsc_channel_init(Device); | 521 | ret = stor_vsc_channel_init(device); |
521 | 522 | ||
522 | return ret; | 523 | return ret; |
523 | } | 524 | } |
@@ -526,17 +527,17 @@ static int stor_vsc_connect_to_vsp(struct hv_device *Device) | |||
526 | * stor_vsc_on_device_add - Callback when the device belonging to this driver | 527 | * stor_vsc_on_device_add - Callback when the device belonging to this driver |
527 | * is added | 528 | * is added |
528 | */ | 529 | */ |
529 | static int stor_vsc_on_device_add(struct hv_device *Device, | 530 | static int stor_vsc_on_device_add(struct hv_device *device, |
530 | void *AdditionalInfo) | 531 | void *additional_info) |
531 | { | 532 | { |
532 | struct storvsc_device *storDevice; | 533 | struct storvsc_device *stor_device; |
533 | /* struct vmstorage_channel_properties *props; */ | 534 | /* struct vmstorage_channel_properties *props; */ |
534 | struct storvsc_device_info *deviceInfo; | 535 | struct storvsc_device_info *device_info; |
535 | int ret = 0; | 536 | int ret = 0; |
536 | 537 | ||
537 | deviceInfo = (struct storvsc_device_info *)AdditionalInfo; | 538 | device_info = (struct storvsc_device_info *)additional_info; |
538 | storDevice = alloc_stor_device(Device); | 539 | stor_device = alloc_stor_device(device); |
539 | if (!storDevice) { | 540 | if (!stor_device) { |
540 | ret = -1; | 541 | ret = -1; |
541 | goto Cleanup; | 542 | goto Cleanup; |
542 | } | 543 | } |
@@ -556,17 +557,17 @@ static int stor_vsc_on_device_add(struct hv_device *Device, | |||
556 | storChannel->PathId = props->PathId; | 557 | storChannel->PathId = props->PathId; |
557 | storChannel->TargetId = props->TargetId; */ | 558 | storChannel->TargetId = props->TargetId; */ |
558 | 559 | ||
559 | storDevice->port_number = deviceInfo->port_number; | 560 | stor_device->port_number = device_info->port_number; |
560 | /* Send it back up */ | 561 | /* Send it back up */ |
561 | ret = stor_vsc_connect_to_vsp(Device); | 562 | ret = stor_vsc_connect_to_vsp(device); |
562 | 563 | ||
563 | /* deviceInfo->PortNumber = storDevice->PortNumber; */ | 564 | /* device_info->PortNumber = stor_device->PortNumber; */ |
564 | deviceInfo->path_id = storDevice->path_id; | 565 | device_info->path_id = stor_device->path_id; |
565 | deviceInfo->target_id = storDevice->target_id; | 566 | device_info->target_id = stor_device->target_id; |
566 | 567 | ||
567 | DPRINT_DBG(STORVSC, "assigned port %u, path %u target %u\n", | 568 | DPRINT_DBG(STORVSC, "assigned port %u, path %u target %u\n", |
568 | storDevice->port_number, storDevice->path_id, | 569 | stor_device->port_number, stor_device->path_id, |
569 | storDevice->target_id); | 570 | stor_device->target_id); |
570 | 571 | ||
571 | Cleanup: | 572 | Cleanup: |
572 | return ret; | 573 | return ret; |
@@ -575,58 +576,58 @@ Cleanup: | |||
575 | /* | 576 | /* |
576 | * stor_vsc_on_device_remove - Callback when the our device is being removed | 577 | * stor_vsc_on_device_remove - Callback when the our device is being removed |
577 | */ | 578 | */ |
578 | static int stor_vsc_on_device_remove(struct hv_device *Device) | 579 | static int stor_vsc_on_device_remove(struct hv_device *device) |
579 | { | 580 | { |
580 | struct storvsc_device *storDevice; | 581 | struct storvsc_device *stor_device; |
581 | 582 | ||
582 | DPRINT_INFO(STORVSC, "disabling storage device (%p)...", | 583 | DPRINT_INFO(STORVSC, "disabling storage device (%p)...", |
583 | Device->Extension); | 584 | device->Extension); |
584 | 585 | ||
585 | storDevice = release_stor_device(Device); | 586 | stor_device = release_stor_device(device); |
586 | 587 | ||
587 | /* | 588 | /* |
588 | * At this point, all outbound traffic should be disable. We | 589 | * At this point, all outbound traffic should be disable. We |
589 | * only allow inbound traffic (responses) to proceed so that | 590 | * only allow inbound traffic (responses) to proceed so that |
590 | * outstanding requests can be completed. | 591 | * outstanding requests can be completed. |
591 | */ | 592 | */ |
592 | while (atomic_read(&storDevice->num_outstanding_requests)) { | 593 | while (atomic_read(&stor_device->num_outstanding_req)) { |
593 | DPRINT_INFO(STORVSC, "waiting for %d requests to complete...", | 594 | DPRINT_INFO(STORVSC, "waiting for %d requests to complete...", |
594 | atomic_read(&storDevice->num_outstanding_requests)); | 595 | atomic_read(&stor_device->num_outstanding_req)); |
595 | udelay(100); | 596 | udelay(100); |
596 | } | 597 | } |
597 | 598 | ||
598 | DPRINT_INFO(STORVSC, "removing storage device (%p)...", | 599 | DPRINT_INFO(STORVSC, "removing storage device (%p)...", |
599 | Device->Extension); | 600 | device->Extension); |
600 | 601 | ||
601 | storDevice = final_release_stor_device(Device); | 602 | stor_device = final_release_stor_device(device); |
602 | 603 | ||
603 | DPRINT_INFO(STORVSC, "storage device (%p) safe to remove", storDevice); | 604 | DPRINT_INFO(STORVSC, "storage device (%p) safe to remove", stor_device); |
604 | 605 | ||
605 | /* Close the channel */ | 606 | /* Close the channel */ |
606 | vmbus_close(Device->channel); | 607 | vmbus_close(device->channel); |
607 | 608 | ||
608 | free_stor_device(storDevice); | 609 | free_stor_device(stor_device); |
609 | return 0; | 610 | return 0; |
610 | } | 611 | } |
611 | 612 | ||
612 | int stor_vsc_on_host_reset(struct hv_device *Device) | 613 | int stor_vsc_on_host_reset(struct hv_device *device) |
613 | { | 614 | { |
614 | struct storvsc_device *storDevice; | 615 | struct storvsc_device *stor_device; |
615 | struct storvsc_request_extension *request; | 616 | struct storvsc_request_extension *request; |
616 | struct vstor_packet *vstorPacket; | 617 | struct vstor_packet *vstor_packet; |
617 | int ret; | 618 | int ret; |
618 | 619 | ||
619 | DPRINT_INFO(STORVSC, "resetting host adapter..."); | 620 | DPRINT_INFO(STORVSC, "resetting host adapter..."); |
620 | 621 | ||
621 | storDevice = get_stor_device(Device); | 622 | stor_device = get_stor_device(device); |
622 | if (!storDevice) { | 623 | if (!stor_device) { |
623 | DPRINT_ERR(STORVSC, "unable to get stor device..." | 624 | DPRINT_ERR(STORVSC, "unable to get stor device..." |
624 | "device being destroyed?"); | 625 | "device being destroyed?"); |
625 | return -1; | 626 | return -1; |
626 | } | 627 | } |
627 | 628 | ||
628 | request = &storDevice->reset_request; | 629 | request = &stor_device->reset_request; |
629 | vstorPacket = &request->vstor_packet; | 630 | vstor_packet = &request->vstor_packet; |
630 | 631 | ||
631 | request->wait_event = osd_waitevent_create(); | 632 | request->wait_event = osd_waitevent_create(); |
632 | if (!request->wait_event) { | 633 | if (!request->wait_event) { |
@@ -634,18 +635,18 @@ int stor_vsc_on_host_reset(struct hv_device *Device) | |||
634 | goto Cleanup; | 635 | goto Cleanup; |
635 | } | 636 | } |
636 | 637 | ||
637 | vstorPacket->operation = VSTOR_OPERATION_RESET_BUS; | 638 | vstor_packet->operation = VSTOR_OPERATION_RESET_BUS; |
638 | vstorPacket->flags = REQUEST_COMPLETION_FLAG; | 639 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; |
639 | vstorPacket->vm_srb.path_id = storDevice->path_id; | 640 | vstor_packet->vm_srb.path_id = stor_device->path_id; |
640 | 641 | ||
641 | ret = vmbus_sendpacket(Device->channel, vstorPacket, | 642 | ret = vmbus_sendpacket(device->channel, vstor_packet, |
642 | sizeof(struct vstor_packet), | 643 | sizeof(struct vstor_packet), |
643 | (unsigned long)&storDevice->reset_request, | 644 | (unsigned long)&stor_device->reset_request, |
644 | VmbusPacketTypeDataInBand, | 645 | VmbusPacketTypeDataInBand, |
645 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); | 646 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
646 | if (ret != 0) { | 647 | if (ret != 0) { |
647 | DPRINT_ERR(STORVSC, "Unable to send reset packet %p ret %d", | 648 | DPRINT_ERR(STORVSC, "Unable to send reset packet %p ret %d", |
648 | vstorPacket, ret); | 649 | vstor_packet, ret); |
649 | goto Cleanup; | 650 | goto Cleanup; |
650 | } | 651 | } |
651 | 652 | ||
@@ -661,118 +662,118 @@ int stor_vsc_on_host_reset(struct hv_device *Device) | |||
661 | */ | 662 | */ |
662 | 663 | ||
663 | Cleanup: | 664 | Cleanup: |
664 | put_stor_device(Device); | 665 | put_stor_device(device); |
665 | return ret; | 666 | return ret; |
666 | } | 667 | } |
667 | 668 | ||
668 | /* | 669 | /* |
669 | * stor_vsc_on_io_request - Callback to initiate an I/O request | 670 | * stor_vsc_on_io_request - Callback to initiate an I/O request |
670 | */ | 671 | */ |
671 | static int stor_vsc_on_io_request(struct hv_device *Device, | 672 | static int stor_vsc_on_io_request(struct hv_device *device, |
672 | struct hv_storvsc_request *Request) | 673 | struct hv_storvsc_request *request) |
673 | { | 674 | { |
674 | struct storvsc_device *storDevice; | 675 | struct storvsc_device *stor_device; |
675 | struct storvsc_request_extension *requestExtension; | 676 | struct storvsc_request_extension *request_extension; |
676 | struct vstor_packet *vstorPacket; | 677 | struct vstor_packet *vstor_packet; |
677 | int ret = 0; | 678 | int ret = 0; |
678 | 679 | ||
679 | requestExtension = | 680 | request_extension = |
680 | (struct storvsc_request_extension *)Request->extension; | 681 | (struct storvsc_request_extension *)request->extension; |
681 | vstorPacket = &requestExtension->vstor_packet; | 682 | vstor_packet = &request_extension->vstor_packet; |
682 | storDevice = get_stor_device(Device); | 683 | stor_device = get_stor_device(device); |
683 | 684 | ||
684 | DPRINT_DBG(STORVSC, "enter - Device %p, DeviceExt %p, Request %p, " | 685 | DPRINT_DBG(STORVSC, "enter - Device %p, DeviceExt %p, Request %p, " |
685 | "Extension %p", Device, storDevice, Request, | 686 | "Extension %p", device, stor_device, request, |
686 | requestExtension); | 687 | request_extension); |
687 | 688 | ||
688 | DPRINT_DBG(STORVSC, "req %p len %d bus %d, target %d, lun %d cdblen %d", | 689 | DPRINT_DBG(STORVSC, "req %p len %d bus %d, target %d, lun %d cdblen %d", |
689 | Request, Request->data_buffer.Length, Request->bus, | 690 | request, request->data_buffer.Length, request->bus, |
690 | Request->target_id, Request->lun_id, Request->cdb_len); | 691 | request->target_id, request->lun_id, request->cdb_len); |
691 | 692 | ||
692 | if (!storDevice) { | 693 | if (!stor_device) { |
693 | DPRINT_ERR(STORVSC, "unable to get stor device..." | 694 | DPRINT_ERR(STORVSC, "unable to get stor device..." |
694 | "device being destroyed?"); | 695 | "device being destroyed?"); |
695 | return -2; | 696 | return -2; |
696 | } | 697 | } |
697 | 698 | ||
698 | /* print_hex_dump_bytes("", DUMP_PREFIX_NONE, Request->Cdb, | 699 | /* print_hex_dump_bytes("", DUMP_PREFIX_NONE, request->Cdb, |
699 | * Request->CdbLen); */ | 700 | * request->CdbLen); */ |
700 | 701 | ||
701 | requestExtension->request = Request; | 702 | request_extension->request = request; |
702 | requestExtension->device = Device; | 703 | request_extension->device = device; |
703 | 704 | ||
704 | memset(vstorPacket, 0 , sizeof(struct vstor_packet)); | 705 | memset(vstor_packet, 0 , sizeof(struct vstor_packet)); |
705 | 706 | ||
706 | vstorPacket->flags |= REQUEST_COMPLETION_FLAG; | 707 | vstor_packet->flags |= REQUEST_COMPLETION_FLAG; |
707 | 708 | ||
708 | vstorPacket->vm_srb.length = sizeof(struct vmscsi_request); | 709 | vstor_packet->vm_srb.length = sizeof(struct vmscsi_request); |
709 | 710 | ||
710 | vstorPacket->vm_srb.port_number = Request->host; | 711 | vstor_packet->vm_srb.port_number = request->host; |
711 | vstorPacket->vm_srb.path_id = Request->bus; | 712 | vstor_packet->vm_srb.path_id = request->bus; |
712 | vstorPacket->vm_srb.target_id = Request->target_id; | 713 | vstor_packet->vm_srb.target_id = request->target_id; |
713 | vstorPacket->vm_srb.lun = Request->lun_id; | 714 | vstor_packet->vm_srb.lun = request->lun_id; |
714 | 715 | ||
715 | vstorPacket->vm_srb.sense_info_length = SENSE_BUFFER_SIZE; | 716 | vstor_packet->vm_srb.sense_info_length = SENSE_BUFFER_SIZE; |
716 | 717 | ||
717 | /* Copy over the scsi command descriptor block */ | 718 | /* Copy over the scsi command descriptor block */ |
718 | vstorPacket->vm_srb.cdb_length = Request->cdb_len; | 719 | vstor_packet->vm_srb.cdb_length = request->cdb_len; |
719 | memcpy(&vstorPacket->vm_srb.cdb, Request->cdb, Request->cdb_len); | 720 | memcpy(&vstor_packet->vm_srb.cdb, request->cdb, request->cdb_len); |
720 | 721 | ||
721 | vstorPacket->vm_srb.data_in = Request->type; | 722 | vstor_packet->vm_srb.data_in = request->type; |
722 | vstorPacket->vm_srb.data_transfer_length = Request->data_buffer.Length; | 723 | vstor_packet->vm_srb.data_transfer_length = request->data_buffer.Length; |
723 | 724 | ||
724 | vstorPacket->operation = VSTOR_OPERATION_EXECUTE_SRB; | 725 | vstor_packet->operation = VSTOR_OPERATION_EXECUTE_SRB; |
725 | 726 | ||
726 | DPRINT_DBG(STORVSC, "srb - len %d port %d, path %d, target %d, " | 727 | DPRINT_DBG(STORVSC, "srb - len %d port %d, path %d, target %d, " |
727 | "lun %d senselen %d cdblen %d", | 728 | "lun %d senselen %d cdblen %d", |
728 | vstorPacket->vm_srb.length, | 729 | vstor_packet->vm_srb.length, |
729 | vstorPacket->vm_srb.port_number, | 730 | vstor_packet->vm_srb.port_number, |
730 | vstorPacket->vm_srb.path_id, | 731 | vstor_packet->vm_srb.path_id, |
731 | vstorPacket->vm_srb.target_id, | 732 | vstor_packet->vm_srb.target_id, |
732 | vstorPacket->vm_srb.lun, | 733 | vstor_packet->vm_srb.lun, |
733 | vstorPacket->vm_srb.sense_info_length, | 734 | vstor_packet->vm_srb.sense_info_length, |
734 | vstorPacket->vm_srb.cdb_length); | 735 | vstor_packet->vm_srb.cdb_length); |
735 | 736 | ||
736 | if (requestExtension->request->data_buffer.Length) { | 737 | if (request_extension->request->data_buffer.Length) { |
737 | ret = vmbus_sendpacket_multipagebuffer(Device->channel, | 738 | ret = vmbus_sendpacket_multipagebuffer(device->channel, |
738 | &requestExtension->request->data_buffer, | 739 | &request_extension->request->data_buffer, |
739 | vstorPacket, | 740 | vstor_packet, |
740 | sizeof(struct vstor_packet), | 741 | sizeof(struct vstor_packet), |
741 | (unsigned long)requestExtension); | 742 | (unsigned long)request_extension); |
742 | } else { | 743 | } else { |
743 | ret = vmbus_sendpacket(Device->channel, vstorPacket, | 744 | ret = vmbus_sendpacket(device->channel, vstor_packet, |
744 | sizeof(struct vstor_packet), | 745 | sizeof(struct vstor_packet), |
745 | (unsigned long)requestExtension, | 746 | (unsigned long)request_extension, |
746 | VmbusPacketTypeDataInBand, | 747 | VmbusPacketTypeDataInBand, |
747 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); | 748 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
748 | } | 749 | } |
749 | 750 | ||
750 | if (ret != 0) { | 751 | if (ret != 0) { |
751 | DPRINT_DBG(STORVSC, "Unable to send packet %p ret %d", | 752 | DPRINT_DBG(STORVSC, "Unable to send packet %p ret %d", |
752 | vstorPacket, ret); | 753 | vstor_packet, ret); |
753 | } | 754 | } |
754 | 755 | ||
755 | atomic_inc(&storDevice->num_outstanding_requests); | 756 | atomic_inc(&stor_device->num_outstanding_req); |
756 | 757 | ||
757 | put_stor_device(Device); | 758 | put_stor_device(device); |
758 | return ret; | 759 | return ret; |
759 | } | 760 | } |
760 | 761 | ||
761 | /* | 762 | /* |
762 | * stor_vsc_on_cleanup - Perform any cleanup when the driver is removed | 763 | * stor_vsc_on_cleanup - Perform any cleanup when the driver is removed |
763 | */ | 764 | */ |
764 | static void stor_vsc_on_cleanup(struct hv_driver *Driver) | 765 | static void stor_vsc_on_cleanup(struct hv_driver *driver) |
765 | { | 766 | { |
766 | } | 767 | } |
767 | 768 | ||
768 | /* | 769 | /* |
769 | * stor_vsc_initialize - Main entry point | 770 | * stor_vsc_initialize - Main entry point |
770 | */ | 771 | */ |
771 | int stor_vsc_initialize(struct hv_driver *Driver) | 772 | int stor_vsc_initialize(struct hv_driver *driver) |
772 | { | 773 | { |
773 | struct storvsc_driver_object *storDriver; | 774 | struct storvsc_driver_object *stor_driver; |
774 | 775 | ||
775 | storDriver = (struct storvsc_driver_object *)Driver; | 776 | stor_driver = (struct storvsc_driver_object *)driver; |
776 | 777 | ||
777 | DPRINT_DBG(STORVSC, "sizeof(STORVSC_REQUEST)=%zd " | 778 | DPRINT_DBG(STORVSC, "sizeof(STORVSC_REQUEST)=%zd " |
778 | "sizeof(struct storvsc_request_extension)=%zd " | 779 | "sizeof(struct storvsc_request_extension)=%zd " |
@@ -784,13 +785,14 @@ int stor_vsc_initialize(struct hv_driver *Driver) | |||
784 | sizeof(struct vmscsi_request)); | 785 | sizeof(struct vmscsi_request)); |
785 | 786 | ||
786 | /* Make sure we are at least 2 pages since 1 page is used for control */ | 787 | /* Make sure we are at least 2 pages since 1 page is used for control */ |
787 | /* ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1)); */ | 788 | /* ASSERT(stor_driver->RingBufferSize >= (PAGE_SIZE << 1)); */ |
788 | 789 | ||
789 | Driver->name = g_driver_name; | 790 | driver->name = g_driver_name; |
790 | memcpy(&Driver->deviceType, &gStorVscDeviceType, | 791 | memcpy(&driver->deviceType, &gStorVscDeviceType, |
791 | sizeof(struct hv_guid)); | 792 | sizeof(struct hv_guid)); |
792 | 793 | ||
793 | storDriver->request_ext_size = sizeof(struct storvsc_request_extension); | 794 | stor_driver->request_ext_size = |
795 | sizeof(struct storvsc_request_extension); | ||
794 | 796 | ||
795 | /* | 797 | /* |
796 | * Divide the ring buffer data size (which is 1 page less | 798 | * Divide the ring buffer data size (which is 1 page less |
@@ -798,22 +800,22 @@ int stor_vsc_initialize(struct hv_driver *Driver) | |||
798 | * the ring buffer indices) by the max request size (which is | 800 | * the ring buffer indices) by the max request size (which is |
799 | * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64) | 801 | * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64) |
800 | */ | 802 | */ |
801 | storDriver->max_outstanding_req_per_channel = | 803 | stor_driver->max_outstanding_req_per_channel = |
802 | ((storDriver->ring_buffer_size - PAGE_SIZE) / | 804 | ((stor_driver->ring_buffer_size - PAGE_SIZE) / |
803 | ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + | 805 | ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + |
804 | sizeof(struct vstor_packet) + sizeof(u64), | 806 | sizeof(struct vstor_packet) + sizeof(u64), |
805 | sizeof(u64))); | 807 | sizeof(u64))); |
806 | 808 | ||
807 | DPRINT_INFO(STORVSC, "max io %u, currently %u\n", | 809 | DPRINT_INFO(STORVSC, "max io %u, currently %u\n", |
808 | storDriver->max_outstanding_req_per_channel, | 810 | stor_driver->max_outstanding_req_per_channel, |
809 | STORVSC_MAX_IO_REQUESTS); | 811 | STORVSC_MAX_IO_REQUESTS); |
810 | 812 | ||
811 | /* Setup the dispatch table */ | 813 | /* Setup the dispatch table */ |
812 | storDriver->base.OnDeviceAdd = stor_vsc_on_device_add; | 814 | stor_driver->base.OnDeviceAdd = stor_vsc_on_device_add; |
813 | storDriver->base.OnDeviceRemove = stor_vsc_on_device_remove; | 815 | stor_driver->base.OnDeviceRemove = stor_vsc_on_device_remove; |
814 | storDriver->base.OnCleanup = stor_vsc_on_cleanup; | 816 | stor_driver->base.OnCleanup = stor_vsc_on_cleanup; |
815 | 817 | ||
816 | storDriver->on_io_request = stor_vsc_on_io_request; | 818 | stor_driver->on_io_request = stor_vsc_on_io_request; |
817 | 819 | ||
818 | return 0; | 820 | return 0; |
819 | } | 821 | } |