summaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
AgeCommit message (Collapse)Author
2021-12-17checkpatch: Do not allow deprecated g_memdup()Philippe Mathieu-Daudé
g_memdup() is insecure and as been deprecated in GLib 2.68. QEMU provides the safely equivalent g_memdup2() wrapper. Do not allow more g_memdup() calls in the repository, provide a hint to use g_memdup2(). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20210903174510.751630-29-philmd@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2021-06-25scripts/checkpatch: roll diff tweaking into checkpatch itselfAlex Bennée
Rather than relying on external tweaks lets just do it inside checkpatch's direct commitish handling which is QEMU specific code anyway. Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Message-Id: <20210623102749.25686-4-alex.bennee@linaro.org>
2021-06-07scripts/checkpatch.pl: process .c.inc and .h.inc files as C sourceMatheus Ferst
Change the regex used to determine whether a file should be processed as C source to include .c.inc and .h.inc extensions. Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br> Reviewed-by: Luis Pires <luis.pires@eldorado.org.br> Message-Id: <20210520195142.941261-1-matheus.ferst@eldorado.org.br> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2021-05-14checkpatch: Fix use of uninitialized valueGreg Kurz
checkfilename() doesn't always set $acpi_testexpected. Fix the following warning: Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529. Fixes: d2f1af0e4120 ("checkpatch: don't emit warning on newly created acpi data files") Cc: isaku.yamahata@intel.com Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <161786467973.295167.5612704777283969903.stgit@bahia.lan> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2021-02-23checkpatch: don't emit warning on newly created acpi data filesIsaku Yamahata
Newly created acpi data files(tests/data/acpi/) cause false positive warning. If file names are acpi expected file, don't emit warning. Fixes: e625ba2a41 ("checkpatch: fix acpi check with multiple file name") Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com> Message-Id: <6899f9ad54cab8e7deca94ff0eeab641680e2b5e.1613615732.git.isaku.yamahata@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2021-02-19scripts/checkpatch: Improve the check for authors mangled by the mailing listThomas Huth
There were recently some patches on the list which had their "From:" line mangled like this: From: qemu_oss--- via <qemu-devel@nongnu.org> Since our test in the checkpatch.pl script did not trigger here, the patches finally also ended up in a pull request, with the wrong author set. So let's improve the regular expression to also complain on these new patterns, too. Message-Id: <20210216071512.1199827-1-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2021-01-18scripts/checkpatch.pl: fix git-show invocation to include diffstatAlex Bennée
Without this checkpatch keeps complaining about new/changed files even when MAINTAINERS has been updated. Normal invocations of checkpatch on patch files rather than commit IDs are unaffected. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210114165730.31607-13-alex.bennee@linaro.org>
2020-10-27scripts: fix error from checkpatch.pl when no commits are foundDaniel P. Berrangé
The error message was supposed to mention the input revision list start point, not the branch flag. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20201019143537.283094-3-berrange@redhat.com> Message-Id: <20201021163136.27324-6-alex.bennee@linaro.org>
2020-09-30checkpatch: Detect '%#' or '%0#' in printf-style format stringsDov Murik
According to the coding style document, we should use literal '0x' prefix instead of printf's '#' flag (which appears as '%#' or '%0#' in the format string). Add a checkpatch rule to enforce that. Note that checkpatch already had a similar rule for trace-events files. Example usage: $ scripts/checkpatch.pl --file chardev/baum.c ... ERROR: Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead #366: FILE: chardev/baum.c:366: + DPRINTF("Broken packet %#2x, tossing\n", req); \ ... ERROR: Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead #472: FILE: chardev/baum.c:472: + DPRINTF("unrecognized request %0#2x\n", req); ... Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com> Message-Id: <20200914172623.72955-1-dovmurik@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-09-30checkpatch: avoid error on cover letter filesStefano Garzarella
Running checkpatch on a directory that contains a cover letter reports this error: Checking /tmp/tmpbnngauy3/0000-cover-letter.patch... ERROR: Does not appear to be a unified-diff format patch total: 1 errors, 0 warnings, 0 lines checked Let's skip cover letter as it is already done in the Linux kernel commits 06330fc40e3f ("checkpatch: avoid NOT_UNIFIED_DIFF errors on cover-letter.patch files") and a08ffbef4ab7 ("checkpatch: fix ignoring cover-letter logic"). Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20200917170212.92672-1-sgarzare@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-29scripts/texi2pod: Delete unused scriptPeter Maydell
We no longer need the texi2pod script, so we can delete it, and the special-casing it had in the checkpatch script. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200925162316.21205-19-peter.maydell@linaro.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-09-17scripts/: fix some comment spelling errorszhaolichang
I found that there are many spelling errors in the comments of qemu, so I used the spellcheck tool to check the spelling errors and finally found some spelling errors in the scripts folder. Signed-off-by: zhaolichang <zhaolichang@huawei.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200917075029.313-5-zhaolichang@huawei.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-07-10checkpatch: Change occurences of 'kernel' to 'qemu' in user messagesAleksandar Markovic
It is odd that we inform user that, for example, his current working directory is not kernel root, when, in face, we mean qemu root. Replace that and few other similar odd user messages. Signed-off-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> Message-Id: <20200620133207.26849-3-aleksandar.qemu.devel@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-06-12checkpatch: reversed logic with acpi test checksMichael S. Tsirkin
Logic reversed: allowed list should just be ignored. Instead we only take that into account :( Fixes: e11b06a880ca ("checkpatch: ignore allowed diff list") Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20200602053614.54745-1-mst@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Eric Auger <eric.auger@redhat.com> Tested-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-05-04checkpatch: ignore allowed diff listMichael S. Tsirkin
Allow changing allowed diff list at any point: - when changing code under test - when adding expected files It's just a list of files so easy to review and merge anyway. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2020-05-04checkpatch: fix acpi check with multiple file nameMichael S. Tsirkin
Using global expected/nonexpected values causes false positives when testing multiple patches in one checkpatch run: one patch can change expected, another one non-expected. Use local variables within process() to fix that. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2020-03-29checkpatch: enforce process for expected filesMichael S. Tsirkin
If the process documented in tests/qtest/bios-tables-test.c is followed, then same patch never touches both expected files and code. Teach checkpatch to enforce this rule. Tested-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2020-02-22softmmu: move vl.c to softmmu/Alexander Bulekov
Move vl.c to a separate directory, similar to linux-user/ Update the chechpatch and get_maintainer scripts, since they relied on /vl.c for top_of_tree checks. Signed-off-by: Alexander Bulekov <alxndr@bu.edu> Reviewed-by: Darren Kenny <darren.kenny@oracle.com> Message-id: 20200220041118.23264-2-alxndr@bu.edu Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-02-18scripts/checkpatch.pl: Detect superfluous semicolon in C codePhilippe Mathieu-Daudé
Display error when a commit contains superfluous semicolon: $ git show 6663a0a3376 | scripts/checkpatch.pl -q - ERROR: superfluous trailing semicolon #276: FILE: block/io_uring.c:186: + ret = -ENOSPC;; total: 1 errors, 1 warnings, 485 lines checked Reported-by: Luc Michel <luc.michel@greensocs.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luc Michel <luc.michel@greensocs.com> Message-Id: <20200218094402.26625-2-philmd@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-02-07scripts/checkpatch.pl: Only allow Python 3 interpreterPhilippe Mathieu-Daudé
Since commit ddf9069963 QEMU requires Python >= 3.5. PEP 0394 [*] states that 'python3' should be available and that 'python' is optional. To avoid problem with unsupported versions, enforce the shebang interpreter to Python 3. [*] https://www.python.org/dev/peps/pep-0394/ Reported-by: John Snow <jsnow@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200130163232.10446-2-philmd@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2019-10-28scripts/checkpatch.pl: don't complain about (foo, /* empty */)Alex Bennée
It's quite common to have a mini comment inside braces to acknowledge we know it's empty. Expand the inline detection to allow closing braces before the end of line. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Aaron Lindsay <aaron@os.amperecomputing.com>
2019-10-23checkpatch: suggest qemu_real_host_page_size instead of getpagesize() or ↵Wei Yang
sysconf(_SC_PAGESIZE) Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> CC: Richard Henderson <richard.henderson@linaro.org> CC: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20191017004633.13229-1-richardw.yang@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-09-05docs: convert README, CODING_STYLE and HACKING to RST syntaxDaniel P. Berrangé
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-07-15checkpatch: detect doubly-encoded UTF-8Paolo Bonzini
Copy and pasting from Thunderbird's "view source" window results in double encoding of multibyte UTF-8 sequences. The appearance of those sequences is very peculiar, so detect it and give an error despite the (low) possibility of false positives. As the major offender, I am also adding the same check to my applypatch-msg and commit-msg hooks, but this will also cause patchew to croak loudly when this mistake happens. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1558099140-53240-1-git-send-email-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-07-05checkpatch: do not warn for multiline parenthesized returned valuePaolo Bonzini
While indeed we do not want to have return (a); it is less clear that this applies to return (a && b); Some editors indent more nicely if you have parentheses, and some people's eyes may appreciate that as well. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <1561116534-21814-1-git-send-email-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-06-03checkpatch: allow SPDX-License-IdentifierPeter Xu
According to: https://spdx.org/ids-how, let's still allow QEMU to use the SPDX license identifier: // SPDX-License-Identifier: *** CC: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20190426062705.4651-1-peterx@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-01-29checkpatch: Don't emit spurious warnings about block commentsPeter Maydell
In checkpatch we attempt to check for and warn about block comments which start with /* or /** followed by a non-blank. Unfortunately a bug in the regex meant that we would incorrectly warn about comments starting with "/**" with no following text: git show 9813dc6ac3954d58ba16b3920556f106f97e1c67|./scripts/checkpatch.pl - WARNING: Block comments use a leading /* on a separate line #34: FILE: tests/libqtest.h:233: +/** The sequence "/\*\*?" was intended to match either "/*" or "/**", but Perl's semantics for '?' allow it to backtrack and try the "matches 0 chars" option if the "matches 1 char" choice leads to a failure of the rest of the regex to match. Switch to "/\*\*?+" which uses what perlre(1) calls the "possessive" quantifier form: this means that if it matches the "/**" string it will not later backtrack to matching just the "/*" prefix. The other end of the regex is also wrong: it is attempting to check for "/* or /** followed by something that isn't just whitespace", but [ \t]*.+[ \t]* will match on pure whitespace. This is less significant but means that a line with just a comment-starter followed by trailing whitespace will generate an incorrect warning about block comment style as well as the correct error about trailing whitespace which a different checkpatch test emits. Fixes: 8c06fbdf36bf4d ("scripts/checkpatch.pl: Enforce multiline comment syntax") Reported-by: Thomas Huth <thuth@redhat.com> Reported-by: Eric Blake <eblake@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 20190118165050.22270-1-peter.maydell@linaro.org
2019-01-11checkpatch: warn about qemu/queue.h head structs that are not typedef-edPaolo Bonzini
These are just like any other struct or union, so they should have CamelCase typedefs. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-01-11checkpatch: colorize output to terminalPaolo Bonzini
Add optional colors to make seeing message types a bit easier. The default is to show them on a tty. Inspired by Linux commits 57230297116fa ("checkpatch: colorize output to terminal") and 737c0767758b ("checkpatch: change format of --color argument to --color[=WHEN]"). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2019-01-11checkpatch: improve handling of multiple patches or filesPaolo Bonzini
Similar to how patchew output looks like for multiple patches, say what file or patch is being tested _before_ emitting errors. This is clearer to a human that scans the output from top to bottom. In addition, provide a truncated commit hash and subject instead of the full hash, and process the commits first-to-last rather than last-to-first. Inspired by Linux commit 0dea9f1eef86bedacad91b6f652ca1ab0d08854c ("checkpatch: reduce number of `git log` calls with --git", 2016-03-20). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-01-11checkpatch: check Signed-off-by in --mailback modePaolo Bonzini
Pull the test before the anticipated exits from the process sub. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-01-11checkpatch: fix premature exit when no input or --mailbackPaolo Bonzini
In some cases, checkpatch's process subroutine is exiting the whole process. This is wrong, just return from the subroutine instead. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-12-14scripts/checkpatch.pl: Enforce multiline comment syntaxPeter Maydell
We now require Linux-kernel-style multiline comments: /* * line one * line two */ Enforce this in checkpatch.pl, by backporting the relevant parts of the Linux kernel's checkpatch.pl. (The only changes needed are that Linux's checkpatch.pl WARN() function takes an extra argument that ours does not, and the kernel has a special case for networking code we don't want.)" The kernel's checkpatch does not enforce "leading /* on a line of its own, so that part is unique to QEMU's checkpatch. Sample warning output: WARNING: Block comments use a leading /* on a separate line #34: FILE: hw/intc/arm_gicv3_common.c:39: + /* Older versions of QEMU had a bug in the handling of state save/restore Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2018-12-12Remove QEMU_ARTIFICIAL macroThomas Huth
The code that used it has already been removed a while ago with commit dc41aa7d34989b552ef ("tcg: Remove GET_TCGV_* and MAKE_TCGV_*"). Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-11-27checkpatch: g_test_message does not need a trailing newlinePaolo Bonzini
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-10-31scripts: report on author emails that are mangled by the mailing listDaniel P. Berrangé
In some cases the Author: email address in patches submitted to the list gets mangled such that it says John Doe via Qemu-devel <qemu-devel@nongnu.org> This change is a result of workarounds for DMARC policies. Subsystem maintainers accepting patches need to catch these and fix them before sending pull requests, so a checkpatch.pl test is highly desirable. Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-08-23checkpatch: allow space in more places before a bracketHeinrich Schuchardt
Allow a space between a colon and subsequent opening bracket. This sequence may occur in inline assembler statements like asm( "ldr %[out], [%[in]]\n\t" : [out] "=r" (ret) : [in] "r" (addr) ); Allow a space between a comma and subsequent opening bracket. This sequence may occur in designated initializers. To ease backporting the patch, I am also changing the comma-bracket detection (added in QEMU by commit 409db6eb7199af7a2f09f746bd1b793e9daefe5f) to use the same regex as brackets and colons (as done independently by Linux commit daebc534ac15f991961a5bb433e515988220e9bf). Link: http://lkml.kernel.org/r/20180403191655.23700-1-xypron.glpk@gmx.de Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-08-23checkpatch: fix filename detection when using -fPaolo Bonzini
Fix $realfile filename when using -f/--file to not remove first level directory as if the filename was used in a -P1 patch. Only strip the first level directory (typically a or b) for P1 patches. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (extracted from Linux commit 2b7ab45395dc4d91ef30985f76d90a8f28f58c27) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-07-06checkpatch: handle token pasting betterPaolo Bonzini
The mechanism to find possible type tokens can sometimes be confused and go into an infinite loop. This happens for example in QEMU for a line that looks like uint## BITS ##_t S = _S, T = _T; \ uint## BITS ##_t as, at, xs, xt, xd; \ Because the token pasting operator does not have a space before _t, it does not match $notPermitted. However, (?x) is turned on in the regular expression for modifiers, and thus ##_t matches the empty string. As a result, annotate_values goes in an infinite loop. The solution is simply to remove token pasting operators from the string before looking for modifiers. In the example above, the string uintBITS_t will be evaluated as a candidate modifier. This is not optimal, but it works as long as people do not write things like a##s##m, and it fits nicely into sub possible. For a similar reason, \# should be rejected always, even if it is not at end of line or followed by whitespace. The same patch was sent to the Linux kernel mailing list. Reported-by: Aleksandar Markovic <amarkovic@wavecomp.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-07-02checkpatch: Recognize IEC binary prefix definitionsPhilippe Mathieu-Daudé
Do not match the IEC binary prefix as camelcase typedefs. This fixes: ERROR: "foo * bar" should be "foo *bar" #310: FILE: hw/ppc/ppc440_uc.c:564: + size = 8 * MiB * sh; total: 1 errors, 0 warnings, 433 lines checked Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180625124238.25339-5-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-05-22checkpatch: generalize xen handle matching in the list of typesPaul Durrant
All the xen stable APIs define handle types of the form: xen<subject of API>_handle and some define additional handle types of the form: xen<subject of API>_<purpose of handle>_handle Examples of these are xenforeignmemory_handle and xenforeignmemory_resource_handle. Both of these types will be misparsed by checkpatch if they appear as the first token in a line since, as types defined by an external library, they do not conform to the QEMU CODING_STYLE, which suggests CamelCase. A previous patch (5ac067a24a8) added xendevicemodel_handle to the list of types. This patch changes that to xen\w+_handle such that it will match all Xen stable API handles of the forms detailed above. Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
2018-05-14Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into ↵Peter Maydell
staging Block pull request * Support -drive cache.direct=off live migration for POSIX files # gpg: Signature made Sat 12 May 2018 10:27:51 BST # gpg: using RSA key 9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/block-pull-request: block/file-posix: add x-check-page-cache=on|off option block/file-posix: implement bdrv_co_invalidate_cache() on Linux checkpatch: reduce MAINTAINERS update message frequency checkpatch: emit a warning on file add/move/delete checkpatch: ignore email headers better checkpatch: check utf-8 content from a commit log when it's missing from charset checkpatch: add a --strict check for utf-8 in commit logs blockjob: drop block_job_pause/resume_all() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-05-10checkpatch: reduce MAINTAINERS update message frequencyJoe Perches
When files are being added/moved/deleted and a patch contains an update to the MAINTAINERS file, assume it's to update the MAINTAINERS file correctly and do not emit the "does MAINTAINERS need updating?" message. Reported by many people. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20180430124651.10340-6-stefanha@redhat.com (cherry picked from e0d975b1b439c4fef58fbc306c542c94f48bb849) Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-05-10checkpatch: emit a warning on file add/move/deleteJoe Perches
Whenever files are added, moved, or deleted, the MAINTAINERS file patterns can be out of sync or outdated. To try to keep MAINTAINERS more up-to-date, add a one-time warning whenever a patch does any of those. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20180430124651.10340-5-stefanha@redhat.com (cherry picked from commit 13f1937ef33950b1112049972249e6191b82e6c9) Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Conflicts: QEMU WARN() only takes one argument, drop the 'type' value in the first argument. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-05-10checkpatch: ignore email headers betterJoe Perches
There are some patches created by git format-patch that when scanned by checkpatch report errors on lines like To: address.tld This is a checkpatch false positive. Improve the logic a bit to ignore folded email headers to avoid emitting these messages. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20180430124651.10340-4-stefanha@redhat.com (cherry picked from commit 29ee1b0c67e0dd7dea8dd718e8326076bce5b6fe) Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-05-10checkpatch: check utf-8 content from a commit log when it's missing from charsetPasi Savanainen
Check that a commit log doesn't contain UTF-8 when a mail header explicitly defines a different charset, like 'Content-Type: text/plain; charset="us-ascii"' Signed-off-by: Pasi Savanainen <pasi.savanainen@nixu.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Message-id: 20180430124651.10340-3-stefanha@redhat.com Cc: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit fa64205df9dfd7b7662cc64a7e82115c00e428e5) Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-05-10checkpatch: add a --strict check for utf-8 in commit logsJoe Perches
Some find using utf-8 in commit logs inappropriate. Some patch commit logs contain unintended utf-8 characters when doing things like copy/pasting compilation output. Look for the start of any commit log by skipping initial lines that look like email headers and "From: " lines. Stop looking for utf-8 at the first signature line. Signed-off-by: Joe Perches <joe@perches.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Message-id: 20180430124651.10340-2-stefanha@redhat.com Suggested-by: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit 15662b3e8644905032c2e26808401a487d4e90c1) Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Conflicts: QEMU does not have CHK(), use WARN() instead. QEMU WARN() only takes one argument, drop the 'type' value in the first argument. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2018-05-09checkpatch.pl: add common glib defines to typelistPeter Xu
Otherwise it can warn this: ERROR: space prohibited between function name and open parenthesis '(' When with things like this: typedef gboolean (*it_tree_iterator)(ITValue start, ITValue end); CC: Paolo Bonzini <pbonzini@redhat.com> CC: "Daniel P. Berrangé" <berrange@redhat.com> CC: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> CC: Fam Zheng <famz@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180425070103.23723-1-peterx@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-04-26checkpatch: Add xendevicemodel_handle to the list of typesIan Jackson
This avoids checkpatch misparsing (as statements) long function definitions or declarations, which sometimes start with constructs like this: static inline int xendevicemodel_relocate_memory( xendevicemodel_handle *dmod, domid_t domid, ... The type xendevicemodel_handle does not conform to Qemu CODING_STYLE, which would suggest CamelCase. However, it is a type defined by the Xen Project in xen.git. It would be possible to introduce a typedef to allow the qemu code to refer to it by a differently-spelled name, but that would obfuscate more than it would clarify. CC: Eric Blake <eblake@redhat.com> CC: Paolo Bonzini <pbonzini@redhat.com> CC: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2018-04-05scripts/checkpatch.pl: Bug fixSu Hang
Commit 2b9aef6fcd96ba7ed8c1ee723e391901852d344c introduced a regression: checkpatch.pl started complaining about the following valid pattern: do { /* something */ } while (condition); Fix the script to once again permit this pattern. Signed-off-by: Su Hang <suhang16@mails.ucas.ac.cn> Message-Id: <1522029982-4650-1-git-send-email-suhang16@mails.ucas.ac.cn> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>