Commit Graph

30 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
252667882a maint/update_copyright_years.sh: implement concurrent execution
Analogous to the way it is done in xlat/gen.sh.

* maint/update_copyright_years.sh (MAX_JOBS): New variable, initialize
it to double the CPU count.
<while [ -n "${1:-}" ]; do case "$1" in>: Add -j option parsing.
(jobs, pids): New variables.
<git ls-files -- "$@" | grep -vFx "$IGNORED_FILES" | while read f; do>:
Execute process_file in background, count background jobs and wait
if there are too many.
2017-11-14 20:32:24 +00:00
Eugene Syromyatnikov
65b1268580 maint/update_copyright_years.sh: use -efu shell mode
* maint/update_copyright_years.sh: Add -efu to shebang.  Adjust
the script for -efu shell mode.
2017-11-14 20:32:24 +00:00
Eugene Syromyatnikov
cca061f6f0 maint: make gen-contributors-list.sh suitable for generation of CREDITS
Implement various features in order to make it suitable for the
generation of the CREDITS file:
- add an option for including contributor e-mail;
- add an option to read additional list of contributors from stdin;
- add shorthand for referring to the initial commit of the branch;
- document all of the above in a help message.

* maint/gen-contributors-list.sh (print_help): New function.
(script): Rename to SCRIPT.
(SCRIPT_NORM_EMAILS, MATCH_OUT, OUT_EMAILS, OUT_NO_EMAILS, read_stdin,
include_email): New variables.
Add parsing of options, rewrite input processing.
2017-11-13 20:21:22 +00:00
Gleb Fotengauer-Malinovskiy
78f448e8c7 maint: remove KVM_PPC_CONFIGURE_V3_MMU ioctl from non-powerpc arches
* maint/ioctls_sym.sh (ppc_list): Update.
2017-11-13 20:21:22 +00:00
73e9f00754 maint/update_copyright_years.sh: fix typo in help output
* maint/update_copyright_years.sh (print_help): Fix typo, disable
here-document expansion.
2017-11-11 23:08:09 +00:00
Gleb Fotengauer-Malinovskiy
55bc4164bd maint: generate ioctl entries without target architecture code execution
ioctls_sym.sh used to generate and invoke target architecture
executables that limited its applicability.
After this change, the generated code is just compiled to the target
architecture object files and all required information is obtained
from the dwarf sections.
This approach allows to generate ioctl entries for any target
architecture supported by compiler.

* maint/ioctls_sym.awk: New file.
* maint/ioctls_sym.sh (LC_ALL): Define to C and export.
(uname_m): Make configurable.
(CFLAGS): Add -gdwarf-2.
(LDFLAGS): Remove.
Do not use print_ioctlent.c.
Change asm-generic/ioctl.h and asm/ioctl.h hook.
Dump and process dwarf sections of generated object files.
* maint/print_ioctlent.c: Remove.
2017-09-19 11:32:05 +00:00
68d18a891e Remove KVM_S390_* ioctls from non-s390 architectures
* maint/ioctls_sym.sh <linux/kvm.h> (s390_list): New variable.
Use it to exclude KVM_S390_* ioctls on non-s390 architectures.
* linux/arm/ioctls_arch0.h: Regenerate.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390/ioctls_arch0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
2017-09-18 11:26:04 +00:00
7052c84b01 Remove some of arch-specific KVM ioctls from non-matching architectures
* maint/ioctls_sym.sh (arm_list, ppc_list, x86_list): Use bracket
expressions to generalize arch-specific regular expressions.
* linux/arm/ioctls_arch0.h: Regenerate.
* linux/i386/ioctls_arch0.h: Likewise.
* linux/powerpc/ioctls_arch0.h: Likewise.
* linux/s390/ioctls_arch0.h: Likewise.
* linux/x86_64/ioctls_arch0.h: Likewise.
2017-09-17 12:04:11 +00:00
832320813b maint: add gen-tag-message.sh script
* maint/gen-tag-message.sh: New file.
2017-09-05 12:13:14 +00:00
10c45eef05 maint: add gen-contributors-list.sh script
* maint/gen-contributors-list.sh: New file.
2017-09-05 12:13:14 +00:00
Eugene Syromyatnikov
2769e408e5 update_copyright_years.sh: add ability to automatically commit results
* maint/update_copyright_years.sh (DEFAULT_GIT_COMMIT_MESSAGE,
GIT_COMMIT_MESSAGE): New variables.
<-c>: New option, implies -a, calls git commit with GIT_COMMIT_TEMPLATE string
as a template.
2017-09-05 10:09:10 +02:00
Eugene Syromyatnikov
295cf322b1 update_copyright_years.sh: workaround for old git versions
Old git versions (like the one shipped in Debian 8) do not support setting
date format with --date, working this around by processing git log output
with date +%Y.

