qcow2.c (32cc71def9e3885f9527af713e6d8dc7521ddc08) qcow2.c (353a5d84b25c335b259f37c4f43dad96e6d60ba8)
1/*
2 * Block driver for the QCOW version 2 format
3 *
4 * Copyright (c) 2004-2006 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 99 unchanged lines hidden (view full) ---

108 }
109
110 ret = bdrv_pread(bs->file, s->crypto_header.offset + offset, buflen, buf,
111 0);
112 if (ret < 0) {
113 error_setg_errno(errp, -ret, "Could not read encryption header");
114 return -1;
115 }
1/*
2 * Block driver for the QCOW version 2 format
3 *
4 * Copyright (c) 2004-2006 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 99 unchanged lines hidden (view full) ---

108 }
109
110 ret = bdrv_pread(bs->file, s->crypto_header.offset + offset, buflen, buf,
111 0);
112 if (ret < 0) {
113 error_setg_errno(errp, -ret, "Could not read encryption header");
114 return -1;
115 }
116 return ret;
116 return buflen;
117}
118
119
120static ssize_t qcow2_crypto_hdr_init_func(QCryptoBlock *block, size_t headerlen,
121 void *opaque, Error **errp)
122{
123 BlockDriverState *bs = opaque;
124 BDRVQcow2State *s = bs->opaque;

--- 44 unchanged lines hidden (view full) ---

169 }
170
171 ret = bdrv_pwrite(bs->file, s->crypto_header.offset + offset, buflen, buf,
172 0);
173 if (ret < 0) {
174 error_setg_errno(errp, -ret, "Could not read encryption header");
175 return -1;
176 }
117}
118
119
120static ssize_t qcow2_crypto_hdr_init_func(QCryptoBlock *block, size_t headerlen,
121 void *opaque, Error **errp)
122{
123 BlockDriverState *bs = opaque;
124 BDRVQcow2State *s = bs->opaque;

--- 44 unchanged lines hidden (view full) ---

169 }
170
171 ret = bdrv_pwrite(bs->file, s->crypto_header.offset + offset, buflen, buf,
172 0);
173 if (ret < 0) {
174 error_setg_errno(errp, -ret, "Could not read encryption header");
175 return -1;
176 }
177 return ret;
177 return buflen;
178}
179
180static QDict*
181qcow2_extract_crypto_opts(QemuOpts *opts, const char *fmt, Error **errp)
182{
183 QDict *cryptoopts_qdict;
184 QDict *opts_qdict;
185

--- 5923 unchanged lines hidden ---
178}
179
180static QDict*
181qcow2_extract_crypto_opts(QemuOpts *opts, const char *fmt, Error **errp)
182{
183 QDict *cryptoopts_qdict;
184 QDict *opts_qdict;
185

--- 5923 unchanged lines hidden ---