Commit c642ea26 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Daniel Borkmann
Browse files

tools: bpftool: fold hex keyword in command help



Instead of spelling [hex] BYTES everywhere use DATA as keyword
for generalized value.  This will help us keep the messages
concise when longer command are added in the future.  It will
also be useful once BTF support comes.  We will only have to
change the definition of DATA.

Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent b4264c96
Loading
Loading
Loading
Loading
+10 −9
Original line number Original line Diff line number Diff line
@@ -23,16 +23,17 @@ MAP COMMANDS


|	**bpftool** **map { show | list }**   [*MAP*]
|	**bpftool** **map { show | list }**   [*MAP*]
|	**bpftool** **map dump**    *MAP*
|	**bpftool** **map dump**    *MAP*
|	**bpftool** **map update**  *MAP*  **key** [**hex**] *BYTES*   **value** [**hex**] *VALUE* [*UPDATE_FLAGS*]
|	**bpftool** **map update**  *MAP*  **key** *DATA*   **value** *VALUE* [*UPDATE_FLAGS*]
|	**bpftool** **map lookup**  *MAP*  **key** [**hex**] *BYTES*
|	**bpftool** **map lookup**  *MAP*  **key** *DATA*
|	**bpftool** **map getnext** *MAP* [**key** [**hex**] *BYTES*]
|	**bpftool** **map getnext** *MAP* [**key** *DATA*]
|	**bpftool** **map delete**  *MAP*  **key** [**hex**] *BYTES*
|	**bpftool** **map delete**  *MAP*  **key** *DATA*
|	**bpftool** **map pin**     *MAP*  *FILE*
|	**bpftool** **map pin**     *MAP*  *FILE*
|	**bpftool** **map help**
|	**bpftool** **map help**
|
|
|	*MAP* := { **id** *MAP_ID* | **pinned** *FILE* }
|	*MAP* := { **id** *MAP_ID* | **pinned** *FILE* }
|	*DATA* := { [**hex**] *BYTES* }
|	*PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* }
|	*PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* }
|	*VALUE* := { *BYTES* | *MAP* | *PROG* }
|	*VALUE* := { *DATA* | *MAP* | *PROG* }
|	*UPDATE_FLAGS* := { **any** | **exist** | **noexist** }
|	*UPDATE_FLAGS* := { **any** | **exist** | **noexist** }


DESCRIPTION
DESCRIPTION
@@ -48,7 +49,7 @@ DESCRIPTION
	**bpftool map dump**    *MAP*
	**bpftool map dump**    *MAP*
		  Dump all entries in a given *MAP*.
		  Dump all entries in a given *MAP*.


	**bpftool map update**  *MAP*  **key** [**hex**] *BYTES*   **value** [**hex**] *VALUE* [*UPDATE_FLAGS*]
	**bpftool map update**  *MAP*  **key** *DATA*   **value** *VALUE* [*UPDATE_FLAGS*]
		  Update map entry for a given *KEY*.
		  Update map entry for a given *KEY*.


		  *UPDATE_FLAGS* can be one of: **any** update existing entry
		  *UPDATE_FLAGS* can be one of: **any** update existing entry
@@ -61,13 +62,13 @@ DESCRIPTION
		  the bytes are parsed as decimal values, unless a "0x" prefix
		  the bytes are parsed as decimal values, unless a "0x" prefix
		  (for hexadecimal) or a "0" prefix (for octal) is provided.
		  (for hexadecimal) or a "0" prefix (for octal) is provided.


	**bpftool map lookup**  *MAP*  **key** [**hex**] *BYTES*
	**bpftool map lookup**  *MAP*  **key** *DATA*
		  Lookup **key** in the map.
		  Lookup **key** in the map.


	**bpftool map getnext** *MAP* [**key** [**hex**] *BYTES*]
	**bpftool map getnext** *MAP* [**key** *DATA*]
		  Get next key.  If *key* is not specified, get first key.
		  Get next key.  If *key* is not specified, get first key.


	**bpftool map delete**  *MAP*  **key** [**hex**] *BYTES*
	**bpftool map delete**  *MAP*  **key** *DATA*
		  Remove entry from the map.
		  Remove entry from the map.


	**bpftool map pin**     *MAP*  *FILE*
	**bpftool map pin**     *MAP*  *FILE*
+7 −6
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (C) 2017 Netronome Systems, Inc.
 * Copyright (C) 2017-2018 Netronome Systems, Inc.
 *
 *
 * This software is dual licensed under the GNU General License Version 2,
 * This software is dual licensed under the GNU General License Version 2,
 * June 1991 as shown in the file COPYING in the top-level directory of this
 * June 1991 as shown in the file COPYING in the top-level directory of this
@@ -874,16 +874,17 @@ static int do_help(int argc, char **argv)
	fprintf(stderr,
	fprintf(stderr,
		"Usage: %s %s { show | list }   [MAP]\n"
		"Usage: %s %s { show | list }   [MAP]\n"
		"       %s %s dump    MAP\n"
		"       %s %s dump    MAP\n"
		"       %s %s update  MAP  key [hex] BYTES value [hex] VALUE [UPDATE_FLAGS]\n"
		"       %s %s update  MAP  key DATA value VALUE [UPDATE_FLAGS]\n"
		"       %s %s lookup  MAP  key [hex] BYTES\n"
		"       %s %s lookup  MAP  key DATA\n"
		"       %s %s getnext MAP [key [hex] BYTES]\n"
		"       %s %s getnext MAP [key DATA]\n"
		"       %s %s delete  MAP  key [hex] BYTES\n"
		"       %s %s delete  MAP  key DATA\n"
		"       %s %s pin     MAP  FILE\n"
		"       %s %s pin     MAP  FILE\n"
		"       %s %s help\n"
		"       %s %s help\n"
		"\n"
		"\n"
		"       MAP := { id MAP_ID | pinned FILE }\n"
		"       MAP := { id MAP_ID | pinned FILE }\n"
		"       DATA := { [hex] BYTES }\n"
		"       " HELP_SPEC_PROGRAM "\n"
		"       " HELP_SPEC_PROGRAM "\n"
		"       VALUE := { BYTES | MAP | PROG }\n"
		"       VALUE := { DATA | MAP | PROG }\n"
		"       UPDATE_FLAGS := { any | exist | noexist }\n"
		"       UPDATE_FLAGS := { any | exist | noexist }\n"
		"       " HELP_SPEC_OPTIONS "\n"
		"       " HELP_SPEC_OPTIONS "\n"
		"",
		"",