On 12/10/2025 12:19 PM, Dave Jiang wrote:
> 
> 
> On 12/9/25 10:13 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 <[email protected]>
>> ---
>>  cxl/lib/libcxl.c | 40 ++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 40 insertions(+)
>>
>> diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
>> index cafde1c..3718b76 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 const char *get_debugfs_dir(void)
> 
> I would suggest taking a look at setmntent()/getmntent() usages. Probably 
> easier than trying to open code this and do it yourself here. You should be 
> able to pass "/proc/mounts" to setmntent() and then do everything through a 
> loop of getmntent().
> 

Yeah that seems easier. I'll take a look for v5.

Reply via email to