<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">For reference, description of how this method works:<div>The target inode's nid is saved in a custom context that's used for the rest of the path search. Buffer offset (pos) is set to 0.</div><div>The function starts a recursive traversal from the root node, always altering the offset in the buffer for the next inode in path (without writing yet).</div><div>Recursion continues until the target nid is reached, then:</div><div>1. The inode's name is written to the buffer at the last remembered offset, in the form of: '/' + <inode name> + NUL</div><div>2. A custom return code EROFS_PATHNAME_FOUND is returned which causes the whole recursion to stop</div><div>3. Parent inode writes the node's name in the form: '/' + <dir inode name>, then also returns EROFS_PATHNAME_FOUND.</div><div>This is repeated per recursion level, until the first callback has returned.</div><div>Demo of the buffer changes (? = undefined data in the buffer, $ = null byte that marks end-of-string):</div><div><br></div><div><div><font face="monospace">?????????????????????????????????????????????????? (initial buffer)</font></div><div><font face="monospace">?????????????????????????????/firmware$??????????? (target inode found, write and break recursion)</font></div><div><font face="monospace">??????????????????????/vendor/firmware$??????????? (1st parent dir inode)</font></div><div><font face="monospace">?????????????/readonly/vendor/firmware$??????????? </font><span style="font-family:monospace">(2nd </span><span style="font-family:monospace">parent</span><span style="font-family:monospace"> </span><span style="font-family:monospace">dir inode)</span></div><div><font face="monospace">????????/adsp/readonly/vendor/firmware$??????????? </font><span style="font-family:monospace">(3rd </span><span style="font-family:monospace">parent</span><span style="font-family:monospace"> </span><span style="font-family:monospace">dir inode)</span></div><div><font face="monospace">????/mdm/adsp/readonly/vendor/firmware$??????????? </font><span style="font-family:monospace">(4th parent dir inode)</span></div><div><font face="monospace">/rfs/mdm/adsp/readonly/vendor/firmware$??????????? </font><span style="font-family:monospace">(last parent dir inode, function returns)</span></div></div></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 17 Dec 2021 at 16:20, Igor Eisberg <<a href="mailto:igoreisberg@gmail.com">igoreisberg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 17 Dec 2021 at 14:30, Igor Eisberg <<a href="mailto:igoreisberg@gmail.com" target="_blank">igoreisberg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br></div>
</blockquote></div>
</blockquote></div>