1 // Copyright 2016 The Fuchsia Authors 2 // 3 // Use of this source code is governed by a MIT-style 4 // license that can be found in the LICENSE file or at 5 // https://opensource.org/licenses/MIT 6 7 #pragma once 8 9 #include <stdbool.h> 10 #include <stdint.h> 11 #include <sys/types.h> 12 #include <zircon/compiler.h> 13 14 __BEGIN_CDECLS 15 16 #define CMDLINE_MAX 4096 17 18 // initialize commandline from str 19 // if string is not null terminated, it will be limited to CMDLINE_MAX 20 void cmdline_append(const char* str); 21 22 // look for "name" or "name=..." in the commandline 23 // returns NULL if not found, asciiz string if found 24 const char* cmdline_get(const char* key); 25 26 // return _default if key not found 27 // return false if key's value is "0", "false", "off" 28 // return true otherwise 29 bool cmdline_get_bool(const char* key, bool _default); 30 31 // return _default if key not found or invalid 32 // return they key's integer value otherwise 33 uint32_t cmdline_get_uint32(const char* key, uint32_t _default); 34 35 // return _default if key not found or invalid 36 // return they key's integer value otherwise 37 uint64_t cmdline_get_uint64(const char* key, uint64_t _default); 38 39 // internal storage for the command line 40 extern char __kernel_cmdline[CMDLINE_MAX]; 41 extern size_t __kernel_cmdline_size; 42 extern size_t __kernel_cmdline_count; 43 44 __END_CDECLS 45