2021-01-22 09:36:21 +00:00
|
|
|
/*
|
|
|
|
* storage_source.h: file utility functions for FS storage backend
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007-2009, 2012-2016 Red Hat, Inc.
|
|
|
|
* Copyright (C) 2007-2008 Daniel P. Berrange
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-01-21 14:44:53 +00:00
|
|
|
#include "storage_source_conf.h"
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
#ifndef DEV_BSIZE
|
|
|
|
# define DEV_BSIZE 512
|
|
|
|
#endif
|
|
|
|
|
|
|
|
virStorageSourcePtr
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceGetMetadataFromFD(const char *path,
|
|
|
|
int fd,
|
|
|
|
int format);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
virStorageSourcePtr
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceGetMetadataFromBuf(const char *path,
|
|
|
|
char *buf,
|
|
|
|
size_t len,
|
|
|
|
int format)
|
2021-01-22 09:36:21 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
|
|
|
|
|
virStorageSourcePtr
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceChainLookup(virStorageSourcePtr chain,
|
|
|
|
virStorageSourcePtr startFrom,
|
|
|
|
const char *name,
|
2021-01-25 14:02:26 +00:00
|
|
|
const char *diskTarget,
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourcePtr *parent)
|
2021-01-22 09:36:21 +00:00
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
|
|
|
int
|
|
|
|
virStorageSourceUpdatePhysicalSize(virStorageSourcePtr src,
|
|
|
|
int fd,
|
|
|
|
struct stat const *sb);
|
|
|
|
|
|
|
|
int
|
|
|
|
virStorageSourceUpdateBackingSizes(virStorageSourcePtr src,
|
|
|
|
int fd,
|
|
|
|
struct stat const *sb);
|
|
|
|
|
|
|
|
int
|
|
|
|
virStorageSourceUpdateCapacity(virStorageSourcePtr src,
|
|
|
|
char *buf,
|
|
|
|
ssize_t len);
|
|
|
|
|
|
|
|
int
|
|
|
|
virStorageSourceNewFromBacking(virStorageSourcePtr parent,
|
|
|
|
virStorageSourcePtr *backing);
|
|
|
|
|
|
|
|
int
|
|
|
|
virStorageSourceParseRBDColonString(const char *rbdstr,
|
|
|
|
virStorageSourcePtr src)
|
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceGetRelativeBackingPath(virStorageSourcePtr top,
|
|
|
|
virStorageSourcePtr base,
|
|
|
|
char **relpath)
|
2021-01-22 09:36:21 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
|
|
|
|
|
|
|
int
|
|
|
|
virStorageSourceNewFromBackingAbsolute(const char *path,
|
|
|
|
virStorageSourcePtr *src);
|
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceInit(virStorageSourcePtr src);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceInitAs(virStorageSourcePtr src,
|
|
|
|
uid_t uid, gid_t gid);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
void
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceDeinit(virStorageSourcePtr src);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceCreate(virStorageSourcePtr src);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceUnlink(virStorageSourcePtr src);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceStat(virStorageSourcePtr src,
|
|
|
|
struct stat *st);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
ssize_t
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceRead(virStorageSourcePtr src,
|
|
|
|
size_t offset,
|
|
|
|
size_t len,
|
|
|
|
char **buf);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
const char *
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceGetUniqueIdentifier(virStorageSourcePtr src);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceAccess(virStorageSourcePtr src,
|
|
|
|
int mode);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceChown(const virStorageSource *src,
|
|
|
|
uid_t uid,
|
|
|
|
gid_t gid);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceSupportsSecurityDriver(const virStorageSource *src);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceSupportsAccess(const virStorageSource *src);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceSupportsCreate(const virStorageSource *src);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceSupportsBackingChainTraversal(const virStorageSource *src);
|
2021-01-22 09:36:21 +00:00
|
|
|
|
|
|
|
int
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceGetMetadata(virStorageSourcePtr src,
|
|
|
|
uid_t uid, gid_t gid,
|
|
|
|
bool report_broken)
|
2021-01-22 09:36:21 +00:00
|
|
|
ATTRIBUTE_NONNULL(1);
|
|
|
|
|
|
|
|
int
|
2021-01-22 14:08:23 +00:00
|
|
|
virStorageSourceFetchRelativeBackingPath(virStorageSourcePtr src,
|
|
|
|
char **relPath)
|
2021-01-22 09:36:21 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
|
|
|
|
|
void
|
2021-01-21 15:46:14 +00:00
|
|
|
virStorageSourceReportBrokenChain(int errcode,
|
|
|
|
virStorageSourcePtr src,
|
|
|
|
virStorageSourcePtr parent);
|