Skip to content

Commit 5657a81

Browse files
JoePerchesaxboe
authored andcommitted
block drivers/block: Use octal not symbolic permissions
Convert the S_<FOO> symbolic permissions to their octal equivalents as using octal and not symbolic permissions is preferred by many as more readable. see: https://lkml.org/lkml/2016/8/2/1945 Done with automated conversion via: $ ./scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace <files...> Miscellanea: o Wrapped modified multi-line calls to a single line where appropriate o Realign modified multi-line calls to open parenthesis Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent e6fc464 commit 5657a81

25 files changed

Lines changed: 154 additions & 163 deletions

‎block/blk-integrity.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,34 +333,34 @@ static ssize_t integrity_device_show(struct blk_integrity *bi, char *page)
333333
}
334334

335335
static struct integrity_sysfs_entry integrity_format_entry = {
336-
.attr = { .name = "format", .mode = S_IRUGO },
336+
.attr = { .name = "format", .mode = 0444 },
337337
.show = integrity_format_show,
338338
};
339339

340340
static struct integrity_sysfs_entry integrity_tag_size_entry = {
341-
.attr = { .name = "tag_size", .mode = S_IRUGO },
341+
.attr = { .name = "tag_size", .mode = 0444 },
342342
.show = integrity_tag_size_show,
343343
};
344344

345345
static struct integrity_sysfs_entry integrity_interval_entry = {
346-
.attr = { .name = "protection_interval_bytes", .mode = S_IRUGO },
346+
.attr = { .name = "protection_interval_bytes", .mode = 0444 },
347347
.show = integrity_interval_show,
348348
};
349349

350350
static struct integrity_sysfs_entry integrity_verify_entry = {
351-
.attr = { .name = "read_verify", .mode = S_IRUGO | S_IWUSR },
351+
.attr = { .name = "read_verify", .mode = 0644 },
352352
.show = integrity_verify_show,
353353
.store = integrity_verify_store,
354354
};
355355

356356
static struct integrity_sysfs_entry integrity_generate_entry = {
357-
.attr = { .name = "write_generate", .mode = S_IRUGO | S_IWUSR },
357+
.attr = { .name = "write_generate", .mode = 0644 },
358358
.show = integrity_generate_show,
359359
.store = integrity_generate_store,
360360
};
361361

362362
static struct integrity_sysfs_entry integrity_device_entry = {
363-
.attr = { .name = "device_is_integrity_capable", .mode = S_IRUGO },
363+
.attr = { .name = "device_is_integrity_capable", .mode = 0444 },
364364
.show = integrity_device_show,
365365
};
366366

‎block/blk-mq-sysfs.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ static struct attribute *default_ctx_attrs[] = {
166166
};
167167

168168
static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_tags = {
169-
.attr = {.name = "nr_tags", .mode = S_IRUGO },
169+
.attr = {.name = "nr_tags", .mode = 0444 },
170170
.show = blk_mq_hw_sysfs_nr_tags_show,
171171
};
172172
static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_reserved_tags = {
173-
.attr = {.name = "nr_reserved_tags", .mode = S_IRUGO },
173+
.attr = {.name = "nr_reserved_tags", .mode = 0444 },
174174
.show = blk_mq_hw_sysfs_nr_reserved_tags_show,
175175
};
176176
static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_cpus = {
177-
.attr = {.name = "cpu_list", .mode = S_IRUGO },
177+
.attr = {.name = "cpu_list", .mode = 0444 },
178178
.show = blk_mq_hw_sysfs_cpus_show,
179179
};
180180

‎block/blk-sysfs.c‎

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -502,187 +502,187 @@ static ssize_t queue_dax_show(struct request_queue *q, char *page)
502502
}
503503

504504
static struct queue_sysfs_entry queue_requests_entry = {
505-
.attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR },
505+
.attr = {.name = "nr_requests", .mode = 0644 },
506506
.show = queue_requests_show,
507507
.store = queue_requests_store,
508508
};
509509

