Re: git: 19f073c612af - main - new-bus: Add resource_validate_map_request function

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 24 Nov 2023 18:21:22 UTC
On 11/23/23 9:41 AM, Mitchell Horne wrote:
> 
> 
> On 11/23/23 13:07, John Baldwin wrote:
>> The branch main has been updated by jhb:
>>
>> URL: https://cgit.FreeBSD.org/src/commit/?id=19f073c612afa0111d216e5ccab9525bfc97ec32
>>
>> commit 19f073c612afa0111d216e5ccab9525bfc97ec32
>> Author:     John Baldwin <jhb@FreeBSD.org>
>> AuthorDate: 2023-11-23 17:06:24 +0000
>> Commit:     John Baldwin <jhb@FreeBSD.org>
>> CommitDate: 2023-11-23 17:06:24 +0000
>>
>>       new-bus: Add resource_validate_map_request function
>>       
>>       This helper function for BUS_MAP_RESOURCE performs common argument
>>       validation.
>>       
>>       Reviewed by:    imp
>>       Differential Revision:  https://reviews.freebsd.org/D42723
>> ---
>>    sys/kern/subr_bus.c | 31 +++++++++++++++++++++++++++++++
>>    sys/sys/bus.h       |  6 +++++-
>>    2 files changed, 36 insertions(+), 1 deletion(-)
>>
>> diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
>> index 648394abd026..80fe182eab56 100644
>> --- a/sys/kern/subr_bus.c
>> +++ b/sys/kern/subr_bus.c
>> @@ -2715,6 +2715,37 @@ resource_init_map_request_impl(struct resource_map_request *args, size_t sz)
>>    	args->memattr = VM_MEMATTR_DEVICE;
>>    }
>>    
>> +int
>> +resource_validate_map_request(struct resource *r,
>> +    struct resource_map_request *in, struct resource_map_request *out,
>> +    rman_res_t *startp, rman_res_t *lengthp)
> 
> Can the function be given a top-level comment stating its purpose? This
> file does a really good job providing this for the majority of its
> public functions.
> 
> Sorry to ask post-commit, but I did not see the review.

Sure.  I also hope to write a manpage for bus_generic_rl_* (and bus_get_resource_list)
along with a second manpage for bus_generic_rman_* (and bus_get_rman) describing when
they should be used.  A manpage for resource_list_* might also be nice to write, but
possibly a bit more work.

-- 
John Baldwin