<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:18:07 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-1606] lustre_idl.h does not compile in user-space</title>
                <link>https://jira.whamcloud.com/browse/LU-1606</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;lustre_idl.h is mentioned (most likely incorrectly) in several examples in the Lustre manual.  I&apos;ve opened a lustre doc bug on that.&lt;/p&gt;

&lt;p&gt;But is clear now that lustre_idl.h will not compile at all in user-space on Linux due to the lack of LPU64 and LPX64 definitions:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$ gcc -o example example.c
In file included from example.c:7:
/usr/include/lustre/lustre_idl.h:98:58: error: libcfs/libcfs.h: No such file or directory
In file included from example.c:7:
/usr/include/lustre/lustre_idl.h: In function &apos;fid_ostid_unpack&apos;:
/usr/include/lustre/lustre_idl.h:548: error: expected &apos;)&apos; before &apos;LPU64&apos;
/usr/include/lustre/lustre_idl.h:560: error: expected &apos;)&apos; before &apos;LPU64&apos;
/usr/include/lustre/lustre_idl.h:573: error: expected &apos;)&apos; before &apos;LPU64&apos;
/usr/include/lustre/lustre_idl.h:582: error: expected &apos;)&apos; before &apos;LPU64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;fid_ostid_pack&apos;:
/usr/include/lustre/lustre_idl.h:584: error: expected &apos;)&apos; before &apos;LPX64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;ostid_seq&apos;:
/usr/include/lustre/lustre_idl.h:631: error: expected &apos;)&apos; before &apos;LPU64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;fid_cpu_to_le&apos;:
/usr/include/lustre/lustre_idl.h:700: error: expected &apos;)&apos; before &apos;LPX64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;fid_le_to_cpu&apos;:
/usr/include/lustre/lustre_idl.h:715: error: expected &apos;)&apos; before &apos;LPX64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;fid_cpu_to_be&apos;:
/usr/include/lustre/lustre_idl.h:724: error: expected &apos;)&apos; before &apos;LPX64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;fid_be_to_cpu&apos;:
/usr/include/lustre/lustre_idl.h:739: error: expected &apos;)&apos; before &apos;LPX64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;lu_fid_eq&apos;:
/usr/include/lustre/lustre_idl.h:765: error: expected &apos;)&apos; before &apos;LPX64&apos;
/usr/include/lustre/lustre_idl.h:766: error: expected &apos;)&apos; before &apos;LPX64&apos;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Should lustre_idl.h even be installed in /usr/include/lustre?  If so we need to deal with the missing definitions.&lt;/p&gt;

&lt;p&gt;I see that darwin&apos;s lustre_usr.h has a copy of the definitions, but for linux they are only in kp30.h, which is not part of user-space.&lt;/p&gt;</description>
                <environment></environment>
        <key id="15151">LU-1606</key>
            <summary>lustre_idl.h does not compile in user-space</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.whamcloud.com/images/icons/priorities/critical.svg">Critical</priority>
                        <status id="6" iconUrl="https://jira.whamcloud.com/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="1">Fixed</resolution>
                                        <assignee username="jhammond">John Hammond</assignee>
                                    <reporter username="morrone">Christopher Morrone</reporter>
                        <labels>
                            <label>mq313</label>
                    </labels>
                <created>Thu, 5 Jul 2012 20:13:45 +0000</created>
                <updated>Thu, 10 Dec 2015 17:45:12 +0000</updated>
                            <resolved>Tue, 6 May 2014 18:03:43 +0000</resolved>
                                    <version>Lustre 2.3.0</version>
                    <version>Lustre 2.4.0</version>
                    <version>Lustre 2.1.1</version>
                    <version>Lustre 2.1.3</version>
                    <version>Lustre 2.4.1</version>
                    <version>Lustre 2.5.0</version>
                    <version>Lustre 2.5.1</version>
                                    <fixVersion>Lustre 2.4.0</fixVersion>
                    <fixVersion>Lustre 2.5.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>15</watches>
                                                                            <comments>
                            <comment id="41544" author="morrone" created="Thu, 5 Jul 2012 20:16:34 +0000"  >&lt;p&gt;I see that LOV_MAX_STRIPE_COUNT is currently defined in lustre_idl.h, and users probably need to know that.&lt;/p&gt;</comment>
                            <comment id="41581" author="pjones" created="Sun, 8 Jul 2012 02:41:45 +0000"  >&lt;p&gt;Minh&lt;/p&gt;

&lt;p&gt;Could you please look into this one?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;</comment>
                            <comment id="41616" author="rhenwood" created="Mon, 9 Jul 2012 14:12:46 +0000"  >&lt;p&gt;Hi Peter,&lt;/p&gt;

&lt;p&gt;I&apos;ve chatted to Minh and Andreas and I&apos;m going to follow up on the work I did on this topic and recorded on the related Issues.&lt;/p&gt;</comment>
                            <comment id="41621" author="rhenwood" created="Mon, 9 Jul 2012 16:10:07 +0000"  >&lt;p&gt;The first example I&apos;m working on is this:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;#include &amp;lt;sys/vfs.h&amp;gt;
#include &amp;lt;config.h&amp;gt;
#include &amp;lt;liblustre.h&amp;gt;


&lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; inline &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; maxint(&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; a, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; b)
{
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; a &amp;gt; b ? a : b;
}

&lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; void *alloc_lum()
{
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; lmmsize = sizeof(struct lov_user_md_v3) +
                LOV_MAX_STRIPE_COUNT * sizeof(struct lov_user_ost_data_v1);
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; malloc(lmmsize);
}

