lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 25 Oct 2019 09:57:48 +0300
From:   Jani Nikula <jani.nikula@...ux.intel.com>
To:     Jonathan Corbet <corbet@....net>,
        Changbin Du <changbin.du@...il.com>
Cc:     linux-pci@...r.kernel.org, linux-doc@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        linux-crypto@...r.kernel.org, linux-kselftest@...r.kernel.org,
        linux-wireless@...r.kernel.org, linux-fpga@...r.kernel.org,
        linux-usb@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        intel-gfx@...ts.freedesktop.org,
        Matthew Wilcox <willy@...radead.org>,
        Thomas Zimmermann <tzimmermann@...e.de>
Subject: Re: [PATCH v2] kernel-doc: rename the kernel-doc directive 'functions' to 'identifiers'

On Thu, 24 Oct 2019, Jonathan Corbet <corbet@....net> wrote:
> On Sun, 20 Oct 2019 21:17:17 +0800
> Changbin Du <changbin.du@...il.com> wrote:
>
>> The 'functions' directive is not only for functions, but also works for
>> structs/unions. So the name is misleading. This patch renames it to
>> 'identifiers', which specific the functions/types to be included in
>> documentation. We keep the old name as an alias of the new one before
>> all documentation are updated.
>> 
>> Signed-off-by: Changbin Du <changbin.du@...il.com>
>
> So I think this is basically OK, but I have one more request...
>
> [...]
>
>> diff --git a/Documentation/sphinx/kerneldoc.py b/Documentation/sphinx/kerneldoc.py
>> index 1159405cb920..0689f9c37f1e 100644
>> --- a/Documentation/sphinx/kerneldoc.py
>> +++ b/Documentation/sphinx/kerneldoc.py
>> @@ -59,9 +59,10 @@ class KernelDocDirective(Directive):
>>      optional_arguments = 4
>>      option_spec = {
>>          'doc': directives.unchanged_required,
>> -        'functions': directives.unchanged,
>>          'export': directives.unchanged,
>>          'internal': directives.unchanged,
>> +        'identifiers': directives.unchanged,
>> +        'functions': directives.unchanged,  # alias of 'identifiers'
>>      }
>>      has_content = False
>>  
>> @@ -71,6 +72,7 @@ class KernelDocDirective(Directive):
>>  
>>          filename = env.config.kerneldoc_srctree + '/' + self.arguments[0]
>>          export_file_patterns = []
>> +        identifiers = None
>>  
>>          # Tell sphinx of the dependency
>>          env.note_dependency(os.path.abspath(filename))
>> @@ -86,19 +88,22 @@ class KernelDocDirective(Directive):
>>              export_file_patterns = str(self.options.get('internal')).split()
>>          elif 'doc' in self.options:
>>              cmd += ['-function', str(self.options.get('doc'))]
>> +        elif 'identifiers' in self.options:
>> +            identifiers = self.options.get('identifiers').split()
>>          elif 'functions' in self.options:
>> -            functions = self.options.get('functions').split()
>> -            if functions:
>> -                for f in functions:
>> -                    cmd += ['-function', f]
>> -            else:
>> -                cmd += ['-no-doc-sections']
>> +            identifiers = self.options.get('functions').split()
>
> Rather than do this, can you just change the elif line to read:
>
>     elif ('identifiers' in self.options) or ('functions' in self.options):
>
> ...then leave the rest of the code intact?  It keeps the logic together,
> and avoids the confusing distinction between identifiers=='' and
> identifiers==None .

I think the problem is you still need to distinguish between the two for
the get('functions') part.

One option is to rename 'functions' to 'identifiers' in the above block,
and put something like this above the whole if ladder (untested):

        # backward compat
        if 'functions' in self.options:
            if 'identifiers' in self.options:
                kernellog.warn(env.app, "fail")
            else:
                self.options.set('identifiers', self.options.get('functions'))

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