summaryrefslogtreecommitdiff
path: root/cmd/sbc_harness/config/config.h
blob: c5ba6d89e0347bade3373e190aece5c4f26cbf49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* config.h - Compile-time configuration for sbc_harness
 *
 * Copyright (C) 2024  Luke T. Shumaker <lukeshu@lukeshu.com>
 * SPDX-Licence-Identifier: AGPL-3.0-or-later
 */

#if (defined(USE_CONFIG_NETIO_POSIX) || defined(USE_CONFIG_COROUTINE)) && !defined(CONFIG_NETIO_NUM_CONNS)
#  define CONFIG_NETIO_NUM_CONNS        8
#endif
#if defined(USE_CONFIG_NETIO_POSIX) && !defined(_CONFIG_H_NETIO_POSIX_)
#define _CONFIG_H_NETIO_POSIX_
#  define CONFIG_NETIO_ISLINUX          1 /* can we use Linux-kernel-specific fcntls?  */
#  define CONFIG_NETIO_NUM_PORTS        1
#endif

#if defined(USE_CONFIG_9P) && !defined(_CONFIG_H_9P_)
#define _CONFIG_H_9P_
#  define CONFIG_9P_PORT                564
   /**
    * This max-msg-size is sized so that a Twrite message can return
    * 8KiB of data.
    *
    * This is the same as the default in Plan 9 4e's lib9p; it has the
    * comment that "24" is "ample room for Twrite/Rread header
    * (iounit)".  In fact, the Twrite header is only 23 bytes
    * ("size[4] Twrite[1] tag[2] fid[4] offset[8] count[4]") and the
    * Rread header is even shorter at 11 bytes ("size[4] Rread[1]
    * tag[2] count[4]"), so "24" appears to be the size of the Twrite
    * header rounded up to a nice round number.
    *
    * In older versions of 9P ("9P1"), the max message size was
    * defined as part of the protocol specification rather than
    * negotiated.  In Plan 9 1e it was (8*1024)+128, and was bumped to
    * (8*1024)+160 in 2e and 3e.
    */
#  define CONFIG_9P_MAX_MSG_SIZE        ((4*1024)+24)
   /**
    * Maximum host-data-structure size.  A message may be larger in
    * unmarshaled-host-structures than marshaled-net-bytes due to (1)
    * struct padding, (2) nul-terminator byes for strings.
    */
#  define CONFIG_9P_MAX_HOSTMSG_SIZE    CONFIG_9P_MAX_MSG_SIZE+16
#  define CONFIG_9P_MAX_FIDS            16
#endif
#if (defined(USE_CONFIG_9P) || defined(USE_CONFIG_COROUTINE)) && !defined(CONFIG_9P_MAX_REQS)
#  define CONFIG_9P_MAX_REQS            2
#endif
#if (defined(USE_CONFIG_9P) || defined(_USE_CONFIG_9P_ERR)) && !defined(CONFIG_9P_MAX_ERR_SIZE)
#  define CONFIG_9P_MAX_ERR_SIZE        128 /* 128 is what Plan 9 4e uses */
#endif

#if defined(USE_CONFIG_COROUTINE) && !defined(_CONFIG_H_COROUTINE_)
#define _CONFIG_H_COROUTINE_
#  define CONFIG_COROUTINE_DEFAULT_STACK_SIZE    (32*1024)
#  define CONFIG_COROUTINE_MEASURE_STACK         1 /* bool */
#  define CONFIG_COROUTINE_PROTECT_STACK         1 /* bool */
#  define CONFIG_COROUTINE_DEBUG                 0 /* bool */
#  define CONFIG_COROUTINE_VALGRIND              1 /* bool */
#  define CONFIG_COROUTINE_NUM                   (1                          /* usb_common   */ +\
                                                  1                          /* usb_keyboard */ +\
                                                  CONFIG_NETIO_NUM_CONNS     /* accept+read  */ +\
                                                  (CONFIG_9P_MAX_REQS*CONFIG_NETIO_NUM_CONNS) /* work+write   */ )
#endif