Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/810451/?format=api
{ "id": 810451, "url": "http://patchwork.ozlabs.org/api/patches/810451/?format=api", "web_url": "http://patchwork.ozlabs.org/project/fwts/patch/20170906090828.2156-1-colin.king@canonical.com/", "project": { "id": 24, "url": "http://patchwork.ozlabs.org/api/projects/24/?format=api", "name": "Firmware Test Suite development", "link_name": "fwts", "list_id": "fwts-devel.lists.ubuntu.com", "list_email": "fwts-devel@lists.ubuntu.com", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170906090828.2156-1-colin.king@canonical.com>", "list_archive_url": null, "date": "2017-09-06T09:08:28", "name": "lib: fwts_firmware: make enums into a defined type", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "dc838d20165ef9228d69660e469c41ea558d1518", "submitter": { "id": 2900, "url": "http://patchwork.ozlabs.org/api/people/2900/?format=api", "name": "Colin Ian King", "email": "colin.king@canonical.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/fwts/patch/20170906090828.2156-1-colin.king@canonical.com/mbox/", "series": [ { "id": 1728, "url": "http://patchwork.ozlabs.org/api/series/1728/?format=api", "web_url": "http://patchwork.ozlabs.org/project/fwts/list/?series=1728", "date": "2017-09-06T09:08:28", "name": "lib: fwts_firmware: make enums into a defined type", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1728/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810451/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810451/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<fwts-devel-bounces@lists.ubuntu.com>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com\n\t(client-ip=91.189.94.19; helo=huckleberry.canonical.com;\n\tenvelope-from=fwts-devel-bounces@lists.ubuntu.com;\n\treceiver=<UNKNOWN>)", "Received": [ "from huckleberry.canonical.com (huckleberry.canonical.com\n\t[91.189.94.19])\n\tby ozlabs.org (Postfix) with ESMTP id 3xnHnG1xT2z9sNc;\n\tWed, 6 Sep 2017 19:08:34 +1000 (AEST)", "from localhost ([127.0.0.1] helo=huckleberry.canonical.com)\n\tby huckleberry.canonical.com with esmtp (Exim 4.86_2)\n\t(envelope-from <fwts-devel-bounces@lists.ubuntu.com>)\n\tid 1dpWJz-0004mQ-DB; Wed, 06 Sep 2017 09:08:31 +0000", "from youngberry.canonical.com ([91.189.89.112])\n\tby huckleberry.canonical.com with esmtps\n\t(TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128)\n\t(Exim 4.86_2) (envelope-from <colin.king@canonical.com>)\n\tid 1dpWJx-0004mH-SA\n\tfor fwts-devel@lists.ubuntu.com; Wed, 06 Sep 2017 09:08:29 +0000", "from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost)\n\tby youngberry.canonical.com with esmtpsa\n\t(TLS1.0:RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.76) (envelope-from <colin.king@canonical.com>)\n\tid 1dpWJx-0004ve-Cl; Wed, 06 Sep 2017 09:08:29 +0000" ], "From": "Colin King <colin.king@canonical.com>", "To": "fwts-devel@lists.ubuntu.com", "Subject": "[PATCH] lib: fwts_firmware: make enums into a defined type", "Date": "Wed, 6 Sep 2017 10:08:28 +0100", "Message-Id": "<20170906090828.2156-1-colin.king@canonical.com>", "X-Mailer": "git-send-email 2.14.1", "MIME-Version": "1.0", "X-BeenThere": "fwts-devel@lists.ubuntu.com", "X-Mailman-Version": "2.1.20", "Precedence": "list", "List-Id": "Firmware Test Suite Development <fwts-devel.lists.ubuntu.com>", "List-Unsubscribe": "<https://lists.ubuntu.com/mailman/options/fwts-devel>,\n\t<mailto:fwts-devel-request@lists.ubuntu.com?subject=unsubscribe>", "List-Archive": "<https://lists.ubuntu.com/archives/fwts-devel>", "List-Post": "<mailto:fwts-devel@lists.ubuntu.com>", "List-Help": "<mailto:fwts-devel-request@lists.ubuntu.com?subject=help>", "List-Subscribe": "<https://lists.ubuntu.com/mailman/listinfo/fwts-devel>,\n\t<mailto:fwts-devel-request@lists.ubuntu.com?subject=subscribe>", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "fwts-devel-bounces@lists.ubuntu.com", "Sender": "\"fwts-devel\" <fwts-devel-bounces@lists.ubuntu.com>" }, "content": "From: Colin Ian King <colin.king@canonical.com>\n\nRather than passing around firmware enums as integers, make the enums into\na defined type and use that type.\n\nSigned-off-by: Colin Ian King <colin.king@canonical.com>\n---\n src/lib/include/fwts_firmware.h | 14 +++++++-------\n src/lib/include/fwts_framework.h | 9 ++++++---\n src/lib/src/fwts_firmware.c | 8 ++++----\n src/lib/src/fwts_framework.c | 2 +-\n 4 files changed, 18 insertions(+), 15 deletions(-)", "diff": "diff --git a/src/lib/include/fwts_firmware.h b/src/lib/include/fwts_firmware.h\nindex d6608680..e1c12f09 100644\n--- a/src/lib/include/fwts_firmware.h\n+++ b/src/lib/include/fwts_firmware.h\n@@ -21,28 +21,28 @@\n \n #include <stdbool.h>\n \n-enum firmware_type {\n+typedef enum {\n \tFWTS_FIRMWARE_UNKNOWN = 0,\n \tFWTS_FIRMWARE_BIOS = 1,\n \tFWTS_FIRMWARE_UEFI = 2,\n \tFWTS_FIRMWARE_OPAL = 3,\n \tFWTS_FIRMWARE_OTHER = 100\n-};\n+} fwts_firmware_type;\n \n-enum firmware_feature {\n+typedef enum {\n \tFWTS_FW_FEATURE_ACPI\t\t= 0x1,\n \tFWTS_FW_FEATURE_DEVICETREE\t= 0x2,\n \tFWTS_FW_FEATURE_IPMI\t\t= 0x4,\n \tFWTS_FW_FEATURE_ALL\t\t= FWTS_FW_FEATURE_ACPI |\n \t\t\t\t\t FWTS_FW_FEATURE_DEVICETREE |\n \t\t\t\t\t FWTS_FW_FEATURE_IPMI\n-};\n+} fwts_firmware_feature;\n \n-int fwts_firmware_detect(void);\n+fwts_firmware_type fwts_firmware_detect(void);\n int fwts_firmware_features(void);\n-const char *fwts_firmware_feature_string(const int features);\n+const char *fwts_firmware_feature_string(const fwts_firmware_feature features);\n \n-static inline bool fwts_firmware_has_features(const int features)\n+static inline bool fwts_firmware_has_features(const fwts_firmware_feature features)\n {\n \treturn (fwts_firmware_features() & features) == features;\n }\ndiff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h\nindex bef903c8..3f15312b 100644\n--- a/src/lib/include/fwts_framework.h\n+++ b/src/lib/include/fwts_framework.h\n@@ -32,6 +32,7 @@ typedef struct fwts_framework fwts_framework;\n #include \"fwts_list.h\"\n #include \"fwts_acpica_mode.h\"\n #include \"fwts_types.h\"\n+#include \"fwts_firmware.h\"\n \n #define FWTS_FRAMEWORK_MAGIC\t0x2af61aec\n \n@@ -143,7 +144,7 @@ struct fwts_framework {\n \tfwts_log_level failed_level;\t\t/* Bit mask of failed levels in test run */\n \tfwts_log_level filter_level;\t\t/* --log-level option filter */\n \n-\tint firmware_type;\t\t\t/* Type of firmware */\n+\tfwts_firmware_type firmware_type;\t/* Type of firmware */\n \tbool show_progress;\t\t\t/* Show progress while running current test */\n \n \tfwts_log_type\tlog_type;\t\t/* Output log type, default is plain text ASCII */\n@@ -190,14 +191,16 @@ typedef struct fwts_framework_test {\n \tfwts_framework_ops *ops;\n \tfwts_priority priority;\n \tfwts_framework_flags flags;\n-\tint fw_features;\n+\tfwts_firmware_feature fw_features;\n \tfwts_results results;\t\t\t/* Per test results */\n \tbool\t was_run;\n \n } fwts_framework_test;\n \n int fwts_framework_args(const int argc, char **argv);\n-void fwts_framework_test_add(const char *name, fwts_framework_ops *ops, const fwts_priority priority, const fwts_framework_flags flags, int fw_features);\n+void fwts_framework_test_add(const char *name, fwts_framework_ops *ops,\n+\tconst fwts_priority priority, const fwts_framework_flags flags,\n+\tconst fwts_firmware_feature fw_features);\n int fwts_framework_compare_test_name(void *, void *);\n void fwts_framework_show_version(FILE *fp, const char *name);\n \ndiff --git a/src/lib/src/fwts_firmware.c b/src/lib/src/fwts_firmware.c\nindex 5befa616..611ce8f8 100644\n--- a/src/lib/src/fwts_firmware.c\n+++ b/src/lib/src/fwts_firmware.c\n@@ -23,11 +23,11 @@\n \n #include \"fwts.h\"\n \n-static enum firmware_type firmware_type;\n+static fwts_firmware_type firmware_type;\n static bool firmware_type_valid;\n \n static const struct {\n-\tenum firmware_feature feature;\n+\tfwts_firmware_feature feature;\n \tconst char name[16];\n } feature_names[] = {\n \t{ FWTS_FW_FEATURE_ACPI,\t\t\"ACPI\" },\n@@ -39,7 +39,7 @@ static const struct {\n * fwts_memory_map_entry_compare()\n *\tcallback used to sort memory_map entries on start address\n */\n-int fwts_firmware_detect(void)\n+fwts_firmware_type fwts_firmware_detect(void)\n {\n \tstruct stat statbuf;\n \n@@ -86,7 +86,7 @@ int fwts_firmware_features(void)\n \treturn features;\n }\n \n-const char *fwts_firmware_feature_string(const int features)\n+const char *fwts_firmware_feature_string(const fwts_firmware_feature features)\n {\n \tconst int n = FWTS_ARRAY_LEN(feature_names);\n \tconst char sep[] = \", \";\ndiff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c\nindex 02e1cde6..c0d71521 100644\n--- a/src/lib/src/fwts_framework.c\n+++ b/src/lib/src/fwts_framework.c\n@@ -171,7 +171,7 @@ void fwts_framework_test_add(\n \tfwts_framework_ops *ops,\n \tconst fwts_priority priority,\n \tconst fwts_framework_flags flags,\n-\tint fw_features)\n+\tconst fwts_firmware_feature fw_features)\n {\n \tfwts_framework_test *new_test;\n \n", "prefixes": [] }