mirror of https://github.com/schoebel/mars
infra: make id static
This commit is contained in:
parent
791b604c5c
commit
9c00104b28
|
@ -45,23 +45,23 @@ EXPORT_SYMBOL_GPL(mars_global_ban);
|
|||
atomic_t mars_global_io_flying = ATOMIC_INIT(0);
|
||||
EXPORT_SYMBOL_GPL(mars_global_io_flying);
|
||||
|
||||
static char *id = NULL;
|
||||
static char id[__NEW_UTS_LEN + 2] = {};
|
||||
|
||||
/* TODO: better use MAC addresses (or motherboard IDs where available).
|
||||
* Or, at least, some checks for MAC addresses should be recorded / added.
|
||||
/* TODO: use MAC addresses (or motherboard IDs etc) for _validation_
|
||||
* of nodenames.
|
||||
* When the nodename is misconfigured, data might be scrambled.
|
||||
* MAC addresses should be more secure.
|
||||
* In ideal case, further checks should be added to prohibit accidental
|
||||
* name clashes.
|
||||
*/
|
||||
char *my_id(void)
|
||||
{
|
||||
struct new_utsname *u;
|
||||
if (!id) {
|
||||
if (unlikely(!id[0])) {
|
||||
struct new_utsname *u;
|
||||
|
||||
//down_read(&uts_sem); // FIXME: this is currenty not EXPORTed from the kernel!
|
||||
u = utsname();
|
||||
if (u) {
|
||||
id = brick_strdup(u->nodename);
|
||||
strncpy(id, u->nodename, sizeof(id));
|
||||
}
|
||||
//up_read(&uts_sem);
|
||||
}
|
||||
|
@ -446,8 +446,4 @@ void exit_mars(void)
|
|||
mars_log_file = NULL;
|
||||
}
|
||||
#endif
|
||||
if (id) {
|
||||
brick_string_free(id);
|
||||
id = NULL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue