/modules.c (9b1a728acfb8a1b4001bd184768aa91ab5dfc3e9) (1518 bytes) (mode 100644) (type blob)
//******************************************************************************
//*this code is protected by the GNU affero GPLv3
//*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com>
//* <digital.ragnarok AT gmail dot com>
//******************************************************************************
#include <ulinux/compiler_types.h>
#include <ulinux/types.h>
#include <ulinux/sysc.h>
#include <ulinux/stat.h>
#include <ulinux/mmap.h>
#include <ulinux/error.h>
#include <ulinux/file.h>
#ifdef DEBUG
#include <stdarg.h>
#include <ulinux/utils/ascii/string/vsprintf.h>
#endif
#include "globals.h"
#include "modules_list.h"
static void module_load(k_u8 *m)
{
k_i fd=(k_i)sysc(open,3,m,K_O_RDONLY,0);
if(K_ISERR(fd)){
OUT("unable to open module(%ld)\n",fd);
goto err;
}
struct k_stat m_stat;
k_l r=sysc(fstat,2,fd,&m_stat);
if(K_ISERR(r)){
OUT("unable to stat module(%ld)\n",r);
goto err;
}
OUT("size=%lu...",m_stat.st_size);
k_l addr=sysc(mmap,6,0,m_stat.st_size,K_PROT_READ,
K_MAP_PRIVATE|K_MAP_POPULATE,fd,0);
if(K_ISERR(addr)){
OUT("unable to mmap module(%ld)\n",addr);
goto err;
}
r=sysc(init_module,3,addr,m_stat.st_size,"");
if(K_ISERR(r)){
OUT("unable init module(%ld)\n",r);
goto err;
}
return;
err:
sysc(exit_group,1,-1);
}
void modules_load(void)
{
k_u8 **m=modules_list;
while(*m!=0){
OUT(PRE "loading module '%s'...",*m);
module_load(*m);
OUTC("done\n");
++m;
}
}
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
279 |
467ddb5b4b0f002ff0eca0a95df378216f88d238 |
README |
100644 |
blob |
694 |
bd3e57878695b87b61d8029ed1b90515140a881c |
conf.mk |
100644 |
blob |
752 |
e33a5e290ca664575b3b191caecf2f73f5921e90 |
globals.h |
100644 |
blob |
1511 |
9650bdbde84702a0af2ea1cd94d56e4e0eed9ee0 |
init.c |
100644 |
blob |
2576 |
21d878573991486a71e5f2c76f45dde2e5a8916c |
makefile |
100644 |
blob |
1518 |
9b1a728acfb8a1b4001bd184768aa91ab5dfc3e9 |
modules.c |
100644 |
blob |
406 |
f5e162a64baf80fef122ef374b138aa50fc4158b |
modules.h |
040000 |
tree |
- |
411cf6aace0ae666b41cecc267da82828eba511d |
script |
100644 |
blob |
495 |
12ec719079e2cc5c9189d0cb59c838746ad7d170 |
uevent.c |
100644 |
blob |
416 |
867f22d10d93effd2a58227deded6274f63ebcfd |
uevent.h |
100644 |
blob |
3786 |
1684f9b6fbb7533af3129805756542fd9223bf61 |
uevents.c |
100644 |
blob |
435 |
5832804a0a8b48e2b5642044ab589d6c7dc682ae |
uevents.h |
040000 |
tree |
- |
065c28358152d0d067168ca95cc5e6551995c5c5 |
ulinux |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/sylware/cinitramfs
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/sylware/cinitramfs
Clone this repository using git:
git clone git://git.rocketgit.com/user/sylware/cinitramfs
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main