Parcourir la source

Split "iSCSI as a SCSI device" out from "iSCSI as a TCP protocol".

tags/v0.9.3
Michael Brown il y a 18 ans
Parent
révision
f25731d08f
3 fichiers modifiés avec 75 ajouts et 28 suppressions
  1. 52
    0
      src/drivers/scsi/iscsidev.c
  2. 3
    0
      src/include/gpxe/iscsi.h
  3. 20
    28
      src/net/tcp/iscsi.c

+ 52
- 0
src/drivers/scsi/iscsidev.c Voir le fichier

@@ -0,0 +1,52 @@
1
+/*
2
+ * Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
3
+ *
4
+ * This program is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU General Public License as
6
+ * published by the Free Software Foundation; either version 2 of the
7
+ * License, or any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful, but
10
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
+ * General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License
15
+ * along with this program; if not, write to the Free Software
16
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
+ */
18
+
19
+#include <stddef.h>
20
+#include <gpxe/iscsi.h>
21
+
22
+/** @file
23
+ *
24
+ * iSCSI SCSI device
25
+ *
26
+ */
27
+
28
+/**
29
+ * Issue SCSI command via iSCSI device
30
+ *
31
+ * @v scsi		SCSI device
32
+ * @v command		SCSI command
33
+ * @ret rc		Return status code
34
+ */
35
+static int iscsi_command ( struct scsi_device *scsi,
36
+			   struct scsi_command *command ) {
37
+	struct iscsi_device *iscsidev
38
+		= container_of ( scsi, struct iscsi_device, scsi );
39
+
40
+	return iscsi_issue ( &iscsidev->iscsi, command );
41
+}
42
+
43
+/**
44
+ * Initialise iSCSI device
45
+ *
46
+ * @v iscsidev		iSCSI device
47
+ */
48
+int init_iscsidev ( struct iscsi_device *iscsidev ) {
49
+	iscsidev->scsi.command = iscsi_command;
50
+	iscsidev->scsi.lun = iscsidev->iscsi.lun;
51
+	return init_scsidev ( &iscsidev->scsi );
52
+}

+ 3
- 0
src/include/gpxe/iscsi.h Voir le fichier

@@ -513,6 +513,9 @@ struct iscsi_session {
513 513
 /** Maximum number of retries at connecting */
514 514
 #define ISCSI_MAX_RETRIES 2
515 515
 
516
+extern int iscsi_issue ( struct iscsi_session *iscsi,
517
+			 struct scsi_command *command );
518
+
516 519
 /** An iSCSI device */
517 520
 struct iscsi_device {
518 521
 	/** SCSI device interface */

+ 20
- 28
src/net/tcp/iscsi.c Voir le fichier

@@ -1,3 +1,21 @@
1
+/*
2
+ * Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
3
+ *
4
+ * This program is free software; you can redistribute it and/or
5
+ * modify it under the terms of the GNU General Public License as
6
+ * published by the Free Software Foundation; either version 2 of the
7
+ * License, or any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful, but
10
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
+ * General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License
15
+ * along with this program; if not, write to the Free Software
16
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
+ */
18
+
1 19
 #include <stddef.h>
2 20
 #include <string.h>
3 21
 #include <vsprintf.h>
@@ -543,8 +561,8 @@ static struct tcp_operations iscsi_tcp_operations = {
543 561
  * @v command		SCSI command
544 562
  * @ret rc		Return status code
545 563
  */
546
-static int iscsi_command ( struct iscsi_session *iscsi,
547
-			   struct scsi_command *command ) {
564
+int iscsi_issue ( struct iscsi_session *iscsi,
565
+		  struct scsi_command *command ) {
548 566
 	iscsi->command = command;
549 567
 	iscsi->status &= ~( ISCSI_STATUS_DONE | ISCSI_STATUS_ERR );
550 568
 
@@ -563,29 +581,3 @@ static int iscsi_command ( struct iscsi_session *iscsi,
563 581
 
564 582
 	return ( ( iscsi->status & ISCSI_STATUS_ERR ) ? -EIO : 0 );	
565 583
 }
566
-
567
-/**
568
- * Issue SCSI command via iSCSI device
569
- *
570
- * @v scsi		SCSI device
571
- * @v command		SCSI command
572
- * @ret rc		Return status code
573
- */
574
-static int iscsi_scsi_command ( struct scsi_device *scsi,
575
-				struct scsi_command *command ) {
576
-	struct iscsi_device *iscsidev
577
-		= container_of ( scsi, struct iscsi_device, scsi );
578
-
579
-	return iscsi_command ( &iscsidev->iscsi, command );
580
-}
581
-
582
-/**
583
- * Initialise iSCSI device
584
- *
585
- * @v iscsidev		iSCSI device
586
- */
587
-int init_iscsidev ( struct iscsi_device *iscsidev ) {
588
-	iscsidev->scsi.command = iscsi_scsi_command;
589
-	iscsidev->scsi.lun = iscsidev->iscsi.lun;
590
-	return init_scsidev ( &iscsidev->scsi );
591
-}

Chargement…
Annuler
Enregistrer