1*ca01d6ddSTony Luck /* 2*ca01d6ddSTony Luck * Persistent Storage - pstore.h 3*ca01d6ddSTony Luck * 4*ca01d6ddSTony Luck * Copyright (C) 2010 Intel Corporation <tony.luck@intel.com> 5*ca01d6ddSTony Luck * 6*ca01d6ddSTony Luck * This code is the generic layer to export data records from platform 7*ca01d6ddSTony Luck * level persistent storage via a file system. 8*ca01d6ddSTony Luck * 9*ca01d6ddSTony Luck * This program is free software; you can redistribute it and/or modify 10*ca01d6ddSTony Luck * it under the terms of the GNU General Public License version 2 as 11*ca01d6ddSTony Luck * published by the Free Software Foundation. 12*ca01d6ddSTony Luck * 13*ca01d6ddSTony Luck * This program is distributed in the hope that it will be useful, 14*ca01d6ddSTony Luck * but WITHOUT ANY WARRANTY; without even the implied warranty of 15*ca01d6ddSTony Luck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16*ca01d6ddSTony Luck * GNU General Public License for more details. 17*ca01d6ddSTony Luck * 18*ca01d6ddSTony Luck * You should have received a copy of the GNU General Public License 19*ca01d6ddSTony Luck * along with this program; if not, write to the Free Software 20*ca01d6ddSTony Luck * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21*ca01d6ddSTony Luck */ 22*ca01d6ddSTony Luck #ifndef _LINUX_PSTORE_H 23*ca01d6ddSTony Luck #define _LINUX_PSTORE_H 24*ca01d6ddSTony Luck 25*ca01d6ddSTony Luck /* types */ 26*ca01d6ddSTony Luck enum pstore_type_id { 27*ca01d6ddSTony Luck PSTORE_TYPE_DMESG = 0, 28*ca01d6ddSTony Luck PSTORE_TYPE_MCE = 1, 29*ca01d6ddSTony Luck PSTORE_TYPE_UNKNOWN = 255 30*ca01d6ddSTony Luck }; 31*ca01d6ddSTony Luck 32*ca01d6ddSTony Luck struct pstore_info { 33*ca01d6ddSTony Luck struct module *owner; 34*ca01d6ddSTony Luck char *name; 35*ca01d6ddSTony Luck struct mutex buf_mutex; /* serialize access to 'buf' */ 36*ca01d6ddSTony Luck char *buf; 37*ca01d6ddSTony Luck size_t bufsize; 38*ca01d6ddSTony Luck size_t (*read)(u64 *id, enum pstore_type_id *type, 39*ca01d6ddSTony Luck struct timespec *time); 40*ca01d6ddSTony Luck u64 (*write)(enum pstore_type_id type, size_t size); 41*ca01d6ddSTony Luck int (*erase)(u64 id); 42*ca01d6ddSTony Luck }; 43*ca01d6ddSTony Luck 44*ca01d6ddSTony Luck #ifdef CONFIG_PSTORE 45*ca01d6ddSTony Luck extern int pstore_register(struct pstore_info *); 46*ca01d6ddSTony Luck extern int pstore_write(enum pstore_type_id type, char *buf, size_t size); 47*ca01d6ddSTony Luck #else 48*ca01d6ddSTony Luck static inline int 49*ca01d6ddSTony Luck pstore_register(struct pstore_info *psi) 50*ca01d6ddSTony Luck { 51*ca01d6ddSTony Luck return -ENODEV; 52*ca01d6ddSTony Luck } 53*ca01d6ddSTony Luck static inline int 54*ca01d6ddSTony Luck pstore_write(enum pstore_type_id type, char *buf, size_t size) 55*ca01d6ddSTony Luck { 56*ca01d6ddSTony Luck return -ENODEV; 57*ca01d6ddSTony Luck } 58*ca01d6ddSTony Luck #endif 59*ca01d6ddSTony Luck 60*ca01d6ddSTony Luck #endif /*_LINUX_PSTORE_H*/ 61