gmodule.h (1337B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 */ 7 8 #ifndef __COMMON_LINUX_KRN_GMODULE_H__ 9 #define __COMMON_LINUX_KRN_GMODULE_H__ 10 11 #include <lkm.h> 12 13 typedef struct gmodule_s { 14 15 const char* name; 16 int major; 17 int minor; 18 19 int (*init)(void); 20 int (*cleanup)(void); 21 22 int (*pprint)(void); 23 24 int (*open)(void); 25 int (*ioctl)(unsigned int cmd, unsigned long arg); 26 int (*close)(void); 27 int (*mmap) (struct file *filp, struct vm_area_struct *vma); 28 29 } gmodule_t; 30 31 32 /* The framework will ask for your module definition */ 33 extern gmodule_t* gmodule_get(void); 34 35 36 /* Proc Filesystem information */ 37 extern int pprintf(const char* fmt, ...) 38 __attribute__ ((format (printf, 1, 2))); 39 extern int gmodule_vpprintf(char** page, const char* fmt, va_list args) 40 __attribute__ ((format (printf, 2, 0))); 41 extern int gmodule_pprintf(char** page, const char* fmt, ...) 42 __attribute__ ((format (printf, 2, 3))); 43 44 extern int gprintk(const char* fmt, ...) 45 __attribute__ ((format (printf, 1, 2))); 46 47 extern int gdbg(const char* fmt, ...) 48 __attribute__ ((format (printf, 1, 2))); 49 #define GDBG gdbg 50 51 #endif /* __COMMON_LINUX_KRN_GMODULE_H__ */