On 12/16/19 10:26 PM, Wenbo Zhang wrote: >>> + * - a regular full path (include mountable fs eg: /proc, /sys) >>> + * - a regular full path with "(deleted)" at the end. > >> Let us say with " (deleted)" is appended to be consistent with comments >> in d_path() and is more clear to user what the format will looks like. > > Thank you, I'll fix this. > >>> + ret = strlen(p); >>> + memmove(dst, p, ret); >>> + dst[ret++] = '\0'; > >> nit: you could do memmove(dst, p, ret + 1)? > > I did with `dst[ret++]='\0';` to return value length including > trailing '\0'. as you mentioned below: > >>> + fput(f); >>> + return ret; > >> The description says the return value length including trailing '\0'. >> The above 'ret' does not include trailing '\0'. > > It seems `[ret++]` not very clear to read and '\0' can be done by > `memmove`. I think I'll refactor to > > ``` > ret = strlen(p) + 1; > memmove(dst, p, ret); > fput(f); > return ret; > ``` > > Is this better? Ah, I missed ret++ in dst[ret++]. Indeed the above code is better.