Debian Codegraph @

lib/request-config.c

raw symbols SCIP
1 // SPDX-License-Identifier: LGPL-2.1-or-latercxx . . $ `<file>/lib/request-config.c`/
2 // SPDX-FileCopyrightText: 2021 Bartosz Golaszewski <[email protected]>
3
4 #include <assert.h>
5 #include <errno.h>
6 #include <gpiod.h>cxx . . $ `<file>/include/gpiod.h`/
7 #include <stdlib.h>
8 #include <string.h>
9
10 #include "internal.h"cxx . . $ `<file>/lib/internal.h`/
11
12 struct gpiod_request_configcxx . . $ gpiod_request_config# {
13 char consumercxx . . $ gpiod_request_config#consumer.[GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`!];
14 size_t event_buffer_sizecxx . . $ gpiod_request_config#event_buffer_size.;
15 };
16
17 GPIOD_APIcxx . . $ `lib/internal.h:15:9`! struct gpiod_request_configcxx . . $ gpiod_request_config# *gpiod_request_config_newcxx . . $ gpiod_request_config_new(bdc300a66be3a9af).(void)
18 {
19 struct gpiod_request_configcxx . . $ gpiod_request_config# *config;
20
21 config = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(*config));
22 if (!config)
23 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
24
25 memsetcxx . . $ memset(d1de1e4fb215f1c6).(config, 0, sizeof(*config));
26
27 return config;
28 }
29
30 GPIOD_APIcxx . . $ `lib/internal.h:15:9`! void gpiod_request_config_freecxx . . $ gpiod_request_config_free(a44c84f50ea26a21).(struct gpiod_request_configcxx . . $ gpiod_request_config# *config)
31 {
32 freecxx . . $ free(5d22bdacc48458e8).(config);
33 }
34
35 GPIOD_APIcxx . . $ `lib/internal.h:15:9`! void
36 gpiod_request_config_set_consumercxx . . $ gpiod_request_config_set_consumer(7882cdb366526dc2).(struct gpiod_request_configcxx . . $ gpiod_request_config# *config,
37 const char *consumer)
38 {
39 assertcxx . . $ `<external>/4398592474888995393/assert.h:156:12`!(config);
40
41 if (!consumer) {
42 config->consumercxx . . $ gpiod_request_config#consumer.[0] = '\0';
43 } else {
44 strncpycxx . . $ strncpy(255158a415b673b0).(config->consumercxx . . $ gpiod_request_config#consumer., consumer, GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`! - 1);
45 config->consumercxx . . $ gpiod_request_config#consumer.[GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`! - 1] = '\0';
46 }
47 }
48
49 GPIOD_APIcxx . . $ `lib/internal.h:15:9`! const char *
50 gpiod_request_config_get_consumercxx . . $ gpiod_request_config_get_consumer(81bc8e56b2d0bc13).(struct gpiod_request_configcxx . . $ gpiod_request_config# *config)
51 {
52 assertcxx . . $ `<external>/4398592474888995393/assert.h:156:12`!(config);
53
54 return config->consumercxx . . $ gpiod_request_config#consumer.[0] == '\0' ? NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! : config->consumercxx . . $ gpiod_request_config#consumer.;
55 }
56
57 GPIOD_APIcxx . . $ `lib/internal.h:15:9`! void
58 gpiod_request_config_set_event_buffer_sizecxx . . $ gpiod_request_config_set_event_buffer_size(274faea03fa6bd28).(struct gpiod_request_configcxx . . $ gpiod_request_config# *config,
59 size_t event_buffer_size)
60 {
61 assertcxx . . $ `<external>/4398592474888995393/assert.h:156:12`!(config);
62
63 config->event_buffer_sizecxx . . $ gpiod_request_config#event_buffer_size. = event_buffer_size;
64 }
65
66 GPIOD_APIcxx . . $ `lib/internal.h:15:9`! size_t
67 gpiod_request_config_get_event_buffer_sizecxx . . $ gpiod_request_config_get_event_buffer_size(1f914bc41fde4e0e).(struct gpiod_request_configcxx . . $ gpiod_request_config# *config)
68 {
69 assertcxx . . $ `<external>/4398592474888995393/assert.h:156:12`!(config);
70
71 return config->event_buffer_sizecxx . . $ gpiod_request_config#event_buffer_size.;
72 }
73
74 void gpiod_request_config_to_uapicxx . . $ gpiod_request_config_to_uapi(a141c21c0e74b916).(struct gpiod_request_configcxx . . $ gpiod_request_config# *config,
75 struct gpio_v2_line_requestcxx . . $ gpio_v2_line_request# *uapi_req)
76 {
77 strcpycxx . . $ strcpy(b7b3a83273496486).(uapi_req->consumercxx . . $ gpio_v2_line_request#consumer., config->consumercxx . . $ gpiod_request_config#consumer.);
78 uapi_req->event_buffer_sizecxx . . $ gpio_v2_line_request#event_buffer_size. = config->event_buffer_sizecxx . . $ gpiod_request_config#event_buffer_size.;
79 }