From: Ben Pfaff Date: Tue, 10 Mar 2009 23:14:11 +0000 (-0700) Subject: dpctl: New command "get-name", for symmetry with "get-idx". X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbc58ce3d9313a82116c3f93b61b06f2ff022cd8;p=openvswitch dpctl: New command "get-name", for symmetry with "get-idx". The utility of both commands is now seriously in question, however, since all dpctl commands now accept both names and numbers. --- diff --git a/utilities/dpctl.c b/utilities/dpctl.c index b934e6a0..a01c04f5 100644 --- a/utilities/dpctl.c +++ b/utilities/dpctl.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -297,6 +298,18 @@ do_get_idx(const struct settings *s UNUSED, int argc UNUSED, char *argv[]) dpif_close(&dpif); } +static void +do_get_name(const struct settings *s UNUSED, int argc UNUSED, char *argv[]) +{ + struct dpif dpif; + char name[IF_NAMESIZE + 1]; + + run(dpif_open(argv[1], &dpif), "opening datapath"); + run(dpif_get_name(&dpif, name, sizeof name), "getting datapath name"); + puts(name); + dpif_close(&dpif); +} + static void do_add_dp(const struct settings *s UNUSED, int argc UNUSED, char *argv[]) { @@ -1520,6 +1533,7 @@ static struct command all_commands[] = { { "addif", 2, INT_MAX, do_add_port }, { "delif", 2, INT_MAX, do_del_port }, { "get-idx", 1, 1, do_get_idx }, + { "get-name", 1, 1, do_get_name }, { "showdp", 0, INT_MAX, do_show_dp }, #endif