aboutsummaryrefslogtreecommitdiff
path: root/wmediumd
diff options
context:
space:
mode:
authorSeungjae Yoo <seungjaeyoo@google.com>2023-03-24 15:53:13 +0900
committerSeungjae Yoo <seungjaeyoo@google.com>2023-03-28 11:13:25 +0900
commit18969969454579fc99a2d37552b76cc382749854 (patch)
tree27b47e8e6001771f58c07b91601d3bcc5dd8722a /wmediumd
parent33448037f466aacaed518b1b611f9c25d3547aa7 (diff)
downloadwmediumd-18969969454579fc99a2d37552b76cc382749854.tar.gz
Introduce extern "C" for existing main func, now main func is cpp.
Bug: 273384914 Test: cvd start and checking if wifi works well. Change-Id: Ic9b930a205fa5b43e894bbf774fe7aa50671ba8f
Diffstat (limited to 'wmediumd')
-rw-r--r--wmediumd/inc/usfstl/list.h14
-rw-r--r--wmediumd/list.h53
-rw-r--r--wmediumd/wmediumd.c2
-rw-r--r--wmediumd/wmediumd.h10
4 files changed, 44 insertions, 35 deletions
diff --git a/wmediumd/inc/usfstl/list.h b/wmediumd/inc/usfstl/list.h
index a07c9e9..079a591 100644
--- a/wmediumd/inc/usfstl/list.h
+++ b/wmediumd/inc/usfstl/list.h
@@ -37,18 +37,18 @@ static inline void usfstl_list_init(struct usfstl_list *list)
}
static inline void usfstl_list_insert_before(struct usfstl_list_entry *existing,
- struct usfstl_list_entry *new)
+ struct usfstl_list_entry *new_entry)
{
- new->prev = existing->prev;
- existing->prev->next = new;
- existing->prev = new;
- new->next = existing;
+ new_entry->prev = existing->prev;
+ existing->prev->next = new_entry;
+ existing->prev = new_entry;
+ new_entry->next = existing;
}
static inline void usfstl_list_append(struct usfstl_list *list,
- struct usfstl_list_entry *new)
+ struct usfstl_list_entry *new_entry)
{
- usfstl_list_insert_before(&list->list, new);
+ usfstl_list_insert_before(&list->list, new_entry);
}
#define usfstl_list_item(element, type, member) \
diff --git a/wmediumd/list.h b/wmediumd/list.h
index a6212af..8671c64 100644
--- a/wmediumd/list.h
+++ b/wmediumd/list.h
@@ -7,9 +7,8 @@
/* Stripped down from Linux ~5.5 */
-#define POISON_POINTER_DELTA 0
-#define LIST_POISON1 ((void *) 0x00100100 + POISON_POINTER_DELTA)
-#define LIST_POISON2 ((void *) 0x00200200 + POISON_POINTER_DELTA)
+#define LIST_POISON1 ((void *) 0x00100100)
+#define LIST_POISON2 ((void *) 0x00200200)
#define WRITE_ONCE(p, v) do { p = v; } while (0)
#define READ_ONCE(p) (p)
#ifndef container_of
@@ -48,7 +47,7 @@ static inline void INIT_LIST_HEAD(struct list_head *list)
list->prev = list;
}
-static inline bool __list_add_valid(struct list_head *new,
+static inline bool __list_add_valid(struct list_head *new_elem,
struct list_head *prev,
struct list_head *next)
{
@@ -65,44 +64,44 @@ static inline bool __list_del_entry_valid(struct list_head *entry)
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
-static inline void __list_add(struct list_head *new,
+static inline void __list_add(struct list_head *new_elem,
struct list_head *prev,
struct list_head *next)
{
- if (!__list_add_valid(new, prev, next))
+ if (!__list_add_valid(new_elem, prev, next))
return;
- next->prev = new;
- new->next = next;
- new->prev = prev;
- WRITE_ONCE(prev->next, new);
+ next->prev = new_elem;
+ new_elem->next = next;
+ new_elem->prev = prev;
+ WRITE_ONCE(prev->next, new_elem);
}
/**
* list_add - add a new entry
- * @new: new entry to be added
+ * @new_elem: new entry to be added
* @head: list head to add it after
*
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
-static inline void list_add(struct list_head *new, struct list_head *head)
+static inline void list_add(struct list_head *new_elem, struct list_head *head)
{
- __list_add(new, head, head->next);
+ __list_add(new_elem, head, head->next);
}
/**
* list_add_tail - add a new entry
- * @new: new entry to be added
+ * @new_elem: new entry to be added
* @head: list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
-static inline void list_add_tail(struct list_head *new, struct list_head *head)
+static inline void list_add_tail(struct list_head *new_elem, struct list_head *head)
{
- __list_add(new, head->prev, head);
+ __list_add(new_elem, head->prev, head);
}
/*
@@ -149,37 +148,37 @@ static inline void __list_del_entry(struct list_head *entry)
static inline void list_del(struct list_head *entry)
{
__list_del_entry(entry);
- entry->next = LIST_POISON1;
- entry->prev = LIST_POISON2;
+ entry->next = (struct list_head *)LIST_POISON1;
+ entry->prev = (struct list_head *)LIST_POISON2;
}
/**
* list_replace - replace old entry by new one
* @old : the element to be replaced
- * @new : the new element to insert
+ * @new_elem : the new element to insert
*
* If @old was empty, it will be overwritten.
*/
static inline void list_replace(struct list_head *old,
- struct list_head *new)
+ struct list_head *new_elem)
{
- new->next = old->next;
- new->next->prev = new;
- new->prev = old->prev;
- new->prev->next = new;
+ new_elem->next = old->next;
+ new_elem->next->prev = new_elem;
+ new_elem->prev = old->prev;
+ new_elem->prev->next = new_elem;
}
/**
* list_replace_init - replace old entry by new one and initialize the old one
* @old : the element to be replaced
- * @new : the new element to insert
+ * @new_elem : the new element to insert
*
* If @old was empty, it will be overwritten.
*/
static inline void list_replace_init(struct list_head *old,
- struct list_head *new)
+ struct list_head *new_elem)
{
- list_replace(old, new);
+ list_replace(old, new_elem);
INIT_LIST_HEAD(old);
}
diff --git a/wmediumd/wmediumd.c b/wmediumd/wmediumd.c
index 5f456a3..ac2723a 100644
--- a/wmediumd/wmediumd.c
+++ b/wmediumd/wmediumd.c
@@ -1871,7 +1871,7 @@ static void init_pcapng(struct wmediumd *ctx, const char *filename)
#define VIRTIO_F_VERSION_1 32
#endif
-int main(int argc, char *argv[])
+int wmediumd_main(int argc, char *argv[])
{
int opt;
struct wmediumd ctx = {};
diff --git a/wmediumd/wmediumd.h b/wmediumd/wmediumd.h
index c5459bc..c40f111 100644
--- a/wmediumd/wmediumd.h
+++ b/wmediumd/wmediumd.h
@@ -306,4 +306,14 @@ int w_flogf(struct wmediumd *ctx, u8 level, FILE *stream, const char *format, ..
int index_to_rate(size_t index, u32 freq);
int get_max_index(void);
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int wmediumd_main(int argc, char *argv[]);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* WMEDIUMD_H_ */