510510
static struct queue_sysfs_entry queue_ra_entry = {
511-
.attr = {.name = "read_ahead_kb", .mode = S_IRUGO | S_IWUSR },
511+
.attr = {.name = "read_ahead_kb", .mode = 0644 },
512512
.show = queue_ra_show,
513513
.store = queue_ra_store,
514514
};
515515

516516
static struct queue_sysfs_entry queue_max_sectors_entry = {
517-
.attr = {.name = "max_sectors_kb", .mode = S_IRUGO | S_IWUSR },
517+
.attr = {.name = "max_sectors_kb", .mode = 0644 },
518518
.show = queue_max_sectors_show,
519519
.store = queue_max_sectors_store,
520520
};
521521

522522
static struct queue_sysfs_entry queue_max_hw_sectors_entry = {
523-
.attr = {.name = "max_hw_sectors_kb", .mode = S_IRUGO },
523+
.attr = {.name = "max_hw_sectors_kb", .mode = 0444 },
524524
.show = queue_max_hw_sectors_show,
525525
};
526526

527527
static struct queue_sysfs_entry queue_max_segments_entry = {
528-
.attr = {.name = "max_segments", .mode = S_IRUGO },
528+
.attr = {.name = "max_segments", .mode = 0444 },
529529
.show = queue_max_segments_show,
530530
};
531531

532532
static struct queue_sysfs_entry queue_max_discard_segments_entry = {
533-
.attr = {.name = "max_discard_segments", .mode = S_IRUGO },
533+
.attr = {.name = "max_discard_segments", .mode = 0444 },
534534
.show = queue_max_discard_segments_show,
535535
};
536536

537537
static struct queue_sysfs_entry queue_max_integrity_segments_entry = {
538-
.attr = {.name = "max_integrity_segments", .mode = S_IRUGO },
538+
.attr = {.name = "max_integrity_segments", .mode = 0444 },
539539
.show = queue_max_integrity_segments_show,
540540
};
541541

542542
static struct queue_sysfs_entry queue_max_segment_size_entry = {
543-
.attr = {.name = "max_segment_size", .mode = S_IRUGO },
543+
.attr = {.name = "max_segment_size", .mode = 0444 },
544544
.show = queue_max_segment_size_show,
545545
};
546546

547547
static struct queue_sysfs_entry queue_iosched_entry = {
548-
.attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR },
548+
.attr = {.name = "scheduler", .mode = 0644 },
549549
.show = elv_iosched_show,
550550
.store = elv_iosched_store,
551551
};
552552

553553
static struct queue_sysfs_entry queue_hw_sector_size_entry = {
554-
.attr = {.name = "hw_sector_size", .mode = S_IRUGO },
554+
.attr = {.name = "hw_sector_size", .mode = 0444 },
555555
.show = queue_logical_block_size_show,
556556
};
557557

558558
static struct queue_sysfs_entry queue_logical_block_size_entry = {
559-
.attr = {.name = "logical_block_size", .mode = S_IRUGO },
559+
.attr = {.name = "logical_block_size", .mode = 0444 },
560560
.show = queue_logical_block_size_show,
561561
};
562562

563563
static struct queue_sysfs_entry queue_physical_block_size_entry = {
564-
.attr = {.name = "physical_block_size", .mode = S_IRUGO },
564+
.attr = {.name = "physical_block_size", .mode = 0444 },
565565
.show = queue_physical_block_size_show,
566566
};
567567

568568
static struct queue_sysfs_entry queue_chunk_sectors_entry = {
569-
.attr = {.name = "chunk_sectors", .mode = S_IRUGO },
569+
.attr = {.name = "chunk_sectors", .mode = 0444 },
570570
.show = queue_chunk_sectors_show,
571571
};
572572

573573
static struct queue_sysfs_entry queue_io_min_entry = {
574-
.attr = {.name = "minimum_io_size", .mode = S_IRUGO },
574+
.attr = {.name = "minimum_io_size", .mode = 0444 },
575575
.show = queue_io_min_show,
576576
};
577577

