1 /* easyproc.h 2 * 3 * Copyright (C) 2010 - 2013 UNISYS CORPORATION 4 * All rights reserved. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or (at 9 * your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, but 12 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 14 * NON INFRINGEMENT. See the GNU General Public License for more 15 * details. 16 */ 17 18 /** @file ********************************************************************* 19 * 20 * This describes the interfaces necessary for a simple /proc file 21 * implementation for a driver. 22 * 23 ****************************************************************************** 24 */ 25 26 #ifndef __EASYPROC_H__ 27 #define __EASYPROC_H__ 28 29 #include "timskmod.h" 30 31 32 struct easyproc_driver_info { 33 struct proc_dir_entry *ProcDir; 34 struct proc_dir_entry *ProcDriverDir; 35 struct proc_dir_entry *ProcDriverDiagFile; 36 struct proc_dir_entry *ProcDeviceDir; 37 char *ProcId; 38 void (*Show_device_info)(struct seq_file *seq, void *p); 39 void (*Show_driver_info)(struct seq_file *seq); 40 void (*Write_device_info)(char *buf, size_t count, 41 loff_t *ppos, void *p); 42 void (*Write_driver_info)(char *buf, size_t count, loff_t *ppos); 43 }; 44 45 /* property is a file under /proc/<x>/device/<x>/<property_name> */ 46 struct easyproc_device_property_info { 47 char property_name[25]; 48 struct proc_dir_entry *procEntry; 49 struct easyproc_driver_info *pdriver; 50 void *devdata; 51 void (*show_device_property_info)(struct seq_file *seq, void *p); 52 }; 53 54 struct easyproc_device_info { 55 struct proc_dir_entry *procDevicexDir; 56 struct proc_dir_entry *procDevicexDiagFile; 57 struct easyproc_driver_info *pdriver; 58 void *devdata; 59 int devno; 60 /* allow for a number of custom properties for each device: */ 61 struct easyproc_device_property_info device_property_info[10]; 62 }; 63 64 void visor_easyproc_InitDevice(struct easyproc_driver_info *pdriver, 65 struct easyproc_device_info *p, int devno, 66 void *devdata); 67 void visor_easyproc_DeInitDevice(struct easyproc_driver_info *pdriver, 68 struct easyproc_device_info *p, int devno); 69 void visor_easyproc_InitDriver(struct easyproc_driver_info *pdriver, 70 char *procId, 71 void (*show_driver_info)(struct seq_file *), 72 void (*show_device_info)(struct seq_file *, 73 void *)); 74 void visor_easyproc_InitDriverEx(struct easyproc_driver_info *pdriver, 75 char *procId, 76 void (*show_driver_info)(struct seq_file *), 77 void (*show_device_info)(struct seq_file *, 78 void *), 79 void (*Write_driver_info)(char *buf, 80 size_t count, 81 loff_t *ppos), 82 void (*Write_device_info)(char *buf, 83 size_t count, 84 loff_t *ppos, 85 void *p)); 86 void visor_easyproc_DeInitDriver(struct easyproc_driver_info *pdriver); 87 void visor_easyproc_CreateDeviceProperty(struct easyproc_device_info *p, 88 void (*show_property_info) 89 (struct seq_file *, void *), 90 char *property_name); 91 92 #endif 93