MCPcopy Create free account
hub / github.com/ceph/ceph / parse_diff_body

Function parse_diff_body

src/tools/rbd/action/MergeDiff.cc:81–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81static int parse_diff_body(int fd, __u8 *tag, uint64_t *offset, uint64_t *length)
82{
83 int r;
84
85 if (!(*tag)) {
86 r = safe_read_exact(fd, tag, 1);
87 if (r < 0)
88 return r;
89 }
90
91 if (*tag == RBD_DIFF_END) {
92 offset = 0;
93 length = 0;
94 return 0;
95 }
96
97 if (*tag != RBD_DIFF_WRITE && *tag != RBD_DIFF_ZERO)
98 return -ENOTSUP;
99
100 char buf[16];
101 r = safe_read_exact(fd, buf, 16);
102 if (r < 0)
103 return r;
104
105 bufferlist bl;
106 bl.append(buf, 16);
107 auto p = bl.cbegin();
108 decode(*offset, p);
109 decode(*length, p);
110
111 if (!(*length))
112 return -ENOTSUP;
113
114 return 0;
115}
116
117/*
118 * fd: the diff file to read from

Callers 1

do_merge_diffFunction · 0.85

Calls 4

safe_read_exactFunction · 0.85
decodeFunction · 0.50
appendMethod · 0.45
cbeginMethod · 0.45

Tested by

no test coverage detected