578578
static struct queue_sysfs_entry queue_io_opt_entry = {
579-
.attr = {.name = "optimal_io_size", .mode = S_IRUGO },
579+
.attr = {.name = "optimal_io_size", .mode = 0444 },
580580
.show = queue_io_opt_show,
581581
};
582582

583583
static struct queue_sysfs_entry queue_discard_granularity_entry = {
584-
.attr = {.name = "discard_granularity", .mode = S_IRUGO },
584+
.attr = {.name = "discard_granularity", .mode = 0444 },
585585
.show = queue_discard_granularity_show,
586586
};
587587

588588
static struct queue_sysfs_entry queue_discard_max_hw_entry = {
589-
.attr = {.name = "discard_max_hw_bytes", .mode = S_IRUGO },
589+
.attr = {.name = "discard_max_hw_bytes", .mode = 0444 },
590590
.show = queue_discard_max_hw_show,
591591
};
592592

593593
static struct queue_sysfs_entry queue_discard_max_entry = {
594-
.attr = {.name = "discard_max_bytes", .mode = S_IRUGO | S_IWUSR },
594+
.attr = {.name = "discard_max_bytes", .mode = 0644 },
595595
.show = queue_discard_max_show,
596596
.store = queue_discard_max_store,
597597
};
598598

599599
static struct queue_sysfs_entry queue_discard_zeroes_data_entry = {
600-
.attr = {.name = "discard_zeroes_data", .mode = S_IRUGO },
600+
.attr = {.name = "discard_zeroes_data", .mode = 0444 },
601601
.show = queue_discard_zeroes_data_show,
602602
};
603603

604604
static struct queue_sysfs_entry queue_write_same_max_entry = {
605-
.attr = {.name = "write_same_max_bytes", .mode = S_IRUGO },
605+
.attr = {.name = "write_same_max_bytes", .mode = 0444 },
606606
.show = queue_write_same_max_show,
607607
};
608608

609609
static struct queue_sysfs_entry queue_write_zeroes_max_entry = {
610-
.attr = {.name = "write_zeroes_max_bytes", .mode = S_IRUGO },
610+
.attr = {.name = "write_zeroes_max_bytes", .mode = 0444 },
611611
.show = queue_write_zeroes_max_show,
612612
};
613613

614614
static struct queue_sysfs_entry queue_nonrot_entry = {
615-
.attr = {.name = "rotational", .mode = S_IRUGO | S_IWUSR },
615+
.attr = {.name = "rotational", .mode = 0644 },
616616
.show = queue_show_nonrot,
617617
.store = queue_store_nonrot,
618618
};
619619

620620
static struct queue_sysfs_entry queue_zoned_entry = {
621-
.attr = {.name = "zoned", .mode = S_IRUGO },
621+
.attr = {.name = "zoned", .mode = 0444 },
622622
.show = queue_zoned_show,
623623
};
624624

625625
static struct queue_sysfs_entry queue_nomerges_entry = {
626-
.attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR },
626+
.attr = {.name = "nomerges", .mode = 0644 },
627627
.show = queue_nomerges_show,
628628
.store = queue_nomerges_store,
629629
};
630630

631631
static struct queue_sysfs_entry queue_rq_affinity_entry = {
632-
.attr = {.name = "rq_affinity", .mode = S_IRUGO | S_IWUSR },
632+
.attr = {.name = "rq_affinity", .mode = 0644 },
633633
.show = queue_rq_affinity_show,
634634
.store = queue_rq_affinity_store,
635635
};
636636

637637
static struct queue_sysfs_entry queue_iostats_entry = {
638-
.attr = {.name = "iostats", .mode = S_IRUGO | S_IWUSR },
638+
.attr = {.name = "iostats", .mode = 0644 },
639639
.show = queue_show_iostats,
640640
.store = queue_store_iostats,
641641
};
642642

643643
static struct queue_sysfs_entry queue_random_entry = {
644-
.attr = {.name = "add_random", .mode = S_IRUGO | S_IWUSR },
644+
.attr = {.name = "add_random", .mode = 0644 },
645645
.show = queue_show_random,
646646
.store = queue_store_random,
647647
};
648648

