\hypertarget{geom__vinum__state_8c_source}{}\doxysection{geom\+\_\+vinum\+\_\+state.\+c}
\label{geom__vinum__state_8c_source}\index{geom/vinum/geom\_vinum\_state.c@{geom/vinum/geom\_vinum\_state.c}}
\mbox{\hyperlink{geom__vinum__state_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2004, 2007 Lukas Ertl}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00005}00005 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00007}00007 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00008}00008 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00009}00009 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00010}00010 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00012}00012 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00013}00013 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00014}00014 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00015}00015 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00016}00016 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00017}00017 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00018}00018 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00019}00019 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00020}00020 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00021}00021 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00022}00022 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00023}00023 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00024}00024 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00025}00025 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00026}00026 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00027}00027 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00028}00028 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00029}00029 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00030}\mbox{\hyperlink{geom__vinum__state_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00030}} \mbox{\hyperlink{geom__vinum__state_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00031}00031 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <sys/libkern.h>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00034}00034 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom_8h}{geom/geom.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__dbg_8h}{geom/geom\_dbg.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__vinum__var_8h}{geom/vinum/geom\_vinum\_var.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__vinum_8h}{geom/vinum/geom\_vinum.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__vinum__share_8h}{geom/vinum/geom\_vinum\_share.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00040}00040 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00041}00041 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00042}\mbox{\hyperlink{geom__vinum_8h_a1bc775115c46b8a5061e5808a6dcfed1}{00042}} \mbox{\hyperlink{geom__vinum__state_8c_a4beae3e7bd2a2a77afbaa95bb88094ad}{gv\_setstate}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__geom}{g\_geom}} *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structgctl__req}{gctl\_req}} *\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00043}00043 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00044}00044         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__softc}{gv\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00045}00045         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__sd}{gv\_sd}} *s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00046}00046         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__drive}{gv\_drive}} *d;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00047}00047         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__volume}{gv\_volume}} *v;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00048}00048         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__plex}{gv\_plex}} *p;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00049}00049         \textcolor{keywordtype}{char} *obj, *\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00050}00050         \textcolor{keywordtype}{int} f, *\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}}, \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00051}00051 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00052}00052         f = 0;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00053}00053         obj = \mbox{\hyperlink{geom_8h_a3e3d6786258b3336d55a96607f9b8eb8}{gctl\_get\_param}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}object"{}}, NULL);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00054}00054         \textcolor{keywordflow}{if} (obj == NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00055}00055                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}no object given"{}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00056}00056                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00057}00057         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00059}00059         \mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} = \mbox{\hyperlink{geom_8h_a3e3d6786258b3336d55a96607f9b8eb8}{gctl\_get\_param}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}state"{}}, NULL);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00060}00060         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00061}00061                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}no state given"{}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00062}00062                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00063}00063         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00064}00064 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00065}00065         \mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} = \mbox{\hyperlink{geom_8h_ab762d12640f528d8f1f60eee92bf5f3b}{gctl\_get\_paraml}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}flags"{}}, \textcolor{keyword}{sizeof}(*\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00066}00066         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00067}00067                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}no flags given"{}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00068}00068                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00069}00069         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00071}00071         \textcolor{keywordflow}{if} (*\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a916ff06e2bdbe5d20c32322c9a75128b}{GV\_FLAG\_F}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00072}00072                 f = \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00073}00073 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00074}00074         sc = \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00075}00075         \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} = \mbox{\hyperlink{geom__vinum_8h_adf857930fd65dd84870be1db99e860f7}{gv\_object\_type}}(sc, obj);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00076}00076         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00077}00077         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_ac00b5b481f097143593b6ac29dd4156f}{GV\_TYPE\_VOL}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00078}00078                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom__vinum__share_8c_a3d33c201d385d451cb4e613b28b5dfd4}{gv\_volstatei}}(\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}}) < 0) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00079}00079                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}invalid volume state '\%s'"{}}, \mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00080}00080                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00081}00081                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00082}00082                 v = \mbox{\hyperlink{geom__vinum_8h_a2fb94d2e82510ca78bb8c88fbc12315e}{gv\_find\_vol}}(sc, obj);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00083}00083                 \mbox{\hyperlink{geom__vinum_8h_ab8b55e981fb9c93aa56042746dd4bf5a}{gv\_post\_event}}(sc, \mbox{\hyperlink{geom__vinum__var_8h_a7ae1dad97b995a4c4236bfcf89215e72}{GV\_EVENT\_SET\_VOL\_STATE}}, v, NULL,}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00084}00084                     \mbox{\hyperlink{geom__vinum__share_8c_a3d33c201d385d451cb4e613b28b5dfd4}{gv\_volstatei}}(\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}}), f);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00085}00085                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00086}00086 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00087}00087         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a2a21f3f69c0e60c425744a299cd49a6f}{GV\_TYPE\_PLEX}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00088}00088                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom__vinum__share_8c_a7d84b92f2d1185bd816798565423f734}{gv\_plexstatei}}(\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}}) < 0) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00089}00089                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}invalid plex state '\%s'"{}}, \mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00090}00090                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00091}00091                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00092}00092                 p = \mbox{\hyperlink{geom__vinum_8h_acf034b996fb50e3a99f2f0d98ffecc53}{gv\_find\_plex}}(sc, obj);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00093}00093                 \mbox{\hyperlink{geom__vinum_8h_ab8b55e981fb9c93aa56042746dd4bf5a}{gv\_post\_event}}(sc, \mbox{\hyperlink{geom__vinum__var_8h_ac7a1b177b6ba4cb23559c7be832dac60}{GV\_EVENT\_SET\_PLEX\_STATE}}, p, NULL,}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00094}00094                     \mbox{\hyperlink{geom__vinum__share_8c_a7d84b92f2d1185bd816798565423f734}{gv\_plexstatei}}(\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}}), f);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00095}00095                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00096}00096 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00097}00097         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_acb4b8aa524c3ba1c7abaa181a5cb6bb9}{GV\_TYPE\_SD}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00098}00098                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom__vinum__share_8c_a829b9547a226dd993f3971571d5644a5}{gv\_sdstatei}}(\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}}) < 0) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00099}00099                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}invalid subdisk state '\%s'"{}}, \mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00100}00100                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00101}00101                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00102}00102                 s = \mbox{\hyperlink{geom__vinum_8h_ada178b6592b1acfe37ad3eecc8075769}{gv\_find\_sd}}(sc, obj);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00103}00103                 \mbox{\hyperlink{geom__vinum_8h_ab8b55e981fb9c93aa56042746dd4bf5a}{gv\_post\_event}}(sc, \mbox{\hyperlink{geom__vinum__var_8h_ac1b8cf9a4aa038cfdef57f93ec194f7a}{GV\_EVENT\_SET\_SD\_STATE}}, s, NULL,}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00104}00104                     \mbox{\hyperlink{geom__vinum__share_8c_a829b9547a226dd993f3971571d5644a5}{gv\_sdstatei}}(\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}}), f);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00105}00105                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00106}00106 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00107}00107         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a4f601240cfd57a614dee2cca5a2e9d67}{GV\_TYPE\_DRIVE}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00108}00108                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom__vinum__share_8c_ab8fcdce7a131f2c54c7db6f2c134c570}{gv\_drivestatei}}(\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}}) < 0) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00109}00109                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}invalid drive state '\%s'"{}}, \mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00110}00110                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00111}00111                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00112}00112                 d = \mbox{\hyperlink{geom__vinum_8h_a6bfd18558261750b40b0bfe3c18c4b8f}{gv\_find\_drive}}(sc, obj);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00113}00113                 \mbox{\hyperlink{geom__vinum_8h_ab8b55e981fb9c93aa56042746dd4bf5a}{gv\_post\_event}}(sc, \mbox{\hyperlink{geom__vinum__var_8h_a05586992825ebb2ad76d56db2ebca698}{GV\_EVENT\_SET\_DRIVE\_STATE}}, d, NULL,}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00114}00114                     \mbox{\hyperlink{geom__vinum__share_8c_ab8fcdce7a131f2c54c7db6f2c134c570}{gv\_drivestatei}}(\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}}), f);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00115}00115                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00116}00116 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00117}00117         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00118}00118                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}unknown object '\%s'"{}}, obj);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00119}00119                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00120}00120         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00121}00121 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00122}00122 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00123}00123 \textcolor{comment}{/* Update drive state; return 0 if the state changes, otherwise error. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00124}00124 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00125}\mbox{\hyperlink{geom__vinum_8h_ab600fc4d016f584dafab0ba6063453a0}{00125}} \mbox{\hyperlink{geom__vinum__state_8c_ad1ff55d598fa8c9ca9b22a286afec1db}{gv\_set\_drive\_state}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__drive}{gv\_drive}} *d, \textcolor{keywordtype}{int} newstate, \textcolor{keywordtype}{int} \mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00126}00126 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00127}00127         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__sd}{gv\_sd}} *s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00128}00128         \textcolor{keywordtype}{int} oldstate;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00129}00129 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00130}00130         KASSERT(d != NULL, (\textcolor{stringliteral}{"{}gv\_set\_drive\_state: NULL d"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00131}00131 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00132}00132         oldstate = d-\/>\mbox{\hyperlink{structgv__drive_af2b798d0717a723c580025dc04416ce7}{state}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00133}00133 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00134}00134         \textcolor{keywordflow}{if} (newstate == oldstate)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00135}00135                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00136}00136 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00137}00137         \textcolor{comment}{/* We allow to take down an open drive only with force. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00138}00138         \textcolor{keywordflow}{if} ((newstate == \mbox{\hyperlink{geom__vinum__var_8h_ab7ae7c257cd1b6a3ef82c1e963713b2b}{GV\_DRIVE\_DOWN}}) \&\& \mbox{\hyperlink{geom__vinum_8h_afc60119e84b762b87ad7f506e87d3478}{gv\_consumer\_is\_open}}(d-\/>\mbox{\hyperlink{structgv__drive_a69dfc95c0bafb10b4239b5d45059e85d}{consumer}}) \&\&}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00139}00139             (!(\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}})))}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00140}00140                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_a34608a22fc52b3fc8b0d849ee996e0a7}{GV\_ERR\_ISBUSY}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00141}00141 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00142}00142         d-\/>\mbox{\hyperlink{structgv__drive_af2b798d0717a723c580025dc04416ce7}{state}} = newstate;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00143}00143 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00144}00144         \textcolor{keywordflow}{if} (d-\/>\mbox{\hyperlink{structgv__drive_af2b798d0717a723c580025dc04416ce7}{state}} != oldstate) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00145}00145                 LIST\_FOREACH(s, \&d-\/>subdisks, from\_drive)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00146}00146                         \mbox{\hyperlink{geom__vinum__state_8c_aa5552d786d1a63e63cbde767f73cd92b}{gv\_update\_sd\_state}}(s);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00147}00147         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00148}00148 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00149}00149         \textcolor{comment}{/* Save the config back to disk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00150}00150         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a5015f80eba1026837e357a5b3f5ca7bb}{GV\_SETSTATE\_CONFIG}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00151}00151                 \mbox{\hyperlink{geom__vinum_8h_a893e3b157c798b3f925d71151d284dd9}{gv\_save\_config}}(d-\/>\mbox{\hyperlink{structgv__drive_a368fba77f67a1acc21238b5066c86261}{vinumconf}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00152}00152 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00153}00153         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00154}00154 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00155}00155 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00156}00156 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00157}\mbox{\hyperlink{geom__vinum_8h_a2dc4176c195982e77ba79874f999300e}{00157}} \mbox{\hyperlink{geom__vinum__state_8c_abdd92b0c27d426f08d519df658766077}{gv\_set\_sd\_state}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__sd}{gv\_sd}} *s, \textcolor{keywordtype}{int} newstate, \textcolor{keywordtype}{int} \mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00158}00158 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00159}00159         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__drive}{gv\_drive}} *d;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00160}00160         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__plex}{gv\_plex}} *p;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00161}00161         \textcolor{keywordtype}{int} oldstate, status;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00162}00162 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00163}00163         KASSERT(s != NULL, (\textcolor{stringliteral}{"{}gv\_set\_sd\_state: NULL s"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00164}00164 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00165}00165         oldstate = s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00166}00166 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00167}00167         \textcolor{comment}{/* We are optimistic and assume it will work. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00168}00168         status = 0;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00169}00169 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00170}00170         \textcolor{keywordflow}{if} (newstate == oldstate)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00171}00171                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00172}00172 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00173}00173         \textcolor{keywordflow}{switch} (newstate) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00174}00174         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a397e4bbebbaca115ef30ebb13a9d18bf}{GV\_SD\_DOWN}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00175}00175                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00176}00176 \textcolor{comment}{                 * If we're attached to a plex, we won't go down without use of}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00177}00177 \textcolor{comment}{                 * force.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00178}00178 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00179}00179                 \textcolor{keywordflow}{if} ((s-\/>\mbox{\hyperlink{structgv__sd_a6894be1eac4716d6eb2bd9e08b9643cf}{plex\_sc}} != NULL) \&\& !(\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}}))}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00180}00180                         \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_a99756b5de9852cd4510167afb3c477df}{GV\_ERR\_ISATTACHED}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00181}00181                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00182}00182 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00183}00183         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a7fe4bfdd815ab9446e630efe806619d1}{GV\_SD\_REVIVING}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00184}00184         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_abb3257448e42ad06d3218e02cc26c8ba}{GV\_SD\_INITIALIZING}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00185}00185                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00186}00186 \textcolor{comment}{                 * Only do this if we're forced, since it usually is done}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00187}00187 \textcolor{comment}{                 * internally, and then we do use the force flag. }}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00188}00188 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00189}00189                 \textcolor{keywordflow}{if} (!(\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}}))}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00190}00190                         \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_ab7754e801e32ba31fc925dc54f224708}{GV\_ERR\_SETSTATE}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00191}00191                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00192}00192 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00193}00193         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a85ea8962028c1319a7fd5cd7adc4e497}{GV\_SD\_UP}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00194}00194                 \textcolor{comment}{/* We can't bring the subdisk up if our drive is dead. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00195}00195                 d = s-\/>\mbox{\hyperlink{structgv__sd_a2b31867e2118053e8a27ce048a84335e}{drive\_sc}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00196}00196                 \textcolor{keywordflow}{if} ((d == NULL) || (d-\/>\mbox{\hyperlink{structgv__drive_af2b798d0717a723c580025dc04416ce7}{state}} != \mbox{\hyperlink{geom__vinum__var_8h_a8a76c535d700d8c84cb573b43fd010f7}{GV\_DRIVE\_UP}}))}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00197}00197                         \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_ab7754e801e32ba31fc925dc54f224708}{GV\_ERR\_SETSTATE}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00198}00198 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00199}00199                 \textcolor{comment}{/* Check from where we want to be brought up. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00200}00200                 \textcolor{keywordflow}{switch} (s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00201}00201                 \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a7fe4bfdd815ab9446e630efe806619d1}{GV\_SD\_REVIVING}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00202}00202                 \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_abb3257448e42ad06d3218e02cc26c8ba}{GV\_SD\_INITIALIZING}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00203}00203                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00204}00204 \textcolor{comment}{                         * The subdisk was initializing.  We allow it to be}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00205}00205 \textcolor{comment}{                         * brought up.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00206}00206 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00207}00207                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00208}00208 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00209}00209                 \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a397e4bbebbaca115ef30ebb13a9d18bf}{GV\_SD\_DOWN}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00210}00210                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00211}00211 \textcolor{comment}{                         * The subdisk is currently down.  We allow it to be}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00212}00212 \textcolor{comment}{                         * brought up if it is not attached to a plex.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00213}00213 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00214}00214                         p = s-\/>\mbox{\hyperlink{structgv__sd_a6894be1eac4716d6eb2bd9e08b9643cf}{plex\_sc}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00215}00215                         \textcolor{keywordflow}{if} (p == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00216}00216                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00217}00217 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00218}00218                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00219}00219 \textcolor{comment}{                         * If this subdisk is attached to a plex, we allow it}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00220}00220 \textcolor{comment}{                         * to be brought up if the plex if it's not a RAID5}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00221}00221 \textcolor{comment}{                         * plex, otherwise it's made 'stale'.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00222}00222 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00223}00223 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00224}00224                         \textcolor{keywordflow}{if} (p-\/>\mbox{\hyperlink{structgv__plex_ac35ac16eab74d053052bdb850ff7efbd}{org}} != \mbox{\hyperlink{geom__vinum__var_8h_a77d0838869414279112148a8b1efee50}{GV\_PLEX\_RAID5}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00225}00225                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00226}00226                         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a580eee21c71602cef6f2e6443719adb8}{GV\_SD\_CANGOUP}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00227}00227                                 s-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \&= \string~GV\_SD\_CANGOUP;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00228}00228                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00229}00229                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00230}00230                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00231}00231                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00232}00232                                 s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a5dd4abf3a748b1a4ee0da0bab79840d2}{GV\_SD\_STALE}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00233}00233 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00234}00234                         status = \mbox{\hyperlink{geom__vinum__var_8h_ab7754e801e32ba31fc925dc54f224708}{GV\_ERR\_SETSTATE}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00235}00235                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00236}00236 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00237}00237                 \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a5dd4abf3a748b1a4ee0da0bab79840d2}{GV\_SD\_STALE}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00238}00238                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00239}00239 \textcolor{comment}{                         * A stale subdisk can be brought up only if it's part}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00240}00240 \textcolor{comment}{                         * of a concat or striped plex that's the only one in a}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00241}00241 \textcolor{comment}{                         * volume, or if the subdisk isn't attached to a plex.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00242}00242 \textcolor{comment}{                         * Otherwise it needs to be revived or initialized}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00243}00243 \textcolor{comment}{                         * first.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00244}00244 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00245}00245                         p = s-\/>\mbox{\hyperlink{structgv__sd_a6894be1eac4716d6eb2bd9e08b9643cf}{plex\_sc}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00246}00246                         \textcolor{keywordflow}{if} (p == NULL || \mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00247}00247                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00248}00248 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00249}00249                         \textcolor{keywordflow}{if} ((p-\/>\mbox{\hyperlink{structgv__plex_ac35ac16eab74d053052bdb850ff7efbd}{org}} != \mbox{\hyperlink{geom__vinum__var_8h_a77d0838869414279112148a8b1efee50}{GV\_PLEX\_RAID5}} \&\&}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00250}00250                             p-\/>\mbox{\hyperlink{structgv__plex_a8e2820d6bd8419d81213f77131d6bd5c}{vol\_sc}}-\/>\mbox{\hyperlink{structgv__volume_a6a2fb4e2da02537035c219df64a65a80}{plexcount}} == 1) ||}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00251}00251                             (p-\/>\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_ae2f57f1186f28adbc12ccf3984be2fc2}{GV\_PLEX\_SYNCING}} \&\&}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00252}00252                             p-\/>\mbox{\hyperlink{structgv__plex_a57ccdca6549fd9e5778635743104391e}{synced}} > 0 \&\&}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00253}00253                             p-\/>\mbox{\hyperlink{structgv__plex_ac35ac16eab74d053052bdb850ff7efbd}{org}} == \mbox{\hyperlink{geom__vinum__var_8h_a77d0838869414279112148a8b1efee50}{GV\_PLEX\_RAID5}}))}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00254}00254                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00255}00255                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00256}00256                                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_ab7754e801e32ba31fc925dc54f224708}{GV\_ERR\_SETSTATE}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00257}00257 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00258}00258                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00259}00259                         \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_a8cee3d102e39840048f667e4965028d0}{GV\_ERR\_INVSTATE}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00260}00260                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00261}00261                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00262}00262 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00263}00263         \textcolor{comment}{/* Other state transitions are only possible with force. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00264}00264         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00265}00265                 \textcolor{keywordflow}{if} (!(\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}}))}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00266}00266                         \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_ab7754e801e32ba31fc925dc54f224708}{GV\_ERR\_SETSTATE}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00267}00267         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00268}00268 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00269}00269         \textcolor{comment}{/* We can change the state and do it. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00270}00270         \textcolor{keywordflow}{if} (status == 0)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00271}00271                 s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} = newstate;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00272}00272 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00273}00273         \textcolor{comment}{/* Update our plex, if we're attached to one. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00274}00274         \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_a6894be1eac4716d6eb2bd9e08b9643cf}{plex\_sc}} != NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00275}00275                 \mbox{\hyperlink{geom__vinum__state_8c_ad6945700d37176c46ad81f34c0d25e67}{gv\_update\_plex\_state}}(s-\/>\mbox{\hyperlink{structgv__sd_a6894be1eac4716d6eb2bd9e08b9643cf}{plex\_sc}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00276}00276 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00277}00277         \textcolor{comment}{/* Save the config back to disk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00278}00278         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a5015f80eba1026837e357a5b3f5ca7bb}{GV\_SETSTATE\_CONFIG}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00279}00279                 \mbox{\hyperlink{geom__vinum_8h_a893e3b157c798b3f925d71151d284dd9}{gv\_save\_config}}(s-\/>\mbox{\hyperlink{structgv__sd_a5852499bf04d1041f8014be8424f1f95}{vinumconf}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00280}00280 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00281}00281         \textcolor{keywordflow}{return} (status);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00282}00282 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00283}00283 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00284}00284 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00285}\mbox{\hyperlink{geom__vinum_8h_a6b370b29fa92afef6aa654a9e1eb5f0d}{00285}} \mbox{\hyperlink{geom__vinum__state_8c_a6b14164511737c5388057b53686bec38}{gv\_set\_plex\_state}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *p, \textcolor{keywordtype}{int} newstate, \textcolor{keywordtype}{int} \mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00286}00286 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00287}00287         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__volume}{gv\_volume}} *v;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00288}00288         \textcolor{keywordtype}{int} oldstate, plexdown;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00289}00289 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00290}00290         KASSERT(p != NULL, (\textcolor{stringliteral}{"{}gv\_set\_plex\_state: NULL p"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00291}00291 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00292}00292         oldstate = p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00293}00293         v = p-\/>\mbox{\hyperlink{structgv__plex_a8e2820d6bd8419d81213f77131d6bd5c}{vol\_sc}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00294}00294         plexdown = 0;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00295}00295 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00296}00296         \textcolor{keywordflow}{if} (newstate == oldstate)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00297}00297                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00298}00298 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00299}00299         \textcolor{keywordflow}{switch} (newstate) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00300}00300         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a2a5ed58267acc541957b387d71bd868d}{GV\_PLEX\_UP}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00301}00301                 \textcolor{comment}{/* Let update\_plex handle if the plex can come up */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00302}00302                 \mbox{\hyperlink{geom__vinum__state_8c_ad6945700d37176c46ad81f34c0d25e67}{gv\_update\_plex\_state}}(p);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00303}00303                 \textcolor{keywordflow}{if} (p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} != \mbox{\hyperlink{geom__vinum__var_8h_a2a5ed58267acc541957b387d71bd868d}{GV\_PLEX\_UP}} \&\& !(\mbox{\hyperlink{structgv__volume_a152fb6b79767817e0c97ff08279501be}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}}))}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00304}00304                         \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_ab7754e801e32ba31fc925dc54f224708}{GV\_ERR\_SETSTATE}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00305}00305                 p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} = newstate;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00306}00306                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00307}00307         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a9eebfaad55e358e87acc6a9bacc163b7}{GV\_PLEX\_DOWN}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00308}00308                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00309}00309 \textcolor{comment}{                 * Set state to GV\_PLEX\_DOWN only if no-\/one is using the plex,}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00310}00310 \textcolor{comment}{                 * or if the state is forced.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00311}00311 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00312}00312                 \textcolor{keywordflow}{if} (v != NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00313}00313                         \textcolor{comment}{/* If the only one up, force is needed. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00314}00314                         plexdown = \mbox{\hyperlink{geom__vinum_8h_a996474203002f5349c6a0ec074971dfa}{gv\_plexdown}}(v);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00315}00315                         \textcolor{keywordflow}{if} ((v-\/>\mbox{\hyperlink{structgv__volume_a6a2fb4e2da02537035c219df64a65a80}{plexcount}} == 1 ||}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00316}00316                             (v-\/>\mbox{\hyperlink{structgv__volume_a6a2fb4e2da02537035c219df64a65a80}{plexcount}} -\/ plexdown == 1)) \&\&}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00317}00317                             ((\mbox{\hyperlink{structgv__volume_a152fb6b79767817e0c97ff08279501be}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}}) == 0))}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00318}00318                                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_ab7754e801e32ba31fc925dc54f224708}{GV\_ERR\_SETSTATE}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00319}00319                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00320}00320                 p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} = newstate;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00321}00321                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00322}00322         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a80774ac8b615985dacf9f245fe370d7c}{GV\_PLEX\_DEGRADED}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00323}00323                 \textcolor{comment}{/* Only used internally, so we have to be forced. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00324}00324                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structgv__volume_a152fb6b79767817e0c97ff08279501be}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00325}00325                         p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} = newstate;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00326}00326                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00327}00327         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00328}00328 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00329}00329         \textcolor{comment}{/* Update our volume if we have one. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00330}00330         \textcolor{keywordflow}{if} (v != NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00331}00331                 \mbox{\hyperlink{geom__vinum__state_8c_a594b665b349eaa0dc8871172ad747c43}{gv\_update\_vol\_state}}(v);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00332}00332 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00333}00333         \textcolor{comment}{/* Save config. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00334}00334         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structgv__volume_a152fb6b79767817e0c97ff08279501be}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a5015f80eba1026837e357a5b3f5ca7bb}{GV\_SETSTATE\_CONFIG}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00335}00335                 \mbox{\hyperlink{geom__vinum_8h_a893e3b157c798b3f925d71151d284dd9}{gv\_save\_config}}(p-\/>\mbox{\hyperlink{structgv__plex_ad30d136a924b3367b9752c10f2391cdc}{vinumconf}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00336}00336         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00337}00337 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00338}00338 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00339}00339 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00340}\mbox{\hyperlink{geom__vinum_8h_a59349c469c7862e251f7fa7e978d338b}{00340}} \mbox{\hyperlink{geom__vinum__state_8c_a06cb68e5927a0af769eed74c90855d13}{gv\_set\_vol\_state}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__volume}{gv\_volume}} *v, \textcolor{keywordtype}{int} newstate, \textcolor{keywordtype}{int} \mbox{\hyperlink{structgv__volume_a152fb6b79767817e0c97ff08279501be}{flags}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00341}00341 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00342}00342         \textcolor{keywordtype}{int} oldstate;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00343}00343 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00344}00344         KASSERT(v != NULL, (\textcolor{stringliteral}{"{}gv\_set\_vol\_state: NULL v"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00345}00345 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00346}00346         oldstate = v-\/>\mbox{\hyperlink{structgv__volume_a54dd71f304a3aefc237c7cef1dac9777}{state}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00347}00347 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00348}00348         \textcolor{keywordflow}{if} (newstate == oldstate)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00349}00349                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00350}00350 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00351}00351         \textcolor{keywordflow}{switch} (newstate) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00352}00352         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a8844be9458f8ec729320775c16ccc542}{GV\_VOL\_UP}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00353}00353                 \textcolor{comment}{/* Let update handle if the volume can come up. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00354}00354                 \mbox{\hyperlink{geom__vinum__state_8c_a594b665b349eaa0dc8871172ad747c43}{gv\_update\_vol\_state}}(v);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00355}00355                 \textcolor{keywordflow}{if} (v-\/>\mbox{\hyperlink{structgv__volume_a54dd71f304a3aefc237c7cef1dac9777}{state}} != \mbox{\hyperlink{geom__vinum__var_8h_a8844be9458f8ec729320775c16ccc542}{GV\_VOL\_UP}} \&\& !(\mbox{\hyperlink{structgv__volume_a152fb6b79767817e0c97ff08279501be}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}}))}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00356}00356                         \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_ab7754e801e32ba31fc925dc54f224708}{GV\_ERR\_SETSTATE}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00357}00357                 v-\/>\mbox{\hyperlink{structgv__volume_a54dd71f304a3aefc237c7cef1dac9777}{state}} = newstate;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00358}00358                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00359}00359         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_af08dd2b0a2b9c2b5f74eaf5927a99c5c}{GV\_VOL\_DOWN}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00360}00360                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00361}00361 \textcolor{comment}{                 * Set state to GV\_VOL\_DOWN only if no-\/one is using the volume,}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00362}00362 \textcolor{comment}{                 * or if the state should be forced.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00363}00363 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00364}00364                 \textcolor{keywordflow}{if} (!\mbox{\hyperlink{geom__vinum_8h_ae338f192dec3e4a3cfd3bc369a9a09dd}{gv\_provider\_is\_open}}(v-\/>\mbox{\hyperlink{structgv__volume_a22436521ee96530c09a185172fb53bf7}{provider}}) \&\&}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00365}00365                     !(\mbox{\hyperlink{structgv__volume_a152fb6b79767817e0c97ff08279501be}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}}))}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00366}00366                         \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_a34608a22fc52b3fc8b0d849ee996e0a7}{GV\_ERR\_ISBUSY}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00367}00367                 v-\/>\mbox{\hyperlink{structgv__volume_a54dd71f304a3aefc237c7cef1dac9777}{state}} = newstate;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00368}00368                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00369}00369         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00370}00370         \textcolor{comment}{/* Save config */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00371}00371         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structgv__volume_a152fb6b79767817e0c97ff08279501be}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a5015f80eba1026837e357a5b3f5ca7bb}{GV\_SETSTATE\_CONFIG}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00372}00372                 \mbox{\hyperlink{geom__vinum_8h_a893e3b157c798b3f925d71151d284dd9}{gv\_save\_config}}(v-\/>\mbox{\hyperlink{structgv__volume_ac506c896287304f39a7beff5a450d63b}{vinumconf}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00373}00373         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00374}00374 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00375}00375 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00376}00376 \textcolor{comment}{/* Update the state of a subdisk based on its environment. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00377}00377 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00378}\mbox{\hyperlink{geom__vinum_8h_a409b1521aec9681f61786308d57836e3}{00378}} \mbox{\hyperlink{geom__vinum__state_8c_aa5552d786d1a63e63cbde767f73cd92b}{gv\_update\_sd\_state}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__sd}{gv\_sd}} *s)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00379}00379 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00380}00380         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__drive}{gv\_drive}} *d;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00381}00381         \textcolor{keywordtype}{int} oldstate;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00382}00382 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00383}00383         KASSERT(s != NULL, (\textcolor{stringliteral}{"{}gv\_update\_sd\_state: NULL s"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00384}00384         d = s-\/>\mbox{\hyperlink{structgv__sd_a2b31867e2118053e8a27ce048a84335e}{drive\_sc}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00385}00385         KASSERT(d != NULL, (\textcolor{stringliteral}{"{}gv\_update\_sd\_state: NULL d"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00386}00386 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00387}00387         oldstate = s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00388}00388 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00389}00389         \textcolor{comment}{/* If our drive isn't up we cannot be up either. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00390}00390         \textcolor{keywordflow}{if} (d-\/>\mbox{\hyperlink{structgv__drive_af2b798d0717a723c580025dc04416ce7}{state}} != \mbox{\hyperlink{geom__vinum__var_8h_a8a76c535d700d8c84cb573b43fd010f7}{GV\_DRIVE\_UP}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00391}00391                 s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a397e4bbebbaca115ef30ebb13a9d18bf}{GV\_SD\_DOWN}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00392}00392         \textcolor{comment}{/* If this subdisk was just created, we assume it is good.*/}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00393}00393         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a584cc0d4d0451a7c5f719bbfacc530d7}{GV\_SD\_NEWBORN}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00394}00394                 s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a85ea8962028c1319a7fd5cd7adc4e497}{GV\_SD\_UP}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00395}00395                 s-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \&= \string~GV\_SD\_NEWBORN;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00396}00396         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} != \mbox{\hyperlink{geom__vinum__var_8h_a85ea8962028c1319a7fd5cd7adc4e497}{GV\_SD\_UP}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00397}00397                 \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a580eee21c71602cef6f2e6443719adb8}{GV\_SD\_CANGOUP}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00398}00398                         s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a85ea8962028c1319a7fd5cd7adc4e497}{GV\_SD\_UP}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00399}00399                         s-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \&= \string~GV\_SD\_CANGOUP;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00400}00400                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00401}00401                         s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a5dd4abf3a748b1a4ee0da0bab79840d2}{GV\_SD\_STALE}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00402}00402         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00403}00403                 s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a85ea8962028c1319a7fd5cd7adc4e497}{GV\_SD\_UP}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00404}00404 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00405}00405         \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} != oldstate)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00406}00406                 \mbox{\hyperlink{geom__vinum_8h_a28cdbd7c30e435ff9ec8676f493593a0}{G\_VINUM\_DEBUG}}(1, \textcolor{stringliteral}{"{}subdisk \%s state change: \%s -\/> \%s"{}}, s-\/>\mbox{\hyperlink{structgv__sd_a835bdd1e1c9adf03425b91c873eebf1e}{name}},}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00407}00407                     \mbox{\hyperlink{geom__vinum__share_8c_a3d13d2bb3d32f3fe52928022b2d5c602}{gv\_sdstate}}(oldstate), \mbox{\hyperlink{geom__vinum__share_8c_a3d13d2bb3d32f3fe52928022b2d5c602}{gv\_sdstate}}(s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00408}00408 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00409}00409         \textcolor{comment}{/* Update the plex, if we have one. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00410}00410         \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_a6894be1eac4716d6eb2bd9e08b9643cf}{plex\_sc}} != NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00411}00411                 \mbox{\hyperlink{geom__vinum__state_8c_ad6945700d37176c46ad81f34c0d25e67}{gv\_update\_plex\_state}}(s-\/>\mbox{\hyperlink{structgv__sd_a6894be1eac4716d6eb2bd9e08b9643cf}{plex\_sc}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00412}00412 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00413}00413 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00414}00414 \textcolor{comment}{/* Update the state of a plex based on its environment. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00415}00415 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00416}\mbox{\hyperlink{geom__vinum_8h_a25757335b3eb65dfb2bda345bce824e1}{00416}} \mbox{\hyperlink{geom__vinum__state_8c_ad6945700d37176c46ad81f34c0d25e67}{gv\_update\_plex\_state}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *p)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00417}00417 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00418}00418         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__sd}{gv\_sd}} *s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00419}00419         \textcolor{keywordtype}{int} sdstates;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00420}00420         \textcolor{keywordtype}{int} oldstate;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00421}00421 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00422}00422         KASSERT(p != NULL, (\textcolor{stringliteral}{"{}gv\_update\_plex\_state: NULL p"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00423}00423 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00424}00424         oldstate = p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00425}00425 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00426}00426         \textcolor{comment}{/* First, check the state of our subdisks. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00427}00427         sdstates = \mbox{\hyperlink{geom__vinum__state_8c_a389b3825c7c812ebe5f1e1748105ad98}{gv\_sdstatemap}}(p);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00428}00428 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00429}00429         \textcolor{comment}{/* If all subdisks are up, our plex can be up, too. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00430}00430         \textcolor{keywordflow}{if} (sdstates == \mbox{\hyperlink{geom__vinum__var_8h_a13610e128cf1e379398747f96c1a8c41}{GV\_SD\_UPSTATE}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00431}00431                 p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a2a5ed58267acc541957b387d71bd868d}{GV\_PLEX\_UP}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00432}00432 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00433}00433         \textcolor{comment}{/* One or more of our subdisks are down. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00434}00434         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (sdstates \& \mbox{\hyperlink{geom__vinum__var_8h_ac6b70b573a2ca73882bc1e7c11d5343b}{GV\_SD\_DOWNSTATE}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00435}00435                 \textcolor{comment}{/* A RAID5 plex can handle one dead subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00436}00436                 \textcolor{keywordflow}{if} ((p-\/>\mbox{\hyperlink{structgv__plex_ac35ac16eab74d053052bdb850ff7efbd}{org}} == \mbox{\hyperlink{geom__vinum__var_8h_a77d0838869414279112148a8b1efee50}{GV\_PLEX\_RAID5}}) \&\& (p-\/>\mbox{\hyperlink{structgv__plex_aa943246707740867fdaf52448353c6f0}{sddown}} == 1))}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00437}00437                         p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a80774ac8b615985dacf9f245fe370d7c}{GV\_PLEX\_DEGRADED}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00438}00438                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00439}00439                         p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a9eebfaad55e358e87acc6a9bacc163b7}{GV\_PLEX\_DOWN}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00440}00440 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00441}00441         \textcolor{comment}{/* Some of our subdisks are initializing. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00442}00442         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (sdstates \& \mbox{\hyperlink{geom__vinum__var_8h_ad73f1d427bef51384a23154ad0f31b89}{GV\_SD\_INITSTATE}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00443}00443                 \textcolor{keywordflow}{if} (p-\/>\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_ae2f57f1186f28adbc12ccf3984be2fc2}{GV\_PLEX\_SYNCING}} ||}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00444}00444                     p-\/>\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a13b286c390639eb1d6e8f3823443e7f0}{GV\_PLEX\_REBUILDING}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00445}00445                         p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a80774ac8b615985dacf9f245fe370d7c}{GV\_PLEX\_DEGRADED}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00446}00446                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00447}00447                         p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a9eebfaad55e358e87acc6a9bacc163b7}{GV\_PLEX\_DOWN}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00448}00448         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00449}00449                 p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a9eebfaad55e358e87acc6a9bacc163b7}{GV\_PLEX\_DOWN}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00450}00450 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00451}00451         \textcolor{keywordflow}{if} (p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} == \mbox{\hyperlink{geom__vinum__var_8h_a2a5ed58267acc541957b387d71bd868d}{GV\_PLEX\_UP}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00452}00452                 LIST\_FOREACH(s, \&p-\/>subdisks, in\_plex) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00453}00453                         \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a0cd7617b098897b809b9c9c9498a7605}{GV\_SD\_GROW}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00454}00454                                 p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a768ff0748cb47b0fa77b1381d770e6e9}{GV\_PLEX\_GROWABLE}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00455}00455                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00456}00456                         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00457}00457                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00458}00458         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00459}00459 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00460}00460         \textcolor{keywordflow}{if} (p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} != oldstate)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00461}00461                 \mbox{\hyperlink{geom__vinum_8h_a28cdbd7c30e435ff9ec8676f493593a0}{G\_VINUM\_DEBUG}}(1, \textcolor{stringliteral}{"{}plex \%s state change: \%s -\/> \%s"{}}, p-\/>\mbox{\hyperlink{structgv__plex_a0978e4d5dd271f5403af3cf98ae02103}{name}},}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00462}00462                     \mbox{\hyperlink{geom__vinum__share_8c_a8bae1daaa46161fa23672f2b220b30a8}{gv\_plexstate}}(oldstate), \mbox{\hyperlink{geom__vinum__share_8c_a8bae1daaa46161fa23672f2b220b30a8}{gv\_plexstate}}(p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00463}00463 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00464}00464         \textcolor{comment}{/* Update our volume, if we have one. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00465}00465         \textcolor{keywordflow}{if} (p-\/>\mbox{\hyperlink{structgv__plex_a8e2820d6bd8419d81213f77131d6bd5c}{vol\_sc}} != NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00466}00466                 \mbox{\hyperlink{geom__vinum__state_8c_a594b665b349eaa0dc8871172ad747c43}{gv\_update\_vol\_state}}(p-\/>\mbox{\hyperlink{structgv__plex_a8e2820d6bd8419d81213f77131d6bd5c}{vol\_sc}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00467}00467 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00468}00468 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00469}00469 \textcolor{comment}{/* Update the volume state based on its plexes. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00470}00470 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00471}\mbox{\hyperlink{geom__vinum_8h_a08b54d0875737c40c15f7516ca72396a}{00471}} \mbox{\hyperlink{geom__vinum__state_8c_a594b665b349eaa0dc8871172ad747c43}{gv\_update\_vol\_state}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__volume}{gv\_volume}} *v)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00472}00472 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00473}00473         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__plex}{gv\_plex}} *p;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00474}00474 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00475}00475         KASSERT(v != NULL, (\textcolor{stringliteral}{"{}gv\_update\_vol\_state: NULL v"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00476}00476 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00477}00477         \textcolor{comment}{/* The volume can't be up without plexes. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00478}00478         \textcolor{keywordflow}{if} (v-\/>\mbox{\hyperlink{structgv__volume_a6a2fb4e2da02537035c219df64a65a80}{plexcount}} == 0) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00479}00479                 v-\/>\mbox{\hyperlink{structgv__volume_a54dd71f304a3aefc237c7cef1dac9777}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_af08dd2b0a2b9c2b5f74eaf5927a99c5c}{GV\_VOL\_DOWN}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00480}00480                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00481}00481         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00482}00482 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00483}00483         LIST\_FOREACH(p, \&v-\/>plexes, in\_volume) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00484}00484                 \textcolor{comment}{/* One of our plexes is accessible, and so are we. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00485}00485                 \textcolor{keywordflow}{if} (p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} > \mbox{\hyperlink{geom__vinum__var_8h_a80774ac8b615985dacf9f245fe370d7c}{GV\_PLEX\_DEGRADED}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00486}00486                         v-\/>\mbox{\hyperlink{structgv__volume_a54dd71f304a3aefc237c7cef1dac9777}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a8844be9458f8ec729320775c16ccc542}{GV\_VOL\_UP}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00487}00487                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00488}00488 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00489}00489                 \textcolor{comment}{/* We can handle a RAID5 plex with one dead subdisk as well. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00490}00490                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} ((p-\/>\mbox{\hyperlink{structgv__plex_ac35ac16eab74d053052bdb850ff7efbd}{org}} == \mbox{\hyperlink{geom__vinum__var_8h_a77d0838869414279112148a8b1efee50}{GV\_PLEX\_RAID5}}) \&\&}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00491}00491                     (p-\/>\mbox{\hyperlink{structgv__plex_a323004a8a80cc2691e845ba155ad55f0}{state}} == \mbox{\hyperlink{geom__vinum__var_8h_a80774ac8b615985dacf9f245fe370d7c}{GV\_PLEX\_DEGRADED}})) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00492}00492                         v-\/>\mbox{\hyperlink{structgv__volume_a54dd71f304a3aefc237c7cef1dac9777}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a8844be9458f8ec729320775c16ccc542}{GV\_VOL\_UP}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00493}00493                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00494}00494                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00495}00495         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00496}00496 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00497}00497         \textcolor{comment}{/* Not one of our plexes is up, so we can't be either. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00498}00498         v-\/>\mbox{\hyperlink{structgv__volume_a54dd71f304a3aefc237c7cef1dac9777}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_af08dd2b0a2b9c2b5f74eaf5927a99c5c}{GV\_VOL\_DOWN}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00499}00499 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00500}00500 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00501}00501 \textcolor{comment}{/* Return a state map for the subdisks of a plex. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00502}00502 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00503}\mbox{\hyperlink{geom__vinum_8h_aa57758582242e9a53014292f14ff542d}{00503}} \mbox{\hyperlink{geom__vinum__state_8c_a389b3825c7c812ebe5f1e1748105ad98}{gv\_sdstatemap}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *p)}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00504}00504 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00505}00505         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__sd}{gv\_sd}} *s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00506}00506         \textcolor{keywordtype}{int} statemap;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00507}00507 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00508}00508         KASSERT(p != NULL, (\textcolor{stringliteral}{"{}gv\_sdstatemap: NULL p"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00509}00509 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00510}00510         statemap = 0;}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00511}00511         p-\/>\mbox{\hyperlink{structgv__plex_aa943246707740867fdaf52448353c6f0}{sddown}} = 0;    \textcolor{comment}{/* No subdisks down yet. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00512}00512 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00513}00513         LIST\_FOREACH(s, \&p-\/>subdisks, in\_plex) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00514}00514                 \textcolor{keywordflow}{switch} (s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00515}00515                 \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a397e4bbebbaca115ef30ebb13a9d18bf}{GV\_SD\_DOWN}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00516}00516                 \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a5dd4abf3a748b1a4ee0da0bab79840d2}{GV\_SD\_STALE}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00517}00517                         statemap |= \mbox{\hyperlink{geom__vinum__var_8h_ac6b70b573a2ca73882bc1e7c11d5343b}{GV\_SD\_DOWNSTATE}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00518}00518                         p-\/>\mbox{\hyperlink{structgv__plex_aa943246707740867fdaf52448353c6f0}{sddown}}++;      \textcolor{comment}{/* Another unusable subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00519}00519                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00520}00520 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00521}00521                 \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a85ea8962028c1319a7fd5cd7adc4e497}{GV\_SD\_UP}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00522}00522                         statemap |= \mbox{\hyperlink{geom__vinum__var_8h_a13610e128cf1e379398747f96c1a8c41}{GV\_SD\_UPSTATE}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00523}00523                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00524}00524 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00525}00525                 \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_abb3257448e42ad06d3218e02cc26c8ba}{GV\_SD\_INITIALIZING}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00526}00526                         statemap |= \mbox{\hyperlink{geom__vinum__var_8h_ad73f1d427bef51384a23154ad0f31b89}{GV\_SD\_INITSTATE}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00527}00527                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00528}00528 }
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00529}00529                 \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a7fe4bfdd815ab9446e630efe806619d1}{GV\_SD\_REVIVING}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00530}00530                         statemap |= \mbox{\hyperlink{geom__vinum__var_8h_ad73f1d427bef51384a23154ad0f31b89}{GV\_SD\_INITSTATE}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00531}00531                         p-\/>\mbox{\hyperlink{structgv__plex_aa943246707740867fdaf52448353c6f0}{sddown}}++;      \textcolor{comment}{/* XXX: Another unusable subdisk? */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00532}00532                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00533}00533                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00534}00534         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00535}00535         \textcolor{keywordflow}{return} (statemap);}
\DoxyCodeLine{\Hypertarget{geom__vinum__state_8c_source_l00536}00536 \}}

\end{DoxyCode}
