openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

gmodule.h (1869B)


      1 /*
      2  * Copyright 2017 Broadcom
      3  * 
      4  * This program is free software; you can redistribute it and/or modify
      5  * it under the terms of the GNU General Public License, version 2, as
      6  * published by the Free Software Foundation (the "GPL").
      7  * 
      8  * This program is distributed in the hope that it will be useful, but
      9  * WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     11  * General Public License version 2 (GPLv2) for more details.
     12  * 
     13  * You should have received a copy of the GNU General Public License
     14  * version 2 (GPLv2) along with this source code.
     15  */
     16 /*
     17  * $Id: gmodule.h,v 1.9 Broadcom SDK $
     18  * $Copyright: (c) 2005 Broadcom Corp.
     19  * All Rights Reserved.$
     20  */
     21 
     22 #ifndef __COMMON_LINUX_KRN_GMODULE_H__
     23 #define __COMMON_LINUX_KRN_GMODULE_H__
     24 
     25 #include <lkm.h>
     26 
     27 typedef struct gmodule_s {
     28   
     29     const char* name;
     30     int         major;
     31     int		minor; 
     32 
     33     int (*init)(void);
     34     int (*cleanup)(void);
     35   
     36     int (*pprint)(void);
     37   
     38     int (*open)(void);
     39     int (*ioctl)(unsigned int cmd, unsigned long arg);
     40     int (*close)(void);
     41     int (*mmap) (struct file *filp, struct vm_area_struct *vma);
     42 
     43 } gmodule_t;
     44   
     45 
     46 /* The framework will ask for your module definition */
     47 extern gmodule_t* gmodule_get(void);
     48 
     49 
     50 /* Proc Filesystem information */
     51 extern int pprintf(const char* fmt, ...)
     52     __attribute__ ((format (printf, 1, 2)));
     53 extern int gmodule_vpprintf(char** page, const char* fmt, va_list args)
     54     __attribute__ ((format (printf, 2, 0)));
     55 extern int gmodule_pprintf(char** page, const char* fmt, ...)
     56     __attribute__ ((format (printf, 2, 3)));
     57 
     58 extern int gprintk(const char* fmt, ...)
     59     __attribute__ ((format (printf, 1, 2)));
     60 
     61 extern int gdbg(const char* fmt, ...)
     62     __attribute__ ((format (printf, 1, 2)));
     63 #define GDBG gdbg
     64 
     65 #endif /* __COMMON_LINUX_KRN_GMODULE_H__ */