From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jASUu-0002JL-3h for mharc-grub-devel@gnu.org; Sat, 07 Mar 2020 00:59:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49619) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jASUr-0002JB-Ia for grub-devel@gnu.org; Sat, 07 Mar 2020 00:59:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jASUp-0003Pz-6K for grub-devel@gnu.org; Sat, 07 Mar 2020 00:59:37 -0500 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]:36946) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jASUo-0003MU-VP for grub-devel@gnu.org; Sat, 07 Mar 2020 00:59:35 -0500 Received: by mail-qk1-x742.google.com with SMTP id y126so4520748qke.4 for ; Fri, 06 Mar 2020 21:59:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=6j25hsPNs6nwzpBJZaYZPxYdAVduu51/nnirG3G8vW8=; b=kF2a3z/ZkQmHxBSurp+YhLFDaTy9CYPIQb/KUwh9jBXl7bKrYAfcCpyH1uwH427lfb whTnYBjycmPomCiuA1Ic2hwtRbQXXtL5F4y1341sZRPyg7DD6pEoOk+25nGPwKZG6aFO cwZRl6K1r3IjqAIc3oASzBFuAAoCYaXc2qJauVJj5qQ6GZ4UDqCDGCEq0HhK0cQY7yKd EOgGP5OA91gSQV0nvJnb1/vCYkWeqzKW+gQxhc7WXloXd7Fc4knp6T93E6Ly6cy1uB5m GqvzYv7z0RjjiCaf1GadaF49GCsAeBxwC9jJbWYm1+BNBR81frwAUT0HwBovdAkKg+Ul MiCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=6j25hsPNs6nwzpBJZaYZPxYdAVduu51/nnirG3G8vW8=; b=Bq4Fzz+R0LYR9NX+jNmZRC4gQlZARNyyiZiNJju1KRkm9Ex04826zvRDox5DbfLWAc ibBAkjGzCwKBgf97tQEPldfyrx6BKVjqEYlpf8UYKY7w6SBecwxJLrDJmSBVaYM2LHYH vR+2WX9EyJUcXcYMSBGMtkpV1oRJkeeWtcUeF1JZ3sBe5QSSL63GNU2MY/kwgnu3ihOp TlUaE3SSdt2QYIUmHqO5/jQ0NyEfscNf/+OJxX2Xhm1eBNECdqinl4ZV33Fo7pNia64f s7fitN4dzaAi2C20DGjSpnS2Y6wwC8/fP++TsJQwL8XOY80Obytk0EiETqOOYn9PaWHV FKaQ== X-Gm-Message-State: ANhLgQ2uHDymf+7Culmo/d0mkI6QBG5aYOSuMdDx7GT/AZYz4SxoDOyx LehTSWh0/4zQBkvu03W9rr3iR9gi X-Google-Smtp-Source: ADFU+vvErUNSAzLrC2B7zz3/xyqq3mevZ2FZWu9byGH/ObDir7ZJo+OdQ8oaOl9o8aEu1lZQSMLSuQ== X-Received: by 2002:a37:4351:: with SMTP id q78mr6233605qka.409.1583560773423; Fri, 06 Mar 2020 21:59:33 -0800 (PST) Received: from callisto ([2601:986:200:7341:384b:df90:fb2f:c5df]) by smtp.gmail.com with ESMTPSA id i4sm19040115qkf.111.2020.03.06.21.59.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 21:59:32 -0800 (PST) From: David Michael To: grub-devel@gnu.org Subject: [PATCH v3 1/2] exfat: Save the matching directory entry struct when searching Date: Sat, 07 Mar 2020 00:59:31 -0500 Message-ID: <87wo7wn1rw.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::742 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: Sat, 07 Mar 2020 05:59:38 -0000 This provides the node's attributes outside the iterator function so the file modification time can be accessed and reported. Signed-off-by: David Michael --- Changes since v2: * Updated commit message grub-core/fs/fat.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c index d544e0af1..dc493add2 100644 --- a/grub-core/fs/fat.c +++ b/grub-core/fs/fat.c @@ -596,6 +596,7 @@ struct grub_fat_iterate_context { #ifdef MODE_EXFAT struct grub_fat_dir_node dir; + struct grub_fat_dir_entry entry; #else struct grub_fat_dir_entry dir; #endif @@ -642,27 +643,27 @@ grub_fat_iterate_dir_next (grub_fshelp_node_t node, grub_memset (&ctxt->dir, 0, sizeof (ctxt->dir)); while (1) { - struct grub_fat_dir_entry dir; + struct grub_fat_dir_entry *dir = &ctxt->entry; - ctxt->offset += sizeof (dir); + ctxt->offset += sizeof (*dir); - if (grub_fat_read_data (node->disk, node, 0, 0, ctxt->offset, sizeof (dir), - (char *) &dir) - != sizeof (dir)) + if (grub_fat_read_data (node->disk, node, 0, 0, ctxt->offset, sizeof (*dir), + (char *) dir) + != sizeof (*dir)) break; - if (dir.entry_type == 0) + if (dir->entry_type == 0) break; - if (!(dir.entry_type & 0x80)) + if (!(dir->entry_type & 0x80)) continue; - if (dir.entry_type == 0x85) + if (dir->entry_type == 0x85) { unsigned i, nsec, slots = 0; - nsec = dir.type_specific.file.secondary_count; + nsec = dir->type_specific.file.secondary_count; - ctxt->dir.attr = grub_cpu_to_le16 (dir.type_specific.file.attr); + ctxt->dir.attr = grub_cpu_to_le16 (dir->type_specific.file.attr); ctxt->dir.have_stream = 0; for (i = 0; i < nsec; i++) { @@ -705,7 +706,7 @@ grub_fat_iterate_dir_next (grub_fshelp_node_t node, if (i != nsec) { - ctxt->offset -= sizeof (dir); + ctxt->offset -= sizeof (*dir); continue; } @@ -715,16 +716,16 @@ grub_fat_iterate_dir_next (grub_fshelp_node_t node, return 0; } /* Allocation bitmap. */ - if (dir.entry_type == 0x81) + if (dir->entry_type == 0x81) continue; /* Upcase table. */ - if (dir.entry_type == 0x82) + if (dir->entry_type == 0x82) continue; /* Volume label. */ - if (dir.entry_type == 0x83) + if (dir->entry_type == 0x83) continue; grub_dprintf ("exfat", "unknown primary type 0x%02x\n", - dir.entry_type); + dir->entry_type); } return grub_errno ? : GRUB_ERR_EOF; } -- 2.21.1