Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346474
b: refs/heads/master
c: 667be1e
h: refs/heads/master
v: v3
  • Loading branch information
Ed Cashin authored and Linus Torvalds committed Dec 18, 2012
1 parent 271f2d8 commit 69541a1
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cd220bf51f94e6b3f7678183b6ea911cefbf7d03
refs/heads/master: 667be1e757f5684576d01d7402907a2489b1402f
1 change: 1 addition & 0 deletions trunk/drivers/block/aoe/aoe.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ struct aoedev {
struct aoetgt *htgt; /* target needing rexmit assistance */
ulong ntargets;
ulong kicked;
char ident[512];
};

/* kthread tracking */
Expand Down
30 changes: 30 additions & 0 deletions trunk/drivers/block/aoe/aoeblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/mutex.h>
#include <linux/export.h>
#include <linux/moduleparam.h>
#include <scsi/sg.h>
#include "aoe.h"

static DEFINE_MUTEX(aoeblk_mutex);
Expand Down Expand Up @@ -212,9 +213,38 @@ aoeblk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
return 0;
}

static int
aoeblk_ioctl(struct block_device *bdev, fmode_t mode, uint cmd, ulong arg)
{
struct aoedev *d;

if (!arg)
return -EINVAL;

d = bdev->bd_disk->private_data;
if ((d->flags & DEVFL_UP) == 0) {
pr_err("aoe: disk not up\n");
return -ENODEV;
}

if (cmd == HDIO_GET_IDENTITY) {
if (!copy_to_user((void __user *) arg, &d->ident,
sizeof(d->ident)))
return 0;
return -EFAULT;
}

/* udev calls scsi_id, which uses SG_IO, resulting in noise */
if (cmd != SG_IO)
pr_info("aoe: unknown ioctl 0x%x\n", cmd);

return -ENOTTY;
}

static const struct block_device_operations aoe_bdops = {
.open = aoeblk_open,
.release = aoeblk_release,
.ioctl = aoeblk_ioctl,
.getgeo = aoeblk_getgeo,
.owner = THIS_MODULE,
};
Expand Down
16 changes: 16 additions & 0 deletions trunk/drivers/block/aoe/aoecmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,17 @@ aoecmd_sleepwork(struct work_struct *work)
}
}

static void
ata_ident_fixstring(u16 *id, int ns)
{
u16 s;

while (ns-- > 0) {
s = *id;
*id++ = s >> 8 | s << 8;
}
}

static void
ataid_complete(struct aoedev *d, struct aoetgt *t, unsigned char *id)
{
Expand Down Expand Up @@ -833,6 +844,11 @@ ataid_complete(struct aoedev *d, struct aoetgt *t, unsigned char *id)
d->geo.sectors = get_unaligned_le16(&id[56 << 1]);
}

ata_ident_fixstring((u16 *) &id[10<<1], 10); /* serial */
ata_ident_fixstring((u16 *) &id[23<<1], 4); /* firmware */
ata_ident_fixstring((u16 *) &id[27<<1], 20); /* model */
memcpy(d->ident, id, sizeof(d->ident));

if (d->ssize != ssize)
printk(KERN_INFO
"aoe: %pm e%ld.%d v%04x has %llu sectors\n",
Expand Down

0 comments on commit 69541a1

Please sign in to comment.