loop.c (754451342fc5954061ede74b0a8485ec4a4c6eaa) | loop.c (5657a819a8d94426c76be04dcedfad0f64cfff00) |
---|---|
1/* 2 * linux/drivers/block/loop.c 3 * 4 * Written by Theodore Ts'o, 3/29/93 5 * 6 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is 7 * permitted under the GNU General Public License. 8 * --- 718 unchanged lines hidden (view full) --- 727#define LOOP_ATTR_RO(_name) \ 728static ssize_t loop_attr_##_name##_show(struct loop_device *, char *); \ 729static ssize_t loop_attr_do_show_##_name(struct device *d, \ 730 struct device_attribute *attr, char *b) \ 731{ \ 732 return loop_attr_show(d, b, loop_attr_##_name##_show); \ 733} \ 734static struct device_attribute loop_attr_##_name = \ | 1/* 2 * linux/drivers/block/loop.c 3 * 4 * Written by Theodore Ts'o, 3/29/93 5 * 6 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is 7 * permitted under the GNU General Public License. 8 * --- 718 unchanged lines hidden (view full) --- 727#define LOOP_ATTR_RO(_name) \ 728static ssize_t loop_attr_##_name##_show(struct loop_device *, char *); \ 729static ssize_t loop_attr_do_show_##_name(struct device *d, \ 730 struct device_attribute *attr, char *b) \ 731{ \ 732 return loop_attr_show(d, b, loop_attr_##_name##_show); \ 733} \ 734static struct device_attribute loop_attr_##_name = \ |
735 __ATTR(_name, S_IRUGO, loop_attr_do_show_##_name, NULL); | 735 __ATTR(_name, 0444, loop_attr_do_show_##_name, NULL); |
736 737static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf) 738{ 739 ssize_t ret; 740 char *p = NULL; 741 742 spin_lock_irq(&lo->lo_lock); 743 if (lo->lo_backing_file) --- 60 unchanged lines hidden (view full) --- 804 NULL, 805}; 806 807static struct attribute_group loop_attribute_group = { 808 .name = "loop", 809 .attrs= loop_attrs, 810}; 811 | 736 737static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf) 738{ 739 ssize_t ret; 740 char *p = NULL; 741 742 spin_lock_irq(&lo->lo_lock); 743 if (lo->lo_backing_file) --- 60 unchanged lines hidden (view full) --- 804 NULL, 805}; 806 807static struct attribute_group loop_attribute_group = { 808 .name = "loop", 809 .attrs= loop_attrs, 810}; 811 |
812static int loop_sysfs_init(struct loop_device *lo) | 812static void loop_sysfs_init(struct loop_device *lo) |
813{ | 813{ |
814 return sysfs_create_group(&disk_to_dev(lo->lo_disk)->kobj, 815 &loop_attribute_group); | 814 lo->sysfs_inited = !sysfs_create_group(&disk_to_dev(lo->lo_disk)->kobj, 815 &loop_attribute_group); |
816} 817 818static void loop_sysfs_exit(struct loop_device *lo) 819{ | 816} 817 818static void loop_sysfs_exit(struct loop_device *lo) 819{ |
820 sysfs_remove_group(&disk_to_dev(lo->lo_disk)->kobj, 821 &loop_attribute_group); | 820 if (lo->sysfs_inited) 821 sysfs_remove_group(&disk_to_dev(lo->lo_disk)->kobj, 822 &loop_attribute_group); |
822} 823 824static void loop_config_discard(struct loop_device *lo) 825{ 826 struct file *file = lo->lo_backing_file; 827 struct inode *inode = file->f_mapping->host; 828 struct request_queue *q = lo->lo_queue; 829 --- 841 unchanged lines hidden (view full) --- 1671 .compat_ioctl = lo_compat_ioctl, 1672#endif 1673}; 1674 1675/* 1676 * And now the modules code and kernel interface. 1677 */ 1678static int max_loop; | 823} 824 825static void loop_config_discard(struct loop_device *lo) 826{ 827 struct file *file = lo->lo_backing_file; 828 struct inode *inode = file->f_mapping->host; 829 struct request_queue *q = lo->lo_queue; 830 --- 841 unchanged lines hidden (view full) --- 1672 .compat_ioctl = lo_compat_ioctl, 1673#endif 1674}; 1675 1676/* 1677 * And now the modules code and kernel interface. 1678 */ 1679static int max_loop; |
1679module_param(max_loop, int, S_IRUGO); | 1680module_param(max_loop, int, 0444); |
1680MODULE_PARM_DESC(max_loop, "Maximum number of loop devices"); | 1681MODULE_PARM_DESC(max_loop, "Maximum number of loop devices"); |
1681module_param(max_part, int, S_IRUGO); | 1682module_param(max_part, int, 0444); |
1682MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device"); 1683MODULE_LICENSE("GPL"); 1684MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR); 1685 1686int loop_register_transfer(struct loop_func_table *funcs) 1687{ 1688 unsigned int n = funcs->number; 1689 --- 465 unchanged lines hidden --- | 1683MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device"); 1684MODULE_LICENSE("GPL"); 1685MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR); 1686 1687int loop_register_transfer(struct loop_func_table *funcs) 1688{ 1689 unsigned int n = funcs->number; 1690 --- 465 unchanged lines hidden --- |