Re: [ndctl PATCH v3 1/7] libcxl: Add debugfs path to CXL context

Cheatham, Benjamin
2025-10-23T20:15:16Z

Hi Dave, thanks for taking a look!

On 10/21/2025 5:55 PM, Dave Jiang wrote:
>
>
> On 10/21/25 11:31 AM, Ben Cheatham wrote:
>> Find the CXL debugfs mount point and add it to the CXL library context.
>> This will be used by poison and procotol error library functions to
>> access the information presented by the filesystem.
>>
>> Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
>> ---
>> cxl/lib/libcxl.c | 40 ++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 40 insertions(+)
>>
>> diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
>> index cafde1c..ea5831f 100644
>> --- a/cxl/lib/libcxl.c
>> +++ b/cxl/lib/libcxl.c
>> @@ -54,6 +54,7 @@ struct cxl_ctx {
>> struct kmod_ctx *kmod_ctx;
>> struct daxctl_ctx *daxctl_ctx;
>> void *private_data;
>> + const char *debugfs;
>> };
>>
>> static void free_pmem(struct cxl_pmem *pmem)
>> @@ -240,6 +241,43 @@ CXL_EXPORT void *cxl_get_private_data(struct cxl_ctx *ctx)
>> return ctx->private_data;
>> }
>>
>> +static char *get_debugfs_dir(void)
>
> const char *?
>

Will do

>
> Also maybe get_debugfs_dir_path()
>
>> +{
>> + char *dev, *dir, *type, *ret = NULL;
>
> 'debugfs_dir' rather than 'ret' would be clearer to read.
>

Makes sense, I'll change it.