From: Marcel Holtmann <marcel@holtmann.org>
To: ofono@ofono.org
Subject: Re: [PATCH 2/4] stemodem: Add RTNL functionality for CAIF Netw Interface.
Date: Mon, 01 Nov 2010 17:59:22 +0100 [thread overview]
Message-ID: <1288630762.3322.120.camel@aeonflux> (raw)
In-Reply-To: <1288274641-4216-2-git-send-email-sjurbren@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2352 bytes --]
Hi Sjur,
> Add file rtnl.c for creating and deleting CAIF network
> interfaces using the RTNL protocol. The interface is
> asynchronous.
>
> Only RTNL NEWLINK and DELLINK commands are implemented.
> CAIF requires NEWLINK to contain channel-id and ip-type
> (ipv4/ipv6) as arguments.
>
> ---
> drivers/stemodem/rtnl.c | 365 +++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 365 insertions(+), 0 deletions(-)
> create mode 100644 drivers/stemodem/rtnl.c
I have no problems with the file names. It does make sense to keep them
simple. However if this is CAIF related, then using caif_rtnl.[ch] might
be a good idea.
And you can combine the patches for the header file, for the actual code
and the Makefile.am into one. That is fine.
<snip>
And I have not looked through the whole patch yet.
> +int rtnl_init(void)
> +{
> + struct sockaddr_nl addr;
> + int sk, ret;
> +
> + sk = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
> + if (sk < 0)
> + return sk;
> +
> + memset(&addr, 0, sizeof(addr));
> + addr.nl_family = AF_NETLINK;
> + addr.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV4_ROUTE;
> +
> + ret = bind(sk, (struct sockaddr *) &addr, sizeof(addr));
> + if (ret < 0) {
> + close(sk);
> + return ret;
> + }
> +
> + channel = g_io_channel_unix_new(sk);
> + g_io_channel_set_close_on_unref(channel, TRUE);
> + rtnl_watch = g_io_add_watch(channel,
> + G_IO_IN | G_IO_NVAL | G_IO_HUP | G_IO_ERR,
> + netlink_event, NULL);
> +
> + return 0;
> +}
> +
> +void rtnl_exit(void)
> +{
> + GSList *list;
> +
> + if (rtnl_watch > 0)
> + g_source_remove(rtnl_watch);
> +
> + for (list = pending_requests; list; list = list->next) {
> + struct iplink_req *req = list->data;
> + g_free(req);
> + list->data = NULL;
> + }
> +
> + g_slist_free(pending_requests);
> + pending_requests = NULL;
> +
> + g_io_channel_shutdown(channel, TRUE, NULL);
> + g_io_channel_unref(channel);
> +
> + channel = NULL;
> +}
Using global function names like rtnl_init and rtnl_exit is not gonna
cut it. This code is CAIF specific and you need at least prefix the
public functions properly.
I am not sure what is best here. Use caif_rtnl_ or ste_rtnl_ or maybe
just skip the keyword rtnl and just prefix it with caif_ only.
Regards
Marcel
next prev parent reply other threads:[~2010-11-01 16:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-28 14:03 [PATCH 1/4] stemodem: Add rtnl header file Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-10-28 14:03 ` [PATCH 2/4] stemodem: Add RTNL functionality for CAIF Netw Interface Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-11-01 16:59 ` Marcel Holtmann [this message]
2010-11-01 20:17 ` [PATCHv2 1/2] stemodem: Add RTNL functionality managing CAIF Network Interfaces Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-11-01 21:04 ` Marcel Holtmann
2010-11-01 22:42 ` Sjur BRENDELAND
2010-11-02 5:03 ` Marcel Holtmann
2010-11-03 10:55 ` Sjur BRENDELAND
2010-11-03 13:41 ` Marcel Holtmann
2010-11-09 16:56 ` Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-11-01 20:17 ` [PATCHv2 2/2] stemodem: Update gprs-context to use rtnl to create/remove interfaces Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-10-28 14:04 ` [PATCH 3/4] stemodem: Update gprs-context to use rtnl Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-10-28 14:04 ` [PATCH 4/4] stemodem: Add rtnl to Makefile Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-11-01 16:54 ` Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1288630762.3322.120.camel@aeonflux \
--to=marcel@holtmann.org \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox