1 /*
2  * storage_file_probe.h: file utility functions for FS storage backend
3  *
4  * Copyright (C) 2007-2009, 2012-2016 Red Hat, Inc.
5  * Copyright (C) 2007-2008 Daniel P. Berrange
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library.  If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
21 
22 #pragma once
23 
24 #include <sys/stat.h>
25 
26 #include "storage_source_conf.h"
27 
28 /* Minimum header size required to probe all known formats with
29  * virStorageFileProbeFormat, or obtain metadata from a known format.
30  * Rounded to multiple of 512 (ISO has a 5-byte magic at offset
31  * 32769).  Some formats can be probed with fewer bytes.  Although
32  * some formats theoretically permit metadata that can rely on offsets
33  * beyond this size, in practice that doesn't matter.  */
34 #define VIR_STORAGE_MAX_HEADER 0x8200
35 
36 int
37 virStorageFileProbeGetMetadata(virStorageSource *meta,
38                                char *buf,
39                                size_t len);
40 
41 int
42 virStorageFileProbeFormat(const char *path,
43                           uid_t uid,
44                           gid_t gid);
45