[PATCH] sd_many done right (2/5)

Kurt Garloff (garloff@suse.de)
Fri, 26 Jul 2002 17:46:22 +0200


--gvF4niNJ+uBMJnEh
Content-Type: multipart/mixed; boundary="AH+kv8CCoFf6qPuz"
Content-Disposition: inline

--AH+kv8CCoFf6qPuz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

here comes patch 2/5 from a series of patches to support more than 128 (and
optionally more than 256) SCSI disks with Linux 2.4 by changing the sd driv=
er
to dynamically allocate memory and register block majors as disks get
attached.

The patches are all available at
http://www.suse.de/~garloff/linux/scsi-many/

This patch (2/5) makes the /proc/scsi/scsi extensions realized in patch 1/5
switchable at run time by echoing "scsi report-devs X" to /proc/scsi/scsi.
(X=3D1 enables, 0 disables). It defaults to off to avoid any trouble with
applications parsing /proc/scsi/scsi. Though I don't know any due to the=20
limited usefulness of /proc/scsi/scsi without these extensions.

Patch is against 2.4.19rc1. Patch depends on patch 1/5.
Marcelo, these patches are meant for inclusion into 2.4.20pre.

Regards,
--=20
Kurt Garloff <garloff@suse.de> Eindhoven, NL
GPG key: See mail header, key servers Linux kernel development
SuSE Linux AG, Nuernberg, DE SCSI, Security

--AH+kv8CCoFf6qPuz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="scsi-switch-repdev-2419rc1.diff"
Content-Transfer-Encoding: quoted-printable

diff -uNr linux-2.4.18.S18.scsiboot/drivers/scsi/scsi.c linux-2.4.18.S18.sc=
siswitch/drivers/scsi/scsi.c
--- linux-2.4.18.S18.scsiboot/drivers/scsi/scsi.c Sat Jul 13 18:48:49 2002
+++ linux-2.4.18.S18.scsiswitch/drivers/scsi/scsi.c Tue Jul 16 01:24:00 2002
@@ -126,6 +126,9 @@
*/
unsigned int scsi_logging_level;
=20
+/* Flag for extended /proc/scsi/scsi format */
+int scsi_rep_hldev;
+
const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] =3D
{
"Direct-Access ",
@@ -1665,6 +1668,18 @@
goto out;
=20
/*
+ * Usage: echo "scsi report-devs X" > /proc/scsi/scsi
+ * to enable (X!=3D0) or disable (X=3D0) the extended /proc/scsi/scsi for=
mat
+ */
+ if (!strncmp("report-devs", buffer + 5, 11)) {
+ p =3D buffer + 17;
+
+ switch (*p) {
+ case '0': scsi_rep_hldev =3D 0; goto out;
+ default: scsi_rep_hldev =3D 1; goto out;
+ }
+ }
+ /*
* Usage: echo "scsi dump #N" > /proc/scsi/scsi
* to dump status of all scsi commands. The number is used to specify th=
e level
* of detail in the dump.
diff -uNr linux-2.4.18.S18.scsiboot/drivers/scsi/scsi_proc.c linux-2.4.18.S=
18.scsiswitch/drivers/scsi/scsi_proc.c
--- linux-2.4.18.S18.scsiboot/drivers/scsi/scsi_proc.c Thu Jun 20 18:08:40 =
2002
+++ linux-2.4.18.S18.scsiswitch/drivers/scsi/scsi_proc.c Sat Jul 13 19:17:3=
5 2002
@@ -256,6 +256,9 @@
return (cmdIndex);
}
=20
+/* Flag for extended /proc/scsi/scsi format */
+extern int scsi_rep_hldev;
+
void proc_print_scsidevice(Scsi_Device * scd, char *buffer, int *size, int=
len)
{
=20
@@ -301,6 +304,11 @@
else
y +=3D sprintf(buffer + len + y, "\n");
=09
+ if (!scsi_rep_hldev) {
+ *size =3D y;
+ return;
+ }
+ =20
/* Report high level devices attached */
y +=3D sprintf (buffer + len + y, " Attached drivers:");
=20

--AH+kv8CCoFf6qPuz--

--gvF4niNJ+uBMJnEh
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9QW7OxmLh6hyYd04RAv0jAJ0UxJbIw+TLDAM5gcHZTjew4ZVNHACcCyv2
dUpojJwzrE3RnTQn2urp86M=
=wJ70
-----END PGP SIGNATURE-----

--gvF4niNJ+uBMJnEh--
-
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/