From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1k0tza-0002wO-UH for mharc-grub-devel@gnu.org; Wed, 29 Jul 2020 17:52:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0tzY-0002tV-Jb for grub-devel@gnu.org; Wed, 29 Jul 2020 17:52:04 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:38860) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k0tzW-0006LJ-30 for grub-devel@gnu.org; Wed, 29 Jul 2020 17:52:04 -0400 Received: by mail-qt1-x844.google.com with SMTP id e5so4841010qth.5 for ; Wed, 29 Jul 2020 14:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LTf5R8A/pqTLRUqja3Fb1/ZtFercdINsKDM7uMGZQBk=; b=P41wgT34MoZaj+xw/YIZISUCHb3clMI/g1WYtRCjJWTuv5sXFJanZuDql5iUfCfTbv 8amDQ8MzhmPSVNQSJ2JB3JxhmN/Roib9bzptqIbfWYujH4HX0/VSX09AfqXWLEg4YM6L 7HCruGK0dStqDDWKODlwu0qxMHNq3f1sSR8Kj1Mix0z8e7MejKpMPpv9GAmYs86NVuX2 N8QrEKX80opiDruMgeiIJgpH3zJp0OWY1wvffPCDh+34AzDkVb4+7f5Ymxe4GMyAlqP8 M2YsqH6xGtE5SKYMn6eoOE7nj45XTw9/G61tSIqkK7me4eB5jdw/x6F1oxrvJlj3ZRAQ FIRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LTf5R8A/pqTLRUqja3Fb1/ZtFercdINsKDM7uMGZQBk=; b=DKv+M5nZggZx0K/vqX++6nT87utzAsbDLSeuW52MV2TMM7AunbveqzsLHSxLieebBO iSxq4/Ticlk5jQd4PK3+tGrf0PAlie5LdWoeF50BOOYkxgcv3WlfE3xsd8qfnnEo82lq jVh6txJv6G6GGpk/BPTR0mRSP9sTnZT8bMuHWIs6OyG/rS2ijNT46RhNyhhmrGYX7A/5 ZzLfDmgxaGI/z1ona90vFdxkcyDMLPZbR2xcs/146qirJWEifip0POIw9YkkGPVetoqg 1HKI3xfmOR5SQUzo+Q0PXcfVNDjd0o/zEVzXQP2vZR9JAJ2mlJuMSOoZLfQ5M0CLVw2I ucFQ== X-Gm-Message-State: AOAM530cqrvaOGqdzTVWfseb/WJxsNXOtKm2ubUNE1NFS5ugNrk99sbZ RsC73cYRJe2cNP+uoYgLrKNDBfpF6wgmog== X-Google-Smtp-Source: ABdhPJwfsccX/l4w/Pi4K+jnK9E2uO9UH6U/3ru41c2s3oeFpYqHWz3DFkZTf/3v6KZ9zLa+MGf28w== X-Received: by 2002:ac8:1c6c:: with SMTP id j41mr31978qtk.226.1596059520530; Wed, 29 Jul 2020 14:52:00 -0700 (PDT) Received: from localhost.localdomain ([189.216.105.24]) by smtp.gmail.com with ESMTPSA id n127sm2804165qke.29.2020.07.29.14.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2020 14:52:00 -0700 (PDT) From: development@efficientek.com To: grub-devel@gnu.org Cc: Glenn Washburn , Daniel Kiper , Patrick Steinhardt Subject: [PATCH 12/17] fs: Allow number of blocks in block list to be optional, where length will be defaulted to the length of the device. Date: Wed, 29 Jul 2020 16:50:17 -0500 Message-Id: <4be0bcfdda72b642200f35f606740b0bd901710c.1596056714.git.development@efficientek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::844; envelope-from=development@efficientek.com; helo=mail-qt1-x844.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2020 21:52:04 -0000 From: Glenn Washburn This is primarily useful to do something like "loopback newdev (dev)8+" to create a device that skips the first 4K, which may contain a non-standard RAID1 header that grub does not recognize. This would allow that initial data to be accessed and potentially mounted by grub up to the rest of the disk. There is currently not a good way with in grub to programmatically get the number of sectors on a disk to select the appropriate number of sectors. Signed-off-by: Glenn Washburn --- grub-core/kern/fs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c index 14c17df74..273115b5a 100644 --- a/grub-core/kern/fs.c +++ b/grub-core/kern/fs.c @@ -173,7 +173,11 @@ grub_fs_blocklist_open (grub_file_t file, const char *name) } p++; - blocks[i].length = grub_strtoul (p, &p, 0); + if (*p == '\0' || *p == ',') + blocks[i].length = total_native_sectors - blocks[i].offset; + else + blocks[i].length = grub_strtoul (p, &p, 0); + if (grub_errno != GRUB_ERR_NONE || blocks[i].length == 0 || (*p && *p != ',' && ! grub_isspace (*p))) -- 2.25.1