|
Packit Service |
75d76b |
/*
|
|
Packit Service |
75d76b |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
75d76b |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
75d76b |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
75d76b |
* of the License, or (at your option) any later version.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
75d76b |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
75d76b |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
75d76b |
* GNU General Public License for more details.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
75d76b |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
75d76b |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
75d76b |
* 02110-1301, USA.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* $Id: //eng/vdo-releases/aluminum/src/c++/vdo/base/vdoLoad.h#3 $
|
|
Packit Service |
75d76b |
*/
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
#ifndef VDO_LOAD_H
|
|
Packit Service |
75d76b |
#define VDO_LOAD_H
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
#include "volumeGeometry.h"
|
|
Packit Service |
75d76b |
#include "types.h"
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* A function which decodes a VDO from a super block.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param vdo The VDO to be decoded (its super block must already
|
|
Packit Service |
75d76b |
* be loaded)
|
|
Packit Service |
75d76b |
* @param validateConfig If true , the VDO's configuration will
|
|
Packit Service |
75d76b |
* be validated before the decode is attempted
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return VDO_SUCCESS or an error
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
typedef int VDODecoder(VDO *vdo, bool validateConfig);
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Load a VDO for normal operation. This method must not be called from a base
|
|
Packit Service |
75d76b |
* thread.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param vdo The VDO to load
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return VDO_SUCCESS or an error
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
int performVDOLoad(VDO *vdo)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Perpare a VDO for loading by reading structures off disk. This method does
|
|
Packit Service |
75d76b |
* not alter the on-disk state. It should be called from the VDO constructor,
|
|
Packit Service |
75d76b |
* whereas performVDOLoad() will be called during pre-resume if the VDO has
|
|
Packit Service |
75d76b |
* not been resumed before.
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
int prepareToLoadVDO(VDO *vdo, const VDOLoadConfig *loadConfig)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Synchronously load a VDO from a specified super block location for use by
|
|
Packit Service |
75d76b |
* user-space tools.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param [in] layer The physical layer the VDO sits on
|
|
Packit Service |
75d76b |
* @param [in] geometry A pointer to the geometry for the volume
|
|
Packit Service |
75d76b |
* @param [in] validateConfig Whether to validate the VDO against the layer
|
|
Packit Service |
75d76b |
* @param [in] decoder The VDO decoder to use, if NULL, the default
|
|
Packit Service |
75d76b |
* decoder will be used
|
|
Packit Service |
75d76b |
* @param [out] vdoPtr A pointer to hold the decoded VDO
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return VDO_SUCCESS or an error
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
int loadVDOSuperblock(PhysicalLayer *layer,
|
|
Packit Service |
75d76b |
VolumeGeometry *geometry,
|
|
Packit Service |
75d76b |
bool validateConfig,
|
|
Packit Service |
75d76b |
VDODecoder *decoder,
|
|
Packit Service |
75d76b |
VDO **vdoPtr)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
/**
|
|
Packit Service |
75d76b |
* Synchronously load a VDO volume for use by user-space tools.
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @param [in] layer The physical layer the VDO sits on
|
|
Packit Service |
75d76b |
* @param [in] validateConfig Whether to validate the VDO against the layer
|
|
Packit Service |
75d76b |
* @param [in] decoder The VDO decoder to use, if NULL, the default
|
|
Packit Service |
75d76b |
* decoder will be used
|
|
Packit Service |
75d76b |
* @param [out] vdoPtr A pointer to hold the decoded VDO
|
|
Packit Service |
75d76b |
*
|
|
Packit Service |
75d76b |
* @return VDO_SUCCESS or an error
|
|
Packit Service |
75d76b |
**/
|
|
Packit Service |
75d76b |
int loadVDO(PhysicalLayer *layer,
|
|
Packit Service |
75d76b |
bool validateConfig,
|
|
Packit Service |
75d76b |
VDODecoder *decoder,
|
|
Packit Service |
75d76b |
VDO **vdoPtr)
|
|
Packit Service |
75d76b |
__attribute__((warn_unused_result));
|
|
Packit Service |
75d76b |
|
|
Packit Service |
75d76b |
#endif /* VDO_LOAD_H */
|