649649
static struct queue_sysfs_entry queue_poll_entry = {
650-
.attr = {.name = "io_poll", .mode = S_IRUGO | S_IWUSR },
650+
.attr = {.name = "io_poll", .mode = 0644 },
651651
.show = queue_poll_show,
652652
.store = queue_poll_store,
653653
};
654654

655655
static struct queue_sysfs_entry queue_poll_delay_entry = {
656-
.attr = {.name = "io_poll_delay", .mode = S_IRUGO | S_IWUSR },
656+
.attr = {.name = "io_poll_delay", .mode = 0644 },
657657
.show = queue_poll_delay_show,
658658
.store = queue_poll_delay_store,
659659
};
660660

661661
static struct queue_sysfs_entry queue_wc_entry = {
662-
.attr = {.name = "write_cache", .mode = S_IRUGO | S_IWUSR },
662+
.attr = {.name = "write_cache", .mode = 0644 },
663663
.show = queue_wc_show,
664664
.store = queue_wc_store,
665665
};
666666

667667
static struct queue_sysfs_entry queue_fua_entry = {
668-
.attr = {.name = "fua", .mode = S_IRUGO },
668+
.attr = {.name = "fua", .mode = 0444 },
669669
.show = queue_fua_show,
670670
};
671671

672672
static struct queue_sysfs_entry queue_dax_entry = {
673-
.attr = {.name = "dax", .mode = S_IRUGO },
673+
.attr = {.name = "dax", .mode = 0444 },
674674
.show = queue_dax_show,
675675
};
676676

677677
static struct queue_sysfs_entry queue_wb_lat_entry = {
678-
.attr = {.name = "wbt_lat_usec", .mode = S_IRUGO | S_IWUSR },
678+
.attr = {.name = "wbt_lat_usec", .mode = 0644 },
679679
.show = queue_wb_lat_show,
680680
.store = queue_wb_lat_store,
681681
};
682682

683683
#ifdef CONFIG_BLK_DEV_THROTTLING_LOW
684684
static struct queue_sysfs_entry throtl_sample_time_entry = {
685-
.attr = {.name = "throttle_sample_time", .mode = S_IRUGO | S_IWUSR },
685+
.attr = {.name = "throttle_sample_time", .mode = 0644 },
686686
.show = blk_throtl_sample_time_show,
687687
.store = blk_throtl_sample_time_store,
688688
};

