\hypertarget{md__sii_8c_source}{}\doxysection{md\+\_\+sii.\+c}
\label{md__sii_8c_source}\index{geom/raid/md\_sii.c@{geom/raid/md\_sii.c}}
\mbox{\hyperlink{md__sii_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2011 Alexander Motin <mav@FreeBSD.org>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00005}00005 \textcolor{comment}{ * Copyright (c) 2000 -\/ 2008 Søren Schmidt <sos@FreeBSD.org>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00006}00006 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00007}00007 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00008}00008 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00009}00009 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00010}00010 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00011}00011 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00012}00012 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00013}00013 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00014}00014 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00015}00015 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00016}00016 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00017}00017 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00018}00018 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00019}00019 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00020}00020 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00021}00021 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00022}00022 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00023}00023 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00024}00024 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00025}00025 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00026}00026 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00027}00027 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00028}00028 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00029}00029 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00030}00030 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00031}\mbox{\hyperlink{md__sii_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00031}} \mbox{\hyperlink{md__sii_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00032}00032 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/bio.h>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/endian.h>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/kobj.h>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/limits.h>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <sys/taskqueue.h>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom_8h}{geom/geom.h}}>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__dbg_8h}{geom/geom\_dbg.h}}>}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00046}00046 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{g__raid_8h}{geom/raid/g\_raid.h}}"{}}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00047}00047 \textcolor{preprocessor}{\#include "{}g\_raid\_md\_if.h"{}}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00048}00048 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00049}\mbox{\hyperlink{md__sii_8c_a690cdb4c12d601242e835b8a0e296b74}{00049}} \textcolor{keyword}{static} \mbox{\hyperlink{md__sii_8c_a690cdb4c12d601242e835b8a0e296b74}{MALLOC\_DEFINE}}(M\_MD\_SII, \textcolor{stringliteral}{"{}md\_sii\_data"{}}, \textcolor{stringliteral}{"{}GEOM\_RAID SiI metadata"{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00050}00050 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00051}\mbox{\hyperlink{structsii__raid__conf}{00051}} \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00052}\mbox{\hyperlink{structsii__raid__conf_a0dbf514048d3a50f8d1877fdf5b2b549}{00052}}         uint16\_t        \mbox{\hyperlink{structsii__raid__conf_a0dbf514048d3a50f8d1877fdf5b2b549}{ata\_params\_00\_53}}[54];}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00053}\mbox{\hyperlink{structsii__raid__conf_a0b20b9cb0685d143151394fadb70c1ea}{00053}}         uint64\_t        \mbox{\hyperlink{structsii__raid__conf_a0b20b9cb0685d143151394fadb70c1ea}{total\_sectors}};             \textcolor{comment}{/* 54 -\/ 57 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00054}\mbox{\hyperlink{structsii__raid__conf_af95a25bf62644ec074f3a4d306613a2e}{00054}}         uint16\_t        \mbox{\hyperlink{structsii__raid__conf_af95a25bf62644ec074f3a4d306613a2e}{ata\_params\_58\_81}}[72];}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00055}\mbox{\hyperlink{structsii__raid__conf_abacbee9fd871f4607a5be96cb576ed8c}{00055}}         uint16\_t        \mbox{\hyperlink{structsii__raid__conf_abacbee9fd871f4607a5be96cb576ed8c}{product\_id}};           \textcolor{comment}{/* 130 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00056}\mbox{\hyperlink{structsii__raid__conf_a710962cd0d289a88b3b60118104b0819}{00056}}         uint16\_t        \mbox{\hyperlink{structsii__raid__conf_a710962cd0d289a88b3b60118104b0819}{vendor\_id}};             \textcolor{comment}{/* 131 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00057}\mbox{\hyperlink{structsii__raid__conf_a32e7e26eb3a741306c684dbadc878ac3}{00057}}         uint16\_t        \mbox{\hyperlink{structsii__raid__conf_a32e7e26eb3a741306c684dbadc878ac3}{version\_minor}};             \textcolor{comment}{/* 132 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00058}\mbox{\hyperlink{structsii__raid__conf_a69bd8fdc564e47717962f6154c2ec341}{00058}}         uint16\_t        \mbox{\hyperlink{structsii__raid__conf_a69bd8fdc564e47717962f6154c2ec341}{version\_major}};             \textcolor{comment}{/* 133 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00059}\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{00059}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[6];          \textcolor{comment}{/* 134 -\/ 136 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00060}\mbox{\hyperlink{structsii__raid__conf_a3dcd3aebef0a1c786e107df9ef722bcc}{00060}}         uint16\_t        \mbox{\hyperlink{structsii__raid__conf_a3dcd3aebef0a1c786e107df9ef722bcc}{strip\_sectors}};             \textcolor{comment}{/* 137 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00061}\mbox{\hyperlink{structsii__raid__conf_a4390714b5102df5168b91218da3f759c}{00061}}         uint16\_t        \mbox{\hyperlink{structsii__raid__conf_a4390714b5102df5168b91218da3f759c}{dummy\_2}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00062}\mbox{\hyperlink{structsii__raid__conf_a7411ecec8e4bf48a4324089b4435f996}{00062}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_a7411ecec8e4bf48a4324089b4435f996}{disk\_number}};         \textcolor{comment}{/* 139 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00063}\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{00063}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00064}\mbox{\hyperlink{md__sii_8c_aebb054a0dbe28afdf07b1e1d997d673a}{00064}} \textcolor{preprocessor}{\#define SII\_T\_RAID0             0x00}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00065}\mbox{\hyperlink{md__sii_8c_a499cbe598b21cbe73c2d3e02b9a0b3e7}{00065}} \textcolor{preprocessor}{\#define SII\_T\_RAID1             0x01}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00066}\mbox{\hyperlink{md__sii_8c_ae352525fb2f51afea0811d45361446d9}{00066}} \textcolor{preprocessor}{\#define SII\_T\_RAID01            0x02}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00067}\mbox{\hyperlink{md__sii_8c_a70ecc6ecc53c3b4ec97ae4a8a390165b}{00067}} \textcolor{preprocessor}{\#define SII\_T\_SPARE             0x03}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00068}\mbox{\hyperlink{md__sii_8c_ab2aed91ce84755548e884cb1f41a77f4}{00068}} \textcolor{preprocessor}{\#define SII\_T\_CONCAT            0x04}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00069}\mbox{\hyperlink{md__sii_8c_ab912f5e01db0d2539550227ff21445ac}{00069}} \textcolor{preprocessor}{\#define SII\_T\_RAID5             0x10}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00070}\mbox{\hyperlink{md__sii_8c_a1ccb49f53d8ce29611f4d074f9bd8682}{00070}} \textcolor{preprocessor}{\#define SII\_T\_RESERVED          0xfd}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00071}\mbox{\hyperlink{md__sii_8c_ac110cd550c9f04a563e076e3e7260423}{00071}} \textcolor{preprocessor}{\#define SII\_T\_JBOD              0xff}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00072}00072 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00073}\mbox{\hyperlink{structsii__raid__conf_a6a510028063a1040ca53e7c5f24c4051}{00073}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_a6a510028063a1040ca53e7c5f24c4051}{raid0\_disks}};         \textcolor{comment}{/* 140 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00074}\mbox{\hyperlink{structsii__raid__conf_ae8f800c6363eb703d37aaf045f123996}{00074}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_ae8f800c6363eb703d37aaf045f123996}{raid0\_ident}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00075}\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{00075}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}};         \textcolor{comment}{/* 141 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00076}\mbox{\hyperlink{structsii__raid__conf_af1768b515ff0f6e35a27c9c45e8b8d15}{00076}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_af1768b515ff0f6e35a27c9c45e8b8d15}{raid1\_ident}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00077}\mbox{\hyperlink{structsii__raid__conf_abb4c6705061784fd94f00a222868c8aa}{00077}}         uint64\_t        \mbox{\hyperlink{structsii__raid__conf_abb4c6705061784fd94f00a222868c8aa}{rebuild\_lba}};         \textcolor{comment}{/* 142 -\/ 145 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00078}\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{00078}}         uint32\_t        \mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}};           \textcolor{comment}{/* 146 -\/ 147 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00079}\mbox{\hyperlink{structsii__raid__conf_a988c831ac436113860d1a2a5907000c0}{00079}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_a988c831ac436113860d1a2a5907000c0}{disk\_status}};         \textcolor{comment}{/* 148 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00080}\mbox{\hyperlink{md__sii_8c_adbf02ee519964663d72dbff929932cdc}{00080}} \textcolor{preprocessor}{\#define SII\_S\_CURRENT           0x01}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00081}\mbox{\hyperlink{md__sii_8c_a118b8534d8229f2c908f8b44eaa75663}{00081}} \textcolor{preprocessor}{\#define SII\_S\_REBUILD           0x02}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00082}\mbox{\hyperlink{md__sii_8c_a41a0164fb2dbfacbc427b2d34ccf01c0}{00082}} \textcolor{preprocessor}{\#define SII\_S\_DROPPED           0x03}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00083}\mbox{\hyperlink{md__sii_8c_a6b2944a44861f106ca4b690812d4bf42}{00083}} \textcolor{preprocessor}{\#define SII\_S\_REMOVED           0x04}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00084}00084 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00085}\mbox{\hyperlink{structsii__raid__conf_a77adb2f77f80bca3be1f43491681a763}{00085}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_a77adb2f77f80bca3be1f43491681a763}{raid\_status}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00086}\mbox{\hyperlink{md__sii_8c_af42da1a61445193310c3e75ae78e9b2e}{00086}} \textcolor{preprocessor}{\#define SII\_S\_ONLINE            0x01}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00087}\mbox{\hyperlink{md__sii_8c_af819c034c1e491e155694366dc788f0f}{00087}} \textcolor{preprocessor}{\#define SII\_S\_AVAILABLE         0x02}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00088}00088 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00089}\mbox{\hyperlink{structsii__raid__conf_ac4bf6b5414065206979657443fd287de}{00089}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_ac4bf6b5414065206979657443fd287de}{raid\_location}};             \textcolor{comment}{/* 149 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00090}\mbox{\hyperlink{structsii__raid__conf_a939424beb10da3b8faea38d25c4a565f}{00090}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_a939424beb10da3b8faea38d25c4a565f}{disk\_location}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00091}\mbox{\hyperlink{structsii__raid__conf_a32cbf0499969d76be2e82b66de56c7be}{00091}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_a32cbf0499969d76be2e82b66de56c7be}{auto\_rebuild}};               \textcolor{comment}{/* 150 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00092}\mbox{\hyperlink{md__sii_8c_a79cdb9a04a8b6a8cc703093ff6bdea88}{00092}} \textcolor{preprocessor}{\#define SII\_R\_REBUILD           0x00}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00093}\mbox{\hyperlink{md__sii_8c_a7d636ba6a31998de3e3bc8be375cf010}{00093}} \textcolor{preprocessor}{\#define SII\_R\_NOREBUILD         0xff}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00094}00094 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00095}\mbox{\hyperlink{structsii__raid__conf_a9edd8658ef126460b7530d1969bd69f9}{00095}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_a9edd8658ef126460b7530d1969bd69f9}{dummy\_3}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00096}\mbox{\hyperlink{structsii__raid__conf_a1e679d0005754b28f027fdc358877e8a}{00096}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structsii__raid__conf_a1e679d0005754b28f027fdc358877e8a}{name}}[16];           \textcolor{comment}{/* 151 -\/ 158 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00097}\mbox{\hyperlink{structsii__raid__conf_abd98e212f44b62a63c1117c1ba1a264b}{00097}}         uint16\_t        \mbox{\hyperlink{structsii__raid__conf_abd98e212f44b62a63c1117c1ba1a264b}{checksum}};               \textcolor{comment}{/* 159 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00098}\mbox{\hyperlink{structsii__raid__conf_ac4c475c8d9c8ea4565f95ab2db589e87}{00098}}         uint16\_t        \mbox{\hyperlink{structsii__raid__conf_ac4c475c8d9c8ea4565f95ab2db589e87}{ata\_params\_160\_255}}[96];}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00099}\mbox{\hyperlink{md__sii_8c_a857e487d5b47b08faaff0f4268b77945}{00099}} \} \mbox{\hyperlink{md__sii_8c_a857e487d5b47b08faaff0f4268b77945}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00100}00100 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00101}\mbox{\hyperlink{structg__raid__md__sii__perdisk}{00101}} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00102}\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{00102}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}}       *\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00103}\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{00103}}         \textcolor{keywordtype}{int}                      \mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00104}\mbox{\hyperlink{structg__raid__md__sii__perdisk_a319be513edd344a92dffdf1926b9f055}{00104}}         off\_t                    \mbox{\hyperlink{structg__raid__md__sii__perdisk_a319be513edd344a92dffdf1926b9f055}{pd\_disk\_size}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00105}00105 \};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00106}00106 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00107}\mbox{\hyperlink{structg__raid__md__sii__object}{00107}} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00108}\mbox{\hyperlink{structg__raid__md__sii__object_a10013f48a975f4963ce98f2a91ad925e}{00108}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}}  \mbox{\hyperlink{structg__raid__md__sii__object_a10013f48a975f4963ce98f2a91ad925e}{mdio\_base}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00109}\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{00109}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}                   \mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[6];}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00110}\mbox{\hyperlink{structg__raid__md__sii__object_ae57dd0b27bc06cdb9c7ea283882be495}{00110}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}                   \mbox{\hyperlink{structg__raid__md__sii__object_ae57dd0b27bc06cdb9c7ea283882be495}{mdio\_location}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00111}\mbox{\hyperlink{structg__raid__md__sii__object_a32aba787e804e1822f219196a9f3d74b}{00111}}         uint32\_t                 \mbox{\hyperlink{structg__raid__md__sii__object_a32aba787e804e1822f219196a9f3d74b}{mdio\_generation}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00112}\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{00112}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}}       *\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00113}\mbox{\hyperlink{structg__raid__md__sii__object_aaf96cf0f02915e6f5762a6126d84be66}{00113}}         \textcolor{keyword}{struct }callout           \mbox{\hyperlink{structg__raid__md__sii__object_aaf96cf0f02915e6f5762a6126d84be66}{mdio\_start\_co}};    \textcolor{comment}{/* STARTING state timer. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00114}\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{00114}}         \textcolor{keywordtype}{int}                      \mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00115}\mbox{\hyperlink{structg__raid__md__sii__object_afc8d1c4998a556058bcecc3f9f8acc79}{00115}}         \textcolor{keywordtype}{int}                      \mbox{\hyperlink{structg__raid__md__sii__object_afc8d1c4998a556058bcecc3f9f8acc79}{mdio\_disks\_present}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00116}\mbox{\hyperlink{structg__raid__md__sii__object_ac678044a1c77fa3e5174afc0918f1e68}{00116}}         \textcolor{keywordtype}{int}                      \mbox{\hyperlink{structg__raid__md__sii__object_ac678044a1c77fa3e5174afc0918f1e68}{mdio\_started}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00117}\mbox{\hyperlink{structg__raid__md__sii__object_a3f8b349de81ac07eb51bde0908780110}{00117}}         \textcolor{keywordtype}{int}                      \mbox{\hyperlink{structg__raid__md__sii__object_a3f8b349de81ac07eb51bde0908780110}{mdio\_incomplete}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00118}\mbox{\hyperlink{structg__raid__md__sii__object_aec9be1474381df7ee991769711370611}{00118}}         \textcolor{keyword}{struct }root\_hold\_token  *\mbox{\hyperlink{structg__raid__md__sii__object_aec9be1474381df7ee991769711370611}{mdio\_rootmount}}; \textcolor{comment}{/* Root mount delay token. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00119}00119 \};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00120}00120 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00121}\mbox{\hyperlink{md__sii_8c_ab025e83b94cf9b30a2ef139d3a6383aa}{00121}} \textcolor{keyword}{static} g\_raid\_md\_create\_t \mbox{\hyperlink{md__sii_8c_ab025e83b94cf9b30a2ef139d3a6383aa}{g\_raid\_md\_create\_sii}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00122}\mbox{\hyperlink{md__sii_8c_a2af40b458749c46abc4044e54b201dab}{00122}} \textcolor{keyword}{static} g\_raid\_md\_taste\_t \mbox{\hyperlink{md__sii_8c_a2af40b458749c46abc4044e54b201dab}{g\_raid\_md\_taste\_sii}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00123}\mbox{\hyperlink{md__sii_8c_a1487b2a04582705c1b68c93d83ad17e4}{00123}} \textcolor{keyword}{static} g\_raid\_md\_event\_t \mbox{\hyperlink{md__sii_8c_a1487b2a04582705c1b68c93d83ad17e4}{g\_raid\_md\_event\_sii}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00124}\mbox{\hyperlink{md__sii_8c_afb7e4ac8e6f972885369ae05ca83a78a}{00124}} \textcolor{keyword}{static} g\_raid\_md\_ctl\_t \mbox{\hyperlink{md__sii_8c_afb7e4ac8e6f972885369ae05ca83a78a}{g\_raid\_md\_ctl\_sii}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00125}\mbox{\hyperlink{md__sii_8c_af9f40935192da6d220ce5fc7f3e3fbc7}{00125}} \textcolor{keyword}{static} g\_raid\_md\_write\_t \mbox{\hyperlink{md__sii_8c_af9f40935192da6d220ce5fc7f3e3fbc7}{g\_raid\_md\_write\_sii}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00126}\mbox{\hyperlink{md__sii_8c_a219f407f3990d2cf5632ffdfbd4203fc}{00126}} \textcolor{keyword}{static} g\_raid\_md\_fail\_disk\_t \mbox{\hyperlink{md__sii_8c_a219f407f3990d2cf5632ffdfbd4203fc}{g\_raid\_md\_fail\_disk\_sii}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00127}\mbox{\hyperlink{md__sii_8c_abdebfcf5ccbe2ccd6042aa398f7eb718}{00127}} \textcolor{keyword}{static} g\_raid\_md\_free\_disk\_t \mbox{\hyperlink{md__sii_8c_abdebfcf5ccbe2ccd6042aa398f7eb718}{g\_raid\_md\_free\_disk\_sii}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00128}\mbox{\hyperlink{md__sii_8c_adc1f336f18b1701bcc67343916ca8c13}{00128}} \textcolor{keyword}{static} g\_raid\_md\_free\_t \mbox{\hyperlink{md__sii_8c_adc1f336f18b1701bcc67343916ca8c13}{g\_raid\_md\_free\_sii}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00129}00129 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00130}\mbox{\hyperlink{md__sii_8c_a73776e56124d14a37d89bdbe26420b0e}{00130}} \textcolor{keyword}{static} kobj\_method\_t \mbox{\hyperlink{md__sii_8c_a73776e56124d14a37d89bdbe26420b0e}{g\_raid\_md\_sii\_methods}}[] = \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00131}00131         KOBJMETHOD(g\_raid\_md\_create,    \mbox{\hyperlink{md__sii_8c_ab025e83b94cf9b30a2ef139d3a6383aa}{g\_raid\_md\_create\_sii}}),}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00132}00132         KOBJMETHOD(g\_raid\_md\_taste,     \mbox{\hyperlink{md__sii_8c_a2af40b458749c46abc4044e54b201dab}{g\_raid\_md\_taste\_sii}}),}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00133}00133         KOBJMETHOD(g\_raid\_md\_event,     \mbox{\hyperlink{md__sii_8c_a1487b2a04582705c1b68c93d83ad17e4}{g\_raid\_md\_event\_sii}}),}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00134}00134         KOBJMETHOD(g\_raid\_md\_ctl,       \mbox{\hyperlink{md__sii_8c_afb7e4ac8e6f972885369ae05ca83a78a}{g\_raid\_md\_ctl\_sii}}),}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00135}00135         KOBJMETHOD(g\_raid\_md\_write,     \mbox{\hyperlink{md__sii_8c_af9f40935192da6d220ce5fc7f3e3fbc7}{g\_raid\_md\_write\_sii}}),}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00136}00136         KOBJMETHOD(g\_raid\_md\_fail\_disk, \mbox{\hyperlink{md__sii_8c_a219f407f3990d2cf5632ffdfbd4203fc}{g\_raid\_md\_fail\_disk\_sii}}),}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00137}00137         KOBJMETHOD(g\_raid\_md\_free\_disk, \mbox{\hyperlink{md__sii_8c_abdebfcf5ccbe2ccd6042aa398f7eb718}{g\_raid\_md\_free\_disk\_sii}}),}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00138}00138         KOBJMETHOD(g\_raid\_md\_free,      \mbox{\hyperlink{md__sii_8c_adc1f336f18b1701bcc67343916ca8c13}{g\_raid\_md\_free\_sii}}),}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00139}00139         \{ 0, 0 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00140}00140 \};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00141}00141 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00142}\mbox{\hyperlink{md__sii_8c_a550a1aa4eb5cd905b77df83a5d123083}{00142}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__class}{g\_raid\_md\_class}} \mbox{\hyperlink{md__sii_8c_a550a1aa4eb5cd905b77df83a5d123083}{g\_raid\_md\_sii\_class}} = \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00143}00143         \textcolor{stringliteral}{"{}SiI"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00144}00144         \mbox{\hyperlink{md__sii_8c_a73776e56124d14a37d89bdbe26420b0e}{g\_raid\_md\_sii\_methods}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00145}00145         \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}}),}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00146}00146         .mdc\_enable = 1,}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00147}00147         .mdc\_priority = 100}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00148}00148 \};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00149}00149 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00150}00150 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00151}\mbox{\hyperlink{md__sii_8c_a8c4f8cb55475acd599cc2a1794c84eb7}{00151}} \mbox{\hyperlink{md__sii_8c_a8c4f8cb55475acd599cc2a1794c84eb7}{g\_raid\_md\_sii\_print}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00152}00152 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00153}00153 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00154}00154         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid_8c_a60062ce0bb852760514459b7a1f3d32e}{g\_raid\_debug}} < 1)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00155}00155                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00156}00156 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00157}00157         printf(\textcolor{stringliteral}{"{}********* ATA SiI RAID Metadata *********\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00158}00158         printf(\textcolor{stringliteral}{"{}total\_sectors       \%llu\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00159}00159             (\textcolor{keywordtype}{long} \textcolor{keywordtype}{long} \textcolor{keywordtype}{unsigned})meta-\/>\mbox{\hyperlink{structsii__raid__conf_a0b20b9cb0685d143151394fadb70c1ea}{total\_sectors}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00160}00160         printf(\textcolor{stringliteral}{"{}product\_id          0x\%04x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_abacbee9fd871f4607a5be96cb576ed8c}{product\_id}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00161}00161         printf(\textcolor{stringliteral}{"{}vendor\_id           0x\%04x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a710962cd0d289a88b3b60118104b0819}{vendor\_id}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00162}00162         printf(\textcolor{stringliteral}{"{}version\_minor       0x\%04x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a32e7e26eb3a741306c684dbadc878ac3}{version\_minor}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00163}00163         printf(\textcolor{stringliteral}{"{}version\_major       0x\%04x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a69bd8fdc564e47717962f6154c2ec341}{version\_major}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00164}00164         printf(\textcolor{stringliteral}{"{}timestamp           0x\%02x\%02x\%02x\%02x\%02x\%02x\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00165}00165             meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[5], meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[4], meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[3],}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00166}00166             meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[2], meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[1], meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[0]);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00167}00167         printf(\textcolor{stringliteral}{"{}strip\_sectors       \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a3dcd3aebef0a1c786e107df9ef722bcc}{strip\_sectors}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00168}00168         printf(\textcolor{stringliteral}{"{}disk\_number         \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a7411ecec8e4bf48a4324089b4435f996}{disk\_number}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00169}00169         printf(\textcolor{stringliteral}{"{}type                0x\%02x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00170}00170         printf(\textcolor{stringliteral}{"{}raid0\_disks         \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a6a510028063a1040ca53e7c5f24c4051}{raid0\_disks}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00171}00171         printf(\textcolor{stringliteral}{"{}raid0\_ident         \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_ae8f800c6363eb703d37aaf045f123996}{raid0\_ident}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00172}00172         printf(\textcolor{stringliteral}{"{}raid1\_disks         \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00173}00173         printf(\textcolor{stringliteral}{"{}raid1\_ident         \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_af1768b515ff0f6e35a27c9c45e8b8d15}{raid1\_ident}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00174}00174         printf(\textcolor{stringliteral}{"{}rebuild\_lba         \%llu\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00175}00175             (\textcolor{keywordtype}{long} \textcolor{keywordtype}{long} \textcolor{keywordtype}{unsigned})meta-\/>\mbox{\hyperlink{structsii__raid__conf_abb4c6705061784fd94f00a222868c8aa}{rebuild\_lba}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00176}00176         printf(\textcolor{stringliteral}{"{}generation          \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00177}00177         printf(\textcolor{stringliteral}{"{}disk\_status         \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a988c831ac436113860d1a2a5907000c0}{disk\_status}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00178}00178         printf(\textcolor{stringliteral}{"{}raid\_status         \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a77adb2f77f80bca3be1f43491681a763}{raid\_status}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00179}00179         printf(\textcolor{stringliteral}{"{}raid\_location       \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_ac4bf6b5414065206979657443fd287de}{raid\_location}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00180}00180         printf(\textcolor{stringliteral}{"{}disk\_location       \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a939424beb10da3b8faea38d25c4a565f}{disk\_location}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00181}00181         printf(\textcolor{stringliteral}{"{}auto\_rebuild        \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a32cbf0499969d76be2e82b66de56c7be}{auto\_rebuild}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00182}00182         printf(\textcolor{stringliteral}{"{}name                <\%.16s>\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a1e679d0005754b28f027fdc358877e8a}{name}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00183}00183         printf(\textcolor{stringliteral}{"{}checksum            0x\%04x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_abd98e212f44b62a63c1117c1ba1a264b}{checksum}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00184}00184         printf(\textcolor{stringliteral}{"{}=================================================\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00185}00185 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00186}00186 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00187}00187 \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00188}\mbox{\hyperlink{md__sii_8c_ab18c5e42f6592a5fcd190fd8282ea5d4}{00188}} \mbox{\hyperlink{md__sii_8c_ab18c5e42f6592a5fcd190fd8282ea5d4}{sii\_meta\_copy}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00189}00189 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00190}00190         \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *nmeta;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00191}00191 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00192}00192         nmeta = malloc(\textcolor{keyword}{sizeof}(*meta), M\_MD\_SII, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00193}00193         memcpy(nmeta, meta, \textcolor{keyword}{sizeof}(*meta));}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00194}00194         \textcolor{keywordflow}{return} (nmeta);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00195}00195 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00196}00196 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00197}00197 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00198}\mbox{\hyperlink{md__sii_8c_ac775f5ffb1917c99c1a7746fe111e2dd}{00198}} \mbox{\hyperlink{md__sii_8c_ac775f5ffb1917c99c1a7746fe111e2dd}{sii\_meta\_total\_disks}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00199}00199 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00200}00200 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00201}00201         \textcolor{keywordflow}{switch} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00202}00202         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_aebb054a0dbe28afdf07b1e1d997d673a}{SII\_T\_RAID0}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00203}00203         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_ab912f5e01db0d2539550227ff21445ac}{SII\_T\_RAID5}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00204}00204         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_ab2aed91ce84755548e884cb1f41a77f4}{SII\_T\_CONCAT}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00205}00205                 \textcolor{keywordflow}{return} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_a6a510028063a1040ca53e7c5f24c4051}{raid0\_disks}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00206}00206         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_a499cbe598b21cbe73c2d3e02b9a0b3e7}{SII\_T\_RAID1}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00207}00207                 \textcolor{keywordflow}{return} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00208}00208         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_ae352525fb2f51afea0811d45361446d9}{SII\_T\_RAID01}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00209}00209                 \textcolor{keywordflow}{return} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_a6a510028063a1040ca53e7c5f24c4051}{raid0\_disks}} * meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00210}00210         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_a70ecc6ecc53c3b4ec97ae4a8a390165b}{SII\_T\_SPARE}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00211}00211         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_ac110cd550c9f04a563e076e3e7260423}{SII\_T\_JBOD}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00212}00212                 \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00213}00213         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00214}00214         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00215}00215 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00216}00216 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00217}00217 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00218}\mbox{\hyperlink{md__sii_8c_a627b17048a22e9f3a9118525ca44f09e}{00218}} \mbox{\hyperlink{md__sii_8c_a627b17048a22e9f3a9118525ca44f09e}{sii\_meta\_disk\_pos}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta, \textcolor{keyword}{struct} \mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *pdmeta)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00219}00219 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00220}00220 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00221}00221         \textcolor{keywordflow}{if} (pdmeta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} == \mbox{\hyperlink{md__sii_8c_a70ecc6ecc53c3b4ec97ae4a8a390165b}{SII\_T\_SPARE}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00222}00222                 \textcolor{keywordflow}{return} (-\/3);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00223}00223 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00224}00224         \textcolor{keywordflow}{if} (memcmp(\&meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}, \&pdmeta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}, 6) != 0)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00225}00225                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00226}00226 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00227}00227         \textcolor{keywordflow}{switch} (pdmeta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00228}00228         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_aebb054a0dbe28afdf07b1e1d997d673a}{SII\_T\_RAID0}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00229}00229         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_a499cbe598b21cbe73c2d3e02b9a0b3e7}{SII\_T\_RAID1}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00230}00230         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_ab912f5e01db0d2539550227ff21445ac}{SII\_T\_RAID5}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00231}00231         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_ab2aed91ce84755548e884cb1f41a77f4}{SII\_T\_CONCAT}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00232}00232                 \textcolor{keywordflow}{return} (pdmeta-\/>\mbox{\hyperlink{structsii__raid__conf_a7411ecec8e4bf48a4324089b4435f996}{disk\_number}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00233}00233         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_ae352525fb2f51afea0811d45361446d9}{SII\_T\_RAID01}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00234}00234                 \textcolor{keywordflow}{return} (pdmeta-\/>\mbox{\hyperlink{structsii__raid__conf_af1768b515ff0f6e35a27c9c45e8b8d15}{raid1\_ident}} * pdmeta-\/>\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}} +}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00235}00235                     pdmeta-\/>\mbox{\hyperlink{structsii__raid__conf_ae8f800c6363eb703d37aaf045f123996}{raid0\_ident}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00236}00236         \textcolor{keywordflow}{case} \mbox{\hyperlink{md__sii_8c_ac110cd550c9f04a563e076e3e7260423}{SII\_T\_JBOD}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00237}00237                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00238}00238         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00239}00239         \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00240}00240 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00241}00241 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00242}00242 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00243}\mbox{\hyperlink{md__sii_8c_af4cbeaa66f2769cb267f3429319b5b7f}{00243}} \mbox{\hyperlink{md__sii_8c_af4cbeaa66f2769cb267f3429319b5b7f}{sii\_meta\_get\_name}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta, \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00244}00244 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00245}00245         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00246}00246 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00247}00247         strncpy(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a1e679d0005754b28f027fdc358877e8a}{name}}, 16);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00248}00248         \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}[16] = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00249}00249         \textcolor{keywordflow}{for} (i = 15; i >= 0; i-\/-\/) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00250}00250                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}[i] > 0x20)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00251}00251                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00252}00252                 \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}[i] = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00253}00253         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00254}00254 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00255}00255 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00256}00256 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00257}\mbox{\hyperlink{md__sii_8c_a83ba5d2e7f366cc3abc663206a5f99cb}{00257}} \mbox{\hyperlink{md__sii_8c_a83ba5d2e7f366cc3abc663206a5f99cb}{sii\_meta\_put\_name}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta, \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00258}00258 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00259}00259 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00260}00260         memset(meta-\/>\mbox{\hyperlink{structsii__raid__conf_a1e679d0005754b28f027fdc358877e8a}{name}}, 0x20, 16);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00261}00261         memcpy(meta-\/>\mbox{\hyperlink{structsii__raid__conf_a1e679d0005754b28f027fdc358877e8a}{name}}, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, MIN(strlen(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}), 16));}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00262}00262 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00263}00263 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00264}00264 \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00265}\mbox{\hyperlink{md__sii_8c_a2568c5d79aab0ca0fbb1ae55464a3d01}{00265}} \mbox{\hyperlink{md__sii_8c_a2568c5d79aab0ca0fbb1ae55464a3d01}{sii\_meta\_read}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00266}00266 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00267}00267         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00268}00268         \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00269}00269         \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00270}00270         \textcolor{keywordtype}{int} error, i;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00271}00271         uint16\_t \mbox{\hyperlink{structsii__raid__conf_abd98e212f44b62a63c1117c1ba1a264b}{checksum}}, *ptr;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00272}00272 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00273}00273         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00274}00274         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} < \textcolor{keyword}{sizeof}(*meta))}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00275}00275                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00276}00276         \textcolor{comment}{/* Read the anchor sector. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00277}00277         \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}} = \mbox{\hyperlink{geom_8h_a550c2071f79908eea3d1ccbf821c4e4f}{g\_read\_data}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00278}00278             \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} -\/ \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, \&error);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00279}00279         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00280}00280                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Cannot read metadata from \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00281}00281                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, error);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00282}00282                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00283}00283         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00284}00284         meta = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *)\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00285}00285 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00286}00286         \textcolor{comment}{/* Check vendor ID. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00287}00287         \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_a710962cd0d289a88b3b60118104b0819}{vendor\_id}} != 0x1095) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00288}00288                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}SiI vendor ID check failed on \%s (0x\%04x)"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00289}00289                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a710962cd0d289a88b3b60118104b0819}{vendor\_id}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00290}00290                 \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00291}00291                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00292}00292         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00293}00293 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00294}00294         \textcolor{comment}{/* Check metadata major version. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00295}00295         \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_a69bd8fdc564e47717962f6154c2ec341}{version\_major}} != 2) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00296}00296                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}SiI version check failed on \%s (\%d.\%d)"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00297}00297                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a69bd8fdc564e47717962f6154c2ec341}{version\_major}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_a32e7e26eb3a741306c684dbadc878ac3}{version\_minor}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00298}00298                 \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00299}00299                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00300}00300         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00301}00301         meta = malloc(\textcolor{keyword}{sizeof}(*meta), M\_MD\_SII, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00302}00302         memcpy(meta, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, min(\textcolor{keyword}{sizeof}(*meta), \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}));}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00303}00303         \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00304}00304 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00305}00305         \textcolor{comment}{/* Check metadata checksum. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00306}00306         \textcolor{keywordflow}{for} (\mbox{\hyperlink{structsii__raid__conf_abd98e212f44b62a63c1117c1ba1a264b}{checksum}} = 0, ptr = (uint16\_t *)meta, i = 0; i <= 159; i++)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00307}00307                 \mbox{\hyperlink{structsii__raid__conf_abd98e212f44b62a63c1117c1ba1a264b}{checksum}} += *ptr++;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00308}00308         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structsii__raid__conf_abd98e212f44b62a63c1117c1ba1a264b}{checksum}} != 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00309}00309                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}SiI checksum check failed on \%s"{}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00310}00310                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(meta, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00311}00311                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00312}00312         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00313}00313 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00314}00314         \textcolor{comment}{/* Check raid type. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00315}00315         \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} != \mbox{\hyperlink{md__sii_8c_aebb054a0dbe28afdf07b1e1d997d673a}{SII\_T\_RAID0}} \&\& meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} != \mbox{\hyperlink{md__sii_8c_a499cbe598b21cbe73c2d3e02b9a0b3e7}{SII\_T\_RAID1}} \&\&}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00316}00316             meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} != \mbox{\hyperlink{md__sii_8c_ae352525fb2f51afea0811d45361446d9}{SII\_T\_RAID01}} \&\& meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} != \mbox{\hyperlink{md__sii_8c_a70ecc6ecc53c3b4ec97ae4a8a390165b}{SII\_T\_SPARE}} \&\&}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00317}00317             meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} != \mbox{\hyperlink{md__sii_8c_ab912f5e01db0d2539550227ff21445ac}{SII\_T\_RAID5}} \&\& meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} != \mbox{\hyperlink{md__sii_8c_ab2aed91ce84755548e884cb1f41a77f4}{SII\_T\_CONCAT}} \&\&}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00318}00318             meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} != \mbox{\hyperlink{md__sii_8c_ac110cd550c9f04a563e076e3e7260423}{SII\_T\_JBOD}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00319}00319                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}SiI unknown RAID level on \%s (0x\%02x)"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00320}00320                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00321}00321                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(meta, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00322}00322                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00323}00323         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00324}00324 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00325}00325         \textcolor{keywordflow}{return} (meta);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00326}00326 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00327}00327 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00328}00328 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00329}\mbox{\hyperlink{md__sii_8c_a8dd5f58a0fd59c7f6f9c30386cbd4ed3}{00329}} \mbox{\hyperlink{md__sii_8c_a8dd5f58a0fd59c7f6f9c30386cbd4ed3}{sii\_meta\_write}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00330}00330 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00331}00331         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00332}00332         \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00333}00333         \textcolor{keywordtype}{int} \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}}, i;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00334}00334         uint16\_t checksum, *ptr;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00335}00335 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00336}00336         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00337}00337 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00338}00338         \textcolor{comment}{/* Recalculate checksum for case if metadata were changed. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00339}00339         meta-\/>\mbox{\hyperlink{structsii__raid__conf_abd98e212f44b62a63c1117c1ba1a264b}{checksum}} = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00340}00340         \textcolor{keywordflow}{for} (checksum = 0, ptr = (uint16\_t *)meta, i = 0; i < 159; i++)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00341}00341                 checksum += *ptr++;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00342}00342         meta-\/>\mbox{\hyperlink{structsii__raid__conf_abd98e212f44b62a63c1117c1ba1a264b}{checksum}} -\/= checksum;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00343}00343 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00344}00344         \textcolor{comment}{/* Create and fill buffer. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00345}00345         \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}} = malloc(\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, M\_MD\_SII, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00346}00346         memcpy(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, meta, \textcolor{keyword}{sizeof}(*meta));}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00347}00347 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00348}00348         \textcolor{comment}{/* Write 4 copies of metadata. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00349}00349         \textcolor{keywordflow}{for} (i = 0; i < 4; i++) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00350}00350                 \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = \mbox{\hyperlink{geom_8h_a9b87ecbd812c109546b077da483baada}{g\_write\_data}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00351}00351                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} -\/ (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} * (1 + 0x200 * i)),}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00352}00352                     \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00353}00353                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} != 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00354}00354                         \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Cannot write metadata to \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00355}00355                             \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00356}00356                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00357}00357                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00358}00358         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00359}00359 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00360}00360         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00361}00361         \textcolor{keywordflow}{return} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00362}00362 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00363}00363 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00364}00364 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00365}\mbox{\hyperlink{md__sii_8c_a32fdcae1d25339f2ea1dae94ae58bc18}{00365}} \mbox{\hyperlink{md__sii_8c_a32fdcae1d25339f2ea1dae94ae58bc18}{sii\_meta\_erase}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00366}00366 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00367}00367         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00368}00368         \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00369}00369         \textcolor{keywordtype}{int} \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}}, i;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00370}00370 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00371}00371         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00372}00372         \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}} = malloc(\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, M\_MD\_SII, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00373}00373         \textcolor{comment}{/* Write 4 copies of metadata. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00374}00374         \textcolor{keywordflow}{for} (i = 0; i < 4; i++) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00375}00375                 \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = \mbox{\hyperlink{geom_8h_a9b87ecbd812c109546b077da483baada}{g\_write\_data}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00376}00376                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} -\/ (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} * (1 + 0x200 * i)),}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00377}00377                     \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00378}00378                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} != 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00379}00379                         \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Cannot erase metadata on \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00380}00380                             \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00381}00381                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00382}00382         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00383}00383         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00384}00384         \textcolor{keywordflow}{return} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00385}00385 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00386}00386 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00387}00387 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00388}\mbox{\hyperlink{md__sii_8c_a2b5df297c0dc961963fb7f38505e8f5b}{00388}} \mbox{\hyperlink{md__sii_8c_a2b5df297c0dc961963fb7f38505e8f5b}{sii\_meta\_write\_spare}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00389}00389 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00390}00390         \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00391}00391         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00392}00392 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00393}00393         meta = malloc(\textcolor{keyword}{sizeof}(*meta), M\_MD\_SII, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00394}00394         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a0b20b9cb0685d143151394fadb70c1ea}{total\_sectors}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} /}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00395}00395             \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} -\/ 0x800;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00396}00396         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a710962cd0d289a88b3b60118104b0819}{vendor\_id}} = 0x1095;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00397}00397         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a32e7e26eb3a741306c684dbadc878ac3}{version\_minor}} = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00398}00398         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a69bd8fdc564e47717962f6154c2ec341}{version\_major}} = 2;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00399}00399         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[0] = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00400}00400         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[1] = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00401}00401         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[2] = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00402}00402         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[3] = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00403}00403         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[4] = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00404}00404         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}[5] = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00405}00405         meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} = \mbox{\hyperlink{md__sii_8c_a70ecc6ecc53c3b4ec97ae4a8a390165b}{SII\_T\_SPARE}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00406}00406         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}} = 1;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00407}00407         meta-\/>\mbox{\hyperlink{structsii__raid__conf_af1768b515ff0f6e35a27c9c45e8b8d15}{raid1\_ident}} = 0xff;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00408}00408         meta-\/>\mbox{\hyperlink{structsii__raid__conf_ac4bf6b5414065206979657443fd287de}{raid\_location}} = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00409}00409         error = \mbox{\hyperlink{md__sii_8c_a8dd5f58a0fd59c7f6f9c30386cbd4ed3}{sii\_meta\_write}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, meta);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00410}00410         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(meta, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00411}00411         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00412}00412 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00413}00413 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00414}00414 \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00415}\mbox{\hyperlink{md__sii_8c_a655664445d4112c3f1ea5508138cfee6}{00415}} \mbox{\hyperlink{md__sii_8c_a655664445d4112c3f1ea5508138cfee6}{g\_raid\_md\_sii\_get\_disk}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc, \textcolor{keywordtype}{int} \textcolor{keywordtype}{id})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00416}00416 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00417}00417         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}}   *\mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00418}00418         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00419}00419 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00420}00420         TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00421}00421                 pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00422}00422                 if (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}} == \textcolor{keywordtype}{id})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00423}00423                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00424}00424         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00425}00425         \textcolor{keywordflow}{return} (\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00426}00426 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00427}00427 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00428}00428 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00429}\mbox{\hyperlink{md__sii_8c_ab6690df836a3bb97a6d6847bc51be059}{00429}} \mbox{\hyperlink{md__sii_8c_ab6690df836a3bb97a6d6847bc51be059}{g\_raid\_md\_sii\_supported}}(\textcolor{keywordtype}{int} level, \textcolor{keywordtype}{int} qual, \textcolor{keywordtype}{int} disks, \textcolor{keywordtype}{int} force)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00430}00430 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00431}00431 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00432}00432         \textcolor{keywordflow}{if} (disks > 8)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00433}00433                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00434}00434         \textcolor{keywordflow}{switch} (level) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00435}00435         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_a6a49f4ddd0b45eb4210ce72528786a32}{G\_RAID\_VOLUME\_RL\_RAID0}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00436}00436                 \textcolor{keywordflow}{if} (disks < 1)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00437}00437                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00438}00438                 \textcolor{keywordflow}{if} (!force \&\& (disks < 2 || disks > 6))}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00439}00439                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00440}00440                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00441}00441         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00442}00442                 \textcolor{keywordflow}{if} (disks < 1)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00443}00443                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00444}00444                 \textcolor{keywordflow}{if} (!force \&\& (disks != 2))}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00445}00445                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00446}00446                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00447}00447         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_ad0ef2cd50760a49759a6cbaf2afeb286}{G\_RAID\_VOLUME\_RL\_RAID1E}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00448}00448                 \textcolor{keywordflow}{if} (disks < 2)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00449}00449                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00450}00450                 \textcolor{keywordflow}{if} (disks \% 2 != 0)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00451}00451                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00452}00452                 \textcolor{keywordflow}{if} (!force \&\& (disks < 4))}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00453}00453                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00454}00454                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00455}00455         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_acb418af006a1d84e0dd912c58cec6f57}{G\_RAID\_VOLUME\_RL\_SINGLE}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00456}00456                 \textcolor{keywordflow}{if} (disks != 1)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00457}00457                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00458}00458                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00459}00459         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_abc695e94a9e4eff0f657ec01d1f19607}{G\_RAID\_VOLUME\_RL\_CONCAT}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00460}00460                 \textcolor{keywordflow}{if} (disks < 2)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00461}00461                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00462}00462                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00463}00463         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_af6db015b03ea390243f2df897eb1189d}{G\_RAID\_VOLUME\_RL\_RAID5}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00464}00464                 \textcolor{keywordflow}{if} (disks < 3)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00465}00465                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00466}00466                 \textcolor{keywordflow}{if} (qual != \mbox{\hyperlink{g__raid_8h_a3605e753584db40187aadad30e663276}{G\_RAID\_VOLUME\_RLQ\_R5LS}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00467}00467                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00468}00468                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00469}00469         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00470}00470                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00471}00471         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00472}00472         \textcolor{keywordflow}{if} (level != \mbox{\hyperlink{g__raid_8h_af6db015b03ea390243f2df897eb1189d}{G\_RAID\_VOLUME\_RL\_RAID5}} \&\& qual != \mbox{\hyperlink{g__raid_8h_a9c036957b2fb94761b5fd084e8f991c9}{G\_RAID\_VOLUME\_RLQ\_NONE}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00473}00473                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00474}00474         \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00475}00475 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00476}00476 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00477}00477 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00478}\mbox{\hyperlink{md__sii_8c_a18b31eae1057bbb93ab7663e2dfb61d7}{00478}} \mbox{\hyperlink{md__sii_8c_a18b31eae1057bbb93ab7663e2dfb61d7}{g\_raid\_md\_sii\_start\_disk}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{structdisk}{disk}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00479}00479 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00480}00480         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00481}00481         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, *tmpsd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00482}00482         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *olddisk, *tmpdisk;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00483}00483         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00484}00484         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *mdi;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00485}00485         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *pd, *oldpd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00486}00486         \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00487}00487         \textcolor{keywordtype}{int} disk\_pos, resurrection = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00488}00488 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00489}00489         sc = \mbox{\hyperlink{structdisk}{disk}}-\/>d\_softc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00490}00490         md = sc-\/>\mbox{\hyperlink{structg__raid__softc_a5bf7421452e0a324fc4f8b954b57314b}{sc\_md}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00491}00491         mdi = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *)md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00492}00492         meta = mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00493}00493         pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00494}00494         olddisk = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00495}00495 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00496}00496         \textcolor{comment}{/* Find disk position in metadata by its serial. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00497}00497         if (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}} != NULL)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00498}00498                 disk\_pos = \mbox{\hyperlink{md__sii_8c_a627b17048a22e9f3a9118525ca44f09e}{sii\_meta\_disk\_pos}}(meta, pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00499}00499         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00500}00500                 disk\_pos = -\/3;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00501}00501         \textcolor{keywordflow}{if} (disk\_pos < 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00502}00502                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}Unknown, probably new or stale disk"{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00503}00503                 \textcolor{comment}{/* If we are in the start process, that's all for now. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00504}00504                 \textcolor{keywordflow}{if} (!mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ac678044a1c77fa3e5174afc0918f1e68}{mdio\_started}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00505}00505                         \textcolor{keywordflow}{goto} nofit;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00506}00506                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00507}00507 \textcolor{comment}{                 * If we have already started -\/ try to get use of the disk.}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00508}00508 \textcolor{comment}{                 * Try to replace OFFLINE disks first, then FAILED.}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00509}00509 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00510}00510                 TAILQ\_FOREACH(tmpdisk, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00511}00511                         \textcolor{keywordflow}{if} (tmpdisk-\/>\mbox{\hyperlink{structg__raid__disk_a893b44bb63bf0b41d6f140424e0db523}{d\_state}} != \mbox{\hyperlink{g__raid_8h_aee552862c97f7442835d7c81b3399ac2}{G\_RAID\_DISK\_S\_OFFLINE}} \&\&}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00512}00512                             tmpdisk-\/>\mbox{\hyperlink{structg__raid__disk_a893b44bb63bf0b41d6f140424e0db523}{d\_state}} != \mbox{\hyperlink{g__raid_8h_a2135c7d2f628dbf559cad6d4ea1b5c8f}{G\_RAID\_DISK\_S\_FAILED}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00513}00513                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00514}00514                         \textcolor{comment}{/* Make sure this disk is big enough. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00515}00515                         TAILQ\_FOREACH(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \&tmpdisk-\/>d\_subdisks, sd\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00516}00516                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a9b4e12573b26ee18473a16408044819f}{sd\_offset}} + \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_abc4da1103e29e3a8e2bbadb18fbccbf6}{sd\_size}} + 512 >}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00517}00517                                     pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a319be513edd344a92dffdf1926b9f055}{pd\_disk\_size}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00518}00518                                         \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc,}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00519}00519                                             \textcolor{stringliteral}{"{}Disk too small (\%ju < \%ju)"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00520}00520                                             pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a319be513edd344a92dffdf1926b9f055}{pd\_disk\_size}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00521}00521                                             \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a9b4e12573b26ee18473a16408044819f}{sd\_offset}} + \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_abc4da1103e29e3a8e2bbadb18fbccbf6}{sd\_size}} + 512);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00522}00522                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00523}00523                                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00524}00524                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00525}00525                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} != NULL)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00526}00526                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00527}00527                         \textcolor{keywordflow}{if} (tmpdisk-\/>\mbox{\hyperlink{structg__raid__disk_a893b44bb63bf0b41d6f140424e0db523}{d\_state}} == \mbox{\hyperlink{g__raid_8h_aee552862c97f7442835d7c81b3399ac2}{G\_RAID\_DISK\_S\_OFFLINE}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00528}00528                                 olddisk = tmpdisk;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00529}00529                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00530}00530                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (olddisk == NULL)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00531}00531                                 olddisk = tmpdisk;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00532}00532                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00533}00533                 \textcolor{keywordflow}{if} (olddisk == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00534}00534 nofit:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00535}00535                         \textcolor{keywordflow}{if} (disk\_pos == -\/3 || pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}} == -\/3) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00536}00536                                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00537}00537                                     \mbox{\hyperlink{g__raid_8h_a53208a3eca6d67917c6fdf6321292c99}{G\_RAID\_DISK\_S\_SPARE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00538}00538                                 \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00539}00539                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00540}00540                                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00541}00541                                     \mbox{\hyperlink{g__raid_8h_a12c815344c6e588760a1619861a54122}{G\_RAID\_DISK\_S\_STALE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00542}00542                                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00543}00543                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00544}00544                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00545}00545                 oldpd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *)olddisk-\/>\mbox{\hyperlink{structg__raid__disk_ab6681cb16ceeb79b9e88d639eca0bd9e}{d\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00546}00546                 disk\_pos = oldpd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00547}00547                 resurrection = 1;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00548}00548         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00549}00549 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00550}00550         \textcolor{keywordflow}{if} (olddisk == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00551}00551                 \textcolor{comment}{/* Find placeholder by position. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00552}00552                 olddisk = \mbox{\hyperlink{md__sii_8c_a655664445d4112c3f1ea5508138cfee6}{g\_raid\_md\_sii\_get\_disk}}(sc, disk\_pos);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00553}00553                 \textcolor{keywordflow}{if} (olddisk == NULL)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00554}00554                         panic(\textcolor{stringliteral}{"{}No disk at position \%d!"{}}, disk\_pos);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00555}00555                 \textcolor{keywordflow}{if} (olddisk-\/>\mbox{\hyperlink{structg__raid__disk_a893b44bb63bf0b41d6f140424e0db523}{d\_state}} != \mbox{\hyperlink{g__raid_8h_aee552862c97f7442835d7c81b3399ac2}{G\_RAID\_DISK\_S\_OFFLINE}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00556}00556                         \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}More than one disk for pos \%d"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00557}00557                             disk\_pos);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00558}00558                         \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_a12c815344c6e588760a1619861a54122}{G\_RAID\_DISK\_S\_STALE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00559}00559                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00560}00560                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00561}00561                 oldpd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *)olddisk-\/>\mbox{\hyperlink{structg__raid__disk_ab6681cb16ceeb79b9e88d639eca0bd9e}{d\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00562}00562         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00563}00563 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00564}00564         \textcolor{comment}{/* Replace failed disk or placeholder with new disk. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00565}00565         TAILQ\_FOREACH\_SAFE(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \&olddisk-\/>d\_subdisks, sd\_next, tmpsd) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00566}00566                 TAILQ\_REMOVE(\&olddisk-\/>d\_subdisks, \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, sd\_next);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00567}00567                 TAILQ\_INSERT\_TAIL(\&\mbox{\hyperlink{structdisk}{disk}}-\/>d\_subdisks, \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, sd\_next);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00568}00568                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a5570ab684f57213078d94750e63354e1}{sd\_disk}} = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00569}00569         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00570}00570         oldpd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}} = -\/2;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00571}00571         pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}} = disk\_pos;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00572}00572 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00573}00573         \textcolor{comment}{/* If it was placeholder -\/-\/ destroy it. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00574}00574         \textcolor{keywordflow}{if} (olddisk-\/>\mbox{\hyperlink{structg__raid__disk_a893b44bb63bf0b41d6f140424e0db523}{d\_state}} == \mbox{\hyperlink{g__raid_8h_aee552862c97f7442835d7c81b3399ac2}{G\_RAID\_DISK\_S\_OFFLINE}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00575}00575                 \mbox{\hyperlink{g__raid_8c_ac1e32d950d9354f1dca5d2ca34244adc}{g\_raid\_destroy\_disk}}(olddisk);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00576}00576         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00577}00577                 \textcolor{comment}{/* Otherwise, make it STALE\_FAILED. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00578}00578                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(olddisk, \mbox{\hyperlink{g__raid_8h_ac204b4a9677b7e98bfeb81a687335e97}{G\_RAID\_DISK\_S\_STALE\_FAILED}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00579}00579         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00580}00580 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00581}00581         \textcolor{comment}{/* Welcome the new disk. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00582}00582         \textcolor{keywordflow}{if} (resurrection)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00583}00583                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00584}00584         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a988c831ac436113860d1a2a5907000c0}{disk\_status}} == \mbox{\hyperlink{md__sii_8c_adbf02ee519964663d72dbff929932cdc}{SII\_S\_CURRENT}} ||}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00585}00585             pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a988c831ac436113860d1a2a5907000c0}{disk\_status}} == \mbox{\hyperlink{md__sii_8c_a118b8534d8229f2c908f8b44eaa75663}{SII\_S\_REBUILD}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00586}00586                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00587}00587         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00588}00588                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_a2135c7d2f628dbf559cad6d4ea1b5c8f}{G\_RAID\_DISK\_S\_FAILED}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00589}00589         TAILQ\_FOREACH(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \&\mbox{\hyperlink{structdisk}{disk}}-\/>d\_subdisks, sd\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00590}00590                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00591}00591 \textcolor{comment}{                 * Different disks may have different sizes,}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00592}00592 \textcolor{comment}{                 * in concat mode. Update from real disk size.}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00593}00593 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00594}00594                 \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} == \mbox{\hyperlink{md__sii_8c_ab2aed91ce84755548e884cb1f41a77f4}{SII\_T\_CONCAT}} || meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} == \mbox{\hyperlink{md__sii_8c_ac110cd550c9f04a563e076e3e7260423}{SII\_T\_JBOD}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00595}00595                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_abc4da1103e29e3a8e2bbadb18fbccbf6}{sd\_size}} = pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a319be513edd344a92dffdf1926b9f055}{pd\_disk\_size}} -\/ 0x800 * 512;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00596}00596 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00597}00597                 \textcolor{keywordflow}{if} (resurrection) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00598}00598                         \textcolor{comment}{/* New or ex-\/spare disk. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00599}00599                         \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00600}00600                             \mbox{\hyperlink{g__raid_8h_a9dd59db9322af74b4b15021c3fc8f2f5}{G\_RAID\_SUBDISK\_S\_NEW}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00601}00601                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a988c831ac436113860d1a2a5907000c0}{disk\_status}} == \mbox{\hyperlink{md__sii_8c_a118b8534d8229f2c908f8b44eaa75663}{SII\_S\_REBUILD}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00602}00602                         \textcolor{comment}{/* Rebuilding disk. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00603}00603                         \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00604}00604                             \mbox{\hyperlink{g__raid_8h_a856d6801d600e0089b0cd39ff5af7224}{G\_RAID\_SUBDISK\_S\_REBUILD}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00605}00605                         \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}} == meta-\/>\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00606}00606                                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_aca58c7c621e10d2cbe97cd1c87214d7b}{sd\_rebuild\_pos}} = pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_abb4c6705061784fd94f00a222868c8aa}{rebuild\_lba}} * 512;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00607}00607                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00608}00608                                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_aca58c7c621e10d2cbe97cd1c87214d7b}{sd\_rebuild\_pos}} = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00609}00609                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a988c831ac436113860d1a2a5907000c0}{disk\_status}} == \mbox{\hyperlink{md__sii_8c_adbf02ee519964663d72dbff929932cdc}{SII\_S\_CURRENT}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00610}00610                         \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a77adb2f77f80bca3be1f43491681a763}{raid\_status}} == \mbox{\hyperlink{md__sii_8c_af42da1a61445193310c3e75ae78e9b2e}{SII\_S\_ONLINE}} ||}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00611}00611                             pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}} != meta-\/>\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00612}00612                                 \textcolor{comment}{/* Dirty or resyncing disk. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00613}00613                                 \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00614}00614                                     \mbox{\hyperlink{g__raid_8h_a41bff35bee21218d2aba7a261eb2e83c}{G\_RAID\_SUBDISK\_S\_STALE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00615}00615                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00616}00616                                 \textcolor{comment}{/* Up to date disk. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00617}00617                                 \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00618}00618                                     \mbox{\hyperlink{g__raid_8h_a498effa0ffa87b75f6c40381c6d4eb39}{G\_RAID\_SUBDISK\_S\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00619}00619                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00620}00620                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00621}00621                         \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00622}00622                             \mbox{\hyperlink{g__raid_8h_a2e56fb1cd5fdab097052e38c28a8c92f}{G\_RAID\_SUBDISK\_S\_FAILED}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00623}00623                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00624}00624                 \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \mbox{\hyperlink{g__raid_8h_ae59b963d99efabe56d8173f3ad914a07}{G\_RAID\_SUBDISK\_E\_NEW}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00625}00625                     \mbox{\hyperlink{g__raid_8h_ae6ac3f8d5dcaa73174e3e8bb9dd12f1c}{G\_RAID\_EVENT\_SUBDISK}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00626}00626         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00627}00627 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00628}00628         \textcolor{comment}{/* Update status of our need for spare. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00629}00629         \textcolor{keywordflow}{if} (mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ac678044a1c77fa3e5174afc0918f1e68}{mdio\_started}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00630}00630                 mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a3f8b349de81ac07eb51bde0908780110}{mdio\_incomplete}} =}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00631}00631                     (\mbox{\hyperlink{g__raid_8c_ad1004201fc232c60faacd7bd3f3b604f}{g\_raid\_ndisks}}(sc, \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}}) <}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00632}00632                      mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00633}00633         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00634}00634 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00635}00635         \textcolor{keywordflow}{return} (resurrection);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00636}00636 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00637}00637 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00638}00638 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00639}\mbox{\hyperlink{md__sii_8c_a53be0affe4138f38e0588b6a59e87b45}{00639}} \mbox{\hyperlink{md__sii_8c_a53be0affe4138f38e0588b6a59e87b45}{g\_disk\_md\_sii\_retaste}}(\textcolor{keywordtype}{void} *arg, \textcolor{keywordtype}{int} pending)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00640}00640 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00641}00641 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00642}00642         \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Array is not complete, trying to retaste."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00643}00643         \mbox{\hyperlink{geom_8h_adb2947739c157b0cb4f1650d1122b953}{g\_retaste}}(\&\mbox{\hyperlink{g__raid_8h_a490a02fd5fb980866b6fbce0f042ed65}{g\_raid\_class}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00644}00644         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(arg, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00645}00645 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00646}00646 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00647}00647 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00648}\mbox{\hyperlink{md__sii_8c_aff6ffeec10065077706374c62465c865}{00648}} \mbox{\hyperlink{md__sii_8c_aff6ffeec10065077706374c62465c865}{g\_raid\_md\_sii\_refill}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00649}00649 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00650}00650         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00651}00651         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *mdi;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00652}00652         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00653}00653         \textcolor{keyword}{struct }task *task;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00654}00654         \textcolor{keywordtype}{int} update, na;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00655}00655 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00656}00656         md = sc-\/>\mbox{\hyperlink{structg__raid__softc_a5bf7421452e0a324fc4f8b954b57314b}{sc\_md}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00657}00657         mdi = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *)md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00658}00658         update = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00659}00659         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00660}00660                 \textcolor{comment}{/* Make sure we miss anything. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00661}00661                 na = \mbox{\hyperlink{g__raid_8c_ad1004201fc232c60faacd7bd3f3b604f}{g\_raid\_ndisks}}(sc, \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00662}00662                 \textcolor{keywordflow}{if} (na == mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00663}00663                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00664}00664 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00665}00665                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00666}00666                     \textcolor{stringliteral}{"{}Array is not complete (\%d of \%d), "{}}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00667}00667                     \textcolor{stringliteral}{"{}trying to refill."{}}, na, mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00668}00668 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00669}00669                 \textcolor{comment}{/* Try to get use some of STALE disks. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00670}00670                 TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00671}00671                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state == \mbox{\hyperlink{g__raid_8h_a12c815344c6e588760a1619861a54122}{G\_RAID\_DISK\_S\_STALE}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00672}00672                                 update += \mbox{\hyperlink{md__sii_8c_a18b31eae1057bbb93ab7663e2dfb61d7}{g\_raid\_md\_sii\_start\_disk}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00673}00673                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state == \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00674}00674                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00675}00675                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00676}00676                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00677}00677                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}} != NULL)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00678}00678                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00679}00679 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00680}00680                 \textcolor{comment}{/* Try to get use some of SPARE disks. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00681}00681                 TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00682}00682                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state == \mbox{\hyperlink{g__raid_8h_a53208a3eca6d67917c6fdf6321292c99}{G\_RAID\_DISK\_S\_SPARE}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00683}00683                                 update += \mbox{\hyperlink{md__sii_8c_a18b31eae1057bbb93ab7663e2dfb61d7}{g\_raid\_md\_sii\_start\_disk}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00684}00684                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state == \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00685}00685                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00686}00686                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00687}00687                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00688}00688         \} \textcolor{keywordflow}{while} (\mbox{\hyperlink{structdisk}{disk}} != NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00689}00689 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00690}00690         \textcolor{comment}{/* Write new metadata if we changed something. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00691}00691         \textcolor{keywordflow}{if} (update)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00692}00692                 \mbox{\hyperlink{md__sii_8c_af9f40935192da6d220ce5fc7f3e3fbc7}{g\_raid\_md\_write\_sii}}(md, NULL, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00693}00693 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00694}00694         \textcolor{comment}{/* Update status of our need for spare. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00695}00695         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a3f8b349de81ac07eb51bde0908780110}{mdio\_incomplete}} = (\mbox{\hyperlink{g__raid_8c_ad1004201fc232c60faacd7bd3f3b604f}{g\_raid\_ndisks}}(sc, \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}}) <}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00696}00696             mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00697}00697 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00698}00698         \textcolor{comment}{/* Request retaste hoping to find spare. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00699}00699         \textcolor{keywordflow}{if} (mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a3f8b349de81ac07eb51bde0908780110}{mdio\_incomplete}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00700}00700                 task = malloc(\textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} task),}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00701}00701                     M\_MD\_SII, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00702}00702                 TASK\_INIT(task, 0, \mbox{\hyperlink{md__sii_8c_a53be0affe4138f38e0588b6a59e87b45}{g\_disk\_md\_sii\_retaste}}, task);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00703}00703                 taskqueue\_enqueue(taskqueue\_swi, task);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00704}00704         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00705}00705 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00706}00706 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00707}00707 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00708}\mbox{\hyperlink{md__sii_8c_ae830bad7750992cbb249e1d7e92e2374}{00708}} \mbox{\hyperlink{md__sii_8c_ae830bad7750992cbb249e1d7e92e2374}{g\_raid\_md\_sii\_start}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00709}00709 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00710}00710         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00711}00711         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *mdi;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00712}00712         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00713}00713         \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00714}00714         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00715}00715         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00716}00716         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}}, *best;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00717}00717         off\_t size;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00718}00718         \textcolor{keywordtype}{int} j, disk\_pos;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00719}00719         uint32\_t gendiff, bestgendiff;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00720}00720         \textcolor{keywordtype}{char} \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}[17];}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00721}00721 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00722}00722         md = sc-\/>\mbox{\hyperlink{structg__raid__softc_a5bf7421452e0a324fc4f8b954b57314b}{sc\_md}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00723}00723         mdi = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *)md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00724}00724         meta = mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00725}00725 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00726}00726         \textcolor{comment}{/* Create volumes and subdisks. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00727}00727         \mbox{\hyperlink{md__sii_8c_af4cbeaa66f2769cb267f3429319b5b7f}{sii\_meta\_get\_name}}(meta, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00728}00728         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} = \mbox{\hyperlink{g__raid_8c_a582a2f56fe635a9f1d2783b9342126ee}{g\_raid\_create\_volume}}(sc, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, -\/1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00729}00729         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} = (off\_t)meta-\/>\mbox{\hyperlink{structsii__raid__conf_a0b20b9cb0685d143151394fadb70c1ea}{total\_sectors}} * 512;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00730}00730         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad17bb2da7eadd462f1f27551cb1da76f}{v\_raid\_level\_qualifier}} = \mbox{\hyperlink{g__raid_8h_a9c036957b2fb94761b5fd084e8f991c9}{G\_RAID\_VOLUME\_RLQ\_NONE}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00731}00731         if (meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} == \mbox{\hyperlink{md__sii_8c_aebb054a0dbe28afdf07b1e1d997d673a}{SII\_T\_RAID0}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00732}00732                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_a6a49f4ddd0b45eb4210ce72528786a32}{G\_RAID\_VOLUME\_RL\_RAID0}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00733}00733                 size = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} / mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00734}00734         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} == \mbox{\hyperlink{md__sii_8c_a499cbe598b21cbe73c2d3e02b9a0b3e7}{SII\_T\_RAID1}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00735}00735                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00736}00736                 size = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00737}00737         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} == \mbox{\hyperlink{md__sii_8c_ae352525fb2f51afea0811d45361446d9}{SII\_T\_RAID01}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00738}00738                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_ad0ef2cd50760a49759a6cbaf2afeb286}{G\_RAID\_VOLUME\_RL\_RAID1E}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00739}00739                 size = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} / (mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}} / 2);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00740}00740         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} == \mbox{\hyperlink{md__sii_8c_ab2aed91ce84755548e884cb1f41a77f4}{SII\_T\_CONCAT}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00741}00741                 \textcolor{keywordflow}{if} (mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}} == 1)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00742}00742                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_acb418af006a1d84e0dd912c58cec6f57}{G\_RAID\_VOLUME\_RL\_SINGLE}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00743}00743                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00744}00744                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_abc695e94a9e4eff0f657ec01d1f19607}{G\_RAID\_VOLUME\_RL\_CONCAT}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00745}00745                 size = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00746}00746         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} == \mbox{\hyperlink{md__sii_8c_ab912f5e01db0d2539550227ff21445ac}{SII\_T\_RAID5}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00747}00747                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_af6db015b03ea390243f2df897eb1189d}{G\_RAID\_VOLUME\_RL\_RAID5}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00748}00748                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad17bb2da7eadd462f1f27551cb1da76f}{v\_raid\_level\_qualifier}} = \mbox{\hyperlink{g__raid_8h_a3605e753584db40187aadad30e663276}{G\_RAID\_VOLUME\_RLQ\_R5LS}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00749}00749                 size = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} / (mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}} -\/ 1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00750}00750         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} == \mbox{\hyperlink{md__sii_8c_ac110cd550c9f04a563e076e3e7260423}{SII\_T\_JBOD}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00751}00751                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_acb418af006a1d84e0dd912c58cec6f57}{G\_RAID\_VOLUME\_RL\_SINGLE}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00752}00752                 size = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00753}00753         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00754}00754                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_a44d5861b2b013283a9dbff0d3ae791e8}{G\_RAID\_VOLUME\_RL\_UNKNOWN}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00755}00755                 size = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00756}00756         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00757}00757         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af0ca6a1c61e893f02a43ca29953c8e39}{v\_strip\_size}} = meta-\/>\mbox{\hyperlink{structsii__raid__conf_a3dcd3aebef0a1c786e107df9ef722bcc}{strip\_sectors}} * 512; \textcolor{comment}{//ZZZ}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00758}00758         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}} = mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00759}00759         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af7b9dcf6621dc8d66be12ba187d5f34b}{v\_sectorsize}} = 512; \textcolor{comment}{//ZZZ}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00760}00760         \textcolor{keywordflow}{for} (j = 0; j < \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}}; j++) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00761}00761                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = \&\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[j];}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00762}00762                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a9b4e12573b26ee18473a16408044819f}{sd\_offset}} = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00763}00763                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_abc4da1103e29e3a8e2bbadb18fbccbf6}{sd\_size}} = size;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00764}00764         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00765}00765         \mbox{\hyperlink{g__raid_8c_a7e6ffb9d11de08e7eaa3e36d1028aa28}{g\_raid\_start\_volume}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00766}00766 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00767}00767         \textcolor{comment}{/* Create disk placeholders to store data for later writing. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00768}00768         \textcolor{keywordflow}{for} (disk\_pos = 0; disk\_pos < mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}}; disk\_pos++) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00769}00769                 pd = malloc(\textcolor{keyword}{sizeof}(*pd), M\_MD\_SII, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00770}00770                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}} = disk\_pos;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00771}00771                 \mbox{\hyperlink{structdisk}{disk}} = \mbox{\hyperlink{g__raid_8c_a7d896eb1612c17408eedbdda2032e897}{g\_raid\_create\_disk}}(sc);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00772}00772                 \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data = (\textcolor{keywordtype}{void} *)pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00773}00773                 \mbox{\hyperlink{structdisk}{disk}}-\/>d\_state = \mbox{\hyperlink{g__raid_8h_aee552862c97f7442835d7c81b3399ac2}{G\_RAID\_DISK\_S\_OFFLINE}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00774}00774                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = \&\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[disk\_pos];}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00775}00775                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a5570ab684f57213078d94750e63354e1}{sd\_disk}} = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00776}00776                 TAILQ\_INSERT\_TAIL(\&\mbox{\hyperlink{structdisk}{disk}}-\/>d\_subdisks, \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, sd\_next);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00777}00777         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00778}00778 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00779}00779         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00780}00780 \textcolor{comment}{         * Make all disks found till the moment take their places}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00781}00781 \textcolor{comment}{         * in order of their generation numbers.}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00782}00782 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00783}00783         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00784}00784                 best = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00785}00785                 bestgendiff = 0xffffffff;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00786}00786                 TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00787}00787                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state != \mbox{\hyperlink{g__raid_8h_ad090f72fa79be3f1a59687ba60f85510}{G\_RAID\_DISK\_S\_NONE}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00788}00788                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00789}00789                         pd = \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00790}00790                         \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}} == NULL)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00791}00791                                 gendiff = 0xfffffffe;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00792}00792                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00793}00793                                 gendiff = meta-\/>\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}} -\/}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00794}00794                                     pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00795}00795                         \textcolor{keywordflow}{if} (gendiff < bestgendiff) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00796}00796                                 best = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00797}00797                                 bestgendiff = gendiff;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00798}00798                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00799}00799                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00800}00800                 \textcolor{keywordflow}{if} (best != NULL)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00801}00801                         \mbox{\hyperlink{md__sii_8c_a18b31eae1057bbb93ab7663e2dfb61d7}{g\_raid\_md\_sii\_start\_disk}}(best);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00802}00802         \} \textcolor{keywordflow}{while} (best != NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00803}00803 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00804}00804         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ac678044a1c77fa3e5174afc0918f1e68}{mdio\_started}} = 1;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00805}00805         \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(0, sc, \textcolor{stringliteral}{"{}Array started."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00806}00806         \mbox{\hyperlink{md__sii_8c_af9f40935192da6d220ce5fc7f3e3fbc7}{g\_raid\_md\_write\_sii}}(md, NULL, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00807}00807 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00808}00808         \textcolor{comment}{/* Pickup any STALE/SPARE disks to refill array if needed. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00809}00809         \mbox{\hyperlink{md__sii_8c_aff6ffeec10065077706374c62465c865}{g\_raid\_md\_sii\_refill}}(sc);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00810}00810 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00811}00811         \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, \mbox{\hyperlink{g__raid_8h_ab4cc6f1792faa0f90f83ebf0f7217a9b}{G\_RAID\_VOLUME\_E\_START}}, \mbox{\hyperlink{g__raid_8h_aa6f84af705b9b366dcb0e4aabd807667}{G\_RAID\_EVENT\_VOLUME}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00812}00812 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00813}00813         callout\_stop(\&mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_aaf96cf0f02915e6f5762a6126d84be66}{mdio\_start\_co}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00814}00814         \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}root\_mount\_rel \%p"{}}, mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_aec9be1474381df7ee991769711370611}{mdio\_rootmount}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00815}00815         root\_mount\_rel(mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_aec9be1474381df7ee991769711370611}{mdio\_rootmount}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00816}00816         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_aec9be1474381df7ee991769711370611}{mdio\_rootmount}} = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00817}00817 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00818}00818 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00819}00819 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00820}\mbox{\hyperlink{md__sii_8c_a0f9b054f929ff7e142fedda61f685dd9}{00820}} \mbox{\hyperlink{md__sii_8c_a0f9b054f929ff7e142fedda61f685dd9}{g\_raid\_md\_sii\_new\_disk}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{structdisk}{disk}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00821}00821 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00822}00822         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00823}00823         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00824}00824         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *mdi;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00825}00825         \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *pdmeta;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00826}00826         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00827}00827 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00828}00828         sc = \mbox{\hyperlink{structdisk}{disk}}-\/>d\_softc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00829}00829         md = sc-\/>\mbox{\hyperlink{structg__raid__softc_a5bf7421452e0a324fc4f8b954b57314b}{sc\_md}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00830}00830         mdi = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *)md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00831}00831         pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00832}00832         pdmeta = pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00833}00833 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00834}00834         if (mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ac678044a1c77fa3e5174afc0918f1e68}{mdio\_started}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00835}00835                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{md__sii_8c_a18b31eae1057bbb93ab7663e2dfb61d7}{g\_raid\_md\_sii\_start\_disk}}(\mbox{\hyperlink{structdisk}{disk}}))}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00836}00836                         \mbox{\hyperlink{md__sii_8c_af9f40935192da6d220ce5fc7f3e3fbc7}{g\_raid\_md\_write\_sii}}(md, NULL, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00837}00837         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00838}00838                 \textcolor{keywordflow}{if} (mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}} == NULL ||}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00839}00839                     ((int32\_t)(pdmeta-\/>\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}} -\/ mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a32aba787e804e1822f219196a9f3d74b}{mdio\_generation}})) > 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00840}00840                         \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}Newer disk"{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00841}00841                         \textcolor{keywordflow}{if} (mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}} != NULL)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00842}00842                                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}}, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00843}00843                         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}} = \mbox{\hyperlink{md__sii_8c_ab18c5e42f6592a5fcd190fd8282ea5d4}{sii\_meta\_copy}}(pdmeta);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00844}00844                         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a32aba787e804e1822f219196a9f3d74b}{mdio\_generation}} = mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00845}00845                         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}} = \mbox{\hyperlink{md__sii_8c_ac775f5ffb1917c99c1a7746fe111e2dd}{sii\_meta\_total\_disks}}(pdmeta);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00846}00846                         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_afc8d1c4998a556058bcecc3f9f8acc79}{mdio\_disks\_present}} = 1;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00847}00847                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (pdmeta-\/>\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}} == mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a32aba787e804e1822f219196a9f3d74b}{mdio\_generation}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00848}00848                         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_afc8d1c4998a556058bcecc3f9f8acc79}{mdio\_disks\_present}}++;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00849}00849                         \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}Matching disk (\%d of \%d up)"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00850}00850                             mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_afc8d1c4998a556058bcecc3f9f8acc79}{mdio\_disks\_present}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00851}00851                             mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00852}00852                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00853}00853                         \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}Older disk"{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00854}00854                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00855}00855 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00856}00856                 \textcolor{comment}{/* If we collected all needed disks -\/ start array. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00857}00857                 \textcolor{keywordflow}{if} (mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_afc8d1c4998a556058bcecc3f9f8acc79}{mdio\_disks\_present}} == mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00858}00858                         \mbox{\hyperlink{md__sii_8c_ae830bad7750992cbb249e1d7e92e2374}{g\_raid\_md\_sii\_start}}(sc);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00859}00859         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00860}00860 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00861}00861 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00862}00862 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00863}\mbox{\hyperlink{md__sii_8c_ad7489b460366b025f802c60900c0a64b}{00863}} \mbox{\hyperlink{md__sii_8c_ad7489b460366b025f802c60900c0a64b}{g\_raid\_sii\_go}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00864}00864 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00865}00865         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00866}00866         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00867}00867         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *mdi;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00868}00868 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00869}00869         sc = arg;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00870}00870         md = sc-\/>\mbox{\hyperlink{structg__raid__softc_a5bf7421452e0a324fc4f8b954b57314b}{sc\_md}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00871}00871         mdi = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *)md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00872}00872         \textcolor{keywordflow}{if} (!mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ac678044a1c77fa3e5174afc0918f1e68}{mdio\_started}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00873}00873                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(0, sc, \textcolor{stringliteral}{"{}Force array start due to timeout."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00874}00874                 \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(sc, \mbox{\hyperlink{g__raid_8h_a24e4a89ebdc2516aa17a2d4c804b38a0}{G\_RAID\_NODE\_E\_START}}, 0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00875}00875         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00876}00876 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00877}00877 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00878}00878 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00879}\mbox{\hyperlink{md__sii_8c_a9ed05e046a64609b2ce389380fab2a45}{00879}} \mbox{\hyperlink{md__sii_8c_ab025e83b94cf9b30a2ef139d3a6383aa}{g\_raid\_md\_create\_sii}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00880}00880     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__geom}{g\_geom}} **\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00881}00881 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00882}00882         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00883}00883         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *mdi;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00884}00884         \textcolor{keywordtype}{char} \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}[32];}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00885}00885 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00886}00886         mdi = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *)md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00887}00887         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[5] = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00888}00888         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[4] = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00889}00889         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[3] = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00890}00890         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[2] = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00891}00891         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[1] = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00892}00892         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[0] = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00893}00893         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ae57dd0b27bc06cdb9c7ea283882be495}{mdio\_location}} = arc4random();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00894}00894         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a32aba787e804e1822f219196a9f3d74b}{mdio\_generation}} = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00895}00895         snprintf(\mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}), \textcolor{stringliteral}{"{}SiI-\/\%02x\%02x\%02x\%02x\%02x\%02x"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00896}00896             mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[5], mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[4],}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00897}00897             mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[3], mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[2],}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00898}00898             mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[1], mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[0]);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00899}00899         sc = \mbox{\hyperlink{g__raid_8c_aee6d4bf64b6c670eda4a8033cb968ae7}{g\_raid\_create\_node}}(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}, md);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00900}00900         \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00901}00901                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__raid__md__if_8m_ae3e40a1a8689841d6d6f54a441d53d43}{G\_RAID\_MD\_TASTE\_FAIL}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00902}00902         md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}} = sc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00903}00903         *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} = sc-\/>\mbox{\hyperlink{structg__raid__softc_aaaffc18ac5f4ad54f823080cf1842943}{sc\_geom}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00904}00904         \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__raid__md__if_8m_aa5340dcca98f524650a3aa3675073120}{G\_RAID\_MD\_TASTE\_NEW}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00905}00905 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00906}00906 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00907}00907 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00908}\mbox{\hyperlink{md__sii_8c_a372bd61267ff01de8b1644d94b1a4c7b}{00908}} \mbox{\hyperlink{md__sii_8c_a2af40b458749c46abc4044e54b201dab}{g\_raid\_md\_taste\_sii}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00909}00909                               \textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__geom}{g\_geom}} **\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00910}00910 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00911}00911         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *rcp;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00912}00912         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00913}00913         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *mdi, *mdi1;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00914}00914         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00915}00915         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00916}00916         \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00917}00917         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00918}00918         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *geom;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00919}00919         \textcolor{keywordtype}{int} disk\_pos, result, spare, len;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00920}00920         \textcolor{keywordtype}{char} \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}[32];}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00921}00921         uint16\_t vendor;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00922}00922 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00923}00923         \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Tasting SiI on \%s"{}}, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00924}00924         mdi = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *)md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00925}00925         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00926}00926 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00927}00927         \textcolor{comment}{/* Read metadata from device. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00928}00928         meta = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00929}00929         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00930}00930         vendor = 0xffff;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00931}00931         len = \textcolor{keyword}{sizeof}(vendor);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00932}00932         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_afe5c92b8a2a9e4cdf1cab6daa96923c1}{geom}}-\/>\mbox{\hyperlink{structg__geom_a6e00f814c9e37ee129d5d456d0379576}{rank}} == 1)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00933}00933                 \mbox{\hyperlink{geom_8h_a63ec0c10c4635c215416171e7e804d17}{g\_io\_getattr}}(\textcolor{stringliteral}{"{}GEOM::hba\_vendor"{}}, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \&len, \&vendor);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00934}00934         meta = \mbox{\hyperlink{md__sii_8c_a2568c5d79aab0ca0fbb1ae55464a3d01}{sii\_meta\_read}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00935}00935         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00936}00936         \textcolor{keywordflow}{if} (meta == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00937}00937                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid_8c_afffb01dfa563be86d3c73e5f264c75ce}{g\_raid\_aggressive\_spare}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00938}00938                         \textcolor{keywordflow}{if} (vendor == 0x1095) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00939}00939                                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1,}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00940}00940                                     \textcolor{stringliteral}{"{}No SiI metadata, forcing spare."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00941}00941                                 spare = 2;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00942}00942                                 \textcolor{keywordflow}{goto} search;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00943}00943                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00944}00944                                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1,}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00945}00945                                     \textcolor{stringliteral}{"{}SiI vendor mismatch 0x\%04x != 0x1095"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00946}00946                                     vendor);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00947}00947                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00948}00948                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00949}00949                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__raid__md__if_8m_ae3e40a1a8689841d6d6f54a441d53d43}{G\_RAID\_MD\_TASTE\_FAIL}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00950}00950         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00951}00951 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00952}00952         \textcolor{comment}{/* Check this disk position in obtained metadata. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00953}00953         disk\_pos = \mbox{\hyperlink{md__sii_8c_a627b17048a22e9f3a9118525ca44f09e}{sii\_meta\_disk\_pos}}(meta, meta);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00954}00954         \textcolor{keywordflow}{if} (disk\_pos == -\/1) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00955}00955                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}SiI disk position not found"{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00956}00956                 \textcolor{keywordflow}{goto} fail1;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00957}00957         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00958}00958 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00959}00959         \textcolor{comment}{/* Metadata valid. Print it. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00960}00960         \mbox{\hyperlink{md__sii_8c_a8c4f8cb55475acd599cc2a1794c84eb7}{g\_raid\_md\_sii\_print}}(meta);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00961}00961         \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}SiI disk position \%d"{}}, disk\_pos);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00962}00962         spare = (meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} == \mbox{\hyperlink{md__sii_8c_a70ecc6ecc53c3b4ec97ae4a8a390165b}{SII\_T\_SPARE}}) ? 1 : 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00963}00963 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00964}00964 search:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00965}00965         \textcolor{comment}{/* Search for matching node. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00966}00966         sc = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00967}00967         mdi1 = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00968}00968         LIST\_FOREACH(geom, \&\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>geom, geom) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00969}00969                 sc = geom-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00970}00970                 \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00971}00971                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00972}00972                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__raid__softc_a92d7a08f5e32fa07a7b8769b5b3ca4f4}{sc\_stopping}} != 0)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00973}00973                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00974}00974                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__raid__softc_a5bf7421452e0a324fc4f8b954b57314b}{sc\_md}}-\/>\mbox{\hyperlink{structg__raid__md__object_ab622ae7b27ee826f1117caaf7fc38f48}{mdo\_class}} != md-\/>\mbox{\hyperlink{structg__raid__md__object_ab622ae7b27ee826f1117caaf7fc38f48}{mdo\_class}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00975}00975                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00976}00976                 mdi1 = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *)sc-\/>\mbox{\hyperlink{structg__raid__softc_a5bf7421452e0a324fc4f8b954b57314b}{sc\_md}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00977}00977                 if (spare) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00978}00978                         \textcolor{keywordflow}{if} (mdi1-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a3f8b349de81ac07eb51bde0908780110}{mdio\_incomplete}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00979}00979                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00980}00980                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00981}00981                         \textcolor{keywordflow}{if} (mdi1-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ae57dd0b27bc06cdb9c7ea283882be495}{mdio\_location}} == meta-\/>\mbox{\hyperlink{structsii__raid__conf_ac4bf6b5414065206979657443fd287de}{raid\_location}} \&\&}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00982}00982                             memcmp(\&mdi1-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00983}00983                              \&meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}, 6) == 0)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00984}00984                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00985}00985                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00986}00986         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00987}00987 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00988}00988         \textcolor{comment}{/* Found matching node. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00989}00989         \textcolor{keywordflow}{if} (geom != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00990}00990                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Found matching array \%s"{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00991}00991                 result = \mbox{\hyperlink{g__raid__md__if_8m_a462421bd5367102456b64943db520823}{G\_RAID\_MD\_TASTE\_EXISTING}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00992}00992 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00993}00993         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (spare) \{ \textcolor{comment}{/* Not found needy node -\/-\/ left for later. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00994}00994                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Spare is not needed at this time"{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00995}00995                 \textcolor{keywordflow}{goto} fail1;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00996}00996 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00997}00997         \} \textcolor{keywordflow}{else} \{ \textcolor{comment}{/* Not found matching node -\/-\/ create one. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00998}00998                 result = \mbox{\hyperlink{g__raid__md__if_8m_aa5340dcca98f524650a3aa3675073120}{G\_RAID\_MD\_TASTE\_NEW}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l00999}00999                 memcpy(\&mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}, \&meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}, 6);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01000}01000                 mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ae57dd0b27bc06cdb9c7ea283882be495}{mdio\_location}} = meta-\/>\mbox{\hyperlink{structsii__raid__conf_ac4bf6b5414065206979657443fd287de}{raid\_location}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01001}01001                 snprintf(\mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}), \textcolor{stringliteral}{"{}SiI-\/\%02x\%02x\%02x\%02x\%02x\%02x"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01002}01002                     mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[5], mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[4],}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01003}01003                     mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[3], mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[2],}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01004}01004                     mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[1], mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}[0]);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01005}01005                 sc = \mbox{\hyperlink{g__raid_8c_aee6d4bf64b6c670eda4a8033cb968ae7}{g\_raid\_create\_node}}(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}, md);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01006}01006                 md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}} = sc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01007}01007                 geom = sc-\/>\mbox{\hyperlink{structg__raid__softc_aaaffc18ac5f4ad54f823080cf1842943}{sc\_geom}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01008}01008                 callout\_init(\&mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_aaf96cf0f02915e6f5762a6126d84be66}{mdio\_start\_co}}, 1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01009}01009                 callout\_reset(\&mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_aaf96cf0f02915e6f5762a6126d84be66}{mdio\_start\_co}}, \mbox{\hyperlink{g__raid_8c_afcfadaaafd5305ba6550313e2cac825b}{g\_raid\_start\_timeout}} * hz,}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01010}01010                     \mbox{\hyperlink{md__sii_8c_ad7489b460366b025f802c60900c0a64b}{g\_raid\_sii\_go}}, sc);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01011}01011                 mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_aec9be1474381df7ee991769711370611}{mdio\_rootmount}} = root\_mount\_hold(\textcolor{stringliteral}{"{}GRAID-\/SiI"{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01012}01012                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}root\_mount\_hold \%p"{}}, mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_aec9be1474381df7ee991769711370611}{mdio\_rootmount}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01013}01013         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01014}01014 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01015}01015         \textcolor{comment}{/* There is no return after this point, so we close passed consumer. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01016}01016         \mbox{\hyperlink{geom_8h_a27b7c72cc3bc5a4d07ce5976e1aa1b58}{g\_access}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, -\/1, 0, 0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01017}01017 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01018}01018         rcp = \mbox{\hyperlink{geom_8h_aef9ca3f0eecc1b245c3c9cd0bac1cdc4}{g\_new\_consumer}}(geom);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01019}01019         rcp-\/>\mbox{\hyperlink{structg__consumer_acf792357913c0445233b71f8259764d9}{flags}} |= \mbox{\hyperlink{geom_8h_a2184f2512ddb7a67ddbb71409cdd953f}{G\_CF\_DIRECT\_RECEIVE}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01020}01020         \mbox{\hyperlink{geom_8h_a7f6ee69db47bae6ff5284f6a9cfceb91}{g\_attach}}(rcp, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01021}01021         \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom_8h_a27b7c72cc3bc5a4d07ce5976e1aa1b58}{g\_access}}(rcp, 1, 1, 1) != 0)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01022}01022                 ; \textcolor{comment}{//goto fail1;}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01023}01023 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01024}01024         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01025}01025         sx\_xlock(\&sc-\/>\mbox{\hyperlink{structg__raid__softc_a6242ad65da243c1107889ace908799fd}{sc\_lock}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01026}01026 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01027}01027         pd = malloc(\textcolor{keyword}{sizeof}(*pd), M\_MD\_SII, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01028}01028         pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}} = meta;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01029}01029         \textcolor{keywordflow}{if} (spare == 2) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01030}01030                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}} = -\/3;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01031}01031         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01032}01032                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}} = -\/1;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01033}01033         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01034}01034         pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a319be513edd344a92dffdf1926b9f055}{pd\_disk\_size}} = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01035}01035         \mbox{\hyperlink{structdisk}{disk}} = \mbox{\hyperlink{g__raid_8c_a7d896eb1612c17408eedbdda2032e897}{g\_raid\_create\_disk}}(sc);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01036}01036         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data = (\textcolor{keywordtype}{void} *)pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01037}01037         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer = rcp;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01038}01038         rcp-\/>\mbox{\hyperlink{structg__consumer_a11273c1281d0cffbc3383eb4e49e7010}{private}} = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01039}01039 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01040}01040         \mbox{\hyperlink{g__raid_8c_afbb51abcd221460c50c23ecc69be3114}{g\_raid\_get\_disk\_info}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01041}01041 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01042}01042         \mbox{\hyperlink{md__sii_8c_a0f9b054f929ff7e142fedda61f685dd9}{g\_raid\_md\_sii\_new\_disk}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01043}01043 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01044}01044         sx\_xunlock(\&sc-\/>\mbox{\hyperlink{structg__raid__softc_a6242ad65da243c1107889ace908799fd}{sc\_lock}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01045}01045         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01046}01046         *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} = geom;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01047}01047         \textcolor{keywordflow}{return} (result);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01048}01048 fail1:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01049}01049         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(meta, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01050}01050         \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__raid__md__if_8m_ae3e40a1a8689841d6d6f54a441d53d43}{G\_RAID\_MD\_TASTE\_FAIL}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01051}01051 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01052}01052 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01053}01053 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01054}\mbox{\hyperlink{md__sii_8c_a428c3d24a25e008dc6dfd62f428d9d0a}{01054}} \mbox{\hyperlink{md__sii_8c_a1487b2a04582705c1b68c93d83ad17e4}{g\_raid\_md\_event\_sii}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md,}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01055}01055     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{structdisk}{disk}}, u\_int \mbox{\hyperlink{g__raid__md__if_8m_a683a43faabf5ffc974caacd425b678d0}{event}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01056}01056 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01057}01057         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01058}01058         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01059}01059         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *mdi;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01060}01060         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01061}01061 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01062}01062         sc = md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01063}01063         mdi = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *)md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01064}01064         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01065}01065                 \textcolor{keywordflow}{switch} (\mbox{\hyperlink{g__raid__md__if_8m_a683a43faabf5ffc974caacd425b678d0}{event}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01066}01066                 \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_a24e4a89ebdc2516aa17a2d4c804b38a0}{G\_RAID\_NODE\_E\_START}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01067}01067                         \textcolor{keywordflow}{if} (!mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ac678044a1c77fa3e5174afc0918f1e68}{mdio\_started}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01068}01068                                 \mbox{\hyperlink{md__sii_8c_ae830bad7750992cbb249e1d7e92e2374}{g\_raid\_md\_sii\_start}}(sc);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01069}01069                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01070}01070                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01071}01071                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01072}01072         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01073}01073         pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01074}01074         switch (\mbox{\hyperlink{g__raid__md__if_8m_a683a43faabf5ffc974caacd425b678d0}{event}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01075}01075         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_aa6e0d41a9b7f63b694bd95805efd6137}{G\_RAID\_DISK\_E\_DISCONNECTED}}:}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01076}01076                 \textcolor{comment}{/* If disk was assigned, just update statuses. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01077}01077                 \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}} >= 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01078}01078                         \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_aee552862c97f7442835d7c81b3399ac2}{G\_RAID\_DISK\_S\_OFFLINE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01079}01079                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01080}01080                                 \mbox{\hyperlink{g__raid_8c_abedf322bff3060596a6f822db290b9f3}{g\_raid\_kill\_consumer}}(sc, \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01081}01081                                 \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01082}01082                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01083}01083                         TAILQ\_FOREACH(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \&\mbox{\hyperlink{structdisk}{disk}}-\/>d\_subdisks, sd\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01084}01084                                 \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01085}01085                                     \mbox{\hyperlink{g__raid_8h_af37111ba44cfc01a98d97bed8f60d964}{G\_RAID\_SUBDISK\_S\_NONE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01086}01086                                 \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \mbox{\hyperlink{g__raid_8h_a1323466893d4ab83ea4c87e89e02fd06}{G\_RAID\_SUBDISK\_E\_DISCONNECTED}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01087}01087                                     \mbox{\hyperlink{g__raid_8h_ae6ac3f8d5dcaa73174e3e8bb9dd12f1c}{G\_RAID\_EVENT\_SUBDISK}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01088}01088                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01089}01089                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01090}01090                         \textcolor{comment}{/* Otherwise -\/-\/ delete. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01091}01091                         \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_ad090f72fa79be3f1a59687ba60f85510}{G\_RAID\_DISK\_S\_NONE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01092}01092                         \mbox{\hyperlink{g__raid_8c_ac1e32d950d9354f1dca5d2ca34244adc}{g\_raid\_destroy\_disk}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01093}01093                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01094}01094 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01095}01095                 \textcolor{comment}{/* Write updated metadata to all disks. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01096}01096                 \mbox{\hyperlink{md__sii_8c_af9f40935192da6d220ce5fc7f3e3fbc7}{g\_raid\_md\_write\_sii}}(md, NULL, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01097}01097 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01098}01098                 \textcolor{comment}{/* Check if anything left except placeholders. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01099}01099                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid_8c_ad1004201fc232c60faacd7bd3f3b604f}{g\_raid\_ndisks}}(sc, -\/1) ==}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01100}01100                     \mbox{\hyperlink{g__raid_8c_ad1004201fc232c60faacd7bd3f3b604f}{g\_raid\_ndisks}}(sc, \mbox{\hyperlink{g__raid_8h_aee552862c97f7442835d7c81b3399ac2}{G\_RAID\_DISK\_S\_OFFLINE}}))}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01101}01101                         \mbox{\hyperlink{g__raid_8c_a99807e6db37e78d1738e46dfd48b7b5c}{g\_raid\_destroy\_node}}(sc, 0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01102}01102                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01103}01103                         \mbox{\hyperlink{md__sii_8c_aff6ffeec10065077706374c62465c865}{g\_raid\_md\_sii\_refill}}(sc);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01104}01104                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01105}01105         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01106}01106         \textcolor{keywordflow}{return} (-\/2);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01107}01107 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01108}01108 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01109}01109 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01110}\mbox{\hyperlink{md__sii_8c_aa4abd5af63f1769c324b217806540110}{01110}} \mbox{\hyperlink{md__sii_8c_afb7e4ac8e6f972885369ae05ca83a78a}{g\_raid\_md\_ctl\_sii}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md,}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01111}01111     \textcolor{keyword}{struct} \mbox{\hyperlink{structgctl__req}{gctl\_req}} *\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01112}01112 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01113}01113         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01114}01114         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01115}01115         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01116}01116         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01117}01117         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *mdi;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01118}01118         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01119}01119         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01120}01120         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01121}01121         \textcolor{keywordtype}{char} arg[16];}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01122}01122         \textcolor{keyword}{const} \textcolor{keywordtype}{char} *verb, *volname, *levelname, *diskname;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01123}01123         \textcolor{keywordtype}{int} *nargs, *force;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01124}01124         off\_t size, \mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, strip;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01125}01125         intmax\_t *sizearg, *striparg;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01126}01126         \textcolor{keywordtype}{int} numdisks, i, len, level, qual, update;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01127}01127         \textcolor{keywordtype}{int} \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01128}01128 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01129}01129         sc = md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01130}01130         mdi = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *)md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01131}01131         verb = \mbox{\hyperlink{geom_8h_a3e3d6786258b3336d55a96607f9b8eb8}{gctl\_get\_param}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}verb"{}}, NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01132}01132         nargs = \mbox{\hyperlink{geom_8h_ab762d12640f528d8f1f60eee92bf5f3b}{gctl\_get\_paraml}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}nargs"{}}, \textcolor{keyword}{sizeof}(*nargs));}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01133}01133         error = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01134}01134         \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}label"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01135}01135                 \textcolor{keywordflow}{if} (*nargs < 4) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01136}01136                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Invalid number of arguments."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01137}01137                         \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01138}01138                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01139}01139                 volname = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}arg1"{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01140}01140                 \textcolor{keywordflow}{if} (volname == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01141}01141                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No volume name."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01142}01142                         \textcolor{keywordflow}{return} (-\/2);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01143}01143                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01144}01144                 levelname = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}arg2"{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01145}01145                 \textcolor{keywordflow}{if} (levelname == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01146}01146                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No RAID level."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01147}01147                         \textcolor{keywordflow}{return} (-\/3);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01148}01148                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01149}01149                 \textcolor{keywordflow}{if} (strcasecmp(levelname, \textcolor{stringliteral}{"{}RAID5"{}}) == 0)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01150}01150                         levelname = \textcolor{stringliteral}{"{}RAID5-\/LS"{}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01151}01151                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid_8c_a54f71ba156f1c4128a0c379435d79f3a}{g\_raid\_volume\_str2level}}(levelname, \&level, \&qual)) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01152}01152                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Unknown RAID level '\%s'."{}}, levelname);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01153}01153                         \textcolor{keywordflow}{return} (-\/4);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01154}01154                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01155}01155                 numdisks = *nargs -\/ 3;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01156}01156                 force = \mbox{\hyperlink{geom_8h_ab762d12640f528d8f1f60eee92bf5f3b}{gctl\_get\_paraml}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}force"{}}, \textcolor{keyword}{sizeof}(*force));}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01157}01157                 \textcolor{keywordflow}{if} (!\mbox{\hyperlink{md__sii_8c_ab6690df836a3bb97a6d6847bc51be059}{g\_raid\_md\_sii\_supported}}(level, qual, numdisks,}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01158}01158                     force ? *force : 0)) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01159}01159                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Unsupported RAID level "{}}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01160}01160                             \textcolor{stringliteral}{"{}(0x\%02x/0x\%02x), or number of disks (\%d)."{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01161}01161                             level, qual, numdisks);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01162}01162                         \textcolor{keywordflow}{return} (-\/5);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01163}01163                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01164}01164 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01165}01165                 \textcolor{comment}{/* Search for disks, connect them and probe. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01166}01166                 size = 0x7fffffffffffffffllu;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01167}01167                 sectorsize = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01168}01168                 \textcolor{keywordflow}{for} (i = 0; i < numdisks; i++) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01169}01169                         snprintf(arg, \textcolor{keyword}{sizeof}(arg), \textcolor{stringliteral}{"{}arg\%d"{}}, i + 3);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01170}01170                         diskname = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, arg);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01171}01171                         \textcolor{keywordflow}{if} (diskname == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01172}01172                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No disk name (\%s)."{}}, arg);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01173}01173                                 error = -\/6;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01174}01174                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01175}01175                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01176}01176                         \textcolor{keywordflow}{if} (strcmp(diskname, \textcolor{stringliteral}{"{}NONE"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01177}01177                                 \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01178}01178                                 \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01179}01179                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01180}01180                                 \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01181}01181                                 \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = \mbox{\hyperlink{g__raid_8c_acc4d5f993651e14eb607d9efe39061c8}{g\_raid\_open\_consumer}}(sc, diskname);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01182}01182                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01183}01183                                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Can't open '\%s'."{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01184}01184                                             diskname);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01185}01185                                         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01186}01186                                         error = -\/7;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01187}01187                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01188}01188                                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01189}01189                                 \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01190}01190                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01191}01191                         pd = malloc(\textcolor{keyword}{sizeof}(*pd), M\_MD\_SII, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01192}01192                         pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}} = i;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01193}01193                         \mbox{\hyperlink{structdisk}{disk}} = \mbox{\hyperlink{g__raid_8c_a7d896eb1612c17408eedbdda2032e897}{g\_raid\_create\_disk}}(sc);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01194}01194                         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data = (\textcolor{keywordtype}{void} *)pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01195}01195                         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01196}01196                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} == NULL)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01197}01197                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01198}01198                         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a11273c1281d0cffbc3383eb4e49e7010}{private}} = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01199}01199                         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01200}01200 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01201}01201                         \mbox{\hyperlink{g__raid_8c_afbb51abcd221460c50c23ecc69be3114}{g\_raid\_get\_disk\_info}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01202}01202 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01203}01203                         pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a319be513edd344a92dffdf1926b9f055}{pd\_disk\_size}} = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01204}01204                         \textcolor{keywordflow}{if} (size > \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01205}01205                                 size = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01206}01206                         \textcolor{keywordflow}{if} (sectorsize < pp-\/>sectorsize)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01207}01207                                 sectorsize = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01208}01208                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01209}01209                 \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01210}01210                         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01211}01211 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01212}01212                 \textcolor{keywordflow}{if} (sectorsize <= 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01213}01213                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Can't get sector size."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01214}01214                         \textcolor{keywordflow}{return} (-\/8);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01215}01215                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01216}01216 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01217}01217                 \textcolor{comment}{/* Reserve space for metadata. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01218}01218                 size -\/= 0x800 * sectorsize;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01219}01219 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01220}01220                 \textcolor{comment}{/* Handle size argument. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01221}01221                 len = \textcolor{keyword}{sizeof}(*sizearg);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01222}01222                 sizearg = \mbox{\hyperlink{geom_8h_a3e3d6786258b3336d55a96607f9b8eb8}{gctl\_get\_param}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}size"{}}, \&len);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01223}01223                 \textcolor{keywordflow}{if} (sizearg != NULL \&\& len == \textcolor{keyword}{sizeof}(*sizearg) \&\&}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01224}01224                     *sizearg > 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01225}01225                         \textcolor{keywordflow}{if} (*sizearg > size) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01226}01226                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Size too big \%lld > \%lld."{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01227}01227                                     (\textcolor{keywordtype}{long} \textcolor{keywordtype}{long})*sizearg, (\textcolor{keywordtype}{long} \textcolor{keywordtype}{long})size);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01228}01228                                 \textcolor{keywordflow}{return} (-\/9);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01229}01229                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01230}01230                         size = *sizearg;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01231}01231                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01232}01232 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01233}01233                 \textcolor{comment}{/* Handle strip argument. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01234}01234                 strip = 131072;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01235}01235                 len = \textcolor{keyword}{sizeof}(*striparg);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01236}01236                 striparg = \mbox{\hyperlink{geom_8h_a3e3d6786258b3336d55a96607f9b8eb8}{gctl\_get\_param}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}strip"{}}, \&len);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01237}01237                 \textcolor{keywordflow}{if} (striparg != NULL \&\& len == \textcolor{keyword}{sizeof}(*striparg) \&\&}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01238}01238                     *striparg > 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01239}01239                         \textcolor{keywordflow}{if} (*striparg < sectorsize) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01240}01240                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Strip size too small."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01241}01241                                 \textcolor{keywordflow}{return} (-\/10);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01242}01242                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01243}01243                         \textcolor{keywordflow}{if} (*striparg \% sectorsize != 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01244}01244                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Incorrect strip size."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01245}01245                                 \textcolor{keywordflow}{return} (-\/11);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01246}01246                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01247}01247                         \textcolor{keywordflow}{if} (strip > 65535 * sectorsize) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01248}01248                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Strip size too big."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01249}01249                                 \textcolor{keywordflow}{return} (-\/12);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01250}01250                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01251}01251                         strip = *striparg;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01252}01252                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01253}01253 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01254}01254                 \textcolor{comment}{/* Round size down to strip or sector. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01255}01255                 \textcolor{keywordflow}{if} (level == \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01256}01256                         size -\/= (size \% sectorsize);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01257}01257                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (level == \mbox{\hyperlink{g__raid_8h_ad0ef2cd50760a49759a6cbaf2afeb286}{G\_RAID\_VOLUME\_RL\_RAID1E}} \&\&}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01258}01258                     (numdisks \& 1) != 0)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01259}01259                         size -\/= (size \% (2 * strip));}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01260}01260                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01261}01261                         size -\/= (size \% strip);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01262}01262                 \textcolor{keywordflow}{if} (size <= 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01263}01263                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Size too small."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01264}01264                         \textcolor{keywordflow}{return} (-\/13);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01265}01265                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01266}01266                 \textcolor{keywordflow}{if} (size > 0xffffffffffffllu * sectorsize) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01267}01267                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Size too big."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01268}01268                         \textcolor{keywordflow}{return} (-\/14);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01269}01269                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01270}01270 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01271}01271                 \textcolor{comment}{/* We have all we need, create things: volume, ... */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01272}01272                 mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a759676fb1c21c97aeda2fa15109ecc04}{mdio\_total\_disks}} = numdisks;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01273}01273                 mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ac678044a1c77fa3e5174afc0918f1e68}{mdio\_started}} = 1;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01274}01274                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} = \mbox{\hyperlink{g__raid_8c_a582a2f56fe635a9f1d2783b9342126ee}{g\_raid\_create\_volume}}(sc, volname, -\/1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01275}01275                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}} = (\textcolor{keywordtype}{void} *)(intptr\_t)0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01276}01276                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = level;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01277}01277                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad17bb2da7eadd462f1f27551cb1da76f}{v\_raid\_level\_qualifier}} = qual;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01278}01278                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af0ca6a1c61e893f02a43ca29953c8e39}{v\_strip\_size}} = strip;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01279}01279                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}} = numdisks;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01280}01280                 \textcolor{keywordflow}{if} (level == \mbox{\hyperlink{g__raid_8h_a6a49f4ddd0b45eb4210ce72528786a32}{G\_RAID\_VOLUME\_RL\_RAID0}} ||}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01281}01281                     level == \mbox{\hyperlink{g__raid_8h_abc695e94a9e4eff0f657ec01d1f19607}{G\_RAID\_VOLUME\_RL\_CONCAT}} ||}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01282}01282                     level == \mbox{\hyperlink{g__raid_8h_acb418af006a1d84e0dd912c58cec6f57}{G\_RAID\_VOLUME\_RL\_SINGLE}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01283}01283                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} = size * numdisks;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01284}01284                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (level == \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01285}01285                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} = size;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01286}01286                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (level == \mbox{\hyperlink{g__raid_8h_af6db015b03ea390243f2df897eb1189d}{G\_RAID\_VOLUME\_RL\_RAID5}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01287}01287                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} = size * (numdisks -\/ 1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01288}01288                 \textcolor{keywordflow}{else} \{ \textcolor{comment}{/* RAID1E */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01289}01289                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} = ((size * numdisks) / strip / 2) *}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01290}01290                             strip;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01291}01291                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01292}01292                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af7b9dcf6621dc8d66be12ba187d5f34b}{v\_sectorsize}} = sectorsize;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01293}01293                 \mbox{\hyperlink{g__raid_8c_a7e6ffb9d11de08e7eaa3e36d1028aa28}{g\_raid\_start\_volume}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01294}01294 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01295}01295                 \textcolor{comment}{/* , and subdisks. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01296}01296                 TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01297}01297                         pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01298}01298                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = \&\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}}];}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01299}01299                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a5570ab684f57213078d94750e63354e1}{sd\_disk}} = \mbox{\hyperlink{structdisk}{disk}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01300}01300                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a9b4e12573b26ee18473a16408044819f}{sd\_offset}} = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01301}01301                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_abc4da1103e29e3a8e2bbadb18fbccbf6}{sd\_size}} = size;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01302}01302                         TAILQ\_INSERT\_TAIL(\&\mbox{\hyperlink{structdisk}{disk}}-\/>d\_subdisks, \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, sd\_next);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01303}01303                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a5570ab684f57213078d94750e63354e1}{sd\_disk}}-\/>\mbox{\hyperlink{structg__raid__disk_a830f6bd55251c14ca26a7f8fceb06a89}{d\_consumer}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01304}01304                                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01305}01305                                     \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01306}01306                                 \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01307}01307                                     \mbox{\hyperlink{g__raid_8h_a498effa0ffa87b75f6c40381c6d4eb39}{G\_RAID\_SUBDISK\_S\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01308}01308                                 \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \mbox{\hyperlink{g__raid_8h_ae59b963d99efabe56d8173f3ad914a07}{G\_RAID\_SUBDISK\_E\_NEW}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01309}01309                                     \mbox{\hyperlink{g__raid_8h_ae6ac3f8d5dcaa73174e3e8bb9dd12f1c}{G\_RAID\_EVENT\_SUBDISK}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01310}01310                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01311}01311                                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_aee552862c97f7442835d7c81b3399ac2}{G\_RAID\_DISK\_S\_OFFLINE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01312}01312                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01313}01313                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01314}01314 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01315}01315                 \textcolor{comment}{/* Write metadata based on created entities. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01316}01316                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(0, sc, \textcolor{stringliteral}{"{}Array started."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01317}01317                 \mbox{\hyperlink{md__sii_8c_af9f40935192da6d220ce5fc7f3e3fbc7}{g\_raid\_md\_write\_sii}}(md, NULL, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01318}01318 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01319}01319                 \textcolor{comment}{/* Pickup any STALE/SPARE disks to refill array if needed. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01320}01320                 \mbox{\hyperlink{md__sii_8c_aff6ffeec10065077706374c62465c865}{g\_raid\_md\_sii\_refill}}(sc);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01321}01321 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01322}01322                 \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, \mbox{\hyperlink{g__raid_8h_ab4cc6f1792faa0f90f83ebf0f7217a9b}{G\_RAID\_VOLUME\_E\_START}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01323}01323                     \mbox{\hyperlink{g__raid_8h_aa6f84af705b9b366dcb0e4aabd807667}{G\_RAID\_EVENT\_VOLUME}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01324}01324                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01325}01325         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01326}01326         \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}delete"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01327}01327                 \textcolor{comment}{/* Check if some volume is still open. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01328}01328                 force = \mbox{\hyperlink{geom_8h_ab762d12640f528d8f1f60eee92bf5f3b}{gctl\_get\_paraml}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}force"{}}, \textcolor{keyword}{sizeof}(*force));}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01329}01329                 \textcolor{keywordflow}{if} (force != NULL \&\& *force == 0 \&\&}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01330}01330                     \mbox{\hyperlink{g__raid_8c_a58ee15b5e8995450f68f052f5fe277bd}{g\_raid\_nopens}}(sc) != 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01331}01331                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Some volume is still open."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01332}01332                         \textcolor{keywordflow}{return} (-\/4);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01333}01333                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01334}01334 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01335}01335                 TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01336}01336                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01337}01337                                 \mbox{\hyperlink{md__sii_8c_a32fdcae1d25339f2ea1dae94ae58bc18}{sii\_meta\_erase}}(\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01338}01338                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01339}01339                 \mbox{\hyperlink{g__raid_8c_a99807e6db37e78d1738e46dfd48b7b5c}{g\_raid\_destroy\_node}}(sc, 0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01340}01340                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01341}01341         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01342}01342         \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}remove"{}}) == 0 ||}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01343}01343             strcmp(verb, \textcolor{stringliteral}{"{}fail"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01344}01344                 \textcolor{keywordflow}{if} (*nargs < 2) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01345}01345                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Invalid number of arguments."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01346}01346                         \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01347}01347                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01348}01348                 \textcolor{keywordflow}{for} (i = 1; i < *nargs; i++) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01349}01349                         snprintf(arg, \textcolor{keyword}{sizeof}(arg), \textcolor{stringliteral}{"{}arg\%d"{}}, i);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01350}01350                         diskname = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, arg);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01351}01351                         \textcolor{keywordflow}{if} (diskname == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01352}01352                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No disk name (\%s)."{}}, arg);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01353}01353                                 error = -\/2;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01354}01354                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01355}01355                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01356}01356                         \textcolor{keywordflow}{if} (strncmp(diskname, \mbox{\hyperlink{geom_8h_a9e429780e6e3bb32284b54630bc60a0d}{\_PATH\_DEV}}, 5) == 0)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01357}01357                                 diskname += 5;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01358}01358 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01359}01359                         TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01360}01360                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer != NULL \&\& }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01361}01361                                     \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer-\/>provider != NULL \&\&}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01362}01362                                     strcmp(\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer-\/>provider-\/>name,}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01363}01363                                      diskname) == 0)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01364}01364                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01365}01365                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01366}01366                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01367}01367                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Disk '\%s' not found."{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01368}01368                                     diskname);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01369}01369                                 error = -\/3;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01370}01370                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01371}01371                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01372}01372 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01373}01373                         \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}fail"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01374}01374                                 \mbox{\hyperlink{md__sii_8c_a219f407f3990d2cf5632ffdfbd4203fc}{g\_raid\_md\_fail\_disk\_sii}}(md, NULL, \mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01375}01375                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01376}01376                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01377}01377 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01378}01378                         pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01379}01379 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01380}01380                         \textcolor{comment}{/* Erase metadata on deleting disk. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01381}01381                         \mbox{\hyperlink{md__sii_8c_a32fdcae1d25339f2ea1dae94ae58bc18}{sii\_meta\_erase}}(\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01382}01382 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01383}01383                         \textcolor{comment}{/* If disk was assigned, just update statuses. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01384}01384                         \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}} >= 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01385}01385                                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_aee552862c97f7442835d7c81b3399ac2}{G\_RAID\_DISK\_S\_OFFLINE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01386}01386                                 \mbox{\hyperlink{g__raid_8c_abedf322bff3060596a6f822db290b9f3}{g\_raid\_kill\_consumer}}(sc, \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01387}01387                                 \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01388}01388                                 TAILQ\_FOREACH(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \&\mbox{\hyperlink{structdisk}{disk}}-\/>d\_subdisks, sd\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01389}01389                                         \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01390}01390                                             \mbox{\hyperlink{g__raid_8h_af37111ba44cfc01a98d97bed8f60d964}{G\_RAID\_SUBDISK\_S\_NONE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01391}01391                                         \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \mbox{\hyperlink{g__raid_8h_a1323466893d4ab83ea4c87e89e02fd06}{G\_RAID\_SUBDISK\_E\_DISCONNECTED}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01392}01392                                             \mbox{\hyperlink{g__raid_8h_ae6ac3f8d5dcaa73174e3e8bb9dd12f1c}{G\_RAID\_EVENT\_SUBDISK}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01393}01393                                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01394}01394                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01395}01395                                 \textcolor{comment}{/* Otherwise -\/-\/ delete. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01396}01396                                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_ad090f72fa79be3f1a59687ba60f85510}{G\_RAID\_DISK\_S\_NONE}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01397}01397                                 \mbox{\hyperlink{g__raid_8c_ac1e32d950d9354f1dca5d2ca34244adc}{g\_raid\_destroy\_disk}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01398}01398                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01399}01399                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01400}01400 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01401}01401                 \textcolor{comment}{/* Write updated metadata to remaining disks. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01402}01402                 \mbox{\hyperlink{md__sii_8c_af9f40935192da6d220ce5fc7f3e3fbc7}{g\_raid\_md\_write\_sii}}(md, NULL, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01403}01403 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01404}01404                 \textcolor{comment}{/* Check if anything left except placeholders. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01405}01405                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid_8c_ad1004201fc232c60faacd7bd3f3b604f}{g\_raid\_ndisks}}(sc, -\/1) ==}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01406}01406                     \mbox{\hyperlink{g__raid_8c_ad1004201fc232c60faacd7bd3f3b604f}{g\_raid\_ndisks}}(sc, \mbox{\hyperlink{g__raid_8h_aee552862c97f7442835d7c81b3399ac2}{G\_RAID\_DISK\_S\_OFFLINE}}))}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01407}01407                         \mbox{\hyperlink{g__raid_8c_a99807e6db37e78d1738e46dfd48b7b5c}{g\_raid\_destroy\_node}}(sc, 0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01408}01408                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01409}01409                         \mbox{\hyperlink{md__sii_8c_aff6ffeec10065077706374c62465c865}{g\_raid\_md\_sii\_refill}}(sc);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01410}01410                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01411}01411         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01412}01412         \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}insert"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01413}01413                 \textcolor{keywordflow}{if} (*nargs < 2) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01414}01414                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Invalid number of arguments."{}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01415}01415                         \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01416}01416                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01417}01417                 update = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01418}01418                 \textcolor{keywordflow}{for} (i = 1; i < *nargs; i++) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01419}01419                         \textcolor{comment}{/* Get disk name. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01420}01420                         snprintf(arg, \textcolor{keyword}{sizeof}(arg), \textcolor{stringliteral}{"{}arg\%d"{}}, i);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01421}01421                         diskname = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, arg);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01422}01422                         \textcolor{keywordflow}{if} (diskname == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01423}01423                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No disk name (\%s)."{}}, arg);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01424}01424                                 error = -\/3;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01425}01425                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01426}01426                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01427}01427 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01428}01428                         \textcolor{comment}{/* Try to find provider with specified name. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01429}01429                         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01430}01430                         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = \mbox{\hyperlink{g__raid_8c_acc4d5f993651e14eb607d9efe39061c8}{g\_raid\_open\_consumer}}(sc, diskname);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01431}01431                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01432}01432                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Can't open disk '\%s'."{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01433}01433                                     diskname);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01434}01434                                 \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01435}01435                                 error = -\/4;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01436}01436                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01437}01437                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01438}01438                         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01439}01439 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01440}01440                         pd = malloc(\textcolor{keyword}{sizeof}(*pd), M\_MD\_SII, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01441}01441                         pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}} = -\/3;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01442}01442                         pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a319be513edd344a92dffdf1926b9f055}{pd\_disk\_size}} = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01443}01443 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01444}01444                         \mbox{\hyperlink{structdisk}{disk}} = \mbox{\hyperlink{g__raid_8c_a7d896eb1612c17408eedbdda2032e897}{g\_raid\_create\_disk}}(sc);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01445}01445                         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01446}01446                         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data = (\textcolor{keywordtype}{void} *)pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01447}01447                         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a11273c1281d0cffbc3383eb4e49e7010}{private}} = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01448}01448                         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01449}01449 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01450}01450                         \mbox{\hyperlink{g__raid_8c_afbb51abcd221460c50c23ecc69be3114}{g\_raid\_get\_disk\_info}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01451}01451 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01452}01452                         \textcolor{comment}{/* Welcome the "{}new"{} disk. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01453}01453                         update += \mbox{\hyperlink{md__sii_8c_a18b31eae1057bbb93ab7663e2dfb61d7}{g\_raid\_md\_sii\_start\_disk}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01454}01454                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state == \mbox{\hyperlink{g__raid_8h_a53208a3eca6d67917c6fdf6321292c99}{G\_RAID\_DISK\_S\_SPARE}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01455}01455                                 \mbox{\hyperlink{md__sii_8c_a2b5df297c0dc961963fb7f38505e8f5b}{sii\_meta\_write\_spare}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01456}01456                                 \mbox{\hyperlink{g__raid_8c_ac1e32d950d9354f1dca5d2ca34244adc}{g\_raid\_destroy\_disk}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01457}01457                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state != \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01458}01458                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Disk '\%s' doesn't fit."{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01459}01459                                     diskname);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01460}01460                                 \mbox{\hyperlink{g__raid_8c_ac1e32d950d9354f1dca5d2ca34244adc}{g\_raid\_destroy\_disk}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01461}01461                                 error = -\/8;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01462}01462                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01463}01463                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01464}01464                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01465}01465 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01466}01466                 \textcolor{comment}{/* Write new metadata if we changed something. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01467}01467                 \textcolor{keywordflow}{if} (update)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01468}01468                         \mbox{\hyperlink{md__sii_8c_af9f40935192da6d220ce5fc7f3e3fbc7}{g\_raid\_md\_write\_sii}}(md, NULL, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01469}01469                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01470}01470         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01471}01471         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Command '\%s' is not supported."{}}, verb);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01472}01472         \textcolor{keywordflow}{return} (-\/100);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01473}01473 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01474}01474 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01475}01475 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01476}\mbox{\hyperlink{md__sii_8c_aa19989fe4231c35b136ec03af1b78da5}{01476}} \mbox{\hyperlink{md__sii_8c_af9f40935192da6d220ce5fc7f3e3fbc7}{g\_raid\_md\_write\_sii}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *tvol,}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01477}01477     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *tsd, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *tdisk)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01478}01478 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01479}01479         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01480}01480         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01481}01481         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01482}01482         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01483}01483         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *mdi;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01484}01484         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01485}01485         \textcolor{keyword}{struct }\mbox{\hyperlink{structsii__raid__conf}{sii\_raid\_conf}} *meta;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01486}01486         u\_int i;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01487}01487 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01488}01488         sc = md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01489}01489         mdi = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *)md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01490}01490 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01491}01491         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__raid__softc_a92d7a08f5e32fa07a7b8769b5b3ca4f4}{sc\_stopping}} == \mbox{\hyperlink{g__raid_8h_ae019bb639a31951ab4cf8dad7f68e46a}{G\_RAID\_DESTROY\_HARD}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01492}01492                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01493}01493 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01494}01494         \textcolor{comment}{/* Bump generation. Newly written metadata may differ from previous. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01495}01495         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a32aba787e804e1822f219196a9f3d74b}{mdio\_generation}}++;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01496}01496 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01497}01497         \textcolor{comment}{/* There is only one volume. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01498}01498         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} = TAILQ\_FIRST(\&sc-\/>sc\_volumes);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01499}01499 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01500}01500         \textcolor{comment}{/* Fill global fields. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01501}01501         meta = malloc(\textcolor{keyword}{sizeof}(*meta), M\_MD\_SII, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01502}01502         \textcolor{keywordflow}{if} (mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01503}01503                 memcpy(meta, mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}}, \textcolor{keyword}{sizeof}(*meta));}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01504}01504         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a0b20b9cb0685d143151394fadb70c1ea}{total\_sectors}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} / \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af7b9dcf6621dc8d66be12ba187d5f34b}{v\_sectorsize}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01505}01505         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a710962cd0d289a88b3b60118104b0819}{vendor\_id}} = 0x1095;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01506}01506         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a32e7e26eb3a741306c684dbadc878ac3}{version\_minor}} = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01507}01507         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a69bd8fdc564e47717962f6154c2ec341}{version\_major}} = 2;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01508}01508         memcpy(\&meta-\/>\mbox{\hyperlink{structsii__raid__conf_a9e0d648609473ec59a207eb07098ce3a}{timestamp}}, \&mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a76798f8cb096df7093b75440bea866f6}{mdio\_timestamp}}, 6);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01509}01509         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a3dcd3aebef0a1c786e107df9ef722bcc}{strip\_sectors}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af0ca6a1c61e893f02a43ca29953c8e39}{v\_strip\_size}} / \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af7b9dcf6621dc8d66be12ba187d5f34b}{v\_sectorsize}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01510}01510         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_a6a49f4ddd0b45eb4210ce72528786a32}{G\_RAID\_VOLUME\_RL\_RAID0}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01511}01511                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} = \mbox{\hyperlink{md__sii_8c_aebb054a0dbe28afdf07b1e1d997d673a}{SII\_T\_RAID0}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01512}01512                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_a6a510028063a1040ca53e7c5f24c4051}{raid0\_disks}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01513}01513                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}} = 0xff;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01514}01514         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01515}01515                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} = \mbox{\hyperlink{md__sii_8c_a499cbe598b21cbe73c2d3e02b9a0b3e7}{SII\_T\_RAID1}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01516}01516                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_a6a510028063a1040ca53e7c5f24c4051}{raid0\_disks}} = 0xff;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01517}01517                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01518}01518         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_ad0ef2cd50760a49759a6cbaf2afeb286}{G\_RAID\_VOLUME\_RL\_RAID1E}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01519}01519                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} = \mbox{\hyperlink{md__sii_8c_ae352525fb2f51afea0811d45361446d9}{SII\_T\_RAID01}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01520}01520                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_a6a510028063a1040ca53e7c5f24c4051}{raid0\_disks}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}} / 2;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01521}01521                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}} = 2;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01522}01522         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_abc695e94a9e4eff0f657ec01d1f19607}{G\_RAID\_VOLUME\_RL\_CONCAT}} ||}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01523}01523             \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_acb418af006a1d84e0dd912c58cec6f57}{G\_RAID\_VOLUME\_RL\_SINGLE}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01524}01524                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} = \mbox{\hyperlink{md__sii_8c_ac110cd550c9f04a563e076e3e7260423}{SII\_T\_JBOD}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01525}01525                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_a6a510028063a1040ca53e7c5f24c4051}{raid0\_disks}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01526}01526                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}} = 0xff;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01527}01527         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01528}01528                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa8e4cdfb23e49e331a19d8d86fe9cb0a}{type}} = \mbox{\hyperlink{md__sii_8c_ab912f5e01db0d2539550227ff21445ac}{SII\_T\_RAID5}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01529}01529                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_a6a510028063a1040ca53e7c5f24c4051}{raid0\_disks}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01530}01530                 meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}} = 0xff;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01531}01531         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01532}01532         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a186457a418c71fea9bf112ebfb929eb3}{generation}} = mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a32aba787e804e1822f219196a9f3d74b}{mdio\_generation}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01533}01533         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a77adb2f77f80bca3be1f43491681a763}{raid\_status}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1c672df93d899cfd72dc0f9b1f4e7139}{v\_dirty}} ? \mbox{\hyperlink{md__sii_8c_af42da1a61445193310c3e75ae78e9b2e}{SII\_S\_ONLINE}} : \mbox{\hyperlink{md__sii_8c_af819c034c1e491e155694366dc788f0f}{SII\_S\_AVAILABLE}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01534}01534         \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01535}01535                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = \&\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[i];}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01536}01536                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} == \mbox{\hyperlink{g__raid_8h_a41bff35bee21218d2aba7a261eb2e83c}{G\_RAID\_SUBDISK\_S\_STALE}} ||}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01537}01537                     \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} == \mbox{\hyperlink{g__raid_8h_a8c3d62bf4e551976a8941a23c8984e5d}{G\_RAID\_SUBDISK\_S\_RESYNC}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01538}01538                         meta-\/>\mbox{\hyperlink{structsii__raid__conf_a77adb2f77f80bca3be1f43491681a763}{raid\_status}} = \mbox{\hyperlink{md__sii_8c_af42da1a61445193310c3e75ae78e9b2e}{SII\_S\_ONLINE}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01539}01539         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01540}01540         meta-\/>\mbox{\hyperlink{structsii__raid__conf_ac4bf6b5414065206979657443fd287de}{raid\_location}} = mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ae57dd0b27bc06cdb9c7ea283882be495}{mdio\_location}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01541}01541         \mbox{\hyperlink{md__sii_8c_a83ba5d2e7f366cc3abc663206a5f99cb}{sii\_meta\_put\_name}}(meta, \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_abdedb24b3ca3f4d3020f94e62d63fa05}{v\_name}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01542}01542 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01543}01543         \textcolor{comment}{/* We are done. Print meta data and store them to disks. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01544}01544         \textcolor{keywordflow}{if} (mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}} != NULL)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01545}01545                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}}, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01546}01546         mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}} = meta;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01547}01547         TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01548}01548                 pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01549}01549                 if (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state != \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01550}01550                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01551}01551                 \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01552}01552                         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01553}01553                         pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}} = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01554}01554                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01555}01555                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}} = \mbox{\hyperlink{md__sii_8c_ab18c5e42f6592a5fcd190fd8282ea5d4}{sii\_meta\_copy}}(meta);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01556}01556                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = TAILQ\_FIRST(\&\mbox{\hyperlink{structdisk}{disk}}-\/>d\_subdisks)) != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01557}01557                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} < \mbox{\hyperlink{g__raid_8h_a9dd59db9322af74b4b15021c3fc8f2f5}{G\_RAID\_SUBDISK\_S\_NEW}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01558}01558                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a988c831ac436113860d1a2a5907000c0}{disk\_status}} = \mbox{\hyperlink{md__sii_8c_a41a0164fb2dbfacbc427b2d34ccf01c0}{SII\_S\_DROPPED}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01559}01559                         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} < \mbox{\hyperlink{g__raid_8h_a41bff35bee21218d2aba7a261eb2e83c}{G\_RAID\_SUBDISK\_S\_STALE}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01560}01560                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a988c831ac436113860d1a2a5907000c0}{disk\_status}} = \mbox{\hyperlink{md__sii_8c_a118b8534d8229f2c908f8b44eaa75663}{SII\_S\_REBUILD}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01561}01561                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_abb4c6705061784fd94f00a222868c8aa}{rebuild\_lba}} =}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01562}01562                                     \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_aca58c7c621e10d2cbe97cd1c87214d7b}{sd\_rebuild\_pos}} / \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af7b9dcf6621dc8d66be12ba187d5f34b}{v\_sectorsize}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01563}01563                         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01564}01564                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a988c831ac436113860d1a2a5907000c0}{disk\_status}} = \mbox{\hyperlink{md__sii_8c_adbf02ee519964663d72dbff929932cdc}{SII\_S\_CURRENT}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01565}01565                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01566}01566                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a7411ecec8e4bf48a4324089b4435f996}{disk\_number}} = \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a415c982fbd2537861e39aa04fa582969}{sd\_pos}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01567}01567                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_ae8f800c6363eb703d37aaf045f123996}{raid0\_ident}} = 0xff;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01568}01568                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_af1768b515ff0f6e35a27c9c45e8b8d15}{raid1\_ident}} = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01569}01569                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_ad0ef2cd50760a49759a6cbaf2afeb286}{G\_RAID\_VOLUME\_RL\_RAID1E}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01570}01570                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a7411ecec8e4bf48a4324089b4435f996}{disk\_number}} = \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a415c982fbd2537861e39aa04fa582969}{sd\_pos}} / meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01571}01571                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_ae8f800c6363eb703d37aaf045f123996}{raid0\_ident}} = \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a415c982fbd2537861e39aa04fa582969}{sd\_pos}} \% meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01572}01572                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_af1768b515ff0f6e35a27c9c45e8b8d15}{raid1\_ident}} = \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a415c982fbd2537861e39aa04fa582969}{sd\_pos}} / meta-\/>\mbox{\hyperlink{structsii__raid__conf_aa4a915acaa0b4a60a0874d55b7a65553}{raid1\_disks}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01573}01573                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01574}01574                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a7411ecec8e4bf48a4324089b4435f996}{disk\_number}} = \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a415c982fbd2537861e39aa04fa582969}{sd\_pos}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01575}01575                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_ae8f800c6363eb703d37aaf045f123996}{raid0\_ident}} = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01576}01576                                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_af1768b515ff0f6e35a27c9c45e8b8d15}{raid1\_ident}} = 0xff;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01577}01577                         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01578}01578                 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01579}01579                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Writing SiI metadata to \%s"{}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01580}01580                     \mbox{\hyperlink{g__raid_8c_a8ceaeb12952563e6fe9869ed6b8daa5d}{g\_raid\_get\_diskname}}(\mbox{\hyperlink{structdisk}{disk}}));}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01581}01581                 \mbox{\hyperlink{md__sii_8c_a8c4f8cb55475acd599cc2a1794c84eb7}{g\_raid\_md\_sii\_print}}(pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01582}01582                 \mbox{\hyperlink{md__sii_8c_a8dd5f58a0fd59c7f6f9c30386cbd4ed3}{sii\_meta\_write}}(\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer, pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01583}01583         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01584}01584         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01585}01585 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01586}01586 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01587}01587 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01588}\mbox{\hyperlink{md__sii_8c_adeaaa9908a0909afdc8c7e800bbd1106}{01588}} \mbox{\hyperlink{md__sii_8c_a219f407f3990d2cf5632ffdfbd4203fc}{g\_raid\_md\_fail\_disk\_sii}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md,}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01589}01589     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *tsd, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *tdisk)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01590}01590 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01591}01591         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01592}01592         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01593}01593         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01594}01594 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01595}01595         sc = md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01596}01596         pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *)tdisk-\/>\mbox{\hyperlink{structg__raid__disk_ab6681cb16ceeb79b9e88d639eca0bd9e}{d\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01597}01597 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01598}01598         \textcolor{comment}{/* We can't fail disk that is not a part of array now. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01599}01599         if (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a71ae75fe7fd4bd54ffd2555e10547eff}{pd\_disk\_pos}} < 0)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01600}01600                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01601}01601 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01602}01602         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01603}01603 \textcolor{comment}{         * Mark disk as failed in metadata and try to write that metadata}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01604}01604 \textcolor{comment}{         * to the disk itself to prevent it's later resurrection as STALE.}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01605}01605 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01606}01606         \textcolor{keywordflow}{if} (tdisk-\/>\mbox{\hyperlink{structg__raid__disk_a830f6bd55251c14ca26a7f8fceb06a89}{d\_consumer}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01607}01607                 \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01608}01608                         pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}-\/>\mbox{\hyperlink{structsii__raid__conf_a988c831ac436113860d1a2a5907000c0}{disk\_status}} = \mbox{\hyperlink{md__sii_8c_a6b2944a44861f106ca4b690812d4bf42}{SII\_S\_REMOVED}};}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01609}01609                         \mbox{\hyperlink{md__sii_8c_a8dd5f58a0fd59c7f6f9c30386cbd4ed3}{sii\_meta\_write}}(tdisk-\/>\mbox{\hyperlink{structg__raid__disk_a830f6bd55251c14ca26a7f8fceb06a89}{d\_consumer}}, pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01610}01610                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01611}01611                         \mbox{\hyperlink{md__sii_8c_a32fdcae1d25339f2ea1dae94ae58bc18}{sii\_meta\_erase}}(tdisk-\/>\mbox{\hyperlink{structg__raid__disk_a830f6bd55251c14ca26a7f8fceb06a89}{d\_consumer}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01612}01612         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01613}01613 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01614}01614         \textcolor{comment}{/* Change states. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01615}01615         \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(tdisk, \mbox{\hyperlink{g__raid_8h_a2135c7d2f628dbf559cad6d4ea1b5c8f}{G\_RAID\_DISK\_S\_FAILED}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01616}01616         TAILQ\_FOREACH(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \&tdisk-\/>d\_subdisks, sd\_next) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01617}01617                 \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01618}01618                     \mbox{\hyperlink{g__raid_8h_a2e56fb1cd5fdab097052e38c28a8c92f}{G\_RAID\_SUBDISK\_S\_FAILED}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01619}01619                 \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \mbox{\hyperlink{g__raid_8h_a11e4d6f6fe0cb9ecaceeb81d2b30a125}{G\_RAID\_SUBDISK\_E\_FAILED}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01620}01620                     \mbox{\hyperlink{g__raid_8h_ae6ac3f8d5dcaa73174e3e8bb9dd12f1c}{G\_RAID\_EVENT\_SUBDISK}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01621}01621         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01622}01622 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01623}01623         \textcolor{comment}{/* Write updated metadata to remaining disks. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01624}01624         \mbox{\hyperlink{md__sii_8c_af9f40935192da6d220ce5fc7f3e3fbc7}{g\_raid\_md\_write\_sii}}(md, NULL, NULL, tdisk);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01625}01625 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01626}01626         \textcolor{comment}{/* Check if anything left except placeholders. */}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01627}01627         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid_8c_ad1004201fc232c60faacd7bd3f3b604f}{g\_raid\_ndisks}}(sc, -\/1) ==}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01628}01628             \mbox{\hyperlink{g__raid_8c_ad1004201fc232c60faacd7bd3f3b604f}{g\_raid\_ndisks}}(sc, \mbox{\hyperlink{g__raid_8h_aee552862c97f7442835d7c81b3399ac2}{G\_RAID\_DISK\_S\_OFFLINE}}))}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01629}01629                 \mbox{\hyperlink{g__raid_8c_a99807e6db37e78d1738e46dfd48b7b5c}{g\_raid\_destroy\_node}}(sc, 0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01630}01630         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01631}01631                 \mbox{\hyperlink{md__sii_8c_aff6ffeec10065077706374c62465c865}{g\_raid\_md\_sii\_refill}}(sc);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01632}01632         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01633}01633 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01634}01634 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01635}01635 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01636}\mbox{\hyperlink{md__sii_8c_aaffa1aef82a51488413a1c11244c3e5c}{01636}} \mbox{\hyperlink{md__sii_8c_abdebfcf5ccbe2ccd6042aa398f7eb718}{g\_raid\_md\_free\_disk\_sii}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md,}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01637}01637     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{structdisk}{disk}})}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01638}01638 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01639}01639         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01640}01640 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01641}01641         pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__perdisk}{g\_raid\_md\_sii\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01642}01642         if (pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01643}01643                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}}, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01644}01644                 pd-\/>\mbox{\hyperlink{structg__raid__md__sii__perdisk_a5f0ab31d3cef2e55296169c351b2b96b}{pd\_meta}} = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01645}01645         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01646}01646         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(pd, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01647}01647         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01648}01648         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01649}01649 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01650}01650 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01651}01651 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01652}\mbox{\hyperlink{md__sii_8c_acd98c7453781ba8260e144ecd8c01736}{01652}} \mbox{\hyperlink{md__sii_8c_adc1f336f18b1701bcc67343916ca8c13}{g\_raid\_md\_free\_sii}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md)}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01653}01653 \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01654}01654         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *mdi;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01655}01655 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01656}01656         mdi = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__sii__object}{g\_raid\_md\_sii\_object}} *)md;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01657}01657         \textcolor{keywordflow}{if} (!mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ac678044a1c77fa3e5174afc0918f1e68}{mdio\_started}}) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01658}01658                 mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_ac678044a1c77fa3e5174afc0918f1e68}{mdio\_started}} = 0;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01659}01659                 callout\_stop(\&mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_aaf96cf0f02915e6f5762a6126d84be66}{mdio\_start\_co}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01660}01660                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}},}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01661}01661                     \textcolor{stringliteral}{"{}root\_mount\_rel \%p"{}}, mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_aec9be1474381df7ee991769711370611}{mdio\_rootmount}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01662}01662                 root\_mount\_rel(mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_aec9be1474381df7ee991769711370611}{mdio\_rootmount}});}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01663}01663                 mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_aec9be1474381df7ee991769711370611}{mdio\_rootmount}} = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01664}01664         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01665}01665         \textcolor{keywordflow}{if} (mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01666}01666                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}}, M\_MD\_SII);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01667}01667                 mdi-\/>\mbox{\hyperlink{structg__raid__md__sii__object_a01935421d6c7e81e3ec69e671f33678b}{mdio\_meta}} = NULL;}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01668}01668         \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01669}01669         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01670}01670 \}}
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01671}01671 }
\DoxyCodeLine{\Hypertarget{md__sii_8c_source_l01672}\mbox{\hyperlink{md__sii_8c_a710b054d4f517b1b59fad9daca9f43fe}{01672}} \mbox{\hyperlink{md__sii_8c_a710b054d4f517b1b59fad9daca9f43fe}{G\_RAID\_MD\_DECLARE}}(sii, \textcolor{stringliteral}{"{}SiI"{}});}

\end{DoxyCode}