&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; main(&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; argc, &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt;** argv)
{
        struct lov_user_md *lum_file = NULL;
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; rc;
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; lum_size;

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (argc != 2) {
                fprintf(stderr, &lt;span class=&quot;code-quote&quot;&gt;&quot;Usage: %s &amp;lt;filename&amp;gt;\n&quot;&lt;/span&gt;, argv[0]);
                &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; 1;
        }

        lum_file = alloc_lum();
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (lum_file == NULL) {
                rc = ENOMEM;
                &lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; cleanup;
        }

        rc = llapi_file_get_stripe(argv[1], lum_file);
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (rc) {
                rc = errno;
                &lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; cleanup;
        }

        &lt;span class=&quot;code-comment&quot;&gt;/* stripe_size stripe_count */&lt;/span&gt;
        printf(&lt;span class=&quot;code-quote&quot;&gt;&quot;stripe_size=%d, stripe_count=%d\n&quot;&lt;/span&gt;,
               lum_file-&amp;gt;lmm_stripe_size,
               lum_file-&amp;gt;lmm_stripe_count);

cleanup:
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (lum_file != NULL)
                free(lum_file);

        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; rc;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The preconditions to compiling this are:&lt;/p&gt;

&lt;h2&gt;&lt;a name=&quot;1.RPMsneedtobeinstalled&quot;&gt;&lt;/a&gt;1. RPMs need to be installed&lt;/h2&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;lustre-client-2.1.2-2.6.32_220.17.1.el6.x86_64.x86_64
lustre-client-modules-2.1.2-2.6.32_220.17.1.el6.x86_64.x86_64
lustre-client-source-2.1.2-2.6.32_220.17.1.el6.x86_64.x86_64
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This seems reasonable.&lt;/p&gt;

&lt;h2&gt;&lt;a name=&quot;2.%7B%7Bconfig.h%7D%7D&quot;&gt;&lt;/a&gt;2. &lt;tt&gt;config.h&lt;/tt&gt;&lt;/h2&gt;

&lt;p&gt;This is created by &lt;tt&gt;/usr/src/lustre-2.1.2/configure&lt;/tt&gt;. This is not included in the client rpms, so I have to generate it. In order to generate it, I need &lt;tt&gt;kernel-devel&lt;/tt&gt; installed.&lt;/p&gt;

&lt;h2&gt;&lt;a name=&quot;Compilingcommand.&quot;&gt;&lt;/a&gt;Compiling command.&lt;/h2&gt;

&lt;p&gt;Once I&apos;ve got &lt;tt&gt;config.h&lt;/tt&gt; I can compile with:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;gcc -o ex1 ex1.c -I/usr/src/lustre-2.1.2/{lustre,lnet,libcfs}/include -I/usr/src/lustre-2.1.2/ -llustreapi
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;Brian, I feel you can cast judgement. Can and should &lt;tt&gt;config.h&lt;/tt&gt; be included in the built RPMs to avoid the additional steps to generate it on the client?&lt;/p&gt;</comment>
                            <comment id="41629" author="morrone" created="Mon, 9 Jul 2012 16:51:17 +0000"  >&lt;p&gt;I&apos;m sorry, this is not the way to go about making examples for user-space applications.&lt;/p&gt;

&lt;p&gt;Here&apos;s what you have to work with in user-space:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$ rpm -ql lustre |grep -e &quot;include.*h&quot;
/usr/include/libcfs/posix/posix-types.h
/usr/include/linux/lustre_user.h
/usr/include/lustre/libiam.h
/usr/include/lustre/liblustreapi.h
/usr/include/lustre/ll_fiemap.h
/usr/include/lustre/lustre_idl.h
/usr/include/lustre/lustre_user.h
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You should definitely not have either config.h or liblustre.h in your example.&lt;/p&gt;

&lt;p&gt;Frankly, our headers are named quite badly.  I would have preferred that we have a single &quot;lustre/lustre.h&quot; header for users, or something like that.  But I we&apos;re stuck with it for now, I suppose.&lt;/p&gt;

&lt;p&gt;Of the listed files, I would argue that only one or both of the following should be used for most examples:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;/usr/include/lustre/lustre_user.h
/usr/include/lustre/liblustreapi.h
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Some examples will require additional headers.  For instance, for your example we would need&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;/usr/include/lustre/lustre_idl.h&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;in order to get the definition of LOV_MAX_STRIPE_COUNT.&lt;/p&gt;

&lt;p&gt;Further, the &quot;alloc_lum&quot; is not a great example because it it is version-dependent.  I just went through this with one of our users, and created the following function that might work better:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;struct lov_user_md *alloc_lov_user_md(&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; stripe_count)
{
    size_t size;
    struct lov_user_md *ptr;

    size = sizeof(struct lov_user_md)
           + (sizeof(*(ptr-&amp;gt;lmm_objects)) * stripe_count);
    ptr = (struct lov_user_md *)malloc(size);

    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; ptr;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I&apos;m not a fan of the variable name here:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;struct lov_user_md *lum_file = NULL;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you made it just &quot;lum&quot;, instead of &quot;lum_file&quot;, I would be fine with it.&lt;/p&gt;

&lt;p&gt;Your &quot;maxint&quot; function isn&apos;t used, so should be removed.&lt;/p&gt;

&lt;p&gt;Also, the compilation command is too long.  The header files that you actually need are already in the standard location.  But fixing that will naturally follow from using the correct headers, instead of trying to pull files out of the lustre source tree.&lt;/p&gt;

&lt;p&gt;This would be easier to review if it was in gerrit.&lt;/p&gt;

&lt;p&gt;Finally, this discussion is probably in the wrong jira ticket, since this ticket is about lustre_idl.h failing to compile in user-space.&lt;/p&gt;</comment>
                            <comment id="41632" author="rhenwood" created="Mon, 9 Jul 2012 17:02:18 +0000"  >&lt;p&gt;Thanks for your rapid and detailed response Chris. I&apos;ll work through your suggestions.&lt;/p&gt;</comment>
                            <comment id="41835" author="rhenwood" created="Fri, 13 Jul 2012 17:37:16 +0000"  >&lt;p&gt;Hi Chris;&lt;/p&gt;

&lt;p&gt;In the absence of a &lt;tt&gt;lustre-client-devel.rpm&lt;/tt&gt;, I have found it necessary to install &lt;tt&gt;lustre-client-source.rpm&lt;/tt&gt; to build on the client. &lt;tt&gt;lustre-client-source.rpm&lt;/tt&gt; provides a load of useful headers into &lt;tt&gt;/usr/src/lustre-2.1.2/&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;I&apos;m performing the following tests:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$ gcc -c ./lustre_idl.h -I/usr/src/lustre-2.1.2/{libcfs,lnet}/include/
In file included from /usr/src/lustre-2.1.2/libcfs/include/libcfs/libcfs_private.h:46,
                 from /usr/src/lustre-2.1.2/libcfs/include/libcfs/libcfs.h:308,
                 from ./lustre_idl.h:98:
/usr/src/lustre-2.1.2/lnet/include/lnet/types.h:282:3: error: #error &quot;LNET_MAX_PAYLOAD must be defined in config.h&quot;
$
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;With the headers provided by &lt;tt&gt;lustre-client-source.rpm&lt;/tt&gt;, this compiles through to needing &lt;tt&gt;LNET_MAX_PAYLOAD&lt;/tt&gt; - which is defined in &lt;tt&gt;/usr/src/lustre-2.1.2/config.h&lt;/tt&gt;.&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$ gcc -c ./lustre_user.h -I/usr/src/lustre-2.1.2/{libcfs,lnet}/include/
In file included from ./lustre_user.h:52:
/usr/include/lustre/ll_fiemap.h:111: error: expected &#8216;=&#8217;, &#8216;,&#8217;, &#8216;;&#8217;, &#8216;asm&#8217; or &#8216;__attribute__&#8217; before &#8216;fiemap_count_to_size&#8217;
/usr/include/lustre/ll_fiemap.h:117: error: expected &#8216;)&#8217; before &#8216;array_size&#8217;
./lustre_user.h: In function &#8216;hai_dump_data_field&#8217;:
./lustre_user.h:820: warning: incompatible implicit declaration of built-in function &#8216;snprintf&#8217;
$
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I believe the problem here is that the include of &lt;tt&gt;stddef.h&lt;/tt&gt; to define &lt;tt&gt;size_t&lt;/tt&gt; does not happen. Including &lt;tt&gt;&amp;lt;libcfs/libcfs.h&amp;gt;&lt;/tt&gt; before the include of &lt;tt&gt;lustre/ll_fiemap.h&lt;/tt&gt; resolves the error - and brings us to the &lt;tt&gt;LNET_MAX_PAYLOAD&lt;/tt&gt; definition error.&lt;/p&gt;
</comment>
                            <comment id="41837" author="morrone" created="Fri, 13 Jul 2012 18:56:50 +0000"  >&lt;p&gt;If you are trying to emulate what a normal user would do, you should not be poking into lustre&apos;s internals.  You don&apos;t need a &quot;lustre-client-devel&quot; package, because the headers and libraries that would appear in something like that are already in &quot;lustre-client&quot;, as I mentioned in &lt;a href=&quot;http://jira.whamcloud.com/browse/LU-1606?focusedCommentId=41629&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-41629&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;this comment&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here&apos;s how I would test this:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;hype356:~$ cat idl_example.c
#include &amp;lt;lustre/liblustreapi.h&amp;gt;
#include &amp;lt;lustre/lustre_idl.h&amp;gt;

main() {}
hype356:~$ gcc idl_example.c -llustreapi
In file included from /usr/include/lustre/lustre_user.h:52,
                 from /usr/include/lustre/liblustreapi.h:48,
                 from idl_example.c:1:
/usr/include/lustre/ll_fiemap.h:111: error: expected &apos;=&apos;, &apos;,&apos;, &apos;;&apos;, &apos;asm&apos; or &apos;__attribute__&apos; before &apos;fiemap_count_to_size&apos;
/usr/include/lustre/ll_fiemap.h:117: error: expected &apos;)&apos; before &apos;array_size&apos;
In file included from idl_example.c:2:
/usr/include/lustre/lustre_idl.h:98:58: error: libcfs/libcfs.h: No such file or directory
In file included from idl_example.c:2:
/usr/include/lustre/lustre_idl.h: In function &apos;fid_ostid_unpack&apos;:
/usr/include/lustre/lustre_idl.h:548: error: expected &apos;)&apos; before &apos;LPU64&apos;
/usr/include/lustre/lustre_idl.h:550: error: &apos;EBADF&apos; undeclared (first use in this function)
/usr/include/lustre/lustre_idl.h:550: error: (Each undeclared identifier is reported only once
/usr/include/lustre/lustre_idl.h:550: error: for each function it appears in.)
/usr/include/lustre/lustre_idl.h:560: error: expected &apos;)&apos; before &apos;LPU64&apos;
/usr/include/lustre/lustre_idl.h:573: error: expected &apos;)&apos; before &apos;LPU64&apos;
/usr/include/lustre/lustre_idl.h:582: error: expected &apos;)&apos; before &apos;LPU64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;fid_ostid_pack&apos;:
/usr/include/lustre/lustre_idl.h:559: error: expected &apos;)&apos; before &apos;LPX64&apos;
/usr/include/lustre/lustre_idl.h:616: error: &apos;EBADF&apos; undeclared (first use in this function)
/usr/include/lustre/lustre_idl.h: In function &apos;ostid_seq&apos;:
/usr/include/lustre/lustre_idl.h:631: error: expected &apos;)&apos; before &apos;LPU64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;fid_cpu_to_le&apos;:
/usr/include/lustre/lustre_idl.h:700: error: expected &apos;)&apos; before &apos;LPX64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;fid_le_to_cpu&apos;:
/usr/include/lustre/lustre_idl.h:715: error: expected &apos;)&apos; before &apos;LPX64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;fid_cpu_to_be&apos;:
/usr/include/lustre/lustre_idl.h:724: error: expected &apos;)&apos; before &apos;LPX64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;fid_be_to_cpu&apos;:
/usr/include/lustre/lustre_idl.h:739: error: expected &apos;)&apos; before &apos;LPX64&apos;
/usr/include/lustre/lustre_idl.h: In function &apos;lu_fid_eq&apos;:
/usr/include/lustre/lustre_idl.h:765: error: expected &apos;)&apos; before &apos;LPX64&apos;
/usr/include/lustre/lustre_idl.h:766: error: expected &apos;)&apos; before &apos;LPX64&apos;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now the solution here is not to start pulling more and more header files out of lustre.  We need to selectively move definitions and such around until the existing set of user-space headers compile.&lt;/p&gt;

