[PATCH net-next 2/3] net: dns_resolver: Move dns_query() explanation out of code block

Bagas Sanjaya posted 3 patches 1 week, 2 days ago
There is a newer version of this series
[PATCH net-next 2/3] net: dns_resolver: Move dns_query() explanation out of code block
Posted by Bagas Sanjaya 1 week, 2 days ago
Documentation for dns_query() is placed in the function's literal code
block snippet instead. Move it out of there.

Fixes: 9dfe1361261b ("docs: networking: convert dns_resolver.txt to ReST")
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 Documentation/networking/dns_resolver.rst | 45 +++++++++++------------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/Documentation/networking/dns_resolver.rst b/Documentation/networking/dns_resolver.rst
index 5cec37bedf9950..329fb21d005ccd 100644
--- a/Documentation/networking/dns_resolver.rst
+++ b/Documentation/networking/dns_resolver.rst
@@ -64,44 +64,43 @@ before the more general line given above as the first match is the one taken::
 Usage
 =====
 
-To make use of this facility, one of the following functions that are
-implemented in the module can be called after doing::
+To make use of this facility, the appropriate header must be included first::
 
 	#include <linux/dns_resolver.h>
 
-     ::
+Then you can make queries by calling::
 
 	int dns_query(const char *type, const char *name, size_t namelen,
 		     const char *options, char **_result, time_t *_expiry);
 
-     This is the basic access function.  It looks for a cached DNS query and if
-     it doesn't find it, it upcalls to userspace to make a new DNS query, which
-     may then be cached.  The key description is constructed as a string of the
-     form::
+This is the basic access function.  It looks for a cached DNS query and if
+it doesn't find it, it upcalls to userspace to make a new DNS query, which
+may then be cached.  The key description is constructed as a string of the
+form::
 
 		[<type>:]<name>
 
-     where <type> optionally specifies the particular upcall program to invoke,
-     and thus the type of query to do, and <name> specifies the string to be
-     looked up.  The default query type is a straight hostname to IP address
-     set lookup.
+where <type> optionally specifies the particular upcall program to invoke,
+and thus the type of query to do, and <name> specifies the string to be
+looked up.  The default query type is a straight hostname to IP address
+set lookup.
 
-     The name parameter is not required to be a NUL-terminated string, and its
-     length should be given by the namelen argument.
+The name parameter is not required to be a NUL-terminated string, and its
+length should be given by the namelen argument.
 
-     The options parameter may be NULL or it may be a set of options
-     appropriate to the query type.
+The options parameter may be NULL or it may be a set of options
+appropriate to the query type.
 
-     The return value is a string appropriate to the query type.  For instance,
-     for the default query type it is just a list of comma-separated IPv4 and
-     IPv6 addresses.  The caller must free the result.
+The return value is a string appropriate to the query type.  For instance,
+for the default query type it is just a list of comma-separated IPv4 and
+IPv6 addresses.  The caller must free the result.
 
-     The length of the result string is returned on success, and a negative
-     error code is returned otherwise.  -EKEYREJECTED will be returned if the
-     DNS lookup failed.
+The length of the result string is returned on success, and a negative
+error code is returned otherwise.  -EKEYREJECTED will be returned if the
+DNS lookup failed.
 
-     If _expiry is non-NULL, the expiry time (TTL) of the result will be
-     returned also.
+If _expiry is non-NULL, the expiry time (TTL) of the result will be
+returned also.
 
 The kernel maintains an internal keyring in which it caches looked up keys.
 This can be cleared by any process that has the CAP_SYS_ADMIN capability by
-- 
An old man doll... just what I always wanted! - Clara
Re: [PATCH net-next 2/3] net: dns_resolver: Move dns_query() explanation out of code block
Posted by Simon Horman 1 week, 1 day ago
On Mon, Sep 22, 2025 at 04:56:47PM +0700, Bagas Sanjaya wrote:
> Documentation for dns_query() is placed in the function's literal code
> block snippet instead. Move it out of there.
> 
> Fixes: 9dfe1361261b ("docs: networking: convert dns_resolver.txt to ReST")
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>

Thanks, this renders much better. In a browser at least.

I've added a few comments below.

> ---
>  Documentation/networking/dns_resolver.rst | 45 +++++++++++------------
>  1 file changed, 22 insertions(+), 23 deletions(-)
> 
> diff --git a/Documentation/networking/dns_resolver.rst b/Documentation/networking/dns_resolver.rst
> index 5cec37bedf9950..329fb21d005ccd 100644
> --- a/Documentation/networking/dns_resolver.rst
> +++ b/Documentation/networking/dns_resolver.rst
> @@ -64,44 +64,43 @@ before the more general line given above as the first match is the one taken::
>  Usage
>  =====
>  
> -To make use of this facility, one of the following functions that are
> -implemented in the module can be called after doing::
> +To make use of this facility, the appropriate header must be included first::

Maybe: ..., first linux/dns_resolver.h must be included.

>  
>  	#include <linux/dns_resolver.h>
>  
> -     ::
> +Then you can make queries by calling::

Please use imperative mood:

Then queries may be made by calling::

