batman-adv: Prefix icmp_socket local static functions with batadv_

All non-static symbols of batman-adv were prefixed with batadv_ to avoid
collisions with other symbols of the kernel. Other symbols of batman-adv
should use the same prefix to keep the naming scheme consistent.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
Sven Eckelmann 2012-05-12 18:33:59 +02:00 committed by Antonio Quartulli
parent 7f9f02cb83
commit af4447f629
1 changed files with 34 additions and 32 deletions

View File

@ -26,18 +26,18 @@
#include "originator.h" #include "originator.h"
#include "hard-interface.h" #include "hard-interface.h"
static struct socket_client *socket_client_hash[256]; static struct socket_client *batadv_socket_client_hash[256];
static void bat_socket_add_packet(struct socket_client *socket_client, static void batadv_socket_add_packet(struct socket_client *socket_client,
struct icmp_packet_rr *icmp_packet, struct icmp_packet_rr *icmp_packet,
size_t icmp_len); size_t icmp_len);
void batadv_socket_init(void) void batadv_socket_init(void)
{ {
memset(socket_client_hash, 0, sizeof(socket_client_hash)); memset(batadv_socket_client_hash, 0, sizeof(batadv_socket_client_hash));
} }
static int bat_socket_open(struct inode *inode, struct file *file) static int batadv_socket_open(struct inode *inode, struct file *file)
{ {
unsigned int i; unsigned int i;
struct socket_client *socket_client; struct socket_client *socket_client;
@ -49,14 +49,14 @@ static int bat_socket_open(struct inode *inode, struct file *file)
if (!socket_client) if (!socket_client)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < ARRAY_SIZE(socket_client_hash); i++) { for (i = 0; i < ARRAY_SIZE(batadv_socket_client_hash); i++) {
if (!socket_client_hash[i]) { if (!batadv_socket_client_hash[i]) {
socket_client_hash[i] = socket_client; batadv_socket_client_hash[i] = socket_client;
break; break;
} }
} }
if (i == ARRAY_SIZE(socket_client_hash)) { if (i == ARRAY_SIZE(batadv_socket_client_hash)) {
pr_err("Error - can't add another packet client: maximum number of clients reached\n"); pr_err("Error - can't add another packet client: maximum number of clients reached\n");
kfree(socket_client); kfree(socket_client);
return -EXFULL; return -EXFULL;
@ -75,7 +75,7 @@ static int bat_socket_open(struct inode *inode, struct file *file)
return 0; return 0;
} }
static int bat_socket_release(struct inode *inode, struct file *file) static int batadv_socket_release(struct inode *inode, struct file *file)
{ {
struct socket_client *socket_client = file->private_data; struct socket_client *socket_client = file->private_data;
struct socket_packet *socket_packet; struct socket_packet *socket_packet;
@ -92,7 +92,7 @@ static int bat_socket_release(struct inode *inode, struct file *file)
kfree(socket_packet); kfree(socket_packet);
} }
socket_client_hash[socket_client->index] = NULL; batadv_socket_client_hash[socket_client->index] = NULL;
spin_unlock_bh(&socket_client->lock); spin_unlock_bh(&socket_client->lock);
kfree(socket_client); kfree(socket_client);
@ -101,8 +101,8 @@ static int bat_socket_release(struct inode *inode, struct file *file)
return 0; return 0;
} }
static ssize_t bat_socket_read(struct file *file, char __user *buf, static ssize_t batadv_socket_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct socket_client *socket_client = file->private_data; struct socket_client *socket_client = file->private_data;
struct socket_packet *socket_packet; struct socket_packet *socket_packet;
@ -144,8 +144,8 @@ static ssize_t bat_socket_read(struct file *file, char __user *buf,
return packet_len; return packet_len;
} }
static ssize_t bat_socket_write(struct file *file, const char __user *buff, static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
size_t len, loff_t *off) size_t len, loff_t *off)
{ {
struct socket_client *socket_client = file->private_data; struct socket_client *socket_client = file->private_data;
struct bat_priv *bat_priv = socket_client->bat_priv; struct bat_priv *bat_priv = socket_client->bat_priv;
@ -206,7 +206,8 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
if (icmp_packet->header.version != COMPAT_VERSION) { if (icmp_packet->header.version != COMPAT_VERSION) {
icmp_packet->msg_type = PARAMETER_PROBLEM; icmp_packet->msg_type = PARAMETER_PROBLEM;
icmp_packet->header.version = COMPAT_VERSION; icmp_packet->header.version = COMPAT_VERSION;
bat_socket_add_packet(socket_client, icmp_packet, packet_len); batadv_socket_add_packet(socket_client, icmp_packet,
packet_len);
goto free_skb; goto free_skb;
} }
@ -239,7 +240,7 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
dst_unreach: dst_unreach:
icmp_packet->msg_type = DESTINATION_UNREACHABLE; icmp_packet->msg_type = DESTINATION_UNREACHABLE;
bat_socket_add_packet(socket_client, icmp_packet, packet_len); batadv_socket_add_packet(socket_client, icmp_packet, packet_len);
free_skb: free_skb:
kfree_skb(skb); kfree_skb(skb);
out: out:
@ -252,7 +253,7 @@ out:
return len; return len;
} }
static unsigned int bat_socket_poll(struct file *file, poll_table *wait) static unsigned int batadv_socket_poll(struct file *file, poll_table *wait)
{ {
struct socket_client *socket_client = file->private_data; struct socket_client *socket_client = file->private_data;
@ -264,13 +265,13 @@ static unsigned int bat_socket_poll(struct file *file, poll_table *wait)
return 0; return 0;
} }
static const struct file_operations fops = { static const struct file_operations batadv_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = bat_socket_open, .open = batadv_socket_open,
.release = bat_socket_release, .release = batadv_socket_release,
.read = bat_socket_read, .read = batadv_socket_read,
.write = bat_socket_write, .write = batadv_socket_write,
.poll = bat_socket_poll, .poll = batadv_socket_poll,
.llseek = no_llseek, .llseek = no_llseek,
}; };
@ -282,7 +283,7 @@ int batadv_socket_setup(struct bat_priv *bat_priv)
goto err; goto err;
d = debugfs_create_file(ICMP_SOCKET, S_IFREG | S_IWUSR | S_IRUSR, d = debugfs_create_file(ICMP_SOCKET, S_IFREG | S_IWUSR | S_IRUSR,
bat_priv->debug_dir, bat_priv, &fops); bat_priv->debug_dir, bat_priv, &batadv_fops);
if (!d) if (!d)
goto err; goto err;
@ -292,9 +293,9 @@ err:
return -ENOMEM; return -ENOMEM;
} }
static void bat_socket_add_packet(struct socket_client *socket_client, static void batadv_socket_add_packet(struct socket_client *socket_client,
struct icmp_packet_rr *icmp_packet, struct icmp_packet_rr *icmp_packet,
size_t icmp_len) size_t icmp_len)
{ {
struct socket_packet *socket_packet; struct socket_packet *socket_packet;
@ -312,7 +313,7 @@ static void bat_socket_add_packet(struct socket_client *socket_client,
/* while waiting for the lock the socket_client could have been /* while waiting for the lock the socket_client could have been
* deleted * deleted
*/ */
if (!socket_client_hash[icmp_packet->uid]) { if (!batadv_socket_client_hash[icmp_packet->uid]) {
spin_unlock_bh(&socket_client->lock); spin_unlock_bh(&socket_client->lock);
kfree(socket_packet); kfree(socket_packet);
return; return;
@ -338,8 +339,9 @@ static void bat_socket_add_packet(struct socket_client *socket_client,
void batadv_socket_receive_packet(struct icmp_packet_rr *icmp_packet, void batadv_socket_receive_packet(struct icmp_packet_rr *icmp_packet,
size_t icmp_len) size_t icmp_len)
{ {
struct socket_client *hash = socket_client_hash[icmp_packet->uid]; struct socket_client *hash;
hash = batadv_socket_client_hash[icmp_packet->uid];
if (hash) if (hash)
bat_socket_add_packet(hash, icmp_packet, icmp_len); batadv_socket_add_packet(hash, icmp_packet, icmp_len);
} }