* main/update_copyright_years.sh (process_file) <first_commit_year,
last_commit_year>: Change format to format:%aD, remove --date, supply
output as a -d option argument to date +%Y.
2017-08-27 11:06:14 +00:00
Gleb Fotengauer-Malinovskiy
16f1b5ca72 maint: fix ioctls_sym.sh premature termination
When the list of headers do not fit into the command line, xargs splits
it into several lists and then passes them to grep.  If no headers from
a list match the grep pattern, grep exits with a non-zero status that
causes xargs to exit with a non-zero status, too.

* maint/ioctls_sym.sh: Use "find -exec +" instead of xargs,
ignore its exit status.
2017-06-29 09:17:18 +00:00
Eugene Syromyatnikov
9d095c7860 Add copyright headers 2017-05-22 17:33:51 +00:00
Eugene Syromyatnikov
c2930b90ae Add scripts for automating copyright notices update
* maint/update_copyright_years.awk: New file.
* maint/update_copyright_years.sh: Likewise.

Co-authored-by: Elvira Khabirova <lineprinter0@gmail.com>
2017-05-22 19:30:30 +02:00
d70a3112a0 Move errnoent.sh, signalent.sh, and syscallent.sh to maint subdirectory
Also do not include them into release tarballs.  These files are
intended for developers who are expected to use a git repository.

