<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:09:55 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-7557] Add fid_to_string and string_to_fid functions</title>
                <link>https://jira.whamcloud.com/browse/LU-7557</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;Add fid_to_string and string_to_fid functions for more readable print/scan statements.  Allow for error checking, defaults, etc.&lt;/p&gt;

&lt;p&gt;Example print statement:&lt;/p&gt;

&lt;p&gt;Original: C_DEBUG(D_PAGE, &quot;%lu@&quot;DFID&quot; %p %lx %d\n&quot;,&lt;br/&gt;
               idx, PFID(&amp;amp;hdr-&amp;gt;coh_lu.loh_fid), vmpage, vmpage-&amp;gt;private, type);&lt;/p&gt;

&lt;p&gt;New: C_DEBUG(D_PAGE, &quot;%lu@%s %p %lx %d\n&quot;,&lt;br/&gt;
               idx, fid_to_string(hdr-&amp;gt;coh_lu.loh_fid), vmpage, vmpage-&amp;gt;private, type);&lt;/p&gt;

&lt;p&gt;Example scan:&lt;/p&gt;

&lt;p&gt;Original: if (sscanf(opt.o_src, SFID, RFID(&amp;amp;old_fid)) != 3 || ...&lt;/p&gt;

&lt;p&gt;New: &lt;br/&gt;
old_fid = string_to_fid(opt.o_src); &lt;br/&gt;
if ( ...&lt;/p&gt;</description>
                <environment></environment>
        <key id="33706">LU-7557</key>
            <summary>Add fid_to_string and string_to_fid functions</summary>
                <type id="4" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11310&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="1" iconUrl="https://jira.whamcloud.com/images/icons/statuses/open.png" description="The issue is open and ready for the assignee to start work on it.">Open</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="bevans">Ben Evans</assignee>
                                    <reporter username="bevans">Ben Evans</reporter>
                        <labels>
                    </labels>
                <created>Tue, 15 Dec 2015 16:30:34 +0000</created>
                <updated>Wed, 3 Feb 2016 16:23:57 +0000</updated>
                                                                                <due></due>
                            <votes>0</votes>
                                    <watches>6</watches>
                                                                            <comments>
                            <comment id="136358" author="bevans" created="Tue, 15 Dec 2015 16:34:55 +0000"  >&lt;p&gt;Offshoot from discussion of &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-5011&quot; title=&quot;lustre_idl.h again does not compile in user space&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-5011&quot;&gt;&lt;del&gt;LU-5011&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="136364" author="simmonsja" created="Tue, 15 Dec 2015 16:39:43 +0000"  >&lt;p&gt;Yes please do this. The upstream reviewers hate macros so replacing this with inline functions would be the way to go.&lt;/p&gt;</comment>
                            <comment id="136395" author="rread" created="Tue, 15 Dec 2015 18:50:33 +0000"  >&lt;p&gt;The caller should be managing memory for fid_to_string, and you&apos;&apos;ll need handle bad strings in string_to_fid, so how about  these prototypes:&lt;/p&gt;

&lt;p&gt;int fid_to_string(const struct lu_fid *fid, char * str, size_t length);&lt;br/&gt;
int string_to_fid(char * str, struct lu_fid *fid);&lt;/p&gt;

&lt;p&gt;To keep things simple I suggest that fid_to_string should not include the braces, and let applications add the braces where needed. &lt;/p&gt;</comment>
                            <comment id="136405" author="bevans" created="Tue, 15 Dec 2015 19:17:50 +0000"  >&lt;p&gt;I was thinking:&lt;/p&gt;

&lt;p&gt;const str* fid_to_string(const struct lu_fid &lt;b&gt;fid, str&lt;/b&gt; string, int sz);  &lt;/p&gt;

&lt;p&gt;struct lu_fid string_to_fid(char* fidstr);&lt;/p&gt;

&lt;p&gt;I&apos;m fine with the nobraces version.&lt;/p&gt;

&lt;p&gt;99% of all the uses of this are going to be for printk statements, and all but one place where fids are read in.&lt;/p&gt;</comment>
                            <comment id="136439" author="rread" created="Tue, 15 Dec 2015 21:55:32 +0000"  >&lt;p&gt;If these are going to be library functions then there will be more uses than just what you can find in the Lustre tree. We need to be able to handle whatever is thrown at us from external applications. &lt;/p&gt;

&lt;p&gt;Returning a pointer to the passed in buffer is reasonable for fid_to_string, just make sure to handle case when the buffer is too small in a sane way. &lt;/p&gt;

&lt;p&gt;I would prefer an actual return code from string_to_fid so applications using this can deal with garbage as early as possible.&lt;/p&gt;</comment>
                            <comment id="136551" author="bevans" created="Wed, 16 Dec 2015 16:15:07 +0000"  >&lt;p&gt;I was thinking it should look like atoi and itoa&lt;/p&gt;</comment>
                            <comment id="136578" author="rread" created="Wed, 16 Dec 2015 17:14:50 +0000"  >&lt;p&gt;Well, atoi does no error checking and is essentially the poster child for what not to do. There is strtol which does check errors,  but with an overly complex &lt;a href=&quot;http://www.gnu.org/software/libc/manual/html_node/Parsing-of-Integers.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;interface&lt;/a&gt; for our needs. &lt;/p&gt;

&lt;p&gt;Instead of returning the error code (which seems the most conventional to me), another option is to pass  &amp;amp;error to the string_to_fid(). &lt;/p&gt;
</comment>
                            <comment id="136580" author="simmonsja" created="Wed, 16 Dec 2015 17:17:48 +0000"  >&lt;p&gt;Just as a note I had discussion with Greg about the policy of UAPI type headers. What I was told was UAPI headers, ones shared between kernel and user space, should only contain data structure or simple defines. No functions should be used in UAPI headers. &lt;/p&gt;</comment>
                            <comment id="136598" author="bevans" created="Wed, 16 Dec 2015 19:25:14 +0000"  >&lt;p&gt;I think we&apos;ve got more flexability with str_to_fid in terms of return and fields than fid_to_str.&lt;/p&gt;

&lt;p&gt;But yes, error checking is a good thing here.&lt;/p&gt;</comment>
                            <comment id="136749" author="rread" created="Thu, 17 Dec 2015 19:24:18 +0000"  >&lt;p&gt;James, that&apos;s right and also there shouldn&apos;t be any inline functions in GPL headers intended to be used by non-GPL code. &lt;/p&gt;</comment>
                            <comment id="137396" author="adilger" created="Thu, 24 Dec 2015 09:53:09 +0000"  >&lt;p&gt;I agree with Robert here. Having an explicit error returned from string_to_fid() is needed to make the error handling reasonable. It might make sense to have a separate fid_to_string_br() or something that prints the standard square brackets around the FID, or it will make for a lot of &quot;&lt;span class=&quot;error&quot;&gt;&amp;#91;%s&amp;#93;&lt;/span&gt;&quot; in the code, and easy to miss those and have inconsistent output. &lt;/p&gt;</comment>
                            <comment id="138541" author="gerrit" created="Mon, 11 Jan 2016 19:15:36 +0000"  >&lt;p&gt;Ben Evans (bevans@cray.com) uploaded a new patch: &lt;a href=&quot;http://review.whamcloud.com/17933&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/17933&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-7557&quot; title=&quot;Add fid_to_string and string_to_fid functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-7557&quot;&gt;LU-7557&lt;/a&gt; headers: add fid_to_str and str_to_fid&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: fc8efddcdf460b40a61acb83da86ed6cf8ae4689&lt;/p&gt;</comment>
                            <comment id="141003" author="bevans" created="Wed, 3 Feb 2016 16:23:57 +0000"  >&lt;p&gt;Started based on comments in: &lt;a href=&quot;https://jira.hpdd.intel.com/browse/LU-5011&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://jira.hpdd.intel.com/browse/LU-5011&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzxvx3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>