From patchwork Fri Mar 6 07:59:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 11423287 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9774492A for ; Fri, 6 Mar 2020 08:00:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 765CE2073D for ; Fri, 6 Mar 2020 08:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725873AbgCFIAB (ORCPT ); Fri, 6 Mar 2020 03:00:01 -0500 Received: from mga17.intel.com ([192.55.52.151]:16832 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725853AbgCFIAA (ORCPT ); Fri, 6 Mar 2020 03:00:00 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2020 00:00:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,521,1574150400"; d="scan'208";a="287909496" Received: from ldmartin1-desk.jf.intel.com ([10.165.21.151]) by FMSMGA003.fm.intel.com with ESMTP; 05 Mar 2020 23:59:59 -0800 From: Lucas De Marchi To: linux-modules@vger.kernel.org Cc: Yanko Kaneti , gladkov.alexey@gmail.com, Lucas De Marchi Subject: [PATCH 1/2] depmod: do not output .bin to stdout Date: Thu, 5 Mar 2020 23:59:33 -0800 Message-Id: <20200306075934.3104-1-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Sender: owner-linux-modules@vger.kernel.org Precedence: bulk List-ID: index_write() relies on fseek/ftell to manage the position to which we are write and thus needs the file stream to support it. Right now when trying to write the index to stdout we fail with: depmod: tools/depmod.c:416: index_write: Assertion `initial_offset >= 0' failed. Aborted (core dumped) We have no interest in outputting our index to stdout, so just skip it like is done with other indexes. While at it, add/remove some newlines to improve readability. Reported-by: Yanko Kaneti Fix: b866b2165ae6 ("Lookup aliases in the modules.builtin.modinfo") --- tools/depmod.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/depmod.c b/tools/depmod.c index fbbce10..875e314 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -2408,8 +2408,10 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) struct index_node *idx; struct kmod_list *l, *builtin = NULL; - idx = index_create(); + if (out == stdout) + return 0; + idx = index_create(); if (idx == NULL) { ret = -ENOMEM; goto fail; @@ -2456,7 +2458,9 @@ static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) if (count) index_write(idx, out); + index_destroy(idx); + fail: if (builtin) kmod_module_unref_list(builtin); From patchwork Fri Mar 6 07:59:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 11423289 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B302A17EF for ; Fri, 6 Mar 2020 08:00:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 93A902084E for ; Fri, 6 Mar 2020 08:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725853AbgCFIAB (ORCPT ); Fri, 6 Mar 2020 03:00:01 -0500 Received: from mga17.intel.com ([192.55.52.151]:16832 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725869AbgCFIAB (ORCPT ); Fri, 6 Mar 2020 03:00:01 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2020 00:00:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,521,1574150400"; d="scan'208";a="287909499" Received: from ldmartin1-desk.jf.intel.com ([10.165.21.151]) by FMSMGA003.fm.intel.com with ESMTP; 06 Mar 2020 00:00:00 -0800 From: Lucas De Marchi To: linux-modules@vger.kernel.org Cc: Yanko Kaneti , gladkov.alexey@gmail.com, Lucas De Marchi Subject: [PATCH 2/2] depmod: just add .bin suffix to builtin.modinfo Date: Thu, 5 Mar 2020 23:59:34 -0800 Message-Id: <20200306075934.3104-2-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306075934.3104-1-lucas.demarchi@intel.com> References: <20200306075934.3104-1-lucas.demarchi@intel.com> MIME-Version: 1.0 Sender: owner-linux-modules@vger.kernel.org Precedence: bulk List-ID: For all the other indexes what we do is to add a .bin to the original filename to denote it's the indexed version of that file. It was kernel's decision to name it modules.builtin.modinfo, so respect that. Fix: b866b2165ae6 ("Lookup aliases in the modules.builtin.modinfo") --- tools/depmod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/depmod.c b/tools/depmod.c index 875e314..fe1c54d 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -2402,7 +2402,7 @@ static int output_devname(struct depmod *depmod, FILE *out) return 0; } -static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) +static int output_builtin_modinfo_bin(struct depmod *depmod, FILE *out) { int ret = 0, count = 0; struct index_node *idx; @@ -2482,7 +2482,7 @@ static int depmod_output(struct depmod *depmod, FILE *out) { "modules.symbols", output_symbols }, { "modules.symbols.bin", output_symbols_bin }, { "modules.builtin.bin", output_builtin_bin }, - { "modules.builtin.alias.bin", output_builtin_alias_bin }, + { "modules.builtin.modinfo.bin", output_builtin_modinfo_bin }, { "modules.devname", output_devname }, { } };