From nobody Sat Sep 6 17:19:46 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=adacore.com ARC-Seal: i=1; a=rsa-sha256; t=1756886337; cv=none; d=zohomail.com; s=zohoarc; b=iuitlws0VuSRX+CP7m5MI5r9f5C02nnPU4e62PQNFpnvQKrmxEvH3M2nuSi3buj7rkjplF1qtduTf4dVc3+OrfvwPl0xyOl0qEtf+Uy/Znbp4o8pveNsdkv0R9F6hX452fG4+F5c7K0DykxLNV+Q8tuYuTU1udBrojxHmXY4NcE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756886337; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5Aa96lioobd3V/jZeaMPcPy1BST5QsMXEtIGLa9bUrQ=; b=YiCcwQi6ZN1RaY+gvILoahmCdyPIhonnYDuwOERqMJYjdqJUmv600+gCVZDowCGYW6eLhGvudqb7GpEAu6oOSyuw7qYr308x8qH0FM0N/CjAE9aww8WDww+vY5FrTZZ2IiZ0Zoyfjgef/ICiEK4aKcB/VJJuih6ou1NVmVFFb04= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756886337612599.4596977263946; Wed, 3 Sep 2025 00:58:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1utiNX-0006oP-8J; Wed, 03 Sep 2025 03:58:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1utiNL-0006he-JC for qemu-devel@nongnu.org; Wed, 03 Sep 2025 03:57:51 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1utiNH-0005Mu-VC for qemu-devel@nongnu.org; Wed, 03 Sep 2025 03:57:50 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-45b7d497ab9so56963755e9.0 for ; Wed, 03 Sep 2025 00:57:43 -0700 (PDT) Received: from chigot-Dell.home ([2a01:cb15:80db:7c00:8880:8b9d:ac82:8ac6]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45b7e7d2393sm227923335e9.3.2025.09.03.00.57.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Sep 2025 00:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1756886262; x=1757491062; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5Aa96lioobd3V/jZeaMPcPy1BST5QsMXEtIGLa9bUrQ=; b=ShgARH4DwwB7L2NMQPXbz7RHcg2+vumOZMcbnkKrSVD+jwPNe55tMWK+KnFonZVRzQ SmAh4lSrJZKVCQru0DSlwcZHj87RRS+EKQ5RdbCQkEWwIUqrYHikD/cS0u+8Mp1tRSQk VbXWzgIMmZu5mCbJO+GWIvDE4bbOr6IBfUByXgVLQTnNrWNf9XRrnKDo0J/84dlGdKdn DRNn9lDB4MYXcA0GuWyymmdjNYEd0JbwHmXaQNDWJvqZ/NQoTZOcPSajIgcuYnpEBI6p Sb/nAx3pdq9qwE37CfQ9b0hRRB7Mfw4tkt68MKnbW7CFM3C2j98S4CbFWgV02SQcDgNC rpNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756886262; x=1757491062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5Aa96lioobd3V/jZeaMPcPy1BST5QsMXEtIGLa9bUrQ=; b=IVLN2exvs3DAhNIt8AOjUI5G2EkhgGbitZ8GwnCto5dhARPjEsl1m+MzBJSxqFQAY9 twhU402EDs8ElWf+BXtx3lX3+pF7m5Fp45RTDy8disnZtrXuKIR9uw47xUV3RPfS6PJ1 LZBLJZuMWihQIzVNpjbGWOmpXMpHzqPUVnay1T0OCcDhXddZZuv+uXK7skFkjW6mPJut Tdqz2RFDVvzFGh36b+PlEg2F/DZyX/tRQWxsk8LdAHjkCNsrh2CyIWqIDXlKOvARKjVE s2kJCrb1iFef4xTEZc/7sRbbCTNETFopg+D4MHXzO5RlSpOqpBM0a1jkXuBSz4stnm5A qiag== X-Gm-Message-State: AOJu0YwVmUU1NENmwraFOxv6s5Tbqa447dF75exN6/uKZwwdP9fU1yVk H/S+JlRmpxunT4EO7ogCZ8o7FcOz4ARRTbwITJBFNj2c0fhtHFTQTUYXKm9YsxUwBCzLgIx7kW4 xzhs= X-Gm-Gg: ASbGncsWdtB5v3zFCGADl2m6uNRlBoBqO6lUUGpwASDLzD8tgLe0DrTKLw30CSD8unR hMQS2lT4sNQcSXnPgXrPOMJYkSv3m+6iu1ClyIxRo6K0Y8gNp3lGuKqxXywoLs9Pv8gt07A2t5A OUVXdM/yCOaU3Lkx/mHaSn1/qwZ6G6IDHoiJ3oUPQERVBl0HaNLeCq50rXV/A0W1veyRRDl7OlD CffteMMb4gXcatWnwwfYNoRoA/mXQr+jjdrO8SvPHgf4bKv9Fbb5LNhRVDGPNwLrHqOPY4d40RD Kzuc+KshR/SueWROWe46W9A5NQJIc3N1Piqun6c6ZhGS3yIm7wDVwi18ZqCkM5ZspgfUQDiYgW9 QOJcG096PdLM9aJUYaFD/N27Za/TCJt24kOB6B1m4eA== X-Google-Smtp-Source: AGHT+IER6ZQF4y1a9JrKdpml7gocWmIaKwcbIdbCV8//1lbdpL5DwhY23XuCyroc/Cs2kk5agIkNew== X-Received: by 2002:a05:600c:8b23:b0:456:1dd2:4e3a with SMTP id 5b1f17b1804b1-45b855506e2mr110848455e9.3.1756886261734; Wed, 03 Sep 2025 00:57:41 -0700 (PDT) From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, hreitz@redhat.com, qemu-block@nongnu.org, =?UTF-8?q?Cl=C3=A9ment=20Chigot?= Subject: [PATCH 1/5] vvfat: introduce no-mbr option Date: Wed, 3 Sep 2025 09:57:17 +0200 Message-Id: <20250903075721.77623-2-chigot@adacore.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250903075721.77623-1-chigot@adacore.com> References: <20250903075721.77623-1-chigot@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=chigot@adacore.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @adacore.com) X-ZM-MESSAGEID: 1756886340432116600 This option when set prevents a master boot record (MBR) to be initialized. This is mandatory as some operating system don't recognized mounted disks if a MBR is present. Signed-off-by: Cl=C3=A9ment Chigot --- block/vvfat.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/block/vvfat.c b/block/vvfat.c index 814796d918..0220dd828b 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -1082,6 +1082,11 @@ static QemuOptsList runtime_opts =3D { .type =3D QEMU_OPT_BOOL, .help =3D "Make the image writable", }, + { + .name =3D "no-mbr", + .type =3D QEMU_OPT_BOOL, + .help =3D "Do not add a Master Boot Record on this disk", + }, { /* end of list */ } }, }; @@ -1092,6 +1097,7 @@ static void vvfat_parse_filename(const char *filename= , QDict *options, int fat_type =3D 0; bool floppy =3D false; bool rw =3D false; + bool no_mbr =3D false; int i; =20 if (!strstart(filename, "fat:", NULL)) { @@ -1116,6 +1122,10 @@ static void vvfat_parse_filename(const char *filenam= e, QDict *options, rw =3D true; } =20 + if (strstr(filename, ":no-mbr:")) { + no_mbr =3D true; + } + /* Get the directory name without options */ i =3D strrchr(filename, ':') - filename; assert(i >=3D 3); @@ -1131,6 +1141,7 @@ static void vvfat_parse_filename(const char *filename= , QDict *options, qdict_put_int(options, "fat-type", fat_type); qdict_put_bool(options, "floppy", floppy); qdict_put_bool(options, "rw", rw); + qdict_put_bool(options, "no-mbr", no_mbr); } =20 static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, @@ -1196,7 +1207,10 @@ static int vvfat_open(BlockDriverState *bs, QDict *o= ptions, int flags, if (!s->fat_type) { s->fat_type =3D 16; } - s->offset_to_bootsector =3D 0x3f; + /* Reserver space for MBR */ + if (!qemu_opt_get_bool(opts, "no-mbr", false)) { + s->offset_to_bootsector =3D 0x3f; + } cyls =3D s->fat_type =3D=3D 12 ? 64 : 1024; heads =3D 16; secs =3D 63; --=20 2.34.1