aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2015-06-22 06:24:48 -0400
committerIlya Dryomov <idryomov@gmail.com>2015-06-25 11:30:54 -0400
commit210c104c544e5be321fc5b78e74b596d36820332 (patch)
treeed9d5eedd19b9770eff6861e596a6a6328313b2c
parente1966b49446a43994c3f25a07d0eb4d05660b429 (diff)
rbd: terminate rbd_opts_tokens with Opt_err
Also nuke useless Opt_last_bool and don't break lines unnecessarily. Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Alex Elder <elder@linaro.org>
-rw-r--r--drivers/block/rbd.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index bc88fbcb9715..4de8c9167c4b 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -724,7 +724,7 @@ static struct rbd_client *rbd_client_find(struct ceph_options *ceph_opts)
724} 724}
725 725
726/* 726/*
727 * mount options 727 * (Per device) rbd map options
728 */ 728 */
729enum { 729enum {
730 Opt_last_int, 730 Opt_last_int,
@@ -733,8 +733,7 @@ enum {
733 /* string args above */ 733 /* string args above */
734 Opt_read_only, 734 Opt_read_only,
735 Opt_read_write, 735 Opt_read_write,
736 /* Boolean args above */ 736 Opt_err
737 Opt_last_bool,
738}; 737};
739 738
740static match_table_t rbd_opts_tokens = { 739static match_table_t rbd_opts_tokens = {
@@ -744,8 +743,7 @@ static match_table_t rbd_opts_tokens = {
744 {Opt_read_only, "ro"}, /* Alternate spelling */ 743 {Opt_read_only, "ro"}, /* Alternate spelling */
745 {Opt_read_write, "read_write"}, 744 {Opt_read_write, "read_write"},
746 {Opt_read_write, "rw"}, /* Alternate spelling */ 745 {Opt_read_write, "rw"}, /* Alternate spelling */
747 /* Boolean args above */ 746 {Opt_err, NULL}
748 {-1, NULL}
749}; 747};
750 748
751struct rbd_options { 749struct rbd_options {
@@ -761,22 +759,15 @@ static int parse_rbd_opts_token(char *c, void *private)
761 int token, intval, ret; 759 int token, intval, ret;
762 760
763 token = match_token(c, rbd_opts_tokens, argstr); 761 token = match_token(c, rbd_opts_tokens, argstr);
764 if (token < 0)
765 return -EINVAL;
766
767 if (token < Opt_last_int) { 762 if (token < Opt_last_int) {
768 ret = match_int(&argstr[0], &intval); 763 ret = match_int(&argstr[0], &intval);
769 if (ret < 0) { 764 if (ret < 0) {
770 pr_err("bad mount option arg (not int) " 765 pr_err("bad mount option arg (not int) at '%s'\n", c);
771 "at '%s'\n", c);
772 return ret; 766 return ret;
773 } 767 }
774 dout("got int token %d val %d\n", token, intval); 768 dout("got int token %d val %d\n", token, intval);
775 } else if (token > Opt_last_int && token < Opt_last_string) { 769 } else if (token > Opt_last_int && token < Opt_last_string) {
776 dout("got string token %d val %s\n", token, 770 dout("got string token %d val %s\n", token, argstr[0].from);
777 argstr[0].from);
778 } else if (token > Opt_last_string && token < Opt_last_bool) {
779 dout("got Boolean token %d\n", token);
780 } else { 771 } else {
781 dout("got token %d\n", token); 772 dout("got token %d\n", token);
782 } 773 }
@@ -789,9 +780,10 @@ static int parse_rbd_opts_token(char *c, void *private)
789 rbd_opts->read_only = false; 780 rbd_opts->read_only = false;
790 break; 781 break;
791 default: 782 default:
792 rbd_assert(false); 783 /* libceph prints "bad option" msg */
793 break; 784 return -EINVAL;
794 } 785 }
786
795 return 0; 787 return 0;
796} 788}
797 789