From nobody Thu Jun 01 18:20:38 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QXDvp73hRz4Ytc0; Thu, 1 Jun 2023 18:20:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QXDvp6VNQz3pZc; Thu, 1 Jun 2023 18:20:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685643638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lVqa+9GI58BKjzDxNdFvM+rcqpPpx85MZd5k68e/gRk=; b=AOxDZ/sseqDJTA3fsNEo9yfBlWO5bWXzn9mggjPpLIEenJr41qXYox6+uDVTJoHISDJHlX Yol9y+b14SH48l8VxO1m7GuphPKSupZMUiN/D1seTfA0/Get0arv/6odZgZDJCQAr9FM7O lPGlWFi9tzT+YCTmz3Cuf815ZkoEcnOh/uJeG5N8rkcxra21OyB9Tdgs53y2Mv/ol20q6H kVXOKKn9hGBjpIP6P1P9MlaFhK2bjjUubpoVbYGQnCQEUpbX4wEci05rqvcwO4DLqJWYZs NhXRh9ztfrOrsdUNmoX46CMkBUt5BChjsNYlIm3TPWOT25ezGRKtAxQxPAcE2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685643638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lVqa+9GI58BKjzDxNdFvM+rcqpPpx85MZd5k68e/gRk=; b=nnKszHRrQZWuW6piPkNf3gaakUJuJgV421S36TSsCjkZgXwqJdltd1ovq8abdLfNOVB2wG Sm7NNZDLXCXUbC9tYDBvv1S/7fA21/hJfXKG3su6c6ce08OLnGdEC11/Hw6SPd1kKUHNie Ea6x9UOcttGzMoSITqpsWYh+iNuOOC5sPDFaEqMEQbJEzB8Ubzj4smZ8RLCknbYRCn5zDV 5yzmGL2fWUWhFTwyMkfwQRs97lHcegouinJ0tjvq/hihSd5JhdY8R54IUOEHWRLl4HHvpY GvQUJGhiBRDWBXf4XCeO0M8/JjXFbqfl9uUOKNvKmnQICUb0ED+aZPsVHRo1+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685643638; a=rsa-sha256; cv=none; b=gE6zzO2qUfX302ixxTxDOEhygBodcb5i5UahAdwDZfeRPGvdz6QWxE9r4u+HEgNVUy9OrX 70jw7UyGXVKmqxpz/+FU9IRr0+B8Nka11GaIVmI2uS1OvaEbFg8J3QQZ3A1DO6zlYzVX6Q aeanqiu687KbqogcL1dpNVTIKBgBV/X2ddFrb/lkgqcysJPo1FaPSUJ/vROChTbPgl58EN 7bn/GRvQRgTFLaC59mgtxDSmqIfd15Uc30Z1O5qs5bONEjoFuc1CDfNV4HzbZAmd8d+N78 956e4HSHKGVYHOX4Z73crmEdfHe8EckGVpVFMmOI7bIyE33aDlAKT+aY3gGXEg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QXDvp5X8lzRy5; Thu, 1 Jun 2023 18:20:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 351IKcwG090288; Thu, 1 Jun 2023 18:20:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 351IKcDm090287; Thu, 1 Jun 2023 18:20:38 GMT (envelope-from git) Date: Thu, 1 Jun 2023 18:20:38 GMT Message-Id: <202306011820.351IKcDm090287@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: be75e578549f - main - libpmc: expand PMC_OP* defines List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be75e578549fcc1da3754a29fc0e7b63672e7b44 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=be75e578549fcc1da3754a29fc0e7b63672e7b44 commit be75e578549fcc1da3754a29fc0e7b63672e7b44 Author: Mitchell Horne AuthorDate: 2023-06-01 18:19:22 +0000 Commit: Mitchell Horne CommitDate: 2023-06-01 18:20:13 +0000 libpmc: expand PMC_OP* defines When performing the syscall, specify the full name of the desired operation. This improves grep-ability. No functional change. Reviewed by: jkoshy MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40334 --- lib/libpmc/libpmc.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index 4a8e02fafbfe..57b9c90de256 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -78,8 +78,7 @@ static int powerpc_allocate_pmc(enum pmc_event _pe, char* ctrspec, struct pmc_op_pmcallocate *_pmc_config); #endif /* __powerpc__ */ -#define PMC_CALL(cmd, params) \ - syscall(pmc_syscall, PMC_OP_##cmd, (params)) +#define PMC_CALL(op, params) syscall(pmc_syscall, (op), (params)) /* * Event aliases provide a way for the user to ask for generic events @@ -1152,7 +1151,7 @@ pmc_allocate(const char *ctrspec, enum pmc_mode mode, } found: - if (PMC_CALL(PMCALLOCATE, &pmc_config) == 0) { + if (PMC_CALL(PMC_OP_PMCALLOCATE, &pmc_config) == 0) { *pmcid = pmc_config.pm_pmcid; retval = 0; } @@ -1171,7 +1170,7 @@ pmc_attach(pmc_id_t pmc, pid_t pid) pmc_attach_args.pm_pmc = pmc; pmc_attach_args.pm_pid = pid; - return (PMC_CALL(PMCATTACH, &pmc_attach_args)); + return (PMC_CALL(PMC_OP_PMCATTACH, &pmc_attach_args)); } int @@ -1197,7 +1196,7 @@ pmc_configure_logfile(int fd) cla.pm_flags = 0; cla.pm_logfd = fd; - if (PMC_CALL(CONFIGURELOG, &cla) < 0) + if (PMC_CALL(PMC_OP_CONFIGURELOG, &cla) < 0) return (-1); return (0); } @@ -1221,7 +1220,7 @@ pmc_detach(pmc_id_t pmc, pid_t pid) pmc_detach_args.pm_pmc = pmc; pmc_detach_args.pm_pid = pid; - return (PMC_CALL(PMCDETACH, &pmc_detach_args)); + return (PMC_CALL(PMC_OP_PMCDETACH, &pmc_detach_args)); } int @@ -1232,7 +1231,7 @@ pmc_disable(int cpu, int pmc) ssa.pm_cpu = cpu; ssa.pm_pmc = pmc; ssa.pm_state = PMC_STATE_DISABLED; - return (PMC_CALL(PMCADMIN, &ssa)); + return (PMC_CALL(PMC_OP_PMCADMIN, &ssa)); } int @@ -1243,7 +1242,7 @@ pmc_enable(int cpu, int pmc) ssa.pm_cpu = cpu; ssa.pm_pmc = pmc; ssa.pm_state = PMC_STATE_FREE; - return (PMC_CALL(PMCADMIN, &ssa)); + return (PMC_CALL(PMC_OP_PMCADMIN, &ssa)); } /* @@ -1355,13 +1354,13 @@ pmc_event_names_of_class(enum pmc_class cl, const char ***eventnames, int pmc_flush_logfile(void) { - return (PMC_CALL(FLUSHLOG,0)); + return (PMC_CALL(PMC_OP_FLUSHLOG, 0)); } int pmc_close_logfile(void) { - return (PMC_CALL(CLOSELOG,0)); + return (PMC_CALL(PMC_OP_CLOSELOG, 0)); } int @@ -1369,7 +1368,7 @@ pmc_get_driver_stats(struct pmc_driverstats *ds) { struct pmc_op_getdriverstats gms; - if (PMC_CALL(GETDRIVERSTATS, &gms) < 0) + if (PMC_CALL(PMC_OP_GETDRIVERSTATS, &gms) < 0) return (-1); /* copy out fields in the current userland<->library interface */ @@ -1390,7 +1389,7 @@ pmc_get_msr(pmc_id_t pmc, uint32_t *msr) struct pmc_op_getmsr gm; gm.pm_pmcid = pmc; - if (PMC_CALL(PMCGETMSR, &gm) < 0) + if (PMC_CALL(PMC_OP_PMCGETMSR, &gm) < 0) return (-1); *msr = gm.pm_msr; return (0); @@ -1420,7 +1419,7 @@ pmc_init(void) /* check the kernel module's ABI against our compiled-in version */ abi_version = PMC_VERSION; - if (PMC_CALL(GETMODULEVERSION, &abi_version) < 0) + if (PMC_CALL(PMC_OP_GETMODULEVERSION, &abi_version) < 0) return (pmc_syscall = -1); /* ignore patch & minor numbers for the comparison */ @@ -1430,7 +1429,7 @@ pmc_init(void) } bzero(&op_cpu_info, sizeof(op_cpu_info)); - if (PMC_CALL(GETCPUINFO, &op_cpu_info) < 0) + if (PMC_CALL(PMC_OP_GETCPUINFO, &op_cpu_info) < 0) return (pmc_syscall = -1); cpu_info.pm_cputype = op_cpu_info.pm_cputype; @@ -1451,7 +1450,7 @@ pmc_init(void) * Get soft events list. */ soft_event_info.pm_class = PMC_CLASS_SOFT; - if (PMC_CALL(GETDYNEVENTINFO, &soft_event_info) < 0) + if (PMC_CALL(PMC_OP_GETDYNEVENTINFO, &soft_event_info) < 0) return (pmc_syscall = -1); /* Map soft events to static list. */ @@ -1833,7 +1832,7 @@ pmc_pmcinfo(int cpu, struct pmc_pmcinfo **ppmci) pmci->pm_cpu = cpu; - if (PMC_CALL(GETPMCINFO, pmci) < 0) { + if (PMC_CALL(PMC_OP_GETPMCINFO, pmci) < 0) { free(pmci); return (-1); } @@ -1852,7 +1851,7 @@ pmc_read(pmc_id_t pmc, pmc_value_t *value) pmc_read_op.pm_flags = PMC_F_OLDVALUE; pmc_read_op.pm_value = -1; - if (PMC_CALL(PMCRW, &pmc_read_op) < 0) + if (PMC_CALL(PMC_OP_PMCRW, &pmc_read_op) < 0) return (-1); *value = pmc_read_op.pm_value; @@ -1865,7 +1864,7 @@ pmc_release(pmc_id_t pmc) struct pmc_op_simple pmc_release_args; pmc_release_args.pm_pmcid = pmc; - return (PMC_CALL(PMCRELEASE, &pmc_release_args)); + return (PMC_CALL(PMC_OP_PMCRELEASE, &pmc_release_args)); } int @@ -1877,7 +1876,7 @@ pmc_rw(pmc_id_t pmc, pmc_value_t newvalue, pmc_value_t *oldvaluep) pmc_rw_op.pm_flags = PMC_F_NEWVALUE | PMC_F_OLDVALUE; pmc_rw_op.pm_value = newvalue; - if (PMC_CALL(PMCRW, &pmc_rw_op) < 0) + if (PMC_CALL(PMC_OP_PMCRW, &pmc_rw_op) < 0) return (-1); *oldvaluep = pmc_rw_op.pm_value; @@ -1892,7 +1891,7 @@ pmc_set(pmc_id_t pmc, pmc_value_t value) sc.pm_pmcid = pmc; sc.pm_count = value; - if (PMC_CALL(PMCSETCOUNT, &sc) < 0) + if (PMC_CALL(PMC_OP_PMCSETCOUNT, &sc) < 0) return (-1); return (0); } @@ -1903,7 +1902,7 @@ pmc_start(pmc_id_t pmc) struct pmc_op_simple pmc_start_args; pmc_start_args.pm_pmcid = pmc; - return (PMC_CALL(PMCSTART, &pmc_start_args)); + return (PMC_CALL(PMC_OP_PMCSTART, &pmc_start_args)); } int @@ -1912,7 +1911,7 @@ pmc_stop(pmc_id_t pmc) struct pmc_op_simple pmc_stop_args; pmc_stop_args.pm_pmcid = pmc; - return (PMC_CALL(PMCSTOP, &pmc_stop_args)); + return (PMC_CALL(PMC_OP_PMCSTOP, &pmc_stop_args)); } int @@ -1939,7 +1938,7 @@ pmc_write(pmc_id_t pmc, pmc_value_t value) pmc_write_op.pm_pmcid = pmc; pmc_write_op.pm_flags = PMC_F_NEWVALUE; pmc_write_op.pm_value = value; - return (PMC_CALL(PMCRW, &pmc_write_op)); + return (PMC_CALL(PMC_OP_PMCRW, &pmc_write_op)); } int @@ -1948,5 +1947,5 @@ pmc_writelog(uint32_t userdata) struct pmc_op_writelog wl; wl.pm_userdata = userdata; - return (PMC_CALL(WRITELOG, &wl)); + return (PMC_CALL(PMC_OP_WRITELOG, &wl)); }