The Linux SCSI Generic (sg) HOWTO
Prev Chapter 8. Ioctl()s Next

8.23. SCSI_IOCTL_GET_IDLUN

SCSI_IOCTL_GET_IDLUN 0x5382. This ioctl takes a pointer to a "struct scsi_idlun" object as its third argument. The "struct scsi_idlun" is not visible to user applications. To use this, that structure needs to be replicated in the user's program. Something like:

typedef struct my_scsi_idlun {
    int four_in_one;    /* 4 separate bytes of info compacted into 1 int */
    int host_unique_id; /* distinguishes adapter cards from same supplier */
} My_scsi_idlun;
"four_in_one" is made up as follows:
(scsi_device_id | (lun << 8) | (channel << 16) | (host_no << 24))
These 4 components are assumed (or masked) to be 1 byte each. These are the four numbers that the SCSI subsystem uses to index devices, often written as "<host_no, channel, scsi_id, lun>". The 'host_unique_id' assigns a different number to each controller from the same manufacturer/low-level device driver. Most of the information provided by this command is more easily obtained from SG_GET_SCSI_ID.

The 'host_no' element is a change in lk 2.4 kernels. [In the lk 2.2 series and earlier, it was 'low_inode & 0xff' from the procfs entry corresponding to the host.] This change makes the use of the SCSI_IOCTL_GET_BUS_NUMBER ioctl() superfluous.

The advantage of this ioctl() is that it can be called on any SCSI file descriptor.


Prev Home Next
Sg ioctls removed in version 3 Up SCSI_IOCTL_GET_PCI


  • Bookmark
  • Add Resource
  • Modify Resource
  • Get Rated
  • Link to Us
  • Advertise
  • Contact
  • Search Resources

  • Recommended

    • Web Site Templates
    • Ultimate Trading Script
    • The Exterminator
    • Guestbook Script
    • Thumbnail Creator
    • Custom Programming
    • PHP Forums
    • Ajax Tutorial
  • Resource Map

    • Home
    • Expanded Directory
    • New Listings
    • Most Popular
    • Top Rated
    • Email Updates
    • Random Link
    • Advanced Search
    • Bookmark Us
    • Link to Us
    • Advertising Info
    • Webmaster Forum
    • Accessibility Statement
  • General Resources

    • ASP
    • C/C++
    • ColdFusion
    • Flash / ActionScript
    • General
    • HTML
    • Java
    • JavaScript
    • Perl
    • PHP
    • Python
    • Remotely Hosted
    • Unix Shell
    • Visual Basic
    • XML
  • Scripts & Programs

    • ASP
    • C/C++
    • ColdFusion
    • Flash / ActionScript
    • Java
    • JavaScript
    • Perl
    • PHP
    • Python
    • Remotely Hosted
    • Unix Shell
    • Visual Basic
    • XML
  • Online Tutorials

    • ASP
    • C/C++
    • ColdFusion
    • Flash / ActionScript
    • HTML
    • Howtos
    • Java
    • JavaScript
    • Perl
    • PHP
    • Python
    • Unix Shell
    • Visual Basic
    • XML
  • Books

    • ASP
    • C/C++
    • ColdFusion
    • Flash / ActionScript
    • HTML
    • Java
    • JavaScript
    • Perl
    • PHP
    • Python
    • Unix Shell
    • Visual Basic
    • XML
  • Supporters

    • Bigwebmaster Supporters
    • Ozzu Website Templates
    • Xbox Mod Chip
    • Mortgages
    • Loans
    • Credit Card
    • Debt Consolidation
  • Partners

    • Unmelted Templates
    • Web Design Forum