1300906Sasomers/*- 2300906Sasomers * Copyright (c) 2011, 2012, 2013 Spectra Logic Corporation 3300906Sasomers * All rights reserved. 4300906Sasomers * 5300906Sasomers * Redistribution and use in source and binary forms, with or without 6300906Sasomers * modification, are permitted provided that the following conditions 7300906Sasomers * are met: 8300906Sasomers * 1. Redistributions of source code must retain the above copyright 9300906Sasomers * notice, this list of conditions, and the following disclaimer, 10300906Sasomers * without modification. 11300906Sasomers * 2. Redistributions in binary form must reproduce at minimum a disclaimer 12300906Sasomers * substantially similar to the "NO WARRANTY" disclaimer below 13300906Sasomers * ("Disclaimer") and any redistribution must be conditioned upon 14300906Sasomers * including a substantially similar Disclaimer requirement for further 15300906Sasomers * binary redistribution. 16300906Sasomers * 17300906Sasomers * NO WARRANTY 18300906Sasomers * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19300906Sasomers * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20300906Sasomers * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 21300906Sasomers * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22300906Sasomers * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23300906Sasomers * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24300906Sasomers * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25300906Sasomers * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26300906Sasomers * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 27300906Sasomers * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28300906Sasomers * POSSIBILITY OF SUCH DAMAGES. 29300906Sasomers * 30300906Sasomers * Authors: Justin T. Gibbs (Spectra Logic Corporation) 31300906Sasomers * 32300906Sasomers * $FreeBSD: releng/11.0/cddl/usr.sbin/zfsd/zfsd_exception.h 300906 2016-05-28 17:43:40Z asomers $ 33300906Sasomers */ 34300906Sasomers 35300906Sasomers/** 36300906Sasomers * \file zfsd_exception.h 37300906Sasomers * 38300906Sasomers * Definition of the ZfsdException class hierarchy. All exceptions 39300906Sasomers * explicitly thrown by Zfsd are defined here. 40300906Sasomers * 41300906Sasomers * Header requirements: 42300906Sasomers * #include <string> 43300906Sasomers * 44300906Sasomers * #include <devdctl/exception.h> 45300906Sasomers */ 46300906Sasomers#ifndef _ZFSD_EXCEPTION_H_ 47300906Sasomers#define _ZFSD_EXCEPTION_H_ 48300906Sasomers 49300906Sasomers/*=========================== Forward Declarations ===========================*/ 50300906Sasomersstruct zpool_handle; 51300906Sasomerstypedef struct zpool_handle zpool_handle_t; 52300906Sasomers 53300906Sasomersstruct nvlist; 54300906Sasomerstypedef struct nvlist nvlist_t; 55300906Sasomers 56300906Sasomers/*============================= Class Definitions ============================*/ 57300906Sasomers/*------------------------------- ZfsdException ------------------------------*/ 58300906Sasomers/** 59300906Sasomers * \brief Class allowing unified reporting/logging of exceptional events. 60300906Sasomers */ 61300906Sasomersclass ZfsdException : public DevdCtl::Exception 62300906Sasomers{ 63300906Sasomerspublic: 64300906Sasomers /** 65300906Sasomers * \brief ZfsdException constructor allowing arbitrary string 66300906Sasomers * data to be reported. 67300906Sasomers * 68300906Sasomers * \param fmt Printf-like string format specifier. 69300906Sasomers */ 70300906Sasomers ZfsdException(const char *fmt, ...); 71300906Sasomers 72300906Sasomers /** 73300906Sasomers * \brief ZfsdException constructor allowing arbitrary string 74300906Sasomers * data to be reported and associated with the configuration 75300906Sasomers * data for a ZFS pool. 76300906Sasomers * 77300906Sasomers * \param pool Pool handle describing the pool to which this 78300906Sasomers * exception is associated. 79300906Sasomers * \param fmt Printf-like string format specifier. 80300906Sasomers * 81300906Sasomers * Instantiation with this method is used to report global 82300906Sasomers * pool errors. 83300906Sasomers */ 84300906Sasomers ZfsdException(zpool_handle_t *pool, const char *, ...); 85300906Sasomers 86300906Sasomers /** 87300906Sasomers * \brief ZfsdException constructor allowing arbitrary string 88300906Sasomers * data to be reported and associated with the configuration 89300906Sasomers * data for a ZFS pool. 90300906Sasomers * 91300906Sasomers * \param poolConfig Pool configuration describing the pool to 92300906Sasomers * which this exception is associated. 93300906Sasomers * \param fmt Printf-like string format specifier. 94300906Sasomers * 95300906Sasomers * Instantiation with this method is used to report global 96300906Sasomers * pool errors. 97300906Sasomers */ 98300906Sasomers ZfsdException(nvlist_t *poolConfig, const char *, ...); 99300906Sasomers 100300906Sasomers /** 101300906Sasomers * \brief Emit exception data to syslog(3). 102300906Sasomers */ 103300906Sasomers virtual void Log() const; 104300906Sasomersprivate: 105300906Sasomers nvlist_t *m_poolConfig; 106300906Sasomers nvlist_t *m_vdevConfig; 107300906Sasomers}; 108300906Sasomers 109300906Sasomers#endif /* _ZFSD_EXCEPTION_H_ */ 110