summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2018-05-24 15:38:59 -0400
committerJens Axboe <axboe@kernel.dk>2018-05-24 15:38:59 -0400
commit5657a819a8d94426c76be04dcedfad0f64cfff00 (patch)
tree62834703d02999728dd5c0c0c3842ffe525d6182
parente6fc46498784e799d3eb95d83079180e413c4e7d (diff)
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>
-rw-r--r--block/blk-integrity.c12
-rw-r--r--block/blk-mq-sysfs.c6
-rw-r--r--block/blk-sysfs.c68
-rw-r--r--block/cfq-iosched.c2
-rw-r--r--block/deadline-iosched.c3
-rw-r--r--block/genhd.c37
-rw-r--r--block/mq-deadline.c3
-rw-r--r--block/partition-generic.c22
-rw-r--r--drivers/block/DAC960.c2
-rw-r--r--drivers/block/aoe/aoeblk.c10
-rw-r--r--drivers/block/brd.c6
-rw-r--r--drivers/block/drbd/drbd_debugfs.c20
-rw-r--r--drivers/block/drbd/drbd_main.c2
-rw-r--r--drivers/block/floppy.c2
-rw-r--r--drivers/block/loop.c6
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c11
-rw-r--r--drivers/block/nbd.c2
-rw-r--r--drivers/block/null_blk.c30
-rw-r--r--drivers/block/pktcdvd.c4
-rw-r--r--drivers/block/rbd.c44
-rw-r--r--drivers/block/rsxx/core.c6
-rw-r--r--drivers/block/virtio_blk.c6
-rw-r--r--drivers/block/xen-blkback/blkback.c2
-rw-r--r--drivers/block/xen-blkback/xenbus.c4
-rw-r--r--drivers/block/xen-blkfront.c7
25 files changed, 154 insertions, 163 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index feb30570eaf5..6121611e1316 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -333,34 +333,34 @@ static ssize_t integrity_device_show(struct blk_integrity *bi, char *page)
333} 333}
334 334
335static struct integrity_sysfs_entry integrity_format_entry = { 335static struct integrity_sysfs_entry integrity_format_entry = {
336 .attr = { .name = "format", .mode = S_IRUGO }, 336 .attr = { .name = "format", .mode = 0444 },
337 .show = integrity_format_show, 337 .show = integrity_format_show,
338}; 338};
339 339
340static struct integrity_sysfs_entry integrity_tag_size_entry = { 340static struct integrity_sysfs_entry integrity_tag_size_entry = {
341 .attr = { .name = "tag_size", .mode = S_IRUGO }, 341 .attr = { .name = "tag_size", .mode = 0444 },
342 .show = integrity_tag_size_show, 342 .show = integrity_tag_size_show,
343}; 343};
344 344
345static struct integrity_sysfs_entry integrity_interval_entry = { 345static struct integrity_sysfs_entry integrity_interval_entry = {
346 .attr = { .name = "protection_interval_bytes", .mode = S_IRUGO }, 346 .attr = { .name = "protection_interval_bytes", .mode = 0444 },
347 .show = integrity_interval_show, 347 .show = integrity_interval_show,
348}; 348};
349 349
350static struct integrity_sysfs_entry integrity_verify_entry = { 350static struct integrity_sysfs_entry integrity_verify_entry = {
351 .attr = { .name = "read_verify", .mode = S_IRUGO | S_IWUSR }, 351 .attr = { .name = "read_verify", .mode = 0644 },
352 .show = integrity_verify_show, 352 .show = integrity_verify_show,
353 .store = integrity_verify_store, 353 .store = integrity_verify_store,
354}; 354};
355 355
356static struct integrity_sysfs_entry integrity_generate_entry = { 356static struct integrity_sysfs_entry integrity_generate_entry = {
357 .attr = { .name = "write_generate", .mode = S_IRUGO | S_IWUSR }, 357 .attr = { .name = "write_generate", .mode = 0644 },
358 .show = integrity_generate_show, 358 .show = integrity_generate_show,
359 .store = integrity_generate_store, 359 .store = integrity_generate_store,
360}; 360};
361 361
362static struct integrity_sysfs_entry integrity_device_entry = { 362static 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 },
364 .show = integrity_device_show, 364 .show = integrity_device_show,
365}; 365};
366 366
diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index a54b4b070f1c..aafb44224c89 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -166,15 +166,15 @@ static struct attribute *default_ctx_attrs[] = {
166}; 166};
167 167
168static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_tags = { 168static 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 },
170 .show = blk_mq_hw_sysfs_nr_tags_show, 170 .show = blk_mq_hw_sysfs_nr_tags_show,
171}; 171};
172static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_reserved_tags = { 172static 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 },
174 .show = blk_mq_hw_sysfs_nr_reserved_tags_show, 174 .show = blk_mq_hw_sysfs_nr_reserved_tags_show,
175}; 175};
176static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_cpus = { 176static 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 },
178 .show = blk_mq_hw_sysfs_cpus_show, 178 .show = blk_mq_hw_sysfs_cpus_show,
179}; 179};
180 180
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index cae525b7aae6..31347e31daa3 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -502,187 +502,187 @@ static ssize_t queue_dax_show(struct request_queue *q, char *page)
502} 502}
503 503
504static struct queue_sysfs_entry queue_requests_entry = { 504static struct queue_sysfs_entry queue_requests_entry = {
505 .attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR }, 505 .attr = {.name = "nr_requests", .mode = 0644 },
506 .show = queue_requests_show, 506 .show = queue_requests_show,
507 .store = queue_requests_store, 507 .store = queue_requests_store,
508}; 508};
509 509
510static struct queue_sysfs_entry queue_ra_entry = { 510static 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 },
512 .show = queue_ra_show, 512 .show = queue_ra_show,
513 .store = queue_ra_store, 513 .store = queue_ra_store,
514}; 514};
515 515
516static struct queue_sysfs_entry queue_max_sectors_entry = { 516static 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 },
518 .show = queue_max_sectors_show, 518 .show = queue_max_sectors_show,
519 .store = queue_max_sectors_store, 519 .store = queue_max_sectors_store,
520}; 520};
521 521
522static struct queue_sysfs_entry queue_max_hw_sectors_entry = { 522static 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 },
524 .show = queue_max_hw_sectors_show, 524 .show = queue_max_hw_sectors_show,
525}; 525};
526 526
527static struct queue_sysfs_entry queue_max_segments_entry = { 527static struct queue_sysfs_entry queue_max_segments_entry = {
528 .attr = {.name = "max_segments", .mode = S_IRUGO }, 528 .attr = {.name = "max_segments", .mode = 0444 },
529 .show = queue_max_segments_show, 529 .show = queue_max_segments_show,
530}; 530};
531 531
532static struct queue_sysfs_entry queue_max_discard_segments_entry = { 532static 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 },
534 .show = queue_max_discard_segments_show, 534 .show = queue_max_discard_segments_show,
535}; 535};
536 536
537static struct queue_sysfs_entry queue_max_integrity_segments_entry = { 537static 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 },
539 .show = queue_max_integrity_segments_show, 539 .show = queue_max_integrity_segments_show,
540}; 540};
541 541
542static struct queue_sysfs_entry queue_max_segment_size_entry = { 542static 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 },
544 .show = queue_max_segment_size_show, 544 .show = queue_max_segment_size_show,
545}; 545};
546 546
547static struct queue_sysfs_entry queue_iosched_entry = { 547static struct queue_sysfs_entry queue_iosched_entry = {
548 .attr = {.name = "scheduler", .mode = S_IRUGO | S_IWUSR }, 548 .attr = {.name = "scheduler", .mode = 0644 },
549 .show = elv_iosched_show, 549 .show = elv_iosched_show,
550 .store = elv_iosched_store, 550 .store = elv_iosched_store,
551}; 551};
552 552
553static struct queue_sysfs_entry queue_hw_sector_size_entry = { 553static 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 },
555 .show = queue_logical_block_size_show, 555 .show = queue_logical_block_size_show,
556}; 556};
557 557
558static struct queue_sysfs_entry queue_logical_block_size_entry = { 558static 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 },
560 .show = queue_logical_block_size_show, 560 .show = queue_logical_block_size_show,
561}; 561};
562 562
563static struct queue_sysfs_entry queue_physical_block_size_entry = { 563static 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 },
565 .show = queue_physical_block_size_show, 565 .show = queue_physical_block_size_show,
566}; 566};
567 567
568static struct queue_sysfs_entry queue_chunk_sectors_entry = { 568static struct queue_sysfs_entry queue_chunk_sectors_entry = {
569 .attr = {.name = "chunk_sectors", .mode = S_IRUGO }, 569 .attr = {.name = "chunk_sectors", .mode = 0444 },
570 .show = queue_chunk_sectors_show, 570 .show = queue_chunk_sectors_show,
571}; 571};
572 572
573static struct queue_sysfs_entry queue_io_min_entry = { 573static 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 },
575 .show = queue_io_min_show, 575 .show = queue_io_min_show,
576}; 576};
577 577
578static struct queue_sysfs_entry queue_io_opt_entry = { 578static 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 },
580 .show = queue_io_opt_show, 580 .show = queue_io_opt_show,
581}; 581};
582 582
583static struct queue_sysfs_entry queue_discard_granularity_entry = { 583static struct queue_sysfs_entry queue_discard_granularity_entry = {
584 .attr = {.name = "discard_granularity", .mode = S_IRUGO }, 584 .attr = {.name = "discard_granularity", .mode = 0444 },
585 .show = queue_discard_granularity_show, 585 .show = queue_discard_granularity_show,
586}; 586};
587 587
588static struct queue_sysfs_entry queue_discard_max_hw_entry = { 588static 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 },
590 .show = queue_discard_max_hw_show, 590 .show = queue_discard_max_hw_show,
591}; 591};
592 592
593static struct queue_sysfs_entry queue_discard_max_entry = { 593static 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 },
595 .show = queue_discard_max_show, 595 .show = queue_discard_max_show,
596 .store = queue_discard_max_store, 596 .store = queue_discard_max_store,
597}; 597};
598 598
599static struct queue_sysfs_entry queue_discard_zeroes_data_entry = { 599static 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 },
601 .show = queue_discard_zeroes_data_show, 601 .show = queue_discard_zeroes_data_show,
602}; 602};
603 603
604static struct queue_sysfs_entry queue_write_same_max_entry = { 604static 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 },
606 .show = queue_write_same_max_show, 606 .show = queue_write_same_max_show,
607}; 607};
608 608
609static struct queue_sysfs_entry queue_write_zeroes_max_entry = { 609static 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 },
611 .show = queue_write_zeroes_max_show, 611 .show = queue_write_zeroes_max_show,
612}; 612};
613 613
614static struct queue_sysfs_entry queue_nonrot_entry = { 614static struct queue_sysfs_entry queue_nonrot_entry = {
615 .attr = {.name = "rotational", .mode = S_IRUGO | S_IWUSR }, 615 .attr = {.name = "rotational", .mode = 0644 },
616 .show = queue_show_nonrot, 616 .show = queue_show_nonrot,
617 .store = queue_store_nonrot, 617 .store = queue_store_nonrot,
618}; 618};
619 619
620static struct queue_sysfs_entry queue_zoned_entry = { 620static struct queue_sysfs_entry queue_zoned_entry = {
621 .attr = {.name = "zoned", .mode = S_IRUGO }, 621 .attr = {.name = "zoned", .mode = 0444 },
622 .show = queue_zoned_show, 622 .show = queue_zoned_show,
623}; 623};
624 624
625static struct queue_sysfs_entry queue_nomerges_entry = { 625static struct queue_sysfs_entry queue_nomerges_entry = {
626 .attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR }, 626 .attr = {.name = "nomerges", .mode = 0644 },
627 .show = queue_nomerges_show, 627 .show = queue_nomerges_show,
628 .store = queue_nomerges_store, 628 .store = queue_nomerges_store,
629}; 629};
630 630
631static struct queue_sysfs_entry queue_rq_affinity_entry = { 631static 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 },
633 .show = queue_rq_affinity_show, 633 .show = queue_rq_affinity_show,
634 .store = queue_rq_affinity_store, 634 .store = queue_rq_affinity_store,
635}; 635};
636 636
637static struct queue_sysfs_entry queue_iostats_entry = { 637static struct queue_sysfs_entry queue_iostats_entry = {
638 .attr = {.name = "iostats", .mode = S_IRUGO | S_IWUSR }, 638 .attr = {.name = "iostats", .mode = 0644 },
639 .show = queue_show_iostats, 639 .show = queue_show_iostats,
640 .store = queue_store_iostats, 640 .store = queue_store_iostats,
641}; 641};
642 642
643static struct queue_sysfs_entry queue_random_entry = { 643static struct queue_sysfs_entry queue_random_entry = {
644 .attr = {.name = "add_random", .mode = S_IRUGO | S_IWUSR }, 644 .attr = {.name = "add_random", .mode = 0644 },
645 .show = queue_show_random, 645 .show = queue_show_random,
646 .store = queue_store_random, 646 .store = queue_store_random,
647}; 647};
648 648
649static struct queue_sysfs_entry queue_poll_entry = { 649static struct queue_sysfs_entry queue_poll_entry = {
650 .attr = {.name = "io_poll", .mode = S_IRUGO | S_IWUSR }, 650 .attr = {.name = "io_poll", .mode = 0644 },
651 .show = queue_poll_show, 651 .show = queue_poll_show,
652 .store = queue_poll_store, 652 .store = queue_poll_store,
653}; 653};
654 654
655static struct queue_sysfs_entry queue_poll_delay_entry = { 655static 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 },
657 .show = queue_poll_delay_show, 657 .show = queue_poll_delay_show,
658 .store = queue_poll_delay_store, 658 .store = queue_poll_delay_store,
659}; 659};
660 660
661static struct queue_sysfs_entry queue_wc_entry = { 661static struct queue_sysfs_entry queue_wc_entry = {
662 .attr = {.name = "write_cache", .mode = S_IRUGO | S_IWUSR }, 662 .attr = {.name = "write_cache", .mode = 0644 },
663 .show = queue_wc_show, 663 .show = queue_wc_show,
664 .store = queue_wc_store, 664 .store = queue_wc_store,
665}; 665};
666 666
667static struct queue_sysfs_entry queue_fua_entry = { 667static struct queue_sysfs_entry queue_fua_entry = {
668 .attr = {.name = "fua", .mode = S_IRUGO }, 668 .attr = {.name = "fua", .mode = 0444 },
669 .show = queue_fua_show, 669 .show = queue_fua_show,
670}; 670};
671 671
672static struct queue_sysfs_entry queue_dax_entry = { 672static struct queue_sysfs_entry queue_dax_entry = {
673 .attr = {.name = "dax", .mode = S_IRUGO }, 673 .attr = {.name = "dax", .mode = 0444 },
674 .show = queue_dax_show, 674 .show = queue_dax_show,
675}; 675};
676 676
677static struct queue_sysfs_entry queue_wb_lat_entry = { 677static 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 },
679 .show = queue_wb_lat_show, 679 .show = queue_wb_lat_show,
680 .store = queue_wb_lat_store, 680 .store = queue_wb_lat_store,
681}; 681};
682 682
683#ifdef CONFIG_BLK_DEV_THROTTLING_LOW 683#ifdef CONFIG_BLK_DEV_THROTTLING_LOW
684static struct queue_sysfs_entry throtl_sample_time_entry = { 684static 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 },
686 .show = blk_throtl_sample_time_show, 686 .show = blk_throtl_sample_time_show,
687 .store = blk_throtl_sample_time_store, 687 .store = blk_throtl_sample_time_store,
688}; 688};
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 6b9f6b1cd33b..82b6c27b3245 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -4786,7 +4786,7 @@ USEC_STORE_FUNCTION(cfq_target_latency_us_store, &cfqd->cfq_target_latency, 1, U
4786#undef USEC_STORE_FUNCTION 4786#undef USEC_STORE_FUNCTION
4787 4787
4788#define CFQ_ATTR(name) \ 4788#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)
4790 4790
4791static struct elv_fs_entry cfq_attrs[] = { 4791static struct elv_fs_entry cfq_attrs[] = {
4792 CFQ_ATTR(quantum), 4792 CFQ_ATTR(quantum),
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
index 9de9f156e203..ef2f1f09e9b3 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -512,8 +512,7 @@ STORE_FUNCTION(deadline_fifo_batch_store, &dd->fifo_batch, 0, INT_MAX, 0);
512#undef STORE_FUNCTION 512#undef STORE_FUNCTION
513 513
514#define DD_ATTR(name) \ 514#define DD_ATTR(name) \
515 __ATTR(name, S_IRUGO|S_IWUSR, deadline_##name##_show, \ 515 __ATTR(name, 0644, deadline_##name##_show, deadline_##name##_store)
516 deadline_##name##_store)
517 516
518static struct elv_fs_entry deadline_attrs[] = { 517static struct elv_fs_entry deadline_attrs[] = {
519 DD_ATTR(read_expire), 518 DD_ATTR(read_expire),
diff --git a/block/genhd.c b/block/genhd.c
index c4513fe1adda..4d694035d343 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1139,28 +1139,25 @@ static ssize_t disk_discard_alignment_show(struct device *dev,
1139 return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue)); 1139 return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue));
1140} 1140}
1141 1141
1142static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL); 1142static DEVICE_ATTR(range, 0444, disk_range_show, NULL);
1143static DEVICE_ATTR(ext_range, S_IRUGO, disk_ext_range_show, NULL); 1143static DEVICE_ATTR(ext_range, 0444, disk_ext_range_show, NULL);
1144static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL); 1144static DEVICE_ATTR(removable, 0444, disk_removable_show, NULL);
1145static DEVICE_ATTR(hidden, S_IRUGO, disk_hidden_show, NULL); 1145static DEVICE_ATTR(hidden, 0444, disk_hidden_show, NULL);
1146static DEVICE_ATTR(ro, S_IRUGO, disk_ro_show, NULL); 1146static DEVICE_ATTR(ro, 0444, disk_ro_show, NULL);
1147static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL); 1147static DEVICE_ATTR(size, 0444, part_size_show, NULL);
1148static DEVICE_ATTR(alignment_offset, S_IRUGO, disk_alignment_offset_show, NULL); 1148static DEVICE_ATTR(alignment_offset, 0444, disk_alignment_offset_show, NULL);
1149static DEVICE_ATTR(discard_alignment, S_IRUGO, disk_discard_alignment_show, 1149static DEVICE_ATTR(discard_alignment, 0444, disk_discard_alignment_show, NULL);
1150 NULL); 1150static DEVICE_ATTR(capability, 0444, disk_capability_show, NULL);
1151static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL); 1151static DEVICE_ATTR(stat, 0444, part_stat_show, NULL);
1152static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); 1152static DEVICE_ATTR(inflight, 0444, part_inflight_show, NULL);
1153static DEVICE_ATTR(inflight, S_IRUGO, part_inflight_show, NULL); 1153static DEVICE_ATTR(badblocks, 0644, disk_badblocks_show, disk_badblocks_store);
1154static DEVICE_ATTR(badblocks, S_IRUGO | S_IWUSR, disk_badblocks_show,
1155 disk_badblocks_store);
1156#ifdef CONFIG_FAIL_MAKE_REQUEST 1154#ifdef CONFIG_FAIL_MAKE_REQUEST
1157static struct device_attribute dev_attr_fail = 1155static 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);
1159#endif 1157#endif
1160#ifdef CONFIG_FAIL_IO_TIMEOUT 1158#ifdef CONFIG_FAIL_IO_TIMEOUT
1161static struct device_attribute dev_attr_fail_timeout = 1159static struct device_attribute dev_attr_fail_timeout =
1162 __ATTR(io-timeout-fail, S_IRUGO|S_IWUSR, part_timeout_show, 1160 __ATTR(io-timeout-fail, 0644, part_timeout_show, part_timeout_store);
1163 part_timeout_store);
1164#endif 1161#endif
1165 1162
1166static struct attribute *disk_attrs[] = { 1163static struct attribute *disk_attrs[] = {
@@ -1924,9 +1921,9 @@ static ssize_t disk_events_poll_msecs_store(struct device *dev,
1924 return count; 1921 return count;
1925} 1922}
1926 1923
1927static const DEVICE_ATTR(events, S_IRUGO, disk_events_show, NULL); 1924static const DEVICE_ATTR(events, 0444, disk_events_show, NULL);
1928static const DEVICE_ATTR(events_async, S_IRUGO, disk_events_async_show, NULL); 1925static const DEVICE_ATTR(events_async, 0444, disk_events_async_show, NULL);
1929static const DEVICE_ATTR(events_poll_msecs, S_IRUGO|S_IWUSR, 1926static const DEVICE_ATTR(events_poll_msecs, 0644,
1930 disk_events_poll_msecs_show, 1927 disk_events_poll_msecs_show,
1931 disk_events_poll_msecs_store); 1928 disk_events_poll_msecs_store);
1932 1929
diff --git a/block/mq-deadline.c b/block/mq-deadline.c
index 8ec0ba9f5386..099a9e05854c 100644
--- a/block/mq-deadline.c
+++ b/block/mq-deadline.c
@@ -630,8 +630,7 @@ STORE_FUNCTION(deadline_fifo_batch_store, &dd->fifo_batch, 0, INT_MAX, 0);
630#undef STORE_FUNCTION 630#undef STORE_FUNCTION
631 631
632#define DD_ATTR(name) \ 632#define DD_ATTR(name) \
633 __ATTR(name, S_IRUGO|S_IWUSR, deadline_##name##_show, \ 633 __ATTR(name, 0644, deadline_##name##_show, deadline_##name##_store)
634 deadline_##name##_store)
635 634
636static struct elv_fs_entry deadline_attrs[] = { 635static struct elv_fs_entry deadline_attrs[] = {
637 DD_ATTR(read_expire), 636 DD_ATTR(read_expire),
diff --git a/block/partition-generic.c b/block/partition-generic.c
index db57cced9b98..93ef8ce568a1 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -179,18 +179,17 @@ ssize_t part_fail_store(struct device *dev,
179} 179}
180#endif 180#endif
181 181
182static DEVICE_ATTR(partition, S_IRUGO, part_partition_show, NULL); 182static DEVICE_ATTR(partition, 0444, part_partition_show, NULL);
183static DEVICE_ATTR(start, S_IRUGO, part_start_show, NULL); 183static DEVICE_ATTR(start, 0444, part_start_show, NULL);
184static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL); 184static DEVICE_ATTR(size, 0444, part_size_show, NULL);
185static DEVICE_ATTR(ro, S_IRUGO, part_ro_show, NULL); 185static DEVICE_ATTR(ro, 0444, part_ro_show, NULL);
186static DEVICE_ATTR(alignment_offset, S_IRUGO, part_alignment_offset_show, NULL); 186static DEVICE_ATTR(alignment_offset, 0444, part_alignment_offset_show, NULL);
187static DEVICE_ATTR(discard_alignment, S_IRUGO, part_discard_alignment_show, 187static DEVICE_ATTR(discard_alignment, 0444, part_discard_alignment_show, NULL);
188 NULL); 188static DEVICE_ATTR(stat, 0444, part_stat_show, NULL);
189static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); 189static DEVICE_ATTR(inflight, 0444, part_inflight_show, NULL);
190static DEVICE_ATTR(inflight, S_IRUGO, part_inflight_show, NULL);
191#ifdef CONFIG_FAIL_MAKE_REQUEST 190#ifdef CONFIG_FAIL_MAKE_REQUEST
192static struct device_attribute dev_attr_fail = 191static struct device_attribute dev_attr_fail =
193 __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store); 192 __ATTR(make-it-fail, 0644, part_fail_show, part_fail_store);
194#endif 193#endif
195 194
196static struct attribute *part_attrs[] = { 195static struct attribute *part_attrs[] = {
@@ -291,8 +290,7 @@ static ssize_t whole_disk_show(struct device *dev,
291{ 290{
292 return 0; 291 return 0;
293} 292}
294static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH, 293static DEVICE_ATTR(whole_disk, 0444, whole_disk_show, NULL);
295 whole_disk_show, NULL);
296 294
297/* 295/*
298 * Must be called either with bd_mutex held, before a disk can be opened or 296 * Must be called either with bd_mutex held, before a disk can be opened or
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index c9ba48519d0f..7c3887a7e534 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -6589,7 +6589,7 @@ static void DAC960_CreateProcEntries(DAC960_Controller_T *Controller)
6589 DAC960_ProcDirectoryEntry); 6589 DAC960_ProcDirectoryEntry);
6590 proc_create_data("initial_status", 0, ControllerProcEntry, &dac960_initial_status_proc_fops, Controller); 6590 proc_create_data("initial_status", 0, ControllerProcEntry, &dac960_initial_status_proc_fops, Controller);
6591 proc_create_data("current_status", 0, ControllerProcEntry, &dac960_current_status_proc_fops, Controller); 6591 proc_create_data("current_status", 0, ControllerProcEntry, &dac960_current_status_proc_fops, Controller);
6592 proc_create_data("user_command", S_IWUSR | S_IRUSR, ControllerProcEntry, &dac960_user_command_proc_fops, Controller); 6592 proc_create_data("user_command", 0600, ControllerProcEntry, &dac960_user_command_proc_fops, Controller);
6593 Controller->ControllerProcEntry = ControllerProcEntry; 6593 Controller->ControllerProcEntry = ControllerProcEntry;
6594} 6594}
6595 6595
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index 027b876370bc..429ebb84b592 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -159,14 +159,14 @@ static int aoe_debugfs_open(struct inode *inode, struct file *file)
159 return single_open(file, aoedisk_debugfs_show, inode->i_private); 159 return single_open(file, aoedisk_debugfs_show, inode->i_private);
160} 160}
161 161
162static DEVICE_ATTR(state, S_IRUGO, aoedisk_show_state, NULL); 162static DEVICE_ATTR(state, 0444, aoedisk_show_state, NULL);
163static DEVICE_ATTR(mac, S_IRUGO, aoedisk_show_mac, NULL); 163static DEVICE_ATTR(mac, 0444, aoedisk_show_mac, NULL);
164static DEVICE_ATTR(netif, S_IRUGO, aoedisk_show_netif, NULL); 164static DEVICE_ATTR(netif, 0444, aoedisk_show_netif, NULL);
165static struct device_attribute dev_attr_firmware_version = { 165static struct device_attribute dev_attr_firmware_version = {
166 .attr = { .name = "firmware-version", .mode = S_IRUGO }, 166 .attr = { .name = "firmware-version", .mode = 0444 },
167 .show = aoedisk_show_fwver, 167 .show = aoedisk_show_fwver,
168}; 168};
169static DEVICE_ATTR(payload, S_IRUGO, aoedisk_show_payload, NULL); 169static DEVICE_ATTR(payload, 0444, aoedisk_show_payload, NULL);
170 170
171static struct attribute *aoe_attrs[] = { 171static struct attribute *aoe_attrs[] = {
172 &dev_attr_state.attr, 172 &dev_attr_state.attr,
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 39c5b90cc187..bb976598ee43 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -331,15 +331,15 @@ static const struct block_device_operations brd_fops = {
331 * And now the modules code and kernel interface. 331 * And now the modules code and kernel interface.
332 */ 332 */
333static int rd_nr = CONFIG_BLK_DEV_RAM_COUNT; 333static int rd_nr = CONFIG_BLK_DEV_RAM_COUNT;
334module_param(rd_nr, int, S_IRUGO); 334module_param(rd_nr, int, 0444);
335MODULE_PARM_DESC(rd_nr, "Maximum number of brd devices"); 335MODULE_PARM_DESC(rd_nr, "Maximum number of brd devices");
336 336
337unsigned long rd_size = CONFIG_BLK_DEV_RAM_SIZE; 337unsigned long rd_size = CONFIG_BLK_DEV_RAM_SIZE;
338module_param(rd_size, ulong, S_IRUGO); 338module_param(rd_size, ulong, 0444);
339MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes."); 339MODULE_PARM_DESC(rd_size, "Size of each RAM disk in kbytes.");
340 340
341static int max_part = 1; 341static int max_part = 1;
342module_param(max_part, int, S_IRUGO); 342module_param(max_part, int, 0444);
343MODULE_PARM_DESC(max_part, "Num Minors to reserve between devices"); 343MODULE_PARM_DESC(max_part, "Num Minors to reserve between devices");
344 344
345MODULE_LICENSE("GPL"); 345MODULE_LICENSE("GPL");
diff --git a/drivers/block/drbd/drbd_debugfs.c b/drivers/block/drbd/drbd_debugfs.c
index ab21976a87b2..5d5e8d6a8a56 100644
--- a/drivers/block/drbd/drbd_debugfs.c
+++ b/drivers/block/drbd/drbd_debugfs.c
@@ -481,9 +481,9 @@ void drbd_debugfs_resource_add(struct drbd_resource *resource)
481 goto fail; 481 goto fail;
482 resource->debugfs_res_connections = dentry; 482 resource->debugfs_res_connections = dentry;
483 483
484 dentry = debugfs_create_file("in_flight_summary", S_IRUSR|S_IRGRP, 484 dentry = debugfs_create_file("in_flight_summary", 0440,
485 resource->debugfs_res, resource, 485 resource->debugfs_res, resource,
486 &in_flight_summary_fops); 486 &in_flight_summary_fops);
487 if (IS_ERR_OR_NULL(dentry)) 487 if (IS_ERR_OR_NULL(dentry))
488 goto fail; 488 goto fail;
489 resource->debugfs_res_in_flight_summary = dentry; 489 resource->debugfs_res_in_flight_summary = dentry;
@@ -645,16 +645,16 @@ void drbd_debugfs_connection_add(struct drbd_connection *connection)
645 goto fail; 645 goto fail;
646 connection->debugfs_conn = dentry; 646 connection->debugfs_conn = dentry;
647 647
648 dentry = debugfs_create_file("callback_history", S_IRUSR|S_IRGRP, 648 dentry = debugfs_create_file("callback_history", 0440,
649 connection->debugfs_conn, connection, 649 connection->debugfs_conn, connection,
650 &connection_callback_history_fops); 650 &connection_callback_history_fops);
651 if (IS_ERR_OR_NULL(dentry)) 651 if (IS_ERR_OR_NULL(dentry))
652 goto fail; 652 goto fail;
653 connection->debugfs_conn_callback_history = dentry; 653 connection->debugfs_conn_callback_history = dentry;
654 654
655 dentry = debugfs_create_file("oldest_requests", S_IRUSR|S_IRGRP, 655 dentry = debugfs_create_file("oldest_requests", 0440,
656 connection->debugfs_conn, connection, 656 connection->debugfs_conn, connection,
657 &connection_oldest_requests_fops); 657 &connection_oldest_requests_fops);
658 if (IS_ERR_OR_NULL(dentry)) 658 if (IS_ERR_OR_NULL(dentry))
659 goto fail; 659 goto fail;
660 connection->debugfs_conn_oldest_requests = dentry; 660 connection->debugfs_conn_oldest_requests = dentry;
@@ -824,7 +824,7 @@ void drbd_debugfs_device_add(struct drbd_device *device)
824 device->debugfs_minor = dentry; 824 device->debugfs_minor = dentry;
825 825
826#define DCF(name) do { \ 826#define DCF(name) do { \
827 dentry = debugfs_create_file(#name, S_IRUSR|S_IRGRP, \ 827 dentry = debugfs_create_file(#name, 0440, \
828 device->debugfs_vol, device, \ 828 device->debugfs_vol, device, \
829 &device_ ## name ## _fops); \ 829 &device_ ## name ## _fops); \
830 if (IS_ERR_OR_NULL(dentry)) \ 830 if (IS_ERR_OR_NULL(dentry)) \
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 185f1ef00a7c..e6ec831ad472 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -3010,7 +3010,7 @@ static int __init drbd_init(void)
3010 goto fail; 3010 goto fail;
3011 3011
3012 err = -ENOMEM; 3012 err = -ENOMEM;
3013 drbd_proc = proc_create_data("drbd", S_IFREG | S_IRUGO , NULL, &drbd_proc_fops, NULL); 3013 drbd_proc = proc_create_data("drbd", S_IFREG | 0444 , NULL, &drbd_proc_fops, NULL);
3014 if (!drbd_proc) { 3014 if (!drbd_proc) {
3015 pr_err("unable to register proc file\n"); 3015 pr_err("unable to register proc file\n");
3016 goto fail; 3016 goto fail;
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 8ec7235fc93b..8871b5044d9e 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4450,7 +4450,7 @@ static ssize_t floppy_cmos_show(struct device *dev,
4450 return sprintf(buf, "%X\n", UDP->cmos); 4450 return sprintf(buf, "%X\n", UDP->cmos);
4451} 4451}
4452 4452
4453static DEVICE_ATTR(cmos, S_IRUGO, floppy_cmos_show, NULL); 4453static DEVICE_ATTR(cmos, 0444, floppy_cmos_show, NULL);
4454 4454
4455static struct attribute *floppy_dev_attrs[] = { 4455static struct attribute *floppy_dev_attrs[] = {
4456 &dev_attr_cmos.attr, 4456 &dev_attr_cmos.attr,
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 5f0df2efc26c..66c1f0786ae8 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -732,7 +732,7 @@ static ssize_t loop_attr_do_show_##_name(struct device *d, \
732 return loop_attr_show(d, b, loop_attr_##_name##_show); \ 732 return loop_attr_show(d, b, loop_attr_##_name##_show); \
733} \ 733} \
734static struct device_attribute loop_attr_##_name = \ 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 736
737static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf) 737static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf)
738{ 738{
@@ -1677,9 +1677,9 @@ static const struct block_device_operations lo_fops = {
1677 * And now the modules code and kernel interface. 1677 * And now the modules code and kernel interface.
1678 */ 1678 */
1679static int max_loop; 1679static int max_loop;
1680module_param(max_loop, int, S_IRUGO); 1680module_param(max_loop, int, 0444);
1681MODULE_PARM_DESC(max_loop, "Maximum number of loop devices"); 1681MODULE_PARM_DESC(max_loop, "Maximum number of loop devices");
1682module_param(max_part, int, S_IRUGO); 1682module_param(max_part, int, 0444);
1683MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device"); 1683MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device");
1684MODULE_LICENSE("GPL"); 1684MODULE_LICENSE("GPL");
1685MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR); 1685MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR);
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 6df5b0b1517a..e873daca9d13 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2285,7 +2285,7 @@ static ssize_t mtip_hw_show_status(struct device *dev,
2285 return size; 2285 return size;
2286} 2286}
2287 2287
2288static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); 2288static DEVICE_ATTR(status, 0444, mtip_hw_show_status, NULL);
2289 2289
2290/* debugsfs entries */ 2290/* debugsfs entries */
2291 2291
@@ -2566,10 +2566,9 @@ static int mtip_hw_debugfs_init(struct driver_data *dd)
2566 return -1; 2566 return -1;
2567 } 2567 }
2568 2568
2569 debugfs_create_file("flags", S_IRUGO, dd->dfs_node, dd, 2569 debugfs_create_file("flags", 0444, dd->dfs_node, dd, &mtip_flags_fops);
2570 &mtip_flags_fops); 2570 debugfs_create_file("registers", 0444, dd->dfs_node, dd,
2571 debugfs_create_file("registers", S_IRUGO, dd->dfs_node, dd, 2571 &mtip_regs_fops);
2572 &mtip_regs_fops);
2573 2572
2574 return 0; 2573 return 0;
2575} 2574}
@@ -4613,7 +4612,7 @@ static int __init mtip_init(void)
4613 } 4612 }
4614 if (dfs_parent) { 4613 if (dfs_parent) {
4615 dfs_device_status = debugfs_create_file("device_status", 4614 dfs_device_status = debugfs_create_file("device_status",
4616 S_IRUGO, dfs_parent, NULL, 4615 0444, dfs_parent, NULL,
4617 &mtip_device_status_fops); 4616 &mtip_device_status_fops);
4618 if (IS_ERR_OR_NULL(dfs_device_status)) { 4617 if (IS_ERR_OR_NULL(dfs_device_status)) {
4619 pr_err("Error creating device_status node\n"); 4618 pr_err("Error creating device_status node\n");
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index bdfbb2a7018c..800e1ec71f3d 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -166,7 +166,7 @@ static ssize_t pid_show(struct device *dev,
166} 166}
167 167
168static const struct device_attribute pid_attr = { 168static const struct device_attribute pid_attr = {
169 .attr = { .name = "pid", .mode = S_IRUGO}, 169 .attr = { .name = "pid", .mode = 0444},
170 .show = pid_show, 170 .show = pid_show,
171}; 171};
172 172
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index a76553293a31..b4d368e3ddcd 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -157,23 +157,23 @@ enum {
157}; 157};
158 158
159static int g_no_sched; 159static int g_no_sched;
160module_param_named(no_sched, g_no_sched, int, S_IRUGO); 160module_param_named(no_sched, g_no_sched, int, 0444);
161MODULE_PARM_DESC(no_sched, "No io scheduler"); 161MODULE_PARM_DESC(no_sched, "No io scheduler");
162 162
163static int g_submit_queues = 1; 163static int g_submit_queues = 1;
164module_param_named(submit_queues, g_submit_queues, int, S_IRUGO); 164module_param_named(submit_queues, g_submit_queues, int, 0444);
165MODULE_PARM_DESC(submit_queues, "Number of submission queues"); 165MODULE_PARM_DESC(submit_queues, "Number of submission queues");
166 166
167static int g_home_node = NUMA_NO_NODE; 167static int g_home_node = NUMA_NO_NODE;
168module_param_named(home_node, g_home_node, int, S_IRUGO); 168module_param_named(home_node, g_home_node, int, 0444);
169MODULE_PARM_DESC(home_node, "Home node for the device"); 169MODULE_PARM_DESC(home_node, "Home node for the device");
170 170
171#ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION 171#ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION
172static char g_timeout_str[80]; 172static char g_timeout_str[80];
173module_param_string(timeout, g_timeout_str, sizeof(g_timeout_str), S_IRUGO); 173module_param_string(timeout, g_timeout_str, sizeof(g_timeout_str), 0444);
174 174
175static char g_requeue_str[80]; 175static char g_requeue_str[80];
176module_param_string(requeue, g_requeue_str, sizeof(g_requeue_str), S_IRUGO); 176module_param_string(requeue, g_requeue_str, sizeof(g_requeue_str), 0444);
177#endif 177#endif
178 178
179static int g_queue_mode = NULL_Q_MQ; 179static int g_queue_mode = NULL_Q_MQ;
@@ -203,27 +203,27 @@ static const struct kernel_param_ops null_queue_mode_param_ops = {
203 .get = param_get_int, 203 .get = param_get_int,
204}; 204};
205 205
206device_param_cb(queue_mode, &null_queue_mode_param_ops, &g_queue_mode, S_IRUGO); 206device_param_cb(queue_mode, &null_queue_mode_param_ops, &g_queue_mode, 0444);
207MODULE_PARM_DESC(queue_mode, "Block interface to use (0=bio,1=rq,2=multiqueue)"); 207MODULE_PARM_DESC(queue_mode, "Block interface to use (0=bio,1=rq,2=multiqueue)");
208 208
209static int g_gb = 250; 209static int g_gb = 250;
210module_param_named(gb, g_gb, int, S_IRUGO); 210module_param_named(gb, g_gb, int, 0444);
211MODULE_PARM_DESC(gb, "Size in GB"); 211MODULE_PARM_DESC(gb, "Size in GB");
212 212
213static int g_bs = 512; 213static int g_bs = 512;
214module_param_named(bs, g_bs, int, S_IRUGO); 214module_param_named(bs, g_bs, int, 0444);
215MODULE_PARM_DESC(bs, "Block size (in bytes)"); 215MODULE_PARM_DESC(bs, "Block size (in bytes)");
216 216
217static int nr_devices = 1; 217static int nr_devices = 1;
218module_param(nr_devices, int, S_IRUGO); 218module_param(nr_devices, int, 0444);
219MODULE_PARM_DESC(nr_devices, "Number of devices to register"); 219MODULE_PARM_DESC(nr_devices, "Number of devices to register");
220 220
221static bool g_blocking; 221static bool g_blocking;
222module_param_named(blocking, g_blocking, bool, S_IRUGO); 222module_param_named(blocking, g_blocking, bool, 0444);
223MODULE_PARM_DESC(blocking, "Register as a blocking blk-mq driver device"); 223MODULE_PARM_DESC(blocking, "Register as a blocking blk-mq driver device");
224 224
225static bool shared_tags; 225static bool shared_tags;
226module_param(shared_tags, bool, S_IRUGO); 226module_param(shared_tags, bool, 0444);
227MODULE_PARM_DESC(shared_tags, "Share tag set between devices for blk-mq"); 227MODULE_PARM_DESC(shared_tags, "Share tag set between devices for blk-mq");
228 228
229static int g_irqmode = NULL_IRQ_SOFTIRQ; 229static int g_irqmode = NULL_IRQ_SOFTIRQ;
@@ -239,19 +239,19 @@ static const struct kernel_param_ops null_irqmode_param_ops = {
239 .get = param_get_int, 239 .get = param_get_int,
240}; 240};
241 241
242device_param_cb(irqmode, &null_irqmode_param_ops, &g_irqmode, S_IRUGO); 242device_param_cb(irqmode, &null_irqmode_param_ops, &g_irqmode, 0444);
243MODULE_PARM_DESC(irqmode, "IRQ completion handler. 0-none, 1-softirq, 2-timer"); 243MODULE_PARM_DESC(irqmode, "IRQ completion handler. 0-none, 1-softirq, 2-timer");
244 244
245static unsigned long g_completion_nsec = 10000; 245static unsigned long g_completion_nsec = 10000;
246module_param_named(completion_nsec, g_completion_nsec, ulong, S_IRUGO); 246module_param_named(completion_nsec, g_completion_nsec, ulong, 0444);
247MODULE_PARM_DESC(completion_nsec, "Time in ns to complete a request in hardware. Default: 10,000ns"); 247MODULE_PARM_DESC(completion_nsec, "Time in ns to complete a request in hardware. Default: 10,000ns");
248 248
249static int g_hw_queue_depth = 64; 249static int g_hw_queue_depth = 64;
250module_param_named(hw_queue_depth, g_hw_queue_depth, int, S_IRUGO); 250module_param_named(hw_queue_depth, g_hw_queue_depth, int, 0444);
251MODULE_PARM_DESC(hw_queue_depth, "Queue depth for each hardware queue. Default: 64"); 251MODULE_PARM_DESC(hw_queue_depth, "Queue depth for each hardware queue. Default: 64");
252 252
253static bool g_use_per_node_hctx; 253static bool g_use_per_node_hctx;
254module_param_named(use_per_node_hctx, g_use_per_node_hctx, bool, S_IRUGO); 254module_param_named(use_per_node_hctx, g_use_per_node_hctx, bool, 0444);
255MODULE_PARM_DESC(use_per_node_hctx, "Use per-node allocation for hardware context queues. Default: false"); 255MODULE_PARM_DESC(use_per_node_hctx, "Use per-node allocation for hardware context queues. Default: false");
256 256
257static struct nullb_device *null_alloc_dev(void); 257static struct nullb_device *null_alloc_dev(void);
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index d8aff7f3256a..2f2d476ffc31 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -478,8 +478,8 @@ static void pkt_debugfs_dev_new(struct pktcdvd_device *pd)
478 if (!pd->dfs_d_root) 478 if (!pd->dfs_d_root)
479 return; 479 return;
480 480
481 pd->dfs_f_info = debugfs_create_file("info", S_IRUGO, 481 pd->dfs_f_info = debugfs_create_file("info", 0444,
482 pd->dfs_d_root, pd, &debug_fops); 482 pd->dfs_d_root, pd, &debug_fops);
483} 483}
484 484
485static void pkt_debugfs_dev_remove(struct pktcdvd_device *pd) 485static void pkt_debugfs_dev_remove(struct pktcdvd_device *pd)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 8e8b04cc569a..7e669c1042b1 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -424,7 +424,7 @@ static struct workqueue_struct *rbd_wq;
424 * single-major requires >= 0.75 version of userspace rbd utility. 424 * single-major requires >= 0.75 version of userspace rbd utility.
425 */ 425 */
426static bool single_major = true; 426static bool single_major = true;
427module_param(single_major, bool, S_IRUGO); 427module_param(single_major, bool, 0444);
428MODULE_PARM_DESC(single_major, "Use a single major number for all rbd devices (default: true)"); 428MODULE_PARM_DESC(single_major, "Use a single major number for all rbd devices (default: true)");
429 429
430static ssize_t rbd_add(struct bus_type *bus, const char *buf, 430static ssize_t rbd_add(struct bus_type *bus, const char *buf,
@@ -468,11 +468,11 @@ static ssize_t rbd_supported_features_show(struct bus_type *bus, char *buf)
468 return sprintf(buf, "0x%llx\n", RBD_FEATURES_SUPPORTED); 468 return sprintf(buf, "0x%llx\n", RBD_FEATURES_SUPPORTED);
469} 469}
470 470
471static BUS_ATTR(add, S_IWUSR, NULL, rbd_add); 471static BUS_ATTR(add, 0200, NULL, rbd_add);
472static BUS_ATTR(remove, S_IWUSR, NULL, rbd_remove); 472static BUS_ATTR(remove, 0200, NULL, rbd_remove);
473static BUS_ATTR(add_single_major, S_IWUSR, NULL, rbd_add_single_major); 473static BUS_ATTR(add_single_major, 0200, NULL, rbd_add_single_major);
474static BUS_ATTR(remove_single_major, S_IWUSR, NULL, rbd_remove_single_major); 474static BUS_ATTR(remove_single_major, 0200, NULL, rbd_remove_single_major);
475static BUS_ATTR(supported_features, S_IRUGO, rbd_supported_features_show, NULL); 475static BUS_ATTR(supported_features, 0444, rbd_supported_features_show, NULL);
476 476
477static struct attribute *rbd_bus_attrs[] = { 477static struct attribute *rbd_bus_attrs[] = {
478 &bus_attr_add.attr, 478 &bus_attr_add.attr,
@@ -4202,22 +4202,22 @@ static ssize_t rbd_image_refresh(struct device *dev,
4202 return size; 4202 return size;
4203} 4203}
4204 4204
4205static DEVICE_ATTR(size, S_IRUGO, rbd_size_show, NULL); 4205static DEVICE_ATTR(size, 0444, rbd_size_show, NULL);
4206static DEVICE_ATTR(features, S_IRUGO, rbd_features_show, NULL); 4206static DEVICE_ATTR(features, 0444, rbd_features_show, NULL);
4207static DEVICE_ATTR(major, S_IRUGO, rbd_major_show, NULL); 4207static DEVICE_ATTR(major, 0444, rbd_major_show, NULL);
4208static DEVICE_ATTR(minor, S_IRUGO, rbd_minor_show, NULL); 4208static DEVICE_ATTR(minor, 0444, rbd_minor_show, NULL);
4209static DEVICE_ATTR(client_addr, S_IRUGO, rbd_client_addr_show, NULL); 4209static DEVICE_ATTR(client_addr, 0444, rbd_client_addr_show, NULL);
4210static DEVICE_ATTR(client_id, S_IRUGO, rbd_client_id_show, NULL); 4210static DEVICE_ATTR(client_id, 0444, rbd_client_id_show, NULL);
4211static DEVICE_ATTR(cluster_fsid, S_IRUGO, rbd_cluster_fsid_show, NULL); 4211static DEVICE_ATTR(cluster_fsid, 0444, rbd_cluster_fsid_show, NULL);
4212static DEVICE_ATTR(config_info, S_IRUSR, rbd_config_info_show, NULL); 4212static DEVICE_ATTR(config_info, 0400, rbd_config_info_show, NULL);
4213static DEVICE_ATTR(pool, S_IRUGO, rbd_pool_show, NULL); 4213static DEVICE_ATTR(pool, 0444, rbd_pool_show, NULL);
4214static DEVICE_ATTR(pool_id, S_IRUGO, rbd_pool_id_show, NULL); 4214static DEVICE_ATTR(pool_id, 0444, rbd_pool_id_show, NULL);
4215static DEVICE_ATTR(name, S_IRUGO, rbd_name_show, NULL); 4215static DEVICE_ATTR(name, 0444, rbd_name_show, NULL);
4216static DEVICE_ATTR(image_id, S_IRUGO, rbd_image_id_show, NULL); 4216static DEVICE_ATTR(image_id, 0444, rbd_image_id_show, NULL);
4217static DEVICE_ATTR(refresh, S_IWUSR, NULL, rbd_image_refresh); 4217static DEVICE_ATTR(refresh, 0200, NULL, rbd_image_refresh);
4218static DEVICE_ATTR(current_snap, S_IRUGO, rbd_snap_show, NULL); 4218static DEVICE_ATTR(current_snap, 0444, rbd_snap_show, NULL);
4219static DEVICE_ATTR(snap_id, S_IRUGO, rbd_snap_id_show, NULL); 4219static DEVICE_ATTR(snap_id, 0444, rbd_snap_id_show, NULL);
4220static DEVICE_ATTR(parent, S_IRUGO, rbd_parent_show, NULL); 4220static DEVICE_ATTR(parent, 0444, rbd_parent_show, NULL);
4221 4221
4222static struct attribute *rbd_attrs[] = { 4222static struct attribute *rbd_attrs[] = {
4223 &dev_attr_size.attr, 4223 &dev_attr_size.attr,
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index 34997df132e2..09537bee387f 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -247,19 +247,19 @@ static void rsxx_debugfs_dev_new(struct rsxx_cardinfo *card)
247 if (IS_ERR_OR_NULL(card->debugfs_dir)) 247 if (IS_ERR_OR_NULL(card->debugfs_dir))
248 goto failed_debugfs_dir; 248 goto failed_debugfs_dir;
249 249
250 debugfs_stats = debugfs_create_file("stats", S_IRUGO, 250 debugfs_stats = debugfs_create_file("stats", 0444,
251 card->debugfs_dir, card, 251 card->debugfs_dir, card,
252 &debugfs_stats_fops); 252 &debugfs_stats_fops);
253 if (IS_ERR_OR_NULL(debugfs_stats)) 253 if (IS_ERR_OR_NULL(debugfs_stats))
254 goto failed_debugfs_stats; 254 goto failed_debugfs_stats;
255 255
256 debugfs_pci_regs = debugfs_create_file("pci_regs", S_IRUGO, 256 debugfs_pci_regs = debugfs_create_file("pci_regs", 0444,
257 card->debugfs_dir, card, 257 card->debugfs_dir, card,
258 &debugfs_pci_regs_fops); 258 &debugfs_pci_regs_fops);
259 if (IS_ERR_OR_NULL(debugfs_pci_regs)) 259 if (IS_ERR_OR_NULL(debugfs_pci_regs))
260 goto failed_debugfs_pci_regs; 260 goto failed_debugfs_pci_regs;
261 261
262 debugfs_cram = debugfs_create_file("cram", S_IRUGO | S_IWUSR, 262 debugfs_cram = debugfs_create_file("cram", 0644,
263 card->debugfs_dir, card, 263 card->debugfs_dir, card,
264 &debugfs_cram_fops); 264 &debugfs_cram_fops);
265 if (IS_ERR_OR_NULL(debugfs_cram)) 265 if (IS_ERR_OR_NULL(debugfs_cram))
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 0617b9922d59..23752dc99b00 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -371,7 +371,7 @@ static ssize_t virtblk_serial_show(struct device *dev,
371 return err; 371 return err;
372} 372}
373 373
374static DEVICE_ATTR(serial, S_IRUGO, virtblk_serial_show, NULL); 374static DEVICE_ATTR(serial, 0444, virtblk_serial_show, NULL);
375 375
376/* The queue's logical block size must be set before calling this */ 376/* The queue's logical block size must be set before calling this */
377static void virtblk_update_capacity(struct virtio_blk *vblk, bool resize) 377static void virtblk_update_capacity(struct virtio_blk *vblk, bool resize)
@@ -576,10 +576,10 @@ virtblk_cache_type_show(struct device *dev, struct device_attribute *attr,
576} 576}
577 577
578static const struct device_attribute dev_attr_cache_type_ro = 578static const struct device_attribute dev_attr_cache_type_ro =
579 __ATTR(cache_type, S_IRUGO, 579 __ATTR(cache_type, 0444,
580 virtblk_cache_type_show, NULL); 580 virtblk_cache_type_show, NULL);
581static const struct device_attribute dev_attr_cache_type_rw = 581static const struct device_attribute dev_attr_cache_type_rw =
582 __ATTR(cache_type, S_IRUGO|S_IWUSR, 582 __ATTR(cache_type, 0644,
583 virtblk_cache_type_show, virtblk_cache_type_store); 583 virtblk_cache_type_show, virtblk_cache_type_store);
584 584
585static int virtblk_init_request(struct blk_mq_tag_set *set, struct request *rq, 585static int virtblk_init_request(struct blk_mq_tag_set *set, struct request *rq,
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 987d665e82de..b55b245e8052 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -98,7 +98,7 @@ MODULE_PARM_DESC(max_queues,
98 * backend, 4KB page granularity is used. 98 * backend, 4KB page granularity is used.
99 */ 99 */
100unsigned int xen_blkif_max_ring_order = XENBUS_MAX_RING_GRANT_ORDER; 100unsigned int xen_blkif_max_ring_order = XENBUS_MAX_RING_GRANT_ORDER;
101module_param_named(max_ring_page_order, xen_blkif_max_ring_order, int, S_IRUGO); 101module_param_named(max_ring_page_order, xen_blkif_max_ring_order, int, 0444);
102MODULE_PARM_DESC(max_ring_page_order, "Maximum order of pages to be used for the shared ring"); 102MODULE_PARM_DESC(max_ring_page_order, "Maximum order of pages to be used for the shared ring");
103/* 103/*
104 * The LRU mechanism to clean the lists of persistent grants needs to 104 * The LRU mechanism to clean the lists of persistent grants needs to
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 21c1be1eb226..66412eededda 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -367,7 +367,7 @@ int __init xen_blkif_interface_init(void)
367out: \ 367out: \
368 return sprintf(buf, format, result); \ 368 return sprintf(buf, format, result); \
369 } \ 369 } \
370 static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) 370 static DEVICE_ATTR(name, 0444, show_##name, NULL)
371 371
372VBD_SHOW_ALLRING(oo_req, "%llu\n"); 372VBD_SHOW_ALLRING(oo_req, "%llu\n");
373VBD_SHOW_ALLRING(rd_req, "%llu\n"); 373VBD_SHOW_ALLRING(rd_req, "%llu\n");
@@ -403,7 +403,7 @@ static const struct attribute_group xen_vbdstat_group = {
403 \ 403 \
404 return sprintf(buf, format, ##args); \ 404 return sprintf(buf, format, ##args); \
405 } \ 405 } \
406 static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) 406 static DEVICE_ATTR(name, 0444, show_##name, NULL)
407 407
408VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor); 408VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor);
409VBD_SHOW(mode, "%s\n", be->mode); 409VBD_SHOW(mode, "%s\n", be->mode);
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 2a8e7813bd1a..ae00a82f350b 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -129,13 +129,12 @@ static const struct block_device_operations xlvbd_block_fops;
129 */ 129 */
130 130
131static unsigned int xen_blkif_max_segments = 32; 131static unsigned int xen_blkif_max_segments = 32;
132module_param_named(max_indirect_segments, xen_blkif_max_segments, uint, 132module_param_named(max_indirect_segments, xen_blkif_max_segments, uint, 0444);
133 S_IRUGO);
134MODULE_PARM_DESC(max_indirect_segments, 133MODULE_PARM_DESC(max_indirect_segments,
135 "Maximum amount of segments in indirect requests (default is 32)"); 134 "Maximum amount of segments in indirect requests (default is 32)");
136 135
137static unsigned int xen_blkif_max_queues = 4; 136static unsigned int xen_blkif_max_queues = 4;
138module_param_named(max_queues, xen_blkif_max_queues, uint, S_IRUGO); 137module_param_named(max_queues, xen_blkif_max_queues, uint, 0444);
139MODULE_PARM_DESC(max_queues, "Maximum number of hardware queues/rings used per virtual disk"); 138MODULE_PARM_DESC(max_queues, "Maximum number of hardware queues/rings used per virtual disk");
140 139
141/* 140/*
@@ -143,7 +142,7 @@ MODULE_PARM_DESC(max_queues, "Maximum number of hardware queues/rings used per v
143 * backend, 4KB page granularity is used. 142 * backend, 4KB page granularity is used.
144 */ 143 */
145static unsigned int xen_blkif_max_ring_order; 144static unsigned int xen_blkif_max_ring_order;
146module_param_named(max_ring_page_order, xen_blkif_max_ring_order, int, S_IRUGO); 145module_param_named(max_ring_page_order, xen_blkif_max_ring_order, int, 0444);
147MODULE_PARM_DESC(max_ring_page_order, "Maximum order of pages to be used for the shared ring"); 146MODULE_PARM_DESC(max_ring_page_order, "Maximum order of pages to be used for the shared ring");
148 147
149#define BLK_RING_SIZE(info) \ 148#define BLK_RING_SIZE(info) \