btrfs-progs: Introduce change_uuid function
[platform/upstream/btrfs-progs.git] / send-stream.h
1 /*
2  * Copyright (C) 2012 Alexander Block.  All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public
6  * License v2 as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public
14  * License along with this program; if not, write to the
15  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16  * Boston, MA 021110-1307, USA.
17  */
18
19 #ifndef __BTRFS_SEND_STREAM_H__
20 #define __BTRFS_SEND_STREAM_H__
21
22 /*
23  * NOTE: this file is public API, any incompatible change has to update
24  * library version
25  */
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 struct btrfs_send_ops {
32         int (*subvol)(const char *path, const u8 *uuid, u64 ctransid,
33                       void *user);
34         int (*snapshot)(const char *path, const u8 *uuid, u64 ctransid,
35                         const u8 *parent_uuid, u64 parent_ctransid,
36                         void *user);
37         int (*mkfile)(const char *path, void *user);
38         int (*mkdir)(const char *path, void *user);
39         int (*mknod)(const char *path, u64 mode, u64 dev, void *user);
40         int (*mkfifo)(const char *path, void *user);
41         int (*mksock)(const char *path, void *user);
42         int (*symlink)(const char *path, const char *lnk, void *user);
43         int (*rename)(const char *from, const char *to, void *user);
44         int (*link)(const char *path, const char *lnk, void *user);
45         int (*unlink)(const char *path, void *user);
46         int (*rmdir)(const char *path, void *user);
47         int (*write)(const char *path, const void *data, u64 offset, u64 len,
48                      void *user);
49         int (*clone)(const char *path, u64 offset, u64 len,
50                      const u8 *clone_uuid, u64 clone_ctransid,
51                      const char *clone_path, u64 clone_offset,
52                      void *user);
53         int (*set_xattr)(const char *path, const char *name, const void *data,
54                          int len, void *user);
55         int (*remove_xattr)(const char *path, const char *name, void *user);
56         int (*truncate)(const char *path, u64 size, void *user);
57         int (*chmod)(const char *path, u64 mode, void *user);
58         int (*chown)(const char *path, u64 uid, u64 gid, void *user);
59         int (*utimes)(const char *path, struct timespec *at,
60                       struct timespec *mt, struct timespec *ct,
61                       void *user);
62         int (*update_extent)(const char *path, u64 offset, u64 len, void *user);
63 };
64
65 int btrfs_read_and_process_send_stream(int fd,
66                                        struct btrfs_send_ops *ops, void *user,
67                                        int honor_end_cmd,
68                                        u64 max_errors);
69
70 #ifdef __cplusplus
71 }
72 #endif
73
74 #endif