aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 4bd3ccf363bd..c0da5eedc245 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -110,7 +110,7 @@ static ctl_table raid_table[] = {
110 .procname = "speed_limit_min", 110 .procname = "speed_limit_min",
111 .data = &sysctl_speed_limit_min, 111 .data = &sysctl_speed_limit_min,
112 .maxlen = sizeof(int), 112 .maxlen = sizeof(int),
113 .mode = 0644, 113 .mode = S_IRUGO|S_IWUSR,
114 .proc_handler = &proc_dointvec, 114 .proc_handler = &proc_dointvec,
115 }, 115 },
116 { 116 {
@@ -118,7 +118,7 @@ static ctl_table raid_table[] = {
118 .procname = "speed_limit_max", 118 .procname = "speed_limit_max",
119 .data = &sysctl_speed_limit_max, 119 .data = &sysctl_speed_limit_max,
120 .maxlen = sizeof(int), 120 .maxlen = sizeof(int),
121 .mode = 0644, 121 .mode = S_IRUGO|S_IWUSR,
122 .proc_handler = &proc_dointvec, 122 .proc_handler = &proc_dointvec,
123 }, 123 },
124 { .ctl_name = 0 } 124 { .ctl_name = 0 }
@@ -129,7 +129,7 @@ static ctl_table raid_dir_table[] = {
129 .ctl_name = DEV_RAID, 129 .ctl_name = DEV_RAID,
130 .procname = "raid", 130 .procname = "raid",
131 .maxlen = 0, 131 .maxlen = 0,
132 .mode = 0555, 132 .mode = S_IRUGO|S_IXUGO,
133 .child = raid_table, 133 .child = raid_table,
134 }, 134 },
135 { .ctl_name = 0 } 135 { .ctl_name = 0 }
@@ -1783,8 +1783,8 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len)
1783 } 1783 }
1784 return err ? err : len; 1784 return err ? err : len;
1785} 1785}
1786static struct rdev_sysfs_entry 1786static struct rdev_sysfs_entry rdev_state =
1787rdev_state = __ATTR(state, 0644, state_show, state_store); 1787__ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store);
1788 1788
1789static ssize_t 1789static ssize_t
1790super_show(mdk_rdev_t *rdev, char *page) 1790super_show(mdk_rdev_t *rdev, char *page)
@@ -1815,7 +1815,7 @@ errors_store(mdk_rdev_t *rdev, const char *buf, size_t len)
1815 return -EINVAL; 1815 return -EINVAL;
1816} 1816}
1817static struct rdev_sysfs_entry rdev_errors = 1817static struct rdev_sysfs_entry rdev_errors =
1818__ATTR(errors, 0644, errors_show, errors_store); 1818__ATTR(errors, S_IRUGO|S_IWUSR, errors_show, errors_store);
1819 1819
1820static ssize_t 1820static ssize_t
1821slot_show(mdk_rdev_t *rdev, char *page) 1821slot_show(mdk_rdev_t *rdev, char *page)
@@ -1849,7 +1849,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len)
1849 1849
1850 1850
1851static struct rdev_sysfs_entry rdev_slot = 1851static struct rdev_sysfs_entry rdev_slot =
1852__ATTR(slot, 0644, slot_show, slot_store); 1852__ATTR(slot, S_IRUGO|S_IWUSR, slot_show, slot_store);
1853 1853
1854static ssize_t 1854static ssize_t
1855offset_show(mdk_rdev_t *rdev, char *page) 1855offset_show(mdk_rdev_t *rdev, char *page)
@@ -1871,7 +1871,7 @@ offset_store(mdk_rdev_t *rdev, const char *buf, size_t len)
1871} 1871}
1872 1872
1873static struct rdev_sysfs_entry rdev_offset = 1873static struct rdev_sysfs_entry rdev_offset =
1874__ATTR(offset, 0644, offset_show, offset_store); 1874__ATTR(offset, S_IRUGO|S_IWUSR, offset_show, offset_store);
1875 1875
1876static ssize_t 1876static ssize_t
1877rdev_size_show(mdk_rdev_t *rdev, char *page) 1877rdev_size_show(mdk_rdev_t *rdev, char *page)
@@ -1895,7 +1895,7 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len)
1895} 1895}
1896 1896
1897static struct rdev_sysfs_entry rdev_size = 1897static struct rdev_sysfs_entry rdev_size =
1898__ATTR(size, 0644, rdev_size_show, rdev_size_store); 1898__ATTR(size, S_IRUGO|S_IWUSR, rdev_size_show, rdev_size_store);
1899 1899
1900static struct attribute *rdev_default_attrs[] = { 1900static struct attribute *rdev_default_attrs[] = {
1901 &rdev_state.attr, 1901 &rdev_state.attr,
@@ -2132,7 +2132,7 @@ safe_delay_store(mddev_t *mddev, const char *cbuf, size_t len)
2132 return len; 2132 return len;
2133} 2133}
2134static struct md_sysfs_entry md_safe_delay = 2134static struct md_sysfs_entry md_safe_delay =
2135__ATTR(safe_mode_delay, 0644,safe_delay_show, safe_delay_store); 2135__ATTR(safe_mode_delay, S_IRUGO|S_IWUSR,safe_delay_show, safe_delay_store);
2136 2136
2137static ssize_t 2137static ssize_t
2138level_show(mddev_t *mddev, char *page) 2138level_show(mddev_t *mddev, char *page)
@@ -2167,7 +2167,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len)
2167} 2167}
2168 2168
2169static struct md_sysfs_entry md_level = 2169static struct md_sysfs_entry md_level =
2170__ATTR(level, 0644, level_show, level_store); 2170__ATTR(level, S_IRUGO|S_IWUSR, level_show, level_store);
2171 2171
2172 2172
2173static ssize_t 2173static ssize_t
@@ -2192,7 +2192,7 @@ layout_store(mddev_t *mddev, const char *buf, size_t len)
2192 return len; 2192 return len;
2193} 2193}
2194static struct md_sysfs_entry md_layout = 2194static struct md_sysfs_entry md_layout =
2195__ATTR(layout, 0655, layout_show, layout_store); 2195__ATTR(layout, S_IRUGO|S_IWUSR, layout_show, layout_store);
2196 2196
2197 2197
2198static ssize_t 2198static ssize_t
@@ -2223,7 +2223,7 @@ raid_disks_store(mddev_t *mddev, const char *buf, size_t len)
2223 return rv ? rv : len; 2223 return rv ? rv : len;
2224} 2224}
2225static struct md_sysfs_entry md_raid_disks = 2225static struct md_sysfs_entry md_raid_disks =
2226__ATTR(raid_disks, 0644, raid_disks_show, raid_disks_store); 2226__ATTR(raid_disks, S_IRUGO|S_IWUSR, raid_disks_show, raid_disks_store);
2227 2227
2228static ssize_t 2228static ssize_t
2229chunk_size_show(mddev_t *mddev, char *page) 2229chunk_size_show(mddev_t *mddev, char *page)
@@ -2247,7 +2247,7 @@ chunk_size_store(mddev_t *mddev, const char *buf, size_t len)
2247 return len; 2247 return len;
2248} 2248}
2249static struct md_sysfs_entry md_chunk_size = 2249static struct md_sysfs_entry md_chunk_size =
2250__ATTR(chunk_size, 0644, chunk_size_show, chunk_size_store); 2250__ATTR(chunk_size, S_IRUGO|S_IWUSR, chunk_size_show, chunk_size_store);
2251 2251
2252static ssize_t 2252static ssize_t
2253resync_start_show(mddev_t *mddev, char *page) 2253resync_start_show(mddev_t *mddev, char *page)
@@ -2271,7 +2271,7 @@ resync_start_store(mddev_t *mddev, const char *buf, size_t len)
2271 return len; 2271 return len;
2272} 2272}
2273static struct md_sysfs_entry md_resync_start = 2273static struct md_sysfs_entry md_resync_start =
2274__ATTR(resync_start, 0644, resync_start_show, resync_start_store); 2274__ATTR(resync_start, S_IRUGO|S_IWUSR, resync_start_show, resync_start_store);
2275 2275
2276/* 2276/*
2277 * The array state can be: 2277 * The array state can be:
@@ -2441,7 +2441,8 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len)
2441 else 2441 else
2442 return len; 2442 return len;
2443} 2443}
2444static struct md_sysfs_entry md_array_state = __ATTR(array_state, 0644, array_state_show, array_state_store); 2444static struct md_sysfs_entry md_array_state =
2445__ATTR(array_state, S_IRUGO|S_IWUSR, array_state_show, array_state_store);
2445 2446
2446static ssize_t 2447static ssize_t
2447null_show(mddev_t *mddev, char *page) 2448null_show(mddev_t *mddev, char *page)
@@ -2501,7 +2502,7 @@ new_dev_store(mddev_t *mddev, const char *buf, size_t len)
2501} 2502}
2502 2503
2503static struct md_sysfs_entry md_new_device = 2504static struct md_sysfs_entry md_new_device =
2504__ATTR(new_dev, 0200, null_show, new_dev_store); 2505__ATTR(new_dev, S_IWUSR, null_show, new_dev_store);
2505 2506
2506static ssize_t 2507static ssize_t
2507size_show(mddev_t *mddev, char *page) 2508size_show(mddev_t *mddev, char *page)
@@ -2539,7 +2540,7 @@ size_store(mddev_t *mddev, const char *buf, size_t len)
2539} 2540}
2540 2541
2541static struct md_sysfs_entry md_size = 2542static struct md_sysfs_entry md_size =
2542__ATTR(component_size, 0644, size_show, size_store); 2543__ATTR(component_size, S_IRUGO|S_IWUSR, size_show, size_store);
2543 2544
2544 2545
2545/* Metdata version. 2546/* Metdata version.
@@ -2587,7 +2588,7 @@ metadata_store(mddev_t *mddev, const char *buf, size_t len)
2587} 2588}
2588 2589
2589static struct md_sysfs_entry md_metadata = 2590static struct md_sysfs_entry md_metadata =
2590__ATTR(metadata_version, 0644, metadata_show, metadata_store); 2591__ATTR(metadata_version, S_IRUGO|S_IWUSR, metadata_show, metadata_store);
2591 2592
2592static ssize_t 2593static ssize_t
2593action_show(mddev_t *mddev, char *page) 2594action_show(mddev_t *mddev, char *page)
@@ -2655,12 +2656,11 @@ mismatch_cnt_show(mddev_t *mddev, char *page)
2655 (unsigned long long) mddev->resync_mismatches); 2656 (unsigned long long) mddev->resync_mismatches);
2656} 2657}
2657 2658
2658static struct md_sysfs_entry 2659static struct md_sysfs_entry md_scan_mode =
2659md_scan_mode = __ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store); 2660__ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store);
2660 2661
2661 2662
2662static struct md_sysfs_entry 2663static struct md_sysfs_entry md_mismatches = __ATTR_RO(mismatch_cnt);
2663md_mismatches = __ATTR_RO(mismatch_cnt);
2664 2664
2665static ssize_t 2665static ssize_t
2666sync_min_show(mddev_t *mddev, char *page) 2666sync_min_show(mddev_t *mddev, char *page)
@@ -2726,8 +2726,7 @@ sync_speed_show(mddev_t *mddev, char *page)
2726 return sprintf(page, "%ld\n", db/dt/2); /* K/sec */ 2726 return sprintf(page, "%ld\n", db/dt/2); /* K/sec */
2727} 2727}
2728 2728
2729static struct md_sysfs_entry 2729static struct md_sysfs_entry md_sync_speed = __ATTR_RO(sync_speed);
2730md_sync_speed = __ATTR_RO(sync_speed);
2731 2730
2732static ssize_t 2731static ssize_t
2733sync_completed_show(mddev_t *mddev, char *page) 2732sync_completed_show(mddev_t *mddev, char *page)
@@ -2743,8 +2742,7 @@ sync_completed_show(mddev_t *mddev, char *page)
2743 return sprintf(page, "%lu / %lu\n", resync, max_blocks); 2742 return sprintf(page, "%lu / %lu\n", resync, max_blocks);
2744} 2743}
2745 2744
2746static struct md_sysfs_entry 2745static struct md_sysfs_entry md_sync_completed = __ATTR_RO(sync_completed);
2747md_sync_completed = __ATTR_RO(sync_completed);
2748 2746
2749static ssize_t 2747static ssize_t
2750suspend_lo_show(mddev_t *mddev, char *page) 2748suspend_lo_show(mddev_t *mddev, char *page)
@@ -5651,8 +5649,8 @@ static int set_ro(const char *val, struct kernel_param *kp)
5651 return -EINVAL; 5649 return -EINVAL;
5652} 5650}
5653 5651
5654module_param_call(start_ro, set_ro, get_ro, NULL, 0600); 5652module_param_call(start_ro, set_ro, get_ro, NULL, S_IRUSR|S_IWUSR);
5655module_param(start_dirty_degraded, int, 0644); 5653module_param(start_dirty_degraded, int, S_IRUGO|S_IWUSR);
5656 5654
5657 5655
5658EXPORT_SYMBOL(register_md_personality); 5656EXPORT_SYMBOL(register_md_personality);