diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-26 22:52:53 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-26 22:52:53 -0800 |
commit | 0444fa78751260b38f0db3418e001bf86593f05f (patch) | |
tree | ffd3bd72c7078d705216ef156cae63d990125113 /drivers/s390/block/dasd_devmap.c | |
parent | 69e4d4c3e1cb23fce81deeae08b502d27bad6993 (diff) | |
parent | 9d40d2e3955185b69c264583d080eb3defcb05a0 (diff) |
Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6: (56 commits)
[S390] replace lock_cpu_hotplug with get_online_cpus
[S390] usage of s390dbf: shrink number of debug areas to use.
[S390] constify function pointer tables.
[S390] do local_irq_restore while spinning in spin_lock_irqsave.
[S390] add smp_call_function_mask
[S390] dasd: fix loop in request expiration handling
[S390] Unused field / extern declaration in processor.h
[S390] Remove TOPDIR from Makefile
[S390] dasd: add hyper PAV support to DASD device driver, part 1
[S390] single-step cleanup
[S390] Move NOTES and BUG_TABLE.
[S390] drivers/s390/: Spelling fixes
[S390] include/asm-s390/: Spelling fixes
[S390] arch/s390/: Spelling fixes
[S390] Use diag308 subcodes 3 and 6 for reboot and dump when possible.
[S390] vmemmap: allocate struct pages before 1:1 mapping
[S390] Initialize sclp_ipl_info
[S390] Allocate and free cpu lowcores and stacks when needed/possible.
[S390] use LIST_HEAD instead of LIST_HEAD_INIT
[S390] Load disabled wait psw instead of stopping cpu on halt.
...
Diffstat (limited to 'drivers/s390/block/dasd_devmap.c')
-rw-r--r-- | drivers/s390/block/dasd_devmap.c | 94 |
1 files changed, 37 insertions, 57 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 0c67258fb9e..f4fb4025734 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -49,22 +49,6 @@ struct dasd_devmap { }; /* - * dasd_server_ssid_map contains a globally unique storage server subsystem ID. - * dasd_server_ssid_list contains the list of all subsystem IDs accessed by - * the DASD device driver. - */ -struct dasd_server_ssid_map { - struct list_head list; - struct system_id { - char vendor[4]; - char serial[15]; - __u16 ssid; - } sid; -}; - -static struct list_head dasd_server_ssid_list; - -/* * Parameter parsing functions for dasd= parameter. The syntax is: * <devno> : (0x)?[0-9a-fA-F]+ * <busid> : [0-0a-f]\.[0-9a-f]\.(0x)?[0-9a-fA-F]+ @@ -721,8 +705,9 @@ dasd_ro_store(struct device *dev, struct device_attribute *attr, devmap->features &= ~DASD_FEATURE_READONLY; if (devmap->device) devmap->device->features = devmap->features; - if (devmap->device && devmap->device->gdp) - set_disk_ro(devmap->device->gdp, val); + if (devmap->device && devmap->device->block + && devmap->device->block->gdp) + set_disk_ro(devmap->device->block->gdp, val); spin_unlock(&dasd_devmap_lock); return count; } @@ -893,12 +878,16 @@ dasd_alias_show(struct device *dev, struct device_attribute *attr, char *buf) devmap = dasd_find_busid(dev->bus_id); spin_lock(&dasd_devmap_lock); - if (!IS_ERR(devmap)) - alias = devmap->uid.alias; + if (IS_ERR(devmap) || strlen(devmap->uid.vendor) == 0) { + spin_unlock(&dasd_devmap_lock); + return sprintf(buf, "0\n"); + } + if (devmap->uid.type == UA_BASE_PAV_ALIAS || + devmap->uid.type == UA_HYPER_PAV_ALIAS) + alias = 1; else alias = 0; spin_unlock(&dasd_devmap_lock); - return sprintf(buf, alias ? "1\n" : "0\n"); } @@ -930,19 +919,36 @@ static ssize_t dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) { struct dasd_devmap *devmap; - char uid[UID_STRLEN]; + char uid_string[UID_STRLEN]; + char ua_string[3]; + struct dasd_uid *uid; devmap = dasd_find_busid(dev->bus_id); spin_lock(&dasd_devmap_lock); - if (!IS_ERR(devmap) && strlen(devmap->uid.vendor) > 0) - snprintf(uid, sizeof(uid), "%s.%s.%04x.%02x", - devmap->uid.vendor, devmap->uid.serial, - devmap->uid.ssid, devmap->uid.unit_addr); - else - uid[0] = 0; + if (IS_ERR(devmap) || strlen(devmap->uid.vendor) == 0) { + spin_unlock(&dasd_devmap_lock); + return sprintf(buf, "\n"); + } + uid = &devmap->uid; + switch (uid->type) { + case UA_BASE_DEVICE: + sprintf(ua_string, "%02x", uid->real_unit_addr); + break; + case UA_BASE_PAV_ALIAS: + sprintf(ua_string, "%02x", uid->base_unit_addr); + break; + case UA_HYPER_PAV_ALIAS: + sprintf(ua_string, "xx"); + break; + default: + /* should not happen, treat like base device */ + sprintf(ua_string, "%02x", uid->real_unit_addr); + break; + } + snprintf(uid_string, sizeof(uid_string), "%s.%s.%04x.%s", + uid->vendor, uid->serial, uid->ssid, ua_string); spin_unlock(&dasd_devmap_lock); - - return snprintf(buf, PAGE_SIZE, "%s\n", uid); + return snprintf(buf, PAGE_SIZE, "%s\n", uid_string); } static DEVICE_ATTR(uid, 0444, dasd_uid_show, NULL); @@ -1040,39 +1046,16 @@ int dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid) { struct dasd_devmap *devmap; - struct dasd_server_ssid_map *srv, *tmp; devmap = dasd_find_busid(cdev->dev.bus_id); if (IS_ERR(devmap)) return PTR_ERR(devmap); - /* generate entry for server_ssid_map */ - srv = (struct dasd_server_ssid_map *) - kzalloc(sizeof(struct dasd_server_ssid_map), GFP_KERNEL); - if (!srv) - return -ENOMEM; - strncpy(srv->sid.vendor, uid->vendor, sizeof(srv->sid.vendor) - 1); - strncpy(srv->sid.serial, uid->serial, sizeof(srv->sid.serial) - 1); - srv->sid.ssid = uid->ssid; - - /* server is already contained ? */ spin_lock(&dasd_devmap_lock); devmap->uid = *uid; - list_for_each_entry(tmp, &dasd_server_ssid_list, list) { - if (!memcmp(&srv->sid, &tmp->sid, - sizeof(struct system_id))) { - kfree(srv); - srv = NULL; - break; - } - } - - /* add servermap to serverlist */ - if (srv) - list_add(&srv->list, &dasd_server_ssid_list); spin_unlock(&dasd_devmap_lock); - return (srv ? 1 : 0); + return 0; } EXPORT_SYMBOL_GPL(dasd_set_uid); @@ -1138,9 +1121,6 @@ dasd_devmap_init(void) dasd_max_devindex = 0; for (i = 0; i < 256; i++) INIT_LIST_HEAD(&dasd_hashlists[i]); - - /* Initialize servermap structure. */ - INIT_LIST_HEAD(&dasd_server_ssid_list); return 0; } |