All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] sgbind
@ 2003-05-14 12:33 Douglas Gilbert
  2003-05-14 13:02 ` Christoph Hellwig
  2003-05-15  0:05 ` Patrick Mansfield
  0 siblings, 2 replies; 5+ messages in thread
From: Douglas Gilbert @ 2003-05-14 12:33 UTC (permalink / raw)
  To: linux-scsi

I have resynced the sgbind code against lk 2.5.69-bk8
but I will await a more stable baseline before releasing
it (so I know sgbind isn't causing more flakiness).


sgbind is a virtual device node (misc char device 10, 246
at the moment) that allows an existing or an unscanned
logical unit (device) to be bound by its nexus and SCSI
commands sent to it. By "nexus" I mean its topological
address <host_no, channel, id, lun>.

The sgbind code is in the sg driver which allows it
to share existing code. sgbind avoids using the sg
driver's upper level sysfs code (i.e. sg_driverfs_dev).

Here is the additional code in the sg header:

/* sgbind support, for device scanning via /dev/sgbind */
#define SGBIND_ATTACH 0x22a0
#define SGBIND_DETACH 0x22a1
#define SGBIND_ADD_LU 0x22a2
#define SGBIND_REMOVE_LU 0x22a3
 

struct sgbind_nexus {
         int descriptor_id;      /* set to 0 for now */
         unsigned int host_no;
         unsigned int channel;
         unsigned int scsi_id;
         unsigned int lun;
};

The SGBIND_ADD_LU and SGBIND_REMOVE_LU ioctls are simply
programmatic interfaces to the code behind "scsi add-single-device"
and "scsi remove-single-device". [Code was moved from scsi_proc.c
to scsi_scan.c so that these ioctls don't require procfs to be
configured.]

Multiple file descriptors may be open on /dev/sgbind, each
file descriptor has its own state (like normal sg device nodes).
The SGBIND_ATTACH ioctl will either bind:
   - to an existing logical unit (device) which matches the
     given nexus
   - create a new scsi_device instance (using scsi_alloc_dev())
     with the given nexus
The host number must match an existing host.

The SGBIND_DETACH ioctl unbinds the file descriptor from an
existing nexus (assuming a nexus was established by a prior
SGBIND_ATTACH). Thereafter an new nexus can be formed with
SGBIND_ATTACH. Closing the file descriptor also has the effect
of unbinding the nexus.

I'm not sure whether a SGBIND_PUBLISH ioctl is required
(SGBIND_ADD_LU sort of does that).

Two other sg ioctl's can be used on a sgbind file descriptor:
   - SG_GET_VERSION
   - SG_IO once there is an existing nexus

Obviously getting to the SG_IO ioctl is the point of the exercise.


To test this further I believe there should be a new
field in the Scsi_Host and Scsi_Host_Template structures
called something like 'no_scan'. Default is 0 for
existing mid level scanning. A value of 1 instructs
the scsi_scan.c to ignore this host.

Comments?

Doug Gilbert





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-05-14 23:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-14 12:33 [RFC] sgbind Douglas Gilbert
2003-05-14 13:02 ` Christoph Hellwig
2003-05-14 14:02   ` Douglas Gilbert
2003-05-14 14:49     ` Patrick Mansfield
2003-05-15  0:05 ` Patrick Mansfield

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.