>  
>  	int dns_query(const char *type, const char *name, size_t namelen,
>  		     const char *options, char **_result, time_t *_expiry);
>  
> -     This is the basic access function.  It looks for a cached DNS query and if
> -     it doesn't find it, it upcalls to userspace to make a new DNS query, which
> -     may then be cached.  The key description is constructed as a string of the
> -     form::
> +This is the basic access function.  It looks for a cached DNS query and if
> +it doesn't find it, it upcalls to userspace to make a new DNS query, which
> +may then be cached.  The key description is constructed as a string of the
> +form::
>  
>  		[<type>:]<name>
>  
> -     where <type> optionally specifies the particular upcall program to invoke,
> -     and thus the type of query to do, and <name> specifies the string to be
> -     looked up.  The default query type is a straight hostname to IP address
> -     set lookup.
> +where <type> optionally specifies the particular upcall program to invoke,
> +and thus the type of query to do, and <name> specifies the string to be

I think while we are here "to do" could be removed.
But maybe that's just me.

> +looked up.  The default query type is a straight hostname to IP address
> +set lookup.

...
Re: [PATCH net-next 2/3] net: dns_resolver: Move dns_query() explanation out of code block
Posted by Randy Dunlap 1 week ago
Hi,

On 9/23/25 3:14 AM, Simon Horman wrote:
> On Mon, Sep 22, 2025 at 04:56:47PM +0700, Bagas Sanjaya wrote:
>> Documentation for dns_query() is placed in the function's literal code
>> block snippet instead. Move it out of there.
>>
>> Fixes: 9dfe1361261b ("docs: networking: convert dns_resolver.txt to ReST")
>> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
> 
> Thanks, this renders much better. In a browser at least.Hi
> 
> I've added a few comments below.
> 
>> ---
>>   Documentation/networking/dns_resolver.rst | 45 +++++++++++------------
>>   1 file changed, 22 insertions(+), 23 deletions(-)
>>
>> diff --git a/Documentation/networking/dns_resolver.rst b/Documentation/networking/dns_resolver.rst
>> index 5cec37bedf9950..329fb21d005ccd 100644
>> --- a/Documentation/networking/dns_resolver.rst
>> +++ b/Documentation/networking/dns_resolver.rst
>> @@ -64,44 +64,43 @@ before the more general line given above as the first match is the one taken::
>>   Usage
>>   =====
>>   
>> -To make use of this facility, one of the following functions that are
>> -implemented in the module can be called after doing::
>> +To make use of this facility, the appropriate header must be included first::
> 
> Maybe: ..., first linux/dns_resolver.h must be included.
> 
>>   
>>   	#include <linux/dns_resolver.h>
>>   
>> -     ::
>> +Then you can make queries by calling::
> 
> Please use imperative mood:
> 
> Then queries may be made by calling::
> 

I think imperative mood would be more like:

   Then make queries by calling::

but I'm not asking for a v3 patch.


-- 
~Randy
Re: [PATCH net-next 2/3] net: dns_resolver: Move dns_query() explanation out of code block
Posted by Bagas Sanjaya 1 week, 1 day ago
On Tue, Sep 23, 2025 at 11:14:56AM +0100, Simon Horman wrote:
> On Mon, Sep 22, 2025 at 04:56:47PM +0700, Bagas Sanjaya wrote:
> > Documentation for dns_query() is placed in the function's literal code
> > block snippet instead. Move it out of there.
> > 
> > Fixes: 9dfe1361261b ("docs: networking: convert dns_resolver.txt to ReST")
> > Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
> 
> Thanks, this renders much better. In a browser at least.
> 
> I've added a few comments below.
> 
> > ---
> >  Documentation/networking/dns_resolver.rst | 45 +++++++++++------------
> >  1 file changed, 22 insertions(+), 23 deletions(-)
> > 
> > diff --git a/Documentation/networking/dns_resolver.rst b/Documentation/networking/dns_resolver.rst
> > index 5cec37bedf9950..329fb21d005ccd 100644
> > --- a/Documentation/networking/dns_resolver.rst
> > +++ b/Documentation/networking/dns_resolver.rst
> > @@ -64,44 +64,43 @@ before the more general line given above as the first match is the one taken::
> >  Usage
> >  =====
> >  
> > -To make use of this facility, one of the following functions that are
> > -implemented in the module can be called after doing::
> > +To make use of this facility, the appropriate header must be included first::
> 
> Maybe: ..., first linux/dns_resolver.h must be included.
> 
> >  
> >  	#include <linux/dns_resolver.h>
> >  
> > -     ::
> > +Then you can make queries by calling::
> 
> Please use imperative mood:
> 
> Then queries may be made by calling::
> 
> >  
> >  	int dns_query(const char *type, const char *name, size_t namelen,
> >  		     const char *options, char **_result, time_t *_expiry);
> >  
> > -     This is the basic access function.  It looks for a cached DNS query and if
> > -     it doesn't find it, it upcalls to userspace to make a new DNS query, which
> > -     may then be cached.  The key description is constructed as a string of the
> > -     form::
> > +This is the basic access function.  It looks for a cached DNS query and if
> > +it doesn't find it, it upcalls to userspace to make a new DNS query, which
> > +may then be cached.  The key description is constructed as a string of the
> > +form::
> >  
> >  		[<type>:]<name>
> >  
> > -     where <type> optionally specifies the particular upcall program to invoke,
> > -     and thus the type of query to do, and <name> specifies the string to be
> > -     looked up.  The default query type is a straight hostname to IP address
> > -     set lookup.
> > +where <type> optionally specifies the particular upcall program to invoke,
> > +and thus the type of query to do, and <name> specifies the string to be
> 
> I think while we are here "to do" could be removed.
> But maybe that's just me.
> 
> > +looked up.  The default query type is a straight hostname to IP address
> > +set lookup.
> 
> ...

Thanks for the wording suggestions! I'll apply them in v2.

-- 
An old man doll... just what I always wanted! - Clara