From 3cbe90093acba116c5fc46beaf50f74c7c8a1b69 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Thu, 5 Aug 2010 15:04:46 +1000 Subject: [PATCH 1/1] Treat iSCSI targets as block devices. Currently iSCSI targets are treated as network devices, this doesn't always work firmware is capable of treating them like block devices which seems more reliable. Signed-off-by: Tony Breeds --- second/file.c | 3 +++ second/fs_ext2.c | 3 ++- second/partition.c | 3 ++- second/prom.c | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/second/file.c b/second/file.c index 466abf2..a52b664 100644 --- a/second/file.c +++ b/second/file.c @@ -675,6 +675,9 @@ int open_file(struct boot_fspec_t* spec, struct boot_file_t* file) case FILE_DEVICE_BLOCK: DEBUG_F("device is a block device\n"); return file_block_open(file, spec, spec->part); + case FILE_DEVICE_ISCSI: + DEBUG_F("device is a iSCSI device\n"); + return file_block_open(file, spec, spec->part); case FILE_DEVICE_NET: DEBUG_F("device is a network device\n"); return file_net_open(file, spec); diff --git a/second/fs_ext2.c b/second/fs_ext2.c index c86907e..a8bdf6b 100644 --- a/second/fs_ext2.c +++ b/second/fs_ext2.c @@ -141,7 +141,8 @@ ext2_open( struct boot_file_t* file, DEBUG_LEAVE(FILE_ERR_FSBUSY); return FILE_ERR_FSBUSY; } - if (file->device_kind != FILE_DEVICE_BLOCK) { + if (file->device_kind != FILE_DEVICE_BLOCK + && file->device_kind != FILE_DEVICE_ISCSI) { DEBUG_LEAVE(FILE_ERR_BADDEV); return FILE_ERR_BADDEV; } diff --git a/second/partition.c b/second/partition.c index d20a0ed..4381770 100644 --- a/second/partition.c +++ b/second/partition.c @@ -400,7 +400,8 @@ get_part_type(char *device, int partition) struct partition_t* found; char *type = NULL; - if (prom_get_devtype(device) != FILE_DEVICE_BLOCK) + int device_kind = prom_get_devtype(device); + if (device_kind != FILE_DEVICE_BLOCK && device_kind != FILE_DEVICE_ISCSI) return NULL; parts = partitions_lookup(device); diff --git a/second/prom.c b/second/prom.c index fbadb2a..784994d 100644 --- a/second/prom.c +++ b/second/prom.c @@ -196,7 +196,7 @@ prom_get_devtype (char *device) char tmp[64]; if (strstr(device, TOK_ISCSI)) - device = strcpy(tmp, "/vdevice/gscsi/disk"); + return FILE_DEVICE_ISCSI; /* Find OF device phandle */ dev = prom_finddevice(device); -- 2.39.2