\hypertarget{geom__vinum__move_8c_source}{}\doxysection{geom\+\_\+vinum\+\_\+move.\+c}
\label{geom__vinum__move_8c_source}\index{geom/vinum/geom\_vinum\_move.c@{geom/vinum/geom\_vinum\_move.c}}
\mbox{\hyperlink{geom__vinum__move_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00004}00004 \textcolor{comment}{ *  Copyright (c) 2005 Chris Jones}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00005}00005 \textcolor{comment}{ *  All rights reserved.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00007}00007 \textcolor{comment}{ * This software was developed for the FreeBSD Project by Chris Jones}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00008}00008 \textcolor{comment}{ * thanks to the support of Google's Summer of Code program and}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00009}00009 \textcolor{comment}{ * mentoring by Lukas Ertl.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00010}00010 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00011}00011 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00012}00012 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00013}00013 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00014}00014 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00015}00015 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00016}00016 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00017}00017 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00018}00018 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00019}00019 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00020}00020 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00021}00021 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00022}00022 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00023}00023 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00024}00024 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00025}00025 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00026}00026 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00027}00027 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00028}00028 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00029}00029 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00030}00030 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00031}00031 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00032}00032 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00033}00033 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00035}\mbox{\hyperlink{geom__vinum__move_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00035}} \mbox{\hyperlink{geom__vinum__move_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00036}00036 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/libkern.h>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00039}00039 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom_8h}{geom/geom.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__dbg_8h}{geom/geom\_dbg.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__vinum__var_8h}{geom/vinum/geom\_vinum\_var.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__vinum_8h}{geom/vinum/geom\_vinum.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00044}00044 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00045}00045 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00046}\mbox{\hyperlink{geom__vinum_8h_aafa570af7538fde4b083172b40b93acf}{00046}} \mbox{\hyperlink{geom__vinum__move_8c_a3cb107defa8e49e4c30aef0c91fc750d}{gv\_move}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__geom}{g\_geom}} *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structgctl__req}{gctl\_req}} *\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00047}00047 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00048}00048         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__softc}{gv\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00049}00049         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__sd}{gv\_sd}} *s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00050}00050         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__drive}{gv\_drive}} *d;}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00051}00051         \textcolor{keywordtype}{char} \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}[20], *destination, *object;}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00052}00052         \textcolor{keywordtype}{int} *argc, *\mbox{\hyperlink{structgv__drive_a9786a03e20a91ab9c73a7aa93b90629a}{flags}}, i, \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00053}00053 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00054}00054         sc = \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00056}00056         argc = \mbox{\hyperlink{geom_8h_ab762d12640f528d8f1f60eee92bf5f3b}{gctl\_get\_paraml}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}argc"{}}, \textcolor{keyword}{sizeof}(*argc));}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00057}00057         \textcolor{keywordflow}{if} (argc == NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00058}00058                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}no arguments given"{}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00059}00059                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00060}00060         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00061}00061         \mbox{\hyperlink{structgv__drive_a9786a03e20a91ab9c73a7aa93b90629a}{flags}} = \mbox{\hyperlink{geom_8h_ab762d12640f528d8f1f60eee92bf5f3b}{gctl\_get\_paraml}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}flags"{}}, \textcolor{keyword}{sizeof}(*\mbox{\hyperlink{structgv__drive_a9786a03e20a91ab9c73a7aa93b90629a}{flags}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00062}00062         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structgv__drive_a9786a03e20a91ab9c73a7aa93b90629a}{flags}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00063}00063                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}no flags given"{}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00064}00064                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00065}00065         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00066}00066         destination = \mbox{\hyperlink{geom_8h_a3e3d6786258b3336d55a96607f9b8eb8}{gctl\_get\_param}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}destination"{}}, NULL);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00067}00067         \textcolor{keywordflow}{if} (destination == NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00068}00068                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}no destination given"{}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00069}00069                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00070}00070         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00071}00071         \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom__vinum_8h_adf857930fd65dd84870be1db99e860f7}{gv\_object\_type}}(sc, destination) != \mbox{\hyperlink{geom__vinum__var_8h_a4f601240cfd57a614dee2cca5a2e9d67}{GV\_TYPE\_DRIVE}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00072}00072                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}destination '\%s' is not a drive"{}}, destination);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00073}00073                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00074}00074         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00075}00075         d = \mbox{\hyperlink{geom__vinum_8h_a6bfd18558261750b40b0bfe3c18c4b8f}{gv\_find\_drive}}(sc, destination);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00076}00076 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00077}00077         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00078}00078 \textcolor{comment}{         * We start with 1 here, because argv[0] on the command line is the}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00079}00079 \textcolor{comment}{         * destination drive.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00080}00080 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00081}00081         \textcolor{keywordflow}{for} (i = 1; i < *argc; i++) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00082}00082                 snprintf(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}), \textcolor{stringliteral}{"{}argv\%d"{}}, i);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00083}00083                 \textcolor{keywordtype}{object} = \mbox{\hyperlink{geom_8h_a3e3d6786258b3336d55a96607f9b8eb8}{gctl\_get\_param}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, NULL);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00084}00084                 \textcolor{keywordflow}{if} (\textcolor{keywordtype}{object} == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00085}00085                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00086}00086 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00087}00087                 \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} = \mbox{\hyperlink{geom__vinum_8h_adf857930fd65dd84870be1db99e860f7}{gv\_object\_type}}(sc, \textcolor{keywordtype}{object});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00088}00088                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} != \mbox{\hyperlink{geom__vinum__var_8h_acb4b8aa524c3ba1c7abaa181a5cb6bb9}{GV\_TYPE\_SD}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00089}00089                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}you can only move subdisks; "{}}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00090}00090                             \textcolor{stringliteral}{"{}'\%s' is not a subdisk"{}}, \textcolor{keywordtype}{object});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00091}00091                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00092}00092                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00093}00093 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00094}00094                 s = \mbox{\hyperlink{geom__vinum_8h_ada178b6592b1acfe37ad3eecc8075769}{gv\_find\_sd}}(sc, \textcolor{keywordtype}{object});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00095}00095                 \textcolor{keywordflow}{if} (s == NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00096}00096                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}unknown subdisk '\%s'"{}}, \textcolor{keywordtype}{object});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00097}00097                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00098}00098                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00099}00099                 \mbox{\hyperlink{geom__vinum_8h_ab8b55e981fb9c93aa56042746dd4bf5a}{gv\_post\_event}}(sc, \mbox{\hyperlink{geom__vinum__var_8h_a09230185db91cc767b0abeab165df846}{GV\_EVENT\_MOVE\_SD}}, s, d, *\mbox{\hyperlink{structgv__drive_a9786a03e20a91ab9c73a7aa93b90629a}{flags}}, 0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00100}00100         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00101}00101 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00102}00102 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00103}00103 \textcolor{comment}{/* Move a subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00104}00104 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00105}\mbox{\hyperlink{geom__vinum_8h_a05ffc2a40cc15ca5bc1224b3fd232cfd}{00105}} \mbox{\hyperlink{geom__vinum__move_8c_ab8bb179a313359132db3031f89e3b59f}{gv\_move\_sd}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__softc}{gv\_softc}} *sc, \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__sd}{gv\_sd}} *cursd, }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00106}00106     \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__drive}{gv\_drive}} *destination, \textcolor{keywordtype}{int} \mbox{\hyperlink{structgv__drive_a9786a03e20a91ab9c73a7aa93b90629a}{flags}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00107}00107 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00108}00108         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__drive}{gv\_drive}} *d;}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00109}00109         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__sd}{gv\_sd}} *newsd, *s, *s2;}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00110}00110         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__plex}{gv\_plex}} *p;}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00111}00111         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00112}00112 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00113}00113         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00114}00114         KASSERT(cursd != NULL, (\textcolor{stringliteral}{"{}gv\_move\_sd: NULL cursd"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00115}00115         KASSERT(destination != NULL, (\textcolor{stringliteral}{"{}gv\_move\_sd: NULL destination"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00116}00116 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00117}00117         d = cursd-\/>\mbox{\hyperlink{structgv__sd_a2b31867e2118053e8a27ce048a84335e}{drive\_sc}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00118}00118 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00119}00119         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{geom__vinum_8h_afc60119e84b762b87ad7f506e87d3478}{gv\_consumer\_is\_open}}(d-\/>\mbox{\hyperlink{structgv__drive_a69dfc95c0bafb10b4239b5d45059e85d}{consumer}}) ||}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00120}00120             \mbox{\hyperlink{geom__vinum_8h_afc60119e84b762b87ad7f506e87d3478}{gv\_consumer\_is\_open}}(destination-\/>\mbox{\hyperlink{structgv__drive_a69dfc95c0bafb10b4239b5d45059e85d}{consumer}})) \&\&}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00121}00121             !(\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a916ff06e2bdbe5d20c32322c9a75128b}{GV\_FLAG\_F}})) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00122}00122                 \mbox{\hyperlink{geom__vinum_8h_a28cdbd7c30e435ff9ec8676f493593a0}{G\_VINUM\_DEBUG}}(0, \textcolor{stringliteral}{"{}consumers on current and destination drive "{}}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00123}00123                     \textcolor{stringliteral}{"{} still open"{}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00124}00124                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_a34608a22fc52b3fc8b0d849ee996e0a7}{GV\_ERR\_ISBUSY}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00125}00125         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00126}00126 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00127}00127         \textcolor{keywordflow}{if} (!(\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a916ff06e2bdbe5d20c32322c9a75128b}{GV\_FLAG\_F}})) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00128}00128                 \mbox{\hyperlink{geom__vinum_8h_a28cdbd7c30e435ff9ec8676f493593a0}{G\_VINUM\_DEBUG}}(1, \textcolor{stringliteral}{"{}-\/f flag not passed; move would be "{}}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00129}00129                     \textcolor{stringliteral}{"{}destructive"{}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00130}00130                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_ada1000a7c1cc0029c956bae687c46279}{GV\_ERR\_INVFLAG}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00131}00131         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00132}00132 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00133}00133         \textcolor{keywordflow}{if} (destination == cursd-\/>\mbox{\hyperlink{structgv__sd_a2b31867e2118053e8a27ce048a84335e}{drive\_sc}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00134}00134                 \mbox{\hyperlink{geom__vinum_8h_a28cdbd7c30e435ff9ec8676f493593a0}{G\_VINUM\_DEBUG}}(1, \textcolor{stringliteral}{"{}subdisk '\%s' already on drive '\%s'"{}},}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00135}00135                     cursd-\/>\mbox{\hyperlink{structgv__sd_a835bdd1e1c9adf03425b91c873eebf1e}{name}}, destination-\/>\mbox{\hyperlink{structgv__drive_a69e5c72365075804074d21c056111ebf}{name}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00136}00136                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_a99756b5de9852cd4510167afb3c477df}{GV\_ERR\_ISATTACHED}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00137}00137         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00138}00138 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00139}00139         \textcolor{comment}{/* XXX: Does it have to be part of a plex? */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00140}00140         p = \mbox{\hyperlink{geom__vinum_8h_acf034b996fb50e3a99f2f0d98ffecc53}{gv\_find\_plex}}(sc, cursd-\/>\mbox{\hyperlink{structgv__sd_abc2c739f0fbd33ce2480d93752375f22}{plex}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00141}00141         \textcolor{keywordflow}{if} (p == NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00142}00142                 \mbox{\hyperlink{geom__vinum_8h_a28cdbd7c30e435ff9ec8676f493593a0}{G\_VINUM\_DEBUG}}(0, \textcolor{stringliteral}{"{}subdisk '\%s' is not part of a plex"{}},}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00143}00143                     cursd-\/>\mbox{\hyperlink{structgv__sd_a835bdd1e1c9adf03425b91c873eebf1e}{name}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00144}00144                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{geom__vinum__var_8h_ab8633f9cf1571091fdadc9e3e0521955}{GV\_ERR\_NOTFOUND}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00145}00145         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00146}00146 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00147}00147         \textcolor{comment}{/* Stale the old subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00148}00148         err = \mbox{\hyperlink{geom__vinum_8h_a2dc4176c195982e77ba79874f999300e}{gv\_set\_sd\_state}}(cursd, \mbox{\hyperlink{geom__vinum__var_8h_a5dd4abf3a748b1a4ee0da0bab79840d2}{GV\_SD\_STALE}},}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00149}00149             \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}} | \mbox{\hyperlink{geom__vinum__var_8h_a5015f80eba1026837e357a5b3f5ca7bb}{GV\_SETSTATE\_CONFIG}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00150}00150         \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00151}00151                 \mbox{\hyperlink{geom__vinum_8h_a28cdbd7c30e435ff9ec8676f493593a0}{G\_VINUM\_DEBUG}}(0, \textcolor{stringliteral}{"{}unable to set the subdisk '\%s' to state "{}}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00152}00152                     \textcolor{stringliteral}{"{}'stale'"{}}, cursd-\/>\mbox{\hyperlink{structgv__sd_a835bdd1e1c9adf03425b91c873eebf1e}{name}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00153}00153                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00154}00154         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00155}00155 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00156}00156         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00157}00157 \textcolor{comment}{         * Create new subdisk. Ideally, we'd use gv\_new\_sd, but that requires}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00158}00158 \textcolor{comment}{         * us to create a string for it to parse, which is silly.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00159}00159 \textcolor{comment}{         * TODO: maybe refactor gv\_new\_sd such that this is no longer the case.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00160}00160 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00161}00161         newsd = \mbox{\hyperlink{geom_8h_a0f190247baa73dc863a79fea9d5f6b4f}{g\_malloc}}(\textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__sd}{gv\_sd}}), M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00162}00162         newsd-\/>\mbox{\hyperlink{structgv__sd_aec325f89682a834bf445a955dd6b8dac}{plex\_offset}} = cursd-\/>\mbox{\hyperlink{structgv__sd_aec325f89682a834bf445a955dd6b8dac}{plex\_offset}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00163}00163         newsd-\/>\mbox{\hyperlink{structgv__sd_a7caba67088081bb1e3ede489c8b0dbbc}{size}} = cursd-\/>\mbox{\hyperlink{structgv__sd_a7caba67088081bb1e3ede489c8b0dbbc}{size}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00164}00164         newsd-\/>\mbox{\hyperlink{structgv__sd_a7affffaf0220e9c53c090bb6f41fb2b4}{drive\_offset}} = -\/1;}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00165}00165         strlcpy(newsd-\/>\mbox{\hyperlink{structgv__sd_a835bdd1e1c9adf03425b91c873eebf1e}{name}}, cursd-\/>\mbox{\hyperlink{structgv__sd_a835bdd1e1c9adf03425b91c873eebf1e}{name}}, \textcolor{keyword}{sizeof}(newsd-\/>\mbox{\hyperlink{structgv__sd_a835bdd1e1c9adf03425b91c873eebf1e}{name}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00166}00166         strlcpy(newsd-\/>\mbox{\hyperlink{structgv__sd_abb67fc2a84afb2c110794b6de19d55d6}{drive}}, destination-\/>\mbox{\hyperlink{structgv__drive_a69e5c72365075804074d21c056111ebf}{name}}, \textcolor{keyword}{sizeof}(newsd-\/>\mbox{\hyperlink{structgv__sd_abb67fc2a84afb2c110794b6de19d55d6}{drive}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00167}00167         strlcpy(newsd-\/>\mbox{\hyperlink{structgv__sd_abc2c739f0fbd33ce2480d93752375f22}{plex}}, cursd-\/>\mbox{\hyperlink{structgv__sd_abc2c739f0fbd33ce2480d93752375f22}{plex}}, \textcolor{keyword}{sizeof}(newsd-\/>\mbox{\hyperlink{structgv__sd_abc2c739f0fbd33ce2480d93752375f22}{plex}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00168}00168         newsd-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} = \mbox{\hyperlink{geom__vinum__var_8h_a5dd4abf3a748b1a4ee0da0bab79840d2}{GV\_SD\_STALE}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00169}00169         newsd-\/>\mbox{\hyperlink{structgv__sd_a5852499bf04d1041f8014be8424f1f95}{vinumconf}} = cursd-\/>\mbox{\hyperlink{structgv__sd_a5852499bf04d1041f8014be8424f1f95}{vinumconf}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00170}00170 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00171}00171         err = \mbox{\hyperlink{geom__vinum_8h_adf7992ee21000ae517cb765d7bed79a4}{gv\_sd\_to\_drive}}(newsd, destination);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00172}00172         \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00173}00173                 \textcolor{comment}{/* XXX not enough free space? */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00174}00174                 \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(newsd);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00175}00175                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00176}00176         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00177}00177 }
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00178}00178         \textcolor{comment}{/* Replace the old sd by the new one. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00179}00179         LIST\_FOREACH\_SAFE(s, \&p-\/>subdisks, in\_plex, s2) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00180}00180                 \textcolor{keywordflow}{if} (s == cursd) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00181}00181                         \mbox{\hyperlink{geom__vinum_8h_aa83ccb21c8d2400aa2418b127d78e7b2}{gv\_rm\_sd}}(sc, s);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00182}00182                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00183}00183         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00184}00184         \mbox{\hyperlink{geom__vinum_8h_a17abaca027474298fdf6074597194169}{gv\_sd\_to\_plex}}(newsd, p);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00185}00185         LIST\_INSERT\_HEAD(\&sc-\/>subdisks, newsd, \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00186}00186         \textcolor{comment}{/* Update volume size of plex. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00187}00187         \textcolor{keywordflow}{if} (p-\/>\mbox{\hyperlink{structgv__plex_a8e2820d6bd8419d81213f77131d6bd5c}{vol\_sc}} != NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00188}00188                 \mbox{\hyperlink{geom__vinum_8h_a83711fe4cc9a2aacd2a0e0ef838a50a8}{gv\_update\_vol\_size}}(p-\/>\mbox{\hyperlink{structgv__plex_a8e2820d6bd8419d81213f77131d6bd5c}{vol\_sc}}, \mbox{\hyperlink{geom__vinum_8h_ab643e8ffd49bc6145637b3c31254d473}{gv\_vol\_size}}(p-\/>\mbox{\hyperlink{structgv__plex_a8e2820d6bd8419d81213f77131d6bd5c}{vol\_sc}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00189}00189         \mbox{\hyperlink{geom__vinum_8h_a893e3b157c798b3f925d71151d284dd9}{gv\_save\_config}}(p-\/>\mbox{\hyperlink{structgv__plex_ad30d136a924b3367b9752c10f2391cdc}{vinumconf}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00190}00190         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__move_8c_source_l00191}00191 \}}

\end{DoxyCode}
