Proliferation of hundreds of tiny files
Dmitry V. Levin
ldv at altlinux.org
Fri Oct 23 06:32:56 UTC 2015
Hi,
On Thu, Oct 22, 2015 at 05:27:24PM +0200, Denys Vlasenko wrote:
> Hello Dmitry,
>
> Two years ago, at the end of 2013, strace source had 29 *.c files
> in its main source directory (meaning: this does not count any tests).
> linux/* contained 148 files in total (not only *.c files).
>
> Today, there are 120 *.c files in main source directory,
> and 419 files in linux/*
Ideally, each parser should have been in a separate file from the
beginning, that would make maintenance easier.
I'm working in this direction.
> I have hard time understanding code now. Register reading logic
> for x86 is now in what, a dozen different files?
>
> Take a look at x86_64/get_scno.c - what's there is not even a
> complete function definition, it's a fragment of C code to be
> #included somewhere else. It's hard to see what's being done
> where, let alone spot possible bugs or inefficiencies.
Ideally, *.c file in the main directory should have been without arch
ifdefs at all, arch specific parts should have been placed in arch
subdirs from the beginning, that would make maintenance easier.
Now that arch specific parts of get_scno are moved to arch subdirs,
I can maintain this code and explain others how it works.
> Another example:
>
> commit 9b2f674adbd5c44fe892b31cf95703eeceb21c40
> Author: Dmitry V. Levin <ldv at altlinux.org>
> Date: Sat Dec 6 03:53:16 2014 +0000
>
> file.c: move chdir parser to a separate file
>
> I have a question: Why it's better to have it in a separate file?
> I mean, the
>
> #include "defs.h"
>
> SYS_FUNC(chdir)
> {
> printpath(tcp, tcp->u_arg[0]);
>
> return RVAL_DECODED;
> }
>
> needs a separate file why?
file.c was a huge mess, I cleaned it up as much as I could by moving all
non-stat parsers to separate files. The remaining part of file.c is still
a mess, but now it's in a more maintainable state.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20151023/2f22a710/attachment.bin>
More information about the Strace-devel
mailing list