diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 18:20:39 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 18:20:39 +0100 |
commit | 3661f00e2097676847deb01add1a0918044bd816 (patch) | |
tree | 5a78dc694217c446b09362913195ad7afcf38fdb /drivers/block/aoe/aoechr.c | |
parent | Merge git://git.linux-nfs.org/pub/linux/nfs-2.6 (diff) | |
parent | [PATCH] aoe [3/3]: update version to 22 (diff) | |
download | linux-3661f00e2097676847deb01add1a0918044bd816.tar.xz linux-3661f00e2097676847deb01add1a0918044bd816.zip |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/aoe-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/aoe-2.6:
[PATCH] aoe [3/3]: update version to 22
[PATCH] aoe [2/3]: don't request ATA device ID on ATA error
[PATCH] aoe [1/3]: support multiple AoE listeners
[PATCH] aoe: do not stop retransmit timer when device goes down
[PATCH] aoe [8/8]: update driver version number
[PATCH] aoe [7/8]: update driver compatibility string
[PATCH] aoe [6/8]: update device information on last close
[PATCH] aoe [5/8]: allow network interface migration on packet retransmit
[PATCH] aoe [4/8]: use less confusing driver name
[PATCH] aoe [3/8]: increase allowed outstanding packets
[PATCH] aoe [2/8]: support dynamic resizing of AoE devices
[PATCH] aoe [1/8]: zero packet data after skb allocation
Diffstat (limited to 'drivers/block/aoe/aoechr.c')
-rw-r--r-- | drivers/block/aoe/aoechr.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c index 41ae0ede619a..5327f553b4f5 100644 --- a/drivers/block/aoe/aoechr.c +++ b/drivers/block/aoe/aoechr.c @@ -13,6 +13,7 @@ enum { MINOR_ERR = 2, MINOR_DISCOVER, MINOR_INTERFACES, + MINOR_REVALIDATE, MSGSZ = 2048, NARGS = 10, NMSG = 100, /* message backlog to retain */ @@ -41,6 +42,7 @@ static struct aoe_chardev chardevs[] = { { MINOR_ERR, "err" }, { MINOR_DISCOVER, "discover" }, { MINOR_INTERFACES, "interfaces" }, + { MINOR_REVALIDATE, "revalidate" }, }; static int @@ -62,6 +64,39 @@ interfaces(const char __user *str, size_t size) return 0; } +static int +revalidate(const char __user *str, size_t size) +{ + int major, minor, n; + ulong flags; + struct aoedev *d; + char buf[16]; + + if (size >= sizeof buf) + return -EINVAL; + buf[sizeof buf - 1] = '\0'; + if (copy_from_user(buf, str, size)) + return -EFAULT; + + /* should be e%d.%d format */ + n = sscanf(buf, "e%d.%d", &major, &minor); + if (n != 2) { + printk(KERN_ERR "aoe: %s: invalid device specification\n", + __FUNCTION__); + return -EINVAL; + } + d = aoedev_by_aoeaddr(major, minor); + if (!d) + return -EINVAL; + + spin_lock_irqsave(&d->lock, flags); + d->flags |= DEVFL_PAUSE; + spin_unlock_irqrestore(&d->lock, flags); + aoecmd_cfg(major, minor); + + return 0; +} + void aoechr_error(char *msg) { @@ -114,6 +149,8 @@ aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp case MINOR_INTERFACES: ret = interfaces(buf, cnt); break; + case MINOR_REVALIDATE: + ret = revalidate(buf, cnt); } if (ret == 0) ret = cnt; |