Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33373
b: refs/heads/master
c: d0710c7
h: refs/heads/master
i:
  33371: 8c2a0e2
v: v3
  • Loading branch information
Horst Hummel authored and Martin Schwidefsky committed Aug 10, 2006
1 parent 65753df commit 67ac6f9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 42 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ebc4599990898ecaaace7ed40dfad6d8d9f2a24a
refs/heads/master: d0710c7c9eea2145a0614f39dbe9dc8cb4ae14da
65 changes: 28 additions & 37 deletions trunk/drivers/s390/block/dasd_devmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static char *dasd[256];
module_param_array(dasd, charp, NULL, 0);

/*
* Single spinlock to protect devmap structures and lists.
* Single spinlock to protect devmap and servermap structures and lists.
*/
static DEFINE_SPINLOCK(dasd_devmap_lock);

Expand Down Expand Up @@ -858,39 +858,6 @@ static struct attribute_group dasd_attr_group = {
.attrs = dasd_attrs,
};

/*
* Check if the related storage server is already contained in the
* dasd_serverlist. If server is not contained, create new entry.
* Return 0 if server was already in serverlist,
* 1 if the server was added successfully
* <0 in case of error.
*/
static int
dasd_add_server(struct dasd_uid *uid)
{
struct dasd_servermap *new, *tmp;

/* check if server is already contained */
list_for_each_entry(tmp, &dasd_serverlist, list)
// normale cmp?
if (strncmp(tmp->sid.vendor, uid->vendor,
sizeof(tmp->sid.vendor)) == 0
&& strncmp(tmp->sid.serial, uid->serial,
sizeof(tmp->sid.serial)) == 0)
return 0;

new = (struct dasd_servermap *)
kzalloc(sizeof(struct dasd_servermap), GFP_KERNEL);
if (!new)
return -ENOMEM;

strncpy(new->sid.vendor, uid->vendor, sizeof(new->sid.vendor));
strncpy(new->sid.serial, uid->serial, sizeof(new->sid.serial));
list_add(&new->list, &dasd_serverlist);
return 1;
}


/*
* Return copy of the device unique identifier.
*/
Expand All @@ -910,6 +877,8 @@ dasd_get_uid(struct ccw_device *cdev, struct dasd_uid *uid)

/*
* Register the given device unique identifier into devmap struct.
* In addition check if the related storage server is already contained in the
* dasd_serverlist. If server is not contained, create new entry.
* Return 0 if server was already in serverlist,
* 1 if the server was added successful
* <0 in case of error.
Expand All @@ -918,16 +887,38 @@ int
dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid)
{
struct dasd_devmap *devmap;
int rc;
struct dasd_servermap *srv, *tmp;

devmap = dasd_find_busid(cdev->dev.bus_id);
if (IS_ERR(devmap))
return PTR_ERR(devmap);

/* generate entry for servermap */
srv = (struct dasd_servermap *)
kzalloc(sizeof(struct dasd_servermap), 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);

/* server is already contained ? */
spin_lock(&dasd_devmap_lock);
devmap->uid = *uid;
rc = dasd_add_server(uid);
list_for_each_entry(tmp, &dasd_serverlist, list) {
if (!memcmp(&srv->sid, &tmp->sid,
sizeof(struct dasd_servermap))) {
kfree(srv);
srv = NULL;
break;
}
}

/* add servermap to serverlist */
if (srv)
list_add(&srv->list, &dasd_serverlist);
spin_unlock(&dasd_devmap_lock);
return rc;

return (srv ? 1 : 0);
}
EXPORT_SYMBOL_GPL(dasd_set_uid);

Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/s390/block/dasd_eckd.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,11 @@ dasd_eckd_generate_uid(struct dasd_device *device, struct dasd_uid *uid)
return -ENODEV;

memset(uid, 0, sizeof(struct dasd_uid));
strncpy(uid->vendor, confdata->ned1.HDA_manufacturer,
sizeof(uid->vendor) - 1);
memcpy(uid->vendor, confdata->ned1.HDA_manufacturer,
sizeof(uid->vendor) - 1);
EBCASC(uid->vendor, sizeof(uid->vendor) - 1);
strncpy(uid->serial, confdata->ned1.HDA_location,
sizeof(uid->serial) - 1);
memcpy(uid->serial, confdata->ned1.HDA_location,
sizeof(uid->serial) - 1);
EBCASC(uid->serial, sizeof(uid->serial) - 1);
uid->ssid = confdata->neq.subsystemID;
if (confdata->ned2.sneq.flags == 0x40) {
Expand Down

0 comments on commit 67ac6f9

Please sign in to comment.