/* include/kernel/module.h * * Copyright (C) 2021, 2022 intirain. * * This file is part of evx. * * evx is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * evx is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with evx. If not, see */ #ifndef __MODULE_H #define __MODULE_H #ifndef __ASSEMBLER__ #include struct modfuncs { /* point to blk/chr/net operations */ void *ops; struct modfuncs *next; }; struct kmodule { char *mod_name; /* this module compiled inside kernel */ #define MODTYPE_KINSIDE 0x0001 #define MODTYPE_GPL 0x0002 #define MODTYPE_BLKDRV 0x0004 #define MODTYPE_CHRDRV 0x0008 #define MODTYPE_NETDRV 0x0010 #define MODTYPE_KPATCH 0x0020 #define MODTYPE_FS 0x0040 /* there is a panic (or oops) caused by this module */ #define MODTYPE_CAUSED_PANIC 0x0080 __uint16_t mod_type; /* reference count of this module. */ __uint32_t mod_refer; struct modfuncs *mod_funcs; /* the uid of the installer of this module */ __uid_t installer_uid; }; #define module_init(fn) \ void *__initcall_##fn __attribute__ ((__section__ (".initcalls.modules"))) = fn; \ #endif #endif