Skip to content

Commit 8d03288

Browse files
author
Khang Nguyen
committed
mctpd: Add meson build option to disable bus owner mode
Currently, mctpd defaults to run as a bus owner, so ctx->bus_owner is always true. This commit adds is-bus-owner build option to meson config so we can disable this mode without editing the source code. Signed-off-by: Khang Nguyen <[email protected]>
1 parent 237fa96 commit 8d03288

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ conf.set10('HAVE_LINUX_MCTP_H',
2020
cc.has_header('linux/mctp.h'),
2121
description: 'Is linux/mctp.h available?'
2222
)
23+
conf.set10('IS_BUS_OWNER',
24+
get_option('is-bus-owner'),
25+
description: 'Whether we are running as the bus owner'
26+
)
2327

2428
config_h = configure_file(
2529
output: 'config.h',

meson_options.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
option(
2+
'is-bus-owner',
3+
type: 'boolean',
4+
value: true,
5+
description: '''Whether we are running as the bus owner'''
6+
)

src/mctpd.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Copyright (c) 2021 Google
77
*/
88

9+
#include "config.h"
910
#define _GNU_SOURCE
1011

1112
#include <sys/socket.h>
@@ -3149,8 +3150,8 @@ static int fill_uuid(ctx *ctx)
31493150
static int setup_config(ctx *ctx)
31503151
{
31513152
int rc;
3152-
// TODO: this will go in a config file or arguments.
3153-
ctx->bus_owner = true;
3153+
// configure this using meson build option
3154+
ctx->bus_owner = IS_BUS_OWNER;
31543155
rc = fill_uuid(ctx);
31553156
if (rc < 0)
31563157
return rc;

0 commit comments

Comments
 (0)