Skip to contentSkip to conversation

checkpatch: sugguest to use qemu_real_host_page_size instead of getpagesize() or sysconf(_SC_PAGESIZE)

PATCH Superseded Wei Yang 5 participants 7 messages Oct 16, 2019 – Oct 17, 2019 Checkpatch

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 checkpatch: sugguest to use qemu_real_host_page_size instead of getpagesize() or sysconf(_SC_PAGESIZE)

CC David Gibson <[email protected]>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/checkpatch.pl +6 -0
index aa9a354a0e..4b360ed310 100755
@@ -2915,6 +2915,12 @@ sub process {
 		if ($line =~ /\bbzero\(/) {
 			ERROR("use memset() instead of bzero()\n" . $herecurr);
 		}
+		if ($line =~ /getpagesize\(\)/) {
+			ERROR("use qemu_real_host_page_size instead of getpagesize()\n" . $herecurr);
+		}
+		if ($line =~ /sysconf\(_SC_PAGESIZE\)/) {
+			ERROR("use qemu_real_host_page_size instead of sysconf(_SC_PAGESIZE)\n" . $herecurr);
+		}
 		my $non_exit_glib_asserts = qr{g_assert_cmpstr|
 						g_assert_cmpint|
 						g_assert_cmpuint|
Signature · 1 line
2.17.1
#1 lore raw
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Subject: [PATCH] checkpatch: sugguest to use qemu_real_host_page_size instead of getpagesize() or sysconf(_SC_PAGESIZE)
Type: series
Message-id: [email protected]

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
6c3e035 checkpatch: sugguest to use qemu_real_host_page_size instead of getpagesize() or sysconf(_SC_PAGESIZE)

=== OUTPUT BEGIN ===
ERROR: line over 90 characters
#20: FILE: scripts/checkpatch.pl:2919:
+ ERROR("use qemu_real_host_page_size instead of getpagesize()\n" . $herecurr);

ERROR: line over 90 characters
#23: FILE: scripts/checkpatch.pl:2922:
+ ERROR("use qemu_real_host_page_size instead of sysconf(_SC_PAGESIZE)\n" . $herecurr);

total: 2 errors, 0 warnings, 12 lines checked

Commit 6c3e0354a83f (checkpatch: sugguest to use qemu_real_host_page_size instead of getpagesize() or sysconf(_SC_PAGESIZE)) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#2 lore raw
Quoted 22 lines · On Wed, Oct 16, 2019 at 03:25:53AM -0700, [email protected] wrote:

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Subject: [PATCH] checkpatch: sugguest to use qemu_real_host_page_size instead of getpagesize() or sysconf(_SC_PAGESIZE)
Type: series
Message-id: [email protected]

=== TEST SCRIPT BEGIN === #!/bin/bash
git rev-parse base > /dev/null || exit 0 git config --local diff.renamelimit 0 git config --local diff.renames True git config --local diff.algorithm histogram ./scripts/checkpatch.pl --mailback base.. === TEST SCRIPT END ===

Quoted 9 lines

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
6c3e035 checkpatch: sugguest to use qemu_real_host_page_size instead of getpagesize() or sysconf(_SC_PAGESIZE)

=== OUTPUT BEGIN ===
ERROR: line over 90 characters #20: FILE: scripts/checkpatch.pl:2919:
+ ERROR("use qemu_real_host_page_size instead of getpagesize()\n" . $herecurr);

Since this is an error message and I see other similar code keep it in the same line, I didn't split it into two lines.

If necessary, I would split it.

Signature · 2 lines
Wei Yang
Help you, Help me
#3 lore raw
In reply to Wei Yang

scripts/checkpatch.pl sub process { · line 2921

Quoted 7 lines · Wei Yang
scripts/checkpatch.pl +4 -0
 		if ($line =~ /\bbzero\(/) {
 			ERROR("use memset() instead of bzero()\n" . $herecurr);
 		}
+		if ($line =~ /getpagesize\(\)/) {
+			ERROR("use qemu_real_host_page_size instead of getpagesize()\n" . $herecurr);
+		}
+		if ($line =~ /sysconf\(_SC_PAGESIZE\)/) {

Use \b to match beginning of symbol like bzero did?

r~

author
#4 lore raw
Quoted 11 lines · Richard Henderson

scripts/checkpatch.pl sub process { · line 2921

Quoted 7 lines · Wei Yang
scripts/checkpatch.pl +4 -0
 		if ($line =~ /\bbzero\(/) {
 			ERROR("use memset() instead of bzero()\n" . $herecurr);
 		}
+		if ($line =~ /getpagesize\(\)/) {
+			ERROR("use qemu_real_host_page_size instead of getpagesize()\n" . $herecurr);
+		}
+		if ($line =~ /sysconf\(_SC_PAGESIZE\)/) {

Use \b to match beginning of symbol like bzero did?

You are right, thanks for the suggestion.

Quoted 2 lines

r~

Signature · 2 lines
Wei Yang
Help you, Help me
#5 lore raw
In reply to Wei Yang
Quoted 13 lines · Wei Yang
CC David Gibson <[email protected]>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/checkpatch.pl +0 -0
index aa9a354a0e..4b360ed310 100755
@@ -2915,6 +2915,12 @@ sub process {
 		if ($line =~ /\bbzero\(/) {
 			ERROR("use memset() instead of bzero()\n" . $herecurr);

scripts/checkpatch.pl sub process { · line 2926

Quoted 10 lines
scripts/checkpatch.pl +6 -0
 		}
+		if ($line =~ /getpagesize\(\)/) {
+			ERROR("use qemu_real_host_page_size instead of getpagesize()\n" . $herecurr);
+		}
+		if ($line =~ /sysconf\(_SC_PAGESIZE\)/) {
+			ERROR("use qemu_real_host_page_size instead of sysconf(_SC_PAGESIZE)\n" . $herecurr);
+		}
 		my $non_exit_glib_asserts = qr{g_assert_cmpstr|
 						g_assert_cmpint|
 						g_assert_cmpuint|

Just wanted to say thank you for extending checkpatch.pl! We don't do it enough but it's the best way to extend QEMU coding style because it's automated :).

Stefan

author
#6 lore raw
Quoted 20 lines · Stefan Hajnoczi
Quoted 19 lines · Wei Yang
CC David Gibson <[email protected]>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/checkpatch.pl +5 -0
index aa9a354a0e..4b360ed310 100755
@@ -2915,6 +2915,12 @@ sub process {
 		if ($line =~ /\bbzero\(/) {
 			ERROR("use memset() instead of bzero()\n" . $herecurr);
 		}
+		if ($line =~ /getpagesize\(\)/) {
+			ERROR("use qemu_real_host_page_size instead of getpagesize()\n" . $herecurr);
+		}
+		if ($line =~ /sysconf\(_SC_PAGESIZE\)/) {
+			ERROR("use qemu_real_host_page_size instead of sysconf(_SC_PAGESIZE)\n" . $herecurr);
Quoted 9 lines

scripts/checkpatch.pl sub process { · line 2926

Quoted 4 lines
scripts/checkpatch.pl +1 -0
+		}
 		my $non_exit_glib_asserts = qr{g_assert_cmpstr|
 						g_assert_cmpint|
 						g_assert_cmpuint|

Just wanted to say thank you for extending checkpatch.pl! We don't do it enough but it's the best way to extend QEMU coding style because it's automated :).

You are welcome. Glad to do something.

Quoted 1 line

Stefan

Signature · 2 lines
Wei Yang
Help you, Help me