]> git.ipfire.org Git - thirdparty/kmod.git/commit - libkmod/libkmod.c
Fix changing hash key after module is inserted in hash
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Thu, 15 Dec 2011 15:11:51 +0000 (13:11 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Thu, 15 Dec 2011 15:48:19 +0000 (13:48 -0200)
commit8bdeca11b14c2e1350b018386b9b91aa1a52dfcb
tree1eec7b8204cc9eb4c08770c3e5d2e57edd5c3c15
parent91428ae1b8d1de1bc5300edb59268bb40ef49ec7
Fix changing hash key after module is inserted in hash

The hash key is not copied so we can't change the string from:
modname/modalias

to:

modname'\0'modalias

in order to setup mod->name and mod->alias.

Now what we do is:

1) if name is in the form 'modname/modalias', the final struct
   kmod_module will be:

   struct kmod_module {
           char *alias;------,
           char *name;-----, |
           char *hashkey;--|-|-,
   }                       | | |
   name <------------------' | |
   alias <-------------------' |
   hashkey <-------------------'

2) if name is in the simple form 'modname', then the final struct
   kmod_module will be:

   struct kmod_module {
           char *alias;------> NULL
           char *name;-----,
           char *hashkey;--|---,
   }                       |   |
   name <------------------*---'
libkmod/libkmod-module.c
libkmod/libkmod-private.h
libkmod/libkmod.c