Commit e7cb6b00 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] namespace pollution in irda_irias

From:  Arnd Bergmann <arnd@bergmann-dalldorf.de>

  A global variable should not be named 'objects' like in
  irias_object.c. This patch puts it into the right
  namespace.
  Also, strndup() is made static.
parent e6621985
...@@ -78,8 +78,6 @@ struct ias_attrib { ...@@ -78,8 +78,6 @@ struct ias_attrib {
struct ias_value *value; /* Attribute value */ struct ias_value *value; /* Attribute value */
}; };
char *strndup(char *str, int max);
struct ias_object *irias_new_object(char *name, int id); struct ias_object *irias_new_object(char *name, int id);
void irias_insert_object(struct ias_object *obj); void irias_insert_object(struct ias_object *obj);
int irias_delete_object(struct ias_object *obj); int irias_delete_object(struct ias_object *obj);
...@@ -104,6 +102,6 @@ struct ias_value *irias_new_missing_value(void); ...@@ -104,6 +102,6 @@ struct ias_value *irias_new_missing_value(void);
void irias_delete_value(struct ias_value *value); void irias_delete_value(struct ias_value *value);
extern struct ias_value missing; extern struct ias_value missing;
extern hashbin_t *objects; extern hashbin_t *irias_objects;
#endif #endif
...@@ -96,9 +96,10 @@ int __init iriap_init(void) ...@@ -96,9 +96,10 @@ int __init iriap_init(void)
return -ENOMEM; return -ENOMEM;
/* Object repository - defined in irias_object.c */ /* Object repository - defined in irias_object.c */
objects = hashbin_new(HB_LOCK); irias_objects = hashbin_new(HB_LOCK);
if (!objects) { if (!irias_objects) {
WARNING("%s: Can't allocate objects hashbin!\n", __FUNCTION__); WARNING("%s: Can't allocate irias_objects hashbin!\n",
__FUNCTION__);
return -ENOMEM; return -ENOMEM;
} }
...@@ -147,7 +148,7 @@ void __exit iriap_cleanup(void) ...@@ -147,7 +148,7 @@ void __exit iriap_cleanup(void)
irlmp_unregister_service(service_handle); irlmp_unregister_service(service_handle);
hashbin_delete(iriap, (FREE_FUNC) __iriap_close); hashbin_delete(iriap, (FREE_FUNC) __iriap_close);
hashbin_delete(objects, (FREE_FUNC) __irias_delete_object); hashbin_delete(irias_objects, (FREE_FUNC) __irias_delete_object);
} }
/* /*
...@@ -971,16 +972,16 @@ int irias_proc_read(char *buf, char **start, off_t offset, int len) ...@@ -971,16 +972,16 @@ int irias_proc_read(char *buf, char **start, off_t offset, int len)
struct ias_attrib *attrib; struct ias_attrib *attrib;
unsigned long flags; unsigned long flags;
ASSERT( objects != NULL, return 0;); ASSERT( irias_objects != NULL, return 0;);
len = 0; len = 0;
len += sprintf(buf+len, "LM-IAS Objects:\n"); len += sprintf(buf+len, "LM-IAS Objects:\n");
spin_lock_irqsave(&objects->hb_spinlock, flags); spin_lock_irqsave(&irias_objects->hb_spinlock, flags);
/* List all objects */ /* List all irias_objects */
obj = (struct ias_object *) hashbin_get_first(objects); obj = (struct ias_object *) hashbin_get_first(irias_objects);
while ( obj != NULL) { while ( obj != NULL) {
ASSERT(obj->magic == IAS_OBJECT_MAGIC, return 0;); ASSERT(obj->magic == IAS_OBJECT_MAGIC, return 0;);
...@@ -1031,9 +1032,9 @@ int irias_proc_read(char *buf, char **start, off_t offset, int len) ...@@ -1031,9 +1032,9 @@ int irias_proc_read(char *buf, char **start, off_t offset, int len)
} }
spin_unlock(&obj->attribs->hb_spinlock); spin_unlock(&obj->attribs->hb_spinlock);
obj = (struct ias_object *) hashbin_get_next(objects); obj = (struct ias_object *) hashbin_get_next(irias_objects);
} }
spin_unlock_irqrestore(&objects->hb_spinlock, flags); spin_unlock_irqrestore(&irias_objects->hb_spinlock, flags);
return len; return len;
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irias_object.h> #include <net/irda/irias_object.h>
hashbin_t *objects = NULL; hashbin_t *irias_objects;
/* /*
* Used when a missing value needs to be returned * Used when a missing value needs to be returned
...@@ -42,7 +42,7 @@ struct ias_value missing = { IAS_MISSING, 0, 0, 0, {0}}; ...@@ -42,7 +42,7 @@ struct ias_value missing = { IAS_MISSING, 0, 0, 0, {0}};
* *
* Faster, check boundary... Jean II * Faster, check boundary... Jean II
*/ */
char *strndup(char *str, int max) static char *strndup(char *str, int max)
{ {
char *new_str; char *new_str;
int len; int len;
...@@ -151,7 +151,7 @@ int irias_delete_object(struct ias_object *obj) ...@@ -151,7 +151,7 @@ int irias_delete_object(struct ias_object *obj)
ASSERT(obj != NULL, return -1;); ASSERT(obj != NULL, return -1;);
ASSERT(obj->magic == IAS_OBJECT_MAGIC, return -1;); ASSERT(obj->magic == IAS_OBJECT_MAGIC, return -1;);
node = hashbin_remove_this(objects, (irda_queue_t *) obj); node = hashbin_remove_this(irias_objects, (irda_queue_t *) obj);
if (!node) if (!node)
return 0; /* Already removed */ return 0; /* Already removed */
...@@ -202,7 +202,7 @@ void irias_insert_object(struct ias_object *obj) ...@@ -202,7 +202,7 @@ void irias_insert_object(struct ias_object *obj)
ASSERT(obj != NULL, return;); ASSERT(obj != NULL, return;);
ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
hashbin_insert(objects, (irda_queue_t *) obj, 0, obj->name); hashbin_insert(irias_objects, (irda_queue_t *) obj, 0, obj->name);
} }
/* /*
...@@ -216,7 +216,7 @@ struct ias_object *irias_find_object(char *name) ...@@ -216,7 +216,7 @@ struct ias_object *irias_find_object(char *name)
ASSERT(name != NULL, return NULL;); ASSERT(name != NULL, return NULL;);
/* Unsafe (locking), object might change */ /* Unsafe (locking), object might change */
return hashbin_lock_find(objects, 0, name); return hashbin_lock_find(irias_objects, 0, name);
} }
/* /*
...@@ -276,7 +276,7 @@ int irias_object_change_attribute(char *obj_name, char *attrib_name, ...@@ -276,7 +276,7 @@ int irias_object_change_attribute(char *obj_name, char *attrib_name,
unsigned long flags; unsigned long flags;
/* Find object */ /* Find object */
obj = hashbin_lock_find(objects, 0, obj_name); obj = hashbin_lock_find(irias_objects, 0, obj_name);
if (obj == NULL) { if (obj == NULL) {
WARNING("%s: Unable to find object: %s\n", __FUNCTION__, WARNING("%s: Unable to find object: %s\n", __FUNCTION__,
obj_name); obj_name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment