Subject: adjust xen build after addition of pv-ops' blktap2 From: jbeulich@novell.com Patch-mainline: n/a --- head-2011-02-17.orig/drivers/xen/Makefile 2011-01-31 15:14:12.000000000 +0100 +++ head-2011-02-17/drivers/xen/Makefile 2011-02-24 13:56:24.000000000 +0100 @@ -8,7 +8,7 @@ obj-y += util.o obj-$(CONFIG_XEN_BALLOON) += balloon/ obj-$(CONFIG_XEN_BLKDEV_BACKEND) += blkback/ obj-$(CONFIG_XEN_BLKDEV_TAP) += blktap/ -obj-$(CONFIG_XEN_BLKDEV_TAP2) += blktap2/ +obj-$(CONFIG_XEN_BLKDEV_TAP2) += blktap2/ blktap2-new/ obj-$(CONFIG_XEN_NETDEV_BACKEND) += netback/ obj-$(CONFIG_XEN_TPMDEV_BACKEND) += tpmback/ obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += blkfront/ --- head-2011-02-17.orig/drivers/xen/blktap2-new/Makefile 2011-02-24 13:49:49.000000000 +0100 +++ head-2011-02-17/drivers/xen/blktap2-new/Makefile 2011-02-24 13:59:48.000000000 +0100 @@ -1,3 +1,4 @@ -obj-$(CONFIG_XEN_BLKDEV_TAP) := blktap.o +obj-$(CONFIG_XEN_BLKDEV_TAP2) := blktap2-new.o -blktap-objs := control.o ring.o device.o request.o sysfs.o +blktap2-new-y := control.o ring.o device.o request.o +blktap2-new-$(CONFIG_SYSFS) += sysfs.o --- head-2011-02-17.orig/drivers/xen/blktap2-new/blktap.h 2011-02-24 13:49:49.000000000 +0100 +++ head-2011-02-17/drivers/xen/blktap2-new/blktap.h 2011-02-24 14:08:40.000000000 +0100 @@ -24,6 +24,8 @@ extern int blktap_device_major; #define BTWARN(_f, _a...) BTPRINTK(0, KERN_WARNING, 0, _f, ##_a) #define BTERR(_f, _a...) BTPRINTK(0, KERN_ERR, 0, _f, ##_a) +#define BLKTAP2_DEV_DIR "xen/blktap-2/" + #define MAX_BLKTAP_DEVICE 1024 #define BLKTAP_DEVICE 4 @@ -181,10 +183,17 @@ void blktap_ring_unmap_request(struct bl void blktap_ring_set_message(struct blktap *, int); void blktap_ring_kick_user(struct blktap *); +#ifdef CONFIG_SYSFS int blktap_sysfs_init(void); void blktap_sysfs_exit(void); int blktap_sysfs_create(struct blktap *); void blktap_sysfs_destroy(struct blktap *); +#else +static inline int blktap_sysfs_init(void) { return 0; } +static inline void blktap_sysfs_exit(void) {} +static inline int blktap_sysfs_create(struct blktap *tapdev) { return 0; } +static inline void blktap_sysfs_destroy(struct blktap *tapdev) {} +#endif int blktap_device_init(void); void blktap_device_exit(void); --- head-2011-02-17.orig/drivers/xen/blktap2-new/control.c 2011-02-24 13:49:49.000000000 +0100 +++ head-2011-02-17/drivers/xen/blktap2-new/control.c 2011-02-24 15:14:41.000000000 +0100 @@ -164,7 +164,7 @@ blktap_control_ioctl(struct inode *inode return -ENOIOCTLCMD; } -static struct file_operations blktap_control_file_operations = { +static const struct file_operations blktap_control_file_operations = { .owner = THIS_MODULE, .ioctl = blktap_control_ioctl, }; @@ -172,6 +172,7 @@ static struct file_operations blktap_con static struct miscdevice blktap_control = { .minor = MISC_DYNAMIC_MINOR, .name = "blktap-control", + .nodename = BLKTAP2_DEV_DIR "control", .fops = &blktap_control_file_operations, }; --- head-2011-02-17.orig/drivers/xen/blktap2-new/device.c 2011-02-24 13:49:49.000000000 +0100 +++ head-2011-02-17/drivers/xen/blktap2-new/device.c 2011-02-24 14:51:43.000000000 +0100 @@ -95,7 +95,7 @@ blktap_device_ioctl(struct block_device return 0; } -static struct block_device_operations blktap_device_file_operations = { +static const struct block_device_operations blktap_device_file_operations = { .owner = THIS_MODULE, .open = blktap_device_open, .release = blktap_device_release, @@ -424,6 +424,12 @@ blktap_device_destroy_sync(struct blktap !blktap_device_try_destroy(tap)); } +static char *blktap_devnode(struct gendisk *gd, mode_t *mode) +{ + return kasprintf(GFP_KERNEL, BLKTAP2_DEV_DIR "tapdev%u", + gd->first_minor); +} + int blktap_device_create(struct blktap *tap, struct blktap_params *params) { @@ -464,6 +470,7 @@ blktap_device_create(struct blktap *tap, gd->major = blktap_device_major; gd->first_minor = minor; + gd->devnode = blktap_devnode; gd->fops = &blktap_device_file_operations; gd->private_data = tapdev; --- head-2011-02-17.orig/drivers/xen/blktap2-new/ring.c 2011-02-24 13:49:49.000000000 +0100 +++ head-2011-02-17/drivers/xen/blktap2-new/ring.c 2011-02-24 15:14:47.000000000 +0100 @@ -435,7 +435,7 @@ static unsigned int blktap_ring_poll(str return 0; } -static struct file_operations blktap_ring_file_operations = { +static const struct file_operations blktap_ring_file_operations = { .owner = THIS_MODULE, .open = blktap_ring_open, .release = blktap_ring_release, --- head-2011-02-17.orig/drivers/xen/blktap2-new/sysfs.c 2011-02-24 13:49:49.000000000 +0100 +++ head-2011-02-17/drivers/xen/blktap2-new/sysfs.c 2011-02-24 14:40:36.000000000 +0100 @@ -160,8 +160,8 @@ blktap_sysfs_store_pool(struct device *d return size; } -DEVICE_ATTR(pool, S_IRUSR|S_IWUSR, - blktap_sysfs_show_pool, blktap_sysfs_store_pool); +static DEVICE_ATTR(pool, S_IRUSR|S_IWUSR, + blktap_sysfs_show_pool, blktap_sysfs_store_pool); int blktap_sysfs_create(struct blktap *tap) @@ -259,6 +259,12 @@ blktap_sysfs_show_devices(struct class * } static CLASS_ATTR(devices, S_IRUGO, blktap_sysfs_show_devices, NULL); +static char *blktap_devnode(struct device *dev, mode_t *mode) +{ + return kasprintf(GFP_KERNEL, BLKTAP2_DEV_DIR "blktap%u", + MINOR(dev->devt)); +} + void blktap_sysfs_exit(void) { @@ -275,6 +281,8 @@ blktap_sysfs_init(void) cls = class_create(THIS_MODULE, "blktap2"); if (IS_ERR(cls)) err = PTR_ERR(cls); + else + cls->devnode = blktap_devnode; if (!err) err = class_create_file(cls, &class_attr_verbosity); if (!err)