[include][console] split lib/console.h into two

TL;DR most uses of lib/console.h -> lk/console_cmd.h

Move the part that lets a piece of code somewhere in the system to
define a console command from the actual lib/console api to start an
instance of the console. Move in almost every place the user of the
console command definition to the new header, lk/console_cmd.h which is
always in the include path.

Also remove most uses of testing for WITH_LIB_CONSOLE since you can
almost always just safely define it and then let the linker remove it.
This commit is contained in:
Travis Geiselbrecht
2019-07-13 16:56:33 -07:00
parent 35a8d555a3
commit 6cb02526b7
48 changed files with 88 additions and 179 deletions

View File

@@ -10,7 +10,7 @@
#include <lk/debug.h>
#include <lk/trace.h>
#include <arch/ops.h>
#include <lib/console.h>
#include <lk/console_cmd.h>
/*
* These sample values come from publication "FIPS-197", Appendix C.1

View File

@@ -20,8 +20,6 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#if WITH_LIB_CONSOLE
#include <ctype.h>
#include <lk/debug.h>
#include <stdlib.h>
@@ -30,7 +28,7 @@
#include <platform.h>
#include <lib/cksum.h>
#include <lib/console.h>
#include <lk/console_cmd.h>
static int cmd_crc16(int argc, const cmd_args *argv);
static int cmd_crc32(int argc, const cmd_args *argv);
@@ -139,5 +137,3 @@ static int cmd_cksum_bench(int argc, const cmd_args *argv)
free(buf);
return 0;
}
#endif // WITH_LIB_CONSOLE

View File

@@ -21,8 +21,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#if defined(WITH_LIB_CONSOLE)
#include <lib/console.h>
#include <lk/console_cmd.h>
#include <stdio.h>
#include <string.h>
@@ -66,5 +65,3 @@ STATIC_COMMAND_START
STATIC_COMMAND("net", "net toolbox", &net_cmd)
STATIC_COMMAND_END(net);
#endif