Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1k1TkU-0007KT-Lt for mharc-grub-devel@gnu.org; Fri, 31 Jul 2020 08:02:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1TkT-0007GB-2s for grub-devel@gnu.org; Fri, 31 Jul 2020 08:02:53 -0400 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:37735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k1TkR-0005XQ-8o for grub-devel@gnu.org; Fri, 31 Jul 2020 08:02:52 -0400 Received: by mail-pj1-x1043.google.com with SMTP id lx9so7613029pjb.2 for ; Fri, 31 Jul 2020 05:02:50 -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=t0BrvZJ7gpWV1bOZUnNWVgFnguHKq3cAwkyzsihvJM4=; b=C1afI36Q8vKBsOEa1kv8mVgpVwoJbhKffAcrIQ2P+ADQ+uuLUvAHH2WKoNswqHiVS7 u8GKV5fh/VZ//KhLRJqAjZ26aXLCKDb+JmytOI7nLAwVxKX8Dv6eb5iPB1cVRyRT8TqT RtzzUjPD7W608oFg/wl9V2fhJ/fT8WhjJxzlgTcL3aKcpvfyKiwDp3QH4YhtyZUpzJ13 wgFFFFr/+B61qTSMCflpS4vkYrpn0B4U4zpXQvpUetNJ9GOUwx605+x4/JnKHHmTgnsk TqsoXLM8V/kA3cAfVmRp+N/n+lSRWkYCzYkdPIWIdxsohQnwUzGWN3nKMW5OV3NK0Tau E6+w== 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=t0BrvZJ7gpWV1bOZUnNWVgFnguHKq3cAwkyzsihvJM4=; b=nrra5RGSJjh+jFdRRq5eT3dy9/jVK9k+umCJfmKpviLbdauJcp8Cu48BYuIoXdlnmO dEgpCjTB2S2Qt4cX6+pMqigJQ3rpMdaE/0ih1JspBRV9+6tGamTg7RnIxe25FJtv3R3p EGz96r7ydGOVmGOIZ7m7N+PzXjgo49ZhEQLTwnaNeZoaDBAYxeCsHnLPGKuu192rcJyx Z2edOXJiDRuovd2o5a1fwtZaXM37NjEy3wuDc5cFoYjqDupQmjM7d/+LBdVtGyP1UYip QsVSQQdyLGPiFMNyfKy3X6jaGZ9VTpVQfkCHnBAt9HV1atfs+grrqLdlia5pIrtGadRF DGzg== X-Gm-Message-State: AOAM533lAayDwJkN0FZ7zxDpnXzQRnHqowDmuxqSwVGIVDpW2lA+nCYd XpZmnMHiepTAFUubZOYvCSJYX5aksgg= X-Google-Smtp-Source: ABdhPJyR3XAev4jzC/LTBYAecOuT21H7Zkr8jP5w7r6sqXniUbOHqY4sFKUir/Ymrsy9JOMI6PyAoQ== X-Received: by 2002:aa7:9422:: with SMTP id y2mr3433029pfo.211.1596196968960; Fri, 31 Jul 2020 05:02:48 -0700 (PDT) Received: from localhost.localdomain ([189.216.105.24]) by smtp.gmail.com with ESMTPSA id o4sm9781590pfd.25.2020.07.31.05.02.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2020 05:02:48 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org Cc: Glenn Washburn , Daniel Kiper , Patrick Steinhardt Subject: [CRYPTO-LUKS v1 13/19] fs: Allow number of blocks in block list to be optional, where length will be defaulted to the length of the device. Date: Fri, 31 Jul 2020 07:01:54 -0500 Message-Id: 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::1043; envelope-from=development@efficientek.com; helo=mail-pj1-x1043.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: Fri, 31 Jul 2020 12:02:53 -0000 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