* errnoent.sh: Move to maint subdirectory.
* signalent.sh: Likewise.
* syscallent.sh: Likewise.
* HACKING-scripts: Update.
* Makefile.am (EXTRA_DIST): Remove errnoent.sh, signalent.sh,
and syscallent.sh.
2017-05-16 02:11:35 +00:00
Gleb Fotengauer-Malinovskiy
4aa409b9e3 maint: update for linux 4.11
* maint/ioctls_sym.sh (ppc_list): Add KVM_PPC_GET_RMMU_INFO
and KVM_PPC_CONFIGURE_V3_MMU.
2017-03-23 16:42:32 +00:00
Gleb Fotengauer-Malinovskiy
ef3fc7ebb7 maint: update for linux 4.10
* maint/ioctls_sym.sh: Update workaround for linux/if_pppox.h file.
2017-02-04 15:57:01 +00:00
Gleb Fotengauer-Malinovskiy
f7a65e0c7d maint: add workaround for m68k
* maint/ioctls_sym.sh: Skip asm/amigayle.h.
2017-02-04 15:57:01 +00:00
5532ac185b maint: add more workarounds for alpha and powerpc
* maint/ioctls_sym.sh: Skip asm/core_*.h.  Filter out from
asm-generic/ioctls.h those macros that are defined using unavailable
struct termios2 on alpha and powerpc.
2016-11-22 00:21:01 +00:00
702c5c29a1 maint: move KVM_* constants from ioctls_inc.h to ioctls_arch.h
* maint/ioctls_gen.sh: Place constants defined in linux/kvm.h
into ioctls_arch.h instead of ioctls_inc.h.
2016-11-22 00:15:20 +00:00
0bb5372ddd maint: harmonize use of ioctls_sym.sh
* maint/ioctls_gen.sh: Consistently specify INCLUDES for all
ioctls_sym.sh invocations.  Use $mydir to specify ioctls_sym.sh
location.
2016-11-21 22:34:05 +00:00
c06335cdd4 maint: rework workarounds for linux/kvm.h
* maint/ioctls_sym.sh: Remove pre-include linux/kvm.h workarounds.
Skip linux/kvm.h on those architectures that have no asm/kvm.h file.
Introduce post-process workarounds, add post-process workarounds
for linux/kvm.h.
2016-11-21 16:08:08 +00:00
Gleb Fotengauer-Malinovskiy
7e8314eb34 maint: update for linux 4.8
* maint/ioctls_sym.sh: Add workarounds for linux/atm_zatm.h and
xen/evtchn.h files.
2016-09-12 13:55:59 +00:00
Gleb Fotengauer-Malinovskiy
4d670d512d maint: update for linux 4.7
* maint/ioctls_sym.sh: Drop obsolete workarounds for linux/btrfs.h.
2016-07-12 16:22:22 +00:00
d07201aeef maint: update for linux 4.6
* maint/ioctls_sym.sh: Update workarounds for linux/kvm.h.
2016-05-18 09:26:01 +00:00
e7794ae36c maint: update for linux 4.5
* maint/ioctls_sym.sh: Update workarounds for drm/*_drm.h files.
Add workarounds for xen/gntdev.h and net/nfc/nci_core.h files.
Update path of saa6588.h and exynos-fimc.h files.
2016-03-26 23:37:18 +00:00
f95cf99556 maint: make linux/kvm.h parseable on arm
* maint/ioctls_sym.sh [AARCH64 || ARM]: Add missing definitions for
structures referenced from linux/kvm.h.
2015-05-21 17:48:38 +00:00
7e88896a16 maint: avoid effects of locale when sorting files
* maint/ioctls_gen.sh: Invoke sort with LC_COLLATE=C.
* maint/ioctls_hex.sh: Likewise.
* maint/ioctls_sym.sh: Likewise.

Reported-by: Philippe De Muyter <phdm@macqel.be>
2015-05-19 18:00:07 +00:00
df7aa2b19e ioctl: take all 32 bits of ioctl commands into account
Historically, only 16 bits (8-bit number and 8-bit type) of 32-bit ioctl
commands were used for decoding, which was the source for numerous
annoying collisions like this:

	ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
	ioctl(0, MGSL_IOCGPARAMS or MMTIMER_GETRES or MTIOCTOP or SNDCTL_MIDI_MPUMODE, 0x7fffd47f7338) = -1 ENOTTY (Inappropriate ioctl for device)

The solution is to use all 32 bits for decoding, not just "number" and
"type", but also "size" and "direction".

As some architectures override defaults that come from asm-generic/ and
provide alternative definitions for some ioctl commands, we support
per-architecture ioctl definitions and merge them with common
definitions at build time.  During the merge, we used to keep both
generic and architecture-specific definitions, now architecture-specific
definitions have precedence over generic ones -- ioctlsort omits
definitions from asm-generic/ for those ioctl names that have different
definitions in asm/.

Additional bits of "direction" are architecture specific -- the number
of bits and their values differ between architectures.  To reduce
architecture differences in the source code, we keep "direction" in
symbolic form and compile it in ioctlsort.

Additional bits of "size" are also architecture specific -- not only the
number of bits differ between architectures, but sizes of many types
depend on sizeof(long).  To reduce architecture differences in the
source code, we keep 32-bit and 64-bit versions of common ioctl
definitions, and use the appropriate version for each architecture and
personality.

To implement this, the tools for generating ioctl definitions from
kernel headers have been rewritten, and the source format of ioctl
definitions has been extended.   The final ioctlent*.h files that are
included by syscall.c are now generated from source ioctls_inc*.h and
ioctls_arch*.h files at build time with ioctlsort.

* ioctl.c (ioctl_lookup): Use all 32 bits of ioctl command code.
* ioctlsort.c: Rewritten.
* linux/32/ioctls_inc.h: New file.
* linux/64/ioctls_inc.h: New file.
* linux/aarch64/ioctls_arch0.h: New file.
* linux/aarch64/ioctls_arch1.h: New file.
* linux/aarch64/ioctls_inc0.h: New file.
* linux/aarch64/ioctls_inc1.h: New file.
* linux/alpha/ioctls_arch0.h: New file.
* linux/alpha/ioctls_inc0.h: New file.
* linux/arc/ioctls_arch0.h: New file.
* linux/arc/ioctls_inc0.h: New file.
* linux/arm/ioctls_arch0.h: New file.
* linux/arm/ioctls_inc0.h: New file.
* linux/avr32/ioctls_arch0.h: New file.
* linux/avr32/ioctls_inc0.h: New file.
* linux/bfin/ioctls_arch0.h: New file.
* linux/bfin/ioctls_inc0.h: New file.
* linux/hppa/ioctls_arch0.h: New file.
* linux/hppa/ioctls_inc0.h: New file.
* linux/i386/ioctls_arch0.h: New file.
* linux/i386/ioctls_inc0.h: New file.
* linux/ia64/ioctls_arch0.h: New file.
* linux/ia64/ioctls_inc0.h: New file.
* linux/m68k/ioctls_arch0.h: New file.
* linux/m68k/ioctls_inc0.h: New file.
* linux/metag/ioctls_arch0.h: New file.
* linux/metag/ioctls_inc0.h: New file.
* linux/microblaze/ioctls_arch0.h: New file.
* linux/microblaze/ioctls_inc0.h: New file.
* linux/mips/ioctls_arch0.h: New file.
* linux/mips/ioctls_inc0.h: New file.
* linux/or1k/ioctls_arch0.h: New file.
* linux/or1k/ioctls_inc0.h: New file.
* linux/powerpc/ioctls_arch0.h: New file.
* linux/powerpc/ioctls_inc0.h: New file.
* linux/powerpc64/ioctls_arch0.h: New file.
* linux/powerpc64/ioctls_arch1.h: New file.
* linux/powerpc64/ioctls_inc0.h: New file.
* linux/powerpc64/ioctls_inc1.h: New file.
* linux/s390/ioctls_arch0.h: New file.
* linux/s390/ioctls_inc0.h: New file.
* linux/s390x/ioctls_arch0.h: New file.
* linux/s390x/ioctls_inc0.h: New file.
* linux/sh/ioctls_arch0.h: New file.
* linux/sh/ioctls_inc0.h: New file.
* linux/sh64/ioctls_arch0.h: New file.
* linux/sh64/ioctls_inc0.h: New file.
* linux/sparc/ioctls_arch0.h: New file.
* linux/sparc/ioctls_inc0.h: New file.
* linux/sparc64/ioctls_arch0.h: New file.
* linux/sparc64/ioctls_arch2.h: New file.
* linux/sparc64/ioctls_inc0.h: New file.
* linux/sparc64/ioctls_inc2.h: New file.
* linux/tile/ioctls_arch0.h: New file.
* linux/tile/ioctls_arch1.h: New file.
* linux/tile/ioctls_inc0.h: New file.
* linux/tile/ioctls_inc1.h: New file.
* linux/x32/ioctls_arch0.h: New file.
* linux/x32/ioctls_arch1.h: New file.
* linux/x32/ioctls_inc0.h: New file.
* linux/x32/ioctls_inc1.h: New file.
* linux/x86_64/ioctls_arch0.h: New file.
* linux/x86_64/ioctls_arch1.h: New file.
* linux/x86_64/ioctls_inc0.h: New file.
* linux/x86_64/ioctls_inc1.h: New file.
* linux/xtensa/ioctls_arch0.h: New file.
* linux/xtensa/ioctls_inc0.h: New file.
* linux/aarch64/ioctlent.h.in: Remove.
* linux/aarch64/ioctlent1.h: Remove.
* linux/alpha/ioctlent.h.in: Remove.
* linux/arc/ioctlent.h.in: Remove.
* linux/arm/ioctlent.h.in: Remove.
* linux/avr32/ioctlent.h.in: Remove.
* linux/bfin/ioctlent.h.in: Remove.
* linux/hppa/ioctlent.h.in: Remove.
* linux/i386/ioctlent.h.in: Remove.
* linux/ia64/ioctlent.h.in: Remove.
* linux/ioctlent.h.in: Remove.
* linux/ioctlent.sh: Remove.
* linux/m68k/ioctlent.h.in: Remove.
* linux/metag/ioctlent.h.in: Remove.
* linux/microblaze/ioctlent.h.in: Remove.
* linux/mips/ioctlent.h.in: Remove.
* linux/mips/ioctlent.sh: Remove.
* linux/or1k/ioctlent.h.in: Remove.
* linux/powerpc/ioctlent.h.in: Remove.
* linux/powerpc64/ioctlent.h: Remove.
* linux/powerpc64/ioctlent1.h: Remove.
* linux/s390/ioctlent.h.in: Remove.
* linux/s390x/ioctlent.h.in: Remove.
* linux/sh/ioctlent.h.in: Remove.
* linux/sh64/ioctlent.h.in: Remove.
* linux/sparc/ioctlent.h.in: Remove.
* linux/sparc64/ioctlent.h.in: Remove.
* linux/sparc64/ioctlent2.h: Remove.
* linux/tile/ioctlent.h.in: Remove.
* linux/tile/ioctlent1.h: Remove.
* linux/x32/ioctlent.h.in: Remove.
* linux/x32/ioctlent1.h: Remove.
* linux/x86_64/ioctlent.h.in: Remove.
* linux/x86_64/ioctlent1.h: Remove.
* linux/xtensa/ioctlent.h.in: Remove.
* linux/x86_64/ioctlent2.h: Include ioctlent0.h instead of ioctlent.h.
* syscall.c (struct_ioctlent ioctlent0): Likewise.
* Makefile.am: Remove all ioctlent-related definitions.
Define the list of ioctlent*.h files that have to be generated by
presence of $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h files.
Add rules for ioctlent*.h files generation.
(EXTRA_DIST): Update.
* maint/ioctls_gen.sh: New file.
* maint/ioctls_hex.sh: New file.
* maint/ioctls_sym.sh: New file.
* maint/print_ioctlent.c: New file.
* HACKING-scripts: Update for ioctlent.sh -> ioctls_gen.sh migration.
* .gitignore: Add ioctlent[012].h and ioctls_all[012].h.
* configure.ac (AC_CHECK_HEADERS): Add linux/hiddev.h
and linux/mmtimer.h for tests.
* tests/ioctl.c: New file.
* tests/ioctl.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add ioctl.
(TESTS): Add ioctl.test.
* tests/.gitignore: Add ioctl.
2015-01-22 00:27:38 +00:00