rtw_proc.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2017 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. *****************************************************************************/
  15. #ifndef __RTW_PROC_H__
  16. #define __RTW_PROC_H__
  17. #include <linux/proc_fs.h>
  18. #include <linux/seq_file.h>
  19. #define RTW_PROC_HDL_TYPE_SEQ 0
  20. #define RTW_PROC_HDL_TYPE_SSEQ 1
  21. struct rtw_proc_hdl {
  22. char *name;
  23. u8 type;
  24. union {
  25. int (*show)(struct seq_file *, void *);
  26. struct seq_operations *seq_op;
  27. } u;
  28. ssize_t (*write)(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data);
  29. };
  30. #define RTW_PROC_HDL_SEQ(_name, _seq_op, _write) \
  31. { .name = _name, .type = RTW_PROC_HDL_TYPE_SEQ, .u.seq_op = _seq_op, .write = _write}
  32. #define RTW_PROC_HDL_SSEQ(_name, _show, _write) \
  33. { .name = _name, .type = RTW_PROC_HDL_TYPE_SSEQ, .u.show = _show, .write = _write}
  34. #ifdef CONFIG_PROC_DEBUG
  35. struct proc_dir_entry *get_rtw_drv_proc(void);
  36. int rtw_drv_proc_init(void);
  37. void rtw_drv_proc_deinit(void);
  38. struct proc_dir_entry *rtw_adapter_proc_init(struct net_device *dev);
  39. void rtw_adapter_proc_deinit(struct net_device *dev);
  40. void rtw_adapter_proc_replace(struct net_device *dev);
  41. #else /* !CONFIG_PROC_DEBUG */
  42. #define get_rtw_drv_proc() NULL
  43. #define rtw_drv_proc_init() 0
  44. #define rtw_drv_proc_deinit() do {} while (0)
  45. #define rtw_adapter_proc_init(dev) NULL
  46. #define rtw_adapter_proc_deinit(dev) do {} while (0)
  47. #define rtw_adapter_proc_replace(dev) do {} while (0)
  48. #endif /* !CONFIG_PROC_DEBUG */
  49. #endif /* __RTW_PROC_H__ */