]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/blobdiff - tc/em_canid.c
em_canid: Renamed em_can to em_canid;
[lisovros/iproute2_canprio.git] / tc / em_canid.c
similarity index 77%
rename from tc/em_can.c
rename to tc/em_canid.c
index fd6aab6d6766276af31023817391192113f2870f..83af57751e1679054b3447ae84e1315525a64342 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * em_can.c
+ * em_canid.c
  *
  *             This program is free software; you can distribute it and/or
  *             modify it under the terms of the GNU General Public License
  *             as published by the Free Software Foundation; either version
  *             2 of the License, or (at your option) any later version.
  *
- * Authors:
+ * Authors: Rostislav Lisovy <lisovy@gmail.com>
  */
 
 #include <stdio.h>
 
 #define EM_CAN_RULES_SIZE                              32
 
-extern struct ematch_util can_ematch_util;
+extern struct ematch_util canid_ematch_util;
 
-static void can_print_usage(FILE *fd)
+static void canid_print_usage(FILE *fd)
 {
        fprintf(fd,
            "Usage: can(MATCH)\n" \
            "where:  MATCH = {sff CANID | eff CANID}\n" \
            "        CANID := ID:MASK\n" \
            "\n" \
-           "Example: u32(sff 0x123 sff 0x124 sff 0x125:0xf)\n");
+           "Example: canid(sff 0x123 sff 0x124 sff 0x125:0xf)\n");
 }
 
-static int can_parse_rule(struct can_filter *rule, struct bstr *a, int iseff)
+static int canid_parse_rule(struct can_filter *rule, struct bstr *a, int iseff)
 {
        unsigned int can_id = 0;
        unsigned int can_mask = 0;
@@ -54,7 +54,7 @@ static int can_parse_rule(struct can_filter *rule, struct bstr *a, int iseff)
        return 0;
 }
 
-static int can_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
+static int canid_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
                          struct bstr *args)
 {
        struct bstr *a;
@@ -66,7 +66,7 @@ static int can_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
        memset(&rules_raw, 0, sizeof(rules_raw));
 
 #define PARSE_ERR(CARG, FMT, ARGS...) \
-       em_parse_error(EINVAL, args, CARG, &can_ematch_util, FMT ,##ARGS)
+       em_parse_error(EINVAL, args, CARG, &canid_ematch_util, FMT ,##ARGS)
 
        if (args == NULL)
                return PARSE_ERR(args, "can: missing arguments");
@@ -82,7 +82,7 @@ static int can_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
        if (a == NULL)
                return PARSE_ERR(a, "can: missing key");
 
-       ret = can_parse_rule(&rules_raw[0], a, iseff);
+       ret = canid_parse_rule(&rules_raw[0], a, iseff);
        if (ret == -1)
                return PARSE_ERR(a, "can: Improperly formed CAN ID & mask\n");
 
@@ -97,7 +97,7 @@ static int can_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
                if (a == NULL)
                        return PARSE_ERR(a, "can: missing argument");
 
-               ret = can_parse_rule(&rules_raw[i], a, iseff);
+               ret = canid_parse_rule(&rules_raw[i], a, iseff);
                if (ret == -1)
                        return PARSE_ERR(a, "can: Improperly formed CAN ID & mask\n");
        }
@@ -113,7 +113,7 @@ static int can_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
        return 0;
 }
 
-static int can_print_eopt(FILE *fd, struct tcf_ematch_hdr *hdr, void *data,
+static int canid_print_eopt(FILE *fd, struct tcf_ematch_hdr *hdr, void *data,
                          int data_len)
 {
        struct can_filter *conf = data; /* Array with rules, fixed size EM_CAN_RULES_SIZE */
@@ -134,10 +134,10 @@ static int can_print_eopt(FILE *fd, struct tcf_ematch_hdr *hdr, void *data,
        return 0;
 }
 
-struct ematch_util can_ematch_util = {
-       .kind = "can",
-       .kind_num = TCF_EM_CAN,
-       .parse_eopt = can_parse_eopt,
-       .print_eopt = can_print_eopt,
-       .print_usage = can_print_usage
+struct ematch_util canid_ematch_util = {
+       .kind = "canid",
+       .kind_num = TCF_EM_CANID,
+       .parse_eopt = canid_parse_eopt,
+       .print_eopt = canid_print_eopt,
+       .print_usage = canid_print_usage
 };