From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1am0Qr-00080M-0u for qemu-devel@nongnu.org; Fri, 01 Apr 2016 10:52:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1am0QF-0006UE-9s for qemu-devel@nongnu.org; Fri, 01 Apr 2016 10:52:16 -0400 From: Max Reitz Date: Fri, 1 Apr 2016 16:50:15 +0200 Message-Id: <1459522215-13950-1-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] block: Move away from anglo-centricity List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: Kevin Wolf , qemu-devel@nongnu.org, Max Reitz In its organizational structure, the qemu project is rather decentralized: Many different maintainers manage their own more or less secluded subsystems. However, regarding languages, it is still rather anglo-centric. This issue has been brought up multiple times in regards to user-visible output such as error messages and has unfortunately generally been dismissed, except for some UIs. Development always flows from the developer community to the user. Our developer community is just as diverse (or at least I hope it is) as our user base. Therefore, we should reflect this diversity in our development process in order for this diversity to reach our users as well, so they can benefit from it. The human-targeted part of that development process are comments in the source code, obviously. Thus, in order to exhibit qemu's diversity, it makes sense for each subsystem's comments to be translated into the maintainer's native language. Unfortunately, I do not speak Swabian. However, as a submaintainer under Kevin, I think it will be fine to translate the comments into German, as that is supposedly a language we both share. I'm certain that this will not hamper development itself by much. First of all, many other developers in the block area are able to speak German: Markus Armbruster, Stefan Hajnoczi, Peter Lieven, Stefan Weil, just to name a few. Second, good code is supposed to be self-explanatory, i.e. without reading the comments. While it should go without saying that the block layer's code quality is simply marvelous, we can now proof that it indeed is, by seeing whether people who cannot speak German can still understand the code. (Although some of our code is rumored to be rather hard to understand even with the comments. But those rumors are purely unfounded, I am sure.) In the rather improbable event that someone is not able to understand the code without being able to read the comments, they will then need to learn German. So this is fine, too. Third, this will surely attract a wave of German developers who were so far unable to participate in qemu's development because of the language barrier. In order to facilitate this process, the next step will be to use German commit messages for every commit in the block layer and to allow German variable names. I am sure if all maintainers follow this process of translating their subsystem's comments, variable names and string contents into their native language, qemu will become a shining example of what we call =E2=80=9EKraut und R=C3=BCben=E2=80=9C. And everyone knows how much the K= rauts like Kraut. Signed-off-by: Max Reitz --- block.c | 936 ++++++++++++++++++++++++++-----------------= ------ block/blkdebug.c | 44 +-- block/linux-aio.c | 51 +-- block/qcow.c | 122 +++---- block/qcow2-cache.c | 18 +- block/qcow2-cluster.c | 566 ++++++++++++++++-------------- block/qcow2-refcount.c | 642 +++++++++++++++++---------------- block/qcow2-snapshot.c | 119 ++++--- block/qcow2.c | 536 +++++++++++++++------------- block/qcow2.h | 127 +++---- block/raw-aio.h | 6 +- block/raw-posix.c | 414 +++++++++++----------- block/raw-win32.c | 45 +-- block/raw_bsd.c | 19 +- block/vpc.c | 132 +++---- block/win32-aio.c | 4 +- blockdev-nbd.c | 7 +- qemu-img.c | 310 ++++++++-------- qemu-io-cmds.c | 80 +++-- qemu-io.c | 19 +- 20 files changed, 2218 insertions(+), 1979 deletions(-) diff --git a/block.c b/block.c index d36eb75..61af50c 100644 --- a/block.c +++ b/block.c @@ -54,7 +54,8 @@ #include #endif =20 -#define NOT_DONE 0x7fffffff /* used while emulated sync operation in pro= gress */ +#define NOT_DONE 0x7fffffff /* zeigt an, dass eine Synchronisationsopera= tion + stattfindet */ =20 static QTAILQ_HEAD(, BlockDriverState) graph_bdrv_states =3D QTAILQ_HEAD_INITIALIZER(graph_bdrv_states); @@ -70,7 +71,8 @@ static int bdrv_open_inherit(BlockDriverState **pbs, co= nst char *filename, BlockDriverState *parent, const BdrvChildRole *child_role, Error **er= rp); =20 -/* If non-zero, use only whitelisted block drivers */ +/* Ist diese Variable nicht null, dann werden nur whitegelistete Blocktr= eiber + * verwendet */ static int use_bdrv_whitelist; =20 static void bdrv_close(BlockDriverState *bs); @@ -98,7 +100,7 @@ int is_windows_drive(const char *filename) size_t bdrv_opt_mem_align(BlockDriverState *bs) { if (!bs || !bs->drv) { - /* page size or 4k (hdd sector size) should be on the safe side = */ + /* Seitengr=C3=B6=C3=9Fe oder 4k (HDD-Sektorengr=C3=B6=C3=9Fe) s= ollte gen=C3=BCgen */ return MAX(4096, getpagesize()); } =20 @@ -108,14 +110,14 @@ size_t bdrv_opt_mem_align(BlockDriverState *bs) size_t bdrv_min_mem_align(BlockDriverState *bs) { if (!bs || !bs->drv) { - /* page size or 4k (hdd sector size) should be on the safe side = */ + /* Seitengr=C3=B6=C3=9Fe oder 4k (HDD-Sektorengr=C3=B6=C3=9Fe) s= ollte gen=C3=BCgen */ return MAX(4096, getpagesize()); } =20 return bs->bl.min_mem_alignment; } =20 -/* check if the path starts with ":" */ +/* =C3=9Cberpr=C3=BCfe, ob der Pfad mit ":" beginnt */ int path_has_protocol(const char *path) { const char *p; @@ -136,7 +138,7 @@ int path_has_protocol(const char *path) int path_is_absolute(const char *path) { #ifdef _WIN32 - /* specific case for names like: "\\.\d:" */ + /* Sonderfall f=C3=BCr Namen wie: "\\.\d:" */ if (is_windows_drive(path) || is_windows_drive_prefix(path)) { return 1; } @@ -146,9 +148,9 @@ int path_is_absolute(const char *path) #endif } =20 -/* if filename is absolute, just copy it to dest. Otherwise, build a - path to it by considering it is relative to base_path. URL are - supported. */ +/* Ist der Dateiname absolut, kopiere ihn einfach nach dest. Ansonsten e= rstelle + einen Pfad zu ihm unter Ber=C3=BCcksichtigung, dass er relativ zu bas= e_path ist. + URLs werden unterst=C3=BCtzt. */ void path_combine(char *dest, int dest_size, const char *base_path, const char *filename) @@ -271,7 +273,7 @@ static int bdrv_is_whitelisted(BlockDriver *drv, bool= read_only) const char **p; =20 if (!whitelist_rw[0] && !whitelist_ro[0]) { - return 1; /* no whitelist, anything goes */ + return 1; /* keine Whitelist, alles geht */ } =20 for (p =3D whitelist_rw; *p; p++) { @@ -338,7 +340,7 @@ int bdrv_create(BlockDriver *drv, const char* filenam= e, } =20 if (qemu_in_coroutine()) { - /* Fast-path if already in coroutine context */ + /* Abk=C3=BCrzung, wenn wir bereits im Koroutinenkontext sind */ bdrv_create_co_entry(&cco); } else { co =3D qemu_coroutine_create(bdrv_create_co_entry); @@ -381,10 +383,10 @@ int bdrv_create_file(const char *filename, QemuOpts= *opts, Error **errp) } =20 /** - * Try to get @bs's logical and physical block size. - * On success, store them in @bsz struct and return 0. - * On failure return -errno. - * @bs must not be empty. + * Versuchen Sie, @ der bs logischen und physischen Blockgr=C3=B6=C3=9Fe= . + * Bei Erfolg speichern sie in @bsz struct und 0 zur=C3=BCck. + * Bei einem Fehler R=C3=BCckkehr -errno. + * @bs darf nicht leer sein. */ int bdrv_probe_blocksizes(BlockDriverState *bs, BlockSizes *bsz) { @@ -398,10 +400,10 @@ int bdrv_probe_blocksizes(BlockDriverState *bs, Blo= ckSizes *bsz) } =20 /** - * Try to get @bs's geometry (cyls, heads, sectors). - * On success, store them in @geo struct and return 0. - * On failure return -errno. - * @bs must not be empty. + * Versuchen @ bs Geometrie zu erhalten (cyls, K=C3=B6pfe, Sektoren). + * Bei Erfolg speichern sie in @geo struct und 0 zur=C3=BCck. + * Bei einem Fehler R=C3=BCckkehr -errno. + * @bs darf nicht leer sein. */ int bdrv_probe_geometry(BlockDriverState *bs, HDGeometry *geo) { @@ -415,15 +417,15 @@ int bdrv_probe_geometry(BlockDriverState *bs, HDGeo= metry *geo) } =20 /* - * Create a uniquely-named empty temporary file. - * Return 0 upon success, otherwise a negative errno value. + * Erstellen Sie eine eindeutig benannte leere tempor=C3=A4re Datei. + * Return 0 bei Erfolg, sonst einen negativen Wert errno. */ int get_tmp_filename(char *filename, int size) { #ifdef _WIN32 char temp_dir[MAX_PATH]; - /* GetTempFileName requires that its output buffer (4th param) - have length MAX_PATH or greater. */ + /* GetTempFileName erfordert, dass seine Ausgangspuffer (4 param) + haben L=C3=A4nge MAX_PATH oder h=C3=B6her. */ assert(size >=3D MAX_PATH); return (GetTempPath(MAX_PATH, temp_dir) && GetTempFileName(temp_dir, "qem", 0, filename) @@ -451,8 +453,8 @@ int get_tmp_filename(char *filename, int size) } =20 /* - * Detect host devices. By convention, /dev/cdrom[N] is always - * recognized as a host CDROM. + * Detect-Host-Ger=C3=A4te. Nach Konvention / dev / cdrom [N] ist immer + * als Host-CD-ROM erkannt. */ static BlockDriver *find_hdev_driver(const char *filename) { @@ -481,14 +483,14 @@ BlockDriver *bdrv_find_protocol(const char *filenam= e, int len; const char *p; =20 - /* TODO Drivers without bdrv_file_open must be specified explicitly = */ + /* TODO Treiber ohne bdrv_file_open muss explizit angegeben werden *= / =20 /* - * XXX(hch): we really should not let host device detection - * override an explicit protocol specification, but moving this - * later breaks access to device names with colons in them. - * Thanks to the brain-dead persistent naming schemes on udev- - * based Linux systems those actually are quite common. + * XXX (HCH): Wir sollten wirklich nicht Host-Ger=C3=A4teerkennung l= assen + * eine explizite Protokollspezifikation au=C3=9Fer Kraft setzen, so= ndern + * bewegte diese sp=C3=A4ter bricht den Zugriff auf Ger=C3=A4tenamen= mit + * Doppelpunkten in ihnen. Dank der hirntot persistent Namensgebung = auf + * udev-basierte Linux-Systeme diese sind eigentlich recht h=C3=A4uf= ig. */ drv1 =3D find_hdev_driver(filename); if (drv1) { @@ -518,18 +520,18 @@ BlockDriver *bdrv_find_protocol(const char *filenam= e, } =20 /* - * Guess image format by probing its contents. - * This is not a good idea when your image is raw (CVE-2008-2004), but - * we do it anyway for backward compatibility. + * Ratet mal, Bildformat, das von seinem Inhalt Sondieren. + * Dies ist keine gute Idee, wenn Ihr Bild roh (CVE-2008-2004), aber + * wir tun es trotzdem f=C3=BCr die Abw=C3=A4rtskompatibilit=C3=A4t. * - * @buf contains the image's first @buf_size bytes. - * @buf_size is the buffer size in bytes (generally BLOCK_PROBE_BUF_S= IZE, - * but can be smaller if the image file is smaller) - * @filename is its filename. + * @buf enth=C3=A4lt die ersten @buf_size Bytes des Bildes. + * @buf_size ist die Puffergr=C3=B6=C3=9Fe in Byte (in der Regel BLOCK_P= ROBE_BUF_SIZE, + * kann aber kleiner sein, wenn die Bilddatei kleiner ist) + * @filename ist der Dateiname. * - * For all block drivers, call the bdrv_probe() method to get its - * probing score. - * Return the first block driver with the highest probing score. + * F=C3=BCr alle Block Treiber, rufen Sie die bdrv_probe () -Methode sei= ne erhalten + * Sondieren des Gastes. + * Bringen Sie den ersten Block Fahrer mit der h=C3=B6chsten Punktzahl S= ondieren. */ BlockDriver *bdrv_probe_all(const uint8_t *buf, int buf_size, const char *filename) @@ -557,7 +559,8 @@ static int find_image_format(BlockDriverState *bs, co= nst char *filename, uint8_t buf[BLOCK_PROBE_BUF_SIZE]; int ret =3D 0; =20 - /* Return the raw BlockDriver * to scsi-generic devices or empty dri= ves */ + /* Bringen Sie den rohen BlockDriver * zu scsi-generic-Ger=C3=A4te o= der + * Leerfahrten */ if (bdrv_is_sg(bs) || !bdrv_is_inserted(bs) || bdrv_getlength(bs) =3D= =3D 0) { *pdrv =3D &bdrv_raw; return ret; @@ -582,18 +585,19 @@ static int find_image_format(BlockDriverState *bs, = const char *filename, } =20 /** - * Set the current 'total_sectors' value - * Return 0 on success, -errno on error. + * Stellen Sie die aktuelle 'total_sectors' Wert + * Zur=C3=BCck 0 bei Erfolg, -errno auf Fehler. */ static int refresh_total_sectors(BlockDriverState *bs, int64_t hint) { BlockDriver *drv =3D bs->drv; =20 - /* Do not attempt drv->bdrv_getlength() on scsi-generic devices */ + /* Versuchen Sie nicht, DRV-> bdrv_getlength () auf scsi-generic-Ger= =C3=A4te */ if (bdrv_is_sg(bs)) return 0; =20 - /* query actual device if possible, otherwise just trust the hint */ + /* abfragen eigentliche Ger=C3=A4t, wenn m=C3=B6glich, sonst nur den= Hinweis + * vertrauen */ if (drv->bdrv_getlength) { int64_t length =3D drv->bdrv_getlength(bs); if (length < 0) { @@ -607,8 +611,9 @@ static int refresh_total_sectors(BlockDriverState *bs= , int64_t hint) } =20 /** - * Combines a QDict of new block driver @options with any missing option= s taken - * from @old_options, so that leaving out an option defaults to its old = value. + * Kombiniert einen QDict neuer Blocktreiber @options mit irgendwelchen + * fehlenden Optionen genommen von @old_options, so dass eine Option + * standardm=C3=A4=C3=9Fig auf seinen alten Wert auslassen. */ static void bdrv_join_options(BlockDriverState *bs, QDict *options, QDict *old_options) @@ -621,16 +626,16 @@ static void bdrv_join_options(BlockDriverState *bs,= QDict *options, } =20 /** - * Set open flags for a given discard mode + * Stellen Sie offene Flags f=C3=BCr einen bestimmten L=C3=B6schmodus * - * Return 0 on success, -1 if the discard mode was invalid. + * Zur=C3=BCck bei Erfolg 0, -1, wenn der L=C3=B6schmodus ung=C3=BCltig = war. */ int bdrv_parse_discard_flags(const char *mode, int *flags) { *flags &=3D ~BDRV_O_UNMAP; =20 if (!strcmp(mode, "off") || !strcmp(mode, "ignore")) { - /* do nothing */ + /* nichts tun */ } else if (!strcmp(mode, "on") || !strcmp(mode, "unmap")) { *flags |=3D BDRV_O_UNMAP; } else { @@ -641,9 +646,9 @@ int bdrv_parse_discard_flags(const char *mode, int *f= lags) } =20 /** - * Set open flags for a given cache mode + * Stellen Sie offene Flags f=C3=BCr einen bestimmten Cache-Modus * - * Return 0 on success, -1 if the cache mode was invalid. + * Zur=C3=BCck bei Erfolg 0, -1, wenn der Cache-Modus ung=C3=BCltig war. */ int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrou= gh) { @@ -670,43 +675,45 @@ int bdrv_parse_cache_mode(const char *mode, int *fl= ags, bool *writethrough) } =20 /* - * Returns the options and flags that a temporary snapshot should get, b= ased on - * the originally requested flags (the originally requested image will h= ave - * flags like a backing file) + * Gibt die Optionen und Flags, die eine tempor=C3=A4re Snapshot sollte,= erhalten + * basierend auf die urspr=C3=BCnglich angeforderten Flags (die urspr=C3= =BCnglich + * angeforderte Bild wird Flags wie eine Tr=C3=A4gerdatei) */ static void bdrv_temp_snapshot_options(int *child_flags, QDict *child_op= tions, int parent_flags, QDict *parent_o= ptions) { *child_flags =3D (parent_flags & ~BDRV_O_SNAPSHOT) | BDRV_O_TEMPORAR= Y; =20 - /* For temporary files, unconditional cache=3Dunsafe is fine */ + /* F=C3=BCr tempor=C3=A4re Dateien, unbedingte cache =3D unsicher is= t in Ordnung */ qdict_set_default_str(child_options, BDRV_OPT_CACHE_DIRECT, "off"); qdict_set_default_str(child_options, BDRV_OPT_CACHE_NO_FLUSH, "on"); } =20 /* - * Returns the options and flags that bs->file should get if a protocol = driver - * is expected, based on the given options and flags for the parent BDS + * Gibt die Optionen und Flags, die BS-> Datei sollte, wenn ein Protokol= ltreiber + * erhalten erwartet wird, basierend auf den angegebenen Optionen und Fl= ags f=C3=BCr + * die =C3=BCbergeordnete BDS */ static void bdrv_inherited_options(int *child_flags, QDict *child_option= s, int parent_flags, QDict *parent_optio= ns) { int flags =3D parent_flags; =20 - /* Enable protocol handling, disable format probing for bs->file */ + /* Aktivieren Protokollverarbeitung, deaktivieren Format Sondieren f= =C3=BCr + * BS-> Datei */ flags |=3D BDRV_O_PROTOCOL; =20 - /* If the cache mode isn't explicitly set, inherit direct and no-flu= sh from - * the parent. */ + /* Wenn der Cache-Modus nicht explizit festgelegt wird, erben direkt= und + * nicht b=C3=BCndig ab das Elternteil. */ qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_DIR= ECT); qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_NO_= FLUSH); =20 - /* Our block drivers take care to send flushes and respect unmap pol= icy, - * so we can default to enable both on lower layers regardless of th= e - * corresponding parent options. */ + /* Unsere Block Fahrer k=C3=BCmmern Wallungen zu senden und unmap Be= dingungen + * beachten, so k=C3=B6nnen wir sowohl auf der unteren Schichten, un= abh=C3=A4ngig + * von der zu erm=C3=B6glichen Standard entsprechenden Eltern Option= en. */ flags |=3D BDRV_O_UNMAP; =20 - /* Clear flags that only apply to the top layer */ + /* Klare Flags, die nur auf die oberste Ebene anwenden */ flags &=3D ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_RE= AD | BDRV_O_NO_IO); =20 @@ -718,9 +725,9 @@ const BdrvChildRole child_file =3D { }; =20 /* - * Returns the options and flags that bs->file should get if the use of = formats - * (and not only protocols) is permitted for it, based on the given opti= ons and - * flags for the parent BDS + * Gibt die Optionen und Flags, die BS-> Datei sollte, wenn die Verwendu= ng von + * Formaten (Und nicht nur Protokolle) f=C3=BCr die es zul=C3=A4ssig ist= , basierend auf + * den gegebenen M=C3=B6glichkeiten und Flags f=C3=BCr die Mutter BDS */ static void bdrv_inherited_fmt_options(int *child_flags, QDict *child_op= tions, int parent_flags, QDict *parent_o= ptions) @@ -736,23 +743,24 @@ const BdrvChildRole child_format =3D { }; =20 /* - * Returns the options and flags that bs->backing should get, based on t= he - * given options and flags for the parent BDS + * Gibt die Optionen und Flags, die BS-> Unterst=C3=BCtzung erhalten sol= len, auf der + * Grundlage der angegebenen Optionen und Flags f=C3=BCr die Eltern BDS */ static void bdrv_backing_options(int *child_flags, QDict *child_options, int parent_flags, QDict *parent_options= ) { int flags =3D parent_flags; =20 - /* The cache mode is inherited unmodified for backing files; except = WCE, - * which is only applied on the top level (BlockBackend) */ + /* Der Cache-Modus wird nicht modifizierten geerbt Dateien f=C3=BCr = die + * Sicherung; au=C3=9Fer WCE, die nur auf der obersten Ebene angewen= det wird + * (BlockBackend) */ qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_DIR= ECT); qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_NO_= FLUSH); =20 - /* backing files always opened read-only */ + /* Sichern von Dateien ge=C3=B6ffnet immer schreibgesch=C3=BCtzt */ flags &=3D ~(BDRV_O_RDWR | BDRV_O_COPY_ON_READ); =20 - /* snapshot=3Don is handled on the top layer */ + /* snapshot =3D on wird auf der oberen Schicht gehandhabt */ flags &=3D ~(BDRV_O_SNAPSHOT | BDRV_O_TEMPORARY); =20 *child_flags =3D flags; @@ -767,13 +775,13 @@ static int bdrv_open_flags(BlockDriverState *bs, in= t flags) int open_flags =3D flags; =20 /* - * Clear flags that are internal to the block layer before opening t= he - * image. + * Klare Flags, die vor dem =C3=96ffnen der am Block Layer intern si= nd + * Image. */ open_flags &=3D ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_PROTO= COL); =20 /* - * Snapshots should be writable. + * Snapshots sollte beschreibbar sein. */ if (flags & BDRV_O_TEMPORARY) { open_flags |=3D BDRV_O_RDWR; @@ -819,27 +827,28 @@ static void bdrv_assign_node_name(BlockDriverState = *bs, node_name =3D gen_node_name =3D id_generate(ID_BLOCK); } else if (!id_wellformed(node_name)) { /* - * Check for empty string or invalid characters, but not if it i= s - * generated (generated names use characters not available to th= e user) + * =C3=9Cberpr=C3=BCfen Sie, ob leere Zeichenfolge oder ung=C3=BC= ltige Zeichen, aber + * nicht, wenn es erzeugt (generierten Namen Zeichen nicht f=C3=BC= r den + * Benutzer verf=C3=BCgbar verwenden) */ error_setg(errp, "Invalid node name"); return; } =20 - /* takes care of avoiding namespaces collisions */ + /* k=C3=BCmmert sich Namespace-Kollisionen zu vermeiden */ if (blk_by_name(node_name)) { error_setg(errp, "node-name=3D%s is conflicting with a device id= ", node_name); goto out; } =20 - /* takes care of avoiding duplicates node names */ + /* k=C3=BCmmert sich um Duplikate Knotennamen zu vermeiden */ if (bdrv_find_node(node_name)) { error_setg(errp, "Duplicate node name"); goto out; } =20 - /* copy node name into the bs and insert it into the graph list */ + /* Kopieren Knotennamen in die bs und in der Grafik Liste einf=C3=BC= gen */ pstrcpy(bs->node_name, sizeof(bs->node_name), node_name); QTAILQ_INSERT_TAIL(&graph_bdrv_states, bs, node_list); out: @@ -870,14 +879,14 @@ static QemuOptsList bdrv_runtime_opts =3D { .type =3D QEMU_OPT_BOOL, .help =3D "Ignore flush requests", }, - { /* end of list */ } + { /* Ende der Liste */ } }, }; =20 /* - * Common part for opening disk images and files + * Gemeinsame Teil f=C3=BCr die =C3=96ffnung der Disk-Images und Dateien * - * Removes all processed options from *options. + * Entfernt alle verarbeiteten Optionen * Optionen. */ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file, QDict *options, Error **errp) @@ -943,7 +952,8 @@ static int bdrv_open_common(BlockDriverState *bs, Bdr= vChild *file, goto fail_opts; } =20 - assert(bs->copy_on_read =3D=3D 0); /* bdrv_new() and bdrv_close() ma= ke it so */ + /* bdrv_new () und bdrv_close () machen es so */ + assert(bs->copy_on_read =3D=3D 0); if (bs->open_flags & BDRV_O_COPY_ON_READ) { if (!bs->read_only) { bdrv_enable_copy_on_read(bs); @@ -964,10 +974,11 @@ static int bdrv_open_common(BlockDriverState *bs, B= drvChild *file, bs->drv =3D drv; bs->opaque =3D g_malloc0(drv->instance_size); =20 - /* Apply cache mode options */ + /* Anwenden Cache-Modus-Optionen */ update_flags_from_options(&bs->open_flags, opts); =20 - /* Open the image, either directly or using a protocol */ + /* =C3=96ffnen Sie das Bild, entweder direkt oder unter Verwendung e= ines + * Protokolls */ open_flags =3D bdrv_open_flags(bs, bs->open_flags); if (drv->bdrv_file_open) { assert(file =3D=3D NULL); @@ -1058,7 +1069,7 @@ static void parse_json_protocol(QDict *options, con= st char **pfilename, QDict *json_options; Error *local_err =3D NULL; =20 - /* Parse json: pseudo-protocol */ + /* Parse json: Pseudo-Protokoll */ if (!*pfilename || !g_str_has_prefix(*pfilename, "json:")) { return; } @@ -1069,18 +1080,18 @@ static void parse_json_protocol(QDict *options, c= onst char **pfilename, return; } =20 - /* Options given in the filename have lower priority than options - * specified directly */ + /* Optionen im Dateinamen angegeben haben niedrigere Priorit=C3=A4t = als Optionen + * angegeben direkt */ qdict_join(options, json_options, false); QDECREF(json_options); *pfilename =3D NULL; } =20 /* - * Fills in default options for opening images and converts the legacy - * filename/flags pair to option QDict entries. - * The BDRV_O_PROTOCOL flag in *flags will be set or cleared accordingly= if a - * block driver has been specified explicitly. + * F=C3=BCllt in Standardoptionen f=C3=BCr Bilder =C3=B6ffnen und wandel= t das Verm=C3=A4chtnis + * Dateiname / pair Flags Option QDict Eintr=C3=A4ge. + * Die BDRV_O_PROTOCOL Flagge in *flags werden entsprechend gesetzt oder + * gel=C3=B6scht werden, wenn ein Block-Treiber wurde explizit angegeben= . */ static int bdrv_fill_options(QDict **options, const char *filename, int *flags, Error **errp) @@ -1098,8 +1109,8 @@ static int bdrv_fill_options(QDict **options, const= char *filename, error_setg(errp, "Unknown driver '%s'", drvname); return -ENOENT; } - /* If the user has explicitly specified the driver, this choice = should - * override the BDRV_O_PROTOCOL flag */ + /* Wenn der Benutzer explizit den Fahrer festgelegt hat, sollte = diese + * Wahl =C3=BCberschreiben die BDRV_O_PROTOCOL Flagge */ protocol =3D drv->bdrv_file_open; } =20 @@ -1109,10 +1120,10 @@ static int bdrv_fill_options(QDict **options, con= st char *filename, *flags &=3D ~BDRV_O_PROTOCOL; } =20 - /* Translate cache options from flags into options */ + /* =C3=9Cbersetzen Cache-Optionen von Flaggen in Optionen */ update_options_from_flags(*options, *flags); =20 - /* Fetch the file name from the options QDict if necessary */ + /* Holt den Dateinamen aus den Optionen QDict ggf. */ if (protocol && filename) { if (!qdict_haskey(*options, "filename")) { qdict_put(*options, "filename", qstring_from_str(filename)); @@ -1124,7 +1135,7 @@ static int bdrv_fill_options(QDict **options, const= char *filename, } } =20 - /* Find the right block driver */ + /* Finden Sie den richtigen Blocktreiber */ filename =3D qdict_get_try_str(*options, "filename"); =20 if (!drvname && protocol) { @@ -1144,7 +1155,7 @@ static int bdrv_fill_options(QDict **options, const= char *filename, =20 assert(drv || !protocol); =20 - /* Driver-specific filename parsing */ + /* Treiber-spezifischen Dateinamen Parsing */ if (drv && drv->bdrv_parse_filename && parse_filename) { drv->bdrv_parse_filename(filename, *options, &local_err); if (local_err) { @@ -1220,8 +1231,8 @@ void bdrv_unref_child(BlockDriverState *parent, Bdr= vChild *child) } =20 /* - * Sets the backing file link of a BDS. A new reference is created; call= ers - * which don't need their own reference any more must call bdrv_unref(). + * Setzt die Tr=C3=A4gerdatei Link eines BDS. Eine neue Referenz erstell= t; Anrufer + * die ihre eigenen Referenz brauchen nicht mehr m=C3=BCssen nennen bdrv= _unref (). */ void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing= _hd) { @@ -1252,7 +1263,8 @@ void bdrv_set_backing_hd(BlockDriverState *bs, Bloc= kDriverState *backing_hd) backing_hd->drv ? backing_hd->drv->format_name : ""); =20 bdrv_op_block_all(backing_hd, bs->backing_blocker); - /* Otherwise we won't be able to commit due to check in bdrv_commit = */ + /* Sonst werden wir nicht wegen der Lage sein, zu begehen, in bdrv_c= ommit + * zu =C3=BCberpr=C3=BCfen */ bdrv_op_unblock(backing_hd, BLOCK_OP_TYPE_COMMIT_TARGET, bs->backing_blocker); out: @@ -1260,14 +1272,14 @@ out: } =20 /* - * Opens the backing file for a BlockDriverState if not yet open + * =C3=96ffnet die Tr=C3=A4gerdatei f=C3=BCr eine BlockDriverState wenn = noch nicht ge=C3=B6ffnet * - * bdref_key specifies the key for the image's BlockdevRef in the option= s QDict. - * That QDict has to be flattened; therefore, if the BlockdevRef is a QD= ict - * itself, all options starting with "${bdref_key}." are considered part= of the - * BlockdevRef. + * bdref_key gibt den Schl=C3=BCssel f=C3=BCr die BlockdevRef das Bild i= n den Optionen + * QDict. Das QDict hat abgeflacht zu werden; Wenn daher die BlockdevRef= eine + * QDict selbst, beginnend alle Optionen mit "$ {bdref_key}." Teil des g= elten + * als BlockdevRef. * - * TODO Can this be unified with bdrv_open_image()? + * TODO Kann dies mit bdrv_open_image vereinigt werden ()? */ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options, const char *bdref_key, Error **errp) @@ -1285,7 +1297,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QD= ict *parent_options, goto free_exit; } =20 - /* NULL means an empty set of options */ + /* NULL bedeutet eine leere Menge von Optionen */ if (parent_options =3D=3D NULL) { tmp_parent_options =3D qdict_new(); parent_options =3D tmp_parent_options; @@ -1336,8 +1348,8 @@ int bdrv_open_backing_file(BlockDriverState *bs, QD= ict *parent_options, goto free_exit; } =20 - /* Hook up the backing file link; drop our reference, bs owns the - * backing_hd reference now */ + /* Schlie=C3=9Fen Sie die Unterst=C3=BCtzung Dateilink; Drop unsere = Referenz, bs + * besitzt die backing_hd Referenz jetzt */ bdrv_set_backing_hd(bs, backing_hd); bdrv_unref(backing_hd); =20 @@ -1350,18 +1362,19 @@ free_exit: } =20 /* - * Opens a disk image whose options are given as BlockdevRef in another = block - * device's options. + * =C3=96ffnet ein Disk-Image, dessen Optionen gegeben werden als Blockd= evRef in + * einem anderen Block Ger=C3=A4teoptionen. * - * If allow_none is true, no image will be opened if filename is false a= nd no - * BlockdevRef is given. NULL will be returned, but errp remains unset. + * Wenn ALLOW_NONE wahr ist, wird kein Bild ge=C3=B6ffnet, wenn Dateinam= e falsch ist + * und keine BlockdevRef gegeben. NULL wird zur=C3=BCckgegeben, aber Err= p bleibt + * ungesetzt. * - * bdrev_key specifies the key for the image's BlockdevRef in the option= s QDict. - * That QDict has to be flattened; therefore, if the BlockdevRef is a QD= ict - * itself, all options starting with "${bdref_key}." are considered part= of the - * BlockdevRef. + * bdrev_key gibt den Schl=C3=BCssel f=C3=BCr die BlockdevRef das Bild i= n den Optionen + * QDict. Das QDict hat abgeflacht zu werden; Wenn daher die BlockdevRef= eine + * QDict selbst, beginnend alle Optionen mit "$ {bdref_key}." Teil des g= elten + * als BlockdevRef. * - * The BlockdevRef will be removed from the options QDict. + * Die BlockdevRef werden aus der Optionen QDict entfernt werden. */ BdrvChild *bdrv_open_child(const char *filename, QDict *options, const char *bdref_key, @@ -1409,7 +1422,8 @@ done: static int bdrv_append_temp_snapshot(BlockDriverState *bs, int flags, QDict *snapshot_options, Error **er= rp) { - /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. *= / + /* TODO: zus=C3=A4tzliches Byte ist ein Hack MAX_PATH Raum auf Windo= ws zu + * gew=C3=A4hrleisten. */ char *tmp_filename =3D g_malloc0(PATH_MAX + 1); int64_t total_size; QemuOpts *opts =3D NULL; @@ -1417,10 +1431,10 @@ static int bdrv_append_temp_snapshot(BlockDriverS= tate *bs, int flags, Error *local_err =3D NULL; int ret; =20 - /* if snapshot, we create a temporary backing file and open it - instead of opening 'filename' directly */ + /* wenn Snapshot erstellen wir eine tempor=C3=A4re Tr=C3=A4ger-Datei= und =C3=B6ffnen Sie + sie anstelle der =C3=96ffnung "Dateiname" direkt */ =20 - /* Get the required size from the image */ + /* Holen Sie die gew=C3=BCnschte Gr=C3=B6=C3=9Fe aus dem Bild */ total_size =3D bdrv_getlength(bs); if (total_size < 0) { ret =3D total_size; @@ -1428,7 +1442,7 @@ static int bdrv_append_temp_snapshot(BlockDriverSta= te *bs, int flags, goto out; } =20 - /* Create the temporary image */ + /* Erstellen Sie das tempor=C3=A4re Bild */ ret =3D get_tmp_filename(tmp_filename, PATH_MAX + 1); if (ret < 0) { error_setg_errno(errp, -ret, "Could not get temporary filename")= ; @@ -1446,7 +1460,7 @@ static int bdrv_append_temp_snapshot(BlockDriverSta= te *bs, int flags, goto out; } =20 - /* Prepare options QDict for the temporary file */ + /* Bereiten Sie Optionen QDict f=C3=BCr die tempor=C3=A4re Datei */ qdict_put(snapshot_options, "file.driver", qstring_from_str("file")); qdict_put(snapshot_options, "file.filename", @@ -1473,19 +1487,22 @@ out: } =20 /* - * Opens a disk image (raw, qcow2, vmdk, ...) + * =C3=96ffnet ein Disk-Image (roh, qcow2, vmdk, ...) * - * options is a QDict of options to pass to the block drivers, or NULL f= or an - * empty set of options. The reference to the QDict belongs to the block= layer - * after the call (even on failure), so if the caller intends to reuse t= he - * dictionary, it needs to use QINCREF() before calling bdrv_open. + * Optionen ist ein QDict von Optionen an die Blocktreiber zu passieren,= oder + * NULL f=C3=BCr eine leere Menge von Optionen. Der Verweis auf die QDic= t geh=C3=B6rt + * zur Blockschicht nach dem Aufruf (auch bei Ausfall), so dass, wenn de= r + * Anrufer die wiederzuverwenden beabsichtigt W=C3=B6rterbuch, braucht e= s QINCREF() + * zu verwenden, bevor bdrv_open aufrufen. * - * If *pbs is NULL, a new BDS will be created with a pointer to it store= d there. - * If it is not NULL, the referenced BDS will be reused. + * Wenn *pbs NULL ist, wird ein neuer BDS mit einem Zeiger auf sie dort + * gespeichert erstellt werden. Wenn es nicht NULL ist, wird die referen= zierten + * BDS wiederverwendet werden. * - * The reference parameter may be used to specify an existing block devi= ce which - * should be opened. If specified, neither options nor a filename may be= given, - * nor can an existing BDS be reused (that is, *pbs has to be NULL). + * Der Referenzparameter verwendet werden kann, eine bestehende Blockger= =C3=A4t + * angeben, welche sollte ge=C3=B6ffnet werden. Wenn angegeben, kann wed= er Optionen + * noch ein Dateiname angegeben werden, noch kann eine bestehende BDS wi= eder + * verwendet werden (das hei=C3=9Ft, *pbs hat NULL sein). */ static int bdrv_open_inherit(BlockDriverState **pbs, const char *filenam= e, const char *reference, QDict *options, int = flags, @@ -1537,12 +1554,12 @@ static int bdrv_open_inherit(BlockDriverState **p= bs, const char *filename, bs =3D bdrv_new(); } =20 - /* NULL means an empty set of options */ + /* NULL bedeutet eine leere Menge von Optionen */ if (options =3D=3D NULL) { options =3D qdict_new(); } =20 - /* json: syntax counts as explicit options, as if in the QDict */ + /* json: Syntax gilt als explizite Optionen, als ob in der QDict */ parse_json_protocol(options, &filename, &local_err); if (local_err) { ret =3D -EINVAL; @@ -1566,7 +1583,7 @@ static int bdrv_open_inherit(BlockDriverState **pbs= , const char *filename, bs->options =3D options; options =3D qdict_clone_shallow(options); =20 - /* Find the right image format driver */ + /* Finden Sie das richtige Bildformat-Treiber */ drvname =3D qdict_get_try_str(options, "driver"); if (drvname) { drv =3D bdrv_find_format(drvname); @@ -1585,7 +1602,7 @@ static int bdrv_open_inherit(BlockDriverState **pbs= , const char *filename, qdict_del(options, "backing"); } =20 - /* Open image file without format layer */ + /* Bilddatei =C3=B6ffnen, ohne Format Schicht */ if ((flags & BDRV_O_PROTOCOL) =3D=3D 0) { if (flags & BDRV_O_RDWR) { flags |=3D BDRV_O_ALLOW_RDWR; @@ -1607,7 +1624,7 @@ static int bdrv_open_inherit(BlockDriverState **pbs= , const char *filename, } } =20 - /* Image format probing */ + /* Bildformat Sondierung */ bs->probed =3D !drv; if (!drv && file) { ret =3D find_image_format(file->bs, filename, &drv, &local_err); @@ -1615,15 +1632,16 @@ static int bdrv_open_inherit(BlockDriverState **p= bs, const char *filename, goto fail; } /* - * This option update would logically belong in bdrv_fill_option= s(), - * but we first need to open bs->file for the probing to work, w= hile - * opening bs->file already requires the (mostly) final set of o= ptions - * so that cache mode etc. can be inherited. + * Diese Option Update geh=C3=B6ren w=C3=BCrde logisch in bdrv_f= ill_options (), + * aber wir m=C3=BCssen zuerst =C3=B6ffnen BS-> Datei f=C3=BCr d= ie Arbeit Sondieren, + * w=C3=A4hrend =C3=96ffnen BS-> erfordert Datei bereits die (me= ist) letzte Satz + * von Optionen so dass Cache-Modus usw. k=C3=B6nnen vererbt wer= den. * - * Adding the driver later is somewhat ugly, but it's not an opt= ion - * that would ever be inherited, so it's correct. We just need t= o make - * sure to update both bs->options (which has the full effective - * options for bs) and options (which has file.* already removed= ). + * der Fahrer ist dann ein etwas h=C3=A4sslich, aber es ist kein= e Option + * dass immer vererbt werden w=C3=BCrde, so ist es richtig. Wir = m=C3=BCssen nur + * sicherstellen, Sie beide BS- zu aktualisieren> Optionen (was = die + * vollst=C3=A4ndige effektive hat Optionen f=C3=BCr bs) und Opt= ionen (die Datei + * hat. * bereits entfernt). */ qdict_put(bs->options, "driver", qstring_from_str(drv->format_na= me)); qdict_put(options, "driver", qstring_from_str(drv->format_name))= ; @@ -1633,13 +1651,14 @@ static int bdrv_open_inherit(BlockDriverState **p= bs, const char *filename, goto fail; } =20 - /* BDRV_O_PROTOCOL must be set iff a protocol BDS is about to be cre= ated */ + /* BDRV_O_PROTOCOL muss genau dann, wenn ein Protokoll festgelegt we= rden BDS + * ist etwa geschaffen werden */ assert(!!(flags & BDRV_O_PROTOCOL) =3D=3D !!drv->bdrv_file_open); - /* file must be NULL if a protocol BDS is about to be created - * (the inverse results in an error message from bdrv_open_common())= */ + /* Datei muss NULL sein, wenn ein Protokoll BDS =C3=BCber erstellt w= erden soll, + * (Die inverse f=C3=BChrt zu einer Fehlermeldung von bdrv_open_comm= on ()) */ assert(!(flags & BDRV_O_PROTOCOL) || !file); =20 - /* Open the image */ + /* =C3=96ffnen Sie das Bild */ ret =3D bdrv_open_common(bs, file, options, &local_err); if (ret < 0) { goto fail; @@ -1650,7 +1669,7 @@ static int bdrv_open_inherit(BlockDriverState **pbs= , const char *filename, file =3D NULL; } =20 - /* If there is a backing file, use it */ + /* Wenn es eine Tr=C3=A4gerdatei ist, verwenden Sie es */ if ((flags & BDRV_O_NO_BACKING) =3D=3D 0) { ret =3D bdrv_open_backing_file(bs, options, "backing", &local_er= r); if (ret < 0) { @@ -1660,7 +1679,7 @@ static int bdrv_open_inherit(BlockDriverState **pbs= , const char *filename, =20 bdrv_refresh_filename(bs); =20 - /* Check if any unknown options were used */ + /* =C3=9Cberpr=C3=BCfen Sie, ob alle unbekannten Optionen verwendet = wurden */ if (options && (qdict_size(options) !=3D 0)) { const QDictEntry *entry =3D qdict_first(options); if (flags & BDRV_O_PROTOCOL) { @@ -1682,7 +1701,7 @@ static int bdrv_open_inherit(BlockDriverState **pbs= , const char *filename, } } else if (!runstate_check(RUN_STATE_PRELAUNCH) && !runstate_check(RUN_STATE_INMIGRATE) - && !runstate_check(RUN_STATE_PAUSED)) { /* HACK */ + && !runstate_check(RUN_STATE_PAUSED)) { /* HACKEN */ error_setg(errp, "Guest must be stopped for opening of encrypted image= "); ret =3D -EBUSY; @@ -1692,8 +1711,8 @@ static int bdrv_open_inherit(BlockDriverState **pbs= , const char *filename, QDECREF(options); *pbs =3D bs; =20 - /* For snapshot=3Don, create a temporary qcow2 overlay. bs points to= the - * temporary snapshot afterwards. */ + /* F=C3=BCr Snapshot =3D on, eine tempor=C3=A4re qcow2 Overlay erste= llen. bs Punkte + * auf die danach vor=C3=BCbergehende Snapshot. */ if (snapshot_flags) { ret =3D bdrv_append_temp_snapshot(bs, snapshot_flags, snapshot_o= ptions, &local_err); @@ -1715,9 +1734,10 @@ fail: QDECREF(options); bs->options =3D NULL; if (!*pbs) { - /* If *pbs is NULL, a new BDS has been created in this function = and - needs to be freed now. Otherwise, it does not need to be clos= ed, - since it has not really been opened yet. */ + /* Wenn * pbs NULL ist, hat sich eine neue BDS in dieser Funktio= n + erstellt wurde und muss jetzt befreit werden. Andernfalls mus= s er + nicht geschlossen werden kann, da hat es noch nicht wirklich + ge=C3=B6ffnet. */ bdrv_unref(bs); } if (local_err) { @@ -1726,7 +1746,7 @@ fail: return ret; =20 close_and_fail: - /* See fail path, but now the BDS has to be always closed */ + /* Siehe Pfad scheitern, aber jetzt hat der BDS immer geschlossen se= in */ if (*pbs) { bdrv_close(bs); } else { @@ -1754,24 +1774,24 @@ typedef struct BlockReopenQueueEntry { } BlockReopenQueueEntry; =20 /* - * Adds a BlockDriverState to a simple queue for an atomic, transactiona= l - * reopen of multiple devices. + * F=C3=BCgt eine BlockDriverState auf eine einfache Warteschlange f=C3=BC= r ein Atom, + * Transaktions- wieder =C3=B6ffnen mehrerer Ger=C3=A4te. * - * bs_queue can either be an existing BlockReopenQueue that has had QSIM= PLE_INIT - * already performed, or alternatively may be NULL a new BlockReopenQueu= e will - * be created and initialized. This newly created BlockReopenQueue shoul= d be - * passed back in for subsequent calls that are intended to be of the sa= me - * atomic 'set'. + * bs_queue kann entweder eine bestehende BlockReopenQueue sein, die + * QSIMPLE_INIT hatte bereits durchgef=C3=BChrt, oder alternativ wird ei= ne neue + * BlockReopenQueue NULL sein erzeugt und initialisiert werden. Diese ne= u + * geschaffene BlockReopenQueue sollte in f=C3=BCr nachfolgende Anrufe + * zur=C3=BCckgef=C3=BChrt, die aus dem gleichen sein sollen Atom-Set '. * - * bs is the BlockDriverState to add to the reopen queue. + * bs ist die BlockDriverState zur Wiederer=C3=B6ffnung Warteschlange hi= nzuzuf=C3=BCgen. * - * options contains the changed options for the associated bs - * (the BlockReopenQueue takes ownership) + * Optionen enth=C3=A4lt die ge=C3=A4nderten Optionen f=C3=BCr den zugeh= =C3=B6rigen bs + * (Die BlockReopenQueue nimmt den Besitz) * - * flags contains the open flags for the associated bs + * Fahnen enth=C3=A4lt die offenen Fahnen f=C3=BCr den zugeh=C3=B6rigen = bs * - * returns a pointer to bs_queue, which is either the newly allocated - * bs_queue, or the existing bs_queue being used. + * Gibt einen Zeiger auf bs_queue, die entweder die neu zugewiesenen + * bs_queue oder der bestehende bs_queue verwendet wird. * */ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_qu= eue, @@ -1798,52 +1818,53 @@ static BlockReopenQueue *bdrv_reopen_queue_child(= BlockReopenQueue *bs_queue, } =20 /* - * Precedence of options: - * 1. Explicitly passed in options (highest) - * 2. Set in flags (only for top level) - * 3. Retained from explicitly set options of bs - * 4. Inherited from parent node - * 5. Retained from effective options of bs + * Rangfolge der Optionen: + * 1. Explizit in den Optionen =C3=BCbergeben (h=C3=B6chste) + * 2. Stellen Sie in den Flaggen (nur f=C3=BCr Top-Level) + * 3. von explizit Optionen von bs R=C3=BCck + * 4. von =C3=BCbergeordneten Knoten geerbt + * 5. von effektiven M=C3=B6glichkeiten der bs R=C3=BCck */ =20 if (!parent_options) { /* - * Any setting represented by flags is always updated. If the - * corresponding QDict option is set, it takes precedence. Other= wise - * the flag is translated into a QDict option. The old setting o= f bs is - * not considered. + * Jede Einstellung, die durch Flags wird immer aktualisiert. we= nn der + * entsprechende QDict Option gesetzt ist, es hat Vorrang. Ander= nfalls + * das Flag in eine QDict Option =C3=BCbersetzt. Die alte Einste= llung von bs + * nicht bedacht. */ update_options_from_flags(options, flags); } =20 - /* Old explicitly set values (don't overwrite by inherited value) */ + /* Alte explizit Werte (nicht =C3=BCberschreiben von geerbten Wert) = */ old_options =3D qdict_clone_shallow(bs->explicit_options); bdrv_join_options(bs, options, old_options); QDECREF(old_options); =20 explicit_options =3D qdict_clone_shallow(options); =20 - /* Inherit from parent node */ + /* Vererben von Elternknoten */ if (parent_options) { assert(!flags); role->inherit_options(&flags, options, parent_flags, parent_opti= ons); } =20 - /* Old values are used for options that aren't set yet */ + /* Alte Werte werden f=C3=BCr Optionen eingesetzt, die noch nicht fe= stgelegt */ old_options =3D qdict_clone_shallow(bs->options); bdrv_join_options(bs, options, old_options); QDECREF(old_options); =20 - /* bdrv_open() masks this flag out */ + /* bdrv_open () Masken dieses Flag aus */ flags &=3D ~BDRV_O_PROTOCOL; =20 QLIST_FOREACH(child, &bs->children, next) { QDict *new_child_options; char *child_key_dot; =20 - /* reopen can only change the options of block devices that were - * implicitly created and inherited options. For other (referenc= ed) - * block devices, a syntax like "backing.foo" results in an erro= r. */ + /* wieder =C3=B6ffnen k=C3=B6nnen nur die Optionen von Blockger=C3= =A4te zu =C3=A4ndern, + * waren implizit Optionen erstellt und vererbt wird. F=C3=BCr a= ndere + * (referenziert) Block-Ger=C3=A4te, eine Syntax wie "backing.fo= o" f=C3=BChrt zu + * einem Fehler. */ if (child->bs->inherits_from !=3D bs) { continue; } @@ -1876,18 +1897,18 @@ BlockReopenQueue *bdrv_reopen_queue(BlockReopenQu= eue *bs_queue, } =20 /* - * Reopen multiple BlockDriverStates atomically & transactionally. + * =C3=96ffnen Sie erneut mehrere BlockDriverStates atomar & transaktion= ell. * - * The queue passed in (bs_queue) must have been built up previous - * via bdrv_reopen_queue(). + * Die Warteschlange in (bs_queue) =C3=BCbergeben m=C3=BCssen vorherigen= gebaut wurden + * bis via bdrv_reopen_queue (). * - * Reopens all BDS specified in the queue, with the appropriate - * flags. All devices are prepared for reopen, and failure of any - * device will cause all device changes to be abandonded, and intermedia= te - * data cleaned up. + * =C3=96ffnet wieder alle BDS in der Warteschlange angegeben, mit dem + * entsprechenden Fahnen. Alle Ger=C3=A4te sind f=C3=BCr den wieder =C3=B6= ffnen vorbereitet + * und Ausfall einer Ger=C3=A4t alle Ger=C3=A4te=C3=A4nderungen bewirken= abandonded werden, + * und Zwischen Daten bereinigt. * - * If all devices prepare successfully, then the changes are committed - * to all devices. + * Wenn alle Ger=C3=A4te erfolgreich vorbereiten, dann sind die =C3=84nd= erungen + * festgeschrieben an alle Ger=C3=A4te. * */ int bdrv_reopen_multiple(BlockReopenQueue *bs_queue, Error **errp) @@ -1908,8 +1929,8 @@ int bdrv_reopen_multiple(BlockReopenQueue *bs_queue= , Error **errp) bs_entry->prepared =3D true; } =20 - /* If we reach this point, we have success and just need to apply th= e - * changes + /* Wenn wir diesen Punkt erreichen, haben wir Erfolg und m=C3=BCssen= nur die + * anzuwenden =C3=84nderungen */ QSIMPLEQ_FOREACH(bs_entry, bs_queue, entry) { bdrv_reopen_commit(&bs_entry->state); @@ -1932,7 +1953,8 @@ cleanup: } =20 =20 -/* Reopen a single BlockDriverState with the specified flags. */ +/* =C3=96ffnen Sie erneut eine einzige BlockDriverState mit den angegebe= nen Flags. + */ int bdrv_reopen(BlockDriverState *bs, int bdrv_flags, Error **errp) { int ret =3D -1; @@ -1948,20 +1970,21 @@ int bdrv_reopen(BlockDriverState *bs, int bdrv_fl= ags, Error **errp) =20 =20 /* - * Prepares a BlockDriverState for reopen. All changes are staged in the - * 'opaque' field of the BDRVReopenState, which is used and allocated by - * the block driver layer .bdrv_reopen_prepare() + * Bereitet ein BlockDriverState f=C3=BCr wieder =C3=B6ffnen. Alle =C3=84= nderungen werden in + * der Szene gesetzt "Opaque" Feld der BDRVReopenState, die verwendet wi= rd, und + * zugeteilt durch die Blocktreiberschicht .bdrv_reopen_prepare () * - * bs is the BlockDriverState to reopen - * flags are the new open flags - * queue is the reopen queue + * bs ist die BlockDriverState wieder zu =C3=B6ffnen + * Flaggen sind die neuen offenen Fahnen + * Warteschlange ist die Warteschlange wieder =C3=B6ffnen * - * Returns 0 on success, non-zero on error. On error errp will be set - * as well. + * Gibt 0 bei Erfolg, von Null auf Fehler. Bei einem Fehler Errp wird ge= setzt + * auch. * - * On failure, bdrv_reopen_abort() will be called to clean up any data. - * It is the responsibility of the caller to then call the abort() or - * commit() for any other BDS that have been left in a prepare() state + * Bei einem Fehler bdrv_reopen_abort () werden alle Daten zu bereinigen= , + * aufgerufen werden. Es liegt in der Verantwortung des Anrufers, um dan= n den + * Abbruch () aufrufen oder commit () f=C3=BCr alle anderen BDS, die in = einem + * prepare () Zustand zur=C3=BCckgelassen wurden * */ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue = *queue, @@ -1977,7 +2000,7 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_sta= te, BlockReopenQueue *queue, assert(reopen_state->bs->drv !=3D NULL); drv =3D reopen_state->bs->drv; =20 - /* Process generic block layer options */ + /* Prozess generische Block-Layer-Optionen */ opts =3D qemu_opts_create(&bdrv_runtime_opts, NULL, 0, &error_abort)= ; qemu_opts_absorb_qdict(opts, reopen_state->options, &local_err); if (local_err) { @@ -1988,8 +2011,8 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_sta= te, BlockReopenQueue *queue, =20 update_flags_from_options(&reopen_state->flags, opts); =20 - /* node-name and driver must be unchanged. Put them back into the QD= ict, so - * that they are checked at the end of this function. */ + /* Knotenname und Fahrer muss nicht ge=C3=A4ndert. Setzen Sie sie wi= eder in die + * QDict, so dass sie am Ende dieser Funktion =C3=BCberpr=C3=BCft. *= / value =3D qemu_opt_get(opts, "node-name"); if (value) { qdict_put(reopen_state->options, "node-name", qstring_from_str(v= alue)); @@ -2000,8 +2023,8 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_sta= te, BlockReopenQueue *queue, qdict_put(reopen_state->options, "driver", qstring_from_str(valu= e)); } =20 - /* if we are to stay read-only, do not allow permission change - * to r/w */ + /* wenn wir schreibgesch=C3=BCtzt bleiben, erlauben keine Berechtigu= ngs=C3=A4nderung + * zu r / w */ if (!(reopen_state->bs->open_flags & BDRV_O_ALLOW_RDWR) && reopen_state->flags & BDRV_O_RDWR) { error_setg(errp, "Node '%s' is read only", @@ -2028,8 +2051,8 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_sta= te, BlockReopenQueue *queue, goto error; } } else { - /* It is currently mandatory to have a bdrv_reopen_prepare() - * handler for each supported drv. */ + /* Es ist derzeit zwingend eine bdrv_reopen_prepare zu haben () + * Handler f=C3=BCr jede unterst=C3=BCtzte drv. */ error_setg(errp, "Block format '%s' used by node '%s' " "does not support reopening files", drv->format_name, bdrv_get_device_or_node_name(reopen_state->bs)); @@ -2037,9 +2060,10 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_st= ate, BlockReopenQueue *queue, goto error; } =20 - /* Options that are not handled are only okay if they are unchanged - * compared to the old state. It is expected that some options are o= nly - * used for the initial open, but not reopen (e.g. filename) */ + /* Optionen, die nicht behandelt werden, sind nur in Ordnung, wenn s= ie + * unver=C3=A4ndert sind im Vergleich zu den alten Zustand. Es wird = erwartet, + * dass einige Optionen nur sind f=C3=BCr die erste offen verwendet,= aber wieder + * =C3=B6ffnen nicht (zum Beispiel Dateiname) */ if (qdict_size(reopen_state->options)) { const QDictEntry *entry =3D qdict_first(reopen_state->options); =20 @@ -2065,9 +2089,9 @@ error: } =20 /* - * Takes the staged changes for the reopen from bdrv_reopen_prepare(), a= nd - * makes them final by swapping the staging BlockDriverState contents in= to - * the active BlockDriverState contents. + * Entnimmt die inszenierten =C3=84nderungen f=C3=BCr die Wiederaufnahme= von + * bdrv_reopen_prepare () und sie endg=C3=BCltig macht, indem sie die In= szenierung + * BlockDriverState Inhalte tauschen in die aktiven BlockDriverState Inh= alte. */ void bdrv_reopen_commit(BDRVReopenState *reopen_state) { @@ -2077,12 +2101,12 @@ void bdrv_reopen_commit(BDRVReopenState *reopen_s= tate) drv =3D reopen_state->bs->drv; assert(drv !=3D NULL); =20 - /* If there are any driver level actions to take */ + /* Wenn es irgendwelche Treiber-Ebene Ma=C3=9Fnahmen zu ergreifen, *= / if (drv->bdrv_reopen_commit) { drv->bdrv_reopen_commit(reopen_state); } =20 - /* set BDS specific flags now */ + /* set BDS jetzt spezifische Flags */ QDECREF(reopen_state->bs->explicit_options); =20 reopen_state->bs->explicit_options =3D reopen_state->explicit_opti= ons; @@ -2093,8 +2117,8 @@ void bdrv_reopen_commit(BDRVReopenState *reopen_sta= te) } =20 /* - * Abort the reopen, and delete and free the staged changes in - * reopen_state + * Abbruch der erneut =C3=B6ffnen und l=C3=B6schen und kostenlos die ins= zenierten + * =C3=84nderungen in reopen_state */ void bdrv_reopen_abort(BDRVReopenState *reopen_state) { @@ -2118,14 +2142,15 @@ static void bdrv_close(BlockDriverState *bs) =20 assert(!bs->job); =20 - /* Disable I/O limits and drain all pending throttled requests */ + /* Deaktivieren Sie E / A-Grenzen und Drain alle anstehenden gedross= elt + * Anfragen */ if (bs->throttle_state) { bdrv_io_limits_disable(bs); } =20 - bdrv_drained_begin(bs); /* complete I/O */ + bdrv_drained_begin(bs); /* Erg=C3=A4nzen I / O */ bdrv_flush(bs); - bdrv_drain(bs); /* in case flush left pending I/O */ + bdrv_drain(bs); /* im Falle b=C3=BCndig links I anh=C3=A4ngig / O */ =20 bdrv_release_named_dirty_bitmaps(bs); assert(QLIST_EMPTY(&bs->dirty_bitmaps)); @@ -2148,8 +2173,8 @@ static void bdrv_close(BlockDriverState *bs) } =20 QLIST_FOREACH_SAFE(child, &bs->children, next, next) { - /* TODO Remove bdrv_unref() from drivers' close function and= use - * bdrv_unref_child() here */ + /* TODO entfernen bdrv_unref () von Fahrer Schlie=C3=9Fen-Fu= nktion und + * Verwendung bdrv_unref_child () hier */ if (child->bs->inherits_from =3D=3D bs) { child->bs->inherits_from =3D NULL; } @@ -2185,14 +2210,14 @@ void bdrv_close_all(void) BlockDriverState *bs; AioContext *aio_context; =20 - /* Drop references from requests still in flight, such as canceled b= lock - * jobs whose AIO context has not been polled yet */ + /* Drop-Referenzen von Anfragen noch im Flug, wie annulliert Block + * Jobs, deren AIO Zusammenhang wurde noch nicht abgefragt */ bdrv_drain_all(); =20 blk_remove_all_bs(); blockdev_close_all_bdrv_states(); =20 - /* Cancel all block jobs */ + /* Brechen Sie alle Block Jobs */ while (!QTAILQ_EMPTY(&all_bdrv_states)) { QTAILQ_FOREACH(bs, &all_bdrv_states, bs_list) { aio_context =3D bdrv_get_aio_context(bs); @@ -2206,18 +2231,19 @@ void bdrv_close_all(void) aio_context_release(aio_context); } =20 - /* All the remaining BlockDriverStates are referenced directly o= r - * indirectly from block jobs, so there needs to be at least one= BDS - * directly used by a block job */ + /* Alle =C3=BCbrigen BlockDriverStates referenziert direkt oder + * indirekt von Block Jobs, so muss mindestens ein BDS sein + * direkt durch einen Block Job verwendet */ assert(bs); } } =20 -/* Fields that need to stay with the top-level BDS */ +/* Felder, die mit der Top-Level zu bleiben, m=C3=BCssen BDS */ static void bdrv_move_feature_fields(BlockDriverState *bs_dest, BlockDriverState *bs_src) { - /* move some fields that need to stay attached to the device */ + /* bewegen einige Felder, die mit dem Ger=C3=A4t zu bleiben angebrac= ht brauchen + */ } =20 static void change_parent_backing_link(BlockDriverState *from, @@ -2226,9 +2252,9 @@ static void change_parent_backing_link(BlockDriverS= tate *from, BdrvChild *c, *next; =20 if (from->blk) { - /* FIXME We bypass blk_set_bs(), so we need to make these update= s - * manually. The root problem is not in this change function, bu= t the - * existence of BlockDriverState.blk. */ + /* FIXME umgehen Wir blk_set_bs (), so m=C3=BCssen wir diese Upd= ates machen + * manuell. Das eigentliche Problem ist nicht in dieser + * =C3=84nderungsfunktion, aber die Existenz von BlockDriverStat= e.blk. */ to->blk =3D from->blk; from->blk =3D NULL; } @@ -2261,20 +2287,20 @@ static void swap_feature_fields(BlockDriverState = *bs_top, } =20 /* - * Add new bs contents at the top of an image chain while the chain is - * live, while keeping required fields on the top layer. + * Neuen bs Inhalt an der Spitze einer Bildkette, w=C3=A4hrend die Kette + * leben, w=C3=A4hrend Pflichtfelder halten auf der obersten Ebene. * - * This will modify the BlockDriverState fields, and swap contents - * between bs_new and bs_top. Both bs_new and bs_top are modified. + * Dadurch werden die BlockDriverState Felder, und Swap-Inhalte =C3=A4nd= ern + * zwischen bs_new und bs_top. Sowohl bs_new und bs_top modifiziert. * - * bs_new must not be attached to a BlockBackend. + * bs_new darf nicht zu einer BlockBackend befestigt werden. * - * This function does not create any image files. + * Diese Funktion erzeugt keine Bilddateien. * - * bdrv_append() takes ownership of a bs_new reference and unrefs it bec= ause - * that's what the callers commonly need. bs_new will be referenced by t= he old - * parents of bs_top after bdrv_append() returns. If the caller needs to= keep a - * reference of its own, it must call bdrv_ref(). + * bdrv_append () =C3=BCbernimmt den Besitz eines bs_new Referenz- und u= nrefs es, + * weil das ist, was die Anrufer h=C3=A4ufig ben=C3=B6tigen. bs_new wird= durch die alte + * referenziert werden Eltern von bs_top nach bdrv_append () zur=C3=BCck= kehrt. Wenn + * muss der Anrufer ein zu halten Bezug der eigenen, muss sie rufen bdrv= _ref (). */ void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top) { @@ -2284,14 +2310,14 @@ void bdrv_append(BlockDriverState *bs_new, BlockD= riverState *bs_top) bdrv_ref(bs_top); change_parent_backing_link(bs_top, bs_new); =20 - /* Some fields always stay on top of the backing file chain */ + /* Einige Felder bleiben immer an der Spitze der Tr=C3=A4gerdatei Ke= tte */ swap_feature_fields(bs_top, bs_new); =20 bdrv_set_backing_hd(bs_new, bs_top); bdrv_unref(bs_top); =20 - /* bs_new is now referenced by its new parents, we don't need the - * additional reference any more. */ + /* bs_new wird nun von seinen neuen Eltern verwiesen, wir brauchen d= as nicht + * zus=C3=A4tzliche Referenz mehr. */ bdrv_unref(bs_new); } =20 @@ -2303,20 +2329,23 @@ void bdrv_replace_in_backing_chain(BlockDriverSta= te *old, BlockDriverState *new) bdrv_ref(old); =20 if (old->blk) { - /* As long as these fields aren't in BlockBackend, but in the to= p-level - * BlockDriverState, it's not possible for a BDS to have two BBs= . + /* Solange diese Felder nicht in BlockBackend sind, aber in der = obersten + * Ebene BlockDriverState, ist es nicht m=C3=B6glich, dass ein B= DS zwei BBs + * zu haben. * - * We really want to copy the fields from old to new, but we go = for a - * swap instead so that pointers aren't duplicated and cause tro= uble. - * (Also, bdrv_swap() used to do the same.) */ + * Wir wollen wirklich die Felder von alten auf neue zu kopieren= , aber + * wir gehen f=C3=BCr ein tauschen stattdessen so, dass Zeiger n= icht + * dupliziert werden und Probleme verursachen. + * (Auch bdrv_swap () verwendet, um das gleiche zu tun.) */ assert(!new->blk); swap_feature_fields(old, new); } change_parent_backing_link(old, new); =20 - /* Change backing files if a previously independent node is added to= the - * chain. For active commit, we replace top by its own (indirect) ba= cking - * file and don't do anything here so we don't build a loop. */ + /* =C3=84ndern Sie die Sicherung von Dateien, wenn ein zuvor unabh=C3= =A4ngiger + * Knoten auf die hinzugef=C3=BCgt wird Kette. F=C3=BCr aktive verpf= lichten, + * ersetzen wir oben durch seine eigene (indirekt) Unterst=C3=BCtzun= g Datei und + * tun nichts hier, so dass wir eine Schleife nicht bauen. */ if (new->backing =3D=3D NULL && !bdrv_chain_contains(backing_bs(old)= , new)) { bdrv_set_backing_hd(new, backing_bs(old)); bdrv_set_backing_hd(old, NULL); @@ -2333,7 +2362,7 @@ static void bdrv_delete(BlockDriverState *bs) =20 bdrv_close(bs); =20 - /* remove from list, if necessary */ + /* Von der Liste entfernen, falls erforderlich */ if (bs->node_name[0] !=3D '\0') { QTAILQ_REMOVE(&graph_bdrv_states, bs, node_list); } @@ -2343,11 +2372,11 @@ static void bdrv_delete(BlockDriverState *bs) } =20 /* - * Run consistency checks on an image + * F=C3=BChren Sie Konsistenzpr=C3=BCfungen auf ein Bild, * - * Returns 0 if the check could be completed (it doesn't mean that the i= mage is - * free of errors) or -errno when an internal error occurred. The result= s of the - * check are stored in res. + * Gibt 0 zur=C3=BCck, wenn die Pr=C3=BCfung abgeschlossen werden konnte= (es bedeutet + * nicht, dass das Bild fehlerfrei) oder -errno, wenn ein interner Fehle= r + * aufgetreten ist. Die Ergebnisse der Pr=C3=BCfung werden in res gespei= chert. */ int bdrv_check(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode= fix) { @@ -2364,7 +2393,7 @@ int bdrv_check(BlockDriverState *bs, BdrvCheckResul= t *res, BdrvCheckMode fix) =20 #define COMMIT_BUF_SECTORS 2048 =20 -/* commit COW file into the raw image */ +/* KUH-Datei in das RAW-Bild begehen */ int bdrv_commit(BlockDriverState *bs) { BlockDriver *drv =3D bs->drv; @@ -2406,9 +2435,9 @@ int bdrv_commit(BlockDriverState *bs) goto ro_cleanup; } =20 - /* If our top snapshot is larger than the backing file image, - * grow the backing file image if possible. If not possible, - * we must return an error */ + /* Wenn unsere Top-Snapshot ist gr=C3=B6=C3=9Fer als die Tr=C3=A4ger= datei Bild, + * die Tr=C3=A4gerdatei Bild, wenn m=C3=B6glich, zu wachsen. Falls d= ies nicht + * m=C3=B6glich, wir m=C3=BCssen einen Fehler zur=C3=BCck */ if (length > backing_length) { ret =3D bdrv_truncate(bs->backing->bs, length); if (ret < 0) { @@ -2418,8 +2447,9 @@ int bdrv_commit(BlockDriverState *bs) =20 total_sectors =3D length >> BDRV_SECTOR_BITS; =20 - /* qemu_try_blockalign() for bs will choose an alignment that works = for - * bs->backing->bs as well, so no need to compare the alignment manu= ally. */ + /* qemu try_blockalign () f=C3=BCr bs wird eine Ausrichtung w=C3=A4h= len, die f=C3=BCr + * Arbeiten BS-> Unterst=C3=BCtzung-> bs als auch, so dass keine + * Notwendigkeit, die Ausrichtung manuell zu vergleichen. */ buf =3D qemu_try_blockalign(bs, COMMIT_BUF_SECTORS * BDRV_SECTOR_SIZ= E); if (buf =3D=3D NULL) { ret =3D -ENOMEM; @@ -2453,8 +2483,8 @@ int bdrv_commit(BlockDriverState *bs) } =20 /* - * Make sure all data we wrote to the backing device is actually - * stable on disk. + * Stellen Sie sicher, dass alle Daten, die wir an der Tr=C3=A4gerei= nrichtung + * schrieb tats=C3=A4chlich ist stabil auf dem Datentr=C3=A4ger. */ if (bs->backing) { bdrv_flush(bs->backing->bs); @@ -2465,7 +2495,7 @@ ro_cleanup: qemu_vfree(buf); =20 if (ro) { - /* ignoring error return here */ + /* ignorieren Fehler R=C3=BCckkehr hier */ bdrv_reopen(bs->backing->bs, open_flags & ~BDRV_O_RDWR, NULL); } =20 @@ -2473,12 +2503,12 @@ ro_cleanup: } =20 /* - * Return values: - * 0 - success - * -EINVAL - backing format specified, but no file - * -ENOSPC - can't update the backing file because no space is left in = the - * image file header - * -ENOTSUP - format driver doesn't support changing the backing file + * R=C3=BCckgabewerte: + * 0 - Erfolg + * -EINVAL - Tr=C3=A4gerformat angegeben, aber keine Datei + * -ENOSPC - Kann nicht die Unterst=C3=BCtzung Datei aktualisiert werden= , da kein + * Platz mehr in der linken Seite Bild-Datei-Header + * -ENOTSUP - Format-Treiber unterst=C3=BCtzt nicht die Unterst=C3=BCtzu= ng Datei =C3=A4ndern */ int bdrv_change_backing_file(BlockDriverState *bs, const char *backing_file, const char *backing_fmt) @@ -2486,7 +2516,7 @@ int bdrv_change_backing_file(BlockDriverState *bs, BlockDriver *drv =3D bs->drv; int ret; =20 - /* Backing file format doesn't make sense without a backing file */ + /* Dateiformat Sichern macht keinen Sinn, ohne Tr=C3=A4gerdatei */ if (backing_fmt && !backing_file) { return -EINVAL; } @@ -2505,14 +2535,14 @@ int bdrv_change_backing_file(BlockDriverState *bs= , } =20 /* - * Finds the image layer in the chain that has 'bs' as its backing file. + * Findet die Bildebene in der Kette, die 'bs' als Tr=C3=A4gerdatei. * - * active is the current topmost image. + * aktiv ist die aktuelle oberste Bild. * - * Returns NULL if bs is not found in active's image chain, - * or if active =3D=3D bs. + * Gibt NULL zur=C3=BCck, wenn bs nicht im aktiven Image Kette gefunden, + * oder wenn aktiv =3D=3D bs. * - * Returns the bottommost base image if bs =3D=3D NULL. + * Gibt die unterste Basis-Image, wenn bs =3D=3D NULL. */ BlockDriverState *bdrv_find_overlay(BlockDriverState *active, BlockDriverState *bs) @@ -2524,39 +2554,39 @@ BlockDriverState *bdrv_find_overlay(BlockDriverSt= ate *active, return active; } =20 -/* Given a BDS, searches for the base layer. */ +/* Bei einer BDS, sucht f=C3=BCr die Basisschicht. */ BlockDriverState *bdrv_find_base(BlockDriverState *bs) { return bdrv_find_overlay(bs, NULL); } =20 /* - * Drops images above 'base' up to and including 'top', and sets the ima= ge - * above 'top' to have base as its backing file. + * Drops Bilder oben "Basis" bis einschlie=C3=9Flich "oben" und setzt da= s Bild + * oben "oben" Basis als Tr=C3=A4gerdatei. * - * Requires that the overlay to 'top' is opened r/w, so that the backing= file - * information in 'bs' can be properly updated. + * Erfordert, dass die =C3=9Cberlagerung "oben" r / w ge=C3=B6ffnet wird= , so dass die + * Tr=C3=A4gerdatei Informationen in 'bs' k=C3=B6nnen korrekt aktualisie= rt werden. * - * E.g., this will convert the following chain: - * bottom <- base <- intermediate <- top <- active + * Z. B. wird dies die folgende Kette umwandeln: + * unten <- base <- Zwischen <- nachp <- aktiv * - * to + * nach * - * bottom <- base <- active + * unten <- base <- aktiv * - * It is allowed for bottom=3D=3Dbase, in which case it converts: + * Es ist f=C3=BCr den Boden =3D=3D Basis erlaubt, wobei in diesem Fall = wandelt: * - * base <- intermediate <- top <- active + * Basis <- Zwischen <- top <- aktiv * * to * - * base <- active + * Basis <- aktiv * - * If backing_file_str is non-NULL, it will be used when modifying top's - * overlay image metadata. + * Wenn backing_file_str nicht NULL ist, wird es verwendet werden, wenn = oben + * die Modifizierung Overlay-Bild-Metadaten. * - * Error conditions: - * if active =3D=3D top, that is considered an error + * Fehlerbedingungen: + * wenn aktiv =3D=3D oben, ist, dass ein Fehler betrachtet * */ int bdrv_drop_intermediate(BlockDriverState *active, BlockDriverState *t= op, @@ -2572,23 +2602,25 @@ int bdrv_drop_intermediate(BlockDriverState *acti= ve, BlockDriverState *top, new_top_bs =3D bdrv_find_overlay(active, top); =20 if (new_top_bs =3D=3D NULL) { - /* we could not find the image above 'top', this is an error */ + /* wir konnten nicht das Bild oben "oben" zu finden, das ist ein= Fehler + */ goto exit; } =20 - /* special case of new_top_bs->backing->bs already pointing to base = - nothing - * to do, no intermediate images */ + /* Sonderfall new_top_bs-> Unterst=C3=BCtzung-> bs bereits auf Basis= zeigt - + * nichts keine Zwischenbilder zu tun, */ if (backing_bs(new_top_bs) =3D=3D base) { ret =3D 0; goto exit; } =20 - /* Make sure that base is in the backing chain of top */ + /* Stellen Sie sicher, dass Basis ist in der Tr=C3=A4gerkette von ob= en */ if (!bdrv_chain_contains(top, base)) { goto exit; } =20 - /* success - we can delete the intermediate states, and link top->ba= se */ + /* Erfolg - k=C3=B6nnen wir die Zwischenzust=C3=A4nde und verkn=C3=BC= pfen + * Oberseite-> Basis l=C3=B6schen */ backing_file_str =3D backing_file_str ? backing_file_str : base->fil= ename; ret =3D bdrv_change_backing_file(new_top_bs, backing_file_str, base->drv ? base->drv->format_name : = ""); @@ -2603,7 +2635,7 @@ exit: } =20 /** - * Truncate file to 'offset' bytes (needed only for file protocols) + * K=C3=BCrzt-Datei 'Offset' Bytes (nur erforderlich f=C3=BCr Dateiproto= kolle) */ int bdrv_truncate(BlockDriverState *bs, int64_t offset) { @@ -2628,8 +2660,9 @@ int bdrv_truncate(BlockDriverState *bs, int64_t off= set) } =20 /** - * Length of a allocated file in bytes. Sparse files are counted by actu= al - * allocated space. Return < 0 if error or unknown. + * L=C3=A4nge einer zugeordneten Datei in Bytes. Sparse-Dateien werden v= on + * tats=C3=A4chlichen gez=C3=A4hlt zugewiesenen Platz. Zur=C3=BCck <0, w= enn Fehler oder + * unbekannt ist. */ int64_t bdrv_get_allocated_file_size(BlockDriverState *bs) { @@ -2647,7 +2680,7 @@ int64_t bdrv_get_allocated_file_size(BlockDriverSta= te *bs) } =20 /** - * Return number of sectors on success, -errno on error. + * Zur=C3=BCck Anzahl der Sektoren auf Erfolg, -errno auf Fehler. */ int64_t bdrv_nb_sectors(BlockDriverState *bs) { @@ -2666,8 +2699,8 @@ int64_t bdrv_nb_sectors(BlockDriverState *bs) } =20 /** - * Return length in bytes on success, -errno on error. - * The length is always a multiple of BDRV_SECTOR_SIZE. + * Zur=C3=BCck L=C3=A4nge in Bytes auf Erfolg, -errno auf Fehler. + * Die L=C3=A4nge ist immer ein Vielfaches von BDRV_SECTOR_SIZE. */ int64_t bdrv_getlength(BlockDriverState *bs) { @@ -2677,7 +2710,8 @@ int64_t bdrv_getlength(BlockDriverState *bs) return ret < 0 ? ret : ret * BDRV_SECTOR_SIZE; } =20 -/* return 0 as number of sectors if no device present or error */ +/* return 0 als Anzahl von Sektoren, falls kein Ger=C3=A4t vorhanden ist= oder Fehler + */ void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr) { int64_t nb_sectors =3D bdrv_nb_sectors(bs); @@ -2734,7 +2768,7 @@ int bdrv_set_key(BlockDriverState *bs, const char *= key) } else if (!bs->valid_key) { bs->valid_key =3D 1; if (bs->blk) { - /* call the change callback now, we skipped it on open */ + /* rufen nun die =C3=84nderung R=C3=BCckruf, wir lie=C3=9Fen= es auf offenen */ blk_dev_change_media_cb(bs->blk, true); } } @@ -2742,15 +2776,17 @@ int bdrv_set_key(BlockDriverState *bs, const char= *key) } =20 /* - * Provide an encryption key for @bs. - * If @key is non-null: - * If @bs is not encrypted, fail. - * Else if the key is invalid, fail. - * Else set @bs's key to @key, replacing the existing key, if any. - * If @key is null: - * If @bs is encrypted and still lacks a key, fail. - * Else do nothing. - * On failure, store an error object through @errp if non-null. + * Geben Sie einen Verschl=C3=BCsselungsschl=C3=BCssel f=C3=BCr @bs. + * Wenn @key nicht null ist: + * Wenn @bs nicht verschl=C3=BCsselt ist, fehlschlagen. + * Else, wenn der Schl=C3=BCssel ung=C3=BCltig ist, fehlschlagen. + * Else Set @ bs Schl=C3=BCssel zum @key, den vorhandenen Schl=C3=BC= ssel zu + * ersetzen, falls vorhanden. + * Wenn @key ist null: + * Wenn @bs verschl=C3=BCsselt ist und es fehlt immer noch einen Sch= l=C3=BCssel, + * scheitern. + * Else nichts zu tun. + * Bei einem Fehler speichern ein Fehlerobjekt durch @errp wenn nicht nu= ll ist. */ void bdrv_add_key(BlockDriverState *bs, const char *key, Error **errp) { @@ -2813,7 +2849,7 @@ void bdrv_iterate_format(void (*it)(void *opaque, c= onst char *name), g_free(formats); } =20 -/* This function is to find a node in the bs graph */ +/* Diese Funktion ist ein Knoten in dem Graphen zu finden bs */ BlockDriverState *bdrv_find_node(const char *node_name) { BlockDriverState *bs; @@ -2828,7 +2864,8 @@ BlockDriverState *bdrv_find_node(const char *node_n= ame) return NULL; } =20 -/* Put this QMP function here so it can access the static graph_bdrv_sta= tes. */ +/* Setzen Sie diese Funktion QMP hier so es die statischen graph_bdrv_st= ates + * zugreifen k=C3=B6nnen. */ BlockDeviceInfoList *bdrv_named_nodes_list(Error **errp) { BlockDeviceInfoList *list, *entry; @@ -2884,8 +2921,8 @@ BlockDriverState *bdrv_lookup_bs(const char *device= , return NULL; } =20 -/* If 'base' is in the same chain as 'top', return true. Otherwise, - * return false. If either argument is NULL, return false. */ +/* Wenn "Basis" in der gleichen Kette wie "oben", return true. Andernfal= ls, + * return false. Wenn eines der Argumente NULL ist, return false. */ bool bdrv_chain_contains(BlockDriverState *top, BlockDriverState *base) { while (top && top !=3D base) { @@ -2903,8 +2940,8 @@ BlockDriverState *bdrv_next_node(BlockDriverState *= bs) return QTAILQ_NEXT(bs, node_list); } =20 -/* Iterates over all top-level BlockDriverStates, i.e. BDSs that are own= ed by - * the monitor or attached to a BlockBackend */ +/* Iteriert =C3=BCber alle Top-Level-BlockDriverStates, das hei=C3=9Ft B= DSe, die von im + * Besitz der Monitor oder an einem BlockBackend */ BlockDriverState *bdrv_next(BlockDriverState *bs) { if (!bs || bs->blk) { @@ -2914,8 +2951,8 @@ BlockDriverState *bdrv_next(BlockDriverState *bs) } } =20 - /* Ignore all BDSs that are attached to a BlockBackend here; they ha= ve been - * handled by the above block already */ + /* Ignorieren Sie alle BDSe, die hier zu einem BlockBackend gebunden= sind; + * Sie waren bereits durch den obigen Block behandelt */ do { bs =3D bdrv_next_monitor_owned(bs); } while (bs && bs->blk); @@ -2927,16 +2964,18 @@ const char *bdrv_get_node_name(const BlockDriverS= tate *bs) return bs->node_name; } =20 -/* TODO check what callers really want: bs->node_name or blk_name() */ +/* TODO =C3=BCberpr=C3=BCfen, was Anrufer wirklich wollen: BS-> node_nam= e oder + * blk_name () */ const char *bdrv_get_device_name(const BlockDriverState *bs) { return bs->blk ? blk_name(bs->blk) : ""; } =20 -/* This can be used to identify nodes that might not have a device - * name associated. Since node and device names live in the same - * namespace, the result is unambiguous. The exception is if both are - * absent, then this returns an empty (non-null) string. */ +/* Dies kann verwendet werden, um Knoten zu identifizieren, die keine + * Vorrichtung haben k=C3=B6nnte Namen zugeordnet ist. Da der Knoten und + * Ger=C3=A4tenamen leben in der gleichen Namensraum, das Ergebnis ist e= indeutig. + * Die Ausnahme ist, wenn beide abwesend ist, gibt diese eine leere (nic= ht null) + * Zeichenfolge. */ const char *bdrv_get_device_or_node_name(const BlockDriverState *bs) { return bs->blk ? blk_name(bs->blk) : bs->node_name; @@ -2956,8 +2995,8 @@ int bdrv_has_zero_init(BlockDriverState *bs) { assert(bs->drv); =20 - /* If BS is a copy on write image, it is initialized to - the contents of the base image, which may not be zeroes. */ + /* Wenn BS eine Kopie auf Schreib Bild ist, wird es initialisiert + der Inhalt des Basisbildes, die Nullen nicht sein kann. */ if (bs->backing) { return 0; } @@ -2965,7 +3004,7 @@ int bdrv_has_zero_init(BlockDriverState *bs) return bs->drv->bdrv_has_zero_init(bs); } =20 - /* safe default */ + /* sichere Standard */ return 0; } =20 @@ -3102,10 +3141,10 @@ int bdrv_is_snapshot(BlockDriverState *bs) return !!(bs->open_flags & BDRV_O_SNAPSHOT); } =20 -/* backing_file can either be relative, or absolute, or a protocol. If = it is - * relative, it must be relative to the chain. So, passing in bs->filen= ame - * from a BDS as backing_file should not be done, as that may be relativ= e to - * the CWD rather than the chain. */ +/* backing_file kann entweder relativ sein, oder absolut, oder ein Proto= koll. + * Wenn es sich um relativ, muss es an der Kette relativ sein. Also, vor= bei in + * BS-> Dateiname von einem BDS als backing_file nicht getan werden soll= te, so + * dass relativ sein kann die CWD anstatt die Kette. */ BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs, const char *backing_file) { @@ -3128,26 +3167,27 @@ BlockDriverState *bdrv_find_backing_image(BlockDr= iverState *bs, =20 for (curr_bs =3D bs; curr_bs->backing; curr_bs =3D curr_bs->backing-= >bs) { =20 - /* If either of the filename paths is actually a protocol, then - * compare unmodified paths; otherwise make paths relative */ + /* Wenn eine der Dateipfade tats=C3=A4chlich ein Protokoll, dann + * vergleichen unmodifizierten Pfade; sonst machen Pfade relativ= */ if (is_protocol || path_has_protocol(curr_bs->backing_file)) { if (strcmp(backing_file, curr_bs->backing_file) =3D=3D 0) { retval =3D curr_bs->backing->bs; break; } } else { - /* If not an absolute filename path, make it relative to the= current - * image's filename path */ + /* Wenn kein absoluter Dateiname Pfad, machen es zum aktuell= en + * relativen Bild des Dateipfad */ path_combine(filename_tmp, PATH_MAX, curr_bs->filename, backing_file); =20 - /* We are going to compare absolute pathnames */ + /* Wir werden absolute Pfadnamen zu vergleichen */ if (!realpath(filename_tmp, filename_full)) { continue; } =20 - /* We need to make sure the backing filename we are comparin= g against - * is relative to the current image filename (or absolute) *= / + /* Wir m=C3=BCssen sicherstellen, dass die Unterst=C3=BCtzun= g Dateinamen + * machen wir einen Vergleich gegen ist auf dem aktuellen + * Image-Dateinamen (oder absolute) relativ */ path_combine(filename_tmp, PATH_MAX, curr_bs->filename, curr_bs->backing_file); =20 @@ -3278,10 +3318,10 @@ int bdrv_inactivate_all(void) } =20 /**************************************************************/ -/* removable device support */ +/* herausnehmbaren Ger=C3=A4tetr=C3=A4ger */ =20 /** - * Return TRUE if the media is present + * TRUE zur=C3=BCck, wenn die Medien vorhanden ist, */ bool bdrv_is_inserted(BlockDriverState *bs) { @@ -3303,8 +3343,9 @@ bool bdrv_is_inserted(BlockDriverState *bs) } =20 /** - * Return whether the media changed since the last call to this - * function, or -ENOTSUP if we don't know. Most drivers don't know. + * Gibt zur=C3=BCck, ob die Medien seit dem letzten Aufruf dieser ge=C3=A4= ndert + * Funktion oder -ENOTSUP, wenn wir nicht wissen. Die meisten Fahrer wis= sen + * es nicht. */ int bdrv_media_changed(BlockDriverState *bs) { @@ -3317,7 +3358,8 @@ int bdrv_media_changed(BlockDriverState *bs) } =20 /** - * If eject_flag is TRUE, eject the media. Otherwise, close the tray + * Wenn eject_flag TRUE ist, kann das Medium ausgeworfen. Andernfalls sc= hlie=C3=9Fen + * Sie das Fach */ void bdrv_eject(BlockDriverState *bs, bool eject_flag) { @@ -3336,8 +3378,8 @@ void bdrv_eject(BlockDriverState *bs, bool eject_fl= ag) } =20 /** - * Lock or unlock the media (if it is locked, the user won't be able - * to eject it manually). + * Sperren oder Entsperren der Medien (wenn es gesperrt ist, wird der Be= nutzer + * nicht in der Lage auszuwerfen es manuell). */ void bdrv_lock_medium(BlockDriverState *bs, bool locked) { @@ -3350,15 +3392,15 @@ void bdrv_lock_medium(BlockDriverState *bs, bool = locked) } } =20 -/* Get a reference to bs */ +/* Holen Sie sich ein Verweis auf bs */ void bdrv_ref(BlockDriverState *bs) { bs->refcnt++; } =20 -/* Release a previously grabbed reference to bs. - * If after releasing, reference count is zero, the BlockDriverState is - * deleted. */ +/* Lassen Sie eine zuvor packte Bezug auf bs. + * Wenn nach dem Loslassen Referenzz=C3=A4hlung gleich Null ist, ist die + * BlockDriverState gel=C3=B6scht. */ void bdrv_unref(BlockDriverState *bs) { if (!bs) { @@ -3454,7 +3496,7 @@ void bdrv_img_create(const char *filename, const ch= ar *fmt, Error *local_err =3D NULL; int ret =3D 0; =20 - /* Find driver and parse its options */ + /* Finden Sie Treiber und analysieren seine Optionen */ drv =3D bdrv_find_format(fmt); if (!drv) { error_setg(errp, "Unknown file format '%s'", fmt); @@ -3481,11 +3523,11 @@ void bdrv_img_create(const char *filename, const = char *fmt, create_opts =3D qemu_opts_append(create_opts, drv->create_opts); create_opts =3D qemu_opts_append(create_opts, proto_drv->create_opts= ); =20 - /* Create parameter list with default values */ + /* Erstellen Parameterliste mit Standardwerten */ opts =3D qemu_opts_create(create_opts, NULL, 0, &error_abort); qemu_opt_set_number(opts, BLOCK_OPT_SIZE, img_size, &error_abort); =20 - /* Parse -o options */ + /* Parse -o */ if (options) { qemu_opts_do_parse(opts, options, NULL, &local_err); if (local_err) { @@ -3544,7 +3586,7 @@ void bdrv_img_create(const char *filename, const ch= ar *fmt, goto out; } =20 - /* backing files always opened read-only */ + /* Sichern von Dateien ge=C3=B6ffnet immer schreibgesch=C3=BC= tzt */ back_flags =3D flags; back_flags &=3D ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT | BDRV_O_NO_= BACKING); =20 @@ -3587,9 +3629,10 @@ void bdrv_img_create(const char *filename, const c= har *fmt, ret =3D bdrv_create(drv, filename, opts, &local_err); =20 if (ret =3D=3D -EFBIG) { - /* This is generally a better message than whatever the driver w= ould - * deliver (especially because of the cluster_size_hint), since = that - * is most probably not much different from "image too large". *= / + /* Dies ist im Allgemeinen eine bessere Nachricht als das, was d= er + * Fahrer w=C3=BCrde liefern (vor allem wegen der cluster_size_h= int), da + * dies ist h=C3=B6chstwahrscheinlich von "Bild zu gro=C3=9F" ni= cht viel anders. + */ const char *cluster_size_hint =3D ""; if (qemu_opt_get_size(opts, BLOCK_OPT_CLUSTER_SIZE, 0)) { cluster_size_hint =3D " (try using a larger cluster size)"; @@ -3672,12 +3715,12 @@ void bdrv_attach_aio_context(BlockDriverState *bs= , =20 void bdrv_set_aio_context(BlockDriverState *bs, AioContext *new_context) { - bdrv_drain(bs); /* ensure there are no in-flight requests */ + bdrv_drain(bs); /* sicherzustellen, dass keine in-flight-Anfragen si= nd */ =20 bdrv_detach_aio_context(bs); =20 - /* This function executes in the old AioContext so acquire the new o= ne in - * case it runs in a different thread. + /* Diese Funktion f=C3=BChrt in der alten AioContext so die neue erw= erben in + * Fall es l=C3=A4uft in einem anderen Thread. */ aio_context_acquire(new_context); bdrv_attach_aio_context(bs, new_context); @@ -3730,55 +3773,56 @@ int bdrv_amend_options(BlockDriverState *bs, Qemu= Opts *opts, return bs->drv->bdrv_amend_options(bs, opts, status_cb, cb_opaque); } =20 -/* This function will be called by the bdrv_recurse_is_first_non_filter = method - * of block filter and by bdrv_is_first_non_filter. - * It is used to test if the given bs is the candidate or recurse more i= n the - * node graph. +/* Diese Funktion wird von der bdrv_recurse_is_first_non_filter Methode + * aufgerufen werden, von Blockfilter und durch bdrv_is_first_non_filter= . + * Es wird verwendet, um zu testen, ob die gegebenen bs der Bewerber ode= r + * Rekursion mehr in der ist Knoten Graphen. */ bool bdrv_recurse_is_first_non_filter(BlockDriverState *bs, BlockDriverState *candidate) { - /* return false if basic checks fails */ + /* return false wenn grundlegende =C3=9Cberpr=C3=BCfungen fehlschl=C3= =A4gt */ if (!bs || !bs->drv) { return false; } =20 - /* the code reached a non block filter driver -> check if the bs is - * the same as the candidate. It's the recursion termination conditi= on. + /* der Code erreicht einen nicht-Block-Filtertreiber -> =C3=BCberpr=C3= =BCfen, ob die + * bs der gleiche wie der Kandidat. Es ist die Rekursion Abbruchbedi= ngung. */ if (!bs->drv->is_filter) { return bs =3D=3D candidate; } - /* Down this path the driver is a block filter driver */ + /* Auf diesem Weg ist der Fahrer ein Blockfiltertreiber */ =20 - /* If the block filter recursion method is defined use it to recurse= down - * the node graph. + /* Wenn der Blockfilter Rekursion Verfahren Gebrauch definiert ist e= s + * rekursiv der Knoten Graphen. */ if (bs->drv->bdrv_recurse_is_first_non_filter) { return bs->drv->bdrv_recurse_is_first_non_filter(bs, candidate); } =20 - /* the driver is a block filter but don't allow to recurse -> return= false - */ + /* der Fahrer ist ein Filterblock aber nicht zulassen recurse -> + * return false */ return false; } =20 -/* This function checks if the candidate is the first non filter bs down= it's - * bs chain. Since we don't have pointers to parents it explore all bs c= hains - * from the top. Some filters can choose not to pass down the recursion. +/* Diese Funktion =C3=BCberpr=C3=BCft, ob der Kandidat die ersten nicht-= Filter bs ist + * nach unten, es ist bs Kette. Da wir es alle bs Ketten erkunden keine = Hinweise + * auf die Eltern von oben. Einige Filter k=C3=B6nnen w=C3=A4hlen, nicht= die Rekursion + * zu =C3=BCberliefern. */ bool bdrv_is_first_non_filter(BlockDriverState *candidate) { BlockDriverState *bs =3D NULL; =20 - /* walk down the bs forest recursively */ + /* Gehen Sie die bs Wald rekursiv */ while ((bs =3D bdrv_next(bs)) !=3D NULL) { bool perm; =20 - /* try to recurse in this top level bs */ + /* versuchen, in diesem Top-Level-bs recurse */ perm =3D bdrv_recurse_is_first_non_filter(bs, candidate); =20 - /* candidate is the first non filter */ + /* Kandidat ist der erste nicht-Filter */ if (perm) { return true; } @@ -3806,10 +3850,10 @@ BlockDriverState *check_to_replace_node(BlockDriv= erState *parent_bs, goto out; } =20 - /* We don't want arbitrary node of the BDS chain to be replaced only= the top - * most non filter in order to prevent data corruption. - * Another benefit is that this tests exclude backing files which ar= e - * blocked by the backing blockers. + /* Wir wollen nicht willk=C3=BCrlich Knoten der BDS-Kette nur die Sp= itze ersetzt + * werden die meisten nicht-Filter, um Datenkorruption zu verhindern= . + * Ein weiterer Vorteil ist, dass diese Tests Backup-Dateien ausschl= ie=C3=9Fen, + * die sind durch die Unterst=C3=BCtzung Blocker blockiert. */ if (!bdrv_recurse_is_first_non_filter(parent_bs, to_replace_bs)) { error_setg(errp, "Only top most non filter can be replaced"); @@ -3833,7 +3877,7 @@ static bool append_open_options(QDict *d, BlockDriv= erState *bs) for (entry =3D qdict_first(bs->options); entry; entry =3D qdict_next(bs->options, entry)) { - /* Exclude options for children */ + /* Exclude-Optionen f=C3=BCr Kinder */ QLIST_FOREACH(child, &bs->children, next) { if (strstart(qdict_entry_key(entry), child->name, &p) && (!*p || *p =3D=3D '.')) @@ -3845,7 +3889,7 @@ static bool append_open_options(QDict *d, BlockDriv= erState *bs) continue; } =20 - /* And exclude all non-driver-specific options */ + /* Und nicht enthalten alle nicht fahrerspezifische Optionen */ for (desc =3D bdrv_runtime_opts.desc; desc->name; desc++) { if (!strcmp(qdict_entry_key(entry), desc->name)) { break; @@ -3863,17 +3907,19 @@ static bool append_open_options(QDict *d, BlockDr= iverState *bs) return found_any; } =20 -/* Updates the following BDS fields: - * - exact_filename: A filename which may be used for opening a block d= evice - * which (mostly) equals the given BDS (even without = any - * other options; so reading and writing must return = the same - * results, but caching etc. may be different) - * - full_open_options: Options which, when given when opening a block = device - * (without a filename), result in a BDS (mostly) - * equalling the given one - * - filename: If exact_filename is set, it is copied here. Otherwise, - * full_open_options is converted to a JSON object, prefixe= d with - * "json:" (for use through the JSON pseudo protocol) and p= ut here. +/* Aktualisiert die folgenden BDS Felder: + * - Exact_filename: Ein Dateiname, der zum =C3=96ffnen eines Blockger=C3= =A4t verwendet + * werden kann, die (meist) gleich der gegebenen BDS = (auch + * ohne andere Optionen; so das Lesen und Schreiben m= =C3=BCssen + * die gleiche R=C3=BCckkehr Ergebnisse, aber Caching= usw. + * k=C3=B6nnen abweichen) + * - Full_open_options: Optionen, die, wenn gegeben, wenn ein Blockger=C3= =A4t zu + * =C3=B6ffnen (Ohne Dateinamen), f=C3=BChren zu e= iner BDS + * (meistens) gleich der gegebenen + * - Dateiname: Wenn exact_filename gesetzt ist, wird es hier kopiert. + * Andernfalls, full_open_options ist mit einem JSON-Objek= t + * umgewandelt, mit dem Pr=C3=A4fix "Json:" (zur Verwendun= g durch das + * JSON Pseudo-Protokoll) und hier setzen. */ void bdrv_refresh_filename(BlockDriverState *bs) { @@ -3884,15 +3930,15 @@ void bdrv_refresh_filename(BlockDriverState *bs) return; } =20 - /* This BDS's file name will most probably depend on its file's name= , so - * refresh that first */ + /* Dieser Dateiname des BDS wird h=C3=B6chstwahrscheinlich auf den N= amen seiner + * Datei ab, so erfrischen, dass zuerst */ if (bs->file) { bdrv_refresh_filename(bs->file->bs); } =20 if (drv->bdrv_refresh_filename) { - /* Obsolete information is of no use here, so drop the old file = name - * information before refreshing it */ + /* Veraltete Informationen ist hier nichts, fallen so den alten + * Dateinamen Informationen, bevor es erfrischend */ bs->exact_filename[0] =3D '\0'; if (bs->full_open_options) { QDECREF(bs->full_open_options); @@ -3904,7 +3950,8 @@ void bdrv_refresh_filename(BlockDriverState *bs) drv->bdrv_refresh_filename(bs, opts); QDECREF(opts); } else if (bs->file) { - /* Try to reconstruct valid information from the underlying file= */ + /* Versuchen Sie, g=C3=BCltige Informationen aus der zugrunde li= egenden + * Datei rekonstruieren */ bool has_open_options; =20 bs->exact_filename[0] =3D '\0'; @@ -3916,16 +3963,18 @@ void bdrv_refresh_filename(BlockDriverState *bs) opts =3D qdict_new(); has_open_options =3D append_open_options(opts, bs); =20 - /* If no specific options have been given for this BDS, the file= name of - * the underlying file should suffice for this one as well */ + /* Wenn keine spezifischen Optionen wurden f=C3=BCr diesen BDS, = dem + * Dateinamen des angegebenen die zugrunde liegende Datei sollte= auch + * f=C3=BCr diese eine ausreichend */ if (bs->file->bs->exact_filename[0] && !has_open_options) { strcpy(bs->exact_filename, bs->file->bs->exact_filename); } - /* Reconstructing the full options QDict is simple for most form= at block - * drivers, as long as the full options are known for the underl= ying - * file BDS. The full options QDict of that file BDS should some= how - * contain a representation of the filename, therefore the follo= wing - * suffices without querying the (exact_)filename of this BDS. *= / + /* die volle Optionen QDict Rekonstruieren ist einfach f=C3=BCr = die meisten + * Format-Block Fahrer, solange die vollen M=C3=B6glichkeiten f=C3= =BCr die + * darunter liegende bekannt sind Datei BDS. Die voll Optionen Q= Dict + * dieser BDS-Datei sollte irgendwie enthalten eine Darstellung = der + * Dateiname, der daher die folgenden gen=C3=BCgt, ohne die + * (exact_) Dateiname dieser BDS abfragen. */ if (bs->file->bs->full_open_options) { qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str(drv->format_name))); @@ -3938,12 +3987,12 @@ void bdrv_refresh_filename(BlockDriverState *bs) QDECREF(opts); } } else if (!bs->full_open_options && qdict_size(bs->options)) { - /* There is no underlying file BDS (at least referenced by BDS.f= ile), - * so the full options QDict should be equal to the options give= n - * specifically for this block device when it was opened (plus t= he - * driver specification). - * Because those options don't change, there is no need to updat= e - * full_open_options when it's already set. */ + /* Es gibt keine zugrunde liegende Datei BDS (zumindest von BDS.= file + * bezeichnet), so dass die volle Optionen QDict sollte gegeben = zu den + * Optionen gleich speziell f=C3=BCr diesen Block-Ger=C3=A4t, we= nn es ge=C3=B6ffnet + * wurde (plus Treiber-Spezifikation). + * Da diese Optionen nicht =C3=A4ndern, gibt es keine Notwendigk= eit zu + * aktualisieren full_open_options, wenn es bereits gesetzt ist.= */ =20 opts =3D qdict_new(); append_open_options(opts, bs); @@ -3951,12 +4000,13 @@ void bdrv_refresh_filename(BlockDriverState *bs) QOBJECT(qstring_from_str(drv->format_name))); =20 if (bs->exact_filename[0]) { - /* This may not work for all block protocol drivers (some ma= y - * require this filename to be parsed), but we have to find = some - * default solution here, so just include it. If some block = driver - * does not support pure options without any filename at all= or - * needs some special format of the options QDict, it needs = to - * implement the driver-specific bdrv_refresh_filename() fun= ction. + /* Dies kann f=C3=BCr alle Block Protokolltreiber nicht (ein= ige k=C3=B6nnen + * ben=C3=B6tigen diese Dateinamen analysiert) werden, aber = wir haben + * einige zu finden Standardl=C3=B6sung hier, so sind es ebe= n. Wenn + * einige Blocktreiber unterst=C3=BCtzt keine reine Optionen= ohne + * Dateinamen =C3=BCberhaupt nicht oder braucht einige spezi= elle Format + * der Optionen QDict, muss es Umsetzung des treiberspezifis= che + * bdrv_refresh_filename () Funktion. */ qdict_put_obj(opts, "filename", QOBJECT(qstring_from_str(bs->exact_filename)))= ; diff --git a/block/blkdebug.c b/block/blkdebug.c index 20d25bd..5084b58 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -115,7 +115,7 @@ static QemuOptsList inject_error_opts =3D { .name =3D "immediately", .type =3D QEMU_OPT_BOOL, }, - { /* end of list */ } + { /* Ende der Liste */ } }, }; =20 @@ -135,7 +135,7 @@ static QemuOptsList set_state_opts =3D { .name =3D "new_state", .type =3D QEMU_OPT_NUMBER, }, - { /* end of list */ } + { /* Ende der Liste */ } }, }; =20 @@ -172,7 +172,7 @@ static int add_rule(void *opaque, QemuOpts *opts, Err= or **errp) BlkdebugEvent event; struct BlkdebugRule *rule; =20 - /* Find the right event for the rule */ + /* Finden Sie das richtige Ereignis f=C3=BCr die Regel */ event_name =3D qemu_opt_get(opts, "event"); if (!event_name) { error_setg(errp, "Missing event name for rule"); @@ -182,7 +182,7 @@ static int add_rule(void *opaque, QemuOpts *opts, Err= or **errp) return -1; } =20 - /* Set attributes common for all actions */ + /* Set-Attribute, die f=C3=BCr alle Aktionen */ rule =3D g_malloc0(sizeof(*rule)); *rule =3D (struct BlkdebugRule) { .event =3D event, @@ -190,7 +190,7 @@ static int add_rule(void *opaque, QemuOpts *opts, Err= or **errp) .state =3D qemu_opt_get_number(opts, "state", 0), }; =20 - /* Parse action-specific options */ + /* Parse aktionsspezifische Optionen */ switch (d->action) { case ACTION_INJECT_ERROR: rule->options.inject.error =3D qemu_opt_get_number(opts, "errno"= , EIO); @@ -211,7 +211,7 @@ static int add_rule(void *opaque, QemuOpts *opts, Err= or **errp) break; }; =20 - /* Add the rule */ + /* F=C3=BCgen Sie die Regel */ QLIST_INSERT_HEAD(&s->rules[event], rule, next); =20 return 0; @@ -289,21 +289,22 @@ fail: return ret; } =20 -/* Valid blkdebug filenames look like blkdebug:path/to/config:path/to/im= age */ +/* G=C3=BCltige blkdebug Dateinamen aussehen + * blkdebug: path / to / config: path / to / Bild */ static void blkdebug_parse_filename(const char *filename, QDict *options= , Error **errp) { const char *c; =20 - /* Parse the blkdebug: prefix */ + /* Analysieren Sie die blkdebug: Pr=C3=A4fix */ if (!strstart(filename, "blkdebug:", &filename)) { - /* There was no prefix; therefore, all options have to be alread= y - present in the QDict (except for the filename) */ + /* Es gab keinen Pr=C3=A4fix; Daher haben alle Optionen bereits = zu sein + in der QDict (mit Ausnahme der Dateiname) */ qdict_put(options, "x-image", qstring_from_str(filename)); return; } =20 - /* Parse config file path */ + /* Parse-Konfigurationsdateipfad */ c =3D strchr(filename, ':'); if (c =3D=3D NULL) { error_setg(errp, "blkdebug requires both config file and image p= ath"); @@ -316,7 +317,8 @@ static void blkdebug_parse_filename(const char *filen= ame, QDict *options, qdict_put(options, "config", config_path); } =20 - /* TODO Allow multi-level nesting and set file.filename here */ + /* TODO zulassen Multi-Level-Verschachtelung und setzen file.filenam= e hier + */ filename =3D c + 1; qdict_put(options, "x-image", qstring_from_str(filename)); } @@ -340,7 +342,7 @@ static QemuOptsList runtime_opts =3D { .type =3D QEMU_OPT_SIZE, .help =3D "Required alignment in bytes", }, - { /* end of list */ } + { /* Ende der Liste */ } }, }; =20 @@ -362,17 +364,17 @@ static int blkdebug_open(BlockDriverState *bs, QDic= t *options, int flags, goto out; } =20 - /* Read rules from config file or command line options */ + /* Lesen Sie Regeln aus Config-Datei oder Kommandozeilenoptionen */ config =3D qemu_opt_get(opts, "config"); ret =3D read_config(s, config, options, errp); if (ret) { goto out; } =20 - /* Set initial state */ + /* Stellen Sie Anfangszustand */ s->state =3D 1; =20 - /* Open the image file */ + /* =C3=96ffnen Sie die Bilddatei */ bs->file =3D bdrv_open_child(qemu_opt_get(opts, "x-image"), options,= "image", bs, &child_file, false, &local_err); if (local_err) { @@ -381,7 +383,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict = *options, int flags, goto out; } =20 - /* Set request alignment */ + /* Set Anfrage Ausrichtung */ align =3D qemu_opt_get_size(opts, "align", bs->request_alignment); if (align > 0 && align < INT_MAX && !(align & (align - 1))) { bs->request_alignment =3D align; @@ -546,12 +548,12 @@ static bool process_rule(BlockDriverState *bs, stru= ct BlkdebugRule *rule, { BDRVBlkdebugState *s =3D bs->opaque; =20 - /* Only process rules for the current state */ + /* Nur Prozessregeln f=C3=BCr den aktuellen Zustand */ if (rule->state && rule->state !=3D s->state) { return injected; } =20 - /* Take the action */ + /* Nehmen Sie die Aktion */ switch (rule->action) { case ACTION_INJECT_ERROR: if (!injected) { @@ -692,8 +694,8 @@ static void blkdebug_refresh_filename(BlockDriverStat= e *bs, QDict *options) } =20 if (force_json && !bs->file->bs->full_open_options) { - /* The config file cannot be recreated, so creating a plain file= name - * is impossible */ + /* Die Konfigurationsdatei kann nicht neu erstellt werden, so da= ss eine + * einfache Dateinamen zu schaffen ist unm=C3=B6glich */ return; } =20 diff --git a/block/linux-aio.c b/block/linux-aio.c index 805757e..09a94e6 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -17,12 +17,12 @@ #include =20 /* - * Queue size (per-device). + * Queue-Gr=C3=B6=C3=9Fe (pro Ger=C3=A4t). * - * XXX: eventually we need to communicate this to the guest and/or make = it - * tunable by the guest. If we get more outstanding requests at a = time - * than this we will get EAGAIN from io_submit which is communicate= d to - * the guest as an I/O error. + * XXX: schlie=C3=9Flich m=C3=BCssen wir dies dem Gast zu kommunizieren = und / oder es + * machen abstimmbar durch den Gast. Wenn wir bekommen mehr aussteh= enden + * Anforderungen zu einer Zeit, als dies werden wir EAGAIN von io_s= ubmit + * erhalten, die in Verbindung steht der Gast als I / O-Fehler. */ #define MAX_EVENTS 128 =20 @@ -50,10 +50,10 @@ struct qemu_laio_state { io_context_t ctx; EventNotifier e; =20 - /* io queue for submit at batch */ + /* io Warteschlange f=C3=BCr auf Charge einreichen */ LaioQueue io_q; =20 - /* I/O completion processing */ + /* I / O-Abschlussverarbeitung */ QEMUBH *completion_bh; struct io_event events[MAX_EVENTS]; int event_idx; @@ -68,7 +68,7 @@ static inline ssize_t io_event_ret(struct io_event *ev) } =20 /* - * Completes an AIO request (calls the callback and frees the ACB). + * Vervollst=C3=A4ndigt ein AIO Anfrage (die R=C3=BCckrufe und befreit d= en ACB). */ static void qemu_laio_process_completion(struct qemu_laio_state *s, struct qemu_laiocb *laiocb) @@ -80,7 +80,7 @@ static void qemu_laio_process_completion(struct qemu_la= io_state *s, if (ret =3D=3D laiocb->nbytes) { ret =3D 0; } else if (ret >=3D 0) { - /* Short reads mean EOF, pad with zeros. */ + /* Kurz liest mittlere EOF, Pad mit Nullen. */ if (laiocb->is_read) { qemu_iovec_memset(laiocb->qiov, ret, 0, laiocb->qiov->size - ret); @@ -94,22 +94,23 @@ static void qemu_laio_process_completion(struct qemu_= laio_state *s, qemu_aio_unref(laiocb); } =20 -/* The completion BH fetches completed I/O requests and invokes their - * callbacks. +/* Die Fertigstellung BH holt Anfragen E / A abgeschlossen und ruft ihre + * R=C3=BCckrufe. * - * The function is somewhat tricky because it supports nested event loop= s, for - * example when a request callback invokes aio_poll(). In order to do t= his, - * the completion events array and index are kept in qemu_laio_state. T= he BH - * reschedules itself as long as there are completions pending so it wil= l - * either be called again in a nested event loop or will be called after= all - * events have been completed. When there are no events left to complet= e, the - * BH returns without rescheduling. + * Die Funktion ist etwas schwierig, weil es verschachtelte Ereignisschl= eifen + * unterst=C3=BCtzt, f=C3=BCr Beispiel, wenn eine Anfrage R=C3=BCckruf r= uft aio_poll (). Um + * dies zu tun, die Fertigstellung Ereignisse Array und Index werden in + * qemu_laio_state gehalten. die BH Umplanungen selbst, solange es Erg=C3= =A4nzungen + * anh=C3=A4ngig sind, so wird es entweder in einer verschachtelten Erei= gnisschleife + * erneut aufgerufen werden oder wird nach all aufgerufen werden Ereigni= sse + * abgeschlossen sind. Wenn es links keine Ereignisse zu vervollst=C3=A4= ndigen, die + * BH zur=C3=BCck, ohne Umschuldung. */ static void qemu_laio_completion_bh(void *opaque) { struct qemu_laio_state *s =3D opaque; =20 - /* Fetch more completion events when empty */ + /* Fetch mehr Abschluss-Ereignisse, wenn leer */ if (s->event_idx =3D=3D s->event_max) { do { struct timespec ts =3D { 0 }; @@ -120,14 +121,15 @@ static void qemu_laio_completion_bh(void *opaque) s->event_idx =3D 0; if (s->event_max <=3D 0) { s->event_max =3D 0; - return; /* no more events */ + return; /* nicht mehr Veranstaltungen */ } } =20 - /* Reschedule so nested event loops see currently pending completion= s */ + /* Umplanen so verschachtelte Ereignisschleifen Zurzeit anstehenden = Fertig + */ qemu_bh_schedule(s->completion_bh); =20 - /* Process completion events */ + /* Prozess Abschluss Veranstaltungen */ while (s->event_idx < s->event_max) { struct iocb *iocb =3D s->events[s->event_idx].obj; struct qemu_laiocb *laiocb =3D @@ -165,7 +167,8 @@ static void laio_cancel(BlockAIOCB *blockacb) ret =3D io_cancel(laiocb->ctx->ctx, &laiocb->iocb, &event); laiocb->ret =3D -ECANCELED; if (ret !=3D 0) { - /* iocb is not cancelled, cb will be called by the event loop la= ter */ + /* IOCB wird nicht abgebrochen, wird cb durch die Ereignisschlei= fe + * sp=C3=A4ter aufgerufen werden */ return; } =20 @@ -263,7 +266,7 @@ BlockAIOCB *laio_submit(BlockDriverState *bs, void *a= io_ctx, int fd, case QEMU_AIO_READ: io_prep_preadv(iocbs, fd, qiov->iov, qiov->niov, offset); break; - /* Currently Linux kernel does not support other operations */ + /* Derzeit Linux-Kernel unterst=C3=BCtzt keine anderen Operationen *= / default: fprintf(stderr, "%s: invalid AIO request type 0x%x.\n", __func__, type); diff --git a/block/qcow.c b/block/qcow.c index 60ddb12..af3ea27 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -34,7 +34,7 @@ #include "migration/migration.h" =20 /**************************************************************/ -/* QEMU COW block driver with compression and encryption support */ +/* QEMU COW-Block-Treiber mit Kompression und Verschl=C3=BCsselung */ =20 #define QCOW_MAGIC (('Q' << 24) | ('F' << 16) | ('I' << 8) | 0xfb) #define QCOW_VERSION 1 @@ -50,7 +50,7 @@ typedef struct QCowHeader { uint64_t backing_file_offset; uint32_t backing_file_size; uint32_t mtime; - uint64_t size; /* in bytes */ + uint64_t size; /* in Bytes */ uint8_t cluster_bits; uint8_t l2_bits; uint16_t padding; @@ -76,7 +76,7 @@ typedef struct BDRVQcowState { uint8_t *cluster_cache; uint8_t *cluster_data; uint64_t cluster_cache_offset; - QCryptoCipher *cipher; /* NULL if no key yet */ + QCryptoCipher *cipher; /* NULL, wenn kein Schl=C3=BCssel vorhanden *= / uint32_t crypt_method_header; CoMutex lock; Error *migration_blocker; @@ -139,8 +139,8 @@ static int qcow_open(BlockDriverState *bs, QDict *opt= ions, int flags, goto fail; } =20 - /* l2_bits specifies number of entries; storing a uint64_t in each e= ntry, - * so bytes =3D num_entries << 3. */ + /* l2_bits gibt Anzahl der Eintr=C3=A4ge; eine uint64_t in jedem Ein= trag zu + * speichern, so Bytes =3D num_entries << 3. */ if (header.l2_bits < 9 - 3 || header.l2_bits > 16 - 3) { error_setg(errp, "L2 table size must be between 512 and 64k"); ret =3D -EINVAL; @@ -177,7 +177,7 @@ static int qcow_open(BlockDriverState *bs, QDict *opt= ions, int flags, bs->total_sectors =3D header.size / 512; s->cluster_offset_mask =3D (1LL << (63 - s->cluster_bits)) - 1; =20 - /* read the level 1 table */ + /* Lesen Sie die Ebene 1 Tisch */ shift =3D s->cluster_bits + s->l2_bits; if (header.size > UINT64_MAX - (1LL << shift)) { error_setg(errp, "Image too large"); @@ -211,7 +211,7 @@ static int qcow_open(BlockDriverState *bs, QDict *opt= ions, int flags, be64_to_cpus(&s->l1_table[i]); } =20 - /* alloc L2 cache (max. 64k * 16 * 8 =3D 8 MB) */ + /* alloc L2-Cache (max. 64 k * 16 * 8 =3D 8 MB) */ s->l2_cache =3D qemu_try_blockalign(bs->file->bs, s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t= )); @@ -224,7 +224,7 @@ static int qcow_open(BlockDriverState *bs, QDict *opt= ions, int flags, s->cluster_data =3D g_malloc(s->cluster_size); s->cluster_cache_offset =3D -1; =20 - /* read the backing file name */ + /* Lesen Sie die Unterst=C3=BCtzung Dateinamen */ if (header.backing_file_offset !=3D 0) { len =3D header.backing_file_size; if (len > 1023 || len >=3D sizeof(bs->backing_file)) { @@ -240,7 +240,7 @@ static int qcow_open(BlockDriverState *bs, QDict *opt= ions, int flags, bs->backing_file[len] =3D '\0'; } =20 - /* Disable migration when qcow images are used */ + /* Deaktivieren Sie die Migration, wenn qcow Bilder verwendet werden= */ error_setg(&s->migration_blocker, "The qcow format used by node '%s'= " "does not support live migration", bdrv_get_device_or_node_name(bs)); @@ -258,8 +258,8 @@ static int qcow_open(BlockDriverState *bs, QDict *opt= ions, int flags, } =20 =20 -/* We have nothing to do for QCOW reopen, stubs just return - * success */ +/* Wir haben nichts f=C3=BCr qcow wieder =C3=B6ffnen zu tun, Stubs nur z= ur=C3=BCckkehren + * Erfolg */ static int qcow_reopen_prepare(BDRVReopenState *state, BlockReopenQueue *queue, Error **errp) { @@ -277,8 +277,8 @@ static int qcow_set_key(BlockDriverState *bs, const c= har *key) len =3D strlen(key); if (len > 16) len =3D 16; - /* XXX: we could compress the chars to 7 bits to increase - entropy */ + /* XXX: wir konnten die Zeichen auf 7 Bit komprimieren zu erh=C3=B6h= en + Entropie */ for(i =3D 0;i < len;i++) { keybuf[i] =3D key[i]; } @@ -292,18 +292,18 @@ static int qcow_set_key(BlockDriverState *bs, const= char *key) &err); =20 if (!s->cipher) { - /* XXX would be nice if errors in this method could - * be properly propagate to the caller. Would need - * the bdrv_set_key() API signature to be fixed. */ + /* XXX w=C3=A4re sch=C3=B6n, wenn Fehler in diesem Verfahren k=C3= =B6nnte + * werden richtig an den Aufrufer propagieren. W=C3=BCrde brauch= en + * die bdrv_set_key () API Signatur festgelegt werden. */ error_free(err); return -1; } return 0; } =20 -/* The crypt function is compatible with the linux cryptoloop - algorithm for < 4 GB images. NOTE: out_buf =3D=3D in_buf is - supported */ +/* Die Krypta Funktion ist kompatibel mit dem Linux cryptoloop + Algorithmus f=C3=BCr <4 GB Bilder. HINWEIS: out_buf =3D=3D in_buf ist + unterst=C3=BCtzt */ static int encrypt_sectors(BDRVQcowState *s, int64_t sector_num, uint8_t *out_buf, const uint8_t *in_buf, int nb_sectors, bool enc, Error **errp) @@ -346,18 +346,18 @@ static int encrypt_sectors(BDRVQcowState *s, int64_= t sector_num, return 0; } =20 -/* 'allocate' is: +/* 'Zuteilen' ist: * - * 0 to not allocate. + * 0 bis nicht zuordnen. * - * 1 to allocate a normal cluster (for sector indexes 'n_start' to - * 'n_end') + * 1 einen normalen Cluster (f=C3=BCr Sektorindizes 'n_start' zuzuweisen= , + * 'N_end') * - * 2 to allocate a compressed cluster of size - * 'compressed_size'. 'compressed_size' must be > 0 and < - * cluster_size + * 2 eine komprimierte Cluster von Gr=C3=B6=C3=9Fe zuzuweisen + * 'Compressed_size'. 'Compressed_size' muss> 0 und < + * Clustergr=C3=B6=C3=9Fe * - * return 0 if not allocated. + * 0 zur=C3=BCck, wenn nicht zugeordnet. */ static uint64_t get_cluster_offset(BlockDriverState *bs, uint64_t offset, int allocate, @@ -376,11 +376,11 @@ static uint64_t get_cluster_offset(BlockDriverState= *bs, if (!l2_offset) { if (!allocate) return 0; - /* allocate a new l2 entry */ + /* einen neuen l2 Eintrag zuweisen */ l2_offset =3D bdrv_getlength(bs->file->bs); - /* round to cluster size */ + /* Runde Clustergr=C3=B6=C3=9Fe */ l2_offset =3D (l2_offset + s->cluster_size - 1) & ~(s->cluster_s= ize - 1); - /* update the L1 entry */ + /* Aktualisierung der L1-Eintrag */ s->l1_table[l1_index] =3D l2_offset; tmp =3D cpu_to_be64(l2_offset); if (bdrv_pwrite_sync(bs->file->bs, @@ -391,7 +391,7 @@ static uint64_t get_cluster_offset(BlockDriverState *= bs, } for(i =3D 0; i < L2_CACHE_SIZE; i++) { if (l2_offset =3D=3D s->l2_cache_offsets[i]) { - /* increment the hit count */ + /* erh=C3=B6he den Trefferanzahl */ if (++s->l2_cache_counts[i] =3D=3D 0xffffffff) { for(j =3D 0; j < L2_CACHE_SIZE; j++) { s->l2_cache_counts[j] >>=3D 1; @@ -401,7 +401,8 @@ static uint64_t get_cluster_offset(BlockDriverState *= bs, goto found; } } - /* not found: load a new entry in the least used one */ + /* nicht gefunden: in der am wenigsten genutzte man einen neuen Eint= rag + * laden */ min_index =3D 0; min_count =3D 0xffffffff; for(i =3D 0; i < L2_CACHE_SIZE; i++) { @@ -431,18 +432,18 @@ static uint64_t get_cluster_offset(BlockDriverState= *bs, ((cluster_offset & QCOW_OFLAG_COMPRESSED) && allocate =3D=3D 1))= { if (!allocate) return 0; - /* allocate a new cluster */ + /* weisen Sie einen neuen Cluster */ if ((cluster_offset & QCOW_OFLAG_COMPRESSED) && (n_end - n_start) < s->cluster_sectors) { - /* if the cluster is already compressed, we must - decompress it in the case it is not completely - overwritten */ + /* wenn der Cluster bereits komprimiert ist, m=C3=BCssen wir + Dekomprimieren es in dem Fall ist es nicht v=C3=B6llig + =C3=BCberschrieben */ if (decompress_cluster(bs, cluster_offset) < 0) return 0; cluster_offset =3D bdrv_getlength(bs->file->bs); cluster_offset =3D (cluster_offset + s->cluster_size - 1) & ~(s->cluster_size - 1); - /* write the cluster content */ + /* Schreiben Sie den Cluster-Gehalt */ if (bdrv_pwrite(bs->file->bs, cluster_offset, s->cluster_cac= he, s->cluster_size) !=3D s->cluster_size) @@ -450,12 +451,12 @@ static uint64_t get_cluster_offset(BlockDriverState= *bs, } else { cluster_offset =3D bdrv_getlength(bs->file->bs); if (allocate =3D=3D 1) { - /* round to cluster size */ + /* Runde Clustergr=C3=B6=C3=9Fe */ cluster_offset =3D (cluster_offset + s->cluster_size - 1= ) & ~(s->cluster_size - 1); bdrv_truncate(bs->file->bs, cluster_offset + s->cluster_= size); - /* if encrypted, we must initialize the cluster - content which won't be written */ + /* wenn diese verschl=C3=BCsselt sind, m=C3=BCssen wir d= ie Cluster + initialisieren Inhalte, die nicht geschrieben werden = */ if (bs->encrypted && (n_end - n_start) < s->cluster_sectors) { uint64_t start_sect; @@ -485,7 +486,7 @@ static uint64_t get_cluster_offset(BlockDriverState *= bs, (uint64_t)compressed_size << (63 - s->cluster_bits); } } - /* update L2 table */ + /* Update L2 Tabelle */ tmp =3D cpu_to_be64(cluster_offset); l2_table[l2_index] =3D tmp; if (bdrv_pwrite_sync(bs->file->bs, l2_offset + l2_index * sizeof= (tmp), @@ -596,7 +597,7 @@ static coroutine_fn int qcow_co_readv(BlockDriverStat= e *bs, int64_t sector_num, qemu_co_mutex_lock(&s->lock); =20 while (nb_sectors !=3D 0) { - /* prepare next request */ + /* Vorbereitung n=C3=A4chste Anfrage */ cluster_offset =3D get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0); index_in_cluster =3D sector_num & (s->cluster_sectors - 1); @@ -607,7 +608,7 @@ static coroutine_fn int qcow_co_readv(BlockDriverStat= e *bs, int64_t sector_num, =20 if (!cluster_offset) { if (bs->backing) { - /* read from the base image */ + /* lesen aus dem Basisbild */ hd_iov.iov_base =3D (void *)buf; hd_iov.iov_len =3D n * 512; qemu_iovec_init_external(&hd_qiov, &hd_iov, 1); @@ -619,11 +620,11 @@ static coroutine_fn int qcow_co_readv(BlockDriverSt= ate *bs, int64_t sector_num, goto fail; } } else { - /* Note: in this case, no need to wait */ + /* Hinweis: in diesem Fall keine Notwendigkeit, warten *= / memset(buf, 0, 512 * n); } } else if (cluster_offset & QCOW_OFLAG_COMPRESSED) { - /* add AIO support for compressed blocks ? */ + /* hinzuf=C3=BCgen AIO Unterst=C3=BCtzung f=C3=BCr komprimie= rte Bl=C3=B6cke? */ if (decompress_cluster(bs, cluster_offset) < 0) { goto fail; } @@ -689,7 +690,7 @@ static coroutine_fn int qcow_co_writev(BlockDriverSta= te *bs, int64_t sector_num, uint8_t *buf; void *orig_buf; =20 - s->cluster_cache_offset =3D -1; /* disable compressed cache */ + s->cluster_cache_offset =3D -1; /* deaktivieren komprimierten Cache = */ =20 if (qiov->niov > 1) { buf =3D orig_buf =3D qemu_try_blockalign(bs, qiov->size); @@ -789,7 +790,7 @@ static int qcow_create(const char *filename, QemuOpts= *opts, Error **errp) int ret; BlockBackend *qcow_blk; =20 - /* Read out options */ + /* Vorlesen Optionen */ total_size =3D ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, = 0), BDRV_SECTOR_SIZE); backing_file =3D qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE); @@ -831,15 +832,15 @@ static int qcow_create(const char *filename, QemuOp= ts *opts, Error **errp) header.backing_file_size =3D cpu_to_be32(backing_filename_le= n); header_size +=3D backing_filename_len; } else { - /* special backing file for vvfat */ + /* Spezial-Tr=C3=A4gerdatei f=C3=BCr vvfat */ backing_file =3D NULL; } - header.cluster_bits =3D 9; /* 512 byte cluster to avoid copying - unmodified sectors */ - header.l2_bits =3D 12; /* 32 KB L2 tables */ + header.cluster_bits =3D 9; /* 512-Byte-Cluster Kopieren zu verme= iden + unmodifizierten Sektoren */ + header.l2_bits =3D 12; /* 32 KB L2-Tabellen */ } else { - header.cluster_bits =3D 12; /* 4 KB clusters */ - header.l2_bits =3D 9; /* 4 KB L2 tables */ + header.cluster_bits =3D 12; /* 4 KB Cluster */ + header.l2_bits =3D 9; /* 4 KB L2-Tabellen */ } header_size =3D (header_size + 7) & ~7; shift =3D header.cluster_bits + header.l2_bits; @@ -852,7 +853,7 @@ static int qcow_create(const char *filename, QemuOpts= *opts, Error **errp) header.crypt_method =3D cpu_to_be32(QCOW_CRYPT_NONE); } =20 - /* write all the data */ + /* Schreiben Sie alle Daten */ ret =3D blk_pwrite(qcow_blk, 0, &header, sizeof(header)); if (ret !=3D sizeof(header)) { goto exit; @@ -907,8 +908,8 @@ static int qcow_make_empty(BlockDriverState *bs) return 0; } =20 -/* XXX: put compressed sectors first, then all the cluster aligned - tables to avoid losing bytes in alignment */ +/* XXX: Put-Druck Sektoren zuerst, dann das ganze Cluster ausgerichtet + Tabellen zu vermeiden Bytes in Ausrichtung zu verlieren */ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_nu= m, const uint8_t *buf, int nb_sectors) { @@ -921,7 +922,8 @@ static int qcow_write_compressed(BlockDriverState *bs= , int64_t sector_num, if (nb_sectors !=3D s->cluster_sectors) { ret =3D -EINVAL; =20 - /* Zero-pad last write if image size is not cluster aligned */ + /* Null-Pad letzte Schreib, wenn die Bildgr=C3=B6=C3=9Fe ist nic= ht ausgerichtet + * Cluster */ if (sector_num + nb_sectors =3D=3D bs->total_sectors && nb_sectors < s->cluster_sectors) { uint8_t *pad_buf =3D qemu_blockalign(bs, s->cluster_size); @@ -936,7 +938,7 @@ static int qcow_write_compressed(BlockDriverState *bs= , int64_t sector_num, =20 out_buf =3D g_malloc(s->cluster_size + (s->cluster_size / 1000) + 12= 8); =20 - /* best compression, small window, no zlib header */ + /* beste Kompression, kleine Fenster, keine zlib-Header */ memset(&strm, 0, sizeof(strm)); ret =3D deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -12, @@ -962,7 +964,7 @@ static int qcow_write_compressed(BlockDriverState *bs= , int64_t sector_num, deflateEnd(&strm); =20 if (ret !=3D Z_STREAM_END || out_len >=3D s->cluster_size) { - /* could not compress: write normal cluster */ + /* komprimieren konnte nicht: Schreiben normalen Cluster */ ret =3D bdrv_write(bs, sector_num, buf, s->cluster_sectors); if (ret < 0) { goto fail; @@ -1015,7 +1017,7 @@ static QemuOptsList qcow_create_opts =3D { .help =3D "Encrypt the image", .def_value_str =3D "off" }, - { /* end of list */ } + { /* Ende der Liste */ } } }; =20 diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index 0fe8eda..937f458 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ =20 -/* Needed for CONFIG_MADVISE */ +/* Erforderlich f=C3=BCr CONFIG_MADVISE */ #include "qemu/osdep.h" =20 #if defined(CONFIG_MADVISE) || defined(CONFIG_POSIX_MADVISE) @@ -97,12 +97,13 @@ void qcow2_cache_clean_unused(BlockDriverState *bs, Q= cow2Cache *c) while (i < c->size) { int to_clean =3D 0; =20 - /* Skip the entries that we don't need to clean */ + /* =C3=9Cberspringen Sie die Eintr=C3=A4ge, die wir nicht brauch= en, zu reinigen + */ while (i < c->size && !can_clean_entry(c, i)) { i++; } =20 - /* And count how many we can clean in a row */ + /* Und z=C3=A4hlen, wie viele wir in einer Reihe reinigen */ while (i < c->size && can_clean_entry(c, i)) { c->entries[i].offset =3D 0; c->entries[i].lru_counter =3D 0; @@ -315,7 +316,7 @@ static int qcow2_cache_do_get(BlockDriverState *bs, Q= cow2Cache *c, trace_qcow2_cache_get(qemu_coroutine_self(), c =3D=3D s->l2_table_ca= che, offset, read_from_disk); =20 - /* Check if the table is already cached */ + /* =C3=9Cberpr=C3=BCfen Sie, ob die Tabelle bereits zwischengespeich= ert wird */ i =3D lookup_index =3D (offset / s->cluster_size * 4) % c->size; do { const Qcow2CachedTable *t =3D &c->entries[i]; @@ -332,12 +333,13 @@ static int qcow2_cache_do_get(BlockDriverState *bs,= Qcow2Cache *c, } while (i !=3D lookup_index); =20 if (min_lru_index =3D=3D -1) { - /* This can't happen in current synchronous code, but leave the = check - * here as a reminder for whoever starts using AIO with the cach= e */ + /* Dies kann nicht im laufenden Synchroncode passieren, aber las= sen Sie + * das Kontroll hier als Erinnerung f=C3=BCr jeden, beginnt AIO = mit dem + * Cache-Verwendung */ abort(); } =20 - /* Cache miss: write a table back and replace it */ + /* Cache-Miss: Schreiben Sie eine Tabelle zur=C3=BCck und ersetzen S= ie es */ i =3D min_lru_index; trace_qcow2_cache_get_replace_entry(qemu_coroutine_self(), c =3D=3D s->l2_table_cache, i); @@ -365,7 +367,7 @@ static int qcow2_cache_do_get(BlockDriverState *bs, Q= cow2Cache *c, =20 c->entries[i].offset =3D offset; =20 - /* And return the right table */ + /* Und kehren die richtige Tabelle */ found: c->entries[i].ref++; *table =3D qcow2_cache_get_table_addr(bs, c, i); diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 31ecc10..94c3c8c 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -44,9 +44,9 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t = min_size, if (min_size <=3D s->l1_size) return 0; =20 - /* Do a sanity check on min_size before trying to calculate new_l1_s= ize - * (this prevents overflows during the while loop for the calculatio= n of - * new_l1_size) */ + /* F=C3=BChren Sie eine Plausibilit=C3=A4tspr=C3=BCfung auf min_size= , bevor Sie + * versuchen new_l1_size zu berechnen (Dies verhindert =C3=9Cberlauf= w=C3=A4hrend + * der while-Schleife f=C3=BCr die Berechnung von new_l1_size) */ if (min_size > INT_MAX / sizeof(uint64_t)) { return -EFBIG; } @@ -54,7 +54,8 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t = min_size, if (exact_size) { new_l1_size =3D min_size; } else { - /* Bump size up to reduce the number of times we have to grow */ + /* Bump Gr=C3=B6=C3=9Fe bis zu der Anzahl der Male reduzieren wi= r m=C3=BCssen + * wachsen */ new_l1_size =3D s->l1_size; if (new_l1_size =3D=3D 0) { new_l1_size =3D 1; @@ -83,7 +84,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t = min_size, =20 memcpy(new_l1_table, s->l1_table, s->l1_size * sizeof(uint64_t)); =20 - /* write new table (align to cluster) */ + /* schreiben neue Tabelle (ausrichten zu Cluster) */ BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_ALLOC_TABLE); new_l1_table_offset =3D qcow2_alloc_clusters(bs, new_l1_size2); if (new_l1_table_offset < 0) { @@ -96,8 +97,8 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t = min_size, goto fail; } =20 - /* the L1 position has not yet been updated, so these clusters must - * indeed be completely free */ + /* die L1-Position wurde noch nicht aktualisiert, so dass diese Clus= ter + * m=C3=BCssen sein in der Tat v=C3=B6llig frei */ ret =3D qcow2_pre_write_overlap_check(bs, 0, new_l1_table_offset, new_l1_size2); if (ret < 0) { @@ -114,7 +115,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_= t min_size, for(i =3D 0; i < s->l1_size; i++) new_l1_table[i] =3D be64_to_cpu(new_l1_table[i]); =20 - /* set new table */ + /* set neue Tabelle */ BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_ACTIVATE_TABLE); cpu_to_be32w((uint32_t*)data, new_l1_size); stq_be_p(data + 4, new_l1_table_offset); @@ -142,11 +143,12 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint6= 4_t min_size, /* * l2_load * - * Loads a L2 table into memory. If the table is in the cache, the cache - * is used; otherwise the L2 table is loaded from the image file. + * L=C3=A4dt eine L2-Tabelle in den Speicher. Wenn die Tabelle in dem Ca= che, der + * Cache wird eingesetzt; ansonsten wird der L2-Tabelle aus der Bilddate= i + * geladen. * - * Returns a pointer to the L2 table on success, or NULL if the read fro= m - * the image file failed. + * Gibt einen Zeiger auf den L2-Tabelle auf Erfolg oder NULL, wenn das L= esen von + * die Bilddatei ist fehlgeschlagen. */ =20 static int l2_load(BlockDriverState *bs, uint64_t l2_offset, @@ -161,8 +163,9 @@ static int l2_load(BlockDriverState *bs, uint64_t l2_= offset, } =20 /* - * Writes one sector of the L1 table to the disk (can't update single en= tries - * and we really don't want bdrv_pread to perform a read-modify-write) + * Schreibt ein Sektor der L1-Tabelle auf die Festplatte (nicht aktualis= ieren + * einzelne Eintr=C3=A4ge und wir wollen wirklich bdrv_pread keine + * Lese-Modifizieren-Schreiben durchzuf=C3=BChren) */ #define L1_ENTRIES_PER_SECTOR (512 / 8) int qcow2_write_l1_entry(BlockDriverState *bs, int l1_index) @@ -199,10 +202,11 @@ int qcow2_write_l1_entry(BlockDriverState *bs, int = l1_index) /* * l2_allocate * - * Allocate a new l2 entry in the file. If l1_index points to an already - * used entry in the L2 table (i.e. we are doing a copy on write for the= L2 - * table) copy the contents of the old L2 table into the newly allocated= one. - * Otherwise the new table is initialized with zeros. + * Vergeben Sie einen neuen l2 Eintrag in der Datei. Wenn l1_index Punkt= e zu + * einem bereits gebrauchte Eintrag in der L2-Tabelle (das hei=C3=9Ft wi= r tun eine + * Kopie auf Schreib f=C3=BCr den L2 Tabelle), den Inhalt der alten L2 T= abelle in + * den neu zugewiesenen kopieren. Andernfalls die neue Tabelle wird mit = Nullen + * initialisiert. * */ =20 @@ -218,7 +222,7 @@ static int l2_allocate(BlockDriverState *bs, int l1_i= ndex, uint64_t **table) =20 trace_qcow2_l2_allocate(bs, l1_index); =20 - /* allocate a new l2 entry */ + /* einen neuen l2 Eintrag zuweisen */ =20 l2_offset =3D qcow2_alloc_clusters(bs, s->l2_size * sizeof(uint64_t)= ); if (l2_offset < 0) { @@ -231,7 +235,7 @@ static int l2_allocate(BlockDriverState *bs, int l1_i= ndex, uint64_t **table) goto fail; } =20 - /* allocate a new entry in the l2 cache */ + /* einen neuen Eintrag in der L2-Cache zuteilen */ =20 trace_qcow2_l2_allocate_get_empty(bs, l1_index); ret =3D qcow2_cache_get_empty(bs, s->l2_table_cache, l2_offset, (voi= d**) table); @@ -242,12 +246,13 @@ static int l2_allocate(BlockDriverState *bs, int l1= _index, uint64_t **table) l2_table =3D *table; =20 if ((old_l2_offset & L1E_OFFSET_MASK) =3D=3D 0) { - /* if there was no old l2 table, clear the new table */ + /* wenn es keine alten l2 Tisch war, deaktivieren Sie die neue T= abelle + */ memset(l2_table, 0, s->l2_size * sizeof(uint64_t)); } else { uint64_t* old_table; =20 - /* if there was an old l2 table, read it from the disk */ + /* wenn es ein alter l2 Tisch war, las er von der Platte */ BLKDBG_EVENT(bs->file, BLKDBG_L2_ALLOC_COW_READ); ret =3D qcow2_cache_get(bs, s->l2_table_cache, old_l2_offset & L1E_OFFSET_MASK, @@ -261,7 +266,7 @@ static int l2_allocate(BlockDriverState *bs, int l1_i= ndex, uint64_t **table) qcow2_cache_put(bs, s->l2_table_cache, (void **) &old_table); } =20 - /* write the l2 table to the file */ + /* Der L2-Tabelle in die Datei schreiben */ BLKDBG_EVENT(bs->file, BLKDBG_L2_ALLOC_WRITE); =20 trace_qcow2_l2_allocate_write_l2(bs, l1_index); @@ -271,7 +276,7 @@ static int l2_allocate(BlockDriverState *bs, int l1_i= ndex, uint64_t **table) goto fail; } =20 - /* update the L1 entry */ + /* Aktualisierung der L1-Eintrag */ trace_qcow2_l2_allocate_write_l1(bs, l1_index); s->l1_table[l1_index] =3D l2_offset | QCOW_OFLAG_COPIED; ret =3D qcow2_write_l1_entry(bs, l1_index); @@ -297,11 +302,12 @@ fail: } =20 /* - * Checks how many clusters in a given L2 table are contiguous in the im= age - * file. As soon as one of the flags in the bitmask stop_flags changes c= ompared - * to the first cluster, the search is stopped and the cluster is not co= unted - * as contiguous. (This allows it, for example, to stop at the first com= pressed - * cluster which may require a different handling) + * Pr=C3=BCft, wie viele Cluster in einem bestimmten L2 Tabelle im Bild + * aneinandergrenzen Datei. Sobald eine der Fahnen in der Bitmaske stop_= flags + * =C3=84nderungen im Vergleich zu dem ersten Cluster, wird die Suche ge= stoppt und + * der Cluster nicht gez=C3=A4hlt als zusammenh=C3=A4ngend. (Dies erm=C3= =B6glicht es, + * beispielsweise bei der ersten zu stoppen komprimiert Cluster, die ein= e + * unterschiedliche Behandlung erfordern kann) */ static int count_contiguous_clusters(int nb_clusters, int cluster_size, uint64_t *l2_table, uint64_t stop_flags) @@ -343,9 +349,9 @@ static int count_contiguous_clusters_by_type(int nb_c= lusters, return i; } =20 -/* The crypt function is compatible with the linux cryptoloop - algorithm for < 4 GB images. NOTE: out_buf =3D=3D in_buf is - supported */ +/* Die Krypta Funktion ist kompatibel mit dem Linux cryptoloop + Algorithmus f=C3=BCr <4 GB Bilder. HINWEIS: out_buf =3D=3D in_buf ist + unterst=C3=BCtzt */ int qcow2_encrypt_sectors(BDRVQcow2State *s, int64_t sector_num, uint8_t *out_buf, const uint8_t *in_buf, int nb_sectors, bool enc, @@ -419,9 +425,10 @@ static int coroutine_fn copy_sectors(BlockDriverStat= e *bs, goto out; } =20 - /* Call .bdrv_co_readv() directly instead of using the public block-= layer - * interface. This avoids double I/O throttling and request trackin= g, - * which can lead to deadlock when block layer copy-on-read is enabl= ed. + /* Rufen Sie .bdrv_co_readv () direkt anstelle der Verwendung der + * =C3=B6ffentlichen Block-Schicht Schnittstelle. Dies vermeidet dop= pelte + * E / A-Drosselung und Anforderungsverfolgung, das kann zu einem De= adlock + * f=C3=BChren, wenn Block-Layer Copy-on-Lesen aktiviert ist. */ ret =3D bs->drv->bdrv_co_readv(bs, start_sect + n_start, n, &qiov); if (ret < 0) { @@ -463,16 +470,17 @@ out: /* * get_cluster_offset * - * For a given offset of the disk image, find the cluster offset in - * qcow2 file. The offset is stored in *cluster_offset. + * F=C3=BCr eine der Disk-Image angegebenen Offset, finden Sie den Clust= er-Offset in + * qcow2 Datei. Der Offset wird in * cluster_offset gespeichert. * - * on entry, *num is the number of contiguous sectors we'd like to - * access following offset. + * =C3=BCber den Eintritt ist * num die Anzahl der zusammenh=C3=A4ngende= n Sektoren + * w=C3=BCrden wir gerne Zugang Offset folgen. * - * on exit, *num is the number of contiguous sectors we can read. + * an der Ausfahrt ist * num die Anzahl der zusammenh=C3=A4ngenden Sekto= ren wir + * lesen k=C3=B6nnen. * - * Returns the cluster type (QCOW2_CLUSTER_*) on success, -errno in erro= r - * cases. + * Gibt den Cluster-Typ (QCOW2_CLUSTER_ *) auf Erfolg, -errno in Fehler + * F=C3=A4lle. */ int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset, int *num, uint64_t *cluster_offset) @@ -490,13 +498,13 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, = uint64_t offset, =20 l1_bits =3D s->l2_bits + s->cluster_bits; =20 - /* compute how many bytes there are between the offset and - * the end of the l1 entry + /* berechnen, wie viele Bytes zwischen dem Offset sind, und + * das Ende des l1 Eintritts */ =20 nb_available =3D (1ULL << l1_bits) - (offset & ((1ULL << l1_bits) - = 1)); =20 - /* compute the number of available sectors */ + /* berechnen die Anzahl der verf=C3=BCgbaren Sektoren */ =20 nb_available =3D (nb_available >> 9) + index_in_cluster; =20 @@ -507,7 +515,7 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, ui= nt64_t offset, =20 *cluster_offset =3D 0; =20 - /* seek to the l2 offset in the l1 table */ + /* zum l2 suchen in der l1 Tabellenoffset */ =20 l1_index =3D offset >> l1_bits; if (l1_index >=3D s->l1_size) { @@ -528,25 +536,25 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, = uint64_t offset, return -EIO; } =20 - /* load the l2 table in memory */ + /* laden Sie die l2 Tabelle im Speicher */ =20 ret =3D l2_load(bs, l2_offset, &l2_table); if (ret < 0) { return ret; } =20 - /* find the cluster offset for the given disk offset */ + /* finden Sie den Cluster f=C3=BCr die gegebene Platte Offset */ =20 l2_index =3D (offset >> s->cluster_bits) & (s->l2_size - 1); *cluster_offset =3D be64_to_cpu(l2_table[l2_index]); =20 - /* nb_needed <=3D INT_MAX, thus nb_clusters <=3D INT_MAX, too */ + /* nb_needed <=3D INT_MAX, so nb_clusters <=3D INT_MAX auch */ nb_clusters =3D size_to_clusters(s, nb_needed << 9); =20 ret =3D qcow2_get_cluster_type(*cluster_offset); switch (ret) { case QCOW2_CLUSTER_COMPRESSED: - /* Compressed clusters can only be processed one by one */ + /* Komprimierte Cluster k=C3=B6nnen nur einzeln verarbeitet werd= en, */ c =3D 1; *cluster_offset &=3D L2E_COMPRESSED_OFFSET_SIZE_MASK; break; @@ -563,13 +571,13 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, = uint64_t offset, *cluster_offset =3D 0; break; case QCOW2_CLUSTER_UNALLOCATED: - /* how many empty clusters ? */ + /* wie viele leere Cluster? */ c =3D count_contiguous_clusters_by_type(nb_clusters, &l2_table[l= 2_index], QCOW2_CLUSTER_UNALLOCATED)= ; *cluster_offset =3D 0; break; case QCOW2_CLUSTER_NORMAL: - /* how many allocated clusters ? */ + /* wie viele Cluster zugewiesen? */ c =3D count_contiguous_clusters(nb_clusters, s->cluster_size, &l2_table[l2_index], QCOW_OFLAG_ZERO); *cluster_offset &=3D L2E_OFFSET_MASK; @@ -606,13 +614,13 @@ fail: /* * get_cluster_table * - * for a given disk offset, load (and allocate if needed) - * the l2 table. + * f=C3=BCr eine bestimmte Platte versetzt, Last (und zuzuweisen, wenn e= rforderlich) + * die l2 Tisch. * - * the l2 table offset in the qcow2 file and the cluster index - * in the l2 table are given to the caller. + * die l2-Tabelle in der qcow2-Datei und der Cluster-Index-Offset + * in der L2-Tabelle an den Anrufer gegeben. * - * Returns 0 on success, -errno in failure case + * Gibt 0 zur=C3=BCck, bei Erfolg, -errno im Fehlerfall */ static int get_cluster_table(BlockDriverState *bs, uint64_t offset, uint64_t **new_l2_table, @@ -624,7 +632,7 @@ static int get_cluster_table(BlockDriverState *bs, ui= nt64_t offset, uint64_t *l2_table =3D NULL; int ret; =20 - /* seek to the l2 offset in the l1 table */ + /* zum l2 suchen in der l1 Tabellenoffset */ =20 l1_index =3D offset >> (s->l2_bits + s->cluster_bits); if (l1_index >=3D s->l1_size) { @@ -643,29 +651,30 @@ static int get_cluster_table(BlockDriverState *bs, = uint64_t offset, return -EIO; } =20 - /* seek the l2 table of the given l2 offset */ + /* Der L2-Tabelle des gegebenen l2 suchen Offset */ =20 if (s->l1_table[l1_index] & QCOW_OFLAG_COPIED) { - /* load the l2 table in memory */ + /* laden Sie die l2 Tabelle im Speicher */ ret =3D l2_load(bs, l2_offset, &l2_table); if (ret < 0) { return ret; } } else { - /* First allocate a new L2 table (and do COW if needed) */ + /* Zuerst weisen Sie einen neuen L2-Tabelle (und KUH tun, wenn + * erforderlich) */ ret =3D l2_allocate(bs, l1_index, &l2_table); if (ret < 0) { return ret; } =20 - /* Then decrease the refcount of the old table */ + /* Dann sinken die refcount der alten Tabelle */ if (l2_offset) { qcow2_free_clusters(bs, l2_offset, s->l2_size * sizeof(uint6= 4_t), QCOW2_DISCARD_OTHER); } } =20 - /* find the cluster offset for the given disk offset */ + /* finden Sie den Cluster f=C3=BCr die gegebene Platte Offset */ =20 l2_index =3D (offset >> s->cluster_bits) & (s->l2_size - 1); =20 @@ -678,13 +687,14 @@ static int get_cluster_table(BlockDriverState *bs, = uint64_t offset, /* * alloc_compressed_cluster_offset * - * For a given offset of the disk image, return cluster offset in - * qcow2 file. + * F=C3=BCr eine der Disk-Image angegebenen Offset, R=C3=BCck Cluster ve= rsetzt + * qcow2 Datei. * - * If the offset is not found, allocate a new compressed cluster. + * Wenn der Offset nicht gefunden wird, einen neuen komprimierten Cluste= r + * zuordnen. * - * Return the cluster offset if successful, - * Return 0, otherwise. + * Bringen Sie den Cluster-Offset, falls erfolgreich, + * Return 0, sonst. * */ =20 @@ -703,8 +713,8 @@ uint64_t qcow2_alloc_compressed_cluster_offset(BlockD= riverState *bs, return 0; } =20 - /* Compression can't overwrite anything. Fail if the cluster was alr= eady - * allocated. */ + /* Die Komprimierung kann nichts =C3=BCberschreiben. Fehlschlagen, w= enn der + * Cluster bereits war zugeordnet. */ cluster_offset =3D be64_to_cpu(l2_table[l2_index]); if (cluster_offset & L2E_OFFSET_MASK) { qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); @@ -723,9 +733,9 @@ uint64_t qcow2_alloc_compressed_cluster_offset(BlockD= riverState *bs, cluster_offset |=3D QCOW_OFLAG_COMPRESSED | ((uint64_t)nb_csectors << s->csize_shift); =20 - /* update L2 table */ + /* Update L2 Tabelle */ =20 - /* compressed clusters never have the copied flag */ + /* komprimierte Cluster haben nie die kopierte Flagge */ =20 BLKDBG_EVENT(bs->file, BLKDBG_L2_UPDATE_COMPRESSED); qcow2_cache_entry_mark_dirty(bs, s->l2_table_cache, l2_table); @@ -755,9 +765,9 @@ static int perform_cow(BlockDriverState *bs, QCowL2Me= ta *m, Qcow2COWRegion *r) } =20 /* - * Before we update the L2 table to actually point to the new cluste= r, we - * need to be sure that the refcounts have been increased and COW wa= s - * handled. + * Bevor wir die L2-Tabelle aktualisieren, um Punkt tats=C3=A4chlich= auf den + * neuen Cluster, wir m=C3=BCssen sicher sein, dass die Refcounts wu= rden erh=C3=B6ht + * und COW war abgewickelt. */ qcow2_cache_depends_on_flush(s->l2_table_cache); =20 @@ -780,7 +790,7 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs,= QCowL2Meta *m) goto err; } =20 - /* copy content of unmodified sectors */ + /* Kopie Inhalt von unmodifizierten Sektoren */ ret =3D perform_cow(bs, m, &m->cow_start); if (ret < 0) { goto err; @@ -791,7 +801,7 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs,= QCowL2Meta *m) goto err; } =20 - /* Update L2 table. */ + /* Update-L2-Tabelle. */ if (s->use_lazy_refcounts) { qcow2_mark_dirty(bs); } @@ -808,12 +818,13 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *b= s, QCowL2Meta *m) =20 assert(l2_index + m->nb_clusters <=3D s->l2_size); for (i =3D 0; i < m->nb_clusters; i++) { - /* if two concurrent writes happen to the same unallocated clust= er - * each write allocates separate cluster and writes data concurrently. - * The first one to complete updates l2 table with pointer to its - * cluster the second one has to do RMW (which is done above by - * copy_sectors()), update l2 table with its cluster pointer and free - * old cluster. This is what this loop does */ + /* wenn zwei gleichzeitige Schreiben passieren zu demselben nich= t + * zugewiesenen Cluster Jeder Schreib ordnet separaten Cluster u= nd + * schreibt gleichzeitig Daten. + * Die erste mit Zeiger-Updates l2 Tabelle zu vervollst=C3=A4ndi= gen, um + * seine Cluster die zweite hat RMW zu tun (die von oben gemacht= wird + * Copy_sectors ()), aktualisieren l2 Tabelle mit seiner Cluster= -Pointer + * und kostenlos Alten Cluster. Dies ist, was diese Schleife tut= */ if(l2_table[l2_index + i] !=3D 0) old_cluster[j++] =3D l2_table[l2_index + i]; =20 @@ -825,10 +836,12 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *b= s, QCowL2Meta *m) qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); =20 /* - * If this was a COW, we need to decrease the refcount of the old cl= uster. + * Wenn dies eine Kuh war, m=C3=BCssen wir die refcount des alten Cl= uster zu + * verringern. * - * Don't discard clusters that reach a refcount of 0 (e.g. compresse= d - * clusters), the next write will reuse them anyway. + * verwerfen Sie nicht Cluster, die eine refcount von 0 (z erreichen + * komprimiert Cluster), wird die n=C3=A4chste Schreib sie trotzdem + * wiederverwenden. */ if (j !=3D 0) { for (i =3D 0; i < j; i++) { @@ -844,9 +857,10 @@ err: } =20 /* - * Returns the number of contiguous clusters that can be used for an all= ocating - * write, but require COW to be performed (this includes yet unallocated= space, - * which must copy from the backing file) + * Gibt die Anzahl der zusammenh=C3=A4ngenden Clustern, die f=C3=BCr ein= e Aufteilung + * genutzt werden k=C3=B6nnen schreiben, aber erfordern KUH durchgef=C3=BC= hrt werden + * (dies noch nicht zugeordneten Speicherplatz umfasst, die sich aus der + * Tr=C3=A4gerdatei kopieren muss) */ static int count_cow_clusters(BDRVQcow2State *s, int nb_clusters, uint64_t *l2_table, int l2_index) @@ -878,18 +892,21 @@ out: } =20 /* - * Check if there already is an AIO write request in flight which alloca= tes - * the same cluster. In this case we need to wait until the previous - * request has completed and updated the L2 table accordingly. + * =C3=9Cberpr=C3=BCfen Sie, ob es bereits eine AIO Schreibanforderung i= m Flug ist die + * zuordnet die gleichen Cluster. In diesem Fall m=C3=BCssen wir bis zum + * vorherigen warten Anforderung abgeschlossen und die L2-Tabelle entspr= echend + * aktualisiert. * - * Returns: - * 0 if there was no dependency. *cur_bytes indicates the number= of - * bytes from guest_offset that can be read before the next - * dependency must be processed (or the request is complete) + * Kehrt zur=C3=BCck: + * 0, wenn es keine Abh=C3=A4ngigkeit. * Cur_bytes gibt die Anzahl der + * Bytes von guest_offset die vor der n=C3=A4chsten gelesen we= rden kann, + * Abh=C3=A4ngigkeit verarbeitet werden m=C3=BCssen (oder die = Anforderung + * abgeschlossen ist) * - * -EAGAIN if we had to wait for another request, previously gathered - * information on cluster allocation may be invalid now. The c= aller - * must start over anyway, so consider *cur_bytes undefined. + * -EAGAIN, Wenn wir f=C3=BCr eine andere Anforderung warten mussten, = die zuvor + * gesammelt Informationen =C3=BCber Cluster Zuordnung kann n= un + * ung=C3=BCltig. Der Anrufer von vorn beginnen m=C3=BCssen s= owieso, also + * betrachten *cur_bytes undefiniert. */ static int handle_dependencies(BlockDriverState *bs, uint64_t guest_offs= et, uint64_t *cur_bytes, QCowL2Meta **m) @@ -906,27 +923,29 @@ static int handle_dependencies(BlockDriverState *bs= , uint64_t guest_offset, uint64_t old_end =3D l2meta_cow_end(old_alloc); =20 if (end <=3D old_start || start >=3D old_end) { - /* No intersection */ + /* keinen Schnittpunkt */ } else { if (start < old_start) { - /* Stop at the start of a running allocation */ + /* Stoppen Sie zu Beginn eines laufenden Zuteilungs */ bytes =3D old_start - start; } else { bytes =3D 0; } =20 - /* Stop if already an l2meta exists. After yielding, it woul= dn't - * be valid any more, so we'd have to clean up the old L2Met= as - * and deal with requests depending on them before starting = to - * gather new ones. Not worth the trouble. */ + /* Stoppen Sie, wenn bereits ein l2meta existiert. Nach dem + * Nachgeben, w=C3=A4re es nicht G=C3=BCltigkeit mehr, so w=C3= =BCrden wir die + * alten L2Metas aufr=C3=A4umen m=C3=BCssen und besch=C3=A4f= tigen sich mit + * Anfragen je nach ihnen vor dem Start zu sammeln neue. Nic= ht + * der M=C3=BChe wert. */ if (bytes =3D=3D 0 && *m) { *cur_bytes =3D 0; return 0; } =20 if (bytes =3D=3D 0) { - /* Wait for the dependency to complete. We need to reche= ck - * the free/allocated clusters when we continue. */ + /* Warten Sie, die Abh=C3=A4ngigkeit zu vervollst=C3=A4n= digen. Wir + * m=C3=BCssen noch einmal zu =C3=BCberpr=C3=BCfen die f= reien / belegte + * Cluster, wenn wir weiter. */ qemu_co_mutex_unlock(&s->lock); qemu_co_queue_wait(&old_alloc->dependent_requests); qemu_co_mutex_lock(&s->lock); @@ -935,34 +954,36 @@ static int handle_dependencies(BlockDriverState *bs= , uint64_t guest_offset, } } =20 - /* Make sure that existing clusters and new allocations are only use= d up to - * the next dependency if we shortened the request above */ + /* Stellen Sie sicher, dass die bestehenden Cluster und neue Zuweisu= ngen + * nur bis verwendet werden, um die n=C3=A4chste Abh=C3=A4ngigkeit, = wenn wir die + * Anfrage =C3=BCber verk=C3=BCrzt */ *cur_bytes =3D bytes; =20 return 0; } =20 /* - * Checks how many already allocated clusters that don't require a copy = on - * write there are at the given guest_offset (up to *bytes). If - * *host_offset is not zero, only physically contiguous clusters beginni= ng at - * this host offset are counted. + * Pr=C3=BCft, wie viele bereits zugewiesenen Cluster, die nicht =C3=BCb= er eine + * Kopie ben=C3=B6tigen auf schreiben gibt es bei der gegebenen guest_of= fset (bis zu + * *bytes). Ob *host_offset nicht Null ist, nur physikalisch zusammenh=C3= =A4ngenden + * Clustern auf Anfang Diesen Gastgeber versetzt sind gez=C3=A4hlt. * - * Note that guest_offset may not be cluster aligned. In this case, the - * returned *host_offset points to exact byte referenced by guest_offset= and - * therefore isn't cluster aligned as well. + * Beachten Sie, dass guest_offset nicht Cluster ausgerichtet werden k=C3= =B6nnen. In + * diesem Fall ist die zur=C3=BCck *host_offset Punkte auf genaue Byte v= on + * guest_offset verwiesen und deshalb wird nicht als gut ausgerichtet Cl= uster. * - * Returns: - * 0: if no allocated clusters are available at the given offset. - * *bytes is normally unchanged. It is set to 0 if the cluster - * is allocated and doesn't need COW, but doesn't have the righ= t - * physical offset. + * Kehrt zur=C3=BCck: + * 0: wenn keine zugewiesenen Cluster sind unter den gegebenen Offset. + * * Bytes ist in der Regel unver=C3=A4ndert. Es wird auf 0 ges= etzt, wenn + * der Cluster zugeordnet ist und nicht COW brauchen, aber nich= t das + * Recht haben, physikalischen Offset. * - * 1: if allocated clusters that don't require a COW are available= at - * the requested offset. *bytes may have decreased and describe= s - * the length of the area that can be written to. + * 1: wenn zugewiesen Cluster, die zur Verf=C3=BCgung stehen Sie nicht= eine Kuh + * erfordern bei die angeforderten versetzt. * Bytes verringert= haben + * kann und beschreibt die L=C3=A4nge der Fl=C3=A4che, die gesc= hrieben werden + * kann. * - * -errno: in error cases + * -errno: im Fehlerfall */ static int handle_copied(BlockDriverState *bs, uint64_t guest_offset, uint64_t *host_offset, uint64_t *bytes, QCowL2Meta **m) @@ -982,8 +1003,8 @@ static int handle_copied(BlockDriverState *bs, uint6= 4_t guest_offset, =3D=3D offset_into_cluster(s, *host_offs= et)); =20 /* - * Calculate the number of clusters to look for. We stop at L2 table - * boundaries to keep things simple. + * Berechne die Anzahl der Cluster zu suchen. Wir halten an L2-Tabel= le + * Grenzen Dinge einfach zu halten. */ nb_clusters =3D size_to_clusters(s, offset_into_cluster(s, guest_offset) + *byte= s); @@ -992,7 +1013,7 @@ static int handle_copied(BlockDriverState *bs, uint6= 4_t guest_offset, nb_clusters =3D MIN(nb_clusters, s->l2_size - l2_index); assert(nb_clusters <=3D INT_MAX); =20 - /* Find L2 entry for the first involved cluster */ + /* Finden L2-Eintrag f=C3=BCr den ersten beteiligten Cluster */ ret =3D get_cluster_table(bs, guest_offset, &l2_table, &l2_index); if (ret < 0) { return ret; @@ -1000,11 +1021,12 @@ static int handle_copied(BlockDriverState *bs, ui= nt64_t guest_offset, =20 cluster_offset =3D be64_to_cpu(l2_table[l2_index]); =20 - /* Check how many clusters are already allocated and don't need COW = */ + /* =C3=9Cberpr=C3=BCfen Sie, wie viele Cluster bereits zugeordnet si= nd und nicht COW + * brauchen */ if (qcow2_get_cluster_type(cluster_offset) =3D=3D QCOW2_CLUSTER_NORM= AL && (cluster_offset & QCOW_OFLAG_COPIED)) { - /* If a specific host_offset is required, check it */ + /* Wenn eine bestimmte host_offset erforderlich ist, =C3=BCberpr= =C3=BCfen */ bool offset_matches =3D (cluster_offset & L2E_OFFSET_MASK) =3D=3D *host_offset; =20 @@ -1023,7 +1045,7 @@ static int handle_copied(BlockDriverState *bs, uint= 64_t guest_offset, goto out; } =20 - /* We keep all QCOW_OFLAG_COPIED clusters */ + /* Wir halten alle QCOW_OFLAG_COPIED Cluster */ keep_clusters =3D count_contiguous_clusters(nb_clusters, s->cluster_size, &l2_table[l2_index], @@ -1039,12 +1061,13 @@ static int handle_copied(BlockDriverState *bs, ui= nt64_t guest_offset, ret =3D 0; } =20 - /* Cleanup */ + /* Aufr=C3=A4umen */ out: qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); =20 - /* Only return a host offset if we actually made progress. Otherwise= we - * would make requirements for handle_alloc() that it can't fulfill = */ + /* Nur geben einen Host-Offset, wenn wir tats=C3=A4chlich Fortschrit= te gemacht. + * Ansonsten wir machen Anforderungen f=C3=BCr handle_alloc w=C3=BCr= de (), dass es + * nicht erf=C3=BCllen kann */ if (ret > 0) { *host_offset =3D (cluster_offset & L2E_OFFSET_MASK) + offset_into_cluster(s, guest_offset); @@ -1054,23 +1077,24 @@ out: } =20 /* - * Allocates new clusters for the given guest_offset. + * Ordnet neuen Cluster f=C3=BCr die gegebene guest_offset. * - * At most *nb_clusters are allocated, and on return *nb_clusters is upd= ated to - * contain the number of clusters that have been allocated and are conti= guous - * in the image file. + * Bei den meisten *nb_clusters zugeordnet sind, und bei der R=C3=BCckke= hr + * *nb_clusters wird aktualisiert enthalten, um die Anzahl von Clustern,= die + * zugewiesen worden sind und zusammenh=C3=A4ngende in der Bilddatei. * - * If *host_offset is non-zero, it specifies the offset in the image fil= e at - * which the new clusters must start. *nb_clusters can be 0 on return in= this - * case if the cluster at host_offset is already in use. If *host_offset= is - * zero, the clusters can be allocated anywhere in the image file. + * Wenn *host_offset nicht Null ist, gibt es den Versatz in der Bilddate= i an + * die die neuen Cluster beginnen. *nb_clusters kann 0 auf R=C3=BCckkehr= in das sein + * Fall, wenn der Cluster bei host_offset bereits im Einsatz ist. Wenn + * *host_offset ist Null ist, k=C3=B6nnen die Cluster =C3=BCberall in de= r Bilddatei + * zugeordnet werden. * - * *host_offset is updated to contain the offset into the image file at = which - * the first allocated cluster starts. + * *host_offset aktualisiert wird der Versatz in die Bilddatei zu enthal= ten, an + * denen der erste zugewiesen Cluster beginnt. * - * Return 0 on success and -errno in error cases. -EAGAIN means that the - * function has been waiting for another request and the allocation must= be - * restarted, but the whole request should not be failed. + * Zur=C3=BCck 0 bei Erfolg und -errno in Fehlerf=C3=A4llen. -EAGAIN Bed= eutet, dass die + * Funktion wurde f=C3=BCr eine weitere Anforderung warten, und die Zute= ilung muss + * sein neu gestartet, aber die ganze Anforderung sollte nicht vers=C3=A4= umt werden. */ static int do_alloc_cluster_offset(BlockDriverState *bs, uint64_t guest_= offset, uint64_t *host_offset, uint64_t *nb_c= lusters) @@ -1080,7 +1104,7 @@ static int do_alloc_cluster_offset(BlockDriverState= *bs, uint64_t guest_offset, trace_qcow2_do_alloc_clusters_offset(qemu_coroutine_self(), guest_of= fset, *host_offset, *nb_clusters); =20 - /* Allocate new clusters */ + /* Ordnen Sie neue Cluster */ trace_qcow2_cluster_alloc_phys(qemu_coroutine_self()); if (*host_offset =3D=3D 0) { int64_t cluster_offset =3D @@ -1101,24 +1125,25 @@ static int do_alloc_cluster_offset(BlockDriverSta= te *bs, uint64_t guest_offset, } =20 /* - * Allocates new clusters for an area that either is yet unallocated or = needs a - * copy on write. If *host_offset is non-zero, clusters are only allocat= ed if - * the new allocation can match the specified host offset. + * Ordnet neue Cluster f=C3=BCr einen Bereich, der entweder noch nicht z= ugeteilten + * oder muss ein Kopieren beim Schreiben. Wenn *host_offset nicht Null i= st, + * werden nur Cluster zugeordnet, wenn die neue Zuordnung kann den angeg= ebenen + * Host-Offset entsprechen. * - * Note that guest_offset may not be cluster aligned. In this case, the - * returned *host_offset points to exact byte referenced by guest_offset= and - * therefore isn't cluster aligned as well. + * Beachten Sie, dass guest_offset nicht Cluster ausgerichtet werden k=C3= =B6nnen. + * In diesem Fall ist die zur=C3=BCck *host_offset Punkte auf genaue Byt= e von + * guest_offset verwiesen und deshalb wird nicht als gut ausgerichtet Cl= uster. * - * Returns: - * 0: if no clusters could be allocated. *bytes is set to 0, - * *host_offset is left unchanged. + * Kehrt zur=C3=BCck: + * 0: wenn keine Cluster zugeordnet werden konnten. *bytes auf 0 geset= zt ist, + * *host_offset bleibt unver=C3=A4ndert. * - * 1: if new clusters were allocated. *bytes may be decreased if t= he - * new allocation doesn't cover all of the requested area. - * *host_offset is updated to contain the host offset of the fi= rst - * newly allocated cluster. + * 1: wenn neue Cluster zugeteilt wurden. *bytes, wenn die verringert = werden + * Neubestimmung deckt nicht alle angeforderten Bereich. + * *host_offset wird aktualisiert, um den Host zu enthalten Off= set des + * ersten neu zugewiesenen Cluster. * - * -errno: in error cases + * -errno: im Fehlerfall */ static int handle_alloc(BlockDriverState *bs, uint64_t guest_offset, uint64_t *host_offset, uint64_t *bytes, QCowL2Meta **m) @@ -1137,8 +1162,8 @@ static int handle_alloc(BlockDriverState *bs, uint6= 4_t guest_offset, assert(*bytes > 0); =20 /* - * Calculate the number of clusters to look for. We stop at L2 table - * boundaries to keep things simple. + * Berechne die Anzahl der Cluster zu suchen. Wir halten an L2-Tabel= le + * Grenzen Dinge einfach zu halten. */ nb_clusters =3D size_to_clusters(s, offset_into_cluster(s, guest_offset) + *byte= s); @@ -1147,7 +1172,7 @@ static int handle_alloc(BlockDriverState *bs, uint6= 4_t guest_offset, nb_clusters =3D MIN(nb_clusters, s->l2_size - l2_index); assert(nb_clusters <=3D INT_MAX); =20 - /* Find L2 entry for the first involved cluster */ + /* Finden L2-Eintrag f=C3=BCr den ersten beteiligten Cluster */ ret =3D get_cluster_table(bs, guest_offset, &l2_table, &l2_index); if (ret < 0) { return ret; @@ -1155,21 +1180,21 @@ static int handle_alloc(BlockDriverState *bs, uin= t64_t guest_offset, =20 entry =3D be64_to_cpu(l2_table[l2_index]); =20 - /* For the moment, overwrite compressed clusters one by one */ + /* Im Moment =C3=BCberschreiben eine komprimierte Cluster durch ein = */ if (entry & QCOW_OFLAG_COMPRESSED) { nb_clusters =3D 1; } else { nb_clusters =3D count_cow_clusters(s, nb_clusters, l2_table, l2_= index); } =20 - /* This function is only called when there were no non-COW clusters,= so if - * we can't find any unallocated or COW clusters either, something i= s - * wrong with our code. */ + /* Diese Funktion wird nur aufgerufen, wenn es keine nicht-COW Clust= er + * wurden, so dass, wenn k=C3=B6nnen wir keine nicht zugeteilter ode= r + * COW Cluster entweder finden, ist etwas mit unserem Code falsch. *= / assert(nb_clusters > 0); =20 qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); =20 - /* Allocate, if necessary at a given offset in the image file */ + /* Ordnen Sie bei Bedarf auf eine in der Bilddatei angegebenen Offse= t */ alloc_cluster_offset =3D start_of_cluster(s, *host_offset); ret =3D do_alloc_cluster_offset(bs, guest_offset, &alloc_cluster_off= set, &nb_clusters); @@ -1177,16 +1202,16 @@ static int handle_alloc(BlockDriverState *bs, uin= t64_t guest_offset, goto fail; } =20 - /* Can't extend contiguous allocation */ + /* Kann nicht zusammenh=C3=A4ngende Zuordnung erweitern */ if (nb_clusters =3D=3D 0) { *bytes =3D 0; return 0; } =20 - /* !*host_offset would overwrite the image header and is reserved fo= r "no - * host offset preferred". If 0 was a valid host offset, it'd trigge= r the - * following overlap check; do that now to avoid having an invalid v= alue in - * *host_offset. */ + /* ! * Host_offset w=C3=BCrde das Bild Header =C3=BCberschreiben und= ist reserviert + * f=C3=BCr "no Offset bevorzugt "Host. Wenn 0 wurde ein g=C3=BCltig= er Host-Offset, + * es w=C3=BCrde ausl=C3=B6sen die folgende =C3=9Cberlappungspr=C3=BC= fung; tun Sie das jetzt + * zu vermeiden, einen ung=C3=BCltigen Wert, in *host_offset. */ if (!alloc_cluster_offset) { ret =3D qcow2_pre_write_overlap_check(bs, 0, alloc_cluster_offse= t, nb_clusters * s->cluster_siz= e); @@ -1195,18 +1220,18 @@ static int handle_alloc(BlockDriverState *bs, uin= t64_t guest_offset, } =20 /* - * Save info needed for meta data update. + * Speichern Sie Informationen f=C3=BCr die Meta-Daten-Update erford= erlich. * - * requested_sectors: Number of sectors from the start of the first - * newly allocated cluster to the end of the (possibly shortened - * before) write request. + * requested_sectors: Anzahl der Sektoren vom Anfang des ersten + * neu Cluster zum Ende der zugewiesenen (m=C3=B6glicherweise verk=C3= =BCrzten + * vor) Schreibanforderung. * - * avail_sectors: Number of sectors from the start of the first - * newly allocated to the end of the last newly allocated cluster. + * avail_sectors: Anzahl der Sektoren vom Anfang des ersten + * bis zum Ende des letzten neu zugewiesenen Cluster neu zugeordnet. * - * nb_sectors: The number of sectors from the start of the first - * newly allocated cluster to the end of the area that the write - * request actually writes to (excluding COW at the end) + * nb_sectors: die Anzahl von Sektoren vom Beginn der ersten + * neu Cluster mit dem Ende des Bereichs, der die Schreib- zugeordne= t + * Anfrage tats=C3=A4chlich schreibt (mit Ausnahme von COW am Ende) */ int requested_sectors =3D (*bytes + offset_into_cluster(s, guest_offset)) @@ -1257,21 +1282,23 @@ fail: /* * alloc_cluster_offset * - * For a given offset on the virtual disk, find the cluster offset in qc= ow2 - * file. If the offset is not found, allocate a new cluster. + * F=C3=BCr eine auf dem virtuellen Laufwerk angegebenen Offset, finden = Sie den + * Cluster in qcow2 Offset Datei. Wenn der Offset nicht gefunden wird, e= inen + * neuen Cluster zuordnen. * - * If the cluster was already allocated, m->nb_clusters is set to 0 and - * other fields in m are meaningless. + * Wenn der Cluster wurde bereits vergeben, m-> nb_clusters auf 0 gesetz= t ist + * und andere Felder in m sind bedeutungslos. * - * If the cluster is newly allocated, m->nb_clusters is set to the numbe= r of - * contiguous clusters that have been allocated. In this case, the other - * fields of m are valid and contain information about the first allocat= ed - * cluster. + * Wenn der Cluster neu zugeordnet wird, m-> nb_clusters bis die Anzahl = der + * gesetzten zusammenh=C3=A4ngenden Clustern, die zugewiesen worden sind= . In diesem + * Fall wird der andere Felder m g=C3=BCltig und enthalten Informationen= =C3=BCber den + * ersten zugewiesenen Cluster. * - * If the request conflicts with another write request in flight, the co= routine - * is queued and will be reentered when the dependency has completed. + * Wenn die Anforderung in Konflikt mit einem anderen Schreibanforderung= im + * Flug, die Koroutine Warteschlange und wird erneut eingegeben werden, = wenn + * die Abh=C3=A4ngigkeit abgeschlossen hat. * - * Return 0 on success and -errno in error cases + * Zur=C3=BCck 0 bei Erfolg und -errno im Fehlerfall */ int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, int *num, uint64_t *host_offset, QCowL2Meta **m) @@ -1313,28 +1340,30 @@ again: cur_bytes =3D remaining; =20 /* - * Now start gathering as many contiguous clusters as possible: + * Starten Sie nun so viele zusammenh=C3=A4ngende Cluster wie m=C3= =B6glich zu + * sammeln: * - * 1. Check for overlaps with in-flight allocations + * 1. =C3=9Cberpr=C3=BCfen Sie, ob =C3=9Cberschneidungen mit in-= flight Zuweisungen * - * a) Overlap not in the first cluster -> shorten this requ= est and - * let the caller handle the rest in its next loop itera= tion. + * a) Overlap nicht im ersten Cluster -> verk=C3=BCrzen die= se + * Anforderung und lassen Sie den Anrufer, den Rest in s= einer + * n=C3=A4chsten Schleifeniterationslatenzzeit behandeln= . * - * b) Real overlaps of two requests. Yield and restart the = search - * for contiguous clusters (the situation could have cha= nged - * while we were sleeping) + * b) Echt =C3=9Cberschneidungen von zwei Anfragen. Ausbeut= e und + * starten Sie die Suche f=C3=BCr zusammenh=C3=A4ngende = Cluster (k=C3=B6nnte + * sich die Situation ge=C3=A4ndert haben w=C3=A4hrend w= ir schliefen) * - * c) TODO: Request starts in the same cluster as the in-fl= ight - * allocation ends. Shorten the COW of the in-fight allo= cation, - * set cluster_offset to write to the same cluster and s= et up - * the right synchronisation between the in-flight reque= st and - * the new one. + * c) TODO: Anfrage startet im gleichen Cluster wie der in-= flight + * Zuordnung endet. Verk=C3=BCrzen Sie die Kuh der in-Ka= mpf + * Zuweisung, set cluster_offset zu demselben Cluster zu + * schreiben und einrichten die richtige Synchronisation + * zwischen dem In-Flight-Anfrage und der neue. */ ret =3D handle_dependencies(bs, start, &cur_bytes, m); if (ret =3D=3D -EAGAIN) { - /* Currently handle_dependencies() doesn't yield if we alrea= dy had - * an allocation. If it did, we would have to clean up the L= 2Meta - * structs before starting over. */ + /* Derzeit handle_dependencies () nicht nachgibt, wenn wir + * bereits hatten eine Zuordnung. Wenn ja, w=C3=BCrden wir d= ie L2Meta + * aufr=C3=A4umen m=C3=BCssen structs vor dem Start =C3=BCbe= r. */ assert(*m =3D=3D NULL); goto again; } else if (ret < 0) { @@ -1342,13 +1371,13 @@ again: } else if (cur_bytes =3D=3D 0) { break; } else { - /* handle_dependencies() may have decreased cur_bytes (short= ened - * the allocations below) so that the next dependency is pro= cessed - * correctly during the next loop iteration. */ + /* handle_dependencies () haben cur_bytes vermindert (verk=C3= =BCrzt + * die Zuordnungen unten), so dass die n=C3=A4chste Abh=C3=A4= ngigkeits + * verarbeitet wird richtig bei der n=C3=A4chsten Iteration.= */ } =20 /* - * 2. Count contiguous COPIED clusters. + * 2. Graf zusammenh=C3=A4ngenden COPIED Cluster. */ ret =3D handle_copied(bs, start, &cluster_offset, &cur_bytes, m)= ; if (ret < 0) { @@ -1360,8 +1389,9 @@ again: } =20 /* - * 3. If the request still hasn't completed, allocate new cluste= rs, - * considering any cluster_offset of steps 1c or 2. + * 3. Wird der Antrag noch nicht abgeschlossen hat, teilt neue C= luster, + * jede cluster_offset von Schritten 1c oder 2 unter + * Ber=C3=BCcksichtigung. */ ret =3D handle_alloc(bs, start, &cluster_offset, &cur_bytes, m); if (ret < 0) { @@ -1435,9 +1465,9 @@ int qcow2_decompress_cluster(BlockDriverState *bs, = uint64_t cluster_offset) } =20 /* - * This discards as many clusters of nb_clusters as possible at once (i.= e. - * all clusters in the same L2 table) and returns the number of discarde= d - * clusters. + * Dies wirft so viele Cluster von nb_clusters wie m=C3=B6glich auf einm= al (das + * hei=C3=9Ft alle Cluster in demselben L2-Tabelle) und gibt die Anzahl = der + * verworfenen Cluster. */ static int discard_single_l2(BlockDriverState *bs, uint64_t offset, uint64_t nb_clusters, enum qcow2_discard_ty= pe type, @@ -1454,7 +1484,7 @@ static int discard_single_l2(BlockDriverState *bs, = uint64_t offset, return ret; } =20 - /* Limit nb_clusters to one L2 table */ + /* Limit nb_clusters einem L2-Tabelle */ nb_clusters =3D MIN(nb_clusters, s->l2_size - l2_index); assert(nb_clusters <=3D INT_MAX); =20 @@ -1464,17 +1494,18 @@ static int discard_single_l2(BlockDriverState *bs= , uint64_t offset, old_l2_entry =3D be64_to_cpu(l2_table[l2_index + i]); =20 /* - * If full_discard is false, make sure that a discarded area rea= ds back - * as zeroes for v3 images (we cannot do it for v2 without actua= lly - * writing a zero-filled buffer). We can skip the operation if t= he - * cluster is already marked as zero, or if it's unallocated and= we - * don't have a backing file. + * Wenn full_discard falsch ist, stellen Sie sicher, dass eine + * weggeworfene Bereich zur=C3=BCck liest als Nullen f=C3=BCr v3= Bilder (wir es + * f=C3=BCr v2 nicht tun k=C3=B6nnen, ohne tats=C3=A4chlich eine= Null-gef=C3=BCllten + * Puffer zu schreiben). Wir k=C3=B6nnen den Vorgang =C3=BCbersp= ringen, wenn die + * Cluster ist bereits als Null markiert, oder wenn es nicht zug= ewiesen + * und wir nicht eine Tr=C3=A4gerdatei. * - * TODO We might want to use bdrv_get_block_status(bs) here, but= we're - * holding s->lock, so that doesn't work today. + * TODO Wir k=C3=B6nnten hier bdrv_get_block_status (bs) verwend= en m=C3=B6chten, + * aber wir sind Halten s-> sperren, so dass nicht heute arbeite= n. * - * If full_discard is true, the sector should not read back as z= eroes, - * but rather fall through to the backing file. + * Wenn full_discard wahr ist, sollte der Sektor nicht als Nulle= n + * zur=C3=BCckgelesen, sondern fallen durch auf die Tr=C3=A4gerd= atei. */ switch (qcow2_get_cluster_type(old_l2_entry)) { case QCOW2_CLUSTER_UNALLOCATED: @@ -1497,7 +1528,7 @@ static int discard_single_l2(BlockDriverState *bs, = uint64_t offset, abort(); } =20 - /* First remove L2 entries */ + /* Entfernen Sie zuerst L2 Eintr=C3=A4ge */ qcow2_cache_entry_mark_dirty(bs, s->l2_table_cache, l2_table); if (!full_discard && s->qcow_version >=3D 3) { l2_table[l2_index + i] =3D cpu_to_be64(QCOW_OFLAG_ZERO); @@ -1505,7 +1536,7 @@ static int discard_single_l2(BlockDriverState *bs, = uint64_t offset, l2_table[l2_index + i] =3D cpu_to_be64(0); } =20 - /* Then decrease the refcount */ + /* Dann sinken die refcount */ qcow2_free_any_clusters(bs, old_l2_entry, 1, type); } =20 @@ -1524,7 +1555,7 @@ int qcow2_discard_clusters(BlockDriverState *bs, ui= nt64_t offset, =20 end_offset =3D offset + (nb_sectors << BDRV_SECTOR_BITS); =20 - /* Round start up and end down */ + /* Start-Runde und am Ende nach unten */ offset =3D align_offset(offset, s->cluster_size); end_offset =3D start_of_cluster(s, end_offset); =20 @@ -1536,7 +1567,8 @@ int qcow2_discard_clusters(BlockDriverState *bs, ui= nt64_t offset, =20 s->cache_discards =3D true; =20 - /* Each L2 table is handled by its own loop iteration */ + /* Jeder L2-Tabelle wird durch eine eigene Schleifeniterationslatenz= zeit + * behandelt */ while (nb_clusters > 0) { ret =3D discard_single_l2(bs, offset, nb_clusters, type, full_di= scard); if (ret < 0) { @@ -1556,9 +1588,9 @@ fail: } =20 /* - * This zeroes as many clusters of nb_clusters as possible at once (i.e. - * all clusters in the same L2 table) and returns the number of zeroed - * clusters. + * Diese Nullen wie viele Cluster von nb_clusters wie m=C3=B6glich auf e= inmal (das + * hei=C3=9Ft alle Cluster in demselben L2-Tabelle) und gibt die Anzahl = der + * genullten Cluster. */ static int zero_single_l2(BlockDriverState *bs, uint64_t offset, uint64_t nb_clusters) @@ -1574,7 +1606,7 @@ static int zero_single_l2(BlockDriverState *bs, uin= t64_t offset, return ret; } =20 - /* Limit nb_clusters to one L2 table */ + /* Limit nb_clusters einem L2-Tabelle */ nb_clusters =3D MIN(nb_clusters, s->l2_size - l2_index); assert(nb_clusters <=3D INT_MAX); =20 @@ -1583,7 +1615,7 @@ static int zero_single_l2(BlockDriverState *bs, uin= t64_t offset, =20 old_offset =3D be64_to_cpu(l2_table[l2_index + i]); =20 - /* Update L2 entries */ + /* Update-L2-Eintr=C3=A4ge */ qcow2_cache_entry_mark_dirty(bs, s->l2_table_cache, l2_table); if (old_offset & QCOW_OFLAG_COMPRESSED) { l2_table[l2_index + i] =3D cpu_to_be64(QCOW_OFLAG_ZERO); @@ -1604,12 +1636,13 @@ int qcow2_zero_clusters(BlockDriverState *bs, uin= t64_t offset, int nb_sectors) uint64_t nb_clusters; int ret; =20 - /* The zero flag is only supported by version 3 and newer */ + /* Die Null-Flag wird nur von Version 3 und h=C3=B6her unterst=C3=BC= tzt */ if (s->qcow_version < 3) { return -ENOTSUP; } =20 - /* Each L2 table is handled by its own loop iteration */ + /* Jeder L2-Tabelle wird durch eine eigene Schleifeniterationslatenz= zeit + * behandelt */ nb_clusters =3D size_to_clusters(s, nb_sectors << BDRV_SECTOR_BITS); =20 s->cache_discards =3D true; @@ -1633,12 +1666,12 @@ fail: } =20 /* - * Expands all zero clusters in a specific L1 table (or deallocates them= , for - * non-backed non-pre-allocated zero clusters). + * Erweitert alle Null-Cluster in einem bestimmten L1-Tabelle (oder frei= gibt + * sie, f=C3=BCr nicht gesicherte nicht vorab zugewiesen Null-Cluster). * - * l1_entries and *visited_l1_entries are used to keep track of progress= for - * status_cb(). l1_entries contains the total number of L1 entries and - * *visited_l1_entries counts all visited L1 entries. + * l1_entries und *visited_l1_entries werden benutzt, um die Fortschritt= e zu + * halten f=C3=BCr status_cb (). l1_entries enth=C3=A4lt die Gesamtzahl = der L1-Eintr=C3=A4ge + * und *visited_l1_entries z=C3=A4hlt alle besuchten L1-Eintr=C3=A4ge. */ static int expand_zero_clusters_in_l1(BlockDriverState *bs, uint64_t *l1= _table, int l1_size, int64_t *visited_l1_e= ntries, @@ -1653,8 +1686,8 @@ static int expand_zero_clusters_in_l1(BlockDriverSt= ate *bs, uint64_t *l1_table, int i, j; =20 if (!is_active_l1) { - /* inactive L2 tables require a buffer to be stored in when load= ing - * them from disk */ + /* inaktiv L2 Tabellen erfordern einen Puffer gespeichert werden= , beim + * Laden sie von der Festplatte */ l2_table =3D qemu_try_blockalign(bs->file->bs, s->cluster_size); if (l2_table =3D=3D NULL) { return -ENOMEM; @@ -1667,7 +1700,7 @@ static int expand_zero_clusters_in_l1(BlockDriverSt= ate *bs, uint64_t *l1_table, uint64_t l2_refcount; =20 if (!l2_offset) { - /* unallocated */ + /* nicht zugeteilt */ (*visited_l1_entries)++; if (status_cb) { status_cb(bs, *visited_l1_entries, l1_entries, cb_opaque= ); @@ -1684,11 +1717,11 @@ static int expand_zero_clusters_in_l1(BlockDriver= State *bs, uint64_t *l1_table, } =20 if (is_active_l1) { - /* get active L2 tables from cache */ + /* Sie aktiv L2-Tabellen aus dem Cache */ ret =3D qcow2_cache_get(bs, s->l2_table_cache, l2_offset, (void **)&l2_table); } else { - /* load inactive L2 tables from disk */ + /* laden inaktiv L2 Tabellen von der Festplatte */ ret =3D bdrv_read(bs->file->bs, l2_offset / BDRV_SECTOR_SIZE= , (void *)l2_table, s->cluster_sectors); } @@ -1714,8 +1747,8 @@ static int expand_zero_clusters_in_l1(BlockDriverSt= ate *bs, uint64_t *l1_table, =20 if (!preallocated) { if (!bs->backing) { - /* not backed; therefore we can simply deallocate th= e - * cluster */ + /* nicht gesichert; Daher k=C3=B6nnen wir einfach di= e freigeben + * Gruppe */ l2_table[j] =3D 0; l2_dirty =3D true; continue; @@ -1728,8 +1761,9 @@ static int expand_zero_clusters_in_l1(BlockDriverSt= ate *bs, uint64_t *l1_table, } =20 if (l2_refcount > 1) { - /* For shared L2 tables, set the refcount accordingl= y (it is - * already 1 and needs to be l2_refcount) */ + /* F=C3=BCr L2 Tabellen gemeinsam genutzt, stellen S= ie die + * refcount entsprechend (es ist 1 bereits und muss + * l2_refcount) */ ret =3D qcow2_update_cluster_refcount(bs, offset >> s->cluster_bits, refcount_diff(1, l2_refcount), false, @@ -1825,10 +1859,11 @@ fail: } =20 /* - * For backed images, expands all zero clusters on the image. For non-ba= cked - * images, deallocates all non-pre-allocated zero clusters (and claims t= he - * allocation for pre-allocated ones). This is important for downgrading= to a - * qcow2 version which doesn't yet support metadata zero clusters. + * F=C3=BCr gesicherte Bilder, dehnt sich alle Null-Cluster auf das Bild= . F=C3=BCr nicht + * gesichert Bilder, freigibt alle nicht im Voraus zugewiesenen Null-Clu= ster + * (und behauptet, die Zuteilung f=C3=BCr vorab zugewiesen sind). Dies i= st wichtig, + * zu einer Herabstufung qcow2 Version, die noch keine Metadaten Null-Cl= uster + * unterst=C3=BCtzen. */ int qcow2_expand_zero_clusters(BlockDriverState *bs, BlockDriverAmendStatusCB *status_cb, @@ -1854,13 +1889,14 @@ int qcow2_expand_zero_clusters(BlockDriverState *= bs, goto fail; } =20 - /* Inactive L1 tables may point to active L2 tables - therefore it i= s - * necessary to flush the L2 table cache before trying to access the= L2 - * tables pointed to by inactive L1 entries (else we might try to ex= pand - * zero clusters that have already been expanded); furthermore, it i= s also - * necessary to empty the L2 table cache, since it may contain table= s which - * are now going to be modified directly on disk, bypassing the cach= e. - * qcow2_cache_empty() does both for us. */ + /* Inaktive L1 Tabellen aktiv L2 Tabellen zeigen kann - daher ist es + * notwendig, um die L2-Tabelle Cache zu leeren, bevor Sie den L2 + * zuzugreifen versuchen, Tabellen, auf den inaktiven L1-Eintr=C3=A4= ge (sonst + * versuchen wir vielleicht zu erweitern Null-Cluster, die bereits + * erweitert haben); Weiterhin ist es auch notwendig, um die + * L2 Tabellen-Cache zu leeren, da es Tabellen enthalten, die werden + * jetzt direkt auf der Festplatte ge=C3=A4ndert werden, um den Cach= e zu + * umgehen. qcow2_cache_empty () wird beides f=C3=BCr uns. */ ret =3D qcow2_cache_empty(bs, s->l2_table_cache); if (ret < 0) { goto fail; diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index ca6094f..fe83b07 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -80,7 +80,7 @@ static Qcow2SetRefcountFunc *const set_refcount_funcs[]= =3D { =20 =20 /*********************************************************/ -/* refcount handling */ +/* refcount Handhabung */ =20 int qcow2_refcount_init(BlockDriverState *bs) { @@ -227,8 +227,8 @@ static int load_refcount_block(BlockDriverState *bs, } =20 /* - * Retrieves the refcount of the cluster given by its index and stores i= t in - * *refcount. Returns 0 on success and -errno on failure. + * Ermittelt die refcount des Clusters durch seinen Index gegeben und sp= eichert + * sie in *refcount. Gibt bei Erfolg 0 und -errno bei einem Fehler. */ int qcow2_get_refcount(BlockDriverState *bs, int64_t cluster_index, uint64_t *refcount) @@ -273,8 +273,8 @@ int qcow2_get_refcount(BlockDriverState *bs, int64_t = cluster_index, } =20 /* - * Rounds the refcount table size up to avoid growing the table for each= single - * refcount block that is allocated. + * Runden der refcount Tischgr=C3=B6=C3=9Fe bis f=C3=BCr jeden einzelnen= w=C3=A4chst die Tabelle + * zu vermeiden refcount Block, der zugeordnet ist. */ static unsigned int next_refcount_table_size(BDRVQcow2State *s, unsigned int min_size) @@ -291,7 +291,7 @@ static unsigned int next_refcount_table_size(BDRVQcow= 2State *s, } =20 =20 -/* Checks if two offsets are described by the same refcount block */ +/* Pr=C3=BCft, ob zwei Offsets durch den gleichen refcount Block beschri= eben */ static int in_same_refcount_block(BDRVQcow2State *s, uint64_t offset_a, uint64_t offset_b) { @@ -302,10 +302,10 @@ static int in_same_refcount_block(BDRVQcow2State *s= , uint64_t offset_a, } =20 /* - * Loads a refcount block. If it doesn't exist yet, it is allocated firs= t - * (including growing the refcount table if needed). + * L=C3=A4dt ein refcount Block. Wenn es noch nicht existiert, wird sie = zugeordnet + * erste (Einschlie=C3=9Flich der refcount Tabelle w=C3=A4chst, wenn erf= orderlich). * - * Returns 0 on success or -errno in error case + * Gibt 0 zur=C3=BCck, bei Erfolg -errno im Fehlerfall */ static int alloc_refcount_block(BlockDriverState *bs, int64_t cluster_index, void **refcount_b= lock) @@ -316,7 +316,7 @@ static int alloc_refcount_block(BlockDriverState *bs, =20 BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC); =20 - /* Find the refcount block for the given cluster */ + /* Finden Sie den refcount Block f=C3=BCr den gegebenen Cluster */ refcount_table_index =3D cluster_index >> s->refcount_block_bits; =20 if (refcount_table_index < s->refcount_table_size) { @@ -324,7 +324,7 @@ static int alloc_refcount_block(BlockDriverState *bs, uint64_t refcount_block_offset =3D s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK; =20 - /* If it's already there, we're done */ + /* Wenn es schon da ist, sind wir fertig */ if (refcount_block_offset) { if (offset_into_cluster(s, refcount_block_offset)) { qcow2_signal_corruption(bs, true, -1, -1, "Refblock offs= et %#" @@ -340,37 +340,42 @@ static int alloc_refcount_block(BlockDriverState *b= s, } =20 /* - * If we came here, we need to allocate something. Something is at l= east - * a cluster for the new refcount block. It may also include a new r= efcount - * table if the old refcount table is too small. + * Wenn wir hierher kamen, brauchen wir etwas zu vergeben. Etwas ist + * zumindest ein Cluster f=C3=BCr den neuen refcount Block. Es kann = auch + * eine neue refcount umfassen Tabelle, wenn der alte refcount Tabel= le ist + * zu klein. * - * Note that allocating clusters here needs some special care: + * Beachten Sie, dass Cluster hier ben=C3=B6tigt eine spezielle Pfle= ge + * Aufteilung: * - * - We can't use the normal qcow2_alloc_clusters(), it would try to - * increase the refcount and very likely we would end up with an e= ndless - * recursion. Instead we must place the refcount blocks in a way t= hat - * they can describe them themselves. + * - Wir k=C3=B6nnen nicht die normalen qcow2_alloc_clusters () verw= enden, w=C3=A4re + * es versuchen, erh=C3=B6hen die refcount und sehr wahrscheinlich= w=C3=BCrden wir + * mit einem endlosen Ende Rekursion. Stattdessen m=C3=BCssen wir = die refcount + * Bl=C3=B6cke so platzieren, sie k=C3=B6nnen sie sich beschreiben= . * - * - We need to consider that at this point we are inside update_ref= counts - * and potentially doing an initial refcount increase. This means = that - * some clusters have already been allocated by the caller, but th= eir - * refcount isn't accurate yet. If we allocate clusters for metada= ta, we - * need to return -EAGAIN to signal the caller that it needs to re= start - * the search for free clusters. + * - Wir m=C3=BCssen bedenken, dass wir an dieser Stelle innerhalb + * update_refcounts sind und m=C3=B6glicherweise eine anf=C3=A4ngl= iche refcount + * Anstieg zu tun. Das bedeutet, dass Einige Bl=C3=B6cke sind bere= its von dem + * Anrufer zugewiesen wurde, aber ihre refcount ist noch nicht gen= au. + * Wenn wir Cluster f=C3=BCr Metadaten zuweisen, wir m=C3=BCssen -= EAGAIN + * zur=C3=BCckkehren, um den Anrufer zu signalisieren, dass es mus= s neu + * gestartet werden die Suche nach freien Clustern. * - * - alloc_clusters_noref and qcow2_free_clusters may load a differe= nt - * refcount block into the cache + * - Alloc_clusters_noref und qcow2_free_clusters laden kann eine an= dere + * refcount Block in den Cache */ =20 *refcount_block =3D NULL; =20 - /* We write to the refcount table, so we might depend on L2 tables *= / + /* Wir schreiben Sie an die refcount Tisch, so dass wir vielleicht a= uf den + * L2-Tabellen abh=C3=A4ngen */ ret =3D qcow2_cache_flush(bs, s->l2_table_cache); if (ret < 0) { return ret; } =20 - /* Allocate the refcount block itself and mark it as used */ + /* Ordnen Sie die refcount Block selbst und markieren Sie ihn als + * gebraucht */ int64_t new_block =3D alloc_clusters_noref(bs, s->cluster_size); if (new_block < 0) { return new_block; @@ -383,7 +388,7 @@ static int alloc_refcount_block(BlockDriverState *bs, #endif =20 if (in_same_refcount_block(s, new_block, cluster_index << s->cluster= _bits)) { - /* Zero the new refcount block before updating it */ + /* Null, um die neuen refcount Block, bevor es die Aktualisierun= g */ ret =3D qcow2_cache_get_empty(bs, s->refcount_block_cache, new_b= lock, refcount_block); if (ret < 0) { @@ -392,13 +397,14 @@ static int alloc_refcount_block(BlockDriverState *b= s, =20 memset(*refcount_block, 0, s->cluster_size); =20 - /* The block describes itself, need to update the cache */ + /* Der Block beschreibt sich selbst, m=C3=BCssen Sie den Cache z= u + * aktualisieren */ int block_index =3D (new_block >> s->cluster_bits) & (s->refcount_block_size - 1); s->set_refcount(*refcount_block, block_index, 1); } else { - /* Described somewhere else. This can recurse at most twice befo= re we - * arrive at a block that describes itself. */ + /* Beschrieben woanders. Dies kann h=C3=B6chstens zweimal, bevor= wir + * Rekursion kommen zu einem Block, der selbst beschreibt. */ ret =3D update_refcount(bs, new_block, s->cluster_size, 1, false= , QCOW2_DISCARD_NEVER); if (ret < 0) { @@ -410,8 +416,8 @@ static int alloc_refcount_block(BlockDriverState *bs, goto fail_block; } =20 - /* Initialize the new refcount block only after updating its ref= count, - * update_refcount uses the refcount cache itself */ + /* Initialisieren Sie den neuen refcount Block erst nach seiner = refcount + * aktualisieren, update_refcount verwendet den refcount Cache s= elbst */ ret =3D qcow2_cache_get_empty(bs, s->refcount_block_cache, new_b= lock, refcount_block); if (ret < 0) { @@ -421,7 +427,8 @@ static int alloc_refcount_block(BlockDriverState *bs, memset(*refcount_block, 0, s->cluster_size); } =20 - /* Now the new refcount block needs to be written to disk */ + /* Jetzt ist die neue refcount Block muss auf die Festplatte geschri= eben + * werden */ BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE); qcow2_cache_entry_mark_dirty(bs, s->refcount_block_cache, *refcount_= block); ret =3D qcow2_cache_flush(bs, s->refcount_block_cache); @@ -429,7 +436,7 @@ static int alloc_refcount_block(BlockDriverState *bs, goto fail_block; } =20 - /* If the refcount table is big enough, just hook the block up there= */ + /* Wenn die refcount Tisch gro=C3=9F genug ist, nur um den Block Hak= en dort */ if (refcount_table_index < s->refcount_table_size) { uint64_t data64 =3D cpu_to_be64(new_block); BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_HOOKUP); @@ -442,36 +449,38 @@ static int alloc_refcount_block(BlockDriverState *b= s, =20 s->refcount_table[refcount_table_index] =3D new_block; =20 - /* The new refcount block may be where the caller intended to pu= t its - * data, so let it restart the search. */ + /* Der neue refcount Block kann sein, wo der Anrufer soll seine = setzen + * Daten, so lassen Sie es die Suche neu starten. */ return -EAGAIN; } =20 qcow2_cache_put(bs, s->refcount_block_cache, refcount_block); =20 /* - * If we come here, we need to grow the refcount table. Again, a new - * refcount table needs some space and we can't simply allocate to a= void - * endless recursion. + * Wenn wir hierher kommen, m=C3=BCssen wir die refcount Tisch zu wa= chsen. + * Wieder ein neuer refcount Tisch braucht etwas Platz und wir k=C3=B6= nnen + * nicht einfach zuordnen zu vermeiden endlose Rekursion. * - * Therefore let's grab new refcount blocks at the end of the image,= which - * will describe themselves and the new refcount table. This way we = can - * reference them only in the new table and do the switch to the new - * refcount table at once without producing an inconsistent state in - * between. + * Deshalb lassen Sie uns am Ende des Bildes neue refcount Bl=C3=B6c= ke + * greifen, die beschreibt sich selbst und die neue refcount Tabelle= . + * Auf diese Weise k=C3=B6nnen wir sie verweisen nur in der neuen Ta= belle + * und machen die Umstellung auf die neue refcount Tabelle auf einma= l + * ohne einen inkonsistenten Zustand produziert in zwischen. */ BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_GROW); =20 - /* Calculate the number of refcount blocks needed so far; this will = be the - * basis for calculating the index of the first cluster used for the - * self-describing refcount structures which we are about to create. + /* Berechnen Sie die Anzahl der refcount Bl=C3=B6cke so weit erforde= rlich; Dies + * wird der Grundlage f=C3=BCr die verwendete den Index des ersten C= lusters + * Berechnungs selbsterkl=C3=A4rend refcount Strukturen, die wir sch= affen + * wollen. * - * Because we reached this point, there cannot be any refcount entri= es for - * cluster_index or higher indices yet. However, because new_block h= as been - * allocated to describe that cluster (and it will assume this role = later - * on), we cannot use that index; also, new_block may actually have = a higher - * cluster index than cluster_index, so it needs to be taken into ac= count - * here (and 1 needs to be added to its value because that cluster i= s used). + * Weil wir diesen Punkt erreicht hat, kann es keine refcount Eintr=C3= =A4ge + * werden f=C3=BCr cluster_index oder h=C3=B6heren Indizes noch. Da = jedoch new_block + * gewesen sp=C3=A4ter zugewiesen, dass Cluster zu beschreiben (und = es wird + * diese Rolle =C3=BCbernehmen on), k=C3=B6nnen wir nicht diesen Ind= ex verwenden; + * Auch new_block kann tats=C3=A4chlich eine h=C3=B6here Cluster-Ind= ex als + * cluster_index, so ber=C3=BCcksichtigt werden muss, hier (und 1 mu= ss sein + * Wert hinzugef=C3=BCgt werden, weil die Cluster verwendet wird). */ uint64_t blocks_used =3D DIV_ROUND_UP(MAX(cluster_index + 1, (new_block >> s->cluster_bit= s) + 1), @@ -481,7 +490,8 @@ static int alloc_refcount_block(BlockDriverState *bs, return -EFBIG; } =20 - /* And now we need at least one block more for the new metadata */ + /* Und jetzt m=C3=BCssen wir mindestens einen Block mehr f=C3=BCr de= n neuen + * Metadaten */ uint64_t table_size =3D next_refcount_table_size(s, blocks_used + 1)= ; uint64_t last_table_size; uint64_t blocks_clusters; @@ -505,7 +515,7 @@ static int alloc_refcount_block(BlockDriverState *bs, s->refcount_table_size, table_size); #endif =20 - /* Create the new refcount table and blocks */ + /* Erstellen Sie die neue refcount Tabelle und blockiert */ uint64_t meta_offset =3D (blocks_used * s->refcount_block_size) * s->cluster_size; uint64_t table_offset =3D meta_offset + blocks_clusters * s->cluster= _size; @@ -518,7 +528,7 @@ static int alloc_refcount_block(BlockDriverState *bs, goto fail_table; } =20 - /* Fill the new refcount table */ + /* F=C3=BCllen Sie den neuen refcount Tisch */ memcpy(new_table, s->refcount_table, s->refcount_table_size * sizeof(uint64_t)); new_table[refcount_table_index] =3D new_block; @@ -528,14 +538,14 @@ static int alloc_refcount_block(BlockDriverState *b= s, new_table[blocks_used + i] =3D meta_offset + (i * s->cluster_siz= e); } =20 - /* Fill the refcount blocks */ + /* F=C3=BCllen Sie die refcount Bl=C3=B6cke */ uint64_t table_clusters =3D size_to_clusters(s, table_size * sizeof(= uint64_t)); int block =3D 0; for (i =3D 0; i < table_clusters + blocks_clusters; i++) { s->set_refcount(new_blocks, block++, 1); } =20 - /* Write refcount blocks to disk */ + /* Schreiben refcount Bl=C3=B6cke auf der Festplatte */ BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE_BLOCKS); ret =3D bdrv_pwrite_sync(bs->file->bs, meta_offset, new_blocks, blocks_clusters * s->cluster_size); @@ -545,7 +555,7 @@ static int alloc_refcount_block(BlockDriverState *bs, goto fail_table; } =20 - /* Write refcount table to disk */ + /* Schreiben refcount Tabelle auf die Festplatte */ for(i =3D 0; i < table_size; i++) { cpu_to_be64s(&new_table[i]); } @@ -561,7 +571,7 @@ static int alloc_refcount_block(BlockDriverState *bs, be64_to_cpus(&new_table[i]); } =20 - /* Hook up the new refcount table in the qcow2 header */ + /* Schlie=C3=9Fen Sie die neue refcount Tabelle im qcow2 Kopf */ struct QEMU_PACKED { uint64_t d64; uint32_t d32; @@ -576,7 +586,7 @@ static int alloc_refcount_block(BlockDriverState *bs, goto fail_table; } =20 - /* And switch it in memory */ + /* Und schalten Sie es im Speicher */ uint64_t old_table_offset =3D s->refcount_table_offset; uint64_t old_table_size =3D s->refcount_table_size; =20 @@ -585,7 +595,7 @@ static int alloc_refcount_block(BlockDriverState *bs, s->refcount_table_size =3D table_size; s->refcount_table_offset =3D table_offset; =20 - /* Free old table. */ + /* Freie alte Tabelle. */ qcow2_free_clusters(bs, old_table_offset, old_table_size * sizeof(ui= nt64_t), QCOW2_DISCARD_OTHER); =20 @@ -594,9 +604,10 @@ static int alloc_refcount_block(BlockDriverState *bs= , return ret; } =20 - /* If we were trying to do the initial refcount update for some clus= ter - * allocation, we might have used the same clusters to store newly - * allocated metadata. Make the caller search some new space. */ + /* Wenn wir versuchten, die anf=C3=A4ngliche refcount Update f=C3=BC= r einige Cluster + * zu tun Zuteilung, wir k=C3=B6nnten die gleichen Cluster verwendet= haben, neu + * zu speichern, zugeordnet Metadaten. Machen Sie den Anrufer einige= neue + * Raum suchen. */ return -EAGAIN; =20 fail_table: @@ -617,7 +628,7 @@ void qcow2_process_discards(BlockDriverState *bs, int= ret) QTAILQ_FOREACH_SAFE(d, &s->discards, next, next) { QTAILQ_REMOVE(&s->discards, d, next); =20 - /* Discard is optional, ignore the return value */ + /* Verwerfen ist optional, ignorieren den R=C3=BCckgabewert */ if (ret >=3D 0) { bdrv_discard(bs->file->bs, d->offset >> BDRV_SECTOR_BITS, @@ -639,9 +650,9 @@ static void update_refcount_discard(BlockDriverState = *bs, uint64_t new_end =3D MAX(offset + length, d->offset + d->bytes); =20 if (new_end - new_start <=3D length + d->bytes) { - /* There can't be any overlap, areas ending up here have no - * references any more and therefore shouldn't get freed ano= ther - * time. */ + /* Es kann keine =C3=9Cberschneidungen, Abgeschlagenheit, hi= er oben + * haben keine Referenzen mehr und kann daher nicht ein ande= res + * bekommen sollte befreit Zeit. */ assert(d->bytes + length =3D=3D new_end - new_start); d->offset =3D new_start; d->bytes =3D new_end - new_start; @@ -658,7 +669,7 @@ static void update_refcount_discard(BlockDriverState = *bs, QTAILQ_INSERT_TAIL(&s->discards, d, next); =20 found: - /* Merge discard requests if they are adjacent now */ + /* Merge Discard-Anfragen, ob sie nun benachbart sind */ QTAILQ_FOREACH_SAFE(p, &s->discards, next, next) { if (p =3D=3D d || p->offset > d->offset + d->bytes @@ -667,7 +678,7 @@ found: continue; } =20 - /* Still no overlap possible */ + /* Noch keine =C3=9Cberschneidungen m=C3=B6glich */ assert(p->offset =3D=3D d->offset + d->bytes || d->offset =3D=3D p->offset + p->bytes); =20 @@ -678,9 +689,10 @@ found: } } =20 -/* XXX: cache several refcount block clusters ? */ -/* @addend is the absolute value of the addend; if @decrease is set, @ad= dend - * will be subtracted from the current refcount, otherwise it will be ad= ded */ +/* XXX: Cache mehrere refcount Block Cluster? */ +/* @addend ist der absolute Wert des Addenden; wenn @decrease gesetzt is= t, + * @addend wird von der aktuellen refcount abgezogen werden, sonst wird = sie + * hinzugef=C3=BCgt */ static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs, int64_t offset, int64_t length, @@ -720,7 +732,7 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(Bl= ockDriverState *bs, int64_t cluster_index =3D cluster_offset >> s->cluster_bits; int64_t table_index =3D cluster_index >> s->refcount_block_bits; =20 - /* Load the refcount block and allocate it if needed */ + /* Laden Sie den refcount Block und ordnen sie, wenn n=C3=B6tig = */ if (table_index !=3D old_table_index) { if (refcount_block) { qcow2_cache_put(bs, s->refcount_block_cache, &refcount_b= lock); @@ -735,7 +747,7 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(Bl= ockDriverState *bs, qcow2_cache_entry_mark_dirty(bs, s->refcount_block_cache, refcount_block); =20 - /* we can update the count and save it */ + /* wir k=C3=B6nnen die Z=C3=A4hlung aktualisieren und speichern = */ block_index =3D cluster_index & (s->refcount_block_size - 1); =20 refcount =3D s->get_refcount(refcount_block, block_index); @@ -767,14 +779,15 @@ fail: qcow2_process_discards(bs, ret); } =20 - /* Write last changed block to disk */ + /* Schreiben Sie zuletzt ge=C3=A4ndert Block auf der Festplatte */ if (refcount_block) { qcow2_cache_put(bs, s->refcount_block_cache, &refcount_block); } =20 /* - * Try do undo any updates if an error is returned (This may succeed= in - * some cases like ENOSPC for allocating a new refcount block) + * Versuchen Sie keine Updates r=C3=BCckg=C3=A4ngig machen, wenn ein= Fehler + * zur=C3=BCckgegeben (Dies gelingt kann In einigen F=C3=A4llen wie = ENOSPC f=C3=BCr + * einen neuen refcount Block Zuteilung) */ if (ret < 0) { int dummy; @@ -787,12 +800,13 @@ fail: } =20 /* - * Increases or decreases the refcount of a given cluster. + * Erh=C3=B6ht oder verringert die refcount eines bestimmten Clusters. * - * @addend is the absolute value of the addend; if @decrease is set, @ad= dend - * will be subtracted from the current refcount, otherwise it will be ad= ded. + * @addend ist der absolute Wert des Addenden; wenn @decrease gesetzt is= t, + * @addend wird von der aktuellen refcount abgezogen werden, sonst wird = es + * hinzugef=C3=BCgt werden. * - * On success 0 is returned; on failure -errno is returned. + * Bei Erfolg wird 0 zur=C3=BCckgegeben; bei Ausfall -errno zur=C3=BCckg= egeben. */ int qcow2_update_cluster_refcount(BlockDriverState *bs, int64_t cluster_index, @@ -814,18 +828,19 @@ int qcow2_update_cluster_refcount(BlockDriverState = *bs, =20 =20 /*********************************************************/ -/* cluster allocation functions */ +/* Cluster-Zuordnungsfunktionen */ =20 =20 =20 -/* return < 0 if error */ +/* R=C3=BCckkehr <0, wenn Fehler */ static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size) { BDRVQcow2State *s =3D bs->opaque; uint64_t i, nb_clusters, refcount; int ret; =20 - /* We can't allocate clusters if they may still be queued for discar= d. */ + /* Wir k=C3=B6nnen keine Cluster zuordnen, wenn sie noch f=C3=BCr Ve= rwerfungs die + * Warteschlange gestellt werden kann. */ if (s->cache_discards) { qcow2_process_discards(bs, 0); } @@ -843,8 +858,8 @@ retry: } } =20 - /* Make sure that all offsets in the "allocated" range are represent= able - * in an int64_t */ + /* Stellen Sie sicher, dass alle Offsets im "zugeordnet" Bereich + * darstellbaren in einem int64_t */ if (s->free_cluster_index > 0 && s->free_cluster_index - 1 > (INT64_MAX >> s->cluster_bits)) { @@ -895,7 +910,7 @@ int64_t qcow2_alloc_clusters_at(BlockDriverState *bs,= uint64_t offset, } =20 do { - /* Check how many clusters there are free */ + /* =C3=9Cberpr=C3=BCfen Sie, wie viele Cluster dort frei */ cluster_index =3D offset >> s->cluster_bits; for(i =3D 0; i < nb_clusters; i++) { ret =3D qcow2_get_refcount(bs, cluster_index++, &refcount); @@ -906,7 +921,7 @@ int64_t qcow2_alloc_clusters_at(BlockDriverState *bs,= uint64_t offset, } } =20 - /* And then allocate them */ + /* Und dann ordnen sie */ ret =3D update_refcount(bs, offset, i << s->cluster_bits, 1, fal= se, QCOW2_DISCARD_NEVER); } while (ret =3D=3D -EAGAIN); @@ -918,8 +933,8 @@ int64_t qcow2_alloc_clusters_at(BlockDriverState *bs,= uint64_t offset, return i; } =20 -/* only used to allocate compressed sectors. We try to allocate - contiguous sectors. size must be <=3D cluster_size */ +/* nur verwendet komprimierte Sektoren zuzuordnen. Wir versuchen zu verg= eben + zusammenh=C3=A4ngenden Sektoren. Gr=C3=B6=C3=9Fe muss <=3D CLUSTER_SI= ZE */ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size) { BDRVQcow2State *s =3D bs->opaque; @@ -971,8 +986,8 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int s= ize) return ret; } =20 - /* The cluster refcount was incremented; refcount blocks must be flu= shed - * before the caller's L2 table updates. */ + /* Der Cluster refcount wurde erh=C3=B6ht; refcount Bl=C3=B6cke m=C3= =BCssen gesp=C3=BClt + * werden vor der L2-Tabellenaktualisierungen des Anrufers. */ qcow2_cache_set_dependency(bs, s->l2_table_cache, s->refcount_block_= cache); =20 s->free_byte_offset =3D offset + size; @@ -993,13 +1008,14 @@ void qcow2_free_clusters(BlockDriverState *bs, ret =3D update_refcount(bs, offset, size, 1, true, type); if (ret < 0) { fprintf(stderr, "qcow2_free_clusters failed: %s\n", strerror(-re= t)); - /* TODO Remember the clusters to free them later and avoid leaki= ng */ + /* Denken Sie daran, TODO die Cluster um sie zu befreien sp=C3=A4= ter und + * vermeiden undicht */ } } =20 /* - * Free a cluster using its L2 entry (handles clusters of all types, e.g= . - * normal cluster, compressed cluster, etc.) + * Befreien eines Clusters seine L2-Eintrag mit (Griffe Cluster aller Ar= t, z + * normalen Cluster, Druck Cluster, etc.) */ void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry, int nb_clusters, enum qcow2_discard_type ty= pe) @@ -1040,11 +1056,11 @@ void qcow2_free_any_clusters(BlockDriverState *bs= , uint64_t l2_entry, =20 =20 /*********************************************************/ -/* snapshots and image creation */ +/* Snapshots und Image-Erstellung */ =20 =20 =20 -/* update the refcounts of snapshots and the copied flag */ +/* Aktualisieren Sie die Refcounts von Snapshots und die kopierte Flagge= */ int qcow2_update_snapshot_refcount(BlockDriverState *bs, int64_t l1_table_offset, int l1_size, int addend) { @@ -1063,9 +1079,9 @@ int qcow2_update_snapshot_refcount(BlockDriverState= *bs, =20 s->cache_discards =3D true; =20 - /* WARNING: qcow2_snapshot_goto relies on this function not using th= e - * l1_table_offset when it is the current s->l1_table_offset! Be car= eful - * when changing this! */ + /* WARNUNG: qcow2_snapshot_goto st=C3=BCtzt sich auf diese Funktion = nicht die + * Verwendung von l1_table_offset, wenn es die aktuelle + * s-> l1_table_offset! Achtung Bei einer =C3=84nderung dieser! */ if (l1_table_offset !=3D s->l1_table_offset) { l1_table =3D g_try_malloc0(align_offset(l1_size2, 512)); if (l1_size2 && l1_table =3D=3D NULL) { @@ -1127,7 +1143,7 @@ int qcow2_update_snapshot_refcount(BlockDriverState= *bs, goto fail; } } - /* compressed clusters are never modified */ + /* komprimierte Cluster werden nicht ver=C3=A4nd= ert */ refcount =3D 2; break; =20 @@ -1146,7 +1162,7 @@ int qcow2_update_snapshot_refcount(BlockDriverState= *bs, =20 cluster_index =3D (offset & L2E_OFFSET_MASK) >> = s->cluster_bits; if (!cluster_index) { - /* unallocated */ + /* nicht zugeteilt */ refcount =3D 0; break; } @@ -1221,7 +1237,7 @@ fail: s->cache_discards =3D false; qcow2_process_discards(bs, ret); =20 - /* Update L1 only if it isn't deleted anyway (addend =3D -1) */ + /* Update-L1 nur, wenn es nicht gel=C3=B6scht wird, sowieso (Summand= =3D -1) */ if (ret =3D=3D 0 && addend >=3D 0 && l1_modified) { for (i =3D 0; i < l1_size; i++) { cpu_to_be64s(&l1_table[i]); @@ -1243,31 +1259,33 @@ fail: =20 =20 /*********************************************************/ -/* refcount checking functions */ +/* RefCount Pr=C3=BCffunktionen */ =20 =20 static uint64_t refcount_array_byte_size(BDRVQcow2State *s, uint64_t ent= ries) { - /* This assertion holds because there is no way we can address more = than - * 2^(64 - 9) clusters at once (with cluster size 512 =3D 2^9, and b= ecause - * offsets have to be representable in bytes); due to every cluster - * corresponding to one refcount entry, we are well below that limit= */ + /* Diese Behauptung h=C3=A4lt, weil es keine M=C3=B6glichkeit gibt, = wir mehr als + * adressieren 2 ^ (64-9) Cluster auf einmal (mit Clustergr=C3=B6=C3= =9Fe + * 512 =3D 2 ^ 9, und weil Offsets haben darstellbare in Bytes zu se= in); + * wegen jedem Cluster entsprechend einem refcount Eintrag, sind wir + * weit unter dieser Grenze */ assert(entries < (UINT64_C(1) << (64 - 9))); =20 - /* Thanks to the assertion this will not overflow, because - * s->refcount_order < 7. - * (note: x << s->refcount_order =3D=3D x * s->refcount_bits) */ + /* dies dank der Behauptung nicht =C3=BCberl=C3=A4uft, weil + * s-> refcount_order <7. + * (Anmerkung: x << s-> refcount_order =3D=3D x * s-> refcount_bits)= */ return DIV_ROUND_UP(entries << s->refcount_order, 8); } =20 /** - * Reallocates *array so that it can hold new_size entries. *size must c= ontain - * the current number of entries in *array. If the reallocation fails, *= array - * and *size will not be modified and -errno will be returned. If the - * reallocation is successful, *array will be set to the new buffer, *si= ze - * will be set to new_size and 0 will be returned. The size of the reall= ocated - * refcount array buffer will be aligned to a cluster boundary, and the = newly - * allocated area will be zeroed. + * Verteilt * Array, so dass es new_size Eintr=C3=A4ge aufnehmen kann. *= Gr=C3=B6=C3=9Fe + * muss enthalten die aktuelle Anzahl der Eintr=C3=A4ge in * array. Wenn= die + * Neuzuweisung fehlschl=C3=A4gt, * array und * Gr=C3=B6=C3=9Fe wird nic= ht ge=C3=A4ndert und + * -errno zur=C3=BCckgegeben. wenn der Neuzuteilung erfolgreich ist, * A= rray wird + * auf den neuen Puffer eingestellt werden, * Gr=C3=B6=C3=9Fe wird geset= zt wird + * new_size und 0 zur=C3=BCckgegeben werden. Die Gr=C3=B6=C3=9Fe des umv= erteilt refcount + * array Puffer wird zu einem Cluster-Grenze ausgerichtet werden, und di= e neu + * zugewiesenen Bereich wird auf Null gesetzt. */ static int realloc_refcount_array(BDRVQcow2State *s, void **array, int64_t *size, int64_t new_size) @@ -1275,7 +1293,8 @@ static int realloc_refcount_array(BDRVQcow2State *s= , void **array, int64_t old_byte_size, new_byte_size; void *new_ptr; =20 - /* Round to clusters so the array can be directly written to disk */ + /* Rund um Cluster so das Array kann auf die Festplatte direkt gesch= rieben + * werden */ old_byte_size =3D size_to_clusters(s, refcount_array_byte_size(s, *s= ize)) * s->cluster_size; new_byte_size =3D size_to_clusters(s, refcount_array_byte_size(s, ne= w_size)) @@ -1309,11 +1328,12 @@ static int realloc_refcount_array(BDRVQcow2State = *s, void **array, } =20 /* - * Increases the refcount for a range of clusters in a given refcount ta= ble. - * This is used to construct a temporary refcount table out of L1 and L2= tables - * which can be compared to the refcount table saved in the image. + * Erh=C3=B6ht die refcount f=C3=BCr eine Reihe von Clustern in einer be= stimmten + * refcount Tabelle. Dies wird verwendet, um eine tempor=C3=A4re refcoun= t Tabelle + * von L1 und L2-Tabellen zu konstruieren die mit dem refcount Tabelle + * verglichen werden kann, in dem Bild gespeichert. * - * Modifies the number of errors in res. + * =C3=84ndert die Anzahl der Fehler in res. */ static int inc_refcounts(BlockDriverState *bs, BdrvCheckResult *res, @@ -1359,18 +1379,18 @@ static int inc_refcounts(BlockDriverState *bs, return 0; } =20 -/* Flags for check_refcounts_l1() and check_refcounts_l2() */ +/* Flags f=C3=BCr check_refcounts_l1 () und check_refcounts_l2 () */ enum { - CHECK_FRAG_INFO =3D 0x2, /* update BlockFragInfo counters */ + CHECK_FRAG_INFO =3D 0x2, /* aktualisieren BlockFragInfo Z=C3=A4= hler */ }; =20 /* - * Increases the refcount in the given refcount table for the all cluste= rs - * referenced in the L2 table. While doing so, performs some checks on L= 2 - * entries. + * Erh=C3=B6ht die refcount in der gegebenen refcount Tabelle f=C3=BCr d= ie alle Cluster + * in der L2-Tabelle verwiesen. W=C3=A4hrend Dabei f=C3=BChrt einige Pr=C3= =BCfungen auf L2 + * Eintr=C3=A4ge. * - * Returns the number of errors found by the checks or -errno if an inte= rnal - * error occurred. + * Gibt die Anzahl der Fehler, die von den Kontrollen gefunden oder -err= no + * wenn eine interne Ein Fehler ist aufgetreten. */ static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res= , void **refcount_table, @@ -1382,7 +1402,7 @@ static int check_refcounts_l2(BlockDriverState *bs,= BdrvCheckResult *res, uint64_t next_contiguous_offset =3D 0; int i, l2_size, nb_csectors, ret; =20 - /* Read L2 table from disk */ + /* Lesen Sie L2-Tabelle von der Festplatte */ l2_size =3D s->l2_size * sizeof(uint64_t); l2_table =3D g_malloc(l2_size); =20 @@ -1393,13 +1413,13 @@ static int check_refcounts_l2(BlockDriverState *b= s, BdrvCheckResult *res, goto fail; } =20 - /* Do the actual checks */ + /* Sind die tats=C3=A4chlichen Kontrollen */ for(i =3D 0; i < s->l2_size; i++) { l2_entry =3D be64_to_cpu(l2_table[i]); =20 switch (qcow2_get_cluster_type(l2_entry)) { case QCOW2_CLUSTER_COMPRESSED: - /* Compressed clusters don't have QCOW_OFLAG_COPIED */ + /* Komprimierte Cluster haben keine QCOW_OFLAG_COPIED */ if (l2_entry & QCOW_OFLAG_COPIED) { fprintf(stderr, "ERROR: cluster %" PRId64 ": " "copied flag must never be set for compressed " @@ -1408,7 +1428,7 @@ static int check_refcounts_l2(BlockDriverState *bs,= BdrvCheckResult *res, res->corruptions++; } =20 - /* Mark cluster as used */ + /* Mark Cluster als verwendet */ nb_csectors =3D ((l2_entry >> s->csize_shift) & s->csize_mask) + 1; l2_entry &=3D s->cluster_offset_mask; @@ -1422,10 +1442,11 @@ static int check_refcounts_l2(BlockDriverState *b= s, BdrvCheckResult *res, res->bfi.allocated_clusters++; res->bfi.compressed_clusters++; =20 - /* Compressed clusters are fragmented by nature. Since = they - * take up sub-sector space but we only have sector gran= ularity - * I/O we need to re-read the same sectors even for adja= cent - * compressed clusters. + /* Komprimierte Cluster werden von der Natur fragmentier= t. Seit + * sie nehmen Teilsektor Platz, aber wir nur Sektor + * Granularit=C3=A4t haben I / O ben=C3=B6tigen wir, um = die gleichen + * Sektoren auch f=C3=BCr benachbarte erneut zu lesen ko= mprimierte + * Cluster. */ res->bfi.fragmented_clusters++; } @@ -1435,7 +1456,7 @@ static int check_refcounts_l2(BlockDriverState *bs,= BdrvCheckResult *res, if ((l2_entry & L2E_OFFSET_MASK) =3D=3D 0) { break; } - /* fall through */ + /* durchfallen */ =20 case QCOW2_CLUSTER_NORMAL: { @@ -1450,14 +1471,14 @@ static int check_refcounts_l2(BlockDriverState *b= s, BdrvCheckResult *res, next_contiguous_offset =3D offset + s->cluster_size; } =20 - /* Mark cluster as used */ + /* Mark Cluster als verwendet */ ret =3D inc_refcounts(bs, res, refcount_table, refcount_tabl= e_size, offset, s->cluster_size); if (ret < 0) { goto fail; } =20 - /* Correct offsets are cluster aligned */ + /* Korrekte Offsets sind Cluster ausgerichteter */ if (offset_into_cluster(s, offset)) { fprintf(stderr, "ERROR offset=3D%" PRIx64 ": Cluster is = not " "properly aligned; L2 entry corrupted.\n", offset); @@ -1483,12 +1504,12 @@ fail: } =20 /* - * Increases the refcount for the L1 table, its L2 tables and all refere= nced - * clusters in the given refcount table. While doing so, performs some c= hecks - * on L1 and L2 entries. + * Erh=C3=B6ht die refcount f=C3=BCr den L1-Tabelle, seine L2-Tabellen u= nd alle + * referenzierten Cluster in der gegebenen refcount Tabelle. W=C3=A4hren= d Dabei + * f=C3=BChrt einige Pr=C3=BCfungen auf L1 und L2-Eintr=C3=A4ge. * - * Returns the number of errors found by the checks or -errno if an inte= rnal - * error occurred. + * Gibt die Anzahl der Fehler, die von den Kontrollen gefunden oder -err= no + * wenn eine interne Ein Fehler ist aufgetreten. */ static int check_refcounts_l1(BlockDriverState *bs, BdrvCheckResult *res, @@ -1503,14 +1524,14 @@ static int check_refcounts_l1(BlockDriverState *b= s, =20 l1_size2 =3D l1_size * sizeof(uint64_t); =20 - /* Mark L1 table as used */ + /* Mark L1-Tabelle als verwendet */ ret =3D inc_refcounts(bs, res, refcount_table, refcount_table_size, l1_table_offset, l1_size2); if (ret < 0) { goto fail; } =20 - /* Read L1 table entries from disk */ + /* Lesen Sie L1 Tabelleneintr=C3=A4ge von der Festplatte */ if (l1_size2 > 0) { l1_table =3D g_try_malloc(l1_size2); if (l1_table =3D=3D NULL) { @@ -1528,11 +1549,11 @@ static int check_refcounts_l1(BlockDriverState *b= s, be64_to_cpus(&l1_table[i]); } =20 - /* Do the actual checks */ + /* Sind die tats=C3=A4chlichen Kontrollen */ for(i =3D 0; i < l1_size; i++) { l2_offset =3D l1_table[i]; if (l2_offset) { - /* Mark L2 table as used */ + /* Mark L2-Tabelle als verwendet */ l2_offset &=3D L1E_OFFSET_MASK; ret =3D inc_refcounts(bs, res, refcount_table, refcount_tabl= e_size, l2_offset, s->cluster_size); @@ -1540,14 +1561,14 @@ static int check_refcounts_l1(BlockDriverState *b= s, goto fail; } =20 - /* L2 tables are cluster aligned */ + /* L2 Tabellen sind Cluster ausgerichteter */ if (offset_into_cluster(s, l2_offset)) { fprintf(stderr, "ERROR l2_offset=3D%" PRIx64 ": Table is= not " "cluster aligned; L1 entry corrupted\n", l2_offset); res->corruptions++; } =20 - /* Process and check L2 entries */ + /* Prozess- und =C3=BCberpr=C3=BCfen L2 Eintr=C3=A4ge */ ret =3D check_refcounts_l2(bs, res, refcount_table, refcount_table_size, l2_offset, fla= gs); if (ret < 0) { @@ -1564,12 +1585,13 @@ fail: } =20 /* - * Checks the OFLAG_COPIED flag for all L1 and L2 entries. + * Pr=C3=BCft die OFLAG_COPIED Flag f=C3=BCr alle L1 und L2-Eintr=C3=A4g= e. * - * This function does not print an error message nor does it increment - * check_errors if qcow2_get_refcount fails (this is because such an err= or will - * have been already detected and sufficiently signaled by the calling f= unction - * (qcow2_check_refcounts) by the time this function is called). + * Diese Funktion ist nicht eine Fehlermeldung auch nicht erh=C3=B6ht + * check_errors wenn qcow2_get_refcount fehlschl=C3=A4gt (dies liegt dar= an, dass + * ein solcher Fehler wird wurden von der aufrufenden Funktion signalisi= ert + * bereits erkannt und hinreichend (Qcow2_check_refcounts) durch die Zei= t, + * diese Funktion aufgerufen wird). */ static int check_oflag_copied(BlockDriverState *bs, BdrvCheckResult *res= , BdrvCheckMode fix) @@ -1592,7 +1614,7 @@ static int check_oflag_copied(BlockDriverState *bs,= BdrvCheckResult *res, ret =3D qcow2_get_refcount(bs, l2_offset >> s->cluster_bits, &refcount); if (ret < 0) { - /* don't print message nor increment check_errors */ + /* nicht gedruckt Nachricht noch Schritt check_errors */ continue; } if ((refcount =3D=3D 1) !=3D ((l1_entry & QCOW_OFLAG_COPIED) !=3D= 0)) { @@ -1636,7 +1658,7 @@ static int check_oflag_copied(BlockDriverState *bs,= BdrvCheckResult *res, data_offset >> s->cluster_bits, &refcount); if (ret < 0) { - /* don't print message nor increment check_errors */ + /* nicht gedruckt Nachricht noch Schritt check_error= s */ continue; } if ((refcount =3D=3D 1) !=3D ((l2_entry & QCOW_OFLAG_COP= IED) !=3D 0)) { @@ -1687,8 +1709,8 @@ fail: } =20 /* - * Checks consistency of refblocks and accounts for each refblock in - * *refcount_table. + * Pr=C3=BCft die Konsistenz von refblocks und Konten f=C3=BCr jeden ref= block in + * * Refcount_table. */ static int check_refblocks(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix, bool *rebuild, @@ -1703,7 +1725,7 @@ static int check_refblocks(BlockDriverState *bs, Bd= rvCheckResult *res, offset =3D s->refcount_table[i]; cluster =3D offset >> s->cluster_bits; =20 - /* Refcount blocks are cluster aligned */ + /* RefCount Bl=C3=B6cke sind Cluster ausgerichteter */ if (offset_into_cluster(s, offset)) { fprintf(stderr, "ERROR refcount block %" PRId64 " is not " "cluster aligned; refcount table entry corrupted\n", i); @@ -1755,9 +1777,10 @@ static int check_refblocks(BlockDriverState *bs, B= drvCheckResult *res, if (ret < 0) { return ret; } - /* No need to check whether the refcount is now greater = than 1: - * This area was just allocated and zeroed, so it can on= ly be - * exactly 1 after inc_refcounts() */ + /* Keine Notwendigkeit, ob der refcount zu =C3=BCberpr=C3= =BCfen, ist + * jetzt gr=C3=B6=C3=9Fer als 1: Dieser Bereich wurde nu= r zugeteilt und + * auf Null gesetzt, so kann es nur sein, genau 1 nach + * inc_refcounts () */ continue; =20 resize_fail: @@ -1791,7 +1814,7 @@ resize_fail: } =20 /* - * Calculates an in-memory refcount table. + * Berechnet einen In-Memory-refcount Tabelle. */ static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *re= s, BdrvCheckMode fix, bool *rebuild, @@ -1812,21 +1835,21 @@ static int calculate_refcounts(BlockDriverState *= bs, BdrvCheckResult *res, } } =20 - /* header */ + /* Kopfzeile */ ret =3D inc_refcounts(bs, res, refcount_table, nb_clusters, 0, s->cluster_size); if (ret < 0) { return ret; } =20 - /* current L1 table */ + /* Strom L1 Tabelle */ ret =3D check_refcounts_l1(bs, res, refcount_table, nb_clusters, s->l1_table_offset, s->l1_size, CHECK_FRAG_= INFO); if (ret < 0) { return ret; } =20 - /* snapshots */ + /* Schnappsch=C3=BCsse */ for (i =3D 0; i < s->nb_snapshots; i++) { sn =3D s->snapshots + i; ret =3D check_refcounts_l1(bs, res, refcount_table, nb_clusters, @@ -1841,7 +1864,7 @@ static int calculate_refcounts(BlockDriverState *bs= , BdrvCheckResult *res, return ret; } =20 - /* refcount data */ + /* refcount Daten */ ret =3D inc_refcounts(bs, res, refcount_table, nb_clusters, s->refcount_table_offset, s->refcount_table_size * sizeof(uint64_t)); @@ -1853,8 +1876,8 @@ static int calculate_refcounts(BlockDriverState *bs= , BdrvCheckResult *res, } =20 /* - * Compares the actual reference count for each cluster in the image aga= inst the - * refcount as reported by the refcount structures on-disk. + * Vergleicht den aktuellen Referenzz=C3=A4hler f=C3=BCr jeden Cluster i= n das Bild gegen + * die refcount wie durch die refcount Strukturen auf der Festplatte gem= eldet. */ static void compare_refcounts(BlockDriverState *bs, BdrvCheckResult *res= , BdrvCheckMode fix, bool *rebuild, @@ -1882,7 +1905,7 @@ static void compare_refcounts(BlockDriverState *bs,= BdrvCheckResult *res, } =20 if (refcount1 !=3D refcount2) { - /* Check if we're allowed to fix the mismatch */ + /* Pr=C3=BCfen, ob wir erlaubt sind die Diskrepanz zu behebe= n */ int *num_fixed =3D NULL; if (refcount1 =3D=3D 0) { *rebuild =3D true; @@ -1910,7 +1933,7 @@ static void compare_refcounts(BlockDriverState *bs,= BdrvCheckResult *res, } } =20 - /* And if we couldn't, print an error */ + /* Und wenn wir konnten nicht, einen Fehler drucken */ if (refcount1 < refcount2) { res->corruptions++; } else { @@ -1921,16 +1944,17 @@ static void compare_refcounts(BlockDriverState *b= s, BdrvCheckResult *res, } =20 /* - * Allocates clusters using an in-memory refcount table (IMRT) in contra= st to - * the on-disk refcount structures. + * Ordnet Cluster unter Verwendung eines In-Memory-refcount Tabelle (IMR= T) im + * Gegensatz zu die auf der Festplatte refcount Strukturen. * - * On input, *first_free_cluster tells where to start looking, and need = not - * actually be a free cluster; the returned offset will not be before th= at - * cluster. On output, *first_free_cluster points to the first gap foun= d, even - * if that gap was too small to be used as the returned offset. + * Bei der Eingabe sagt * first_free_cluster, wo zu Beginn der Suche, un= d + * brauchen nicht eigentlich ein freier Cluster sein; der Offset zur=C3=BC= ckgegeben + * wird, bevor das nicht sein Cluster. Bei der Ausgabe * first_free_clus= ter + * zeigt auf den ersten Spalt gefunden, sogar wenn diese L=C3=BCcke zu k= lein war, + * um den Offset zur=C3=BCckgegeben werden. * - * Note that *first_free_cluster is a cluster index whereas the return v= alue is - * an offset. + * Beachten Sie, dass * first_free_cluster ist ein Cluster-Index w=C3=A4= hrend der + * R=C3=BCckgabewert ein Offset. */ static int64_t alloc_clusters_imrt(BlockDriverState *bs, int cluster_count, @@ -1944,8 +1968,8 @@ static int64_t alloc_clusters_imrt(BlockDriverState= *bs, int contiguous_free_clusters; int ret; =20 - /* Starting at *first_free_cluster, find a range of at least cluster= _count - * continuously free clusters */ + /* Ab * first_free_cluster, finden Sie einen Bereich von mindestens + * cluster_count kontinuierlich freien Clustern */ for (contiguous_free_clusters =3D 0; cluster < *imrt_nb_clusters && contiguous_free_clusters < cluster_count; @@ -1954,8 +1978,8 @@ static int64_t alloc_clusters_imrt(BlockDriverState= *bs, if (!s->get_refcount(*refcount_table, cluster)) { contiguous_free_clusters++; if (first_gap) { - /* If this is the first free cluster found, update - * *first_free_cluster accordingly */ + /* Wenn dies der erste freie Cluster gefunden ist, aktua= lisieren + * * First_free_cluster entsprechend */ *first_free_cluster =3D cluster; first_gap =3D false; } @@ -1964,20 +1988,21 @@ static int64_t alloc_clusters_imrt(BlockDriverSta= te *bs, } } =20 - /* If contiguous_free_clusters is greater than zero, it contains the= number - * of continuously free clusters until the current cluster; the firs= t free - * cluster in the current "gap" is therefore - * cluster - contiguous_free_clusters */ + /* Wenn contiguous_free_clusters gr=C3=B6=C3=9Fer als Null ist, enth= =C3=A4lt es die + * Nummer von kontinuierlich freien Clustern, bis der aktuelle Clust= er; + * die erste freie Cluster in der aktuellen "L=C3=BCcke" ist daher + * Cluster - contiguous_free_clusters */ =20 - /* If no such range could be found, grow the in-memory refcount tabl= e - * accordingly to append free clusters at the end of the image */ + /* Wenn kein solcher Bereich gefunden werden konnte, wachsen die + * In-Memory-refcount Tabelle dementsprechend freien Clustern am End= e des + * Bildes anzuh=C3=A4ngen */ if (contiguous_free_clusters < cluster_count) { - /* contiguous_free_clusters clusters are already empty at the im= age end; - * we need cluster_count clusters; therefore, we have to allocat= e - * cluster_count - contiguous_free_clusters new clusters at the = end of - * the image (which is the current value of cluster; note that c= luster - * may exceed old_imrt_nb_clusters if *first_free_cluster pointe= d beyond - * the image end) */ + /* contiguous_free_clusters Cluster am Bildende bereits leer sin= d; + * wir brauchen cluster_count Cluster; daher m=C3=BCssen wir ver= geben + * cluster_count - contiguous_free_clusters neue Cluster am Ende + * das Bild (das ist der aktuelle Wert des Clusters ist, beachte= n Sie, + * dass Cluster =C3=BCberschreiten darf old_imrt_nb_clusters wen= n + * * first_free_cluster =C3=BCber spitz das Bild Ende) */ ret =3D realloc_refcount_array(s, refcount_table, imrt_nb_cluste= rs, cluster + cluster_count - contiguous_free_clusters); @@ -1986,7 +2011,7 @@ static int64_t alloc_clusters_imrt(BlockDriverState= *bs, } } =20 - /* Go back to the first free cluster */ + /* Gehen Sie zur=C3=BCck zu den ersten freien Cluster */ cluster -=3D contiguous_free_clusters; for (i =3D 0; i < cluster_count; i++) { s->set_refcount(*refcount_table, cluster + i, 1); @@ -1996,12 +2021,12 @@ static int64_t alloc_clusters_imrt(BlockDriverSta= te *bs, } =20 /* - * Creates a new refcount structure based solely on the in-memory inform= ation - * given through *refcount_table. All necessary allocations will be refl= ected - * in that array. + * Erstellt eine neue refcount Struktur ausschlie=C3=9Flich auf der + * In-Memory-Informationen basierend durch * refcount_table gegeben. All= e + * notwendigen Zuweisungen werden reflektiert in diesem Array. * - * On success, the old refcount structure is leaked (it will be covered = by the - * new refcount structure). + * Bei Erfolg wird die alte refcount Struktur durchgesickert (es wird du= rch + * die abgedeckt werden neue refcount Struktur). */ static int rebuild_refcount_structure(BlockDriverState *bs, BdrvCheckResult *res, @@ -2031,7 +2056,8 @@ write_refblocks: refblock_index =3D cluster >> s->refcount_block_bits; refblock_start =3D refblock_index << s->refcount_block_bits; =20 - /* Don't allocate a cluster in a refblock already written to dis= k */ + /* Verwenden Sie kein Cluster in einem refblock zuweisen bereits= auf + * die Platte geschrieben */ if (first_free_cluster < refblock_start) { first_free_cluster =3D refblock_start; } @@ -2064,15 +2090,16 @@ write_refblocks: memset(on_disk_reftable + old_reftable_size, 0, (reftable_size - old_reftable_size) * sizeof(uint64_t= )); =20 - /* The offset we have for the reftable is now no longer vali= d; - * this will leak that range, but we can easily fix that by = running - * a leak-fixing check after this rebuild operation */ + /* Der Offset haben wir f=C3=BCr die refTable ist jetzt nich= t mehr + * g=C3=BCltig; Dies wird diesen Bereich auslaufen, aber wir= k=C3=B6nnen das + * leicht beheben, indem Sie ein Leck Festsetzungspr=C3=BCfu= ng nach + * dieser Operation wieder aufbauen */ reftable_offset =3D -1; } on_disk_reftable[refblock_index] =3D refblock_offset; =20 - /* If this is apparently the last refblock (for now), try to squ= eeze the - * reftable in */ + /* Wenn dies anscheinend der letzte refblock ist (bis jetzt), ve= rsuchen + * Sie das zu quetschen refTable in */ if (refblock_index =3D=3D (*nb_clusters - 1) >> s->refcount_bloc= k_bits && reftable_offset < 0) { @@ -2097,8 +2124,8 @@ write_refblocks: goto fail; } =20 - /* The size of *refcount_table is always cluster-aligned, theref= ore the - * write operation will not overflow */ + /* Die Gr=C3=B6=C3=9Fe * refcount_table ist immer Cluster ausger= ichtet sind, + * damit die Schreiboperation nicht =C3=BCberl=C3=A4uft */ on_disk_refblock =3D (void *)((char *) *refcount_table + refblock_index * s->cluster_size); =20 @@ -2109,7 +2136,7 @@ write_refblocks: goto fail; } =20 - /* Go to the end of this refblock */ + /* Zum Ende dieses refblock */ cluster =3D refblock_start + s->refcount_block_size - 1; } =20 @@ -2119,7 +2146,7 @@ write_refblocks: post_refblock_start =3D ROUND_UP(*nb_clusters, s->refcount_block= _size); reftable_clusters =3D size_to_clusters(s, reftable_size * sizeof(uint= 64_t)); - /* Not pretty but simple */ + /* Nicht sch=C3=B6n, aber einfach */ if (first_free_cluster < post_refblock_start) { first_free_cluster =3D post_refblock_start; } @@ -2158,7 +2185,7 @@ write_refblocks: goto fail; } =20 - /* Enter new reftable into the image header */ + /* Geben Sie den neuen refTable in die Bildkopf */ cpu_to_be64w(&reftable_offset_and_clusters.reftable_offset, reftable_offset); cpu_to_be32w(&reftable_offset_and_clusters.reftable_clusters, @@ -2187,10 +2214,11 @@ fail: } =20 /* - * Checks an image for refcount consistency. + * Pr=C3=BCft ein Bild f=C3=BCr refcount Konsistenz. * - * Returns 0 if no errors are found, the number of errors in case the im= age is - * detected as corrupted, and -errno when an internal error occurred. + * 0 zur=C3=BCck, wenn keine Fehler gefunden werden, die Anzahl der Fehl= er, falls + * das Bild als besch=C3=A4digt erkannt und -errno, wenn ein interner Fe= hler + * aufgetreten ist. */ int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix) @@ -2223,9 +2251,9 @@ int qcow2_check_refcounts(BlockDriverState *bs, Bdr= vCheckResult *res, goto fail; } =20 - /* In case we don't need to rebuild the refcount structure (but want= to fix - * something), this function is immediately called again, in which c= ase the - * result should be ignored */ + /* F=C3=BCr den Fall, brauchen wir nicht die refcount Struktur neu z= u erstellen + * (aber wollen zu beheben etwas), wird diese Funktion sofort wieder + * aufgerufen wird, in welchem Fall der Ergebnis sollte ignoriert */ pre_compare_res =3D *res; compare_refcounts(bs, res, 0, &rebuild, &highest_cluster, refcount_t= able, nb_clusters); @@ -2244,8 +2272,8 @@ int qcow2_check_refcounts(BlockDriverState *bs, Bdr= vCheckResult *res, res->corruptions =3D 0; res->leaks =3D 0; =20 - /* Because the old reftable has been exchanged for a new one the - * references have to be recalculated */ + /* Da die alte refTable wurde f=C3=BCr eine neue ausgetauscht de= r + * Referenzen sind neu berechnet werden */ rebuild =3D false; memset(refcount_table, 0, refcount_array_byte_size(s, nb_cluster= s)); ret =3D calculate_refcounts(bs, res, 0, &rebuild, &refcount_tabl= e, @@ -2255,9 +2283,10 @@ int qcow2_check_refcounts(BlockDriverState *bs, Bd= rvCheckResult *res, } =20 if (fix & BDRV_FIX_LEAKS) { - /* The old refcount structures are now leaked, fix it; the r= esult - * can be ignored, aside from leaks which were introduced by - * rebuild_refcount_structure() that could not be fixed */ + /* Die alten refcount Strukturen sind nun ausgelaufen ist, f= ixieren; + * das Ergebnis kann von Lecks ignoriert, beiseite, die durc= h + * eingef=C3=BChrt wurden rebuild_refcount_structure (), die= nicht + * repariert werden konnte */ BdrvCheckResult saved_res =3D *res; *res =3D (BdrvCheckResult){ 0 }; =20 @@ -2268,9 +2297,9 @@ int qcow2_check_refcounts(BlockDriverState *bs, Bdr= vCheckResult *res, "broken\n"); } =20 - /* Any leaks accounted for here were introduced by - * rebuild_refcount_structure() because that function has cr= eated a - * new refcount structure from scratch */ + /* Undichtigkeiten f=C3=BCr hier ber=C3=BCcksichtigt wurden = eingef=C3=BChrt + * durch rebuild_refcount_structure (), weil die Funktion + * erstellt eine neue refcount Struktur von Grund auf neu */ fresh_leaks =3D res->leaks; *res =3D saved_res; } @@ -2297,7 +2326,7 @@ int qcow2_check_refcounts(BlockDriverState *bs, Bdr= vCheckResult *res, } } =20 - /* check OFLAG_COPIED */ + /* =C3=BCberpr=C3=BCfen OFLAG_COPIED */ ret =3D check_oflag_copied(bs, res, fix); if (ret < 0) { goto fail; @@ -2316,18 +2345,22 @@ fail: ranges_overlap(offset, size, ofs, sz) =20 /* - * Checks if the given offset into the image file is actually free to us= e by - * looking for overlaps with important metadata sections (L1/L2 tables e= tc.), - * i.e. a sanity check without relying on the refcount tables. + * =C3=9Cberpr=C3=BCft, ob die in die Bilddatei angegebenen Offset ist e= igentlich frei + * durch die Verwendung Suche nach =C3=9Cberschneidungen mit wichtigen M= etadaten + * Abschnitten (L1 / L2-Tabellen etc.), das hei=C3=9Ft eine Plausibilit=C3= =A4tspr=C3=BCfung + * auf den refcount Tabellen, ohne sich. * - * The ign parameter specifies what checks not to perform (being a bitma= sk of - * QCow2MetadataOverlap values), i.e., what sections to ignore. + * Der ign Parameter gibt an, welche Schecks nicht durchzuf=C3=BChren (i= m Falle + * einer Bitmaske QCow2MetadataOverlap Werte), das hei=C3=9Ft, welche Ab= schnitte + * zu ignorieren. * - * Returns: - * - 0 if writing to this offset will not affect the mentioned metadata - * - a positive QCow2MetadataOverlap value indicating one overlapping se= ction - * - a negative value (-errno) indicating an error while performing a ch= eck, - * e.g. when bdrv_read failed on QCOW2_OL_INACTIVE_L2 + * Kehrt zur=C3=BCck: + * - 0, wenn Offset dieses Schreiben wird keinen Einfluss auf die genann= ten + * Metadaten + * - Ein positiver QCow2MetadataOverlap Wert ein =C3=9Cberlappungsbereic= h anzeigt, + * - Ein negativer Wert (-errno) einen Fehler anzeigt, w=C3=A4hrend eine= Pr=C3=BCfung + * durchgef=C3=BChrt wird, z.B. wenn bdrv_read fehlgeschlagen auf + * QCOW2_OL_INACTIVE_L2 */ int qcow2_check_metadata_overlap(BlockDriverState *bs, int ign, int64_t = offset, int64_t size) @@ -2346,7 +2379,7 @@ int qcow2_check_metadata_overlap(BlockDriverState *= bs, int ign, int64_t offset, } } =20 - /* align range to test to cluster boundaries */ + /* ausrichten Bereich Clustergrenzen zu testen */ size =3D align_offset(offset_into_cluster(s, offset) + size, s->clus= ter_size); offset =3D start_of_cluster(s, offset); =20 @@ -2444,14 +2477,16 @@ static const char *metadata_ol_names[] =3D { }; =20 /* - * First performs a check for metadata overlaps (through - * qcow2_check_metadata_overlap); if that fails with a negative value (e= rror - * while performing a check), that value is returned. If an impending ov= erlap - * is detected, the BDS will be made unusable, the qcow2 file marked cor= rupt - * and -EIO returned. + * Zun=C3=A4chst f=C3=BChrt eine Pr=C3=BCfung f=C3=BCr Metadaten =C3=9Cb= erlappungen (durch + * qcow2_check_metadata_overlap); wenn das nicht klappt mit einem negati= ven Wert + * (Fehler w=C3=A4hrend ein check) durchgef=C3=BChrt wird, wird dieser W= ert + * zur=C3=BCckgegeben. Wenn eine bevorstehende =C3=9Cberlappung erkannt = wird, werden die + * BDS unbrauchbar gemacht, markiert die qcow2 Datei besch=C3=A4digt und= -EIO + * zur=C3=BCckgegeben. * - * Returns 0 if there were neither overlaps nor errors while checking fo= r - * overlaps; or a negative value (-errno) on error. + * Gibt 0 zur=C3=BCck, wenn es weder =C3=9Cberschneidungen noch Fehler w= aren w=C3=A4hrend + * der =C3=9Cberpr=C3=BCfung f=C3=BCr =C3=BCberlappt; oder ein negativer= Wert (-errno) auf + * Fehler. */ int qcow2_pre_write_overlap_check(BlockDriverState *bs, int ign, int64_t= offset, int64_t size) @@ -2473,15 +2508,17 @@ int qcow2_pre_write_overlap_check(BlockDriverStat= e *bs, int ign, int64_t offset, return 0; } =20 -/* A pointer to a function of this type is given to walk_over_reftable()= . That - * function will create refblocks and pass them to a RefblockFinishOp on= ce they - * are completed (@refblock). @refblock_empty is set if the refblock is - * completely empty. +/* Ein Zeiger auf eine Funktion dieses Typs ist gegeben walk_over_reftab= le (). + * Dass Funktion refblocks erstellen und sie zu einem RefblockFinishOp, = sobald + * sie passieren abgeschlossen (@refblock) sind. @refblock_empty wird ge= setzt, + * wenn die refblock ist v=C3=B6llig leer. * - * Along with the refblock, a corresponding reftable entry is passed, in= the - * reftable @reftable (which may be reallocated) at @reftable_index. + * Zusammen mit dem refblock wird eine entsprechende refTable Eintrag + * vergangen, in der refTable @reftable bei @reftable_index (die neu + * zugeordnet werden kann). * - * @allocated should be set to true if a new cluster has been allocated. + * @allocated sollte auf true gesetzt werden, wenn ein neuer Cluster zug= eordnet + * ist. */ typedef int (RefblockFinishOp)(BlockDriverState *bs, uint64_t **reftable= , uint64_t reftable_index, uint64_t *reftab= le_size, @@ -2489,9 +2526,9 @@ typedef int (RefblockFinishOp)(BlockDriverState *bs= , uint64_t **reftable, bool *allocated, Error **errp); =20 /** - * This "operation" for walk_over_reftable() allocates the refblock on d= isk (if - * it is not empty) and inserts its offset into the new reftable. The si= ze of - * this new reftable is increased as required. + * Diese "Betrieb" f=C3=BCr walk_over_reftable () ordnet die refblock au= f der + * Festplatte (falls es ist nicht leer) und f=C3=BCgt seine in die neue = refTable + * versetzt. Die Gr=C3=B6=C3=9Fe von Diese neue refTable wird nach Bedar= f erh=C3=B6ht. */ static int alloc_refblock(BlockDriverState *bs, uint64_t **reftable, uint64_t reftable_index, uint64_t *reftable_si= ze, @@ -2542,9 +2579,9 @@ static int alloc_refblock(BlockDriverState *bs, uin= t64_t **reftable, } =20 /** - * This "operation" for walk_over_reftable() writes the refblock to disk= at the - * offset specified by the new reftable's entry. It does not modify the = new - * reftable or change any refcounts. + * Diese "Betrieb" f=C3=BCr walk_over_reftable () schreibt die refblock = auf die + * Festplatte an der Offset durch den neuen refTable der Eintrag angegeb= en. + * Es ver=C3=A4ndert nicht die neue refTable oder irgendwelche Refcounts= =C3=A4ndern. */ static int flush_refblock(BlockDriverState *bs, uint64_t **reftable, uint64_t reftable_index, uint64_t *reftable_si= ze, @@ -2577,17 +2614,20 @@ static int flush_refblock(BlockDriverState *bs, u= int64_t **reftable, } =20 /** - * This function walks over the existing reftable and every referenced r= efblock; - * if @new_set_refcount is non-NULL, it is called for every refcount ent= ry to - * create an equal new entry in the passed @new_refblock. Once that - * @new_refblock is completely filled, @operation will be called. + * Diese Funktion geht =C3=BCber die bestehende refTable und jedes refer= enzierte + * refblock; wenn @new_set_refcount nicht NULL ist, wird es f=C3=BCr jed= en + * refcount Eintrag aufgerufen eine gleiche neuen Eintrag in der =C3=BCb= ergebenen + * @new_refblock erstellen. Sobald das @new_refblock vollst=C3=A4ndig ge= f=C3=BCllt ist, + * wird @operation aufgerufen werden. * - * @status_cb and @cb_opaque are used for the amend operation's status c= allback. - * @index is the index of the walk_over_reftable() calls and @total is t= he total - * number of walk_over_reftable() calls per amend operation. Both are us= ed for - * calculating the parameters for the status callback. + * @status_cb und @cb_opaque sind f=C3=BCr die =C3=84nderung der Operati= on Status + * R=C3=BCckruf verwendet. @index ist der Index des walk_over_reftable (= ) aufruft + * und @total ist die Gesamt Anzahl der walk_over_reftable () ruft pro + * Betrieb =C3=A4ndern. Beide werden verwendet f=C3=BCr Berechnen der Pa= rameter f=C3=BCr + * den Status R=C3=BCckruf. * - * @allocated is set to true if a new cluster has been allocated. + * @allocated auf true gesetzt ist, wenn ein neuer Cluster zugeordnet wo= rden + * ist. */ static int walk_over_reftable(BlockDriverState *bs, uint64_t **new_refta= ble, uint64_t *new_reftable_index, @@ -2642,7 +2682,7 @@ static int walk_over_reftable(BlockDriverState *bs,= uint64_t **new_reftable, uint64_t refcount; =20 if (new_refblock_index >=3D new_refblock_size) { - /* new_refblock is now complete */ + /* new_refblock ist nun abgeschlossen */ ret =3D operation(bs, new_reftable, *new_reftable_in= dex, new_reftable_size, new_refblock, new_refblock_empty, allocated, errp)= ; @@ -2683,12 +2723,12 @@ static int walk_over_reftable(BlockDriverState *b= s, uint64_t **new_reftable, =20 qcow2_cache_put(bs, s->refcount_block_cache, &refblock); } else { - /* No refblock means every refcount is 0 */ + /* Keine refblock bedeutet, dass jeder refcount 0 */ for (refblock_index =3D 0; refblock_index < s->refcount_bloc= k_size; refblock_index++) { if (new_refblock_index >=3D new_refblock_size) { - /* new_refblock is now complete */ + /* new_refblock ist nun abgeschlossen */ ret =3D operation(bs, new_reftable, *new_reftable_in= dex, new_reftable_size, new_refblock, new_refblock_empty, allocated, errp)= ; @@ -2711,7 +2751,8 @@ static int walk_over_reftable(BlockDriverState *bs,= uint64_t **new_reftable, } =20 if (new_refblock_index > 0) { - /* Complete the potentially existing partially filled final refb= lock */ + /* F=C3=BCllen Sie das potenziell vorhandene teilweise gef=C3=BC= llt letzte + * refblock */ if (new_set_refcount) { for (; new_refblock_index < new_refblock_size; new_refblock_index++) @@ -2758,7 +2799,7 @@ int qcow2_change_refcount_order(BlockDriverState *b= s, int refcount_order, assert(s->qcow_version >=3D 3); assert(refcount_order >=3D 0 && refcount_order <=3D 6); =20 - /* see qcow2_open() */ + /* siehe qcow2_open () */ new_refblock_size =3D 1 << (s->cluster_bits - (refcount_order - 3)); =20 new_get_refcount =3D get_refcount_funcs[refcount_order]; @@ -2770,15 +2811,15 @@ int qcow2_change_refcount_order(BlockDriverState = *bs, int refcount_order, =20 new_allocation =3D false; =20 - /* At least we have to do this walk and the one which writes the - * refblocks; also, at least we have to do this loop here at lea= st - * twice (normally), first to do the allocations, and second to - * determine that everything is correctly allocated, this then m= akes - * three walks in total */ + /* Wenigstens haben wir diesen Weg und das eine zu tun, die das = schreibt + * refblocks; auch, zumindest m=C3=BCssen wir hier zumindest die= se Schleife + * zu tun zweimal (in der Regel), zuerst die Zuweisungen zu tun,= und an + * zweiter Stelle zu feststellen, dass alles korrekt zugeordnet = ist, + * dies dann macht drei Wanderungen insgesamt */ total_walks =3D MAX(walk_index + 2, 3); =20 - /* First, allocate the structures so they are present in the ref= count - * structures */ + /* Zun=C3=A4chst erfolgt die Zuweisung der Strukturen, so dass s= ie in der + * refcount Strukturen */ ret =3D walk_over_reftable(bs, &new_reftable, &new_reftable_inde= x, &new_reftable_size, NULL, new_refblock_= size, new_refcount_bits, &alloc_refblock, @@ -2809,7 +2850,7 @@ int qcow2_change_refcount_order(BlockDriverState *b= s, int refcount_order, } } while (new_allocation); =20 - /* Second, write the new refblocks */ + /* Zweitens schreiben die neuen refblocks */ ret =3D walk_over_reftable(bs, &new_reftable, &new_reftable_index, &new_reftable_size, new_refblock, new_refblock_size, new_refcount_bits, @@ -2822,7 +2863,7 @@ int qcow2_change_refcount_order(BlockDriverState *b= s, int refcount_order, assert(!new_allocation); =20 =20 - /* Write the new reftable */ + /* Schreiben Sie die neue refTable */ ret =3D qcow2_pre_write_overlap_check(bs, 0, new_reftable_offset, new_reftable_size * sizeof(uint6= 4_t)); if (ret < 0) { @@ -2847,17 +2888,18 @@ int qcow2_change_refcount_order(BlockDriverState = *bs, int refcount_order, } =20 =20 - /* Empty the refcount cache */ + /* Leeren Sie den Cache refcount */ ret =3D qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { error_setg_errno(errp, -ret, "Failed to flush the refblock cache= "); goto done; } =20 - /* Update the image header to point to the new reftable; this only u= pdates - * the fields which are relevant to qcow2_update_header(); other fie= lds - * such as s->refcount_table or s->refcount_bits stay stale for now - * (because we have to restore everything if qcow2_update_header() f= ails) */ + /* Aktualisieren Sie die Bild-Header an den neuen refTable zu zeigen= ; + * diese nur Updates die Felder, die zu qcow2_update_header() releva= nt + * sind; anderen Bereichen wie s-> refcount_table oder + * s-> refcount_bits jetzt abgestanden bleiben (Weil wir alles + * wiederherstellen, wenn qcow2_update_header () fehlschl=C3=A4gt) *= / old_refcount_order =3D s->refcount_order; old_reftable_size =3D s->refcount_table_size; old_reftable_offset =3D s->refcount_table_offset; @@ -2875,7 +2917,7 @@ int qcow2_change_refcount_order(BlockDriverState *b= s, int refcount_order, goto done; } =20 - /* Now update the rest of the in-memory information */ + /* Jetzt aktualisieren den Rest der In-Memory-Informationen */ old_reftable =3D s->refcount_table; s->refcount_table =3D new_reftable; =20 @@ -2889,17 +2931,17 @@ int qcow2_change_refcount_order(BlockDriverState = *bs, int refcount_order, s->get_refcount =3D new_get_refcount; s->set_refcount =3D new_set_refcount; =20 - /* For cleaning up all old refblocks and the old reftable below the = "done" - * label */ + /* F=C3=BCr alle alten refblocks und die alte refTable unter dem "fe= rtig" + * Aufr=C3=A4umen Etikette */ new_reftable =3D old_reftable; new_reftable_size =3D old_reftable_size; new_reftable_offset =3D old_reftable_offset; =20 done: if (new_reftable) { - /* On success, new_reftable actually points to the old reftable = (and - * new_reftable_size is the old reftable's size); but that is ju= st - * fine */ + /* Bei Erfolg zeigt new_reftable tats=C3=A4chlich auf die alte r= efTable (und + * new_reftable_size ist die alte refTable Gr=C3=B6=C3=9Fe); abe= r das ist nur + * fein */ for (i =3D 0; i < new_reftable_size; i++) { uint64_t offset =3D new_reftable[i] & REFT_OFFSET_MASK; if (offset) { diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index 5f4a17e..8fd79a8 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c @@ -64,7 +64,7 @@ int qcow2_read_snapshots(BlockDriverState *bs) s->snapshots =3D g_new0(QCowSnapshot, s->nb_snapshots); =20 for(i =3D 0; i < s->nb_snapshots; i++) { - /* Read statically sized part of the snapshot header */ + /* Lesen Sie statisch Gr=C3=B6=C3=9Fe Teil des Snapshot-Header *= / offset =3D align_offset(offset, 8); ret =3D bdrv_pread(bs->file->bs, offset, &h, sizeof(h)); if (ret < 0) { @@ -84,7 +84,7 @@ int qcow2_read_snapshots(BlockDriverState *bs) id_str_size =3D be16_to_cpu(h.id_str_size); name_size =3D be16_to_cpu(h.name_size); =20 - /* Read extra data */ + /* Lesen Sie zus=C3=A4tzliche Daten */ ret =3D bdrv_pread(bs->file->bs, offset, &extra, MIN(sizeof(extra), extra_data_size)); if (ret < 0) { @@ -102,7 +102,7 @@ int qcow2_read_snapshots(BlockDriverState *bs) sn->disk_size =3D bs->total_sectors * BDRV_SECTOR_SIZE; } =20 - /* Read snapshot ID */ + /* Lesen Sie Snapshot-ID */ sn->id_str =3D g_malloc(id_str_size + 1); ret =3D bdrv_pread(bs->file->bs, offset, sn->id_str, id_str_size= ); if (ret < 0) { @@ -111,7 +111,7 @@ int qcow2_read_snapshots(BlockDriverState *bs) offset +=3D id_str_size; sn->id_str[id_str_size] =3D '\0'; =20 - /* Read snapshot name */ + /* Lesen Sie Snapshot-Name */ sn->name =3D g_malloc(name_size + 1); ret =3D bdrv_pread(bs->file->bs, offset, sn->name, name_size); if (ret < 0) { @@ -135,7 +135,7 @@ fail: return ret; } =20 -/* add at the end of the file a new list of snapshots */ +/* eine neue Liste von Snapshots am Ende der Datei hinzuf=C3=BCgen */ static int qcow2_write_snapshots(BlockDriverState *bs) { BDRVQcow2State *s =3D bs->opaque; @@ -150,7 +150,7 @@ static int qcow2_write_snapshots(BlockDriverState *bs= ) int64_t offset, snapshots_offset =3D 0; int ret; =20 - /* compute the size of the snapshots */ + /* Berechnen der Gr=C3=B6=C3=9Fe der Schnappsch=C3=BCsse */ offset =3D 0; for(i =3D 0; i < s->nb_snapshots; i++) { sn =3D s->snapshots + i; @@ -169,7 +169,7 @@ static int qcow2_write_snapshots(BlockDriverState *bs= ) assert(offset <=3D INT_MAX); snapshots_size =3D offset; =20 - /* Allocate space for the new snapshot list */ + /* Ordnen Sie Platz f=C3=BCr die neue Snapshot-Liste */ snapshots_offset =3D qcow2_alloc_clusters(bs, snapshots_size); offset =3D snapshots_offset; if (offset < 0) { @@ -181,22 +181,23 @@ static int qcow2_write_snapshots(BlockDriverState *= bs) goto fail; } =20 - /* The snapshot list position has not yet been updated, so these clu= sters - * must indeed be completely free */ + /* Die Snapshot-Liste Position wurde noch nicht aktualisiert worden,= so dass + * diese Cluster muss in der Tat v=C3=B6llig frei sein */ ret =3D qcow2_pre_write_overlap_check(bs, 0, offset, snapshots_size)= ; if (ret < 0) { goto fail; } =20 =20 - /* Write all snapshots to the new list */ + /* Schreiben Sie alle Snapshots auf die neue Liste */ for(i =3D 0; i < s->nb_snapshots; i++) { sn =3D s->snapshots + i; memset(&h, 0, sizeof(h)); h.l1_table_offset =3D cpu_to_be64(sn->l1_table_offset); h.l1_size =3D cpu_to_be32(sn->l1_size); - /* If it doesn't fit in 32 bit, older implementations should tre= at it - * as a disk-only snapshot rather than truncate the VM state */ + /* Wenn es nicht in 32-Bit passt, =C3=A4lteren Implementierungen= sollte es + * behandeln als scheiben nur snapshot anstatt die VM Zustand + * trunkieren */ if (sn->vm_state_size <=3D 0xffffffff) { h.vm_state_size =3D cpu_to_be32(sn->vm_state_size); } @@ -242,8 +243,9 @@ static int qcow2_write_snapshots(BlockDriverState *bs= ) } =20 /* - * Update the header to point to the new snapshot table. This requir= es the - * new table and its refcounts to be stable on disk. + * Aktualisieren Sie den Header an den neuen Snapshot-Tabelle zu ver= weisen. + * Dies erfordert die neue Tabelle, und seine Refcounts auf der Plat= te + * stabil. */ ret =3D bdrv_flush(bs); if (ret < 0) { @@ -262,7 +264,7 @@ static int qcow2_write_snapshots(BlockDriverState *bs= ) goto fail; } =20 - /* free the old snapshot table */ + /* befreien die alte Snapshot-Tabelle */ qcow2_free_clusters(bs, s->snapshots_offset, s->snapshots_size, QCOW2_DISCARD_SNAPSHOT); s->snapshots_offset =3D snapshots_offset; @@ -337,7 +339,7 @@ static int find_snapshot_by_id_or_name(BlockDriverSta= te *bs, return find_snapshot_by_id_and_name(bs, NULL, id_or_name); } =20 -/* if no id is provided, a new one is constructed */ +/* wenn keine ID angegeben ist, wird eine neue gebaut */ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_inf= o) { BDRVQcow2State *s =3D bs->opaque; @@ -354,15 +356,15 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEM= USnapshotInfo *sn_info) =20 memset(sn, 0, sizeof(*sn)); =20 - /* Generate an ID */ + /* Generieren Sie eine ID */ find_new_snapshot_id(bs, sn_info->id_str, sizeof(sn_info->id_str)); =20 - /* Check that the ID is unique */ + /* =C3=9Cberpr=C3=BCfen Sie, ob die ID eindeutig ist */ if (find_snapshot_by_id_and_name(bs, sn_info->id_str, NULL) >=3D 0) = { return -EEXIST; } =20 - /* Populate sn with passed data */ + /* Best=C3=BCcken sn mit =C3=BCbergebenen Daten */ sn->id_str =3D g_strdup(sn_info->id_str); sn->name =3D g_strdup(sn_info->name); =20 @@ -372,7 +374,8 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUS= napshotInfo *sn_info) sn->date_nsec =3D sn_info->date_nsec; sn->vm_clock_nsec =3D sn_info->vm_clock_nsec; =20 - /* Allocate the L1 table of the snapshot and copy the current one th= ere. */ + /* Ordnen Sie die L1-Tabelle des Schnappschusses und kopieren Sie di= e + * aktuelle. */ l1_table_offset =3D qcow2_alloc_clusters(bs, s->l1_size * sizeof(uin= t64_t)); if (l1_table_offset < 0) { ret =3D l1_table_offset; @@ -408,16 +411,16 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEM= USnapshotInfo *sn_info) l1_table =3D NULL; =20 /* - * Increase the refcounts of all clusters and make sure everything i= s - * stable on disk before updating the snapshot table to contain a po= inter - * to the new L1 table. + * Erh=C3=B6hen Sie die Refcounts aller Cluster und stellen Sie sich= er, alles + * ist stabil auf der Festplatte, bevor Sie den Snapshot-Tabelle zu + * aktualisieren einen Zeiger enthalten auf die neue L1-Tabelle. */ ret =3D qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1= _size, 1); if (ret < 0) { goto fail; } =20 - /* Append the new snapshot to the snapshot list */ + /* F=C3=BCgen Sie den neuen Snapshot auf die Snapshot-Liste */ new_snapshot_list =3D g_new(QCowSnapshot, s->nb_snapshots + 1); if (s->snapshots) { memcpy(new_snapshot_list, s->snapshots, @@ -437,8 +440,9 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUS= napshotInfo *sn_info) =20 g_free(old_snapshot_list); =20 - /* The VM state isn't needed any more in the active L1 table; in fac= t, it - * hurts by causing expensive COW for the next snapshot. */ + /* Der VM-Status ist nicht mehr in der aktiven L1 Tabelle ben=C3=B6t= igt wird; in + * der Tat, es verletzt durch teure KUH f=C3=BCr den n=C3=A4chsten S= chnappschuss zu + * verursachen. */ qcow2_discard_clusters(bs, qcow2_vm_state_offset(s), align_offset(sn->vm_state_size, s->cluster_si= ze) >> BDRV_SECTOR_BITS, @@ -460,7 +464,7 @@ fail: return ret; } =20 -/* copy the snapshot 'snapshot_name' into the current disk image */ +/* Kopieren Sie den Snapshot 'snapshot_name' in die aktuelle Disk-Image = */ int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id) { BDRVQcow2State *s =3D bs->opaque; @@ -470,7 +474,7 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const c= har *snapshot_id) int ret; uint64_t *sn_l1_table =3D NULL; =20 - /* Search the snapshot */ + /* Suchen Sie den Snapshot */ snapshot_index =3D find_snapshot_by_id_or_name(bs, snapshot_id); if (snapshot_index < 0) { return -ENOENT; @@ -485,9 +489,10 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const = char *snapshot_id) } =20 /* - * Make sure that the current L1 table is big enough to contain the = whole - * L1 table of the snapshot. If the snapshot L1 table is smaller, th= e - * current one must be padded with zeros. + * Stellen Sie sicher, dass der Strom L1 Tabelle gro=C3=9F genug ist= , um das + * Ganze zu enthalten L1 Tabelle des Schnappschusses. Wenn der + * Snapshot-L1-Tabelle ist kleiner, die Strom muss man mit Nullen + * aufgef=C3=BCllt werden. */ ret =3D qcow2_grow_l1_table(bs, sn->l1_size, true); if (ret < 0) { @@ -498,12 +503,12 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const= char *snapshot_id) sn_l1_bytes =3D sn->l1_size * sizeof(uint64_t); =20 /* - * Copy the snapshot L1 table to the current L1 table. + * Kopieren Sie den Snapshot-L1-Tabelle auf den aktuellen L1-Tabelle= . * - * Before overwriting the old current L1 table on disk, make sure to - * increase all refcounts for the clusters referenced by the new one= . - * Decrease the refcount referenced by the old one only when the L1 - * table is overwritten. + * Vor dem =C3=9Cberschreiben der Festplatte des alten Strom L1 Tabe= lle, stellen + * Sie sicher, erh=C3=B6hen alle Refcounts f=C3=BCr die durch den ne= uen verwiesen + * Cluster. Verringern Sie die refcount durch die alte verwiesen nur= , + * wenn die L1 Tabelle =C3=BCberschrieben. */ sn_l1_table =3D g_try_malloc0(cur_l1_bytes); if (cur_l1_bytes && sn_l1_table =3D=3D NULL) { @@ -536,21 +541,22 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const= char *snapshot_id) } =20 /* - * Decrease refcount of clusters of current L1 table. + * Verringern Sie refcount von Clustern von Strom L1-Tabelle. * - * At this point, the in-memory s->l1_table points to the old L1 tab= le, - * whereas on disk we already have the new one. + * An diesem Punkt, der In-Memory-s-> l1_table Punkte auf den alten + * L1 Tabelle w=C3=A4hrend auf der Festplatte haben wir bereits die = neuen. * - * qcow2_update_snapshot_refcount special cases the current L1 table= to use - * the in-memory data instead of really using the offset to load a n= ew one, - * which is why this works. + * qcow2_update_snapshot_refcount besonderen F=C3=A4llen die aktuell= e L1 Tabelle + * zu verwenden, die im Speicher befindlichen Daten, anstatt wirklic= h den + * Offset zu laden eine neue Verwendung, weshalb das funktioniert. */ ret =3D qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1_size, -1); =20 /* - * Now update the in-memory L1 table to be in sync with the on-disk = one. We - * need to do this even if updating refcounts failed. + * Jetzt aktualisieren, um die In-Memory-L1-Tabelle mit der On-Disk = eine + * vollkommen synchron sein. Wir m=C3=BCssen dies selbst dann, wenn = die + * Aktualisierung Refcounts nicht getan. */ for(i =3D 0;i < s->l1_size; i++) { s->l1_table[i] =3D be64_to_cpu(sn_l1_table[i]); @@ -564,8 +570,8 @@ int qcow2_snapshot_goto(BlockDriverState *bs, const c= har *snapshot_id) sn_l1_table =3D NULL; =20 /* - * Update QCOW_OFLAG_COPIED in the active L1 table (it may have chan= ged - * when we decreased the refcount of the old snapshot. + * Update QCOW_OFLAG_COPIED in der aktiven L1-Tabelle (es mag sich g= e=C3=A4ndert + * haben wenn wir verringerte die refcount des alten Schnappschuss. */ ret =3D qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1= _size, 0); if (ret < 0) { @@ -594,7 +600,7 @@ int qcow2_snapshot_delete(BlockDriverState *bs, QCowSnapshot sn; int snapshot_index, ret; =20 - /* Search the snapshot */ + /* Suchen Sie den Snapshot */ snapshot_index =3D find_snapshot_by_id_and_name(bs, snapshot_id, nam= e); if (snapshot_index < 0) { error_setg(errp, "Can't find the snapshot"); @@ -602,7 +608,7 @@ int qcow2_snapshot_delete(BlockDriverState *bs, } sn =3D s->snapshots[snapshot_index]; =20 - /* Remove it from the snapshot list */ + /* Entfernen Sie es aus der Snapshot-Liste */ memmove(s->snapshots + snapshot_index, s->snapshots + snapshot_index + 1, (s->nb_snapshots - snapshot_index - 1) * sizeof(sn)); @@ -615,15 +621,15 @@ int qcow2_snapshot_delete(BlockDriverState *bs, } =20 /* - * The snapshot is now unused, clean up. If we fail after this point= , we - * won't recover but just leak clusters. + * Der Snapshot jetzt ungenutzt ist, aufzur=C3=A4umen. Wenn wir nich= t nach + * diesem Punkt, wir wird sich nicht erholen, sondern Cluster auslau= fen nur. */ g_free(sn.id_str); g_free(sn.name); =20 /* - * Now decrease the refcounts of clusters referenced by the snapshot= and - * free the L1 table. + * Jetzt die Refcounts von Clustern durch Snapshot referenziert verr= ingern + * und befreien die L1-Tabelle. */ ret =3D qcow2_update_snapshot_refcount(bs, sn.l1_table_offset, sn.l1_size, -1); @@ -634,7 +640,8 @@ int qcow2_snapshot_delete(BlockDriverState *bs, qcow2_free_clusters(bs, sn.l1_table_offset, sn.l1_size * sizeof(uint= 64_t), QCOW2_DISCARD_SNAPSHOT); =20 - /* must update the copied flag on the current cluster offsets */ + /* die kopierte Flagge auf den aktuellen Cluster-Offsets muss aktual= isiert + * werden */ ret =3D qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1= _size, 0); if (ret < 0) { error_setg_errno(errp, -ret, @@ -694,7 +701,7 @@ int qcow2_snapshot_load_tmp(BlockDriverState *bs, =20 assert(bs->read_only); =20 - /* Search the snapshot */ + /* Suchen Sie den Snapshot */ snapshot_index =3D find_snapshot_by_id_and_name(bs, snapshot_id, nam= e); if (snapshot_index < 0) { error_setg(errp, @@ -703,7 +710,7 @@ int qcow2_snapshot_load_tmp(BlockDriverState *bs, } sn =3D &s->snapshots[snapshot_index]; =20 - /* Allocate and read in the snapshot's L1 table */ + /* Ordnen und in der Snapshot-L1-Tabelle lesen */ if (sn->l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) { error_setg(errp, "Snapshot L1 table too large"); return -EFBIG; @@ -723,7 +730,7 @@ int qcow2_snapshot_load_tmp(BlockDriverState *bs, return ret; } =20 - /* Switch the L1 table */ + /* Schalten Sie den L1-Tabelle */ qemu_vfree(s->l1_table); =20 s->l1_size =3D sn->l1_size; diff --git a/block/qcow2.c b/block/qcow2.c index 056525c..d2aa94b 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -38,19 +38,19 @@ #include "qemu/cutils.h" =20 /* - Differences with QCOW: - - - Support for multiple incremental snapshots. - - Memory management by reference counts. - - Clusters which have a reference count of one have the bit - QCOW_OFLAG_COPIED to optimize write performance. - - Size of compressed clusters is stored in sectors to reduce bit usage - in the cluster offsets. - - Support for storing additional data (such as the VM state) in the - snapshots. - - If a backing store is used, the cluster size is not constrained - (could be backported to QCOW). - - L2 tables have always a size of one cluster. + Unterschiede mit qcow: + + - Unterst=C3=BCtzung f=C3=BCr mehrere inkrementelle Snapshots. + - Speicherverwaltung durch Verweis z=C3=A4hlt. + - Cluster, die einen Referenzz=C3=A4hler ein, haben die M=C3=B6glichke= it Bit + QCOW_OFLAG_COPIED Schreibleistung zu optimieren. + - Gr=C3=B6=C3=9Fe der komprimierten Cluster wird in Sektoren gespeiche= rt Bitverwendung + reduzieren in den Cluster-Offsets. + - Unterst=C3=BCtzung f=C3=BCr die Speicherung von zus=C3=A4tzlichen Da= ten (wie die + VM-Zustand) in der Schnappsch=C3=BCsse. + - Wenn ein Zusatzspeicher verwendet wird, wird die Clustergr=C3=B6=C3=9F= e nicht + eingeschr=C3=A4nkt (K=C3=B6nnte zu qcow zur=C3=BCckportiert werden). + - L2-Tabellen haben immer eine Gr=C3=B6=C3=9Fe eines Clusters. */ =20 =20 @@ -77,11 +77,12 @@ static int qcow2_probe(const uint8_t *buf, int buf_si= ze, const char *filename) =20 =20 /*=20 - * read qcow2 extension and fill bs - * start reading from start_offset - * finish reading upon magic of value 0 or when end_offset reached - * unknown magic is skipped (future extension this version knows nothing= about) - * return 0 upon success, non-0 otherwise + * lesen qcow2 Erweiterung und f=C3=BCllen bs + * Start von START_OFFSET lesen + * Ende lesen auf Magie der Wert 0 oder wenn end_offset erreicht + * unbekannt Magie wird =C3=BCbersprungen (zuk=C3=BCnftige Erweiterung d= ieser Version + * nichts wei=C3=9F) + * return 0 auf Erfolg, nicht 0 sonst */ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_of= fset, uint64_t end_offset, void **p_feature_t= able, @@ -99,7 +100,7 @@ static int qcow2_read_extensions(BlockDriverState *bs,= uint64_t start_offset, while (offset < end_offset) { =20 #ifdef DEBUG_EXT - /* Sanity check */ + /* Gesundheits=C3=BCberpr=C3=BCfung */ if (offset > s->cluster_size) printf("qcow2_read_extension: suspicious offset %lu\n", offs= et); =20 @@ -162,7 +163,8 @@ static int qcow2_read_extensions(BlockDriverState *bs= , uint64_t start_offset, break; =20 default: - /* unknown magic - save it in case we need to rewrite the he= ader */ + /* unbekannt Magie - es f=C3=BCr den Fall, speichern wir den= Header neu + * schreiben m=C3=BCssen */ { Qcow2UnknownHeaderExtension *uext; =20 @@ -229,11 +231,11 @@ static void report_unsupported_feature(Error **errp= , Qcow2Feature *table, } =20 /* - * Sets the dirty bit and flushes afterwards if necessary. + * Setzt das Dirty-Bit und sp=C3=BClt danach, wenn n=C3=B6tig. * - * The incompatible_features bit is only set if the image file header wa= s - * updated successfully. Therefore it is not required to check the retu= rn - * value of this function. + * Das incompatible_features Bit wird nur gesetzt, wenn die Image-Datei-= Header + * war Erfolgreich geupdated. Daher ist es nicht erforderlich, um die R=C3= =BCckkehr + * zu =C3=BCberpr=C3=BCfen Wert dieser Funktion. */ int qcow2_mark_dirty(BlockDriverState *bs) { @@ -244,7 +246,7 @@ int qcow2_mark_dirty(BlockDriverState *bs) assert(s->qcow_version >=3D 3); =20 if (s->incompatible_features & QCOW2_INCOMPAT_DIRTY) { - return 0; /* already dirty */ + return 0; /* bereits verschmutzt */ } =20 val =3D cpu_to_be64(s->incompatible_features | QCOW2_INCOMPAT_DIRTY)= ; @@ -258,15 +260,16 @@ int qcow2_mark_dirty(BlockDriverState *bs) return ret; } =20 - /* Only treat image as dirty if the header was updated successfully = */ + /* Nur behandeln Bild als schmutzig, wenn der Header erfolgreich + * aktualisiert wurde */ s->incompatible_features |=3D QCOW2_INCOMPAT_DIRTY; return 0; } =20 /* - * Clears the dirty bit and flushes before if necessary. Only call this - * function when there are no pending requests, it does not guard agains= t - * concurrent requests dirtying the image. + * L=C3=B6scht das Dirty-Bit und sp=C3=BClt vor, wenn n=C3=B6tig. Nur ne= nnen dies + * Funktion, wenn es keine ausstehenden Anforderungen sind, ist es sch=C3= =BCtzen + * nicht gegen gleichzeitige Anforderungen das Bild zu beschmutzen. */ static int qcow2_mark_clean(BlockDriverState *bs) { @@ -288,7 +291,7 @@ static int qcow2_mark_clean(BlockDriverState *bs) } =20 /* - * Marks the image as corrupt. + * Markiert das Bild als korrupt. */ int qcow2_mark_corrupt(BlockDriverState *bs) { @@ -299,8 +302,8 @@ int qcow2_mark_corrupt(BlockDriverState *bs) } =20 /* - * Marks the image as consistent, i.e., unsets the corrupt bit, and flus= hes - * before if necessary. + * als konsistent markiert das Bild, das hei=C3=9Ft, f=C3=BChrt zum L=C3= =B6schen der + * besch=C3=A4digten Bit, und sp=C3=BClt vor, falls erforderlich. */ int qcow2_mark_consistent(BlockDriverState *bs) { @@ -342,8 +345,9 @@ static int validate_table_offset(BlockDriverState *bs= , uint64_t offset, BDRVQcow2State *s =3D bs->opaque; uint64_t size; =20 - /* Use signed INT64_MAX as the maximum even for uint64_t header fiel= ds, - * because values will be passed to qemu functions taking int64_t. *= / + /* Verwenden unterzeichnet INT64_MAX als Maximum auch f=C3=BCr + * uint64_t Header-Felder, weil Werte zu qemu-Funktionen =C3=BCberge= ben werden, + * wobei int64_t. */ if (entries > INT64_MAX / entry_len) { return -EINVAL; } @@ -354,7 +358,7 @@ static int validate_table_offset(BlockDriverState *bs= , uint64_t offset, return -EINVAL; } =20 - /* Tables must be cluster aligned */ + /* Tabellen m=C3=BCssen Cluster ausgerichtet werden */ if (offset & (s->cluster_size - 1)) { return -EINVAL; } @@ -460,7 +464,7 @@ static QemuOptsList qcow2_runtime_opts =3D { .type =3D QEMU_OPT_NUMBER, .help =3D "Clean unused cache entries after this time (in se= conds)", }, - { /* end of list */ } + { /* Ende der Liste */ } }, }; =20 @@ -608,7 +612,8 @@ static int qcow2_update_options_prepare(BlockDriverSt= ate *bs, goto fail; } =20 - /* get L2 table/refcount block cache size from command line options = */ + /* L2 Tabelle / refcount Block-Cache-Gr=C3=B6=C3=9Fe von Kommandozei= lenoptionen + * erhalten */ read_cache_sizes(bs, opts, &l2_cache_size, &refcount_cache_size, &local_err); if (local_err) { @@ -637,7 +642,7 @@ static int qcow2_update_options_prepare(BlockDriverSt= ate *bs, goto fail; } =20 - /* alloc new L2 table/refcount block cache, flush old one */ + /* alloc neue L2-Tabelle / refcount Block Cache, b=C3=BCndig alte */ if (s->l2_table_cache) { ret =3D qcow2_cache_flush(bs, s->l2_table_cache); if (ret) { @@ -663,7 +668,7 @@ static int qcow2_update_options_prepare(BlockDriverSt= ate *bs, goto fail; } =20 - /* New interval for cache cleanup timer */ + /* New Intervall f=C3=BCr die Cache-Bereinigung Timer */ r->cache_clean_interval =3D qemu_opt_get_number(opts, QCOW2_OPT_CACHE_CLEAN_INTERVAL, s->cache_clean_interval); @@ -673,7 +678,7 @@ static int qcow2_update_options_prepare(BlockDriverSt= ate *bs, goto fail; } =20 - /* lazy-refcounts; flush if going from enabled to disabled */ + /* lazy-Refcounts; b=C3=BCndig, wenn von behinderten gehen aktiviert= */ r->use_lazy_refcounts =3D qemu_opt_get_bool(opts, QCOW2_OPT_LAZY_REF= COUNTS, (s->compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS)); if (r->use_lazy_refcounts && s->qcow_version < 3) { @@ -691,7 +696,7 @@ static int qcow2_update_options_prepare(BlockDriverSt= ate *bs, } } =20 - /* Overlap check options */ + /* Overlap Pr=C3=BCfoptionen */ opt_overlap_check =3D qemu_opt_get(opts, QCOW2_OPT_OVERLAP); opt_overlap_check_template =3D qemu_opt_get(opts, QCOW2_OPT_OVERLAP_= TEMPLATE); if (opt_overlap_check_template && opt_overlap_check && @@ -725,8 +730,8 @@ static int qcow2_update_options_prepare(BlockDriverSt= ate *bs, =20 r->overlap_check =3D 0; for (i =3D 0; i < QCOW2_OL_MAX_BITNR; i++) { - /* overlap-check defines a template bitmask, but every flag may = be - * overwritten through the associated boolean option */ + /* Overlap-Check definiert eine Vorlage bitmask, aber jede Fahne= kann + * sein, durch die zugeh=C3=B6rige boolean Option =C3=BCberschri= eben */ r->overlap_check |=3D qemu_opt_get_bool(opts, overlap_bool_option_names[i], overlap_check_template & (1 << i)) << i; @@ -848,7 +853,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *op= tions, int flags, =20 s->qcow_version =3D header.version; =20 - /* Initialise cluster size */ + /* Initialisiere Clustergr=C3=B6=C3=9Fe */ if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { error_setg(errp, "Unsupported cluster size: 2^%" PRIu32, @@ -861,7 +866,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *op= tions, int flags, s->cluster_size =3D 1 << s->cluster_bits; s->cluster_sectors =3D 1 << (s->cluster_bits - 9); =20 - /* Initialise version 3 header fields */ + /* Initialisiere Version 3-Header-Felder */ if (header.version =3D=3D 2) { header.incompatible_features =3D 0; header.compatible_features =3D 0; @@ -912,7 +917,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *op= tions, int flags, ext_end =3D 1 << header.cluster_bits; } =20 - /* Handle feature bits */ + /* Handle Feature Bits */ s->incompatible_features =3D header.incompatible_features; s->compatible_features =3D header.compatible_features; s->autoclear_features =3D header.autoclear_features; @@ -930,7 +935,8 @@ static int qcow2_open(BlockDriverState *bs, QDict *op= tions, int flags, } =20 if (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT) { - /* Corrupt images may not be written to unless they are being re= paired + /* Corrupt Bilder k=C3=B6nnen nicht geschrieben werden, es sei d= enn, sie + * repariert werden */ if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_CHECK)) { error_setg(errp, "qcow2: Image is corrupt; cannot be opened = " @@ -940,7 +946,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *op= tions, int flags, } } =20 - /* Check support for various header values */ + /* =C3=9Cberpr=C3=BCfen Sie die Unterst=C3=BCtzung f=C3=BCr verschie= dene Header-Werte */ if (header.refcount_order > 6) { error_setg(errp, "Reference count entry width too large; may not= " "exceed 64 bits"); @@ -976,9 +982,9 @@ static int qcow2_open(BlockDriverState *bs, QDict *op= tions, int flags, bs->encrypted =3D 1; } =20 - s->l2_bits =3D s->cluster_bits - 3; /* L2 is always one cluster */ + s->l2_bits =3D s->cluster_bits - 3; /* L2 ist immer ein Cluster */ s->l2_size =3D 1 << s->l2_bits; - /* 2^(s->refcount_order - 3) is the refcount width in bytes */ + /* 2 ^ (s-> refcount_order - 3) ist die refcount Breite in Bytes */ s->refcount_block_bits =3D s->cluster_bits - (s->refcount_order - 3)= ; s->refcount_block_size =3D 1 << s->refcount_block_bits; bs->total_sectors =3D header.size / 512; @@ -1003,7 +1009,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *= options, int flags, goto fail; } =20 - /* Snapshot table offset/length */ + /* Snapshot-Tabelle Offset / L=C3=A4nge */ if (header.nb_snapshots > QCOW_MAX_SNAPSHOTS) { error_setg(errp, "Too many snapshots"); ret =3D -EINVAL; @@ -1018,7 +1024,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *= options, int flags, goto fail; } =20 - /* read the level 1 table */ + /* Lesen Sie die Ebene 1 Tisch */ if (header.l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) { error_setg(errp, "Active L1 table too large"); ret =3D -EFBIG; @@ -1034,8 +1040,8 @@ static int qcow2_open(BlockDriverState *bs, QDict *= options, int flags, } s->l1_vm_state_index =3D l1_vm_state_index; =20 - /* the L1 table must contain at least enough entries to put - header.size bytes */ + /* die L1-Tabelle muss mindestens gen=C3=BCgend Eintr=C3=A4ge enthal= ten setzen + header.size Bytes */ if (s->l1_size < s->l1_vm_state_index) { error_setg(errp, "L1 table is too small"); ret =3D -EINVAL; @@ -1070,14 +1076,14 @@ static int qcow2_open(BlockDriverState *bs, QDict= *options, int flags, } } =20 - /* Parse driver-specific options */ + /* Parse treiberspezifischen Optionen */ ret =3D qcow2_update_options(bs, options, flags, errp); if (ret < 0) { goto fail; } =20 s->cluster_cache =3D g_malloc(s->cluster_size); - /* one more sector for decompressed data alignment */ + /* ein weiterer Sektor f=C3=BCr die Ausrichtung dekomprimiert Daten = */ s->cluster_data =3D qemu_try_blockalign(bs->file->bs, QCOW_MAX_CRYPT= _CLUSTERS * s->cluster_size + = 512); if (s->cluster_data =3D=3D NULL) { @@ -1098,7 +1104,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *= options, int flags, QLIST_INIT(&s->cluster_allocs); QTAILQ_INIT(&s->discards); =20 - /* read qcow2 extensions */ + /* lesen qcow2 Erweiterungen */ if (qcow2_read_extensions(bs, header.header_length, ext_end, NULL, &local_err)) { error_propagate(errp, local_err); @@ -1106,7 +1112,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *= options, int flags, goto fail; } =20 - /* read the backing file name */ + /* Lesen Sie die Unterst=C3=BCtzung Dateinamen */ if (header.backing_file_offset !=3D 0) { len =3D header.backing_file_size; if (len > MIN(1023, s->cluster_size - header.backing_file_offset= ) || @@ -1125,7 +1131,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *= options, int flags, s->image_backing_file =3D g_strdup(bs->backing_file); } =20 - /* Internal snapshots */ + /* Interne Schnappsch=C3=BCsse */ s->snapshots_offset =3D header.snapshots_offset; s->nb_snapshots =3D header.nb_snapshots; =20 @@ -1135,7 +1141,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *= options, int flags, goto fail; } =20 - /* Clear unknown autoclear feature bits */ + /* Klar unbekannt AUTOCLEAR- Feature Bits */ if (!bs->read_only && !(flags & BDRV_O_INACTIVE) && s->autoclear_fea= tures) { s->autoclear_features =3D 0; ret =3D qcow2_update_header(bs); @@ -1145,10 +1151,10 @@ static int qcow2_open(BlockDriverState *bs, QDict= *options, int flags, } } =20 - /* Initialise locks */ + /* Initialisiere Schl=C3=B6sser */ qemu_co_mutex_init(&s->lock); =20 - /* Repair image if dirty */ + /* Reparatur Bild, wenn sie verschmutzt */ if (!(flags & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !bs->read_only && (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) { BdrvCheckResult result =3D {0}; @@ -1174,7 +1180,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *= options, int flags, qcow2_free_snapshots(bs); qcow2_refcount_close(bs); qemu_vfree(s->l1_table); - /* else pre-write overlap checks in cache_destroy may crash */ + /* sonst vorgeSchreib =C3=9Cberlappung Kontrollen in cache_destroy a= bst=C3=BCrzen */ s->l1_table =3D NULL; cache_clean_timer_del(bs); if (s->l2_table_cache) { @@ -1206,8 +1212,8 @@ static int qcow2_set_key(BlockDriverState *bs, cons= t char *key) len =3D strlen(key); if (len > 16) len =3D 16; - /* XXX: we could compress the chars to 7 bits to increase - entropy */ + /* XXX: wir konnten die Zeichen auf 7 Bit komprimieren zu erh=C3=B6h= en + Entropie */ for(i =3D 0;i < len;i++) { keybuf[i] =3D key[i]; } @@ -1221,9 +1227,9 @@ static int qcow2_set_key(BlockDriverState *bs, cons= t char *key) &err); =20 if (!s->cipher) { - /* XXX would be nice if errors in this method could - * be properly propagate to the caller. Would need - * the bdrv_set_key() API signature to be fixed. */ + /* XXX w=C3=A4re sch=C3=B6n, wenn Fehler in diesem Verfahren k=C3= =B6nnte + * werden richtig an den Aufrufer propagieren. W=C3=BCrde brauch= en + * die bdrv_set_key () API Signatur festgelegt werden. */ error_free(err); return -1; } @@ -1245,7 +1251,8 @@ static int qcow2_reopen_prepare(BDRVReopenState *st= ate, goto fail; } =20 - /* We need to write out any unwritten data if we reopen read-only. *= / + /* Wir m=C3=BCssen alle ungeschriebenen Daten schreiben, wenn wir + * schreibgesch=C3=BCtzt wieder =C3=B6ffnen. */ if ((state->flags & BDRV_O_RDWR) =3D=3D 0) { ret =3D bdrv_flush(state->bs); if (ret < 0) { @@ -1287,7 +1294,8 @@ static void qcow2_join_options(QDict *options, QDic= t *old_options) qdict_haskey(options, QCOW2_OPT_CACHE_SIZE); bool has_all_cache_options; =20 - /* New overlap template overrides all old overlap options */ + /* Vorlage New =C3=9Cberlappung =C3=BCberschreibt alle alten + * =C3=9Cberlappungsoptionen */ if (has_new_overlap_template) { qdict_del(old_options, QCOW2_OPT_OVERLAP); qdict_del(old_options, QCOW2_OPT_OVERLAP_TEMPLATE); @@ -1301,7 +1309,7 @@ static void qcow2_join_options(QDict *options, QDic= t *old_options) qdict_del(old_options, QCOW2_OPT_OVERLAP_INACTIVE_L2); } =20 - /* New total cache size overrides all old options */ + /* Neue Gesamtcachegr=C3=B6=C3=9Fe =C3=BCberschreibt alle alten Opti= onen */ if (qdict_haskey(options, QCOW2_OPT_CACHE_SIZE)) { qdict_del(old_options, QCOW2_OPT_L2_CACHE_SIZE); qdict_del(old_options, QCOW2_OPT_REFCOUNT_CACHE_SIZE); @@ -1310,9 +1318,10 @@ static void qcow2_join_options(QDict *options, QDi= ct *old_options) qdict_join(options, old_options, false); =20 /* - * If after merging all cache size options are set, an old total siz= e is - * overwritten. Do keep all options, however, if all three are new. = The - * resulting error message is what we want to happen. + * Wenn nach dem alle Cache-Gr=C3=B6=C3=9Fe Optionen fusionieren, ei= ne alte + * Gesamtgr=C3=B6=C3=9Fe ist =C3=BCberschrieben. Bewahren Sie alle O= ptionen, aber wenn + * alle drei neu sind. Das Fehlermeldung resultiert, ist, was wir wo= llen + * passieren. */ has_all_cache_options =3D qdict_haskey(options, QCOW2_OPT_CACHE_SIZE) || @@ -1355,7 +1364,7 @@ static int64_t coroutine_fn qcow2_co_get_block_stat= us(BlockDriverState *bs, return status; } =20 -/* handle reading after the end of the backing file */ +/* Griff nach dem Ende der Tr=C3=A4gerdatei gelesen */ int qcow2_backing_read1(BlockDriverState *bs, QEMUIOVector *qiov, int64_t sector_num, int nb_sectors) { @@ -1378,7 +1387,7 @@ static coroutine_fn int qcow2_co_readv(BlockDriverS= tate *bs, int64_t sector_num, BDRVQcow2State *s =3D bs->opaque; int index_in_cluster, n1; int ret; - int cur_nr_sectors; /* number of sectors in current iteration */ + int cur_nr_sectors; /* Anzahl der Sektoren in der aktuellen Iteratio= n */ uint64_t cluster_offset =3D 0; uint64_t bytes_done =3D 0; QEMUIOVector hd_qiov; @@ -1390,7 +1399,7 @@ static coroutine_fn int qcow2_co_readv(BlockDriverS= tate *bs, int64_t sector_num, =20 while (remaining_sectors !=3D 0) { =20 - /* prepare next request */ + /* Vorbereitung n=C3=A4chste Anfrage */ cur_nr_sectors =3D remaining_sectors; if (s->cipher) { cur_nr_sectors =3D MIN(cur_nr_sectors, @@ -1413,7 +1422,7 @@ static coroutine_fn int qcow2_co_readv(BlockDriverS= tate *bs, int64_t sector_num, case QCOW2_CLUSTER_UNALLOCATED: =20 if (bs->backing) { - /* read from the base image */ + /* lesen aus dem Basisbild */ n1 =3D qcow2_backing_read1(bs->backing->bs, &hd_qiov, sector_num, cur_nr_sectors); if (n1 > 0) { @@ -1436,7 +1445,7 @@ static coroutine_fn int qcow2_co_readv(BlockDriverS= tate *bs, int64_t sector_num, } } } else { - /* Note: in this case, no need to wait */ + /* Hinweis: in diesem Fall keine Notwendigkeit, warten *= / qemu_iovec_memset(&hd_qiov, 0, 0, 512 * cur_nr_sectors); } break; @@ -1446,7 +1455,7 @@ static coroutine_fn int qcow2_co_readv(BlockDriverS= tate *bs, int64_t sector_num, break; =20 case QCOW2_CLUSTER_COMPRESSED: - /* add AIO support for compressed blocks ? */ + /* hinzuf=C3=BCgen AIO Unterst=C3=BCtzung f=C3=BCr komprimie= rte Bl=C3=B6cke? */ ret =3D qcow2_decompress_cluster(bs, cluster_offset); if (ret < 0) { goto fail; @@ -1467,8 +1476,9 @@ static coroutine_fn int qcow2_co_readv(BlockDriverS= tate *bs, int64_t sector_num, assert(s->cipher); =20 /* - * For encrypted images, read everything into a temporar= y - * contiguous buffer on which the AES functions can work= . + * F=C3=BCr verschl=C3=BCsselte Bilder, lesen Sie alles = in eine + * tempor=C3=A4re zusammenh=C3=A4ngenden Puffer, auf den= en die + * AES Funktionen arbeiten k=C3=B6nnen. */ if (!cluster_data) { cluster_data =3D @@ -1541,7 +1551,7 @@ static coroutine_fn int qcow2_co_writev(BlockDriver= State *bs, BDRVQcow2State *s =3D bs->opaque; int index_in_cluster; int ret; - int cur_nr_sectors; /* number of sectors in current iteration */ + int cur_nr_sectors; /* Anzahl der Sektoren in der aktuellen Iteratio= n */ uint64_t cluster_offset; QEMUIOVector hd_qiov; uint64_t bytes_done =3D 0; @@ -1553,7 +1563,7 @@ static coroutine_fn int qcow2_co_writev(BlockDriver= State *bs, =20 qemu_iovec_init(&hd_qiov, qiov->niov); =20 - s->cluster_cache_offset =3D -1; /* disable compressed cache */ + s->cluster_cache_offset =3D -1; /* deaktivieren komprimierten Cache = */ =20 qemu_co_mutex_lock(&s->lock); =20 @@ -1640,7 +1650,7 @@ static coroutine_fn int qcow2_co_writev(BlockDriver= State *bs, goto fail; } =20 - /* Take the request off the list of running requests */ + /* Nehmen Sie die Anfrage von der Liste der laufenden Anfrag= en */ if (l2meta->nb_clusters !=3D 0) { QLIST_REMOVE(l2meta, next_in_flight); } @@ -1712,7 +1722,7 @@ static void qcow2_close(BlockDriverState *bs) { BDRVQcow2State *s =3D bs->opaque; qemu_vfree(s->l1_table); - /* else pre-write overlap checks in cache_destroy may crash */ + /* sonst vorgeSchreib =C3=9Cberlappung Kontrollen in cache_destroy a= bst=C3=BCrzen */ s->l1_table =3D NULL; =20 if (!(s->flags & BDRV_O_INACTIVE)) { @@ -1748,8 +1758,9 @@ static void qcow2_invalidate_cache(BlockDriverState= *bs, Error **errp) int ret; =20 /* - * Backing files are read-only which makes all of their metadata imm= utable, - * that means we don't have to worry about reopening them here. + * Sichern von Dateien sind schreibgesch=C3=BCtzt, die alle ihre Met= adaten + * unver=C3=A4nderlich macht, das bedeutet, dass wir sie hier nicht = =C3=BCber die + * Wiederer=C3=B6ffnung zu k=C3=BCmmern. */ =20 cipher =3D s->cipher; @@ -1804,12 +1815,13 @@ static size_t header_ext_add(char *buf, uint32_t = magic, const void *s, } =20 /* - * Updates the qcow2 header, including the variable length parts of it, = i.e. - * the backing file name and all extensions. qcow2 was not designed to a= llow - * such changes, so if we run out of space (we can only use the first cl= uster) - * this function may fail. + * Aktualisiert die qcow2 Header, einschlie=C3=9Flich der variablen L=C3= =A4nge Teile + * davon, das hei=C3=9Ft die Tr=C3=A4gerdateinamen und alle Erweiterunge= n. qcow2 wurde, + * nicht zuzulassen, entworfen solche Ver=C3=A4nderungen, so dass, wenn = wir aus + * dem Raum laufen (wir k=C3=B6nnen nur den ersten Cluster verwenden) + * Diese Funktion kann fehlschlagen. * - * Returns 0 on success, -errno in error cases. + * Gibt 0 zur=C3=BCck, bei Erfolg, -errno in Fehlerf=C3=A4llen. */ int qcow2_update_header(BlockDriverState *bs) { @@ -1825,7 +1837,7 @@ int qcow2_update_header(BlockDriverState *bs) =20 buf =3D qemu_blockalign(bs, buflen); =20 - /* Header structure */ + /* Header-Struktur */ header =3D (QCowHeader*) buf; =20 if (buflen < sizeof(*header)) { @@ -1838,7 +1850,7 @@ int qcow2_update_header(BlockDriverState *bs) refcount_table_clusters =3D s->refcount_table_size >> (s->cluster_bi= ts - 3); =20 *header =3D (QCowHeader) { - /* Version 2 fields */ + /* Version 2 Felder */ .magic =3D cpu_to_be32(QCOW_MAGIC), .version =3D cpu_to_be32(s->qcow_version), .backing_file_offset =3D 0, @@ -1853,7 +1865,7 @@ int qcow2_update_header(BlockDriverState *bs) .nb_snapshots =3D cpu_to_be32(s->nb_snapshots), .snapshots_offset =3D cpu_to_be64(s->snapshots_offset), =20 - /* Version 3 fields */ + /* Version 3 Felder */ .incompatible_features =3D cpu_to_be64(s->incompatible_features= ), .compatible_features =3D cpu_to_be64(s->compatible_features), .autoclear_features =3D cpu_to_be64(s->autoclear_features), @@ -1861,7 +1873,7 @@ int qcow2_update_header(BlockDriverState *bs) .header_length =3D cpu_to_be32(header_length), }; =20 - /* For older versions, write a shorter header */ + /* F=C3=BCr =C3=A4ltere Versionen, schreiben Sie eine k=C3=BCrzere K= opf */ switch (s->qcow_version) { case 2: ret =3D offsetof(QCowHeader, incompatible_features); @@ -1878,7 +1890,7 @@ int qcow2_update_header(BlockDriverState *bs) buflen -=3D ret; memset(buf, 0, buflen); =20 - /* Preserve any unknown field in the header */ + /* Bewahren Sie alle unbekannten Feld im Kopf */ if (s->unknown_header_fields_size) { if (buflen < s->unknown_header_fields_size) { ret =3D -ENOSPC; @@ -1890,7 +1902,7 @@ int qcow2_update_header(BlockDriverState *bs) buflen -=3D s->unknown_header_fields_size; } =20 - /* Backing file format header extension */ + /* Sichern Dateiformat Header-Erweiterung */ if (s->image_backing_format) { ret =3D header_ext_add(buf, QCOW2_EXT_MAGIC_BACKING_FORMAT, s->image_backing_format, @@ -1904,7 +1916,7 @@ int qcow2_update_header(BlockDriverState *bs) buflen -=3D ret; } =20 - /* Feature table */ + /* Feature-Tabelle */ if (s->qcow_version >=3D 3) { Qcow2Feature features[] =3D { { @@ -1933,7 +1945,7 @@ int qcow2_update_header(BlockDriverState *bs) buflen -=3D ret; } =20 - /* Keep unknown header extensions */ + /* Halten Sie unbekannte Header-Erweiterungen */ QLIST_FOREACH(uext, &s->unknown_header_ext, next) { ret =3D header_ext_add(buf, uext->magic, uext->data, uext->len, = buflen); if (ret < 0) { @@ -1944,7 +1956,7 @@ int qcow2_update_header(BlockDriverState *bs) buflen -=3D ret; } =20 - /* End of header extensions */ + /* Ende der Header-Erweiterungen */ ret =3D header_ext_add(buf, QCOW2_EXT_MAGIC_END, NULL, 0, buflen); if (ret < 0) { goto fail; @@ -1953,7 +1965,7 @@ int qcow2_update_header(BlockDriverState *bs) buf +=3D ret; buflen -=3D ret; =20 - /* Backing file name */ + /* Sichern Dateinamen */ if (s->image_backing_file) { size_t backing_file_len =3D strlen(s->image_backing_file); =20 @@ -1962,14 +1974,14 @@ int qcow2_update_header(BlockDriverState *bs) goto fail; } =20 - /* Using strncpy is ok here, since buf is not NUL-terminated. */ + /* strncpy verwenden ist hier ok, da buf nicht NUL-terminiert. *= / strncpy(buf, s->image_backing_file, buflen); =20 header->backing_file_offset =3D cpu_to_be64(buf - ((char*) heade= r)); header->backing_file_size =3D cpu_to_be32(backing_file_len); } =20 - /* Write the new header */ + /* Schreiben Sie den neuen Header */ ret =3D bdrv_pwrite(bs->file->bs, 0, header, s->cluster_size); if (ret < 0) { goto fail; @@ -2028,24 +2040,25 @@ static int preallocate(BlockDriverState *bs) return ret; } =20 - /* There are no dependent requests, but we need to remove ou= r - * request from the list of in-flight requests */ + /* Es gibt keine abh=C3=A4ngigen Anfragen, aber wir m=C3=BCs= sen unsere + * entfernen fordern von der Liste der in-flight-Anfragen */ QLIST_REMOVE(meta, next_in_flight); =20 g_free(meta); meta =3D next; } =20 - /* TODO Preallocate data if requested */ + /* TODO vorbelegen Daten auf Wunsch */ =20 nb_sectors -=3D num; offset +=3D num << BDRV_SECTOR_BITS; } =20 /* - * It is expected that the image file is large enough to actually co= ntain - * all of the allocated clusters (otherwise we get failing reads aft= er - * EOF). Extend the image to the last allocated sector. + * Es wird erwartet, dass die Bilddatei gro=C3=9F genug ist eigentli= ch zu + * enthalten alle zugewiesenen Cluster (sonst bekommen wir andernfal= ls + * liest nach EOF). Erweitern Sie das Bild in den letzten zugewiesen= en + * Sektor. */ if (host_offset !=3D 0) { uint8_t buf[BDRV_SECTOR_SIZE]; @@ -2070,7 +2083,7 @@ static int qcow2_create2(const char *filename, int6= 4_t total_size, int cluster_bits; QDict *options; =20 - /* Calculate cluster_bits */ + /* Berechnen Cluster-Bits */ cluster_bits =3D ctz32(cluster_size); if (cluster_bits < MIN_CLUSTER_BITS || cluster_bits > MAX_CLUSTER_BI= TS || (1 << cluster_bits) !=3D cluster_size) @@ -2081,16 +2094,16 @@ static int qcow2_create2(const char *filename, in= t64_t total_size, } =20 /* - * Open the image file and write a minimal qcow2 header. + * =C3=96ffnen Sie die Bilddatei und schreiben einen minimalen qcow2= -Header. * - * We keep things simple and start with a zero-sized image. We also - * do without refcount blocks or a L1 table for now. We'll fix the - * inconsistency later. + * Wir halten die Dinge einfach und mit einer Null-Gr=C3=B6=C3=9Fe B= ild starten. + * Wir ... auch tun, ohne refcount Bl=C3=B6cke oder L1-Tabelle f=C3=BC= r den Moment. + * Wir werden das beheben sp=C3=A4ter Inkonsistenz. * - * We do need a refcount table because growing the refcount table me= ans - * allocating two new refcount blocks - the seconds of which would b= e at - * 2 GB for 64k clusters, and we don't want to have a 2 GB initial f= ile - * size for any qcow2 image. + * Wir haben eine refcount Tisch brauchen, weil die refcount Tabelle= nmittel + * w=C3=A4chst zwei neue refcount Bl=C3=B6cke Aufteilung - die Sekun= den davon w=C3=A4re + * bei 2 GB f=C3=BCr 64k-Cluster, und wir wollen nicht, eine 2 GB ur= spr=C3=BCngliche + * Datei zu haben, Gr=C3=B6=C3=9Fe f=C3=BCr qcow2 Bild. */ BlockBackend *blk; QCowHeader *header; @@ -2099,58 +2112,60 @@ static int qcow2_create2(const char *filename, in= t64_t total_size, int ret; =20 if (prealloc =3D=3D PREALLOC_MODE_FULL || prealloc =3D=3D PREALLOC_M= ODE_FALLOC) { - /* Note: The following calculation does not need to be exact; if= it is a - * bit off, either some bytes will be "leaked" (which is fine) o= r we - * will need to increase the file size by some bytes (which is f= ine, - * too, as long as the bulk is allocated here). Therefore, using - * floating point arithmetic is fine. */ + /* Hinweis: Die folgende Berechnung nicht genau zu sein braucht;= wenn + * es ein biss, entweder einige Bytes "durchgesickert" wird (was= in + * Ordnung ist), oder wir m=C3=BCssen Sie die Dateigr=C3=B6=C3=9F= e von einigen Bytes + * zu erh=C3=B6hen (was in Ordnung ist, zu, solange die Masse wi= rd hier + * zugeordnet). Daher ist die Verwendung Gleitpunktarithmetik is= t in + * Ordnung. */ int64_t meta_size =3D 0; uint64_t nreftablee, nrefblocke, nl1e, nl2e; int64_t aligned_total_size =3D align_offset(total_size, cluster_= size); int refblock_bits, refblock_size; - /* refcount entry size in bytes */ + /* refcount Eintrag Gr=C3=B6=C3=9Fe in Byte */ double rces =3D (1 << refcount_order) / 8.; =20 - /* see qcow2_open() */ + /* siehe qcow2_open () */ refblock_bits =3D cluster_bits - (refcount_order - 3); refblock_size =3D 1 << refblock_bits; =20 - /* header: 1 cluster */ + /* Header: 1 Cluster */ meta_size +=3D cluster_size; =20 - /* total size of L2 tables */ + /* Gesamtgr=C3=B6=C3=9Fe des L2-Tabellen */ nl2e =3D aligned_total_size / cluster_size; nl2e =3D align_offset(nl2e, cluster_size / sizeof(uint64_t)); meta_size +=3D nl2e * sizeof(uint64_t); =20 - /* total size of L1 tables */ + /* Gesamtgr=C3=B6=C3=9Fe von L1 Tabellen */ nl1e =3D nl2e * sizeof(uint64_t) / cluster_size; nl1e =3D align_offset(nl1e, cluster_size / sizeof(uint64_t)); meta_size +=3D nl1e * sizeof(uint64_t); =20 - /* total size of refcount blocks + /* Gesamtgr=C3=B6=C3=9Fe von refcount Bl=C3=B6cke * - * note: every host cluster is reference-counted, including meta= data - * (even refcount blocks are recursively included). - * Let: - * a =3D total_size (this is the guest disk size) - * m =3D meta size not including refcount blocks and refcount = tables - * c =3D cluster size - * y1 =3D number of refcount blocks entries - * y2 =3D meta size including everything - * rces =3D refcount entry size in bytes - * then, - * y1 =3D (y2 + a)/c - * y2 =3D y1 * rces + y1 * rces * sizeof(u64) / c + m - * we can get y1: - * y1 =3D (a + m) / (c - rces - rces * sizeof(u64) / c) + * Hinweis: Jeder Host-Cluster ist Referenz gez=C3=A4hlt, einsch= lie=C3=9Flich + * Metadaten (Auch refcount Bl=C3=B6cke werden rekursiv enthalte= n). + * Lassen: + * a =3D total_size (dies ist die Gr=C3=B6=C3=9Fe Gast Platte) + * m =3D Meta-Gr=C3=B6=C3=9Fe nicht einschlie=C3=9Flich refcou= nt Bl=C3=B6cke und + * refcount Tabellen + * c =3D Clustergr=C3=B6=C3=9Fe + * y1 =3D Anzahl der Bl=C3=B6cke refcount entries + * y2 =3D meta Gr=C3=B6=C3=9Fe einschlie=C3=9Flich alles + * RCEs =3D refcount Eintrag Gr=C3=B6=C3=9Fe in Byte + * dann, + * y1 =3D (y2 + a) / c + * y2 =3D y1 * RCEs + y1 * RCEs * sizeof (u64) / c + m + * wir k=C3=B6nnen y1 erhalten: + * y1 =3D (a + m) / (c - RCEs - RCEs * sizeof (U64) / c) */ nrefblocke =3D (aligned_total_size + meta_size + cluster_size) / (cluster_size - rces - rces * sizeof(uint64_t) / cluster_size); meta_size +=3D DIV_ROUND_UP(nrefblocke, refblock_size) * cluster= _size; =20 - /* total size of refcount tables */ + /* Gesamtgr=C3=B6=C3=9Fe von refcount Tabellen */ nreftablee =3D nrefblocke / refblock_size; nreftablee =3D align_offset(nreftablee, cluster_size / sizeof(ui= nt64_t)); meta_size +=3D nreftablee * sizeof(uint64_t); @@ -2176,7 +2191,7 @@ static int qcow2_create2(const char *filename, int6= 4_t total_size, =20 blk_set_allow_write_beyond_eof(blk, true); =20 - /* Write the header */ + /* Schreiben Sie den Header */ QEMU_BUILD_BUG_ON((1 << MIN_CLUSTER_BITS) < sizeof(*header)); header =3D g_malloc0(cluster_size); *header =3D (QCowHeader) { @@ -2210,7 +2225,7 @@ static int qcow2_create2(const char *filename, int6= 4_t total_size, goto out; } =20 - /* Write a refcount table with one refcount block */ + /* Schreiben Sie einen refcount Tisch mit einem refcount Block */ refcount_table =3D g_malloc0(2 * cluster_size); refcount_table[0] =3D cpu_to_be64(2 * cluster_size); ret =3D blk_pwrite(blk, cluster_size, refcount_table, 2 * cluster_si= ze); @@ -2225,9 +2240,9 @@ static int qcow2_create2(const char *filename, int6= 4_t total_size, blk =3D NULL; =20 /* - * And now open the image and make it consistent first (i.e. increas= e the - * refcount of the cluster that is occupied by the header and the re= fcount - * table) + * Und nun das Bild =C3=B6ffnen, und es im Einklang ersten machen (d= as hei=C3=9Ft + * die Erh=C3=B6hung refcount des Clusters, die von dem Header und d= em refcount + * besetzt ist Tabelle) */ options =3D qdict_new(); qdict_put(options, "driver", qstring_from_str("qcow2")); @@ -2250,21 +2265,23 @@ static int qcow2_create2(const char *filename, in= t64_t total_size, abort(); } =20 - /* Create a full header (including things like feature table) */ + /* Erstellen Sie einen vollst=C3=A4ndigen Header (einschlie=C3=9Flic= h solcher Dinge + * wie Feature-Tabelle) */ ret =3D qcow2_update_header(blk_bs(blk)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not update qcow2 header"); goto out; } =20 - /* Okay, now that we have a valid image, let's give it the right siz= e */ + /* Okay, jetzt, da wir ein g=C3=BCltiges Bild haben, lassen Sie uns = es die + * richtige Gr=C3=B6=C3=9Fe geben */ ret =3D blk_truncate(blk, total_size); if (ret < 0) { error_setg_errno(errp, -ret, "Could not resize image"); goto out; } =20 - /* Want a backing file? There you go.*/ + /* M=C3=B6chten Sie eine Tr=C3=A4gerdatei? Dort gehen Sie.*/ if (backing_file) { ret =3D bdrv_change_backing_file(blk_bs(blk), backing_file, back= ing_format); if (ret < 0) { @@ -2274,7 +2291,7 @@ static int qcow2_create2(const char *filename, int6= 4_t total_size, } } =20 - /* And if we're supposed to preallocate metadata, do that now */ + /* Und wenn wir angeblich sind Metadaten vorab zuzuordnen, das jetzt= tun */ if (prealloc !=3D PREALLOC_MODE_OFF) { BDRVQcow2State *s =3D blk_bs(blk)->opaque; qemu_co_mutex_lock(&s->lock); @@ -2289,7 +2306,8 @@ static int qcow2_create2(const char *filename, int6= 4_t total_size, blk_unref(blk); blk =3D NULL; =20 - /* Reopen the image without BDRV_O_NO_FLUSH to flush it before retur= ning */ + /* =C3=96ffnen Sie erneut das Bild ohne BDRV_O_NO_FLUSH es zu sp=C3=BC= len vor der + * R=C3=BCckkehr */ options =3D qdict_new(); qdict_put(options, "driver", qstring_from_str("qcow2")); blk =3D blk_new_open(filename, NULL, options, @@ -2323,7 +2341,7 @@ static int qcow2_create(const char *filename, QemuO= pts *opts, Error **errp) Error *local_err =3D NULL; int ret; =20 - /* Read out options */ + /* Vorlesen Optionen */ size =3D ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0), BDRV_SECTOR_SIZE); backing_file =3D qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE); @@ -2345,7 +2363,7 @@ static int qcow2_create(const char *filename, QemuO= pts *opts, Error **errp) g_free(buf); buf =3D qemu_opt_get_del(opts, BLOCK_OPT_COMPAT_LEVEL); if (!buf) { - /* keep the default */ + /* behalten Sie die Standardeinstellung */ } else if (!strcmp(buf, "0.10")) { version =3D 2; } else if (!strcmp(buf, "1.1")) { @@ -2413,12 +2431,12 @@ static coroutine_fn int qcow2_co_write_zeroes(Blo= ckDriverState *bs, int ret; BDRVQcow2State *s =3D bs->opaque; =20 - /* Emulate misaligned zero writes */ + /* Emulieren falsch ausgerichtet Null schreibt */ if (sector_num % s->cluster_sectors || nb_sectors % s->cluster_secto= rs) { return -ENOTSUP; } =20 - /* Whatever is left can use real zero clusters */ + /* Was auch immer k=C3=B6nnen echte Null-Cluster links verwenden */ qemu_co_mutex_lock(&s->lock); ret =3D qcow2_zero_clusters(bs, sector_num << BDRV_SECTOR_BITS, nb_sectors); @@ -2451,13 +2469,13 @@ static int qcow2_truncate(BlockDriverState *bs, i= nt64_t offset) return -EINVAL; } =20 - /* cannot proceed if image has snapshots */ + /* kann nicht fortgesetzt werden, wenn Bildschnappsch=C3=BCsse hat *= / if (s->nb_snapshots) { error_report("Can't resize an image which has snapshots"); return -ENOTSUP; } =20 - /* shrinking is currently not supported */ + /* Schrumpfen wird derzeit nicht unterst=C3=BCtzt */ if (offset < bs->total_sectors * 512) { error_report("qcow2 doesn't support shrinking images yet"); return -ENOTSUP; @@ -2469,7 +2487,7 @@ static int qcow2_truncate(BlockDriverState *bs, int= 64_t offset) return ret; } =20 - /* write updated header.size */ + /* schreiben aktualisiert header.size */ offset =3D cpu_to_be64(offset); ret =3D bdrv_pwrite_sync(bs->file->bs, offsetof(QCowHeader, size), &offset, sizeof(uint64_t)); @@ -2481,8 +2499,8 @@ static int qcow2_truncate(BlockDriverState *bs, int= 64_t offset) return 0; } =20 -/* XXX: put compressed sectors first, then all the cluster aligned - tables to avoid losing bytes in alignment */ +/* XXX: Put-Druck Sektoren zuerst, dann das ganze Cluster ausgerichtet + Tabellen zu vermeiden Bytes in Ausrichtung zu verlieren */ static int qcow2_write_compressed(BlockDriverState *bs, int64_t sector_n= um, const uint8_t *buf, int nb_sectors) { @@ -2493,8 +2511,8 @@ static int qcow2_write_compressed(BlockDriverState = *bs, int64_t sector_num, uint64_t cluster_offset; =20 if (nb_sectors =3D=3D 0) { - /* align end of file to a sector boundary to ease reading with - sector based I/Os */ + /* Ende der Datei an einer Sektorgrenze auszurichten erleichtern= das + Lesen Sektor basierend I / Os */ cluster_offset =3D bdrv_getlength(bs->file->bs); return bdrv_truncate(bs->file->bs, cluster_offset); } @@ -2502,7 +2520,8 @@ static int qcow2_write_compressed(BlockDriverState = *bs, int64_t sector_num, if (nb_sectors !=3D s->cluster_sectors) { ret =3D -EINVAL; =20 - /* Zero-pad last write if image size is not cluster aligned */ + /* Null-Pad letzte Schreib, wenn die Bildgr=C3=B6=C3=9Fe ist nic= ht ausgerichtet + * Cluster */ if (sector_num + nb_sectors =3D=3D bs->total_sectors && nb_sectors < s->cluster_sectors) { uint8_t *pad_buf =3D qemu_blockalign(bs, s->cluster_size); @@ -2517,7 +2536,7 @@ static int qcow2_write_compressed(BlockDriverState = *bs, int64_t sector_num, =20 out_buf =3D g_malloc(s->cluster_size + (s->cluster_size / 1000) + 12= 8); =20 - /* best compression, small window, no zlib header */ + /* beste Kompression, kleine Fenster, keine zlib-Header */ memset(&strm, 0, sizeof(strm)); ret =3D deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -12, @@ -2543,7 +2562,7 @@ static int qcow2_write_compressed(BlockDriverState = *bs, int64_t sector_num, deflateEnd(&strm); =20 if (ret !=3D Z_STREAM_END || out_len >=3D s->cluster_size) { - /* could not compress: write normal cluster */ + /* komprimieren konnte nicht: Schreiben normalen Cluster */ ret =3D bdrv_write(bs, sector_num, buf, s->cluster_sectors); if (ret < 0) { goto fail; @@ -2598,7 +2617,7 @@ static int make_completely_empty(BlockDriverState *= bs) goto fail; } =20 - /* Refcounts will be broken utterly */ + /* Refcounts wird v=C3=B6llig gebrochen werden */ ret =3D qcow2_mark_dirty(bs); if (ret < 0) { goto fail; @@ -2609,8 +2628,8 @@ static int make_completely_empty(BlockDriverState *= bs) l1_clusters =3D DIV_ROUND_UP(s->l1_size, s->cluster_size / sizeof(ui= nt64_t)); l1_size2 =3D (uint64_t)s->l1_size * sizeof(uint64_t); =20 - /* After this call, neither the in-memory nor the on-disk refcount - * information accurately describe the actual references */ + /* Nach diesem Aufruf weder die im Speicher noch die On-Disk-refcoun= t + * Informationen genau die aktuellen Referenzen beschreiben */ =20 ret =3D bdrv_write_zeroes(bs->file->bs, s->l1_table_offset / BDRV_SE= CTOR_SIZE, l1_clusters * s->cluster_sectors, 0); @@ -2621,18 +2640,19 @@ static int make_completely_empty(BlockDriverState= *bs) =20 BLKDBG_EVENT(bs->file, BLKDBG_EMPTY_IMAGE_PREPARE); =20 - /* Overwrite enough clusters at the beginning of the sectors to plac= e - * the refcount table, a refcount block and the L1 table in; this ma= y - * overwrite parts of the existing refcount and L1 table, which is n= ot - * an issue because the dirty flag is set, complete data loss is in = fact - * desired and partial data loss is consequently fine as well */ + /* =C3=9Cberschreiben genug Cluster am Anfang der Sektoren zu platzi= eren + * die refcount Tisch, ein refcount Block und der L1-Tabelle in; das + * vielleicht =C3=BCberschreiben Teile des bestehenden refcount und = L1-Tabelle, + * die nicht ist ein Problem, weil das schmutzige Flag gesetzt ist, + * kompletten Datenverlust ist in der Tat Soll- und Teildatenverlust= ist + * somit auch gut */ ret =3D bdrv_write_zeroes(bs->file->bs, s->cluster_size / BDRV_SECTO= R_SIZE, (2 + l1_clusters) * s->cluster_size / BDRV_SECTOR_SIZE, 0); - /* This call (even if it failed overall) may have overwritten on-dis= k - * refcount structures; in that case, the in-memory refcount informa= tion - * will probably differ from the on-disk information which makes the= BDS - * unusable */ + /* Dieser Aufruf (auch wenn es insgesamt nicht) haben auf der Festpl= atte + * =C3=BCberschrieben refcount Strukturen; in diesem Fall kann die i= m Speicher + * refcount Informationen wird wahrscheinlich von der + * On-Disk Informationen, die den =C3=BCber BDS macht unbrauchbar */ if (ret < 0) { goto fail_broken_refcounts; } @@ -2640,9 +2660,10 @@ static int make_completely_empty(BlockDriverState = *bs) BLKDBG_EVENT(bs->file, BLKDBG_L1_UPDATE); BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_UPDATE); =20 - /* "Create" an empty reftable (one cluster) directly after the image - * header and an empty L1 table three clusters after the image heade= r; - * the cluster between those two will be used as the first refblock = */ + /* "Create" ein leeres refTable (ein Cluster) direkt nach dem Bild + * Header und eine leere L1 Tabelle drei Cluster nach dem Bild-Heade= r; + * der Cluster zwischen diesen beiden wird als erste refblock verwen= det + * werden */ cpu_to_be64w(&l1_ofs_rt_ofs_cls.l1_offset, 3 * s->cluster_size); cpu_to_be64w(&l1_ofs_rt_ofs_cls.reftable_offset, s->cluster_size); cpu_to_be32w(&l1_ofs_rt_ofs_cls.reftable_clusters, 1); @@ -2667,15 +2688,16 @@ static int make_completely_empty(BlockDriverState= *bs) s->refcount_table =3D new_reftable; new_reftable =3D NULL; =20 - /* Now the in-memory refcount information again corresponds to the o= n-disk - * information (reftable is empty and no refblocks (the refblock cac= he is - * empty)); however, this means some clusters (e.g. the image header= ) are - * referenced, but not refcounted, but the normal qcow2 code assumes= that - * the in-memory information is always correct */ + /* Nun ist die In-Memory-refcount Informationen entspricht wieder de= m + * On-Disk Informationen (refTable leer ist und keine refblocks (der + * refblock Cache ist leer)); jedoch bedeutet dies einige Cluster + * (beispielsweise das Bild-Header) sind Bezug genommen wird, aber n= icht + * refcounted, aber der normale qcow2 Code geht davon aus, dass die + * In-Memory-Daten immer korrekt */ =20 BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC); =20 - /* Enter the first refblock into the reftable */ + /* Geben Sie den ersten refblock in die refTable */ rt_entry =3D cpu_to_be64(2 * s->cluster_size); ret =3D bdrv_pwrite_sync(bs->file->bs, s->cluster_size, &rt_entry, sizeof(rt_entry)); @@ -2695,8 +2717,8 @@ static int make_completely_empty(BlockDriverState *= bs) abort(); } =20 - /* Now finally the in-memory information corresponds to the on-disk - * structures and is correct */ + /* Nun endlich die im Speicher entspricht Information an die auf der + * Festplatte Strukturen und ist richtig */ ret =3D qcow2_mark_clean(bs); if (ret < 0) { goto fail; @@ -2710,12 +2732,13 @@ static int make_completely_empty(BlockDriverState= *bs) return 0; =20 fail_broken_refcounts: - /* The BDS is unusable at this point. If we wanted to make it usable= , we - * would have to call qcow2_refcount_close(), qcow2_refcount_init(), - * qcow2_check_refcounts(), qcow2_refcount_close() and qcow2_refcoun= t_init() - * again. However, because the functions which could have caused thi= s error - * path to be taken are used by those functions as well, it's very l= ikely - * that that sequence will fail as well. Therefore, just eject the B= DS. */ + /* Der BDS ist an dieser Stelle unbrauchbar. Wenn wir wollten, es nu= tzbar zu + * machen, wir h=C3=A4tte qcow2_refcount_close (), qcow2_refcount_in= it () zu + * nennen, qcow2_check_refcounts (), qcow2_refcount_close () und + * qcow2_refcount_init () aufs Neue. Da jedoch die Funktionen, die d= iesen + * Fehler verursacht haben k=C3=B6nnte Pfad zu werden, als auch von = den + * Funktionen genommen, ist es sehr wahrscheinlich, dass diese Seque= nz wird + * auch scheitern. Daher auswerfen nur die BDS. */ bs->drv =3D NULL; =20 fail: @@ -2734,24 +2757,25 @@ static int qcow2_make_empty(BlockDriverState *bs) =20 if (s->qcow_version >=3D 3 && !s->snapshots && 3 + l1_clusters <=3D s->refcount_block_size) { - /* The following function only works for qcow2 v3 images (it req= uires - * the dirty flag) and only as long as there are no snapshots (b= ecause - * it completely empties the image). Furthermore, the L1 table a= nd three - * additional clusters (image header, refcount table, one refcou= nt - * block) have to fit inside one refcount block. */ + /* Die folgende Funktion ist nur f=C3=BCr qcow2 v3 Bilder (es er= fordert + * das schmutzige Flagge) und nur so lange, wie es keine Schnapp= sch=C3=BCsse + * (weil es leert sich das Bild vollst=C3=A4ndig). Weiterhin ist= die + * L1-Tabelle und drei zus=C3=A4tzliche Cluster (Bild-Header, + * refcount Tisch, ein refcount * Block) haben innerhalb eines + * refcount Block zu passen. */ return make_completely_empty(bs); } =20 - /* This fallback code simply discards every active cluster; this is = slow, - * but works in all cases */ + /* Dieser R=C3=BCckfall Code einfach verwirft alle aktiven Cluster; = Dies ist + * langsam, funktioniert aber in allen F=C3=A4llen */ for (start_sector =3D 0; start_sector < bs->total_sectors; start_sector +=3D sector_step) { - /* As this function is generally used after committing an extern= al - * snapshot, QCOW2_DISCARD_SNAPSHOT seems appropriate. Also, the - * default action for this kind of discard is to pass the discar= d, - * which will ideally result in an actually smaller image file, = as - * is probably desired. */ + /* Da diese Funktion wird nach der Begehung einer externen allge= mein + * verwendet Schnappschuss, scheint QCOW2_DISCARD_SNAPSHOT angem= essen. + * Auch der Standardaktion f=C3=BCr diese Art von Ablage ist der= Ablage + * passieren, die idealerweise in einem tats=C3=A4chlich kleiner= e Bilddatei + * zur Folge haben, wie ist wahrscheinlich erw=C3=BCnscht. */ ret =3D qcow2_discard_clusters(bs, start_sector * BDRV_SECTOR_SI= ZE, MIN(sector_step, bs->total_sectors - start_secto= r), @@ -2824,8 +2848,9 @@ static ImageInfoSpecific *qcow2_get_specific_info(B= lockDriverState *bs) .refcount_bits =3D s->refcount_bits, }; } else { - /* if this assertion fails, this probably means a new version wa= s - * added without having it covered here */ + /* wenn diese Behauptung fehlschl=C3=A4gt, bedeutet dies wahrsch= einlich + * eine neue Version war hinzugef=C3=BCgt, ohne dass es hier beh= andelt zu + * haben */ assert(false); } =20 @@ -2866,9 +2891,9 @@ static int qcow2_save_vmstate(BlockDriverState *bs,= QEMUIOVector *qiov, ret =3D bdrv_pwritev(bs, qcow2_vm_state_offset(s) + pos, qiov); bs->zero_beyond_eof =3D zero_beyond_eof; =20 - /* bdrv_co_do_writev will have increased the total_sectors value to = include - * the VM state - the VM state is however not an actual part of the = block - * device, therefore, we need to restore the old value. */ + /* bdrv_co_do_writev den total_sectors Wert enthalten haben zugenomm= en + * die VM-Status - die VM-Status ist jedoch kein tats=C3=A4chlicher = Teil des + * Blockger=C3=A4ts, daher m=C3=BCssen wir den alten Wert wiederherz= ustellen. */ bs->total_sectors =3D total_sectors; =20 return ret; @@ -2890,8 +2915,8 @@ static int qcow2_load_vmstate(BlockDriverState *bs,= uint8_t *buf, } =20 /* - * Downgrades an image's version. To achieve this, any incompatible feat= ures - * have to be removed. + * Herabstufungen eines Bildes Version. Um dies zu erreichen, werden all= e + * inkompatible Funktionen muss entfernt werden. */ static int qcow2_downgrade(BlockDriverState *bs, int target_version, BlockDriverAmendStatusCB *status_cb, void *cb= _opaque) @@ -2913,7 +2938,7 @@ static int qcow2_downgrade(BlockDriverState *bs, in= t target_version, return -ENOTSUP; } =20 - /* clear incompatible features */ + /* klar inkompatible Funktionen */ if (s->incompatible_features & QCOW2_INCOMPAT_DIRTY) { ret =3D qcow2_mark_clean(bs); if (ret < 0) { @@ -2921,20 +2946,21 @@ static int qcow2_downgrade(BlockDriverState *bs, = int target_version, } } =20 - /* with QCOW2_INCOMPAT_CORRUPT, it is pretty much impossible to get = here in - * the first place; if that happens nonetheless, returning -ENOTSUP = is the - * best thing to do anyway */ + /* mit QCOW2_INCOMPAT_CORRUPT, ist es ziemlich unm=C3=B6glich, hier = zu bekommen + * den ersten Platz; wenn dies dennoch geschieht, ist R=C3=BCckkehr = -ENOTSUP die + * Beste, was zu tun sowieso */ =20 if (s->incompatible_features) { return -ENOTSUP; } =20 - /* since we can ignore compatible features, we can set them to 0 as = well */ + /* da wir kompatiblen Funktionen ignorieren k=C3=B6nnen, k=C3=B6nnen= wir sie auf 0 + * gesetzt und */ s->compatible_features =3D 0; - /* if lazy refcounts have been used, they have already been fixed th= rough - * clearing the dirty flag */ + /* wenn faul Refcounts verwendet wurden, haben sie bereits festgeleg= t + * worden durch L=C3=B6schen der schmutzige Flagge */ =20 - /* clearing autoclear features is trivial */ + /* AUTOCLEAR- Funktionen Clearing ist trivial */ s->autoclear_features =3D 0; =20 ret =3D qcow2_expand_zero_clusters(bs, status_cb, cb_opaque); @@ -2952,9 +2978,9 @@ static int qcow2_downgrade(BlockDriverState *bs, in= t target_version, } =20 typedef enum Qcow2AmendOperation { - /* This is the value Qcow2AmendHelperCBInfo::last_operation will be - * statically initialized to so that the helper CB can discern the f= irst - * invocation from an operation change */ + /* Dies ist der Wert Qcow2AmendHelperCBInfo :: last_operation wird + * statisch initialisiert, so dass die Helfer CB die erste erkennen = kann + * Aufruf von einer Operation =C3=A4ndern */ QCOW2_NO_OPERATION =3D 0, =20 QCOW2_CHANGING_REFCOUNT_ORDER, @@ -2962,22 +2988,22 @@ typedef enum Qcow2AmendOperation { } Qcow2AmendOperation; =20 typedef struct Qcow2AmendHelperCBInfo { - /* The code coordinating the amend operations should only modify - * these four fields; the rest will be managed by the CB */ + /* Der Code der Operationen =C3=A4ndern zu koordinieren sollte nur =C3= =A4ndern + * diese vier Felder; der Rest wird von der CB verwaltet */ BlockDriverAmendStatusCB *original_status_cb; void *original_cb_opaque; =20 Qcow2AmendOperation current_operation; =20 - /* Total number of operations to perform (only set once) */ + /* Gesamtzahl der Operationen auszuf=C3=BChren (nur einmal festgeleg= t) */ int total_operations; =20 - /* The following fields are managed by the CB */ + /* Die folgenden Felder werden von der CB verwaltet */ =20 - /* Number of operations completed */ + /* Anzahl der Operationen abgeschlossen */ int operations_completed; =20 - /* Cumulative offset of all completed operations */ + /* Kumulative aller abgeschlossenen Operationen Offset */ int64_t offset_completed; =20 Qcow2AmendOperation last_operation; @@ -3008,10 +3034,11 @@ static void qcow2_amend_helper_cb(BlockDriverStat= e *bs, =20 current_work_size =3D info->offset_completed + operation_work_size; =20 - /* current_work_size is the total work size for (operations_complete= d + 1) - * operations (which includes this one), so multiply it by the numbe= r of - * operations not covered and divide it by the number of operations - * covered to get a projection for the operations not covered */ + /* current_work_size ist die Gesamtarbeitsgr=C3=B6=C3=9Fe f=C3=BCr + * (operations_completed + 1) Operationen (einschlie=C3=9Flich diese= r) + * multiplizieren, so dass es durch die Anzahl der Operationen nicht + * abgedeckt und teilen sich durch die Anzahl der Operationen bedeck= t + * einen Vorsprung f=C3=BCr die Operationen nicht zu bekommen bedeck= t */ projected_work_size =3D current_work_size * (info->total_operations = - info->operations_complete= d - 1) / (info->operations_complete= d + 1); @@ -3040,7 +3067,7 @@ static int qcow2_amend_options(BlockDriverState *bs= , QemuOpts *opts, =20 while (desc && desc->name) { if (!qemu_opt_find(opts, desc->name)) { - /* only change explicitly defined options */ + /* =C3=A4ndern, dass nur explizit definierte Optionen */ desc++; continue; } @@ -3048,7 +3075,7 @@ static int qcow2_amend_options(BlockDriverState *bs= , QemuOpts *opts, if (!strcmp(desc->name, BLOCK_OPT_COMPAT_LEVEL)) { compat =3D qemu_opt_get(opts, BLOCK_OPT_COMPAT_LEVEL); if (!compat) { - /* preserve default */ + /* bewahren Standard */ } else if (!strcmp(compat, "0.10")) { new_version =3D 2; } else if (!strcmp(compat, "1.1")) { @@ -3096,8 +3123,9 @@ static int qcow2_amend_options(BlockDriverState *bs= , QemuOpts *opts, return -EINVAL; } } else { - /* if this point is reached, this probably means a new optio= n was - * added without having it covered here */ + /* Wenn dieser Punkt erreicht ist, bedeutet dies wahrscheinl= ich eine + * neue Option war hinzugef=C3=BCgt, ohne dass es hier behan= delt zu + * haben */ abort(); } =20 @@ -3111,7 +3139,8 @@ static int qcow2_amend_options(BlockDriverState *bs= , QemuOpts *opts, + (s->refcount_bits !=3D refcount_bits) }; =20 - /* Upgrade first (some features may require compat=3D1.1) */ + /* Aktualisieren Sie zuerst (Einige Funktionen erfordern m=C3=B6glic= herweise + * compat =3D 1.1) */ if (new_version > old_version) { s->qcow_version =3D new_version; ret =3D qcow2_update_header(bs); @@ -3166,12 +3195,12 @@ static int qcow2_amend_options(BlockDriverState *= bs, QemuOpts *opts, } s->use_lazy_refcounts =3D true; } else { - /* make image clean first */ + /* machen Bild sauber zuerst */ ret =3D qcow2_mark_clean(bs); if (ret < 0) { return ret; } - /* now disallow lazy refcounts */ + /* jetzt nicht zulassen faul Refcounts */ s->compatible_features &=3D ~QCOW2_COMPAT_LAZY_REFCOUNTS; ret =3D qcow2_update_header(bs); if (ret < 0) { @@ -3189,7 +3218,8 @@ static int qcow2_amend_options(BlockDriverState *bs= , QemuOpts *opts, } } =20 - /* Downgrade last (so unsupported features can be removed before) */ + /* Herunterstufung zuletzt (so nicht unterst=C3=BCtzten Funktionen k= =C3=B6nnen, + * bevor sie entfernt werden) */ if (new_version < old_version) { helper_cb_info.current_operation =3D QCOW2_DOWNGRADING; ret =3D qcow2_downgrade(bs, new_version, &qcow2_amend_helper_cb, @@ -3203,10 +3233,10 @@ static int qcow2_amend_options(BlockDriverState *= bs, QemuOpts *opts, } =20 /* - * If offset or size are negative, respectively, they will not be includ= ed in - * the BLOCK_IMAGE_CORRUPTED event emitted. - * fatal will be ignored for read-only BDS; corruptions found there will= always - * be considered non-fatal. + * Wenn Offset oder Gr=C3=B6=C3=9Fe negativ sind bzw. werden sie nicht e= inbezogen + * die BLOCK_IMAGE_CORRUPTED Ereignis emittiert. + * fatal f=C3=BCr Nur-Lese-BDS ignoriert werden; Verf=C3=A4lschungen dor= t zu finden + * wird immer werden als nicht t=C3=B6dlich. */ void qcow2_signal_corruption(BlockDriverState *bs, bool fatal, int64_t o= ffset, int64_t size, const char *message_format, .= ..) @@ -3246,7 +3276,7 @@ void qcow2_signal_corruption(BlockDriverState *bs, = bool fatal, int64_t offset, =20 if (fatal) { qcow2_mark_corrupt(bs); - bs->drv =3D NULL; /* make BDS unusable */ + bs->drv =3D NULL; /* machen BDS unbrauchbar */ } =20 s->signaled_corruption =3D true; @@ -3306,7 +3336,7 @@ static QemuOptsList qcow2_create_opts =3D { .help =3D "Width of a reference count entry in bits", .def_value_str =3D "16" }, - { /* end of list */ } + { /* Ende der Liste */ } } }; =20 diff --git a/block/qcow2.h b/block/qcow2.h index a063a3c..9ca88e2 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -40,40 +40,42 @@ #define QCOW_MAX_CRYPT_CLUSTERS 32 #define QCOW_MAX_SNAPSHOTS 65536 =20 -/* 8 MB refcount table is enough for 2 PB images at 64k cluster size - * (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */ +/* 8 MB refcount Tabelle ist ausreichend f=C3=BCr 2 PB Bilder bei 64k Cl= ustergr=C3=B6=C3=9Fe + * (128 GB f=C3=BCr 512-Byte-Cluster, 2 EB f=C3=BCr 2 MB Cluster) */ #define QCOW_MAX_REFTABLE_SIZE 0x800000 =20 -/* 32 MB L1 table is enough for 2 PB images at 64k cluster size - * (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */ +/* 32 MB L1 Tabelle ist ausreichend f=C3=BCr 2 PB Bilder bei 64k Cluster= gr=C3=B6=C3=9Fe + * (128 GB f=C3=BCr 512-Byte-Cluster, 2 EB f=C3=BCr 2 MB Cluster) */ #define QCOW_MAX_L1_SIZE 0x2000000 =20 -/* Allow for an average of 1k per snapshot table entry, should be plenty= of - * space for snapshot names and IDs */ +/* Lassen Sie f=C3=BCr einen Durchschnitt von 1k pro Snapshot-Tabellenei= ntrag, + * sollte viel sein Platz f=C3=BCr Snapshot-Namen und IDs */ #define QCOW_MAX_SNAPSHOTS_SIZE (1024 * QCOW_MAX_SNAPSHOTS) =20 -/* indicate that the refcount of the referenced cluster is exactly one. = */ +/* zeigen, dass die refcount des referenzierten Cluster genau eins ist. = */ #define QCOW_OFLAG_COPIED (1ULL << 63) -/* indicate that the cluster is compressed (they never have the copied f= lag) */ +/* zeigen, dass der Cluster komprimiert wird (sie haben nie die kopierte + * Flagge) */ #define QCOW_OFLAG_COMPRESSED (1ULL << 62) -/* The cluster reads as all zeros */ +/* Der Cluster lautet wie Nullen */ #define QCOW_OFLAG_ZERO (1ULL << 0) =20 #define MIN_CLUSTER_BITS 9 #define MAX_CLUSTER_BITS 21 =20 -/* Must be at least 2 to cover COW */ -#define MIN_L2_CACHE_SIZE 2 /* clusters */ +/* Muss mindestens 2 sein COW abzudecken */ +#define MIN_L2_CACHE_SIZE 2 /* Cluster */ =20 -/* Must be at least 4 to cover all cases of refcount table growth */ -#define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */ +/* Es muss mindestens 4 sein, alle F=C3=A4lle von refcount Tabelle Wachs= tum zu + * decken */ +#define MIN_REFCOUNT_CACHE_SIZE 4 /* Cluster */ =20 -/* Whichever is more */ -#define DEFAULT_L2_CACHE_CLUSTERS 8 /* clusters */ -#define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* bytes */ +/* Unabh=C3=A4ngig davon, welche mehr */ +#define DEFAULT_L2_CACHE_CLUSTERS 8 /* Cluster */ +#define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* Bytes */ =20 -/* The refblock cache needs only a fourth of the L2 cache size to cover = as many - * clusters */ +/* Der refblock Cache ben=C3=B6tigt nur ein Viertel des L2-Cache-Gr=C3=B6= =C3=9Fe so viele + * zur Deckung Cluster */ #define DEFAULT_L2_REFCOUNT_SIZE_RATIO 4 =20 #define DEFAULT_CLUSTER_SIZE 65536 @@ -104,16 +106,16 @@ typedef struct QCowHeader { uint64_t backing_file_offset; uint32_t backing_file_size; uint32_t cluster_bits; - uint64_t size; /* in bytes */ + uint64_t size; /* in Bytes */ uint32_t crypt_method; - uint32_t l1_size; /* XXX: save number of clusters instead ? */ + uint32_t l1_size; /* XXX: statt Anzahl der Cluster speichern? */ uint64_t l1_table_offset; uint64_t refcount_table_offset; uint32_t refcount_table_clusters; uint32_t nb_snapshots; uint64_t snapshots_offset; =20 - /* The following fields are only valid for version >=3D 3 */ + /* Die folgenden Felder sind nur g=C3=BCltig f=C3=BCr Version> =3D 3= */ uint64_t incompatible_features; uint64_t compatible_features; uint64_t autoclear_features; @@ -123,7 +125,7 @@ typedef struct QCowHeader { } QEMU_PACKED QCowHeader; =20 typedef struct QEMU_PACKED QCowSnapshotHeader { - /* header is 8 byte aligned */ + /* Header ist 8 Byte ausgerichtet */ uint64_t l1_table_offset; =20 uint32_t l1_size; @@ -136,10 +138,10 @@ typedef struct QEMU_PACKED QCowSnapshotHeader { uint64_t vm_clock_nsec; =20 uint32_t vm_state_size; - uint32_t extra_data_size; /* for extension */ - /* extra data follows */ - /* id_str follows */ - /* name follows */ + uint32_t extra_data_size; /* f=C3=BCr Erweiterung */ + /* zus=C3=A4tzliche Daten folgt */ + /* id_str folgt */ + /* Name folgt */ } QCowSnapshotHeader; =20 typedef struct QEMU_PACKED QCowSnapshotExtraData { @@ -176,7 +178,7 @@ enum { QCOW2_FEAT_TYPE_AUTOCLEAR =3D 2, }; =20 -/* Incompatible feature bits */ +/* Inkompatible Feature Bits */ enum { QCOW2_INCOMPAT_DIRTY_BITNR =3D 0, QCOW2_INCOMPAT_CORRUPT_BITNR =3D 1, @@ -187,7 +189,7 @@ enum { | QCOW2_INCOMPAT_CORRUPT, }; =20 -/* Compatible feature bits */ +/* Kompatibel Feature Bits */ enum { QCOW2_COMPAT_LAZY_REFCOUNTS_BITNR =3D 0, QCOW2_COMPAT_LAZY_REFCOUNTS =3D 1 << QCOW2_COMPAT_LAZY_REFCOUN= TS_BITNR, @@ -256,7 +258,8 @@ typedef struct BDRVQcow2State { =20 CoMutex lock; =20 - QCryptoCipher *cipher; /* current cipher, NULL if no key yet */ + /* Stromchiffre, NULL, wenn kein Schl=C3=BCssel vorhanden */ + QCryptoCipher *cipher; uint32_t crypt_method_header; uint64_t snapshots_offset; int snapshots_size; @@ -275,7 +278,7 @@ typedef struct BDRVQcow2State { =20 bool discard_passthrough[QCOW2_DISCARD_MAX]; =20 - int overlap_check; /* bitmask of Qcow2MetadataOverlap values */ + int overlap_check; /* bitmask von Qcow2MetadataOverlap Werte */ bool signaled_corruption; =20 uint64_t incompatible_features; @@ -288,64 +291,64 @@ typedef struct BDRVQcow2State { QTAILQ_HEAD (, Qcow2DiscardRegion) discards; bool cache_discards; =20 - /* Backing file path and format as stored in the image (this is not = the - * effective path/format, which may be the result of a runtime optio= n - * override) */ + /* Sichern Dateipfad und Format wie in dem Bild gespeichert (dies is= t nicht + * das ist effektive Weg / Format, das das Ergebnis einer Runtime-Op= tion + * sein kann gekr=C3=B6pft) */ char *image_backing_file; char *image_backing_format; } BDRVQcow2State; =20 typedef struct Qcow2COWRegion { /** - * Offset of the COW region in bytes from the start of the first clu= ster - * touched by the request. + * Offset der COW-Region in Bytes vom Anfang des ersten Clusters + * durch die Anforderung ber=C3=BChrt. */ uint64_t offset; =20 - /** Number of sectors to copy */ + /** Anzahl der Sektoren zu kopieren */ int nb_sectors; } Qcow2COWRegion; =20 /** - * Describes an in-flight (part of a) write request that writes to clust= ers - * that are not referenced in their L2 table yet. + * Beschreibt ein in-flight (Teil eines) Schreibanforderung, die an Clus= ter + * schreibt, die noch nicht in ihrer L2 Tabelle verwiesen. */ typedef struct QCowL2Meta { - /** Guest offset of the first newly allocated cluster */ + /** Gast Offset des ersten neu zugewiesenen Cluster */ uint64_t offset; =20 - /** Host offset of the first newly allocated cluster */ + /** Host-Offset neu des ersten zugewiesenen Cluster */ uint64_t alloc_offset; =20 /** - * Number of sectors from the start of the first allocated cluster t= o - * the end of the (possibly shortened) request + * Anzahl von Sektoren vom Beginn des ersten zugewiesenen Cluster + * das Ende der (m=C3=B6glicherweise gek=C3=BCrzt) Anfrage */ int nb_available; =20 - /** Number of newly allocated clusters */ + /** Anzahl der neu zugewiesenen Cluster */ int nb_clusters; =20 /** - * Requests that overlap with this allocation and wait to be restart= ed - * when the allocating request has completed. + * Anfrangen, die mit dieser Zuordnung =C3=BCberlappen, und darauf w= arten, neu + * gestartet zu werden, wenn die Zuteilungsanforderung abgeschlossen= ist. */ CoQueue dependent_requests; =20 /** - * The COW Region between the start of the first allocated cluster a= nd the - * area the guest actually writes to. + * Die Kuh Region zwischen dem Beginn des ersten zugewiesenen Cluste= r und + * die Gebiet der Gast tats=C3=A4chlich schreibt. */ Qcow2COWRegion cow_start; =20 /** - * The COW Region between the area the guest actually writes to and = the - * end of the last allocated cluster. + * Die Kuh Region zwischen dem Bereich der Gast schreibt tats=C3=A4c= hlich und + * der Ende des letzten zugeordneten Cluster. */ Qcow2COWRegion cow_end; =20 - /** Pointer to next L2Meta of the same write request */ + /** Zeiger auf das n=C3=A4chste L2Meta der gleichen Schreibanforderu= ng */ struct QCowL2Meta *next; =20 QLIST_ENTRY(QCowL2Meta) next_in_flight; @@ -378,22 +381,24 @@ typedef enum QCow2MetadataOverlap { QCOW2_OL_REFCOUNT_BLOCK =3D (1 << QCOW2_OL_REFCOUNT_BLOCK_BITNR), QCOW2_OL_SNAPSHOT_TABLE =3D (1 << QCOW2_OL_SNAPSHOT_TABLE_BITNR), QCOW2_OL_INACTIVE_L1 =3D (1 << QCOW2_OL_INACTIVE_L1_BITNR), - /* NOTE: Checking overlaps with inactive L2 tables will result in bd= rv - * reads. */ + /* HINWEIS: =C3=9Cberpr=C3=BCfen =C3=BCberlappt mit inaktiven L2 Tab= ellen f=C3=BChrt in BDRV + * liest. */ QCOW2_OL_INACTIVE_L2 =3D (1 << QCOW2_OL_INACTIVE_L2_BITNR), } QCow2MetadataOverlap; =20 -/* Perform all overlap checks which can be done in constant time */ +/* F=C3=BChren Sie alle =C3=9Cberschneidungen =C3=BCberpr=C3=BCft, die i= n konstanter Zeit + * durchgef=C3=BChrt werden kann */ #define QCOW2_OL_CONSTANT \ (QCOW2_OL_MAIN_HEADER | QCOW2_OL_ACTIVE_L1 | QCOW2_OL_REFCOUNT_TABLE= | \ QCOW2_OL_SNAPSHOT_TABLE) =20 -/* Perform all overlap checks which don't require disk access */ +/* F=C3=BChren Sie alle =C3=9Cberlappungspr=C3=BCfungen, die keine Platt= enzugriff + * erfordern */ #define QCOW2_OL_CACHED \ (QCOW2_OL_CONSTANT | QCOW2_OL_ACTIVE_L2 | QCOW2_OL_REFCOUNT_BLOCK | = \ QCOW2_OL_INACTIVE_L1) =20 -/* Perform all overlap checks */ +/* F=C3=BChren Sie alle =C3=9Cberlappungspr=C3=BCfungen */ #define QCOW2_OL_ALL \ (QCOW2_OL_CACHED | QCOW2_OL_INACTIVE_L2) =20 @@ -458,7 +463,7 @@ static inline int qcow2_get_cluster_type(uint64_t l2_= entry) } } =20 -/* Check whether refcounts are eager or lazy */ +/* =C3=9Cberpr=C3=BCfen Sie, ob Refcounts sind gespannt oder faul */ static inline bool qcow2_need_accurate_refcounts(BDRVQcow2State *s) { return !(s->incompatible_features & QCOW2_INCOMPAT_DIRTY); @@ -482,7 +487,7 @@ static inline uint64_t refcount_diff(uint64_t r1, uin= t64_t r2) =20 // FIXME Need qcow2_ prefix to global functions =20 -/* qcow2.c functions */ +/* qcow2.c Funktionen */ int qcow2_backing_read1(BlockDriverState *bs, QEMUIOVector *qiov, int64_t sector_num, int nb_sectors); =20 @@ -495,7 +500,7 @@ void qcow2_signal_corruption(BlockDriverState *bs, bo= ol fatal, int64_t offset, int64_t size, const char *message_format, .= ..) GCC_FMT_ATTR(5, 6); =20 -/* qcow2-refcount.c functions */ +/* qcow2-refcount.c Funktionen */ int qcow2_refcount_init(BlockDriverState *bs); void qcow2_refcount_close(BlockDriverState *bs); =20 @@ -533,7 +538,7 @@ int qcow2_change_refcount_order(BlockDriverState *bs,= int refcount_order, BlockDriverAmendStatusCB *status_cb, void *cb_opaque, Error **errp); =20 -/* qcow2-cluster.c functions */ +/* qcow2-cluster.c Funktionen */ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size, bool exact_size); int qcow2_write_l1_entry(BlockDriverState *bs, int l1_index); @@ -560,7 +565,7 @@ int qcow2_expand_zero_clusters(BlockDriverState *bs, BlockDriverAmendStatusCB *status_cb, void *cb_opaque); =20 -/* qcow2-snapshot.c functions */ +/* qcow2-snapshot.c Funktionen */ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_inf= o); int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id); int qcow2_snapshot_delete(BlockDriverState *bs, @@ -576,7 +581,7 @@ int qcow2_snapshot_load_tmp(BlockDriverState *bs, void qcow2_free_snapshots(BlockDriverState *bs); int qcow2_read_snapshots(BlockDriverState *bs); =20 -/* qcow2-cache.c functions */ +/* qcow2-cache.c Funktionen */ Qcow2Cache *qcow2_cache_create(BlockDriverState *bs, int num_tables); int qcow2_cache_destroy(BlockDriverState* bs, Qcow2Cache *c); =20 diff --git a/block/raw-aio.h b/block/raw-aio.h index 811e375..77183b4 100644 --- a/block/raw-aio.h +++ b/block/raw-aio.h @@ -17,7 +17,7 @@ =20 #include "qemu/iov.h" =20 -/* AIO request types */ +/* AIO Anforderungstypen */ #define QEMU_AIO_READ 0x0001 #define QEMU_AIO_WRITE 0x0002 #define QEMU_AIO_IOCTL 0x0004 @@ -28,12 +28,12 @@ (QEMU_AIO_READ|QEMU_AIO_WRITE|QEMU_AIO_IOCTL|QEMU_AIO_FLUSH| \ QEMU_AIO_DISCARD|QEMU_AIO_WRITE_ZEROES) =20 -/* AIO flags */ +/* AIO-Flags */ #define QEMU_AIO_MISALIGNED 0x1000 #define QEMU_AIO_BLKDEV 0x2000 =20 =20 -/* linux-aio.c - Linux native implementation */ +/* linux-aio.c - Linux native Implementierung */ #ifdef CONFIG_LINUX_AIO void *laio_init(void); void laio_cleanup(void *s); diff --git a/block/raw-posix.c b/block/raw-posix.c index 906d5c9..2f72c8e 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -65,7 +65,7 @@ #include #endif #ifndef FS_NOCOW_FL -#define FS_NOCOW_FL 0x00800000 /* Do not cow file */ +#define FS_NOCOW_FL 0x00800000 /* Nicht Kuh-Datei */ #endif #endif #if defined(CONFIG_FALLOCATE_PUNCH_HOLE) || defined(CONFIG_FALLOCATE_ZER= O_RANGE) @@ -112,7 +112,7 @@ do { \ } \ } while (0) =20 -/* OS X does not have O_DSYNC */ +/* OS X nicht =C3=BCber O_DSYNC */ #ifndef O_DSYNC #ifdef O_SYNC #define O_DSYNC O_SYNC @@ -121,7 +121,7 @@ do { \ #endif #endif =20 -/* Approximate O_DIRECT with O_DSYNC if O_DIRECT isn't available */ +/* Ungef=C3=A4hre O_DIRECT mit O_DSYNC wenn O_DIRECT nicht verf=C3=BCgba= r ist */ #ifndef O_DIRECT #define O_DIRECT O_DSYNC #endif @@ -171,7 +171,7 @@ typedef struct RawPosixAIOData { }; int aio_niov; uint64_t aio_nbytes; -#define aio_ioctl_cmd aio_nbytes /* for QEMU_AIO_IOCTL */ +#define aio_ioctl_cmd aio_nbytes /* f=C3=BCr QEMU_AIO_IOCTL */ off_t aio_offset; int aio_type; } RawPosixAIOData; @@ -219,7 +219,8 @@ static int raw_normalize_devicepath(const char **file= name) #endif =20 /* - * Get logical block size via ioctl. On success store it in @sector_size= _p. + * Erhalten logische Blockgr=C3=B6=C3=9Fe =C3=BCber ioctl. Bei Erfolg sp= eichern Sie es in + * @sector_size_p. */ static int probe_logical_blocksize(int fd, unsigned int *sector_size_p) { @@ -228,7 +229,7 @@ static int probe_logical_blocksize(int fd, unsigned i= nt *sector_size_p) =20 errno =3D ENOTSUP; =20 - /* Try a few ioctls to get the right size */ + /* Probieren Sie ein paar ioctls die richtige Gr=C3=B6=C3=9Fe zu bek= ommen */ #ifdef BLKSSZGET if (ioctl(fd, BLKSSZGET, §or_size) >=3D 0) { *sector_size_p =3D sector_size; @@ -252,9 +253,9 @@ static int probe_logical_blocksize(int fd, unsigned i= nt *sector_size_p) } =20 /** - * Get physical block size of @fd. - * On success, store it in @blk_size and return 0. - * On failure, return -errno. + * Erhalten Sie physischen Blockgr=C3=B6=C3=9Fe von @fd. + * Bei Erfolg, sollte sie in @blk_size und 0 zur=C3=BCck. + * Bei einem Fehler R=C3=BCckkehr -errno. */ static int probe_physical_blocksize(int fd, unsigned int *blk_size) { @@ -268,9 +269,11 @@ static int probe_physical_blocksize(int fd, unsigned= int *blk_size) #endif } =20 -/* Check if read is allowed with given memory buffer and length. +/* =C3=9Cberpr=C3=BCfen Sie, ob gelesen wird mit bestimmten Speicherpuff= er und L=C3=A4nge + * erlaubt. * - * This function is used to check O_DIRECT memory buffer and request ali= gnment. + * Mit dieser Funktion wird O_DIRECT Speicherpuffer und Anforderung Ausr= ichtung + * zu pr=C3=BCfen. */ static bool raw_is_io_aligned(int fd, void *buf, size_t len) { @@ -281,9 +284,10 @@ static bool raw_is_io_aligned(int fd, void *buf, siz= e_t len) } =20 #ifdef __linux__ - /* The Linux kernel returns EINVAL for misaligned O_DIRECT reads. I= gnore - * other errors (e.g. real I/O error), which could happen on a faile= d - * drive, since we only care about probing alignment. + /* Der Linux-Kernel gibt EINVAL f=C3=BCr falsch ausgerichtete O_DIRE= CT liest. + * Ignorieren andere Fehler (z reale I / O-Fehler), die auf einem + * ausgefallenen passieren k=C3=B6nnte fahren, da wir =C3=BCber Sond= ieren + * Ausrichtung nur k=C3=BCmmern. */ if (errno !=3D EINVAL) { return true; @@ -299,8 +303,8 @@ static void raw_probe_alignment(BlockDriverState *bs,= int fd, Error **errp) char *buf; size_t max_align =3D MAX(MAX_BLOCKSIZE, getpagesize()); =20 - /* For SCSI generic devices the alignment is not really used. - With buffered I/O, we don't have any restrictions. */ + /* F=C3=BCr allgemeine SCSI-Ger=C3=A4ten ist die Ausrichtung nicht w= irklich genutzt. + Mit I buffered / O, haben wir keine Einschr=C3=A4nkungen. */ if (bdrv_is_sg(bs) || !s->needs_alignment) { bs->request_alignment =3D 1; s->buf_align =3D 1; @@ -309,7 +313,8 @@ static void raw_probe_alignment(BlockDriverState *bs,= int fd, Error **errp) =20 bs->request_alignment =3D 0; s->buf_align =3D 0; - /* Let's try to use the logical blocksize for the alignment. */ + /* Lassen Sie uns versuchen, die logische Blockgr=C3=B6=C3=9Fe f=C3=BC= r die Ausrichtung + * zu verwenden. */ if (probe_logical_blocksize(fd, &bs->request_alignment) < 0) { bs->request_alignment =3D 0; } @@ -318,13 +323,14 @@ static void raw_probe_alignment(BlockDriverState *b= s, int fd, Error **errp) struct dioattr da; if (xfsctl(NULL, fd, XFS_IOC_DIOINFO, &da) >=3D 0) { bs->request_alignment =3D da.d_miniosz; - /* The kernel returns wrong information for d_mem */ - /* s->buf_align =3D da.d_mem; */ + /* Der Kernel gibt falsche Informationen f=C3=BCr d_mem */ + /* s-> buf_align =3D da.d_mem; */ } } #endif =20 - /* If we could not get the sizes so far, we can only guess them */ + /* Wenn wir nicht die Gr=C3=B6=C3=9Fen so weit kommen konnte, k=C3=B6= nnen wir sie nur + * vermuten, */ if (!s->buf_align) { size_t align; buf =3D qemu_memalign(max_align, 2 * max_align); @@ -367,8 +373,8 @@ static void raw_parse_flags(int bdrv_flags, int *open= _flags) *open_flags |=3D O_RDONLY; } =20 - /* Use O_DSYNC for write-through caching, no flags for write-back ca= ching, - * and O_DIRECT for no caching. */ + /* Verwenden Sie O_DSYNC f=C3=BCr Write-Through-Caching, Flaggen nic= ht f=C3=BCr + * Write-Back-Caching, und O_DIRECT ohne Caching. */ if ((bdrv_flags & BDRV_O_NOCACHE)) { *open_flags |=3D O_DIRECT; } @@ -404,13 +410,13 @@ static int raw_set_aio(void **aio_ctx, int *use_aio= , int bdrv_flags) assert(aio_ctx !=3D NULL); assert(use_aio !=3D NULL); /* - * Currently Linux do AIO only for files opened with O_DIRECT - * specified so check NOCACHE flag too + * Linux tun AIO Zur Zeit nur f=C3=BCr Dateien mit O_DIRECT ge=C3=B6= ffnet + * angegeben, so =C3=BCberpr=C3=BCfen zu NOCACHE Flagge */ if ((bdrv_flags & (BDRV_O_NOCACHE|BDRV_O_NATIVE_AIO)) =3D=3D (BDRV_O_NOCACHE|BDRV_O_NATIVE_AIO)) { =20 - /* if non-NULL, laio_init() has already been run */ + /* wenn nicht NULL, laio_init () bereits ausgef=C3=BChrt wurde *= / if (*aio_ctx =3D=3D NULL) { *aio_ctx =3D laio_init(); if (!*aio_ctx) { @@ -432,9 +438,9 @@ error: static void raw_parse_filename(const char *filename, QDict *options, Error **errp) { - /* The filename does not have to be prefixed by the protocol name, s= ince - * "file" is the default protocol; therefore, the return value of th= is - * function call can be ignored. */ + /* Der Dateiname muss nicht durch den Protokollnamen vorangestellt w= erden, + * da "File" ist das Standardprotokoll; daher der R=C3=BCckgabewert = dieser + * Funktionsaufruf kann ignoriert werden. */ strstart(filename, "file:", &filename); =20 qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename= ))); @@ -449,7 +455,7 @@ static QemuOptsList raw_runtime_opts =3D { .type =3D QEMU_OPT_STRING, .help =3D "File name of the image", }, - { /* end of list */ } + { /* Ende der Liste */ } }, }; =20 @@ -513,7 +519,7 @@ static int raw_open_common(BlockDriverState *bs, QDic= t *options, ret =3D -EINVAL; goto fail; } -#endif /* !defined(CONFIG_LINUX_AIO) */ +#endif /* ! Definiert (CONFIG_LINUX_AIO) */ =20 s->has_discard =3D true; s->has_write_zeroes =3D true; @@ -538,9 +544,10 @@ static int raw_open_common(BlockDriverState *bs, QDi= ct *options, } #endif #ifdef __linux__ - /* On Linux 3.10, BLKDISCARD leaves stale data in the page cache= . Do - * not rely on the contents of discarded blocks unless using O_D= IRECT. - * Same for BLKZEROOUT. + /* Unter Linux 3.10, verl=C3=A4sst BLKDISCARD veraltete Daten in= den + * Seiten-Cache. Machen nicht auf den Inhalt der Bl=C3=B6cke ver= worfen + * verlassen O_DIRECT sofern nicht verwenden. Das Gleiche gilt f= =C3=BCr + * BLKZEROOUT. */ if (!(bs->open_flags & BDRV_O_NOCACHE)) { s->discard_zeroes =3D false; @@ -551,10 +558,11 @@ static int raw_open_common(BlockDriverState *bs, QD= ict *options, #ifdef __FreeBSD__ if (S_ISCHR(st.st_mode)) { /* - * The file is a char device (disk), which on FreeBSD isn't behi= nd - * a pager, so force all requests to be aligned. This is needed - * so QEMU makes sure all IO operations on the device are aligne= d - * to sector size, or else FreeBSD will reject them with EINVAL. + * Die Datei ist eine char-Ger=C3=A4t (Disk), die auf FreeBSD is= t nicht + * hinter ein Pager, zwingen so alle Anforderungen ausgerichtet = werden. + * Dies ist erforderlich, so macht QEMU sicher, dass alle + * IO-Operationen auf dem Ger=C3=A4t ausgerichtet sind In den Se= ktorgr=C3=B6=C3=9Fe + * oder auch FreeBSD wird sie mit EINVAL ablehnen. */ s->needs_alignment =3D true; } @@ -611,9 +619,10 @@ static int raw_reopen_prepare(BDRVReopenState *state= , #ifdef CONFIG_LINUX_AIO raw_s->use_aio =3D s->use_aio; =20 - /* we can use s->aio_ctx instead of a copy, because the use_aio flag= is - * valid in the 'false' condition even if aio_ctx is set, and raw_se= t_aio() - * won't override aio_ctx if aio_ctx is non-NULL */ + /* k=C3=B6nnen wir verwenden s-> aio_ctx statt einer Kopie, weil die= use_aio + * Flag g=C3=BCltig in der "falschen" Zustand, auch wenn aio_ctx ges= etzt ist, + * und raw_set_aio () nicht au=C3=9Fer Kraft setzen, wenn aio_ctx ai= o_ctx nicht + * NULL ist */ if (raw_set_aio(&s->aio_ctx, &raw_s->use_aio, state->flags)) { error_setg(errp, "Could not set AIO state"); return -1; @@ -634,17 +643,18 @@ static int raw_reopen_prepare(BDRVReopenState *stat= e, #endif =20 #ifdef O_ASYNC - /* Not all operating systems have O_ASYNC, and those that don't - * will not let us track the state into raw_s->open_flags (typically - * you achieve the same effect with an ioctl, for example I_SETSIG - * on Solaris). But we do not use O_ASYNC, so that's fine. + /* Nicht alle Betriebssysteme haben O_ASYNC, und diejenigen, die die= s nicht + * tun lassen Sie uns den Zustand nicht verfolgen in raw_s-> open_fl= ags + * (typischerweise Sie den gleichen Effekt mit einem ioctl zu erreic= hen, + * zum Beispiel I_SETSIG auf Solaris). Aber wir O_ASYNC setzen nicht= , so + * ist das in Ordnung. */ assert((s->open_flags & O_ASYNC) =3D=3D 0); #endif =20 if ((raw_s->open_flags & ~fcntl_flags) =3D=3D (s->open_flags & ~fcnt= l_flags)) { - /* dup the original fd */ - /* TODO: use qemu fcntl wrapper */ + /* dup die urspr=C3=BCngliche fd */ + /* TODO: Verwendung qemu fcntl Wrapper */ #ifdef F_DUPFD_CLOEXEC raw_s->fd =3D fcntl(s->fd, F_DUPFD_CLOEXEC, 0); #else @@ -662,7 +672,8 @@ static int raw_reopen_prepare(BDRVReopenState *state, } } =20 - /* If we cannot use fcntl, or fcntl failed, fall back to qemu_open()= */ + /* Wenn wir nicht fcntl verwenden k=C3=B6nnen, oder fcntl fehlgeschl= agen ist, + * zur=C3=BCckgreifen zu qemu_open () */ if (raw_s->fd =3D=3D -1) { const char *normalized_filename =3D state->bs->filename; ret =3D raw_normalize_devicepath(&normalized_filename); @@ -678,8 +689,8 @@ static int raw_reopen_prepare(BDRVReopenState *state, } } =20 - /* Fail already reopen_prepare() if we can't get a working O_DIRECT - * alignment with the new fd. */ + /* Nicht bestanden bereits reopen_prepare (), wenn wir nicht eine + * funktionierende O_DIRECT bekommen Ausrichtung mit dem neuen fd. *= / if (raw_s->fd !=3D -1) { raw_probe_alignment(state->bs, raw_s->fd, &local_err); if (local_err) { @@ -715,7 +726,7 @@ static void raw_reopen_abort(BDRVReopenState *state) { BDRVRawReopenState *raw_s =3D state->opaque; =20 - /* nothing to do if NULL, we didn't get far enough */ + /* nichts zu tun, wenn NULL, wir nicht weit genug bekommen */ if (raw_s =3D=3D NULL) { return; } @@ -749,16 +760,16 @@ static int check_for_dasd(int fd) } =20 /** - * Try to get @bs's logical and physical block size. - * On success, store them in @bsz and return zero. - * On failure, return negative errno. + * Versuchen Sie, @ der bs logischen und physischen Blockgr=C3=B6=C3=9Fe= . + * Bei Erfolg speichern sie in @bsz und null zur=C3=BCck. + * Bei einem Fehler R=C3=BCckkehr negativ errno. */ static int hdev_probe_blocksizes(BlockDriverState *bs, BlockSizes *bsz) { BDRVRawState *s =3D bs->opaque; int ret; =20 - /* If DASD, get blocksizes */ + /* Wenn DASD, bekommen Blockgr=C3=B6=C3=9Fen */ if (check_for_dasd(s->fd) < 0) { return -ENOTSUP; } @@ -770,10 +781,10 @@ static int hdev_probe_blocksizes(BlockDriverState *= bs, BlockSizes *bsz) } =20 /** - * Try to get @bs's geometry: cyls, heads, sectors. - * On success, store them in @geo and return 0. - * On failure return -errno. - * (Allows block driver to assign default geometry values that guest see= s) + * Versuchen @ bs Geometrie zu erhalten: cyls, K=C3=B6pfe, Sektoren. + * Bei Erfolg speichern sie in @geo und 0 zur=C3=BCck. + * Bei einem Fehler R=C3=BCckkehr -errno. + * (Erm=C3=B6glicht Blocktreiber Standardgeometriewerte zuweisen, dass G= ast sieht) */ #ifdef __linux__ static int hdev_probe_geometry(BlockDriverState *bs, HDGeometry *geo) @@ -781,19 +792,19 @@ static int hdev_probe_geometry(BlockDriverState *bs= , HDGeometry *geo) BDRVRawState *s =3D bs->opaque; struct hd_geometry ioctl_geo =3D {0}; =20 - /* If DASD, get its geometry */ + /* Wenn DASD, erhalten ihre Geometrie */ if (check_for_dasd(s->fd) < 0) { return -ENOTSUP; } if (ioctl(s->fd, HDIO_GETGEO, &ioctl_geo) < 0) { return -errno; } - /* HDIO_GETGEO may return success even though geo contains zeros - (e.g. certain multipath setups) */ + /* HDIO_GETGEO kann Erfolg zur=C3=BCckgeben, auch wenn geo Nullen en= th=C3=A4lt + (Z.B. bestimmte Mehrweg-Setups) */ if (!ioctl_geo.heads || !ioctl_geo.sectors || !ioctl_geo.cylinders) = { return -ENOTSUP; } - /* Do not return a geometry for partition */ + /* Verwenden Sie keine Geometrie f=C3=BCr Partition zur=C3=BCckkehre= n */ if (ioctl_geo.start !=3D 0) { return -ENOTSUP; } @@ -891,10 +902,10 @@ static ssize_t handle_aiocb_rw_vector(RawPosixAIODa= ta *aiocb) } =20 /* - * Read/writes the data to/from a given linear buffer. + * Lese- / schreibt die Daten zu / von einem gegebenen linearen Puffer. * - * Returns the number of bytes handles or -errno in case of an error. Sh= ort - * reads are only returned if the end of the file is reached. + * Gibt die Anzahl von Bytes, Griffe oder -errno im Falle eines Fehlers.= Kurz + * nur zur=C3=BCck liest, wenn das Ende der Datei erreicht ist. */ static ssize_t handle_aiocb_rw_linear(RawPosixAIOData *aiocb, char *buf) { @@ -919,9 +930,10 @@ static ssize_t handle_aiocb_rw_linear(RawPosixAIODat= a *aiocb, char *buf) (aiocb->bs->open_flags & BDRV_O_NOCACHE) && !(aiocb->aio_type & QEMU_AIO_WRITE) && offset > 0) { - /* O_DIRECT pread() may fail with EINVAL when offset is unal= igned - * after a short read. Assume that O_DIRECT short reads onl= y occur - * at EOF. Therefore this is a short read, not an I/O error= . + /* O_DIRECT pread () kann mit EINVAL fehlschlagen, wenn nich= t + * ausgerichteten Offset nach einer kurzen Lekt=C3=BCre. Es = sei + * angenommen, dass O_DIRECT kurz nur liest auftreten bei EO= F. + * Daher ist dies eine kurze Lese, und kein I / O-Fehler. */ break; } else if (len =3D=3D -1) { @@ -943,17 +955,17 @@ static ssize_t handle_aiocb_rw(RawPosixAIOData *aio= cb) =20 if (!(aiocb->aio_type & QEMU_AIO_MISALIGNED)) { /* - * If there is just a single buffer, and it is properly aligned - * we can just use plain pread/pwrite without any problems. + * Wenn es nur einen einzigen Puffer, und es richtig ausgerichte= t ist + * wir k=C3=B6nnen einfach nur pread / pwrite ohne Probleme verw= enden. */ if (aiocb->aio_niov =3D=3D 1) { return handle_aiocb_rw_linear(aiocb, aiocb->aio_iov->iov_ba= se); } /* - * We have more than one iovec, and all are properly aligned. + * Wir haben mehr als eine iovec und alle richtig ausgerichtet s= ind. * - * Try preadv/pwritev first and fall back to linearizing the - * buffer if it's not supported. + * Versuchen Sie preadv / pwritev erste und fallen wieder die zu + * Linearisieren Puffer, wenn es nicht unterst=C3=BCtzt wird. */ if (preadv_present) { nbytes =3D handle_aiocb_rw_vector(aiocb); @@ -965,15 +977,15 @@ static ssize_t handle_aiocb_rw(RawPosixAIOData *aio= cb) } =20 /* - * XXX(hch): short read/write. no easy way to handle the remind= er - * using these interfaces. For now retry using plain - * pread/pwrite? + * XXX (HCH): F=C3=BCr kurze Lese- / Schreib. keine einfache M=C3= =B6glichkeit, + * um die Erinnerung zu handhaben Mit diesen Schnittstellen. F=C3= =BCr + * versuchen nun klar, mit pread / pwrite? */ } =20 /* - * Ok, we have to do it the hard way, copy all segments into - * a single aligned buffer. + * Ok, wir haben es auf die harte Art und Weise zu tun, kopieren Sie= alle + * Segmente in ein einziger ausgerichtet Puffer. */ buf =3D qemu_try_blockalign(aiocb->bs, aiocb->aio_nbytes); if (buf =3D=3D NULL) { @@ -1310,10 +1322,10 @@ static BlockAIOCB *raw_aio_submit(BlockDriverStat= e *bs, return NULL; =20 /* - * Check if the underlying device requires requests to be aligned, - * and if the request we are trying to submit is aligned or not. - * If this is the case tell the low-level driver that it needs - * to copy the buffer. + * =C3=9Cberpr=C3=BCfen Sie, ob die zugrunde liegende Ger=C3=A4teanf= orderungen erfordert + * ausgerichtet werden, und wenn die Anforderung wir einreichen vers= uchen + * ausgerichtet ist oder nicht. Ist dies der Fall, sagen die + * Low-Level-Treiber, der es braucht den Puffer zu kopieren. */ if (s->needs_alignment) { if (!bdrv_qiov_is_aligned(bs, qiov)) { @@ -1486,7 +1498,7 @@ static int64_t raw_getlength(BlockDriverState *bs) } =20 /* - * Use the DKIOCGMEDIAINFO ioctl to read the size. + * Verwenden Sie die DKIOCGMEDIAINFO ioctl die Gr=C3=B6=C3=9Fe zu le= sen. */ ret =3D ioctl(s->fd, DKIOCGMEDIAINFO, &minfo); if (ret !=3D -1) { @@ -1494,8 +1506,8 @@ static int64_t raw_getlength(BlockDriverState *bs) } =20 /* - * There are reports that lseek on some devices fails, but - * irc discussion said that contingency on contingency was overkill. + * Es gibt Berichte, dass bei einigen Ger=C3=A4ten lseek ausf=C3=A4l= lt, aber + * irc Diskussion gesagt, dass Kontingenz auf Kontingenz Overkill wa= r. */ size =3D lseek(s->fd, 0, SEEK_END); if (size < 0) { @@ -1559,10 +1571,11 @@ again: #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) switch(s->type) { case FTYPE_CD: - /* XXX FreeBSD acd returns UINT_MAX sectors for an empty dri= ve */ + /* XXX FreeBSD acd kehrt UINT_MAX Sektoren f=C3=BCr ein leer= es + * Laufwerk */ if (size =3D=3D 2048LL * (unsigned)-1) size =3D 0; - /* XXX no disc? maybe we need to reopen... */ + /* XXX keine Disc? vielleicht m=C3=BCssen wir wieder =C3=B6f= fnen ... */ if (size <=3D 0 && !reopened && cdrom_reopen(bs) >=3D 0) { reopened =3D 1; goto again; @@ -1620,7 +1633,7 @@ static int raw_create(const char *filename, QemuOpt= s *opts, Error **errp) =20 strstart(filename, "file:", &filename); =20 - /* Read out options */ + /* Vorlesen Optionen */ total_size =3D ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, = 0), BDRV_SECTOR_SIZE); nocow =3D qemu_opt_get_bool(opts, BLOCK_OPT_NOCOW, false); @@ -1645,10 +1658,10 @@ static int raw_create(const char *filename, QemuO= pts *opts, Error **errp) =20 if (nocow) { #ifdef __linux__ - /* Set NOCOW flag to solve performance issue on fs like btrfs. - * This is an optimisation. The FS_IOC_SETFLAGS ioctl return val= ue - * will be ignored since any failure of this operation should no= t - * block the left work. + /* Stellen Sie NOCOW Flag Performance-Problem auf fs wie Btrfs z= u + * l=C3=B6sen. Dies ist eine Optimierung. Der FS_IOC_SETFLAGS io= ctl + * R=C3=BCckgabewert wird da jeder Ausfall dieser Operation igno= riert + * werden sollte nicht blockieren die linke Arbeit. */ int attr; if (ioctl(fd, FS_IOC_GETFLAGS, &attr) =3D=3D 0) { @@ -1667,7 +1680,7 @@ static int raw_create(const char *filename, QemuOpt= s *opts, Error **errp) switch (prealloc) { #ifdef CONFIG_POSIX_FALLOCATE case PREALLOC_MODE_FALLOC: - /* posix_fallocate() doesn't set errno. */ + /* posix_fallocate () f=C3=BChrt errno nicht gesetzt. */ result =3D -posix_fallocate(fd, 0, total_size); if (result !=3D 0) { error_setg_errno(errp, -result, @@ -1721,14 +1734,15 @@ out: } =20 /* - * Find allocation range in @bs around offset @start. - * May change underlying file descriptor's file offset. - * If @start is not in a hole, store @start in @data, and the - * beginning of the next hole in @hole, and return 0. - * If @start is in a non-trailing hole, store @start in @hole and the - * beginning of the next non-hole in @data, and return 0. - * If @start is in a trailing hole or beyond EOF, return -ENXIO. - * If we can't find out, return a negative errno other than -ENXIO. + * Finden Zuordnungsbereichs in @bs um Offset @start. + * Kann =C3=A4ndern Dateideskriptor der Datei Offset zugrunde liegen. + * Wenn @start ist nicht in einem Loch, speichern @start in @data, und d= ie + * Anfang des n=C3=A4chsten Loch in @ Loch und 0 zur=C3=BCck. + * Wenn @start ist in einer nicht abschlie=C3=9Fenden Loch, speichern @s= tart in + * @ Loch und die Anfang des n=C3=A4chsten Nicht-Loch in @data und 0 zur= =C3=BCck. + * Wenn @start in einem nachgestellten Loch oder =C3=BCber EOF ist, kehr= en -ENXIO. + * Wenn wir nicht herausfinden k=C3=B6nnen, kehren Sie zu einem negative= n errno + * andere als -ENXIO. */ static int find_allocation(BlockDriverState *bs, off_t start, off_t *data, off_t *hole) @@ -1738,67 +1752,67 @@ static int find_allocation(BlockDriverState *bs, = off_t start, off_t offs; =20 /* - * SEEK_DATA cases: - * D1. offs =3D=3D start: start is in data - * D2. offs > start: start is in a hole, next data at offs - * D3. offs < 0, errno =3D ENXIO: either start is in a trailing hole - * or start is beyond EOF - * If the latter happens, the file has been truncated behind - * our back since we opened it. All bets are off then. - * Treating like a trailing hole is simplest. - * D4. offs < 0, errno !=3D ENXIO: we learned nothing + * SEEK_DATA F=C3=A4lle: + * D1. offs =3D=3D Start: Start in Daten + * D2. offs> starten: Start in ein Loch ist, bei offs n=C3=A4chsten = Daten + * D3. offs <0, errno =3D ENXIO: entweder Start ist in einem abschli= e=C3=9Fenden + * Loch oder Start ist =C3=BCber EOF + * Wenn letzteres der Fall ist, wurde die Datei hinter abgeschni= tten + * R=C3=BCcken, da wir es ge=C3=B6ffnet. Alle Wetten ab dann. + * Die Behandlung wie ein nachlauf Loch ist am einfachsten. + * D4. offs <0, errno =3D ENXIO: wir nichts gelernt */ offs =3D lseek(s->fd, start, SEEK_DATA); if (offs < 0) { - return -errno; /* D3 or D4 */ + return -errno; /* D3 oder D4 */ } assert(offs >=3D start); =20 if (offs > start) { - /* D2: in hole, next data at offs */ + /* D2: in Loch n=C3=A4chsten Daten bei offs */ *hole =3D start; *data =3D offs; return 0; } =20 - /* D1: in data, end not yet known */ + /* D1: in Daten, Ende noch nicht bekannt */ =20 /* - * SEEK_HOLE cases: - * H1. offs =3D=3D start: start is in a hole - * If this happens here, a hole has been dug behind our back - * since the previous lseek(). - * H2. offs > start: either start is in data, next hole at offs, - * or start is in trailing hole, EOF at offs - * Linux treats trailing holes like any other hole: offs =3D=3D - * start. Solaris seeks to EOF instead: offs > start (blech). - * If that happens here, a hole has been dug behind our back - * since the previous lseek(). - * H3. offs < 0, errno =3D ENXIO: start is beyond EOF - * If this happens, the file has been truncated behind our - * back since we opened it. Treat it like a trailing hole. - * H4. offs < 0, errno !=3D ENXIO: we learned nothing - * Pretend we know nothing at all, i.e. "forget" about D1. + * SEEK_HOLE F=C3=A4lle: + * H1. offs =3D=3D Start: Start ist in einem Loch + * Wenn dies hier der Fall ist, hat ein Loch wurde hinter unsere= m + * R=C3=BCcken gegraben seit dem vorherigen lseek (). + * H2. offs> starten: entweder Start in Daten, das n=C3=A4chste Loch= ist bei + * offs, oder Start ist Loch in der Schleppkette, EOF bei offs + * Linux leckereien L=C3=B6cher wie jedes andere Loch Hinter: of= fs =3D=3D + * Anfang. Solaris sucht stattdessen EOF: offs> start (blech). + * Wenn das hier der Fall ist, hat ein Loch wurde hinter unserem= R=C3=BCcken + * gegraben seit dem vorherigen lseek (). + * H3. offs <0, errno =3D ENXIO: Start ist =C3=BCber EOF + * Wenn dies geschieht, wurde die Datei hinter unserem abgeschni= tten + * zur=C3=BCck, da wir es ge=C3=B6ffnet. Behandeln Sie es wie ei= n nachlauf Loch. + * H4. offs <0, errno =3D ENXIO: wir nichts gelernt + * T=C3=A4uschen wir wissen gar nichts, das hei=C3=9Ft "vergesse= n" =C3=BCber D1. */ offs =3D lseek(s->fd, start, SEEK_HOLE); if (offs < 0) { - return -errno; /* D1 and (H3 or H4) */ + return -errno; /* D1 und (H3 oder H4) */ } assert(offs >=3D start); =20 if (offs > start) { /* - * D1 and H2: either in data, next hole at offs, or it was in - * data but is now in a trailing hole. In the latter case, - * all bets are off. Treating it as if it there was data all - * the way to EOF is safe, so simply do that. + * D1 und H2: entweder in Daten, n=C3=A4chste Loch in offs, oder= es war in + * die Daten sind jedoch nun in einem abschlie=C3=9Fenden Loch. = Im letzteren + * Fall, sind alle Wetten ab. Behandeln, als ob es Daten gibt es= war + * alles der Weg zum EOF ist sicher, so einfach das tun. */ *data =3D start; *hole =3D offs; return 0; } =20 - /* D1 and H1 */ + /* D1 und H1 */ return -EBUSY; #else return -ENOTSUP; @@ -1806,17 +1820,17 @@ static int find_allocation(BlockDriverState *bs, = off_t start, } =20 /* - * Returns the allocation status of the specified sectors. + * Gibt den Zuordnungs-Status der angegebenen Sektoren. * - * If 'sector_num' is beyond the end of the disk image the return value = is 0 - * and 'pnum' is set to 0. + * Wenn 'sector_num' =C3=BCber das Ende des Disk-Image ist der R=C3=BCck= gabewert 0 + * und 'pnum' auf 0 gesetzt ist. * - * 'pnum' is set to the number of sectors (including and immediately fol= lowing - * the specified sector) that are known to be in the same - * allocated/unallocated state. + * 'Pnum' ist auf die Anzahl der Sektoren gesetzt (einschlie=C3=9Flich u= nd + * unmittelbar im Anschluss an der angegebene Sektor), die in derselben + * bekannt sind zugeordnet / nicht zugeordneten Zustand. * - * 'nb_sectors' is the max value 'pnum' should be set to. If nb_sectors= goes - * beyond the end of the disk image it will be clamped. + * 'Nb_sectors' ist der h=C3=B6chste Wert 'pnum' gesetzt werden soll. We= nn + * nb_sectors geht =C3=BCber das Ende des Disk-Image wird es gespannt we= rden. */ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs= , int64_t sector_num, @@ -1845,20 +1859,21 @@ static int64_t coroutine_fn raw_co_get_block_stat= us(BlockDriverState *bs, =20 ret =3D find_allocation(bs, start, &data, &hole); if (ret =3D=3D -ENXIO) { - /* Trailing hole */ + /* Nachgestellte Loch */ *pnum =3D nb_sectors; ret =3D BDRV_BLOCK_ZERO; } else if (ret < 0) { - /* No info available, so pretend there are no holes */ + /* Keine Information verf=C3=BCgbar, so tun, so gibt es keine L=C3= =B6cher */ *pnum =3D nb_sectors; ret =3D BDRV_BLOCK_DATA; } else if (data =3D=3D start) { - /* On a data extent, compute sectors to the end of the extent, - * possibly including a partial sector at EOF. */ + /* Auf einem Daten Ma=C3=9Fe berechnen Sektoren bis zum Ende des= Ausma=C3=9Fes, + * m=C3=B6glicherweise auch einen Teilsektor bei EOF. */ *pnum =3D MIN(nb_sectors, DIV_ROUND_UP(hole - start, BDRV_SECTOR= _SIZE)); ret =3D BDRV_BLOCK_DATA; } else { - /* On a hole, compute sectors to the beginning of the next exten= t. */ + /* Auf einem Loch, berechnen Sektoren zu Beginn des n=C3=A4chste= n + * Ausma=C3=9F. */ assert(hole =3D=3D start); *pnum =3D MIN(nb_sectors, (data - start) / BDRV_SECTOR_SIZE); ret =3D BDRV_BLOCK_ZERO; @@ -1921,7 +1936,7 @@ static QemuOptsList raw_create_opts =3D { .type =3D QEMU_OPT_STRING, .help =3D "Preallocation mode (allowed values: off, falloc, = full)" }, - { /* end of list */ } + { /* Ende der Liste */ } } }; =20 @@ -1930,7 +1945,7 @@ BlockDriver bdrv_file =3D { .protocol_name =3D "file", .instance_size =3D sizeof(BDRVRawState), .bdrv_needs_filename =3D true, - .bdrv_probe =3D NULL, /* no probe for protocols */ + .bdrv_probe =3D NULL, /* keine Sonde f=C3=BCr Protokolle */ .bdrv_parse_filename =3D raw_parse_filename, .bdrv_file_open =3D raw_open, .bdrv_reopen_prepare =3D raw_reopen_prepare, @@ -1964,7 +1979,7 @@ BlockDriver bdrv_file =3D { }; =20 /***********************************************/ -/* host device */ +/* Host-Ger=C3=A4t */ =20 #if defined(__APPLE__) && defined(__MACH__) static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPa= th, @@ -2000,7 +2015,7 @@ static char *FindEjectableOpticalMedia(io_iterator_= t *mediaIterator) continue; } =20 - /* If a match was found, leave the loop */ + /* Wenn eine =C3=9Cbereinstimmung gefunden wurde, lassen Sie die= Schleife */ if (*mediaIterator !=3D 0) { DPRINTF("Matching using %s\n", matching_array[index]); mediaType =3D g_strdup(matching_array[index]); @@ -2039,14 +2054,14 @@ kern_return_t GetBSDPath(io_iterator_t mediaItera= tor, char *bsdPath, return kernResult; } =20 -/* Sets up a real cdrom for use in QEMU */ +/* Richtet eine echte CD-ROM f=C3=BCr den Einsatz in QEMU */ static bool setup_cdrom(char *bsd_path, Error **errp) { int index, num_of_test_partitions =3D 2, fd; char test_partition[MAXPATHLEN]; bool partition_found =3D false; =20 - /* look for a working partition */ + /* suchen Sie nach einem Arbeitspartition */ for (index =3D 0; index < num_of_test_partitions; index++) { snprintf(test_partition, sizeof(test_partition), "%ss%d", bsd_pa= th, index); @@ -2058,7 +2073,7 @@ static bool setup_cdrom(char *bsd_path, Error **err= p) } } =20 - /* if a working partition on the device was not found */ + /* wenn eine Arbeits Partition auf dem Ger=C3=A4t wurde nicht gefund= en */ if (partition_found =3D=3D false) { error_setg(errp, "Failed to find a working partition on disc"); } else { @@ -2068,7 +2083,7 @@ static bool setup_cdrom(char *bsd_path, Error **err= p) return partition_found; } =20 -/* Prints directions on mounting and unmounting a device */ +/* Drucke Richtungen auf Montage und Aush=C3=A4ngen einer Vorrichtung */ static void print_unmounting_directions(const char *file_name) { error_report("If device %s is mounted on the desktop, unmount" @@ -2078,13 +2093,14 @@ static void print_unmounting_directions(const cha= r *file_name) error_report("Command to mount device: diskutil mountDisk %s", file_= name); } =20 -#endif /* defined(__APPLE__) && defined(__MACH__) */ +#endif /* defined (__ APPLE__) && defined (__ MACH__) */ =20 static int hdev_probe_device(const char *filename) { struct stat st; =20 - /* allow a dedicated CD-ROM driver to match with a higher priority *= / + /* ein spezielles CD-ROM-Treiber erlauben, mit einer h=C3=B6heren Pr= iorit=C3=A4t zu + * entsprechen */ if (strstart(filename, "/dev/cdrom", NULL)) return 50; =20 @@ -2099,13 +2115,13 @@ static int hdev_probe_device(const char *filename= ) static int check_hdev_writable(BDRVRawState *s) { #if defined(BLKROGET) - /* Linux block devices can be configured "read-only" using blockdev(= 8). - * This is independent of device node permissions and therefore open= (2) - * with O_RDWR succeeds. Actual writes fail with EPERM. + /* Linux-Block-Ger=C3=A4te k=C3=B6nnen "read-only" mit blockdev (8) = konfiguriert + * werden. Dies ist unabh=C3=A4ngig von Ger=C3=A4teknoten Berechtigu= ngen und daher + * offen (2) mit O_RDWR gelingt. Tats=C3=A4chliche schreibt nicht mi= t EPERM. * - * bdrv_open() is supposed to fail if the disk is read-only. Explic= itly - * check for read-only block devices so that Linux block devices beh= ave - * properly. + * bdrv_open () soll zum Scheitern verurteilt, wenn der Datentr=C3=A4= ger ist + * schreibgesch=C3=BCtzt. Ausdr=C3=BCcklich Check f=C3=BCr Nur-Lese-= Block-Ger=C3=A4te, so + * dass Linux-Block-Ger=C3=A4te verhalten richtig. */ struct stat st; int readonly =3D 0; @@ -2125,14 +2141,14 @@ static int check_hdev_writable(BDRVRawState *s) if (readonly) { return -EACCES; } -#endif /* defined(BLKROGET) */ +#endif /* definiert (BLKROGET) */ return 0; } =20 static void hdev_parse_filename(const char *filename, QDict *options, Error **errp) { - /* The prefix is optional, just as for "file". */ + /* Das Pr=C3=A4fix ist optional, ebenso wie f=C3=BCr "Datei". */ strstart(filename, "host_device:", &filename); =20 qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename= ))); @@ -2172,7 +2188,7 @@ static int hdev_open(BlockDriverState *bs, QDict *o= ptions, int flags, char bsd_path[MAXPATHLEN] =3D ""; bool error_occurred =3D false; =20 - /* If using a real cdrom */ + /* Wenn eine echte CD-Rom mit */ if (strcmp(filename, "/dev/cdrom") =3D=3D 0) { char *mediaType =3D NULL; kern_return_t ret_val; @@ -2193,14 +2209,15 @@ static int hdev_open(BlockDriverState *bs, QDict = *options, int flags, goto hdev_open_Mac_error; } =20 - /* If a real optical drive was not found */ + /* Wenn eine echte optische Laufwerk wurde nicht gefunden */ if (bsd_path[0] =3D=3D '\0') { error_setg(errp, "Failed to obtain bsd path for optical driv= e"); error_occurred =3D true; goto hdev_open_Mac_error; } =20 - /* If using a cdrom disc and finding a partition on the disc fai= led */ + /* Wenn eine CD-ROM-Disc und eine Partition auf der Platte zu fi= nden, + * fehlgeschlagen */ if (strncmp(mediaType, kIOCDMediaClass, 9) =3D=3D 0 && setup_cdrom(bsd_path, errp) =3D=3D false) { print_unmounting_directions(bsd_path); @@ -2219,7 +2236,7 @@ hdev_open_Mac_error: return -ENOENT; } } -#endif /* defined(__APPLE__) && defined(__MACH__) */ +#endif /* defined (__ APPLE__) && defined (__ MACH__) */ =20 s->type =3D FTYPE_FILE; =20 @@ -2232,15 +2249,16 @@ hdev_open_Mac_error: if (*bsd_path) { filename =3D bsd_path; } - /* if a physical device experienced an error while being opened = */ + /* wenn ein physisches Ger=C3=A4t ein Fehler aufgetreten, w=C3=A4= hrend ge=C3=B6ffnet + * werden */ if (strncmp(filename, "/dev/", 5) =3D=3D 0) { print_unmounting_directions(filename); } -#endif /* defined(__APPLE__) && defined(__MACH__) */ +#endif /* defined (__ APPLE__) && defined (__ MACH__) */ return ret; } =20 - /* Since this does ioctl the device must be already opened */ + /* Da dies das Ger=C3=A4t tut ioctl muss bereits ge=C3=B6ffnet */ bs->sg =3D hdev_is_sg(bs); =20 if (flags & BDRV_O_RDWR) { @@ -2284,7 +2302,8 @@ static int fd_open(BlockDriverState *bs) { BDRVRawState *s =3D bs->opaque; =20 - /* this is just to ensure s->fd is sane (its called by io ops) */ + /* dies ist nur s-, um sicherzustellen,> fd gesund ist + * (sein von io ops genannt) */ if (s->fd >=3D 0) return 0; return -EIO; @@ -2332,10 +2351,10 @@ static int hdev_create(const char *filename, Qemu= Opts *opts, int64_t total_size =3D 0; bool has_prefix; =20 - /* This function is used by both protocol block drivers and therefor= e either - * of these prefixes may be given. - * The return value has to be stored somewhere, otherwise this is an= error - * due to -Werror=3Dunused-value. */ + /* Diese Funktion wird von den beiden Protokollblock Treiber verwend= et und + * daher entweder dieser Pr=C3=A4fixe gegeben werden kann. + * Der R=C3=BCckgabewert muss irgendwo gelagert werden, sonst ist di= es ein + * Fehler aufgrund Werror =3D ungenutzt-Wert. */ has_prefix =3D strstart(filename, "host_device:", &filename) || strstart(filename, "host_cdrom:" , &filename); @@ -2348,7 +2367,7 @@ static int hdev_create(const char *filename, QemuOp= ts *opts, return ret; } =20 - /* Read out options */ + /* Vorlesen Optionen */ total_size =3D ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, = 0), BDRV_SECTOR_SIZE); =20 @@ -2411,7 +2430,7 @@ static BlockDriver bdrv_host_device =3D { .bdrv_detach_aio_context =3D raw_detach_aio_context, .bdrv_attach_aio_context =3D raw_attach_aio_context, =20 - /* generic scsi device */ + /* generische SCSI Ger=C3=A4t */ #ifdef __linux__ .bdrv_aio_ioctl =3D hdev_aio_ioctl, #endif @@ -2421,7 +2440,7 @@ static BlockDriver bdrv_host_device =3D { static void cdrom_parse_filename(const char *filename, QDict *options, Error **errp) { - /* The prefix is optional, just as for "file". */ + /* Das Pr=C3=A4fix ist optional, ebenso wie f=C3=BCr "Datei". */ strstart(filename, "host_cdrom:", &filename); =20 qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename= ))); @@ -2438,7 +2457,8 @@ static int cdrom_open(BlockDriverState *bs, QDict *= options, int flags, =20 s->type =3D FTYPE_CD; =20 - /* open will not fail even if no CD is inserted, so add O_NONBLOCK *= / + /* offen nicht einmal fehl, wenn keine CD eingelegt ist, so f=C3=BCg= en Sie + * O_NONBLOCK */ ret =3D raw_open_common(bs, options, flags, O_NONBLOCK, &local_err); if (local_err) { error_propagate(errp, local_err); @@ -2461,7 +2481,7 @@ static int cdrom_probe_device(const char *filename) goto outc; } =20 - /* Attempt to detect via a CDROM specific ioctl */ + /* Der Versuch, =C3=BCber ein CD-ROM-spezifische ioctl zu erkennen *= / ret =3D ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT); if (ret >=3D 0) prio =3D 100; @@ -2500,10 +2520,10 @@ static void cdrom_lock_medium(BlockDriverState *b= s, bool locked) =20 if (ioctl(s->fd, CDROM_LOCKDOOR, locked) < 0) { /* - * Note: an error can happen if the distribution automatically - * mounts the CD-ROM + * Hinweis: ein Fehler automatisch, wenn die Verteilung passiere= n kann + * richtet die CD-ROM */ - /* perror("CDROM_LOCKDOOR"); */ + /* perror ( "CDROM_LOCKDOOR"); */ } } =20 @@ -2539,12 +2559,12 @@ static BlockDriver bdrv_host_cdrom =3D { .bdrv_detach_aio_context =3D raw_detach_aio_context, .bdrv_attach_aio_context =3D raw_attach_aio_context, =20 - /* removable device support */ + /* herausnehmbaren Ger=C3=A4tetr=C3=A4ger */ .bdrv_is_inserted =3D cdrom_is_inserted, .bdrv_eject =3D cdrom_eject, .bdrv_lock_medium =3D cdrom_lock_medium, =20 - /* generic scsi device */ + /* generische SCSI Ger=C3=A4t */ .bdrv_aio_ioctl =3D hdev_aio_ioctl, }; #endif /* __linux__ */ @@ -2567,7 +2587,7 @@ static int cdrom_open(BlockDriverState *bs, QDict *= options, int flags, return ret; } =20 - /* make sure the door isn't locked at this time */ + /* Sicherstellen, dass die T=C3=BCr zu diesem Zeitpunkt nicht gesper= rt */ ioctl(s->fd, CDIOCALLOW); return 0; } @@ -2586,8 +2606,8 @@ static int cdrom_reopen(BlockDriverState *bs) int fd; =20 /* - * Force reread of possibly changed/newly loaded disc, - * FreeBSD seems to not notice sometimes... + * Force-reread m=C3=B6glicherweise ge=C3=A4ndert / neu eingelegte D= isc, + * FreeBSD scheint manchmal nicht zu bemerken ... */ if (s->fd >=3D 0) qemu_close(s->fd); @@ -2598,7 +2618,7 @@ static int cdrom_reopen(BlockDriverState *bs) } s->fd =3D fd; =20 - /* make sure the door isn't locked at this time */ + /* Sicherstellen, dass die T=C3=BCr zu diesem Zeitpunkt nicht gesper= rt */ ioctl(s->fd, CDIOCALLOW); return 0; } @@ -2636,10 +2656,10 @@ static void cdrom_lock_medium(BlockDriverState *b= s, bool locked) return; if (ioctl(s->fd, (locked ? CDIOCPREVENT : CDIOCALLOW)) < 0) { /* - * Note: an error can happen if the distribution automatically - * mounts the CD-ROM + * Hinweis: ein Fehler automatisch, wenn die Verteilung passiere= n kann + * richtet die CD-ROM */ - /* perror("CDROM_LOCKDOOR"); */ + /* perror ( "CDROM_LOCKDOOR"); */ } } =20 @@ -2675,7 +2695,7 @@ static BlockDriver bdrv_host_cdrom =3D { .bdrv_detach_aio_context =3D raw_detach_aio_context, .bdrv_attach_aio_context =3D raw_attach_aio_context, =20 - /* removable device support */ + /* herausnehmbaren Ger=C3=A4tetr=C3=A4ger */ .bdrv_is_inserted =3D cdrom_is_inserted, .bdrv_eject =3D cdrom_eject, .bdrv_lock_medium =3D cdrom_lock_medium, @@ -2685,8 +2705,8 @@ static BlockDriver bdrv_host_cdrom =3D { static void bdrv_file_init(void) { /* - * Register all the drivers. Note that order is important, the driv= er - * registered last will get probed first. + * Registrieren Sie alle Treiber. Beachten Sie, dass wichtig ist, de= r Fahrer + * registriert wird zuletzt erste sondiert bekommen. */ bdrv_register(&bdrv_file); bdrv_register(&bdrv_host_device); diff --git a/block/raw-win32.c b/block/raw-win32.c index fd23891..5f8eb56 100644 --- a/block/raw-win32.c +++ b/block/raw-win32.c @@ -52,15 +52,15 @@ typedef struct RawWin32AIOData { typedef struct BDRVRawState { HANDLE hfile; int type; - char drive_path[16]; /* format: "d:\" */ + char drive_path[16]; /* Format: "d: \" */ QEMUWin32AIOState *aio; } BDRVRawState; =20 /* - * Read/writes the data to/from a given linear buffer. + * Lese- / schreibt die Daten zu / von einem gegebenen linearen Puffer. * - * Returns the number of bytes handles or -errno in case of an error. Sh= ort - * reads are only returned if the end of the file is reached. + * Gibt die Anzahl von Bytes, Griffe oder -errno im Falle eines Fehlers.= Kurz + * nur zur=C3=BCck liest, wenn das Ende der Datei erreicht ist. */ static size_t handle_aiocb_rw(RawWin32AIOData *aiocb) { @@ -105,8 +105,8 @@ static int aio_worker(void *arg) case QEMU_AIO_READ: count =3D handle_aiocb_rw(aiocb); if (count < aiocb->aio_nbytes) { - /* A short read means that we have reached EOF. Pad the buff= er - * with zeros for bytes after EOF. */ + /* Eine kurze Lese bedeutet, dass wir EOF erreicht haben. F=C3= =BCllt das + * Puffer mit Nullen f=C3=BCr Bytes nach EOF. */ iov_memset(aiocb->aio_iov, aiocb->aio_niov, count, 0, aiocb->aio_nbytes - count); =20 @@ -177,7 +177,7 @@ int qemu_ftruncate64(int fd, int64_t length) =20 h =3D (HANDLE)_get_osfhandle(fd); =20 - /* get current position, ftruncate do not change position */ + /* erhalten aktuelle Position, ftruncate nicht Position =C3=A4ndern = */ li.HighPart =3D 0; li.LowPart =3D SetFilePointer (h, 0, &li.HighPart, FILE_CURRENT); if (li.LowPart =3D=3D INVALID_SET_FILE_POINTER && GetLastError() !=3D= NO_ERROR) { @@ -191,7 +191,7 @@ int qemu_ftruncate64(int fd, int64_t length) } res =3D SetEndOfFile(h); =20 - /* back to old position */ + /* zur=C3=BCck zur alten Position */ SetFilePointer(h, li.LowPart, &li.HighPart, FILE_BEGIN); return res ? 0 : -1; } @@ -240,7 +240,7 @@ static void raw_probe_alignment(BlockDriverState *bs) bs->request_alignment =3D dg.Geometry.BytesPerSector; return; } - /* try GetDiskFreeSpace too */ + /* versuchen GetDiskFreeSpace zu */ } =20 if (s->drive_path[0]) { @@ -274,9 +274,9 @@ static void raw_parse_flags(int flags, int *access_fl= ags, DWORD *overlapped) static void raw_parse_filename(const char *filename, QDict *options, Error **errp) { - /* The filename does not have to be prefixed by the protocol name, s= ince - * "file" is the default protocol; therefore, the return value of th= is - * function call can be ignored. */ + /* Der Dateiname muss nicht durch den Protokollnamen vorangestellt w= erden, + * da "File" ist das Standardprotokoll; daher der R=C3=BCckgabewert = dieser + * Funktionsaufruf kann ignoriert werden. */ strstart(filename, "file:", &filename); =20 qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename= ))); @@ -291,7 +291,7 @@ static QemuOptsList raw_runtime_opts =3D { .type =3D QEMU_OPT_STRING, .help =3D "File name of the image", }, - { /* end of list */ } + { /* Ende der Liste */ } }, }; =20 @@ -325,7 +325,7 @@ static int raw_open(BlockDriverState *bs, QDict *opti= ons, int flags, } else if (filename[0] =3D=3D '\\' && filename[1] =3D=3D '\\') { s->drive_path[0] =3D 0; } else { - /* Relative path. */ + /* Relative Pfad. */ char buf[MAX_PATH]; GetCurrentDirectory(MAX_PATH, buf); snprintf(s->drive_path, sizeof(s->drive_path), "%c:\\", buf[0]); @@ -433,8 +433,8 @@ static int raw_truncate(BlockDriverState *bs, int64_t= offset) high =3D offset >> 32; =20 /* - * An error has occurred if the return value is INVALID_SET_FILE_POI= NTER - * and GetLastError doesn't return NO_ERROR. + * Ein Fehler ist aufgetreten, wenn der R=C3=BCckgabewert + * INVALID SET_FILE_POINTER ist und GetLastError nicht zur=C3=BCck N= O_ERROR. */ dwPtrLow =3D SetFilePointer(s->hfile, low, &high, FILE_BEGIN); if (dwPtrLow =3D=3D INVALID_SET_FILE_POINTER && GetLastError() !=3D = NO_ERROR) { @@ -488,7 +488,8 @@ static int64_t raw_get_allocated_file_size(BlockDrive= rState *bs) get_compressed_t get_compressed; struct _stati64 st; const char *filename =3D bs->filename; - /* WinNT support GetCompressedFileSize to determine allocate size */ + /* WinNT Unterst=C3=BCtzung GetCompressedFileSize zu bestimmen Gr=C3= =B6=C3=9Fe + * zuweisen */ get_compressed =3D (get_compressed_t) GetProcAddress(GetModuleHandle("kernel32"), "GetCompressedFileSizeA"); @@ -513,7 +514,7 @@ static int raw_create(const char *filename, QemuOpts = *opts, Error **errp) =20 strstart(filename, "file:", &filename); =20 - /* Read out options */ + /* Vorlesen Optionen */ total_size =3D ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, = 0), BDRV_SECTOR_SIZE); =20 @@ -539,7 +540,7 @@ static QemuOptsList raw_create_opts =3D { .type =3D QEMU_OPT_SIZE, .help =3D "Virtual disk size" }, - { /* end of list */ } + { /* Ende der Liste */ } } }; =20 @@ -567,7 +568,7 @@ BlockDriver bdrv_file =3D { }; =20 /***********************************************/ -/* host device */ +/* Host-Ger=C3=A4t */ =20 static int find_cdrom(char *cdrom_name, int cdrom_name_size) { @@ -627,7 +628,7 @@ static int hdev_probe_device(const char *filename) static void hdev_parse_filename(const char *filename, QDict *options, Error **errp) { - /* The prefix is optional, just as for "file". */ + /* Das Pr=C3=A4fix ist optional, ebenso wie f=C3=BCr "Datei". */ strstart(filename, "host_device:", &filename); =20 qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename= ))); @@ -664,7 +665,7 @@ static int hdev_open(BlockDriverState *bs, QDict *opt= ions, int flags, } filename =3D device_name; } else { - /* transform drive letters into device name */ + /* Laufwerksbuchstaben in Ger=C3=A4tenamen umwandeln */ if (((filename[0] >=3D 'a' && filename[0] <=3D 'z') || (filename[0] >=3D 'A' && filename[0] <=3D 'Z')) && filename[1] =3D=3D ':' && filename[2] =3D=3D '\0') { diff --git a/block/raw_bsd.c b/block/raw_bsd.c index a6cc7e9..cd23531 100644 --- a/block/raw_bsd.c +++ b/block/raw_bsd.c @@ -40,7 +40,7 @@ static QemuOptsList raw_create_opts =3D { .type =3D QEMU_OPT_SIZE, .help =3D "Virtual disk size" }, - { /* end of list */ } + { /* Ende der Liste */ } } }; =20 @@ -67,14 +67,15 @@ raw_co_writev_flags(BlockDriverState *bs, int64_t sec= tor_num, int nb_sectors, int ret; =20 if (bs->probed && sector_num =3D=3D 0) { - /* As long as these conditions are true, we can't get partial wr= ites to - * the probe buffer and can just directly check the request. */ + /* Solange diese Bedingungen erf=C3=BCllt sind, k=C3=B6nnen wir = bekommen nicht + * teilweise schreibt zu die Sonde Puffer und kann nur direkt di= e + * Anfrage pr=C3=BCfen. */ QEMU_BUILD_BUG_ON(BLOCK_PROBE_BUF_SIZE !=3D 512); QEMU_BUILD_BUG_ON(BDRV_SECTOR_SIZE !=3D 512); =20 if (nb_sectors =3D=3D 0) { - /* qemu_iovec_to_buf() would fail, but we want to return suc= cess - * instead of -EINVAL in this case. */ + /* qemu_iovec_to_buf () fehlschlagen w=C3=BCrde, aber wir wo= llen Erfolg + * zur=C3=BCck statt -EINVAL in diesem Fall. */ return 0; } =20 @@ -96,8 +97,8 @@ raw_co_writev_flags(BlockDriverState *bs, int64_t secto= r_num, int nb_sectors, goto fail; } =20 - /* Use the checked buffer, a malicious guest might be overwritin= g its - * original buffer in the background. */ + /* Verwenden Sie das getestete Puffer, ein b=C3=B6sartiger Gast = k=C3=B6nnte + * =C3=BCberschrieben wird seine Original-Puffer im Hintergrund.= */ qemu_iovec_init(&local_qiov, qiov->niov + 1); qemu_iovec_add(&local_qiov, buf, 512); qemu_iovec_concat(&local_qiov, qiov, 512, qiov->size - 512); @@ -232,8 +233,8 @@ static void raw_close(BlockDriverState *bs) =20 static int raw_probe(const uint8_t *buf, int buf_size, const char *filen= ame) { - /* smallest possible positive score so that raw is used if and only = if no - * other block driver works + /* kleinstm=C3=B6gliche positive Punktzahl, so dass roh verwendet wi= rd, wenn und + * nur wenn kein andere Block-Treiber funktioniert */ return 1; } diff --git a/block/vpc.c b/block/vpc.c index 8830b5b..5d10540 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -162,7 +162,7 @@ static QemuOptsList vpc_runtime_opts =3D { "or use the disk current_size specified in the VHD f= ooter. " "{chs, current_size}" }, - { /* end of list */ } + { /* Ende der Liste */ } } }; =20 @@ -194,7 +194,7 @@ static void vpc_parse_options(BlockDriverState *bs, Q= emuOpts *opts, size_calc =3D qemu_opt_get(opts, VPC_OPT_SIZE_CALC); =20 if (!size_calc) { - /* no override, use autodetect only */ + /* Kein Vorrang, verwenden Sie die automatische Erkennung nur */ } else if (!strcmp(size_calc, "current_size")) { s->force_use_sz =3D true; } else if (!strcmp(size_calc, "chs")) { @@ -252,7 +252,8 @@ static int vpc_open(BlockDriverState *bs, QDict *opti= ons, int flags, goto fail; } =20 - /* If a fixed disk, the footer is found only at the end of the f= ile */ + /* Wenn eine Festplatte, wird die Fu=C3=9Fzeile erst am Ende der= Datei + * gefunden */ ret =3D bdrv_pread(bs->file->bs, offset-HEADER_SIZE, s->footer_b= uf, HEADER_SIZE); if (ret < 0) { @@ -272,7 +273,8 @@ static int vpc_open(BlockDriverState *bs, QDict *opti= ons, int flags, fprintf(stderr, "block-vpc: The header checksum of '%s' is " "incorrect.\n", bs->filename); =20 - /* Write 'checksum' back to footer, or else will leave it with zero.= */ + /* Schreiben 'Pr=C3=BCfsumme' zur=C3=BCck zur Fu=C3=9Fzeile oder son= st verlassen sie mit + * Null. */ footer->checksum =3D cpu_to_be32(checksum); =20 // The visible size of a image in Virtual PC depends on the geometry @@ -281,28 +283,31 @@ static int vpc_open(BlockDriverState *bs, QDict *op= tions, int flags, bs->total_sectors =3D (int64_t) be16_to_cpu(footer->cyls) * footer->heads * footer->secs_per_cyl= ; =20 - /* Microsoft Virtual PC and Microsoft Hyper-V produce and read - * VHD image sizes differently. VPC will rely on CHS geometry, - * while Hyper-V and disk2vhd use the size specified in the footer. + /* Microsoft Virtual PC und Microsoft Hyper-V erzeugen und lesen + * VHD Bildgr=C3=B6=C3=9Fen unterschiedlich. VPC auf CHS-Geometrie v= erlassen, + * w=C3=A4hrend Hyper-V und Disk2vhd die Gr=C3=B6=C3=9Fe in der Fu=C3= =9Fzeile angegeben + * verwenden. * - * We use a couple of approaches to try and determine the correct me= thod: - * look at the Creator App field, and look for images that have CHS - * geometry that is the maximum value. + * Wir verwenden ein paar Ans=C3=A4tze, die richtige Methode, um zu = versuchen + * und zu bestimmen: Blick auf den Sch=C3=B6pfer App Feld, und suche= n Sie nach + * Bildern, die CHS haben Geometrie, die der Maximalwert ist. * - * If the CHS geometry is the maximum CHS geometry, then we assume t= hat - * the size is the footer->current_size to avoid truncation. Otherw= ise, - * we follow the table based on footer->creator_app: + * Wenn die CHS-Geometrie die maximale CHS-Geometrie ist, dann gehen= wir + * davon aus, dass Die Gr=C3=B6=C3=9Fe ist die footer-> aktuelle_gr=C3= =B6=C3=9Fe Abschneiden + * zu vermeiden. Andernfalls, wir folgen der Tabelle basiert auf + * footer-> creator_app: * - * Known creator apps: - * 'vpc ' : CHS Virtual PC (uses disk geometry) - * 'qemu' : CHS QEMU (uses disk geometry) - * 'qem2' : current_size QEMU (uses current_size) - * 'win ' : current_size Hyper-V - * 'd2v ' : current_size Disk2vhd + * Bekannte Sch=C3=B6pfer Apps: + * "VPC": CHS Virtual PC (verwendet Plattengeometrie) + * 'QEMU': CHS QEMU (verwendet Plattengeometrie) + * 'Qem2': aktuelle_gr=C3=B6=C3=9Fe QEMU (verwendet aktuelle_gr= =C3=B6=C3=9Fe) + * "Gewinnen": aktuelle_gr=C3=B6=C3=9Fe Hyper-V + * 'D2v': aktuelle_gr=C3=B6=C3=9Fe Disk2vhd * - * The user can override the table values via drive options, howeve= r - * even with an override we will still use current_size for images - * that have CHS geometry of the maximum size. + * Der Benutzer kann die Tabellenwerte =C3=BCber die Antriebsoption= en au=C3=9Fer + * Kraft setzen, aber selbst bei einer =C3=9Cberschreibung wird imm= er noch wir + * aktuelle_gr=C3=B6=C3=9Fe f=C3=BCr Bilder verwenden dass haben CH= S Geometrie der + * maximalen Gr=C3=B6=C3=9Fe. */ use_chs =3D (!!strncmp(footer->creator_app, "win ", 4) && !!strncmp(footer->creator_app, "qem2", 4) && @@ -313,7 +318,7 @@ static int vpc_open(BlockDriverState *bs, QDict *opti= ons, int flags, BDRV_SECTOR_SIZE; } =20 - /* Allow a maximum disk size of approximately 2 TB */ + /* Lassen Sie eine maximale Festplattengr=C3=B6=C3=9Fe von ca. 2 TB = */ if (bs->total_sectors >=3D VHD_MAX_SECTORS) { ret =3D -EFBIG; goto fail; @@ -416,7 +421,7 @@ static int vpc_open(BlockDriverState *bs, QDict *opti= ons, int flags, =20 qemu_co_mutex_init(&s->lock); =20 - /* Disable migration when VHD images are used */ + /* Deaktivieren Sie die Migration, wenn VHD-Images verwendet werden = */ error_setg(&s->migration_blocker, "The vpc format used by node '%s' = " "does not support live migration", bdrv_get_device_or_node_name(bs)); @@ -439,11 +444,11 @@ static int vpc_reopen_prepare(BDRVReopenState *stat= e, } =20 /* - * Returns the absolute byte offset of the given sector in the image fil= e. - * If the sector is not allocated, -1 is returned instead. + * Gibt den absoluten Byte-Offset des jeweiligen Sektors in der Bilddate= i. + * Wenn der Sektor nicht zugeordnet wird, wird -1 statt zur=C3=BCckgegeb= en. * - * The parameter write must be 1 if the offset will be used for a write - * operation (the block bitmaps is updated then), 0 otherwise. + * Der Parameter Schreib muss 1 sein, wenn die f=C3=BCr einen Schreib ve= rwendet + * ausgeglichen werden Betrieb (die Block-Bitmaps aktualisiert dann), 0 = sonst. */ static inline int64_t get_sector_offset(BlockDriverState *bs, int64_t sector_num, int write) @@ -479,10 +484,10 @@ static inline int64_t get_sector_offset(BlockDriver= State *bs, } =20 /* - * Writes the footer to the end of the image file. This is needed when t= he - * file grows as it overwrites the old footer + * Schreibt die Fu=C3=9Fzeile an das Ende der Bilddatei. Dies ist erford= erlich, + * wenn die Datei w=C3=A4chst, wie es die alte Fu=C3=9Fzeile =C3=BCbersc= hreibt * - * Returns 0 on success and < 0 on error + * Gibt bei Erfolg 0 und <0 auf Fehler */ static int rewrite_footer(BlockDriverState* bs) { @@ -498,11 +503,11 @@ static int rewrite_footer(BlockDriverState* bs) } =20 /* - * Allocates a new block. This involves writing a new footer and updatin= g - * the Block Allocation Table to use the space at the old end of the ima= ge - * file (overwriting the old footer) + * Ordnet einen neuen Block. Dies beinhaltet eine neue Fu=C3=9Fzeile zu = schreiben + * und zu aktualisieren die Block-Allocation Table den Raum am alten End= e des + * Bildes zu verwenden, Datei (=C3=9Cberschreiben der alten Fu=C3=9Fzeil= e) * - * Returns the sectors' offset in the image file on success and < 0 on e= rror + * Gibt den Sektoren "Offset in der Bilddatei auf Erfolg und <0 auf Fehl= er */ static int64_t alloc_block(BlockDriverState* bs, int64_t sector_num) { @@ -687,7 +692,8 @@ static int64_t coroutine_fn vpc_co_get_block_status(B= lockDriverState *bs, *pnum =3D 0; =20 do { - /* All sectors in a block are contiguous (without using the bitm= ap) */ + /* Alle Sektoren in einem Block angrenzen (ohne das Bitmap verwe= ndet + * wird) */ n =3D ROUND_UP(sector_num + 1, s->block_size / BDRV_SECTOR_SIZE) - sector_num; n =3D MIN(n, nb_sectors); @@ -695,8 +701,8 @@ static int64_t coroutine_fn vpc_co_get_block_status(B= lockDriverState *bs, *pnum +=3D n; sector_num +=3D n; nb_sectors -=3D n; - /* *pnum can't be greater than one block for allocated - * sectors since there is always a bitmap in between. */ + /* * Pnum kann nicht gr=C3=B6=C3=9Fer sein als ein Block f=C3=BC= r zugewiesen + * Sektoren, da es immer eine Bitmap dazwischen. */ if (allocated) { *file =3D bs->file->bs; return BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID | start; @@ -711,16 +717,16 @@ static int64_t coroutine_fn vpc_co_get_block_status= (BlockDriverState *bs, } =20 /* - * Calculates the number of cylinders, heads and sectors per cylinder - * based on a given number of sectors. This is the algorithm described - * in the VHD specification. + * Berechnet die Anzahl der Zylinder, K=C3=B6pfe und Sektoren pro Zylind= er + * basierend auf einer vorgegebenen Anzahl von Sektoren. Dies ist der + * beschriebene Algorithmus in der VHD-Spezifikation. * - * Note that the geometry doesn't always exactly match total_sectors but - * may round it down. + * Beachten Sie, dass die Geometrie nicht immer genau total_sectors pass= en, aber + * kann rund es nach unten. * - * Returns 0 on success, -EFBIG if the size is larger than ~2 TB. Overri= de - * the hardware EIDE and ATA-2 limit of 16 heads (max disk size of 127 G= B) - * and instead allow up to 255 heads. + * Gibt 0 zur=C3=BCck, bei Erfolg, -EFBIG, wenn die Gr=C3=B6=C3=9Fe gr=C3= =B6=C3=9Fer als ~ 2 TB. + * au=C3=9Fer Kraft setzen die Hardware-EIDE und ATA-2 Grenze von 16 K=C3= =B6pfe (max + * Plattengr=C3=B6=C3=9Fe von 127 GB) und stattdessen erlauben bis zu 25= 5 K=C3=B6pfe. */ static int calculate_geometry(int64_t total_sectors, uint16_t* cyls, uint8_t* heads, uint8_t* secs_per_cyl) @@ -803,8 +809,9 @@ static int create_dynamic_disk(BlockBackend *blk, uin= t8_t *buf, memcpy(dyndisk_header->magic, "cxsparse", 8); =20 /* - * Note: The spec is actually wrong here for data_offset, it says - * 0xFFFFFFFF, but MS tools expect all 64 bits to be set. + * Hinweis: Die Spezifikation hier eigentlich falsch ist f=C3=BCr da= ta_offset, + * hei=C3=9Ft es 0xFFFFFFFF, aber MS-Tools erwarten, dass alle 64 Bi= t gesetzt + * werden. */ dyndisk_header->data_offset =3D cpu_to_be64(0xFFFFFFFFFFFFFFFFULL); dyndisk_header->table_offset =3D cpu_to_be64(3 * 512); @@ -831,7 +838,7 @@ static int create_fixed_disk(BlockBackend *blk, uint8= _t *buf, { int ret; =20 - /* Add footer to total size */ + /* In Fu=C3=9Fzeile Gesamtgr=C3=B6=C3=9Fe */ total_size +=3D HEADER_SIZE; =20 ret =3D blk_truncate(blk, total_size); @@ -864,7 +871,7 @@ static int vpc_create(const char *filename, QemuOpts = *opts, Error **errp) Error *local_err =3D NULL; BlockBackend *blk =3D NULL; =20 - /* Read out options */ + /* Vorlesen Optionen */ total_size =3D ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, = 0), BDRV_SECTOR_SIZE); disk_type_param =3D qemu_opt_get_del(opts, BLOCK_OPT_SUBFMT); @@ -900,16 +907,19 @@ static int vpc_create(const char *filename, QemuOpt= s *opts, Error **errp) blk_set_allow_write_beyond_eof(blk, true); =20 /* - * Calculate matching total_size and geometry. Increase the number o= f - * sectors requested until we get enough (or fail). This ensures tha= t - * qemu-img convert doesn't truncate images, but rather rounds up. + * Berechnen Sie passende total_size und Geometrie. Erh=C3=B6hen Sie= die Anzahl + * der Sektoren aufgefordert, bis wir genug (oder nicht) zu bekommen= . Dies + * stellt sicher, dass qemu-img convert k=C3=BCrzt nicht Bilder, son= dern + * abrundet. * - * If the image size can't be represented by a spec conformant CHS g= eometry, - * we set the geometry to 65535 x 16 x 255 (CxHxS) sectors and use - * the image size from the VHD footer to calculate total_sectors. + * Wenn die Bildgr=C3=B6=C3=9Fe kann nicht durch eine Spezifikation = konformes + * CHS-Geometrie dargestellt werden, setzen wir die Geometrie zu + * 65535 x 16 x 255 (CxHxS) Sektoren und Nutzung die Bildgr=C3=B6=C3= =9Fe aus der + * VHD Fu=C3=9Fzeile total_sectors berechnen. */ if (force_size) { - /* This will force the use of total_size for sector count, below= */ + /* Dadurch wird die Verwendung von total_size f=C3=BCr Sektorz=C3= =A4hlung + * zwingen, unter */ cyls =3D VHD_CHS_MAX_C; heads =3D VHD_CHS_MAX_H; secs_per_cyl =3D VHD_CHS_MAX_S; @@ -922,7 +932,7 @@ static int vpc_create(const char *filename, QemuOpts = *opts, Error **errp) =20 if ((int64_t)cyls * heads * secs_per_cyl =3D=3D VHD_MAX_GEOMETRY) { total_sectors =3D total_size / BDRV_SECTOR_SIZE; - /* Allow a maximum disk size of approximately 2 TB */ + /* Lassen Sie eine maximale Festplattengr=C3=B6=C3=9Fe von ca. 2= TB */ if (total_sectors > VHD_MAX_SECTORS) { ret =3D -EFBIG; goto out; @@ -932,7 +942,7 @@ static int vpc_create(const char *filename, QemuOpts = *opts, Error **errp) total_size =3D total_sectors * BDRV_SECTOR_SIZE; } =20 - /* Prepare the Hard Disk Footer */ + /* Bereiten Sie die Festplatte Footer */ memset(buf, 0, 1024); =20 memcpy(footer->creator, "conectix", 8); @@ -952,7 +962,7 @@ static int vpc_create(const char *filename, QemuOpts = *opts, Error **errp) } footer->timestamp =3D cpu_to_be32(time(NULL) - VHD_TIMESTAMP_BASE); =20 - /* Version of Virtual PC 2007 */ + /* Version von Virtual PC 2007 */ footer->major =3D cpu_to_be16(0x0005); footer->minor =3D cpu_to_be16(0x0003); footer->orig_size =3D cpu_to_be64(total_size); @@ -1028,7 +1038,7 @@ static QemuOptsList vpc_create_opts =3D { "specified, rather than using the nearest CHS-based = " "calculation" }, - { /* end of list */ } + { /* Ende der Liste */ } } }; =20 diff --git a/block/win32-aio.c b/block/win32-aio.c index 2d509a9..7b31134 100644 --- a/block/win32-aio.c +++ b/block/win32-aio.c @@ -56,7 +56,7 @@ typedef struct QEMUWin32AIOCB { } QEMUWin32AIOCB; =20 /* - * Completes an AIO request (calls the callback and frees the ACB). + * Vervollst=C3=A4ndigt ein AIO Anfrage (die R=C3=BCckrufe und befreit d= en ACB). */ static void win32_aio_process_completion(QEMUWin32AIOState *s, QEMUWin32AIOCB *waiocb, DWORD count) @@ -69,7 +69,7 @@ static void win32_aio_process_completion(QEMUWin32AIOSt= ate *s, } else { ret =3D 0; if (count < waiocb->nbytes) { - /* Short reads mean EOF, pad with zeros. */ + /* Kurz liest mittlere EOF, Pad mit Nullen. */ if (waiocb->is_read) { qemu_iovec_memset(waiocb->qiov, count, 0, waiocb->qiov->size - count); diff --git a/blockdev-nbd.c b/blockdev-nbd.c index 12cae0e..fa13427 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -184,9 +184,10 @@ void qmp_nbd_server_add(const char *device, bool has= _writable, bool writable, =20 nbd_export_set_name(exp, device); =20 - /* The list of named exports has a strong reference to this export n= ow and - * our only way of accessing it is through nbd_export_find(), so we = can drop - * the strong reference that is @exp. */ + /* Die Liste der Namen Exporte hat einen starken Hinweis auf diese E= xport + * jetzt und unsere einzige M=C3=B6glichkeit f=C3=BCr den Zugriff is= t durch + * nbd_export_find (), so k=C3=B6nnen wir fallen die starke Referenz= , die @Exp + * ist. */ nbd_export_put(exp); } =20 diff --git a/qemu-img.c b/qemu-img.c index 06264d9..30d8283 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -59,7 +59,8 @@ typedef enum OutputFormat { OFORMAT_HUMAN, } OutputFormat; =20 -/* Default to cache=3Dwriteback as data integrity is not important for q= emu-img */ +/* Standard-Cache =3D writeback als Datenintegrit=C3=A4t ist nicht wicht= ig f=C3=BCr + * qemu-img */ #define BDRV_DEFAULT_CACHE "writeback" =20 static void format_print(void *opaque, const char *name) @@ -81,7 +82,7 @@ static void QEMU_NORETURN GCC_FMT_ATTR(1, 2) error_exit= (const char *fmt, ...) exit(EXIT_FAILURE); } =20 -/* Please keep in synch with qemu-img.texi */ +/* Bitte halten Sie synchron mit qemu-img.texi */ static void QEMU_NORETURN help(void) { const char *help_msg =3D @@ -199,7 +200,7 @@ static int print_block_option_help(const char *filena= me, const char *fmt) QemuOptsList *create_opts =3D NULL; Error *local_err =3D NULL; =20 - /* Find driver and parse its options */ + /* Finden Sie Treiber und analysieren seine Optionen */ drv =3D bdrv_find_format(fmt); if (!drv) { error_report("Unknown file format '%s'", fmt); @@ -420,7 +421,7 @@ static int img_create(int argc, char **argv) } } =20 - /* Get the filename */ + /* Holen Sie sich den Dateinamen */ filename =3D (optind < argc) ? argv[optind] : NULL; if (options && has_help_option(options)) { g_free(options); @@ -439,7 +440,7 @@ static int img_create(int argc, char **argv) goto fail; } =20 - /* Get image size, if specified */ + /* Erhalten Sie die Bildgr=C3=B6=C3=9Fe, falls angegeben */ if (optind < argc) { int64_t sval; char *end; @@ -577,13 +578,14 @@ static int collect_image_check(BlockDriverState *bs= , } =20 /* - * Checks an image for consistency. Exit codes: + * Pr=C3=BCft ein Bild f=C3=BCr Konsistenz. Exit-Codes: * - * 0 - Check completed, image is good - * 1 - Check not completed because of internal errors - * 2 - Check completed, image is corrupted - * 3 - Check completed, image has leaked clusters, but is good otherwis= e - * 63 - Checks are not supported by the image format + * 0 - Pr=C3=BCfung abgeschlossen, ist das Bild gut + * 1 - =C3=9Cberpr=C3=BCfen Sie aufgrund interner Fehler nicht abgeschl= ossen + * 2 - =C3=9Cberpr=C3=BCfen abgeschlossen, wird das Bild besch=C3=A4dig= t + * 3 - =C3=9Cberpr=C3=BCfen Sie abgeschlossen, Bild durchgesickert Clus= ter hat, ist + * aber gut anders + * 63 - Schecks werden nicht durch das Bildformat unterst=C3=BCtzt */ static int img_check(int argc, char **argv) { @@ -787,8 +789,8 @@ static void run_block_job(BlockJob *job, Error **errp= ) =20 block_job_complete_sync(job, errp); =20 - /* A block job may finish instantaneously without publishing any pro= gress, - * so just signal completion here */ + /* Ein Block Job zu beenden kann sofort ohne irgendwelche Fortschrit= te zu + * ver=C3=B6ffentlichen, so signalisieren nur Fertigstellung hier */ qemu_progress_print(100.f, 0); } =20 @@ -832,7 +834,7 @@ static int img_commit(int argc, char **argv) break; case 'b': base =3D optarg; - /* -b implies -d */ + /* -b impliziert -d */ drop =3D true; break; case 'd': @@ -858,7 +860,7 @@ static int img_commit(int argc, char **argv) } } =20 - /* Progress is not shown in Quiet mode */ + /* Der Fortschritt wird nicht im stillen Modus gezeigt */ if (quiet) { progress =3D false; } @@ -898,9 +900,10 @@ static int img_commit(int argc, char **argv) goto done; } } else { - /* This is different from QMP, which by default uses the deepest= file in - * the backing chain (i.e., the very base); however, the traditi= onal - * behavior of qemu-img commit is using the immediate backing fi= le. */ + /* Dies unterscheidet sich von QMP, die standardm=C3=A4=C3=9Fig = verwendet die + * tiefste Datei in die Tr=C3=A4gerkette (das hei=C3=9Ft, die ei= gentliche + * Basis); jedoch die traditionellen Verhalten von qemu-img bege= hen + * wird die sofortige Unterst=C3=BCtzung Datei. */ base_bs =3D backing_bs(bs); if (!base_bs) { error_setg(&local_err, "Image does not have a backing file")= ; @@ -919,10 +922,10 @@ static int img_commit(int argc, char **argv) goto done; } =20 - /* When the block job completes, the BlockBackend reference will poi= nt to - * the old backing file. In order to avoid that the top image is alr= eady - * deleted, so we can still empty it afterwards, increment the refer= ence - * counter here preemptively. */ + /* Wenn der Block Auftrag abgeschlossen ist, zeigen die BlockBackend + * Bezug auf die alte Tr=C3=A4gerdatei. Um zu vermeiden, dass das ob= ere Bild + * ist schon gel=C3=B6scht, so k=C3=B6nnen wir es noch danach zu lee= ren, erh=C3=B6he + * den Referenz begegnen hier pr=C3=A4ventiv. */ if (!drop) { bdrv_ref(bs); } @@ -961,11 +964,12 @@ done: } =20 /* - * Returns true iff the first sector pointed to by 'buf' contains at lea= st - * a non-NUL byte. + * Gibt true zur=C3=BCck, genau dann, wenn der erste Sektor, auf den 'bu= f' enth=C3=A4lt + * mindestens ein nicht-NUL-Byte. * - * 'pnum' is set to the number of sectors (including and immediately fol= lowing - * the first one) that are known to be in the same allocated/unallocated= state. + * 'Pnum' ist auf die Anzahl der Sektoren gesetzt (einschlie=C3=9Flich u= nd + * unmittelbar im Anschluss an die erste), die in derselben zugeordnet /= nicht + * zugeordneten Zustand bekannt sind. */ static int is_allocated_sectors(const uint8_t *buf, int n, int *pnum) { @@ -988,9 +992,10 @@ static int is_allocated_sectors(const uint8_t *buf, = int n, int *pnum) } =20 /* - * Like is_allocated_sectors, but if the buffer starts with a used secto= r, - * up to 'min' consecutive sectors containing zeros are ignored. This av= oids - * breaking up write requests for only small sparse areas. + * Wie is_allocated_sectors, aber wenn der Puffer mit einem verwendeten = Sektor + * beginnt, bis zu 'min' aufeinanderfolgenden Sektoren Nullen enthalten, + * werden ignoriert. Dies vermeidet Schreibanforderungen nur f=C3=BCr kl= eine + * sp=C3=A4rlich Bereiche Zerschlagung. */ static int is_allocated_sectors_min(const uint8_t *buf, int n, int *pnum= , int min) @@ -1030,11 +1035,12 @@ static int is_allocated_sectors_min(const uint8_t= *buf, int n, int *pnum, } =20 /* - * Compares two buffers sector by sector. Returns 0 if the first sector = of both - * buffers matches, non-zero otherwise. + * Vergleicht zwei Puffer Sektor f=C3=BCr Sektor. 0 zur=C3=BCck, wenn de= r erste Sektor + * von sowohl Puffer Streichh=C3=B6lzer, nicht Null sonst. * - * pnum is set to the number of sectors (including and immediately follo= wing - * the first one) that are known to have the same comparison result + * pnum ist auf die Anzahl der Sektoren gesetzt (einschlie=C3=9Flich und= unmittelbar + * im Anschluss an der erste), die die gleiche Vergleichsergebnis bekann= t + * sind, haben */ static int compare_sectors(const uint8_t *buf1, const uint8_t *buf2, int= n, int *pnum) @@ -1074,17 +1080,18 @@ static int64_t sectors_to_process(int64_t total, = int64_t from) } =20 /* - * Check if passed sectors are empty (not allocated or contain only 0 by= tes) + * =C3=9Cberpr=C3=BCfen Sie, ob vergangen Sektoren leer sind (nicht zuge= ordnet oder + * enthalten nur 0 Bytes) * - * Returns 0 in case sectors are filled with 0, 1 if sectors contain non= -zero - * data and negative value on error. + * Gibt 0 zur=C3=BCck, falls Sektoren mit 0 gef=C3=BCllt, 1, wenn Sektor= en enthalten + * nicht Null Daten und negativen Wert auf Fehler. * - * @param blk: BlockBackend for the image - * @param sect_num: Number of first sector to check - * @param sect_count: Number of sectors to check - * @param filename: Name of disk file we are checking (logging purpose) - * @param buffer: Allocated buffer for storing read data - * @param quiet: Flag for quiet mode + * @param blk: BlockBackend f=C3=BCr das Bild + * @param sect_num: Anzahl der ersten Sektor zu pr=C3=BCfen, + * @param sect_count: Anzahl der Sektoren zu =C3=BCberpr=C3=BCfen + * @param Dateiname: Name der Plattendatei pr=C3=BCfen wir (Anmeldung Zw= eck) + * @param Puffer: Allocated Puffer gelesenen Daten zum Speichern + * @param ruhig: Flag f=C3=BCr den Ruhemodus */ static int check_empty_sectors(BlockBackend *blk, int64_t sect_num, int sect_count, const char *filename, @@ -1108,11 +1115,11 @@ static int check_empty_sectors(BlockBackend *blk,= int64_t sect_num, } =20 /* - * Compares two images. Exit codes: + * Vergleicht zwei Bilder. Exit-Codes: * - * 0 - Images are identical - * 1 - Images differ - * >1 - Error occurred + * 0 - Bilder sind identisch + * 1 - Bilder unterscheiden + * >1 - Fehler aufgetreten */ static int img_compare(int argc, char **argv) { @@ -1123,7 +1130,7 @@ static int img_compare(int argc, char **argv) uint8_t *buf1 =3D NULL, *buf2 =3D NULL; int pnum1, pnum2; int allocated1, allocated2; - int ret =3D 0; /* return value - 0 Ident, 1 Different, >1 Error */ + int ret =3D 0; /* R=C3=BCckgabewert - 0 Ident, 1 Verschiedene,> 1 Fe= hler */ bool progress =3D false, quiet =3D false, strict =3D false; int flags; bool writethrough; @@ -1186,7 +1193,7 @@ static int img_compare(int argc, char **argv) } } =20 - /* Progress is not shown in Quiet mode */ + /* Der Fortschritt wird nicht im stillen Modus gezeigt */ if (quiet) { progress =3D false; } @@ -1206,7 +1213,7 @@ static int img_compare(int argc, char **argv) goto out4; } =20 - /* Initialize before goto out */ + /* Initialisieren, bevor gehe aus */ qemu_progress_init(progress, 2.0); =20 flags =3D 0; @@ -1475,11 +1482,11 @@ static int convert_iteration_sectors(ImgConvertSt= ate *s, int64_t sector_num) } else if (ret & BDRV_BLOCK_DATA) { s->status =3D BLK_DATA; } else if (!s->target_has_backing) { - /* Without a target backing file we must copy over the conte= nts of - * the backing file as well. */ - /* TODO Check block status of the backing file chain to avoi= d - * needlessly reading zeroes and limiting the iteration to t= he - * buffer size */ + /* Ohne eine Zieltr=C3=A4gerdatei m=C3=BCssen wir =C3=BCber = den Inhalt kopieren + * als auch die Tr=C3=A4gerdatei. */ + /* TODO =C3=BCberpr=C3=BCfen Block Status der Tr=C3=A4gerdat= ei Kette zu + * vermeiden unn=C3=B6tig Nullen und die Begrenzung der Iter= ation auf + * das Lesen Puffergr=C3=B6=C3=9Fe */ s->status =3D BLK_DATA; } else { s->status =3D BLK_BACKING_FILE; @@ -1493,9 +1500,9 @@ static int convert_iteration_sectors(ImgConvertStat= e *s, int64_t sector_num) n =3D MIN(n, s->buf_sectors); } =20 - /* We need to write complete clusters for compressed images, so if a= n - * unallocated area is shorter than that, we must consider the whole - * cluster allocated. */ + /* Wir m=C3=BCssen komplette Cluster f=C3=BCr komprimierte Bilder zu= schreiben, so + * dass, wenn ein nicht zugewiesenen Bereich k=C3=BCrzer ist als das= , m=C3=BCssen + * wir die ganze betrachten Cluster zugeordnet. */ if (s->compressed) { if (n < s->cluster_sectors) { n =3D MIN(s->cluster_sectors, s->total_sectors - sector_num)= ; @@ -1519,9 +1526,10 @@ static int convert_read(ImgConvertState *s, int64_= t sector_num, int nb_sectors, BlockBackend *blk; int64_t bs_sectors; =20 - /* In the case of compression with multiple source files, we can= get a - * nb_sectors that spreads into the next part. So we must be abl= e to - * read across multiple BDSes for one convert_read() call. */ + /* Im Falle der Komprimierung mit mehreren Quelldateien, k=C3=B6= nnen wir + * eine bekommen nb_sectors, die in den n=C3=A4chsten Teil ausbr= eitet. + * Deshalb m=C3=BCssen wir in der Lage sein, Lesen Sie =C3=BCber= mehrere BDSes + * f=C3=BCr ein convert_read () Aufruf. */ convert_select_part(s, sector_num); blk =3D s->src[s->src_cur]; bs_sectors =3D s->src_sectors[s->src_cur]; @@ -1550,17 +1558,18 @@ static int convert_write(ImgConvertState *s, int6= 4_t sector_num, int nb_sectors, =20 switch (s->status) { case BLK_BACKING_FILE: - /* If we have a backing file, leave clusters unallocated tha= t are - * unallocated in the source image, so that the backing file= is - * visible at the respective offset. */ + /* Wenn wir eine Tr=C3=A4gerdatei haben, lassen Cluster nich= t + * zugeordneten, das sind in dem Quellenbild nicht zugewiese= nen, + * so dass die Tr=C3=A4gerdatei sichtbar an der jeweiligen O= ffset. */ assert(s->target_has_backing); break; =20 case BLK_DATA: - /* We must always write compressed clusters as a whole, so d= on't - * try to find zeroed parts in the buffer. We can only save = the - * write if the buffer is completely zeroed and we're allowe= d to - * keep the target sparse. */ + /* Wir m=C3=BCssen immer komprimiert Cluster als Ganzes zu s= chreiben, + * also nicht versuchen genullten Teile in den Puffer zu fin= den. + * Wir k=C3=B6nnen nur sparen die schreiben, wenn der Puffer + * vollst=C3=A4ndig auf Null gestellt wird und wir d=C3=BCrf= en halten das + * Ziel sp=C3=A4rlich. */ if (s->compressed) { if (s->has_zero_init && s->min_sparse && buffer_is_zero(buf, n * BDRV_SECTOR_SIZE)) @@ -1576,9 +1585,9 @@ static int convert_write(ImgConvertState *s, int64_= t sector_num, int nb_sectors, break; } =20 - /* If there is real non-zero data or we're told to keep the = target - * fully allocated (-S 0), we must write it. Otherwise we ca= n treat - * it as zero sectors. */ + /* Wenn es echte Daten ungleich Null oder wir gesagt, das Zi= el + * zu halten vollst=C3=A4ndig (-S 0), k=C3=B6nnen wir es sch= reiben m=C3=BCssen. + * Sonst k=C3=B6nnen wir behandeln als Null Sektoren. */ if (!s->min_sparse || is_allocated_sectors_min(buf, n, &n, s->min_sparse)) { @@ -1588,7 +1597,7 @@ static int convert_write(ImgConvertState *s, int64_= t sector_num, int nb_sectors, } break; } - /* fall-through */ + /* durchfallen */ =20 case BLK_ZERO: if (s->has_zero_init) { @@ -1616,7 +1625,8 @@ static int convert_do_copy(ImgConvertState *s) int ret; int n; =20 - /* Check whether we have zero initialisation or can get it efficient= ly */ + /* =C3=9Cberpr=C3=BCfen Sie, ob wir Null Initialisierung haben oder = es kann + * effizient erhalten */ s->has_zero_init =3D s->min_sparse && !s->target_has_backing ? bdrv_has_zero_init(blk_bs(s->target)) : false; @@ -1630,8 +1640,8 @@ static int convert_do_copy(ImgConvertState *s) } } =20 - /* Allocate buffer for copied data. For compressed images, only one = cluster - * can be copied at a time. */ + /* Ordnen Sie Puffer f=C3=BCr kopierten Daten. F=C3=BCr komprimierte= Bilder, nur + * ein Cluster kann zu einem Zeitpunkt kopiert werden. */ if (s->compressed) { if (s->cluster_sectors <=3D 0 || s->cluster_sectors > s->buf_sec= tors) { error_report("invalid cluster size"); @@ -1642,7 +1652,7 @@ static int convert_do_copy(ImgConvertState *s) } buf =3D blk_blockalign(s->target, s->buf_sectors * BDRV_SECTOR_SIZE)= ; =20 - /* Calculate allocated sectors for progress */ + /* Berechnen zugeordnet Sektoren f=C3=BCr den Fortschritt */ s->allocated_sectors =3D 0; sector_num =3D 0; while (sector_num < s->total_sectors) { @@ -1658,7 +1668,7 @@ static int convert_do_copy(ImgConvertState *s) sector_num +=3D n; } =20 - /* Do the copy */ + /* Haben die Kopie */ s->src_cur =3D 0; s->src_cur_offset =3D 0; s->sector_next_status =3D 0; @@ -1703,7 +1713,7 @@ static int convert_do_copy(ImgConvertState *s) } =20 if (s->compressed) { - /* signal EOF to align */ + /* Signal EOF ausrichten */ ret =3D blk_write_compressed(s->target, 0, NULL, 0); if (ret < 0) { goto fail; @@ -1735,7 +1745,8 @@ static int img_convert(int argc, char **argv) const char *out_baseimg_param; char *options =3D NULL; const char *snapshot_name =3D NULL; - int min_sparse =3D 8; /* Need at least 4k of zeros for sparse detect= ion */ + int min_sparse =3D 8; /* mindestens 4k von Nullen f=C3=BCr sp=C3=A4r= liche Erkennung + ben=C3=B6tigen */ bool quiet =3D false; Error *local_err =3D NULL; QemuOpts *sn_opts =3D NULL; @@ -1868,7 +1879,7 @@ static int img_convert(int argc, char **argv) goto fail_getopt; } =20 - /* Initialize before goto out */ + /* Initialisieren, bevor gehe aus */ if (quiet) { progress =3D 0; } @@ -1946,7 +1957,7 @@ static int img_convert(int argc, char **argv) goto out; } =20 - /* Find driver and parse its options */ + /* Finden Sie Treiber und analysieren seine Optionen */ drv =3D bdrv_find_format(out_fmt); if (!drv) { error_report("Unknown file format '%s'", out_fmt); @@ -1997,13 +2008,13 @@ static int img_convert(int argc, char **argv) } } =20 - /* Get backing file name if -o backing_file was used */ + /* Erhalten Sie Dateinamen sichern, wenn -o backing_file verwendet w= urde, */ out_baseimg_param =3D qemu_opt_get(opts, BLOCK_OPT_BACKING_FILE); if (out_baseimg_param) { out_baseimg =3D out_baseimg_param; } =20 - /* Check if compression is supported */ + /* =C3=9Cberpr=C3=BCfen Sie, ob die Komprimierung unterst=C3=BCtzt w= ird */ if (compress) { bool encryption =3D qemu_opt_get_bool(opts, BLOCK_OPT_ENCRYPT, false); @@ -2034,7 +2045,7 @@ static int img_convert(int argc, char **argv) } =20 if (!skip_create) { - /* Create the new image */ + /* Erstellen Sie das neue Bild */ ret =3D bdrv_create(drv, out_filename, opts, &local_err); if (ret < 0) { error_reportf_err(local_err, "%s: error while converting %s:= ", @@ -2050,10 +2061,10 @@ static int img_convert(int argc, char **argv) goto out; } =20 - /* XXX we should allow --image-opts to trigger use of - * img_open() here, but then we have trouble with - * the bdrv_create() call which takes different params. - * Not critical right now, so fix can wait... + /* XXX sollten wir --image-opts erm=C3=B6glichen die Verwendung von = auszul=C3=B6sen + * img_open () hier, aber dann haben wir Probleme mit + * die bdrv_create () Aufruf, die unterschiedliche params nimmt. + * Nicht kritisch gerade jetzt, so reparieren kann warten ... */ out_blk =3D img_open_file(out_filename, out_fmt, flags, writethrough= , quiet); if (!out_blk) { @@ -2062,9 +2073,9 @@ static int img_convert(int argc, char **argv) } out_bs =3D blk_bs(out_blk); =20 - /* increase bufsectors from the default 4096 (2M) if opt_transfer_le= ngth - * or discard_alignment of the out_bs is greater. Limit to 32768 (16= MB) - * as maximum. */ + /* erh=C3=B6hen bufsectors von der Standard-4096 (2M), wenn opt_tran= sfer_length + * oder discard_alignment der out_bs gr=C3=B6=C3=9Fer ist. Beschr=C3= =A4nken auf 32.768 + * (16MB) als Maximum. */ bufsectors =3D MIN(32768, MAX(bufsectors, MAX(out_bs->bl.opt_transfer_length, out_bs->bl.discard_alignment)) @@ -2210,15 +2221,15 @@ static gboolean str_equal_func(gconstpointer a, g= constpointer b) } =20 /** - * Open an image file chain and return an ImageInfoList + * =C3=96ffnen Sie eine Bilddatei Kette und geben eine ImageInfoList * - * @filename: topmost image filename - * @fmt: topmost image format (may be NULL to autodetect) - * @chain: true - enumerate entire backing file chain - * false - only topmost image file + * @filename: oberste Dateiname Bild + * @fmt: oberste Bildformat (kann NULL sein, um die automatische Erkennu= ng) + * @chain: true - aufzuz=C3=A4hlen gesamte Tr=C3=A4gerdatei Kette + * false - nur oberste Bilddatei * - * Returns a list of ImageInfo objects or NULL if there was an error ope= ning an - * image file. If there was an error a message will have been printed t= o + * Gibt eine Liste von Objekten oder Imageinfo NULL, wenn es einen Fehle= r gab + * eine =C3=96ffnung Bilddatei. Wenn ein Fehler eine Meldung war gedruck= t wurden * stderr. */ static ImageInfoList *collect_image_info_list(bool image_opts, @@ -2404,8 +2415,9 @@ static void dump_map_entry(OutputFormat output_form= at, MapEntry *e, e->has_offset ? e->offset : 0, e->has_filename ? e->filename : ""); } - /* This format ignores the distinction between 0, ZERO and ZERO|= DATA. - * Modify the flags here to allow more coalescing. + /* Dieses Format ignoriert die Unterscheidung zwischen 0, ZERO u= nd + * ZERO | DATA. =C3=84ndern Sie die Fahnen hier, um mehr Koalesz= ierstruktur + * erm=C3=B6glichen. */ if (next && (!next->data || next->zero)) { next->data =3D false; @@ -2439,9 +2451,9 @@ static int get_block_status(BlockDriverState *bs, i= nt64_t sector_num, BlockDriverState *file; bool has_offset; =20 - /* As an optimization, we could cache the current range of unallocat= ed - * clusters in each file of the chain, and avoid querying the same - * range repeatedly. + /* Als Optimierung konnten wir den Strombereich von nicht zugeordnet= en + * cachen Cluster in jeder Datei der Kette, und vermeiden Sie die gl= eiche + * Abfrage reichen wiederholt. */ =20 depth =3D 0; @@ -2595,7 +2607,7 @@ static int img_map(int argc, char **argv) =20 sector_num =3D (curr.start + curr.length) >> BDRV_SECTOR_BITS; =20 - /* Probe up to 1 GiB at a time. */ + /* Sonde bis zu 1 GiB zu einem Zeitpunkt. */ nsectors_left =3D DIV_ROUND_UP(length, BDRV_SECTOR_SIZE) - secto= r_num; n =3D MIN(1 << (30 - BDRV_SECTOR_BITS), nsectors_left); ret =3D get_block_status(bs, sector_num, n, &next); @@ -2642,7 +2654,7 @@ static int img_snapshot(int argc, char **argv) bool image_opts =3D false; =20 bdrv_oflags =3D BDRV_O_RDWR; - /* Parse commandline parameters */ + /* Parse Kommandozeilenparameter */ for(;;) { static const struct option long_options[] =3D { {"help", no_argument, 0, 'h'}, @@ -2666,7 +2678,7 @@ static int img_snapshot(int argc, char **argv) return 0; } action =3D SNAPSHOT_LIST; - bdrv_oflags &=3D ~BDRV_O_RDWR; /* no need for RW */ + bdrv_oflags &=3D ~BDRV_O_RDWR; /* keine Notwendigkeit f=C3=BC= r RW */ break; case 'a': if (action) { @@ -2721,14 +2733,14 @@ static int img_snapshot(int argc, char **argv) return 1; } =20 - /* Open the image */ + /* =C3=96ffnen Sie das Bild */ blk =3D img_open(image_opts, filename, NULL, bdrv_oflags, false, qui= et); if (!blk) { return 1; } bs =3D blk_bs(blk); =20 - /* Perform the requested action */ + /* F=C3=BChren Sie die gew=C3=BCnschte Aktion */ switch(action) { case SNAPSHOT_LIST: dump_snapshots(bs); @@ -2767,7 +2779,7 @@ static int img_snapshot(int argc, char **argv) break; } =20 - /* Cleanup */ + /* Aufr=C3=A4umen */ blk_unref(blk); if (ret) { return 1; @@ -2791,7 +2803,7 @@ static int img_rebase(int argc, char **argv) Error *local_err =3D NULL; bool image_opts =3D false; =20 - /* Parse commandline parameters */ + /* Parse Kommandozeilenparameter */ fmt =3D NULL; cache =3D BDRV_DEFAULT_CACHE; src_cache =3D BDRV_DEFAULT_CACHE; @@ -2888,15 +2900,17 @@ static int img_rebase(int argc, char **argv) goto out; } =20 - /* The source files are opened read-only, don't care about WCE */ + /* Die Quelldateien werden ge=C3=B6ffnet schreibgesch=C3=BCtzt, k=C3= =BCmmern sich nicht + * um WCE */ assert((src_flags & BDRV_O_RDWR) =3D=3D 0); (void) src_writethrough; =20 /* - * Open the images. + * =C3=96ffnen Sie die Bilder. * - * Ignore the old backing file for unsafe rebase in case we want to = correct - * the reference to a renamed or moved backing file. + * Ignorieren Sie die alte Tr=C3=A4gerdatei f=C3=BCr unsichere Rebas= e im Fall wollen + * wir korrigieren der Verweis auf eine Tr=C3=A4ger Datei umbenannt = oder + * verschoben. */ blk =3D img_open(image_opts, filename, fmt, flags, writethrough, qui= et); if (!blk) { @@ -2913,7 +2927,8 @@ static int img_rebase(int argc, char **argv) } } =20 - /* For safe rebasing we need to compare old and new backing file */ + /* F=C3=BCr eine sichere Rebasing brauchen wir alte und neue Tr=C3=A4= gerdatei zu + * vergleichen */ if (!unsafe) { char backing_name[PATH_MAX]; QDict *options =3D NULL; @@ -2953,13 +2968,14 @@ static int img_rebase(int argc, char **argv) } =20 /* - * Check each unallocated cluster in the COW file. If it is unalloca= ted, - * accesses go to the backing file. We must therefore compare this c= luster - * in the old and new backing file, and if they differ we need to co= py it - * from the old backing file into the COW file. + * =C3=9Cberpr=C3=BCfen Sie jede nicht zugewiesenen Cluster in der C= OW-Datei. Wenn + * es nicht zugeordneten ist, gehen Zugriffe auf die Tr=C3=A4gerdate= i. Daher + * m=C3=BCssen wir diese Cluster vergleichen in den alten und neuen + * Tr=C3=A4gerdatei, und wenn sie sich unterscheiden m=C3=BCssen wir= es zu kopieren + * von der alten Tr=C3=A4gerdatei in die COW-Datei. * - * If qemu-img crashes during this step, no harm is done. The conten= t of - * the image is the same as the original one at any time. + * Wenn qemu-img Abst=C3=BCrze w=C3=A4hrend dieses Schritts wird kei= n Schaden. Der + * Inhalt von das Bild ist das gleiche wie das Original zu jeder Zei= t. */ if (!unsafe) { int64_t num_sectors; @@ -3006,14 +3022,15 @@ static int img_rebase(int argc, char **argv) =20 for (sector =3D 0; sector < num_sectors; sector +=3D n) { =20 - /* How many sectors can we handle with the next read? */ + /* Wie viele Sektoren k=C3=B6nnen wir mit dem n=C3=A4chsten = Lese umgehen? */ if (sector + (IO_BUF_SIZE / 512) <=3D num_sectors) { n =3D (IO_BUF_SIZE / 512); } else { n =3D num_sectors - sector; } =20 - /* If the cluster is allocated, we don't need to take action= */ + /* Wenn der Cluster zugeordnet ist, brauchen wir keine Ma=C3= =9Fnahmen + * zu ergreifen, */ ret =3D bdrv_is_allocated(bs, sector, n, &n); if (ret < 0) { error_report("error while reading image metadata: %s", @@ -3025,8 +3042,8 @@ static int img_rebase(int argc, char **argv) } =20 /* - * Read old and new backing file and take into consideration= that - * backing files may be smaller than the COW image. + * Lesen Sie alte und neue Tr=C3=A4gerdatei und beachten Sie= , dass + * kann das Sichern von Dateien kleiner als die Kuh Bild. */ if (sector >=3D old_backing_num_sectors) { memset(buf_old, 0, n * BDRV_SECTOR_SIZE); @@ -3056,7 +3073,8 @@ static int img_rebase(int argc, char **argv) } } =20 - /* If they differ, we need to write to the COW file */ + /* Wenn sie sich unterscheiden, m=C3=BCssen wir in die COW-D= atei zu + * schreiben */ uint64_t written =3D 0; =20 while (written < n) { @@ -3081,9 +3099,10 @@ static int img_rebase(int argc, char **argv) } =20 /* - * Change the backing file. All clusters that are different from the= old - * backing file are overwritten in the COW file now, so the visible = content - * doesn't change when we switch the backing file. + * =C3=84ndern Sie die Tr=C3=A4gerdatei. Alle Cluster, die verschied= en von der + * alten sind Tr=C3=A4gerdatei werden nun in der COW-Datei =C3=BCber= schrieben, so + * dass der Inhalt sichtbar =C3=A4ndert sich nicht, wenn wir die + * Unterst=C3=BCtzung Datei wechseln. */ if (out_baseimg && *out_baseimg) { ret =3D bdrv_change_backing_file(bs, out_baseimg, out_basefmt); @@ -3101,14 +3120,15 @@ static int img_rebase(int argc, char **argv) =20 qemu_progress_print(100, 0); /* - * TODO At this point it is possible to check if any clusters that a= re - * allocated in the COW file are the same in the backing file. If so= , they - * could be dropped from the COW file. Don't do this before switchin= g the - * backing file, in case of a crash this would lead to corruption. + * TODO An dieser Stelle ist es m=C3=B6glich, zu =C3=BCberpr=C3=BCfe= n, ob alle Cluster, + * die sind in der COW-Datei zugeordnet sind gleich in der Tr=C3=A4g= erdatei. + * Wenn ja, sie konnte von der Kuh-Datei gel=C3=B6scht werden. Tun S= ie dies + * nicht, bevor die Schalt Datei, in einem Crash-Fall die Sicherung + * dieser w=C3=BCrde zu Korruption f=C3=BChren. */ out: qemu_progress_end(); - /* Cleanup */ + /* Aufr=C3=A4umen */ if (!unsafe) { blk_unref(blk_old_backing); blk_unref(blk_new_backing); @@ -3143,14 +3163,14 @@ static int img_resize(int argc, char **argv) .type =3D QEMU_OPT_SIZE, .help =3D "Virtual disk size" }, { - /* end of list */ + /* Ende der Liste */ } }, }; bool image_opts =3D false; =20 - /* Remove size from argv manually so that negative numbers are not t= reated - * as options by getopt. */ + /* Entfernen der Gr=C3=B6=C3=9Fe von argv manuell so da=C3=9F negati= ve Zahlen nicht + * behandelt werden wie Optionen, die von getopt. */ if (argc < 3) { error_exit("Not enough arguments"); return 1; @@ -3158,7 +3178,7 @@ static int img_resize(int argc, char **argv) =20 size =3D argv[--argc]; =20 - /* Parse getopt arguments */ + /* Parse getopt Argumente */ fmt =3D NULL; for(;;) { static const struct option long_options[] =3D { @@ -3208,7 +3228,7 @@ static int img_resize(int argc, char **argv) return 1; } =20 - /* Choose grow, shrink, or absolute resize mode */ + /* W=C3=A4hlen Sie wachsen, schrumpfen oder absolute Resize-Modus */ switch (size[0]) { case '+': relative =3D 1; @@ -3223,7 +3243,7 @@ static int img_resize(int argc, char **argv) break; } =20 - /* Parse size */ + /* Parse Gr=C3=B6=C3=9Fe */ param =3D qemu_opts_create(&resize_options, NULL, 0, &error_abort); qemu_opt_set(param, BLOCK_OPT_SIZE, size, &err); if (err) { @@ -3377,8 +3397,8 @@ static int img_amend(int argc, char **argv) =20 filename =3D (optind =3D=3D argc - 1) ? argv[argc - 1] : NULL; if (fmt && has_help_option(options)) { - /* If a format is explicitly specified (and possibly no filename= is - * given), print option help here */ + /* Wenn ein Format explizit angegeben wird (und m=C3=B6glicherwe= ise kein + * Dateiname ist hier gegeben), Hilfe Druckoption */ ret =3D print_block_option_help(filename, fmt); goto out; } @@ -3406,7 +3426,7 @@ static int img_amend(int argc, char **argv) fmt =3D bs->drv->format_name; =20 if (has_help_option(options)) { - /* If the format was auto-detected, print option help here */ + /* Wenn das Format wurde automatisch erkannt, Druckoption Hilfe = hier */ ret =3D print_block_option_help(filename, fmt); goto out; } @@ -3429,7 +3449,7 @@ static int img_amend(int argc, char **argv) } } =20 - /* In case the driver does not call amend_status_cb() */ + /* Im Falle, dass der Fahrer nicht nennen amend_status_cb () */ qemu_progress_print(0.f, 0); ret =3D bdrv_amend_options(bs, opts, &amend_status_cb, NULL); qemu_progress_print(100.f, 0); @@ -3496,7 +3516,7 @@ int main(int argc, char **argv) qemu_add_opts(&qemu_object_opts); qemu_add_opts(&qemu_source_opts); =20 - /* find the command */ + /* finden Sie den Befehl */ for (cmd =3D img_cmds; cmd->name !=3D NULL; cmd++) { if (!strcmp(cmdname, cmd->name)) { return cmd->handler(argc - 1, argv + 1); @@ -3513,6 +3533,6 @@ int main(int argc, char **argv) return 0; } =20 - /* not found */ + /* nicht gefunden */ error_exit("Command not found: %s", cmdname); } diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index 382faa8..ec20579 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -13,7 +13,7 @@ #include "qemu-io.h" #include "sysemu/block-backend.h" #include "block/block.h" -#include "block/block_int.h" /* for info_f() */ +#include "block/block_int.h" /* f=C3=BCr info_f () */ #include "block/qapi.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" @@ -102,7 +102,7 @@ static const cmdinfo_t *find_command(const char *cmd) return NULL; } =20 -/* Invoke fn() for commands with a matching prefix */ +/* Rufen Sie fn () f=C3=BCr Befehle mit einem passenden Pr=C3=A4fix */ void qemuio_complete_command(const char *input, void (*fn)(const char *cmd, void *opaque), void *opaque) @@ -143,7 +143,7 @@ static int64_t cvtnum(const char *s) =20 ret =3D qemu_strtosz_suffix(s, &end, QEMU_STRTOSZ_DEFSUFFIX_B); if (*end !=3D '\0') { - /* Detritus at the end of the string */ + /* Detritus am Ende der Zeichenfolge */ return -EINVAL; } return ret; @@ -254,7 +254,7 @@ static void timestr(struct timeval *tv, char *ts, siz= e_t size, int format) (unsigned int) (usec * 100)); return; } - format |=3D VERBOSE_FIXED_TIME; /* fallback if hours needed */ + format |=3D VERBOSE_FIXED_TIME; /* R=C3=BCckfall, wenn Stunden b= en=C3=B6tigt */ } =20 if ((format & VERBOSE_FIXED_TIME) || tv->tv_sec) { @@ -269,10 +269,10 @@ static void timestr(struct timeval *tv, char *ts, s= ize_t size, int format) } =20 /* - * Parse the pattern argument to various sub-commands. + * Analysieren Sie die Muster Argument verschiedenen Unterbefehle. * - * Because the pattern is used as an argument to memset it must evaluate - * to an unsigned integer that fits into a single byte. + * Da das Muster als Argument verwendet wird, um memset auswerten m=C3=BC= ssen + * auf eine ganze Zahl ohne Vorzeichen, die in einem einzigen Byte passt= . */ static int parse_pattern(const char *arg) { @@ -289,10 +289,11 @@ static int parse_pattern(const char *arg) } =20 /* - * Memory allocation helpers. + * Speicherzuordnung Helfer. * - * Make sure memory is aligned by default, or purposefully misaligned if - * that is specified on the command line. + * Stellen Sie sicher, dass Speicher ist standardm=C3=A4=C3=9Fig ausgeri= chtet sind, + * oder absichtlich falsch ausgerichtet, wenn dass auf der Befehlszeile + * angegeben. */ =20 #define MISALIGN_OFFSET 16 @@ -357,7 +358,7 @@ static void print_report(const char *op, struct timev= al *t, int64_t offset, op, total, count, offset); printf("%s, %d ops; %s (%s/sec and %.4f ops/sec)\n", s1, cnt, ts, s2, tdiv((double)cnt, *t)); - } else {/* bytes,ops,time,bytes/sec,ops/sec */ + } else {/* Bytes, ops, Zeit, Bytes / sec, ops / sec */ printf("%"PRId64",%d,%s,%.3f,%.3f\n", total, cnt, ts, tdiv((double)total, *t), @@ -366,8 +367,8 @@ static void print_report(const char *op, struct timev= al *t, int64_t offset, } =20 /* - * Parse multiple length statements for vectored I/O, and construct an I= /O - * vector matching it. + * Parse mehrere L=C3=A4nge Anweisungen f=C3=BCr vektorisiert I / O, und= bauen eine + * I / O Vektor passende es. */ static void * create_iovec(BlockBackend *blk, QEMUIOVector *qiov, char **argv, int nr_= iov, @@ -389,7 +390,7 @@ create_iovec(BlockBackend *blk, QEMUIOVector *qiov, c= har **argv, int nr_iov, goto fail; } =20 - /* should be SIZE_T_MAX, but that doesn't exist */ + /* SIZE_T_MAX sein sollte, aber das ist nicht vorhanden */ if (len > INT_MAX) { printf("Argument '%s' exceeds maximum size %d\n", arg, INT_M= AX); goto fail; @@ -701,7 +702,8 @@ static int read_f(BlockBackend *blk, int argc, char *= *argv) char *buf; int64_t offset; int64_t count; - /* Some compilers get confused and warn if this is not initialized. = */ + /* Einige Compiler verwirrt und warnen, wenn dies nicht initialisier= t + * wird. */ int64_t total =3D 0; int pattern =3D 0; int64_t pattern_offset =3D 0, pattern_count =3D 0; @@ -839,7 +841,7 @@ static int read_f(BlockBackend *blk, int argc, char *= *argv) dump_buffer(buf, offset, count); } =20 - /* Finally, report back -- -C gives a parsable format */ + /* Schlie=C3=9Flich Bericht zur=C3=BCck - bis C gibt ein Parse-Forma= t */ t2 =3D tsub(t2, t1); print_report("read", &t2, offset, count, total, cnt, Cflag); =20 @@ -887,7 +889,8 @@ static int readv_f(BlockBackend *blk, int argc, char = **argv) int c, cnt; char *buf; int64_t offset; - /* Some compilers get confused and warn if this is not initialized. = */ + /* Einige Compiler verwirrt und warnen, wenn dies nicht initialisier= t + * wird. */ int total =3D 0; int nr_iov; QEMUIOVector qiov; @@ -968,7 +971,7 @@ static int readv_f(BlockBackend *blk, int argc, char = **argv) dump_buffer(buf, offset, qiov.size); } =20 - /* Finally, report back -- -C gives a parsable format */ + /* Schlie=C3=9Flich Bericht zur=C3=BCck - bis C gibt ein Parse-Forma= t */ t2 =3D tsub(t2, t1); print_report("read", &t2, offset, qiov.size, total, cnt, Cflag); =20 @@ -1021,7 +1024,8 @@ static int write_f(BlockBackend *blk, int argc, cha= r **argv) char *buf =3D NULL; int64_t offset; int64_t count; - /* Some compilers get confused and warn if this is not initialized. = */ + /* Einige Compiler verwirrt und warnen, wenn dies nicht initialisier= t + * wird. */ int64_t total =3D 0; int pattern =3D 0xcd; =20 @@ -1129,7 +1133,7 @@ static int write_f(BlockBackend *blk, int argc, cha= r **argv) goto out; } =20 - /* Finally, report back -- -C gives a parsable format */ + /* Schlie=C3=9Flich Bericht zur=C3=BCck - bis C gibt ein Parse-Forma= t */ t2 =3D tsub(t2, t1); print_report("wrote", &t2, offset, count, total, cnt, Cflag); =20 @@ -1178,7 +1182,8 @@ static int writev_f(BlockBackend *blk, int argc, ch= ar **argv) int c, cnt; char *buf; int64_t offset; - /* Some compilers get confused and warn if this is not initialized. = */ + /* Einige Compiler verwirrt und warnen, wenn dies nicht initialisier= t + * wird. */ int total =3D 0; int nr_iov; int pattern =3D 0xcd; @@ -1239,7 +1244,7 @@ static int writev_f(BlockBackend *blk, int argc, ch= ar **argv) goto out; } =20 - /* Finally, report back -- -C gives a parsable format */ + /* Schlie=C3=9Flich Bericht zur=C3=BCck - bis C gibt ein Parse-Forma= t */ t2 =3D tsub(t2, t1); print_report("wrote", &t2, offset, qiov.size, total, cnt, Cflag); out: @@ -1287,7 +1292,8 @@ static int multiwrite_f(BlockBackend *blk, int argc= , char **argv) int c, cnt; char **buf; int64_t offset, first_offset =3D 0; - /* Some compilers get confused and warn if this is not initialized. = */ + /* Einige Compiler verwirrt und warnen, wenn dies nicht initialisier= t + * wird. */ int total =3D 0; int nr_iov; int nr_reqs; @@ -1333,7 +1339,7 @@ static int multiwrite_f(BlockBackend *blk, int argc= , char **argv) for (i =3D 0; i < nr_reqs && optind < argc; i++) { int j; =20 - /* Read the offset of the request */ + /* Lesen Sie Offset des Antrags */ offset =3D cvtnum(argv[optind]); if (offset < 0) { print_cvtnum_err(offset, argv[optind]); @@ -1351,7 +1357,7 @@ static int multiwrite_f(BlockBackend *blk, int argc= , char **argv) first_offset =3D offset; } =20 - /* Read lengths for qiov entries */ + /* Lesen Sie L=C3=A4ngen f=C3=BCr qiov Eintr=C3=A4ge */ for (j =3D optind; j < argc; j++) { if (!strcmp(argv[j], ";")) { break; @@ -1360,7 +1366,7 @@ static int multiwrite_f(BlockBackend *blk, int argc= , char **argv) =20 nr_iov =3D j - optind; =20 - /* Build request */ + /* Bauen Sie Anfrage */ buf[i] =3D create_iovec(blk, &qiovs[i], &argv[optind], nr_iov, p= attern); if (buf[i] =3D=3D NULL) { goto out; @@ -1375,7 +1381,7 @@ static int multiwrite_f(BlockBackend *blk, int argc= , char **argv) pattern++; } =20 - /* If there were empty requests at the end, ignore them */ + /* Wenn es am Ende leer Anfragen waren, ignorieren sie */ nr_reqs =3D i; =20 gettimeofday(&t1, NULL); @@ -1391,7 +1397,7 @@ static int multiwrite_f(BlockBackend *blk, int argc= , char **argv) goto out; } =20 - /* Finally, report back -- -C gives a parsable format */ + /* Schlie=C3=9Flich Bericht zur=C3=BCck - bis C gibt ein Parse-Forma= t */ t2 =3D tsub(t2, t1); print_report("wrote", &t2, first_offset, total, total, cnt, Cflag); out: @@ -1441,7 +1447,7 @@ static void aio_write_done(void *opaque, int ret) goto out; } =20 - /* Finally, report back -- -C gives a parsable format */ + /* Schlie=C3=9Flich Bericht zur=C3=BCck - bis C gibt ein Parse-Forma= t */ t2 =3D tsub(t2, ctx->t1); print_report("wrote", &t2, ctx->offset, ctx->qiov.size, ctx->qiov.size, 1, ctx->Cflag); @@ -1485,7 +1491,7 @@ static void aio_read_done(void *opaque, int ret) dump_buffer(ctx->buf, ctx->offset, ctx->qiov.size); } =20 - /* Finally, report back -- -C gives a parsable format */ + /* Schlie=C3=9Flich Bericht zur=C3=BCck - bis C gibt ein Parse-Forma= t */ t2 =3D tsub(t2, ctx->t1); print_report("read", &t2, ctx->offset, ctx->qiov.size, ctx->qiov.size, 1, ctx->Cflag); @@ -1900,7 +1906,7 @@ static int discard_f(BlockBackend *blk, int argc, c= har **argv) goto out; } =20 - /* Finally, report back -- -C gives a parsable format */ + /* Schlie=C3=9Flich Bericht zur=C3=BCck - bis C gibt ein Parse-Forma= t */ if (!qflag) { t2 =3D tsub(t2, t1); print_report("discard", &t2, offset, count, count, 1, Cflag); @@ -2084,8 +2090,8 @@ static QemuOptsList reopen_opts =3D { .merge_lists =3D true, .head =3D QTAILQ_HEAD_INITIALIZER(reopen_opts.head), .desc =3D { - /* no elements =3D> accept any params */ - { /* end of list */ } + /* keine Elemente =3D> akzeptieren keine params */ + { /* Ende der Liste */ } }, }; =20 @@ -2295,9 +2301,9 @@ static int sigraise_f(BlockBackend *blk, int argc, = char **argv) return 0; } =20 - /* Using raise() to kill this process does not necessarily flush all= open - * streams. At least stdout and stderr (although the latter should b= e - * non-buffered anyway) should be flushed, though. */ + /* Mit raise () diesen Prozess zu t=C3=B6ten nicht b=C3=BCndig nicht= unbedingt alle + * offenen B=C3=A4che. Mindestens stdout und stderr (obwohl letztere= sein + * sollte ungepufferten sollte sowieso) gesp=C3=BClt werden, wenn. *= / fflush(stdout); fflush(stderr); =20 @@ -2436,7 +2442,7 @@ bool qemuio_command(BlockBackend *blk, const char *= cmd) =20 static void __attribute((constructor)) init_qemuio_commands(void) { - /* initialize commands */ + /* initialisieren Befehle */ qemuio_add_command(&help_cmd); qemuio_add_command(&read_cmd); qemuio_add_command(&readv_cmd); diff --git a/qemu-io.c b/qemu-io.c index 0a738f1..31aea32 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -30,7 +30,7 @@ static char *progname; =20 static BlockBackend *qemuio_blk; =20 -/* qemu-io commands passed using -c */ +/* qemu-io Befehle bestanden mit -c */ static int ncmdline; static char **cmdline; static bool imageOpts; @@ -129,8 +129,8 @@ static QemuOptsList empty_opts =3D { .merge_lists =3D true, .head =3D QTAILQ_HEAD_INITIALIZER(empty_opts.head), .desc =3D { - /* no elements =3D> accept any params */ - { /* end of list */ } + /* keine Elemente =3D> akzeptieren keine params */ + { /* Ende der Liste */ } }, }; =20 @@ -401,8 +401,8 @@ static QemuOptsList file_opts =3D { .implied_opt_name =3D "file", .head =3D QTAILQ_HEAD_INITIALIZER(file_opts.head), .desc =3D { - /* no elements =3D> accept any params */ - { /* end of list */ } + /* keine Elemente =3D> akzeptieren keine params */ + { /* Ende der Liste */ } }, }; =20 @@ -485,7 +485,7 @@ int main(int argc, char **argv) break; case 'T': if (!trace_init_backends()) { - exit(1); /* error message will have been printed */ + exit(1); /* Fehlermeldung wurden, werden gedruckt */ } break; case 'V': @@ -533,7 +533,7 @@ int main(int argc, char **argv) exit(1); } =20 - /* initialize commands */ + /* initialisieren Befehle */ qemuio_add_command(&quit_cmd); qemuio_add_command(&open_cmd); qemuio_add_command(&close_cmd); @@ -547,7 +547,7 @@ int main(int argc, char **argv) atexit(reenable_tty_echo); } =20 - /* open the device */ + /* =C3=96ffnen Sie das Ger=C3=A4t */ if (!readonly) { flags |=3D BDRV_O_RDWR; } @@ -572,7 +572,8 @@ int main(int argc, char **argv) command_loop(); =20 /* - * Make sure all outstanding requests complete before the program ex= its. + * Stellen Sie sicher, dass alle ausstehenden Anforderungen abgeschl= ossen + * ist, bevor das Programm beendet. */ bdrv_drain_all(); =20 --=20 2.7.4