2 * Copyright (c) 2011, 2012, 2013 Spectra Logic Corporation
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions, and the following disclaimer,
10 * without modification.
11 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12 * substantially similar to the "NO WARRANTY" disclaimer below
13 * ("Disclaimer") and any redistribution must be conditioned upon
14 * including a substantially similar Disclaimer requirement for further
15 * binary redistribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGES.
30 * Authors: Justin T. Gibbs (Spectra Logic Corporation)
36 * \file zfsd_exception.h
38 * Definition of the ZfsdException class hierarchy. All exceptions
39 * explicitly thrown by Zfsd are defined here.
41 * Header requirements:
44 * #include <devdctl/exception.h>
46 #ifndef _ZFSD_EXCEPTION_H_
47 #define _ZFSD_EXCEPTION_H_
49 /*=========================== Forward Declarations ===========================*/
51 typedef struct zpool_handle zpool_handle_t;
54 typedef struct nvlist nvlist_t;
56 /*============================= Class Definitions ============================*/
57 /*------------------------------- ZfsdException ------------------------------*/
59 * \brief Class allowing unified reporting/logging of exceptional events.
61 class ZfsdException : public DevdCtl::Exception
65 * \brief ZfsdException constructor allowing arbitrary string
66 * data to be reported.
68 * \param fmt Printf-like string format specifier.
70 ZfsdException(const char *fmt, ...);
73 * \brief ZfsdException constructor allowing arbitrary string
74 * data to be reported and associated with the configuration
75 * data for a ZFS pool.
77 * \param pool Pool handle describing the pool to which this
78 * exception is associated.
79 * \param fmt Printf-like string format specifier.
81 * Instantiation with this method is used to report global
84 ZfsdException(zpool_handle_t *pool, const char *, ...);
87 * \brief ZfsdException constructor allowing arbitrary string
88 * data to be reported and associated with the configuration
89 * data for a ZFS pool.
91 * \param poolConfig Pool configuration describing the pool to
92 * which this exception is associated.
93 * \param fmt Printf-like string format specifier.
95 * Instantiation with this method is used to report global
98 ZfsdException(nvlist_t *poolConfig, const char *, ...);
101 * \brief Emit exception data to syslog(3).
103 virtual void Log() const;
105 nvlist_t *m_poolConfig;
106 nvlist_t *m_vdevConfig;
109 #endif /* _ZFSD_EXCEPTION_H_ */