&lt;p&gt;So yes, I think that ll_fiemap.h is missing an include of stddef.h when in user space.  But we should add THAT include, not start including libcfs headers.&lt;/p&gt;

&lt;p&gt;And now back to lustre_idl.h.  This header is really ill suited to being used by users that just want to use use the lustre standard API.  Perhaps we really just need to move the few bits that users will really need (like LOV_MAX_STRIPE_COUNT) into lustre_user.h, and then drop lustre_idl.h from user space.&lt;/p&gt;</comment>
                            <comment id="41946" author="morrone" created="Tue, 17 Jul 2012 18:56:15 +0000"  >&lt;p&gt;It seems clear from some comments in lustre_idl.h itself&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;* ALL structs passing over the wire should be declared here.  Structs
* that are used in interfaces with userspace should go in lustre_user.h.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&lt;span class=&quot;code-comment&quot;&gt;/* Defn&apos;s shared with user-space. */&lt;/span&gt;
#include &amp;lt;lustre/lustre_user.h&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and just by reading the file that folks have not intended for lustre_idl.h to be used in user space.  And yet using certain APIs in user space currently require the inclusion of lustre_idl.h, so it is installed in the standard header location by default.&lt;/p&gt;

&lt;p&gt;Are there a relatively small set of things that we can move from lustre_idl.h into lustre_user.h and cease installing lustre_idl.h?&lt;/p&gt;

&lt;p&gt;We obviously need LOV_MAX_STRIPE_COUNT, because llapi_file_get_stripe() just assumes that the array length will be any size that it needs.  That in turn requires the user to always make the length of the array LOV_MAX_STRIPE_COUNT.&lt;/p&gt;

&lt;p&gt;What else would users need?&lt;/p&gt;

&lt;p&gt;And while we are fixing things, frankly I think we should change the name of the &quot;liblustreapi.h&quot; to &quot;lustreapi.h&quot;.  &quot;liblustre&quot; is name for the lustre client-in-user-space code.  So &quot;liblustreapi&quot; has the unfortunate implication of somehow being an API for that client-in-user-space code.  But its just a general API for getting/setting lustre information.&lt;/p&gt;

&lt;p&gt;We can keep &quot;liblustreapi.h&quot; around for a time for backwards compatibility, but make it nearly empty.  Its only contents would be a comment explaining that it is deprecated, and &quot;#include &amp;lt;lustreapi.h&amp;gt;&quot;.&lt;/p&gt;

</comment>
                            <comment id="41950" author="morrone" created="Tue, 17 Jul 2012 21:25:44 +0000"  >&lt;p&gt;I believe that by including libcfs/libcfs.h we are now violating this rule at the top of lustre_idl.h:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt; * The only other acceptable items in this file are VERY SIMPLE accessor
 * functions to avoid callers grubbing inside the structures, and the
 * prototypes of the swabber functions for each struct.  Nothing that
 * depends on external functions or definitions should be in here.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note especially that last sentence.&lt;/p&gt;

&lt;p&gt;But Ricardo, understandably, added the include of libcfs/libcfs.h in f1eaa63c32d7af5a09b1d9874b0310bad02b1a1f because &quot;lustre_idl.h uses symbols such as LASSERT, CLASSERT, LPUX64, etc&quot;.  Which is exactly why it doesn&apos;t compile in userspace either.&lt;/p&gt;

&lt;p&gt;So it seems like we went the wrong way by adding that include.  We should have backed out the user of external definitions that are violating the rules of lustre_idl.h.  I see that Andreas made a couple of tweaks here in 5351a1ba03e3464f26271216cd266d2cb77b5625, but its not clear to me how he expected LASSERT and LPU64 to be defined in user space normally.&lt;/p&gt;

&lt;p&gt;We can move LOV_MAX_STRIPE_COUNT and a few nearby defines into lustre_user.h.  Then we can drop lustre_idl.h from all user space examples in the manual, and see if there is anything else we need to move to lustre_user.h.  And finally, we might just not install lustre_idl.h (or install an empty stub for backwards compatibility).&lt;/p&gt;

&lt;p&gt;Alternatively, if we really want lustre_idl.h in user space we should back out all of the external definitions that have crept into lustre_idl.h.  Then we should just include lustre_idl.h from lustreapi.h so that the users only need a single include to use the API.&lt;/p&gt;

&lt;p&gt;I&apos;m not wed to any approach yet.  But we definitely need to untangle the user space headers.&lt;/p&gt;</comment>
                            <comment id="41951" author="morrone" created="Tue, 17 Jul 2012 21:36:13 +0000"  >&lt;p&gt;Here are some patches to get us started.  These are completely untested as of yet.&lt;/p&gt;

&lt;p&gt; &lt;a href=&quot;http://review.whamcloud.com/3425&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/3425&lt;/a&gt;&lt;br/&gt;
 &lt;a href=&quot;http://review.whamcloud.com/3426&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/3426&lt;/a&gt;&lt;br/&gt;
 &lt;a href=&quot;http://review.whamcloud.com/3427&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/3427&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="42576" author="rhenwood" created="Wed, 1 Aug 2012 23:10:31 +0000"  >&lt;p&gt;Two of these patches are landed (3425 and 3426.)&lt;/p&gt;

&lt;p&gt;Chris has pointed out that landing of the remaining patch 3427 will invalidate some of the code examples contained in the man pages and manual - so these need to be updated too.&lt;/p&gt;

&lt;p&gt;Some of the man changes and examples are updated in the patch but these haven&apos;t been extensively tested according to Chris. I&apos;m going to review 3427 this patch and identify the impact of the header changes on code examples, man pages, the Manual and tests required to get this landed.&lt;/p&gt;</comment>
                            <comment id="42671" author="rhenwood" created="Fri, 3 Aug 2012 12:18:57 +0000"  >&lt;p&gt;I propose to re-factor the change &lt;a href=&quot;http://review.whamcloud.com/#change,3427&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;3427&lt;/a&gt; and provide a basic api fix change with two associated changes for the c test code and man pages changes.&lt;/p&gt;

&lt;p&gt;The manual update is being tracked in &lt;a href=&quot;http://jira.whamcloud.com/browse/LUDOC-28&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;LUDOC-28&lt;/a&gt; this will be completed after the code changes are landed.&lt;/p&gt;

&lt;p&gt;thoughts?&lt;/p&gt;</comment>
                            <comment id="42682" author="morrone" created="Fri, 3 Aug 2012 14:15:25 +0000"  >&lt;p&gt;What api fix are you proposing?  Why do it in &lt;a href=&quot;http://review.whamcloud.com/#change,3427&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;3427&lt;/a&gt; instead of just adding another commit that builds on 3427?  I like to keep commits simple and clear when possible.  How about we just let 3427 be the header rename, and do further changes in the next commit?&lt;/p&gt;</comment>
                            <comment id="42767" author="rhenwood" created="Mon, 6 Aug 2012 16:21:10 +0000"  >&lt;p&gt;I think you are suggesting moving the test cases and man updates into a dependent commit. This would leave 3427 as basic rename/refactor.&lt;/p&gt;

&lt;p&gt;I think this is a fine idea and I&apos;ll begin work on it.&lt;/p&gt;</comment>
                            <comment id="43230" author="rhenwood" created="Tue, 14 Aug 2012 21:58:32 +0000"  >&lt;p&gt;I am making progress: I have completed a minor refactoring of 3427 to make 3427 just the implementation of lusterapi.h. I am preparing two dependent change-sets: one with the man page updates, another with the updates to the code in ./tests/ that needs updating. There is no new work yet - just Chris&apos;s patches and some testing.&lt;/p&gt;

&lt;p&gt;I am currently looking at &lt;a href=&quot;http://git.whamcloud.com/?p=fs/lustre-release.git;a=blob;f=lustre/tests/ll_dirstripe_verify.c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;./lustre/tests/ll_dirstripe_verify.c&lt;/tt&gt;&lt;/a&gt; which calls &lt;tt&gt;lov_mds_md_size&lt;/tt&gt;. &lt;tt&gt;lov_mds_md_size&lt;/tt&gt; is not exposed by &lt;tt&gt;liblusterapi.c&lt;/tt&gt;. &lt;/p&gt;

&lt;p&gt;I am currently looking into the best way to satisfy the general rule: you only need &lt;tt&gt;lustreapi.h&lt;/tt&gt; and get the &lt;tt&gt;lov_mds_md_size&lt;/tt&gt; functionality. &lt;/p&gt;</comment>
                            <comment id="43283" author="morrone" created="Wed, 15 Aug 2012 15:18:29 +0000"  >&lt;blockquote&gt;&lt;p&gt;There is no new work yet - just Chris&apos;s patches and some testing.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;That isn&apos;t quite accurate.  An unrelated change to lustre_user.h was added.&lt;/p&gt;

