storage_driver.h 2.4 KB
Newer Older
1 2 3
/*
 * storage_driver.h: core driver for storage APIs
 *
4
 * Copyright (C) 2006-2008, 2014 Red Hat, Inc.
5 6 7 8 9 10 11 12 13 14 15 16 17
 * Copyright (C) 2006-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
18
 * License along with this library.  If not, see
O
Osier Yang 已提交
19
 * <http://www.gnu.org/licenses/>.
20 21 22 23 24
 *
 * Author: Daniel P. Berrange <berrange@redhat.com>
 */

#ifndef __VIR_STORAGE_DRIVER_H__
25
# define __VIR_STORAGE_DRIVER_H__
26

27 28
# include <sys/stat.h>

29
# include "domain_conf.h"
30
# include "storage_conf.h"
31
# include "virstoragefile.h"
32

33 34 35
int virStorageFileInit(virStorageSourcePtr src);
int virStorageFileInitAs(virStorageSourcePtr src,
                         uid_t uid, gid_t gid);
36
void virStorageFileDeinit(virStorageSourcePtr src);
37

38 39 40
int virStorageFileCreate(virStorageSourcePtr src);
int virStorageFileUnlink(virStorageSourcePtr src);
int virStorageFileStat(virStorageSourcePtr src,
41
                       struct stat *stat);
42 43 44
ssize_t virStorageFileReadHeader(virStorageSourcePtr src,
                                 ssize_t max_len,
                                 char **buf);
45
const char *virStorageFileGetUniqueIdentifier(virStorageSourcePtr src);
46
int virStorageFileAccess(virStorageSourcePtr src, int mode);
47
int virStorageFileChown(virStorageSourcePtr src, uid_t uid, gid_t gid);
48

49 50
bool virStorageFileSupportsSecurityDriver(virStorageSourcePtr src);

51 52
int virStorageFileGetMetadata(virStorageSourcePtr src,
                              uid_t uid, gid_t gid,
53 54
                              bool allow_probe,
                              bool report_broken)
55 56
    ATTRIBUTE_NONNULL(1);

57 58 59
int virStorageTranslateDiskSourcePool(virConnectPtr conn,
                                      virDomainDiskDefPtr def);

60 61 62 63 64
virStoragePoolPtr
storagePoolLookupByTargetPath(virConnectPtr conn,
                              const char *path)
    ATTRIBUTE_NONNULL(2);

65 66 67
int storageRegister(void);

#endif /* __VIR_STORAGE_DRIVER_H__ */