On 1/30/06, Joerg Schilling <schilling@fokus.fraunhofer.de> wrote: > Albert Cahalan <acahalan@gmail.com> wrote: > > > Let's address the second bug first. Linux provides full > > bus number and LUN info for all block devices. You get it > > like this: > > > > struct stat sbuf; > > stat("/dev/hdc", &sbuf); > > int bus = sbuf.st_mode>>12; > > int target = major(sbuf.st_rdev); > > int lun = minor(sbuf.st_rdev); > > Now tell me how to match this with information from /dev/sg* You do the obvious, scanning /dev to find the device file. You can map from names to numbers (like DNS does for IP) and back from numbers to names (like reverse DNS does). If you need to map from /dev/hd* to /dev/sg*, then you have found a bug. Explain what must be added to /dev/hd* so that you don't need to go messing with /dev/sg* anymore. The name /dev/hd* is not the high-level interface. It's the device name, used by both high-level and low-level interfaces. It alone is the non-kernel way to refer to the device. (inside the kernel you just get a pointer, and the dev_t assists in translation) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: CD writing in future Linux try #2 [ was: Re: CD writing in future Linux (stirring up a hornets' nest) ]
- From: Joerg Schilling <schilling@fokus.fraunhofer.de>
- Re: CD writing in future Linux try #2 [ was: Re: CD writing in future Linux (stirring up a hornets' nest) ]
- References:
- CD writing in future Linux try #2 [ was: Re: CD writing in future Linux (stirring up a hornets' nest) ]
- From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
- Re: CD writing in future Linux try #2 [ was: Re: CD writing in future Linux (stirring up a hornets' nest) ]
- From: Joerg Schilling <schilling@fokus.fraunhofer.de>
- Re: CD writing in future Linux try #2 [ was: Re: CD writing in future Linux (stirring up a hornets' nest) ]
- From: Matthias Andree <matthias.andree@gmx.de>
- Re: CD writing in future Linux try #2 [ was: Re: CD writing in future Linux (stirring up a hornets' nest) ]
- From: Jan Engelhardt <jengelh@linux01.gwdg.de>
- Re: CD writing in future Linux try #2 [ was: Re: CD writing in future Linux (stirring up a hornets' nest) ]
- From: Joerg Schilling <schilling@fokus.fraunhofer.de>
- Re: CD writing in future Linux try #2 [ was: Re: CD writing in future Linux (stirring up a hornets' nest) ]
- From: Albert Cahalan <acahalan@gmail.com>
- Re: CD writing in future Linux try #2 [ was: Re: CD writing in future Linux (stirring up a hornets' nest) ]
- From: Joerg Schilling <schilling@fokus.fraunhofer.de>
- CD writing in future Linux try #2 [ was: Re: CD writing in future Linux (stirring up a hornets' nest) ]
- Prev by Date: Re: CD writing in future Linux (stirring up a hornets' nest)
- Next by Date: FW: MSI-X on 2.6.15
- Previous by thread: Re: CD writing in future Linux try #2 [ was: Re: CD writing in future Linux (stirring up a hornets' nest) ]
- Next by thread: Re: CD writing in future Linux try #2 [ was: Re: CD writing in future Linux (stirring up a hornets' nest) ]
- Index(es):
![]() |