‎block/cfq-iosched.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4786,7 +4786,7 @@ USEC_STORE_FUNCTION(cfq_target_latency_us_store, &cfqd->cfq_target_latency, 1, U
47864786
#undef USEC_STORE_FUNCTION
47874787

47884788
#define CFQ_ATTR(name) \
4789-
__ATTR(name, S_IRUGO|S_IWUSR, cfq_##name##_show, cfq_##name##_store)
4789+
__ATTR(name, 0644, cfq_##name##_show, cfq_##name##_store)
47904790

47914791
static struct elv_fs_entry cfq_attrs[] = {
47924792
CFQ_ATTR(quantum),

‎block/deadline-iosched.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,7 @@ STORE_FUNCTION(deadline_fifo_batch_store, &dd->fifo_batch, 0, INT_MAX, 0);
512512
#undef STORE_FUNCTION
513513

514514
#define DD_ATTR(name) \
515-
__ATTR(name, S_IRUGO|S_IWUSR, deadline_##name##_show, \
516-
deadline_##name##_store)
515+
__ATTR(name, 0644, deadline_##name##_show, deadline_##name##_store)
517516

518517
static struct elv_fs_entry deadline_attrs[] = {
519518
DD_ATTR(read_expire),

‎block/genhd.c‎

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,28 +1139,25 @@ static ssize_t disk_discard_alignment_show(struct device *dev,
11391139
return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue));
11401140
}
11411141

1142-
static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL);
1143-
static DEVICE_ATTR(ext_range, S_IRUGO, disk_ext_range_show, NULL);
1144-
static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL);
1145-
static DEVICE_ATTR(hidden, S_IRUGO, disk_hidden_show, NULL);
1146-
static DEVICE_ATTR(ro, S_IRUGO, disk_ro_show, NULL);
1147-
static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL);
1148-
static DEVICE_ATTR(alignment_offset, S_IRUGO, disk_alignment_offset_show, NULL);
1149-
static DEVICE_ATTR(discard_alignment, S_IRUGO, disk_discard_alignment_show,
1150-
NULL);
1151-
static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL);
1152-
static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL);
1153-
static DEVICE_ATTR(inflight, S_IRUGO, part_inflight_show, NULL);
1154-
static DEVICE_ATTR(badblocks, S_IRUGO | S_IWUSR, disk_badblocks_show,
1155-
disk_badblocks_store);
1142+
static DEVICE_ATTR(range, 0444, disk_range_show, NULL);
1143+
static DEVICE_ATTR(ext_range, 0444, disk_ext_range_show, NULL);
1144+
static DEVICE_ATTR(removable, 0444, disk_removable_show, NULL);
1145+
static DEVICE_ATTR(hidden, 0444, disk_hidden_show, NULL);
1146+
static DEVICE_ATTR(ro, 0444, disk_ro_show, NULL);
1147+
static DEVICE_ATTR(size, 0444, part_size_show, NULL);
1148+
static DEVICE_ATTR(alignment_offset, 0444, disk_alignment_offset_show, NULL);
1149+
static DEVICE_ATTR(discard_alignment, 0444, disk_discard_alignment_show, NULL);
1150+
static DEVICE_ATTR(capability, 0444, disk_capability_show, NULL);
1151+
static DEVICE_ATTR(stat, 0444, part_stat_show, NULL);
1152+
static DEVICE_ATTR(inflight, 0444, part_inflight_show, NULL);
1153+
static DEVICE_ATTR(badblocks, 0644, disk_badblocks_show, disk_badblocks_store);
11561154
#ifdef CONFIG_FAIL_MAKE_REQUEST
11571155
static struct device_attribute dev_attr_fail =
1158-
__ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store);
1156+
__ATTR(make-it-fail, 0644, part_fail_show, part_fail_store);
11591157
#endif
11601158
#ifdef CONFIG_FAIL_IO_TIMEOUT
11611159
static struct device_attribute dev_attr_fail_timeout =
1162-
__ATTR(io-timeout-fail, S_IRUGO|S_IWUSR, part_timeout_show,
1163-
part_timeout_store);
1160+
__ATTR(io-timeout-fail, 0644, part_timeout_show, part_timeout_store);
11641161
#endif
11651162

11661163
static struct attribute *disk_attrs[] = {
@@ -1924,9 +1921,9 @@ static ssize_t disk_events_poll_msecs_store(struct device *dev,
19241921
return count;
19251922
}
19261923

1927-
static const DEVICE_ATTR(events, S_IRUGO, disk_events_show, NULL);
1928-
static const DEVICE_ATTR(events_async, S_IRUGO, disk_events_async_show, NULL);
1929-
static const DEVICE_ATTR(events_poll_msecs, S_IRUGO|S_IWUSR,
1924+
static const DEVICE_ATTR(events, 0444, disk_events_show, NULL);
1925+
static const DEVICE_ATTR(events_async, 0444, disk_events_async_show, NULL);
1926+
static const DEVICE_ATTR(events_poll_msecs, 0644,
19301927
disk_events_poll_msecs_show,
19311928
disk_events_poll_msecs_store);
19321929

‎block/mq-deadline.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,7 @@ STORE_FUNCTION(deadline_fifo_batch_store, &dd->fifo_batch, 0, INT_MAX, 0);
630630
#undef STORE_FUNCTION
631631

632632
#define DD_ATTR(name) \
633-
__ATTR(name, S_IRUGO|S_IWUSR, deadline_##name##_show, \
634-
deadline_##name##_store)
633+
__ATTR(name, 0644, deadline_##name##_show, deadline_##name##_store)
635634

636635
static struct elv_fs_entry deadline_attrs[] = {
637636
DD_ATTR(read_expire),

0 commit comments

Comments
 (0)