From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hannes Reinecke Date: Wed, 07 Jul 2010 10:20:23 +0000 Subject: Re: [PATCH] path_id: add handle_scsi_sas Message-Id: <4C3454E7.8090103@suse.de> List-Id: References: <1277468902-12862-1-git-send-email-harald@redhat.com> In-Reply-To: <1277468902-12862-1-git-send-email-harald@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org harald@redhat.com wrote: > From: Harald Hoyer >=20 > based on code by Jim Garlick. > --- > extras/path_id/path_id.c | 64 ++++++++++++++++++++++++++++++++++++++++= +++++- > 1 files changed, 63 insertions(+), 1 deletions(-) >=20 > diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c > index dcee378..c3d241b 100644 > --- a/extras/path_id/path_id.c > +++ b/extras/path_id/path_id.c > @@ -121,7 +121,69 @@ out: > =20 > static struct udev_device *handle_scsi_sas(struct udev_device *parent, c= har **path) > { > - return NULL; > + struct udev *udev =3D udev_device_get_udev(parent); > + struct udev_device *end_dev; > + struct udev_device *sasdev; > + struct udev_device *phydev; > + struct udev_device *parent_dev; > + struct udev_device *child_dev; > + char syspath[UTIL_PATH_SIZE], *base; > + char phy_path[UTIL_PATH_SIZE]; > + const char *end_name, *name, *enc, *bay; > + const char *port_path; > + int scsi_host; > + int num_phys =3D 8; > + int i; > + > + parent_dev =3D parent; > + while (1) { > + child_dev =3D parent_dev; > + parent_dev =3D udev_device_get_parent(child_dev); > + if (parent_dev =3D NULL) > + return NULL; > + name =3D udev_device_get_sysname(parent_dev); > + if (strstr(name, "end_device-")) { > + end_dev =3D parent_dev; > + end_name =3D name; > + } else if (sscanf(name, "host%d", &scsi_host)) { > + port_path =3D udev_device_get_syspath(child_dev); > + break; > + } > + } > + This is wrong. The whole idea of path_id is that the path traversal is done in one common loop, from which there are callouts to the individual device handlers. So we should be having one sas_end_device_handler and one sas_host handler. I'll see to come up with an updated version. Cheers, Hannes --=20 Dr. Hannes Reinecke zSeries & Storage hare@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg GF: Markus Rex, HRB 16746 (AG N=FCrnberg)