]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/block/nbd.c
Driver core: convert block from raw kobjects to core devices
[linux-2.6-omap-h63xx.git] / drivers / block / nbd.c
index 6332acad078c5f6976854b0f394e3496dc1f4e81..ba9b17e507e000efb3f37c644373f43812eabd2e 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <net/sock.h>
+#include <linux/net.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -126,7 +127,7 @@ static void sock_shutdown(struct nbd_device *lo, int lock)
        if (lo->sock) {
                printk(KERN_WARNING "%s: shutting down socket\n",
                        lo->disk->disk_name);
-               lo->sock->ops->shutdown(lo->sock, SEND_SHUTDOWN|RCV_SHUTDOWN);
+               kernel_sock_shutdown(lo->sock, SHUT_RDWR);
                lo->sock = NULL;
        }
        if (lock)
@@ -374,14 +375,17 @@ harderror:
        return NULL;
 }
 
-static ssize_t pid_show(struct gendisk *disk, char *page)
+static ssize_t pid_show(struct device *dev,
+                       struct device_attribute *attr, char *buf)
 {
-       return sprintf(page, "%ld\n",
+       struct gendisk *disk = dev_to_disk(dev);
+
+       return sprintf(buf, "%ld\n",
                (long) ((struct nbd_device *)disk->private_data)->pid);
 }
 
-static struct disk_attribute pid_attr = {
-       .attr = { .name = "pid", .mode = S_IRUGO },
+static struct device_attribute pid_attr = {
+       .attr = { .name = "pid", .mode = S_IRUGO, .owner = THIS_MODULE },
        .show = pid_show,
 };
 
@@ -393,7 +397,7 @@ static int nbd_do_it(struct nbd_device *lo)
        BUG_ON(lo->magic != LO_MAGIC);
 
        lo->pid = current->pid;
-       ret = sysfs_create_file(&lo->disk->kobj, &pid_attr.attr);
+       ret = sysfs_create_file(&lo->disk->dev.kobj, &pid_attr.attr);
        if (ret) {
                printk(KERN_ERR "nbd: sysfs_create_file failed!");
                return ret;
@@ -402,7 +406,7 @@ static int nbd_do_it(struct nbd_device *lo)
        while ((req = nbd_read_stat(lo)) != NULL)
                nbd_end_request(req);
 
-       sysfs_remove_file(&lo->disk->kobj, &pid_attr.attr);
+       sysfs_remove_file(&lo->disk->dev.kobj, &pid_attr.attr);
        return 0;
 }