[openib-general] [PATCH][SDP][10/22] Remove use of leading underscores in static names in sdp_link.c
Tom Duffy
Tom.Duffy at Sun.COM
Mon Feb 28 14:01:42 PST 2005
Signed-off-by: Tom Duffy <tduffy at sun.com>
Index: drivers/infiniband/ulp/sdp/sdp_link.c
===================================================================
--- drivers/infiniband/ulp/sdp/sdp_link.c (revision 1929)
+++ drivers/infiniband/ulp/sdp/sdp_link.c (working copy)
@@ -36,18 +36,18 @@
#include "sdp_main.h"
#include "sdp_link.h"
-static kmem_cache_t *_wait_cache = NULL;
-static kmem_cache_t *_info_cache = NULL;
+static kmem_cache_t *wait_cache = NULL;
+static kmem_cache_t *info_cache = NULL;
-static struct sdp_path_info *_info_list = NULL;
+static struct sdp_path_info *info_list = NULL;
-static struct workqueue_struct *_link_wq;
-static struct work_struct _link_timer;
+static struct workqueue_struct *link_wq;
+static struct work_struct link_timer;
-static u64 _path_lookup_id = 0;
+static u64 path_lookup_id = 0;
#define _SDP_PATH_LOOKUP_ID() \
- ((++_path_lookup_id) ? _path_lookup_id : ++_path_lookup_id)
+ ((++path_lookup_id) ? path_lookup_id : ++path_lookup_id)
#define GID_FMT "%x:%x:%x:%x:%x:%x:%x:%x"
#define GID_ARG(gid) be16_to_cpup((__be16 *) ((gid).raw + 0)), \
@@ -61,23 +61,22 @@ static u64 _path_lookup_id = 0;
/*
* proto
*/
-void _sdp_link_path_lookup(void *data);
+static void do_link_path_lookup(void *data);
/*
- * _sdp_link_path_complete - generate a path record completion for user
+ * sdp_link_path_complete - generate a path record completion for user
*/
-static void _sdp_link_path_complete(u64 id,
- int status,
- struct sdp_path_info *info,
- void (*func)(u64 id,
- int status,
- u32 dst_addr,
- u32 src_addr,
- u8 hw_port,
- struct ib_device *ca,
- struct ib_sa_path_rec *path,
- void *arg),
- void *arg)
+static void sdp_link_path_complete(u64 id, int status,
+ struct sdp_path_info *info,
+ void (*func)(u64 id,
+ int status,
+ u32 dst_addr,
+ u32 src_addr,
+ u8 hw_port,
+ struct ib_device *ca,
+ struct ib_sa_path_rec *path,
+ void *arg),
+ void *arg)
{
/*
* call completion function
@@ -95,10 +94,10 @@ static void _sdp_link_path_complete(u64
}
/*
- * _sdp_path_wait_add - add a wait entry into the wait list for a path
+ * sdp_path_wait_add - add a wait entry into the wait list for a path
*/
-static void _sdp_path_wait_add(struct sdp_path_info *info,
- struct sdp_path_wait *wait)
+static void sdp_path_wait_add(struct sdp_path_info *info,
+ struct sdp_path_wait *wait)
{
wait->next = info->wait_list;
@@ -110,9 +109,9 @@ static void _sdp_path_wait_add(struct sd
}
/*
- * _sdp_path_wait_destroy - destroy an entry for a wait element
+ * sdp_path_wait_destroy - destroy an entry for a wait element
*/
-static void _sdp_path_wait_destroy(struct sdp_path_wait *wait)
+static void sdp_path_wait_destroy(struct sdp_path_wait *wait)
{
/*
* if it's in the list, pext will not be null
@@ -127,33 +126,32 @@ static void _sdp_path_wait_destroy(struc
wait->next = NULL;
}
- kmem_cache_free(_wait_cache, wait);
+ kmem_cache_free(wait_cache, wait);
}
/*
- * _sdp_path_wait_complete - complete an entry for a wait element
+ * sdp_path_wait_complete - complete an entry for a wait element
*/
-static void _sdp_path_wait_complete(struct sdp_path_wait *wait,
- struct sdp_path_info *info,
- int status)
+static void sdp_path_wait_complete(struct sdp_path_wait *wait,
+ struct sdp_path_info *info, int status)
{
- _sdp_link_path_complete(wait->id,
+ sdp_link_path_complete(wait->id,
status,
info,
wait->completion,
wait->arg);
- _sdp_path_wait_destroy(wait);
+ sdp_path_wait_destroy(wait);
}
/*
- * _sdp_path_info_lookup - lookup a path record entry
+ * sdp_path_info_lookup - lookup a path record entry
*/
-static struct sdp_path_info *_sdp_path_info_lookup(u32 dst_ip, int dev_if)
+static struct sdp_path_info *sdp_path_info_lookup(u32 dst_ip, int dev_if)
{
struct sdp_path_info *info;
- for (info = _info_list; info; info = info->next)
+ for (info = info_list; info; info = info->next)
if (dst_ip == info->dst && dev_if == info->dif)
break;
@@ -161,21 +159,21 @@ static struct sdp_path_info *_sdp_path_i
}
/*
- * _sdp_path_info_create - create an entry for a path record element
+ * sdp_path_info_create - create an entry for a path record element
*/
-static struct sdp_path_info *_sdp_path_info_create(u32 dst_ip, int dev_if)
+static struct sdp_path_info *sdp_path_info_create(u32 dst_ip, int dev_if)
{
struct sdp_path_info *info;
- info = kmem_cache_alloc(_info_cache, SLAB_KERNEL);
+ info = kmem_cache_alloc(info_cache, SLAB_KERNEL);
if (!info)
return NULL;
memset(info, 0, sizeof(struct sdp_path_info));
- info->next = _info_list;
- _info_list = info;
- info->pext = &_info_list;
+ info->next = info_list;
+ info_list = info;
+ info->pext = &info_list;
if (info->next)
info->next->pext = &info->next;
@@ -186,15 +184,15 @@ static struct sdp_path_info *_sdp_path_i
info->sa_time = SDP_LINK_SA_TIME_MIN;
info->arp_time = SDP_LINK_ARP_TIME_MIN;
- INIT_WORK(&info->timer, _sdp_link_path_lookup, info);
+ INIT_WORK(&info->timer, do_link_path_lookup, info);
return info;
}
/*
- * _sdp_path_info_destroy - destroy an entry for a path record element
+ * sdp_path_info_destroy - destroy an entry for a path record element
*/
-static void _sdp_path_info_destroy(struct sdp_path_info *info, int status)
+static void sdp_path_info_destroy(struct sdp_path_info *info, int status)
{
struct sdp_path_wait *wait;
/*
@@ -211,18 +209,17 @@ static void _sdp_path_info_destroy(struc
}
while ((wait = info->wait_list))
- _sdp_path_wait_complete(wait, info, status);
+ sdp_path_wait_complete(wait, info, status);
cancel_delayed_work(&info->timer);
- kmem_cache_free(_info_cache, info);
+ kmem_cache_free(info_cache, info);
}
/*
- * _sdp_link_path_rec_done - path record completion function
+ * sdp_link_path_rec_done - path record completion function
*/
-static void _sdp_link_path_rec_done(int status,
- struct ib_sa_path_rec *resp,
- void *context)
+static void sdp_link_path_rec_done(int status, struct ib_sa_path_rec *resp,
+ void *context)
{
struct sdp_path_info *info = (struct sdp_path_info *)context;
struct sdp_path_wait *wait;
@@ -254,7 +251,7 @@ static void _sdp_link_path_rec_done(int
wait->retry++;
if (!status || SDP_LINK_SA_RETRY < wait->retry)
- _sdp_path_wait_complete(wait, info, status);
+ sdp_path_wait_complete(wait, info, status);
}
/*
* retry if anyone is waiting.
@@ -271,22 +268,22 @@ static void _sdp_link_path_rec_done(int
IB_SA_PATH_REC_NUMB_PATH),
info->sa_time,
GFP_KERNEL,
- _sdp_link_path_rec_done,
+ sdp_link_path_rec_done,
info,
&info->query);
if (result < 0) {
sdp_dbg_warn(NULL, "Error <%d> restarting path query",
result);
- _sdp_path_info_destroy(info, result);
+ sdp_path_info_destroy(info, result);
}
}
}
/*
- * _sdp_link_path_rec_get - resolve GIDs to a path record
+ * sdp_link_path_rec_get - resolve GIDs to a path record
*/
-static int _sdp_link_path_rec_get(struct sdp_path_info *info)
+static int sdp_link_path_rec_get(struct sdp_path_info *info)
{
int result;
@@ -306,7 +303,7 @@ static int _sdp_link_path_rec_get(struct
IB_SA_PATH_REC_NUMB_PATH),
info->sa_time,
GFP_KERNEL,
- _sdp_link_path_rec_done,
+ sdp_link_path_rec_done,
info,
&info->query);
if (result < 0) {
@@ -322,9 +319,9 @@ static int _sdp_link_path_rec_get(struct
}
/*
- * _sdp_link_path_lookup - resolve an ip address to a path record
+ * do_link_path_lookup - resolve an ip address to a path record
*/
-void _sdp_link_path_lookup(void *data)
+static void do_link_path_lookup(void *data)
{
struct sdp_path_info *info = data;
struct ipoib_dev_priv *priv;
@@ -488,8 +485,7 @@ arp:
sweep = sweep->next;
if (SDP_LINK_SA_RETRY < wait->retry++)
- _sdp_path_wait_complete(wait, info,
- -ETIMEDOUT);
+ sdp_path_wait_complete(wait, info, -ETIMEDOUT);
}
if (!info->wait_list) {
@@ -502,11 +498,11 @@ arp:
}
info->flags |= SDP_LINK_F_ARP;
- queue_delayed_work(_link_wq, &info->timer, info->arp_time);
+ queue_delayed_work(link_wq, &info->timer, info->arp_time);
return;
path:
- result = _sdp_link_path_rec_get(info);
+ result = sdp_link_path_rec_get(info);
if (result) {
sdp_dbg_warn(NULL, "Error <%d> getting path record.", result);
goto error;
@@ -514,7 +510,7 @@ path:
done:
return;
error:
- _sdp_path_info_destroy(info, result);
+ sdp_path_info_destroy(info, result);
}
/*
@@ -546,9 +542,9 @@ int sdp_link_path_lookup(u32 dst_addr,
/*
* lookup entry, create if not found and add to wait list.
*/
- info = _sdp_path_info_lookup(dst_addr, bound_dev_if);
+ info = sdp_path_info_lookup(dst_addr, bound_dev_if);
if (!info) {
- info = _sdp_path_info_create(dst_addr, bound_dev_if);
+ info = sdp_path_info_create(dst_addr, bound_dev_if);
if (!info) {
sdp_dbg_warn(NULL, "Failed to create path object");
return -ENOMEM;
@@ -561,13 +557,13 @@ int sdp_link_path_lookup(u32 dst_addr,
* if not waiting for result, complete.
*/
if (info->flags & SDP_LINK_F_VALID) {
- _sdp_link_path_complete(*id, 0, info, completion, arg);
+ sdp_link_path_complete(*id, 0, info, completion, arg);
return 0;
}
/*
* add request to list of lookups.
*/
- wait = kmem_cache_alloc(_wait_cache, SLAB_KERNEL);
+ wait = kmem_cache_alloc(wait_cache, SLAB_KERNEL);
if (!wait) {
sdp_dbg_warn(NULL, "Failed to create path wait object");
result = -ENOMEM;
@@ -578,12 +574,12 @@ int sdp_link_path_lookup(u32 dst_addr,
wait->completion = completion;
wait->arg = arg;
- _sdp_path_wait_add(info, wait);
+ sdp_path_wait_add(info, wait);
/*
* initiate address lookup, if not in progress.
*/
if (!((SDP_LINK_F_ARP|SDP_LINK_F_PATH) & info->flags))
- _sdp_link_path_lookup(info);
+ do_link_path_lookup(info);
return 0;
error:
@@ -595,14 +591,14 @@ error:
*/
/*
- * _sdp_link_sweep - periodic path information cleanup function
+ * sdp_link_sweep - periodic path information cleanup function
*/
-static void _sdp_link_sweep(void *data)
+static void sdp_link_sweep(void *data)
{
struct sdp_path_info *info;
struct sdp_path_info *sweep;
- sweep = _info_list;
+ sweep = info_list;
while (sweep) {
info = sweep;
sweep = sweep->next;
@@ -616,11 +612,11 @@ static void _sdp_link_sweep(void *data)
(info->dst & 0xff000000) >> 24,
jiffies, info->use);
- _sdp_path_info_destroy(info, -ETIMEDOUT);
+ sdp_path_info_destroy(info, -ETIMEDOUT);
}
}
- queue_delayed_work(_link_wq, &_link_timer, SDP_LINK_SWEEP_INTERVAL);
+ queue_delayed_work(link_wq, &link_timer, SDP_LINK_SWEEP_INTERVAL);
}
/*
@@ -628,9 +624,9 @@ static void _sdp_link_sweep(void *data)
*/
/*
- * _sdp_link_arp_work - handle IB REQUEST/REPLY ARP packets
+ * sdp_link_arp_work - handle IB REQUEST/REPLY ARP packets
*/
-static void _sdp_link_arp_work(void *data)
+static void sdp_link_arp_work(void *data)
{
struct sdp_work *work = (struct sdp_work *)data;
struct sk_buff *skb = (struct sk_buff *)work->arg;
@@ -649,7 +645,7 @@ static void _sdp_link_arp_work(void *dat
/*
* find a path info structure for the source IP address.
*/
- for (info = _info_list; info; info = info->next)
+ for (info = info_list; info; info = info->next)
if (info->dst == arp->src_ip)
break;
@@ -665,10 +661,10 @@ static void _sdp_link_arp_work(void *dat
memcpy(&info->path.dgid, &arp->src_gid, sizeof(union ib_gid));
- result = _sdp_link_path_rec_get(info);
+ result = sdp_link_path_rec_get(info);
if (result) {
sdp_dbg_warn(NULL, "Error <%d> path request on ARP.", result);
- _sdp_path_info_destroy(info, result);
+ sdp_path_info_destroy(info, result);
}
done:
@@ -677,11 +673,10 @@ done:
}
/*
- * _sdp_link_arp_recv - receive all ARP packets
+ * sdp_link_arp_recv - receive all ARP packets
*/
-static int _sdp_link_arp_recv(struct sk_buff *skb,
- struct net_device *dev,
- struct packet_type *pt)
+static int sdp_link_arp_recv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt)
{
struct sdp_work *work;
struct arphdr *arp_hdr;
@@ -700,8 +695,8 @@ static int _sdp_link_arp_recv(struct sk_
goto done;
work->arg = skb;
- INIT_WORK(&work->work, _sdp_link_arp_work, work);
- queue_work(_link_wq, &work->work);
+ INIT_WORK(&work->work, sdp_link_arp_work, work);
+ queue_work(link_wq, &work->work);
return 0;
done:
@@ -712,9 +707,9 @@ done:
/*
* primary initialization/cleanup functions
*/
-static struct packet_type _sdp_arp_type = {
+static struct packet_type sdp_arp_type = {
.type = __constant_htons(ETH_P_ARP),
- .func = _sdp_link_arp_recv,
+ .func = sdp_link_arp_recv,
.af_packet_priv = (void*) 1, /* understand shared skbs */
};
@@ -739,50 +734,50 @@ int sdp_link_addr_init(void)
goto error_async;
}
#endif
- _info_cache = kmem_cache_create("sdp_path_info",
+ info_cache = kmem_cache_create("sdp_path_info",
sizeof(struct sdp_path_info),
0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
- if (!_info_cache) {
+ if (!info_cache) {
sdp_warn("Failed to allocate path info cache.");
result = -ENOMEM;
goto error_path;
}
- _wait_cache = kmem_cache_create("sdp_path_wait",
+ wait_cache = kmem_cache_create("sdp_path_wait",
sizeof(struct sdp_path_wait),
0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
- if (!_wait_cache) {
+ if (!wait_cache) {
sdp_warn("Failed to allocate path wait cache.");
result = -ENOMEM;
goto error_wait;
}
- _link_wq = create_workqueue("sdp_wq");
- if (!_link_wq) {
+ link_wq = create_workqueue("sdp_wq");
+ if (!link_wq) {
sdp_warn("Failed to allocate ARP wait queue.");
result = -ENOMEM;
goto error_wq;
}
- INIT_WORK(&_link_timer, _sdp_link_sweep, NULL);
- queue_delayed_work(_link_wq, &_link_timer, SDP_LINK_SWEEP_INTERVAL);
+ INIT_WORK(&link_timer, sdp_link_sweep, NULL);
+ queue_delayed_work(link_wq, &link_timer, SDP_LINK_SWEEP_INTERVAL);
/*
* install device for receiving ARP packets in parallel to the normal
* Linux ARP, this will be the SDP notifier that an ARP request has
* completed.
*/
- dev_add_pack(&_sdp_arp_type);
+ dev_add_pack(&sdp_arp_type);
return 0;
error_wq:
- kmem_cache_destroy(_wait_cache);
+ kmem_cache_destroy(wait_cache);
error_wait:
- kmem_cache_destroy(_info_cache);
+ kmem_cache_destroy(info_cache);
error_path:
return result;
}
@@ -798,23 +793,23 @@ int sdp_link_addr_cleanup(void)
/*
* clear objects
*/
- while ((info = _info_list))
- _sdp_path_info_destroy(info, -EINTR);
+ while ((info = info_list))
+ sdp_path_info_destroy(info, -EINTR);
/*
* remove ARP packet processing.
*/
- dev_remove_pack(&_sdp_arp_type);
+ dev_remove_pack(&sdp_arp_type);
/*
* destroy work queue
*/
- cancel_delayed_work(&_link_timer);
- flush_workqueue(_link_wq);
- destroy_workqueue(_link_wq);
+ cancel_delayed_work(&link_timer);
+ flush_workqueue(link_wq);
+ destroy_workqueue(link_wq);
/*
* destroy caches
*/
- kmem_cache_destroy(_info_cache);
- kmem_cache_destroy(_wait_cache);
+ kmem_cache_destroy(info_cache);
+ kmem_cache_destroy(wait_cache);
#if 0
/*
* release async event handler
More information about the general
mailing list