Patchwork [1/8] petitboot: Pass cb_arg to discover_client_init

login
register
mail settings
Submitter Geoff Levand
Date Feb. 16, 2009, 6:57 a.m.
Message ID <20090216065712.711326298@am.sony.com>
Download mbox | patch
Permalink /patch/23203/
State Accepted
Delegated to: Jeremy Kerr
Headers show

Comments

Geoff Levand - Feb. 16, 2009, 6:57 a.m.
Pass the client cb_arg to discover_client_init() and have it
initialize the structure member.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
 ui/common/discover-client.c |    3 ++-
 ui/common/discover-client.h |    2 +-
 ui/test/pb-test.c           |    2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)
Jeremy Kerr - Feb. 21, 2009, 3:32 a.m.
On Monday 16 February 2009, Geoff Levand wrote:
> Pass the client cb_arg to discover_client_init() and have it
> initialize the structure member.

Thanks - applied with minor changes: please use 'void *cb_arg', rather 
than 'void* cb_arg'.

Cheers,

Jeremy

Patch

--- a/ui/common/discover-client.c
+++ b/ui/common/discover-client.c
@@ -33,7 +33,7 @@  static int discover_client_destructor(vo
 }
 
 struct discover_client* discover_client_init(
-	const struct discover_client_ops *ops)
+	const struct discover_client_ops *ops, void* cb_arg)
 {
 	struct discover_client *client;
 	struct sockaddr_un addr;
@@ -43,6 +43,7 @@  struct discover_client* discover_client_
 		return NULL;
 
 	memcpy(&client->ops, ops, sizeof(client->ops));
+	client->ops.cb_arg = cb_arg;
 
 	client->fd = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (!client->fd < 0) {
--- a/ui/common/discover-client.h
+++ b/ui/common/discover-client.h
@@ -19,7 +19,7 @@  struct discover_client_ops {
 };
 
 struct discover_client *discover_client_init(
-	const struct discover_client_ops *ops);
+	const struct discover_client_ops *ops, void* cb_arg);
 
 int discover_client_get_fd(const struct discover_client *client);
 
--- a/ui/test/pb-test.c
+++ b/ui/test/pb-test.c
@@ -45,7 +45,7 @@  int main(void)
 {
 	struct discover_client *client;
 
-	client = discover_client_init(&client_ops);
+	client = discover_client_init(&client_ops, NULL);
 	if (!client)
 		return -1;