From patchwork Thu May 18 12:49:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 126989 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A3AFB42B3A; Thu, 18 May 2023 14:50:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2D34340E25; Thu, 18 May 2023 14:50:01 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 2ACC64014F for ; Thu, 18 May 2023 14:49:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684414199; x=1715950199; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Mcl+XpfoiSVUb3EycnjgBWF+Ax4IMJLOD0nP5s0d0FI=; b=UH0QP2fg9gH9rV0SDB6Omhl4McpPmafvit8v9LK4jtuSLHCokjjAn1XZ 3fY+4BPLBUH5dNlFvY8tDZtPGu+Q4jS4ucGuWSSbslzs5PsxkzTZSYZOz MDg/90JlYf5EjbiFovXZsdpfSeKU6QiBg019wd6L66FBF5N3fgCUUyuI7 a2Jxz3++J4c5XE+HRnmEQW1JEVp3/9JOTXed6G1jtXE2Pk+lluysflf8K yq5VANkpltR0MslIqjTATz3inCTZiM934jdu3HNk1WZu4F+rE0rflxFLC 1g/FueCb4SpKyJWsmLkaXuFwswp7AGiITyz4uqQLEROUDdsZFfOK6J0qu A==; X-IronPort-AV: E=McAfee;i="6600,9927,10713"; a="380259865" X-IronPort-AV: E=Sophos;i="5.99,285,1677571200"; d="scan'208";a="380259865" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2023 05:49:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10713"; a="705187617" X-IronPort-AV: E=Sophos;i="5.99,285,1677571200"; d="scan'208";a="705187617" Received: from silpixa00401385.ir.intel.com ([10.237.214.44]) by fmsmga007.fm.intel.com with ESMTP; 18 May 2023 05:49:57 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH v5 0/3] Split logging functionality out of EAL Date: Thu, 18 May 2023 13:49:46 +0100 Message-Id: <20230518124949.879834-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20220829151901.376754-1-bruce.richardson@intel.com> References: <20220829151901.376754-1-bruce.richardson@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org There is a general desire to reduce the size and scope of EAL. To this end, this patchset makes a (very) small step in that direction by taking the logging functionality out of EAL and putting it into its own library that can be built and maintained separately. As with the first RFC for this, the main obstacle is the "fnmatch" function which is needed by both EAL and the new log function when building on windows. While the function cannot stay in EAL - or we would have a circular dependency, moving it to a new library or just putting it in the log library have the disadvantages that it then "leaks" into the public namespace without an rte_prefix, which could cause issues. Since only a single function is involved, subsequent versions take a different approach to v1, and just moves the offending function to be a static function in a header file. This allows use by multiple libs without conflicting names or making it public. The other complication, as explained in v1 RFC was that of multiple implementations for different OS's. This is solved here in the same way as v1, by including the OS in the name and having meson pick the correct file for each build. Since only one file is involved, there seemed little need for replicating EAL's separate subdirectories per-OS. v5: * rebased to latest main branch * fixed trailing whitespace issues in new doc section v4: * Fixed windows build error, due to missing strdup (_strdup on windows) * Added doc updates to programmers guide. v3: * Fixed missing log file for BSD * Removed "eal" from the filenames of files in the log directory * added prefixes to elements in the fnmatch header to avoid conflicts * fixed space indentation in new lines in telemetry.c (checkpatch) * removed "extern int logtype" definition in telemetry.c (checkpatch) * added log directory to list for doxygen scanning Bruce Richardson (3): eal/windows: move fnmatch function to header file log: separate logging functions out of EAL telemetry: use standard logging doc/api/doxy-api.conf.in | 1 + .../prog_guide/env_abstraction_layer.rst | 4 +- doc/guides/prog_guide/index.rst | 1 + doc/guides/prog_guide/log_lib.rst | 115 ++++++++++++ lib/eal/common/eal_common_options.c | 2 +- lib/eal/common/eal_private.h | 7 - lib/eal/common/meson.build | 1 - lib/eal/freebsd/eal.c | 6 +- lib/eal/include/meson.build | 1 - lib/eal/linux/eal.c | 8 +- lib/eal/linux/meson.build | 1 - lib/eal/meson.build | 2 +- lib/eal/version.map | 17 -- lib/eal/windows/eal.c | 2 +- lib/eal/windows/fnmatch.c | 172 ----------------- lib/eal/windows/include/fnmatch.h | 175 ++++++++++++++++-- lib/eal/windows/meson.build | 2 - lib/kvargs/meson.build | 3 +- .../common/eal_common_log.c => log/log.c} | 7 +- lib/log/log_freebsd.c | 12 ++ .../common/eal_log.h => log/log_internal.h} | 18 +- lib/{eal/linux/eal_log.c => log/log_linux.c} | 2 +- .../windows/eal_log.c => log/log_windows.c} | 2 +- lib/log/meson.build | 9 + lib/{eal/include => log}/rte_log.h | 0 lib/log/version.map | 34 ++++ lib/meson.build | 1 + lib/telemetry/meson.build | 3 +- lib/telemetry/telemetry.c | 11 +- lib/telemetry/telemetry_internal.h | 3 +- 30 files changed, 370 insertions(+), 252 deletions(-) create mode 100644 doc/guides/prog_guide/log_lib.rst delete mode 100644 lib/eal/windows/fnmatch.c rename lib/{eal/common/eal_common_log.c => log/log.c} (99%) create mode 100644 lib/log/log_freebsd.c rename lib/{eal/common/eal_log.h => log/log_internal.h} (69%) rename lib/{eal/linux/eal_log.c => log/log_linux.c} (97%) rename lib/{eal/windows/eal_log.c => log/log_windows.c} (93%) create mode 100644 lib/log/meson.build rename lib/{eal/include => log}/rte_log.h (100%) create mode 100644 lib/log/version.map --- 2.39.2