make ubusd_get_client_by_id static

This commit is contained in:
Felix Fietkau 2011-02-07 02:40:40 +01:00
parent c4c0a2256d
commit 1643f728e7
3 changed files with 13 additions and 14 deletions

13
ubusd.c
View file

@ -12,7 +12,7 @@
#include "ubusd.h" #include "ubusd.h"
static struct avl_tree clients; struct avl_tree clients;
static struct ubus_msg_buf *ubus_msg_unshare(struct ubus_msg_buf *ub) static struct ubus_msg_buf *ubus_msg_unshare(struct ubus_msg_buf *ub)
{ {
@ -249,17 +249,6 @@ disconnect:
handle_client_disconnect(cl); handle_client_disconnect(cl);
} }
struct ubus_client *ubusd_get_client_by_id(uint32_t id)
{
struct ubus_id *clid;
clid = ubus_find_id(&clients, id);
if (!clid)
return NULL;
return container_of(clid, struct ubus_client, id);
}
static bool get_next_connection(int fd) static bool get_next_connection(int fd)
{ {
struct ubus_client *cl; struct ubus_client *cl;

View file

@ -13,6 +13,7 @@
#define UBUS_OBJ_HASH_BITS 4 #define UBUS_OBJ_HASH_BITS 4
extern struct blob_buf b; extern struct blob_buf b;
extern struct avl_tree clients;
struct ubus_msg_buf { struct ubus_msg_buf {
uint32_t refcount; /* ~0: uses external data buffer */ uint32_t refcount; /* ~0: uses external data buffer */
@ -48,8 +49,6 @@ void ubus_msg_send(struct ubus_client *cl, struct ubus_msg_buf *ub, bool free);
struct ubus_msg_buf *ubus_msg_ref(struct ubus_msg_buf *ub); struct ubus_msg_buf *ubus_msg_ref(struct ubus_msg_buf *ub);
void ubus_msg_free(struct ubus_msg_buf *ub); void ubus_msg_free(struct ubus_msg_buf *ub);
struct ubus_client *ubusd_get_client_by_id(uint32_t id);
void ubusd_receive_message(struct ubus_client *cl, struct ubus_msg_buf *ub); void ubusd_receive_message(struct ubus_client *cl, struct ubus_msg_buf *ub);
bool ubusd_send_hello(struct ubus_client *cl); bool ubusd_send_hello(struct ubus_client *cl);

View file

@ -231,6 +231,17 @@ static int ubusd_handle_invoke(struct ubus_client *cl, struct ubus_msg_buf *ub,
return -1; return -1;
} }
static struct ubus_client *ubusd_get_client_by_id(uint32_t id)
{
struct ubus_id *clid;
clid = ubus_find_id(&clients, id);
if (!clid)
return NULL;
return container_of(clid, struct ubus_client, id);
}
static int ubusd_handle_response(struct ubus_client *cl, struct ubus_msg_buf *ub, struct blob_attr **attr) static int ubusd_handle_response(struct ubus_client *cl, struct ubus_msg_buf *ub, struct blob_attr **attr)
{ {
struct ubus_object *obj; struct ubus_object *obj;