&lt;p&gt;I don&apos;t think the goal here is to make everything in lustre/tests use only the api available to end users (although that might be a reasonable thing to pursue next.  The goal is just to make the examples that we provide users use only the api, and make the api&apos;s headers actually compilable in user space. &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.whamcloud.com/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;
</comment>
                            <comment id="46256" author="rhenwood" created="Tue, 9 Oct 2012 11:20:29 +0000"  >&lt;p&gt;The API fixes have landed: &lt;a href=&quot;http://review.whamcloud.com/#change,3427&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/#change,3427&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To reduce the changes of this breaking, unnoticed, again it would be good to include an item in the test suite. As a start, I present the following proposals:&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;Pull and build the code examples embedded in the man page.&lt;/li&gt;
	&lt;li&gt;Pull and build the code examples embedded in the Manual.&lt;/li&gt;
	&lt;li&gt;Build a separate, stand-alone example.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Any preference?&lt;/p&gt;</comment>
                            <comment id="46487" author="rhenwood" created="Fri, 12 Oct 2012 18:04:25 +0000"  >&lt;p&gt;&lt;tt&gt;lustre-client-source.rpm&lt;/tt&gt; doesn&apos;t provide &lt;tt&gt;/usr/src/lustre/config.h&lt;/tt&gt;. &lt;tt&gt;config.h&lt;/tt&gt; provides &lt;tt&gt;LNET_MAX_PAYLOAD&lt;/tt&gt; that is necessary for building.&lt;/p&gt;

&lt;p&gt;I will pursue getting &lt;tt&gt;/usr/src/lustre/config.h&lt;/tt&gt; included the &lt;tt&gt;lustre-client-source.rpm&lt;/tt&gt;.&lt;/p&gt;</comment>
                            <comment id="46490" author="morrone" created="Fri, 12 Oct 2012 18:26:27 +0000"  >&lt;p&gt;Hold on for a moment; that needs more explanation.  I am concerned that you are trying to use lustre-client-source.rpm for anything in userspace again.  I tried to explain already that nothing in userspace should be using lustre&apos;s internal source or headers.&lt;/p&gt;

&lt;p&gt;So lets start with this: what is it that you are building that needs LNET_MAX_PAYLOAD?&lt;/p&gt;</comment>
                            <comment id="46492" author="morrone" created="Fri, 12 Oct 2012 18:47:38 +0000"  >&lt;p&gt;Also, are you aware that lustre-source*.rpm and lustre-client-source*.rpm are essentially the same thing?  the &quot;lustre-client&quot; version is just a result of building with servers support disabled.&lt;/p&gt;

&lt;p&gt;The more I think about it, the more and I am unclear on why we have &quot;binary&quot; -source rpms.  Perhaps it is time to eliminate those.  It seems like people should just use the real source rpm if they want the source code.&lt;/p&gt;

&lt;p&gt;In proper Lustre tradition, there are no comments that explain the existence of the &quot;source&quot; binary package...&lt;/p&gt;

&lt;p&gt;So Richard, yeah, really don&apos;t do that.  Those packages may not even exist when Lustre 2.4 comes out.&lt;/p&gt;</comment>
                            <comment id="46593" author="rhenwood" created="Mon, 15 Oct 2012 15:06:18 +0000"  >&lt;p&gt;Chris: I agree, the lustre-source* rpm does sound redundant to me. &lt;/p&gt;

&lt;p&gt;Also: I gave my initial suggestion to include &lt;tt&gt;/usr/src/lustre/config.h&lt;/tt&gt; thought over the weekend. As you say, this is the wrong way to go because it adds dependency between the client and the build configuration and internals. I agree this is an undesirable approach.&lt;/p&gt;


&lt;p&gt;&lt;tt&gt;LNET_MAX_PAYLOAD&lt;/tt&gt; is required by &lt;tt&gt;/usr/include/lnet/types.h&lt;/tt&gt;:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$ gcc basic.c -llustreapi
In file included from /usr/include/libcfs/libcfs_private.h:46,
                 from /usr/include/libcfs/libcfs.h:313,
                 from /usr/include/lustre/lustre_idl.h:95,
                 from /usr/include/lustre/lustreapi.h:46,
                 from basic.c:1:
/usr/include/lnet/types.h:279:3: error: #error &quot;LNET_MAX_PAYLOAD must be defined in config.h&quot;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;tt&gt;basic.c&lt;/tt&gt; looks like&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;#include &amp;lt;lustre/lustreapi.h&amp;gt;

main() {}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I&apos;ve been searching to see how the problem with LNET_MAX_PAYLOAD has been addressed in the past and found a &lt;a href=&quot;http://lists.opensfs.org/pipermail/lustre-devel-opensfs.org/2011-November/thread.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;thread and patch from last year on the topic of a lustre-devel pachage&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will review this patch, and identify useful components that can be applied to this issue.&lt;/p&gt;
</comment>
                            <comment id="46596" author="morrone" created="Mon, 15 Oct 2012 16:18:47 +0000"  >&lt;p&gt;Ok, the first problem that needs to be addressed is lustre_idl.h including libcfs.h.  That should not be happening.  libcfs/libcfs.h is not packaged for user-space.  The only header that from libcfs that we have allowed to appear in the package for user-space is libcfs/posix/posix-types.h, and we don&apos;t want to allow any more without very good reason.&lt;/p&gt;

&lt;p&gt;I&apos;m getting deja vu...right, see my &lt;a href=&quot;http://jira.whamcloud.com/browse/LU-1606?focusedCommentId=41950&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-41950&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;July 17 comment&lt;/a&gt; where I pointed out this problem.  In particular this sentence:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt; I see that Andreas made a couple of tweaks here in 5351a1ba03e3464f26271216cd266d2cb77b5625, but its not clear to me how he expected LASSERT and LPU64 to be defined in user space normally.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;In summary, in user-space lustre_idl.h should not be including libcfs.h.&lt;/p&gt;

&lt;p&gt;In my earlier July 13 comment, I also suggested that it might be best to remove lustre_idl.h from user-space altogether.  Things that need to be shared with user-space should be moved from lustre_idl.h to lustre_user.h, or something along those lines.&lt;/p&gt;</comment>
                            <comment id="46747" author="rhenwood" created="Thu, 18 Oct 2012 14:22:48 +0000"  >&lt;p&gt;I like the idea of removing &lt;tt&gt;lustre_idl.h&lt;/tt&gt; from user-space.&lt;/p&gt;

&lt;p&gt;In pursuing this goal, I&apos;ve been removing various tentacles that extend from a bunch of the &lt;tt&gt;./lustre/tests/*.c&lt;/tt&gt; files into the source. I&apos;ve been chipping away at these.&lt;/p&gt;

&lt;p&gt;Can you advise on: &lt;tt&gt;LPU64&lt;/tt&gt;? &lt;/p&gt;

&lt;p&gt;Should these definitions be included in &lt;tt&gt;lustreapi.h&lt;/tt&gt; or just pop-in a llu definition?&lt;/p&gt;

&lt;p&gt;An example LPU64 usage can be found in: &lt;a href=&quot;http://git.whamcloud.com/?p=fs/lustre-release.git;a=blob_plain;f=lustre/tests/copytool.c;hb=HEAD&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;./lustre/tests/copytool.c&lt;/tt&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="46755" author="morrone" created="Thu, 18 Oct 2012 18:01:07 +0000"  >&lt;p&gt;Ah, good!  Thats the question I posed in the &quot;Description&quot; section of this jira ticket.  The lack of LPU64 and LPX64 definitions is a problem.  What I&apos;d love to do is rewrite the API functions to abstract away our wire-protocol fixed-size types, and use more standard posix types wherever possible.  Using a data type that is larger than necessary isn&apos;t a problem when we aren&apos;t putting the value in a packet on the wire.&lt;/p&gt;

&lt;p&gt;But, of course, that is way too much work for the scope of this ticket.&lt;/p&gt;

&lt;p&gt;So first, lets note that there are three &quot;lustre_user.h&quot; files in the source tree:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;./lustre/include/lustre/lustre_user.h
./lustre/include/linux/lustre_user.h
./lustre/include/darwin/lustre_user.h
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &quot;lustre/lustre_user.h&quot; file is the main one that users will #include.  It in turn #includes either linux/lustre_user.h or darwin/lustre_user.h based on which OS you are using.&lt;/p&gt;

&lt;p&gt;Note that the darwin version of lustre_user.h defines LPU64 &amp;amp; friends, but the linux version does not.&lt;/p&gt;

&lt;p&gt;Further note that &quot;LPU64&quot; is defined in no less than six places at the moment:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;libcfs/include/libcfs/darwin/kp30.h
libcfs/include/libcfs/linux/kp30.h
libcfs/include/libcfs/posix/posix-wordsize.h
libcfs/include/libcfs/winnt/kp30.h
lustre/include/darwin/lustre_lib.h
lustre/include/darwin/lustre_user.h
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;About the only place they aren&apos;t currently defined is Linux user-space.&lt;/p&gt;

&lt;p&gt;I should also note that we can&apos;t assume that both user-space and kernel-space have the same data types on the SAME system.  I believe that Linux on ppc is a place were user space and kernel space can differ.&lt;/p&gt;

&lt;p&gt;It looks like the libcfs/posix/posix-wordsize.h has the most exhaustive set of definitions of LPU64 &amp;amp; friends, attempting to cover kernel- and user-space, and 32-bit and 64-bit systems.&lt;/p&gt;

&lt;p&gt;At first glance, I would be tempted to add posix-wordsize.h to the list of normally packaged user-space headers.  It seems to have been originally intended for that purpose, based on the comment at the top &quot;Wordsize related  defines for posix userspace.&quot;&lt;/p&gt;

&lt;p&gt;But then posix-wordsize.h has some odd things in it besides just dealing with definitions to deal with wordsize.  It also has things like this that seem totally out of place:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;# define CFS_MODULE_PARM(name, t, type, perm, desc)
#define PORTAL_SYMBOL_GET(x) inter_module_get(#x)
#define PORTAL_SYMBOL_PUT(x) inter_module_put(#x)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But I don&apos;t suppose that would actually hurt anything if we put this file in user-space.  I think maybe that came over as a side effect of posix-wordsize.h starting out as a cut-and-paste of the linux/kp30.h file (as seen by the &quot;#ifndef _&lt;em&gt;LIBCFS_LINUX_KP30_H&lt;/em&gt;&lt;em&gt;&quot; at the top of posix-wordsize.h).  I don&apos;t know if there are actually any consumers of CFS_MODULE_PARM, or PORTAL_SYMBOL&lt;/em&gt;* from posix-wordsize.h.&lt;/p&gt;

&lt;p&gt;The libcfs directory has become pretty messy about keeping kernel-space and user-space separated.&lt;/p&gt;

&lt;p&gt;The more that I look at it, the more that I think that exposing posix-wordsize.h to user-space is the way to go for now.  Anything more could kick of rather larger of a cleanup effort than we&apos;re ready for at the moment.&lt;/p&gt;

&lt;p&gt;And while I propose to include posix-wordsize.h in user-space, I don&apos;t intend that any users should ever use it directly.  It will just be an implementation detail of lustreapi.h as far as real users are concerned.  So we should not be hamstrung by its inclusion should someone have time for a larger cleanup effort in the future.&lt;/p&gt;

&lt;p&gt;Then that might just leave the issue of LASSERT &amp;amp; variants not being defined in user space.&lt;/p&gt;</comment>
                            <comment id="46758" author="morrone" created="Thu, 18 Oct 2012 18:41:45 +0000"  >&lt;p&gt;What do folks think of the following two patches?&lt;/p&gt;

&lt;p&gt;  &lt;a href=&quot;http://review.whamcloud.com/4301&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/4301&lt;/a&gt;&lt;br/&gt;
  &lt;a href=&quot;http://review.whamcloud.com/4302&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/4302&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Those are completely untested.&lt;/p&gt;</comment>
                            <comment id="47628" author="yujian" created="Fri, 9 Nov 2012 04:03:16 +0000"  >&lt;p&gt;This is blocking building e2fsprogs package (&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-2259&quot; title=&quot;e2fsprogs: rename liblustreapi.h with lustreapi.h&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-2259&quot;&gt;&lt;del&gt;LU-2259&lt;/del&gt;&lt;/a&gt;).&lt;/p&gt;</comment>
                            <comment id="47660" author="morrone" created="Fri, 9 Nov 2012 21:17:18 +0000"  >&lt;p&gt;I abandonded the &lt;a href=&quot;http://review.whamcloud.com/4301&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;4301&lt;/a&gt; and &lt;a href=&quot;http://review.whamcloud.com/4302&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;4302&lt;/a&gt; changes.&lt;/p&gt;

&lt;p&gt;Instead, I think that we should remove the #include of lustre_idl.h from lustreapi.h.  Please review change &lt;a href=&quot;http://review.whamcloud.com/4505&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;4505&lt;/a&gt;.&lt;/p&gt;

</comment>
                            <comment id="47685" author="rhenwood" created="Mon, 12 Nov 2012 11:28:50 +0000"  >&lt;p&gt;From your commit log:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;lustre_idl.h has become increasingly difficult to use from&lt;br/&gt;
user-space. Normal users of the lustre api should not&lt;br/&gt;
be looking into lustre wire protocol anyway, so this change&lt;br/&gt;
eliminates the include of lustre_idl.h.&lt;/p&gt;

&lt;p&gt;After removing lustre_idl.h, it became obvious that a number&lt;br/&gt;
of programs have been picking up normal user-space headers&lt;br/&gt;
through a very windy path of includes. With the include&lt;br/&gt;
of lustre_idl.h gone, they no longer compiled, so we also&lt;br/&gt;
add the missing explicit includes.&lt;/p&gt;

&lt;p&gt;It became clear that copytool.c explicity requires&lt;br/&gt;
libcfs/libcfs.h, and lustre_rsync.c require lustre_idl.h.&lt;br/&gt;
But I believe that it is far better to have those includes&lt;br/&gt;
explicitly stated, so it is obvious that those programs&lt;br/&gt;
are peeking into lustre&apos;s internals. In the future we&lt;br/&gt;
can work on creating new lustre API calls that provide the&lt;br/&gt;
information that they need without side-stepping abstraction&lt;br/&gt;
layers.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I was playing with the now abandoned changes 4301, 4302 and was getting bogged down resolving dependencies as you say in your commit (above.)&lt;/p&gt;

&lt;p&gt;I like the approach of the new patch. With your new approach, the task now is to enhance &lt;tt&gt;lustreapi.h&lt;/tt&gt; so no userspace code needs to fish around in the internals. There is a open ticket for &lt;tt&gt;lfs.c&lt;/tt&gt; to only use &lt;tt&gt;lustreapi.h&lt;/tt&gt;: &lt;a href=&quot;http://jira.whamcloud.com/browse/LU-1758&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;http://jira.whamcloud.com/browse/LU-1758&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if this current change lands, I will open tickets for &lt;tt&gt;lustre/tests/copytool.c&lt;/tt&gt;, &lt;tt&gt;lustre/tests/multiop.c&lt;/tt&gt;, &lt;tt&gt;lustre/tests/sendfile.c&lt;/tt&gt;, and &lt;tt&gt;lustre/utils/lustre_rsync.c&lt;/tt&gt;.&lt;/p&gt;</comment>
                            <comment id="48044" author="morrone" created="Mon, 19 Nov 2012 22:33:08 +0000"  >&lt;p&gt;Oh, I see, change 3427 really did introduce a new bug.  Change number 4505 corrects that bug.&lt;/p&gt;

&lt;p&gt;What we missed in the reviews is that someone (who shall remain nameless &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.whamcloud.com/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;) snuck an extra &quot;#include &amp;lt;lustre/lustre_idl.h&amp;gt;&quot; into the new lustreapi.h file.&lt;/p&gt;

&lt;p&gt;This is a great learning case though.  I think what happened is that the rename of liblustreapi.h to lustreapi.h made the entire contents of the lustreapi.h appear as new lines in a diff.  That means that any new lines added at the same time as the file rename are really easy for the reviewers to miss, which I think is what happened here.&lt;/p&gt;

&lt;p&gt;So maybe I wasn&apos;t clear on why I wasn&apos;t in favor of expanding my patch with additional changes, but this is generally the type of thing that I was worried about.  And clearly even though I was worried about it, I too failed to notice the new lustre_idl.h include.  It just got lost in the sea of added lines, and I assumed that it was still just the file rename.&lt;/p&gt;</comment>
                            <comment id="48080" author="prakash" created="Tue, 20 Nov 2012 12:22:18 +0000"  >&lt;blockquote&gt;
&lt;p&gt;This is a great learning case though. I think what happened is that the rename of liblustreapi.h to lustreapi.h made the entire contents of the lustreapi.h appear as new lines in a diff. That means that any new lines added at the same time as the file rename are really easy for the reviewers to miss, which I think is what happened here.&lt;br/&gt;
So maybe I wasn&apos;t clear on why I wasn&apos;t in favor of expanding my patch with additional changes, but this is generally the type of thing that I was worried about. And clearly even though I was worried about it, I too failed to notice the new lustre_idl.h include. It just got lost in the sea of added lines, and I assumed that it was still just the file rename.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Yes, in general this is how it works. The new file and all its lines just show as &quot;added&quot; lines, and the removed file as &quot;removed&quot; lines. Although, if the committer uses the &lt;tt&gt;git mv&lt;/tt&gt; command, Gerritt (and &lt;tt&gt;git status&lt;/tt&gt;, but not &lt;tt&gt;git log&lt;/tt&gt;) will show an annotation on the renamed file to reflect that it hasn&apos;t changed ans was &lt;b&gt;only&lt;/b&gt; renamed. For example, see &lt;a href=&quot;http://review.whamcloud.com/4633&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/4633&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="48081" author="prakash" created="Tue, 20 Nov 2012 12:28:51 +0000"  >&lt;p&gt;And then if the &lt;tt&gt;git mv&lt;/tt&gt;&apos;d file is modified, it correctly shows the diff for the modified lines. See: &lt;a href=&quot;http://review.whamcloud.com/4634&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/4634&lt;/a&gt;. In the future, I suggest negative reviews for patches which rename a file and do not use this method to try and prevent these mistakes.&lt;/p&gt;</comment>
                            <comment id="48093" author="morrone" created="Tue, 20 Nov 2012 13:24:39 +0000"  >&lt;p&gt;Well, actually, if I understand correctly there is nothing particularly special about &quot;git mv&quot;; it is just a convenience function.  Git is a lot like a file system internally.  At each commit, it represents the full contents of the tree.  Then each commit has one or more &quot;parents&quot;.  So there is nothing internally that records &quot;this file moved to from here in this commit to there in that commit&quot;.  It is up to commands like &quot;git status&quot; and other things to figure that out after the fact.&lt;/p&gt;

&lt;p&gt;So you can move the file without &quot;git mv&quot;, then individually do the &quot;git rm&quot; and &quot;git add&quot; commands, and &quot;git status&quot; will show &quot;renamed&quot; just as reliably as if &quot;git mv&quot; had been used.  Except when sometimes it doesn&apos;t...and I&apos;m not entire sure what situations fool it and other tools.&lt;/p&gt;
</comment>
                            <comment id="48923" author="pjones" created="Fri, 7 Dec 2012 15:27:01 +0000"  >&lt;p&gt;With the latest landing is this issue now fixed for master?&lt;/p&gt;</comment>
                            <comment id="48932" author="morrone" created="Fri, 7 Dec 2012 18:07:56 +0000"  >&lt;p&gt;We worked around one problem and are on the road to having better examples, but the titular problem still remains: lustre_idl.h is packaged and installed in a user visible location, and yet does not compile in user space.&lt;/p&gt;

&lt;p&gt;More and more, I am leaning towards the solution of just &lt;em&gt;not&lt;/em&gt; packaging lustre_idl.h.&lt;/p&gt;</comment>
                            <comment id="49224" author="rhenwood" created="Thu, 13 Dec 2012 20:06:16 +0000"  >&lt;p&gt;Chris: given that &lt;a href=&quot;http://review.whamcloud.com/4505&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/4505&lt;/a&gt; has landed, I believe users can compile code on 2.4.&lt;/p&gt;

&lt;p&gt;Is the remaining task to remove lustre_idl.h and see what breaks, and then fix that?&lt;/p&gt;</comment>
                            <comment id="49251" author="morrone" created="Fri, 14 Dec 2012 14:37:44 +0000"  >&lt;p&gt;Sure, if folks are ok with us removing lustre_idl.h.  We might, though, want to consider replacing it with an empty header with a warning (like liblustreapi.h) so that we don&apos;t flat out break apps that included it for no other reason than the examples said to include it.&lt;/p&gt;</comment>
                            <comment id="51647" author="nedbass" created="Fri, 1 Feb 2013 15:37:31 +0000"  >&lt;p&gt;I believe we also need to include stdio.h from lustre_user.h since it uses snprintf.&lt;/p&gt;</comment>
                            <comment id="53774" author="adilger" created="Tue, 12 Mar 2013 04:38:25 +0000"  >&lt;p&gt;&lt;a href=&quot;http://review.whamcloud.com/5682&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/5682&lt;/a&gt; removes LASSERT() and CLASSERT() from lustre_idl.h.&lt;/p&gt;</comment>
                            <comment id="57447" author="rhenwood" created="Wed, 1 May 2013 16:33:17 +0000"  >&lt;p&gt;A regression test has now landed:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://review.whamcloud.com/3440&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/3440&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="65374" author="rhenwood" created="Thu, 29 Aug 2013 16:06:33 +0000"  >&lt;p&gt;I would like to close this ticket: any objections?&lt;/p&gt;</comment>
                            <comment id="65384" author="morrone" created="Thu, 29 Aug 2013 17:21:04 +0000"  >&lt;p&gt;None here.  Thanks!&lt;/p&gt;</comment>
                            <comment id="68981" author="jlevi" created="Tue, 15 Oct 2013 13:50:02 +0000"  >&lt;p&gt;Added 2.5.0 FixVersion&lt;/p&gt;</comment>
                            <comment id="82819" author="rread" created="Tue, 29 Apr 2014 23:40:24 +0000"  >&lt;p&gt;I&apos;m seeing similar errors again in master and 2.5.1. Also, some additional include files needed for lustre_idl.h are not being  installed. &lt;/p&gt;

&lt;p&gt;This is on master, and 2.5.1 is similar:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$ gcc example.c
In file included from example.c:1:
/usr/include/lustre/lustre_idl.h:95:49: error: libcfs/libcfs.h: No such file or directory
/usr/include/lustre/lustre_idl.h:101:33: error: lustre/lustre_errno.h: No such file or directory
In file included from example.c:1:
/usr/include/lustre/lustre_idl.h: In function &#8216;ostid_set_id&#8217;:
/usr/include/lustre/lustre_idl.h:705: error: expected &#8216;)&#8217; before &#8216;LPU64&#8217;
/usr/include/lustre/lustre_idl.h:712: error: expected &#8216;)&#8217; before &#8216;LPU64&#8217;
/usr/include/lustre/lustre_idl.h:722: error: expected &#8216;)&#8217; before &#8216;LPU64&#8217;
/usr/include/lustre/lustre_idl.h: In function &#8216;fid_set_id&#8217;:
/usr/include/lustre/lustre_idl.h:723: error: expected &#8216;)&#8217; before &#8216;LPX64&#8217;
/usr/include/lustre/lustre_idl.h:734: error: &#8216;EBADF&#8217; undeclared (first use in this function)
/usr/include/lustre/lustre_idl.h:734: error: (Each undeclared identifier is reported only once
/usr/include/lustre/lustre_idl.h:734: error: for each function it appears in.)
/usr/include/lustre/lustre_idl.h:739: error: expected &#8216;)&#8217; before &#8216;LPU64&#8217;
/usr/include/lustre/lustre_idl.h:748: error: expected &#8216;)&#8217; before &#8216;LPU64&#8217;
/usr/include/lustre/lustre_idl.h: In function &#8216;ostid_to_fid&#8217;:
/usr/include/lustre/lustre_idl.h:749: error: expected &#8216;)&#8217; before &#8216;LPX64&#8217;
/usr/include/lustre/lustre_idl.h:774: error: &#8216;EBADF&#8217; undeclared (first use in this function)
/usr/include/lustre/lustre_idl.h:785: error: expected &#8216;)&#8217; before &#8216;LPX64&#8217;
/usr/include/lustre/lustre_idl.h:787: error: expected &#8216;)&#8217; before &#8216;LPX64&#8217;
/usr/include/lustre/lustre_idl.h: In function &#8216;fid_to_ostid&#8217;:
/usr/include/lustre/lustre_idl.h:803: error: expected &#8216;)&#8217; before &#8216;LPX64&#8217;
/usr/include/lustre/lustre_idl.h:817: error: &#8216;EBADF&#8217; undeclared (first use in this function)
/usr/include/lustre/lustre_idl.h: In function &#8216;lmv_mds_md_size&#8217;:
/usr/include/lustre/lustre_idl.h:2808: error: &#8216;EINVAL&#8217; undeclared (first use in this function)
/usr/include/lustre/lustre_idl.h: In function &#8216;lmv_mds_md_stripe_count_get&#8217;:
/usr/include/lustre/lustre_idl.h:2821: error: &#8216;EINVAL&#8217; undeclared (first use in this function)
/usr/include/lustre/lustre_idl.h: In function &#8216;lmv_mds_md_stripe_count_set&#8217;:
/usr/include/lustre/lustre_idl.h:2837: error: &#8216;EINVAL&#8217; undeclared (first use in this function)
/usr/include/lustre/lustre_idl.h: At top level:
/usr/include/lustre/lustre_idl.h:3127: error: expected specifier-qualifier-list before &#8216;lnet_nid_t&#8217;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="82820" author="morrone" created="Wed, 30 Apr 2014 00:34:05 +0000"  >&lt;p&gt;My &lt;a href=&quot;https://jira.hpdd.intel.com/browse/LU-1606?focusedCommentId=48932&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-48932&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;earlier comment&lt;/a&gt; apparently still applies.&lt;/p&gt;

&lt;p&gt;Robert, do you really need to compile against lustre_idl.h?  I would probably still argue that lustre should not be installing lustre_idl.h in user space.  The intent was clearly to use lustre/lustre_user.h as the place for definitions that needed to be shared with user space.  lustre_idl.h really never should have be installed in the first place.&lt;/p&gt;</comment>
                            <comment id="82831" author="rread" created="Wed, 30 Apr 2014 05:44:07 +0000"  >&lt;p&gt;Currently liblustreapi code is including and using defines in lustre_idl.h, so reproducing some that functionality is difficult without access to the same headers. Even using liblustreapi outside of the lustre tree can be challenging since there are a few definitions in lustre_user.h that depend on lustre_idl.h.  Since it seems removing luste_idl.h from userspace is the correct thing to do, then we should fix all of our userspace tools to not rely on it. As it is today, though, we&apos;re shipping broken header files, so let&apos;s fix that here, either way. &lt;/p&gt;</comment>
                            <comment id="82851" author="spitzcor" created="Wed, 30 Apr 2014 14:40:59 +0000"  >&lt;p&gt;I agree that we shouldn&apos;t ship broken headers, but we should really agree what should be installed.  There should be a hello world program(s) added to the test framework that include(s) stuff that should be installed.&lt;/p&gt;</comment>
                            <comment id="82858" author="rread" created="Wed, 30 Apr 2014 16:03:11 +0000"  >&lt;p&gt;Such a test was added by Richard for this ticket (&lt;a href=&quot;http://review.whamcloud.com/3440&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/3440&lt;/a&gt;. It&apos;s using the includes in the tree, though, so it&apos;s not actually testing the exported API. And because it&apos;s using a for loop it silently does nothing when the test programs are not available, so it looks like it&apos;s not testing anything when run in a test environment. &lt;/p&gt;

&lt;p&gt;This is a drawback of having the userspace code in the same tree as the kernel code. It&apos;s easy for these problems to creep in without the isolation and forced discipline of keeping the code separate trees.&lt;/p&gt;</comment>
                            <comment id="82936" author="morrone" created="Wed, 30 Apr 2014 22:06:47 +0000"  >&lt;p&gt;I&apos;m not seeing any explicit include of lustre_idl.h in lustreapi.h&apos;s tree of includes.  Am I missing anything?&lt;br/&gt;
If that is correctly avoiding the use of lustre_idl.h then we are better off then I feared.&lt;/p&gt;

&lt;p&gt;I completely agree that much of the things that the liblustreapi library can do internally (because it is built in-tree) cannot be done by external applications.  And I know that the there is legacy crap in lustreapi.h that is very poorly implemented.&lt;/p&gt;

&lt;p&gt;I would just argue that the path forward is to start developing good APIs to access the needed functionality rather than trying to make lustre_idl.h usable in user-space.&lt;/p&gt;</comment>
                            <comment id="83024" author="rread" created="Thu, 1 May 2014 17:30:00 +0000"  >&lt;p&gt;We&apos;re in violent agreement on the goal here - a good API.&lt;/p&gt;

&lt;p&gt;I didn&apos;t mean that lustreapi.h includes lustre_idl.h directly. I meant some things defined in lustreapi.h (or lustre_user.h) require definitions that typically done via lustre_idl.h.  For example, DFID uses LPX64, and that is not defined in lustre_user.h or in any of the installed headers.  Since the in-tree user space utilities are currently relying on lustre_idl.h, I, rather naively, thought the right way forward was to enable external utilities to use the same headers the internal tools used, because I would like the same API to be available to all user space utilities.   Otherwise, if I want to use those headers I need a configured lustre tree available and have to add the following to my gcc command line:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;      -include /home/rread/lustre-release/config.h \
      -I/home/rread/lustre-release/libcfs/include \
      -I/home/rread/lustre-release/lustre/include \
      -I/home/rread/lustre-release/lnet/include
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I&apos;d like to not have to do this - what is the best way forward?&lt;/p&gt;</comment>
                            <comment id="83029" author="jhammond" created="Thu, 1 May 2014 18:04:35 +0000"  >&lt;p&gt;Here is my 42 point proposal:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Add libcfs/include/libcfs/libcfs_types.h:
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;#ifdef __KERNEL__
# include &amp;lt;linux/types.h&amp;gt;
#&lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-comment&quot;&gt;/* __KERNEL__ */&lt;/span&gt;
# include &amp;lt;stdint.h&amp;gt;
typedef uint64_t __u64;
&lt;span class=&quot;code-comment&quot;&gt;/* ... */&lt;/span&gt;
#endif
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;
	&lt;li&gt;Add libcfs/include/libcfs/libcfs_types.h to the set of shipped headers.&lt;/li&gt;
	&lt;li&gt;Kill HAVE_USER__U64_LONG_LONG and similar autocrud.&lt;/li&gt;
	&lt;li&gt;Rewrite DFID() to use &apos;%#llx&apos;,... and PFID() to use explicit casts.&lt;/li&gt;
	&lt;li&gt;Similarly for the other D*() and P*() macros.&lt;/li&gt;
	&lt;li&gt;Move SFID and RFID to lustre_idl.h so no one uses them by mistake.&lt;/li&gt;
	&lt;li&gt;Include libcfs_types.h in lustre_user.h.&lt;/li&gt;
	&lt;li&gt;Don&apos;t ship lustre_idl.h.&lt;/li&gt;
	&lt;li&gt;If you want find something in lustre_idl.h that you believe belongs in lustre_user.h then move it.&lt;/li&gt;
	&lt;li&gt;Add a checkpatch rule that LPX64 and similar are not being added to our shipped headers.&lt;/li&gt;
	&lt;li&gt;Add a real compile lustre_user.h in userspace test.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;We must not ship config.h and we must not ship any headers that depend on config.h. Doing so is just braindead.&lt;/p&gt;</comment>
                            <comment id="83034" author="rread" created="Thu, 1 May 2014 18:37:02 +0000"  >&lt;p&gt;I&apos;m also using SFID/RFID, and fid_is_sane() which is in lustre_idl.h. &lt;/p&gt;
</comment>
                            <comment id="83037" author="jhammond" created="Thu, 1 May 2014 20:04:17 +0000"  >&lt;p&gt;On my 64-bit machine uint64_t is unsigned long, while the kernel&apos;s __u64 is unsigned long long. So my proposal will create typedef conflicts for files that see those definitions and include a linux/ header. Bah!&lt;/p&gt;</comment>
                            <comment id="83050" author="morrone" created="Thu, 1 May 2014 21:57:38 +0000"  >&lt;blockquote&gt;&lt;p&gt; I, rather naively, thought the right way forward was to enable external utilities to use the same headers the internal tools used, because I would like the same API to be available to all user space utilities.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Yeah, I can understand that.  The problem, of course, is that those interfaces are often hackerish and designed to meet only the immediate need of the in-tree built lustre tools.  Far too often the &quot;library&quot; really contains code specific to a specific tool rather than being something that is in any way reasonably reusable.  They were not at all designed with the needs of user space, or general concepts of good abstraction in mind.&lt;/p&gt;

&lt;p&gt;Things like DFID and PFID do not, in my opinion, belong in the userspace API.  We also do not want inline functions in headers (e.g. fid_is_sane) in the user space interfaces.&lt;/p&gt;

&lt;p&gt;For DFID/PFID, we instead want fid-to-string and string-to-fid style of functions in the user space library.&lt;/p&gt;

&lt;p&gt;The problem with macros and inline functions is that the application needs to be recompiled any time there is a change.  A library call on the other hand, can often change internally without changing the external interface and therefore require no rebuild of the external application.  If the interface needs to change externally, it is more obvious that we need to increment the shared library version.  I am certain that folks will forget to do that with macros and inlines.  (Of course, we don&apos;t version our library yet, which is also criminal...)&lt;/p&gt;</comment>
                            <comment id="83059" author="rread" created="Fri, 2 May 2014 00:43:48 +0000"  >&lt;p&gt;Chris, yes, I&apos;m buying in to separation lustre_user.h vs. lustre_idl.h. &lt;/p&gt;

&lt;p&gt;I would like to take a step back, then, and consider the ioctl interface for Lustre to be the fundamental userspace API.  The existing library is can be a reference implementation, but it should be optional.  This interface should ideally consist of constants, types, and structure definitions, with perhaps some useful macros along the lines of S_ISDIR(), but no functions at all, inline or otherwise.  We don&apos;t need things like DFID/SFID because representing data externally is the application&apos;s business. Likewise, the kernel should be responsible for ensuring the sanity of its inputs, so we don&apos;t necessarily need fid_is_sane() in userspace. &lt;/p&gt;

&lt;p&gt;Perhaps a good model for us is &lt;a href=&quot;https://www.kernel.org/doc/Documentation/filesystems/fiemap.txt&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;fiemap&lt;/a&gt; ioctl, which has rather complex interface for an ioctl, but still doesn&apos;t require a library to use. &lt;/p&gt;</comment>
                            <comment id="83114" author="morrone" created="Sat, 3 May 2014 00:17:24 +0000"  >&lt;p&gt;The lustre ioctls are &lt;em&gt;an&lt;/em&gt; interface.  What in particular are you trying to do?&lt;/p&gt;</comment>
                            <comment id="83115" author="morrone" created="Sat, 3 May 2014 00:19:16 +0000"  >&lt;p&gt;I am marking this a blocker for 2.6.  We can&apos;t ship with broken headers.&lt;/p&gt;

&lt;p&gt;And this time around we need to really figure out what to do with lustre_idl.h.  The developers and code reviewers keep allowing it to break over and over again.  Status quo is clearly not working.&lt;/p&gt;</comment>
                            <comment id="83118" author="rread" created="Sat, 3 May 2014 01:02:18 +0000"  >&lt;p&gt;Moving to triage for assignment. &lt;/p&gt;</comment>
                            <comment id="83119" author="morrone" created="Sat, 3 May 2014 01:19:13 +0000"  >&lt;p&gt;I did some leg work to track down which commits were at fault and opened four separate bugs on them.  They are marked as blocking this ticket.  We clearly need to raise awareness about the rules about what is allowed in lustre_idl.h.&lt;/p&gt;

&lt;p&gt;Or stop packaging lustre_idl.h, of course, in which case we don&apos;t need much in the way of rule.  But not packaging it requires additional work to add new APIs to export required information.  For instance, there is LOV_MAX_STRIPE_COUNT and likely other things that users need to be able to allocate buffers correctly and work with striping.  The striping issues can be simplified if we get the work from &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-2182&quot; title=&quot;Add llapi_file_get_layout() function in liblustreapi&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-2182&quot;&gt;&lt;del&gt;LU-2182&lt;/del&gt;&lt;/a&gt; landed.&lt;/p&gt;

&lt;p&gt;We probably don&apos;t have a very exact list of things that external applications have been using from lustre_idl.h.&lt;/p&gt;</comment>
                            <comment id="83120" author="rread" created="Sat, 3 May 2014 02:09:52 +0000"  >&lt;p&gt;LOV_PATTERN_F_RELEASED  is needed to import stub files for HSM. &lt;/p&gt;</comment>
                            <comment id="83125" author="prakash" created="Sat, 3 May 2014 16:19:18 +0000"  >&lt;blockquote&gt;
&lt;p&gt;I would like to take a step back, then, and consider the ioctl interface for Lustre to be the fundamental userspace API.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Yes! Without userspace daemons for applications to talk to, this is true no matter what; whether we like it or not. Since Lustre &lt;b&gt;only&lt;/b&gt; has kernel components, the system call interface &lt;b&gt;is&lt;/b&gt; the userspace API. Libraries are nice, but they are essentially only &quot;helper functions&quot; built on top of the core API which is the system calls and ioctl protocol. I&apos;m really glad to see somebody upstream make this distinction.&lt;/p&gt;</comment>
                            <comment id="83128" author="adilger" created="Sun, 4 May 2014 00:23:01 +0000"  >&lt;p&gt;I for one do NOT want the ioctl interface (at least not the current one) to be the interface exposed to applications. Asking that applications use the setstripe ioctl correctly is just asking for grief. That is moving in exactly the opposite direction of &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-2182&quot; title=&quot;Add llapi_file_get_layout() function in liblustreapi&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-2182&quot;&gt;&lt;del&gt;LU-2182&lt;/del&gt;&lt;/a&gt;, which I thought is what LLNL wanted?&lt;/p&gt;

&lt;p&gt;As for the various issues brought up in recent comments:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;DFID uses LPX64 - fixed in &lt;a href=&quot;http://review.whamcloud.com/6156&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/6156&lt;/a&gt; along with other similar issues&lt;/li&gt;
	&lt;li&gt;I&apos;m largely in support of John proposal&lt;/li&gt;
	&lt;li&gt;cleaning up liblustreapi - great&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="83208" author="rread" created="Mon, 5 May 2014 16:48:12 +0000"  >&lt;p&gt;Pretty much by definition the ioctl interface is part of the user interface for the kernel, in addition to other syscalls, /proc, and xattrs.  That the current ioctl interface is not a particularly good one (agreed) is a separate issue. &lt;/p&gt;</comment>
                            <comment id="83214" author="adilger" created="Mon, 5 May 2014 17:45:00 +0000"  >&lt;p&gt;Some of these issues are being fixed by John in &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-4961&quot; title=&quot;utils and test should not depend on obd.h or liblustre.h&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-4961&quot;&gt;&lt;del&gt;LU-4961&lt;/del&gt;&lt;/a&gt; and &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-4999&quot; title=&quot;lustre_idl.h compilation regression from LU-3569&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-4999&quot;&gt;&lt;del&gt;LU-4999&lt;/del&gt;&lt;/a&gt; (e.g. &lt;a href=&quot;http://review.whamcloud.com/10194&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/10194&lt;/a&gt; and &lt;a href=&quot;http://review.whamcloud.com/10210&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/10210&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;It would have been better to open a new ticket for the new issues with lustre_idl.h (possibly linking it back to this one if desired) instead of re-opening this old ticket (which was marked closed for previous releases on which those fixes were landed).&lt;/p&gt;</comment>
                            <comment id="83223" author="rread" created="Mon, 5 May 2014 21:48:38 +0000"  >&lt;p&gt;Since original problem this ticket raised (that of lustre_idl.h not compiling in user space) has either regressed or wasn&apos;t addressed by the patches in the first place, reopening seemed like the right thing to do.  But opening a new one is fine, too, if that fits our process better. &lt;/p&gt;</comment>
                            <comment id="83235" author="morrone" created="Mon, 5 May 2014 23:09:24 +0000"  >&lt;p&gt;I agree with Andreas that I don&apos;t want to force normal users to use ioctls.  It would certainly be good to be a little more formal with the ioctls, and treat them as the formal interfaces that they are.  But they do not consitute adequate application APIs on their own.&lt;/p&gt;

&lt;p&gt;As Andreas pointed out, we at LLNL explicitly want to avoid using them in the backend implementation of the Lustre API library.  The details are in &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-2182&quot; title=&quot;Add llapi_file_get_layout() function in liblustreapi&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-2182&quot;&gt;&lt;del&gt;LU-2182&lt;/del&gt;&lt;/a&gt;, but the short story is that ioctls are difficult to function ship.&lt;/p&gt;</comment>
                            <comment id="83238" author="morrone" created="Mon, 5 May 2014 23:33:55 +0000"  >&lt;p&gt;I started &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; to track the new issues that we&apos;ll fix for Lustre 2.6.0 (and backport to the stable branches that need them).  That ticket is marked the blocker instead of this one, and &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; is also the one now with the the subtickets links.&lt;/p&gt;

&lt;p&gt;On the assumption that we will now reclose this one, I made John Hammond the owner of that ticket.&lt;/p&gt;

&lt;p&gt;The only thing I didn&apos;t do is close this ticket.  If all are in agreement, I can do that as well.&lt;/p&gt;</comment>
                            <comment id="83322" author="rread" created="Tue, 6 May 2014 16:49:21 +0000"  >&lt;p&gt;I agree, we don&apos;t want to force users to use the ioctl interface, but we shouldn&apos;t prevent them from using it, either. &lt;/p&gt;

&lt;p&gt;Chris, feel free to close this ticket. &lt;/p&gt;</comment>
                            <comment id="83437" author="prakash" created="Wed, 7 May 2014 19:50:51 +0000"  >&lt;blockquote&gt;
&lt;p&gt;I for one do NOT want the ioctl interface (at least not the current one) to be the interface exposed to applications.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;My previous comment wasn&apos;t specific to the ioctl interface; that&apos;s only &lt;em&gt;part&lt;/em&gt; of the userspace API. &lt;b&gt;All&lt;/b&gt; of the system calls we expose constitute the userspace API; read, write, getxattr, ioctl, etc. But I think I&apos;m getting away from the goal of this ticket, so I&apos;ll step out now.&lt;/p&gt;</comment>
                            <comment id="135876" author="gerrit" created="Thu, 10 Dec 2015 17:45:12 +0000"  >&lt;p&gt;Oleg Drokin (oleg.drokin@intel.com) merged in patch &lt;a href=&quot;http://review.whamcloud.com/6156/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/6156/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-1606&quot; title=&quot;lustre_idl.h does not compile in user-space&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-1606&quot;&gt;&lt;del&gt;LU-1606&lt;/del&gt;&lt;/a&gt; misc: clean up DFID related error messages&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 1c24b0afdb1b065d5016865d922c89c384bdbde4&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="19845">LU-3597</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="24552">LU-4999</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="24396">LU-4961</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="12680">LUDOC-28</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="24554">LU-5001</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="16544">LU-2259</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="24578">LU-5011</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="15149">LUDOC-63</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="16381">LU-2196</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <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|hzv65j:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4531</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10022"><![CDATA[3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>