Blame source/vdo/base/vdoLoad.h

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