Skip to content

Commit

Permalink
STORAGEMODEL-385 - changed ioctl return type to hopfully support all …
Browse files Browse the repository at this point in the history
…platforms
  • Loading branch information
miro-original committed Mar 9, 2017
1 parent 44c618a commit 54d902c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/infi/sgutils/ioctl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def scsi_ioctl_get_idlun(device_path):

def scsi_ioctl_get_bus_number(device_path):
""":returns: a :class:`.SG_GET_SCSI_ID` object"""
from ctypes import c_ulong
buffer = c_ulong()
from ctypes import c_buffer
import struct
buffer = c_buffer(4)
result = ioctl(device_path, opcodes.SCSI_IOCTL_GET_BUS_NUMBER, buffer)
return buffer.value
# using @I due to STORAGEMODEL-385
return struct.unpack("@I", buffer.raw)[0]

0 comments on commit 54d902c

Please sign in to comment.