Details
-
Bug
-
Resolution: Fixed
-
Minor
-
Lustre 2.4.1
-
None
-
3
-
11039
Description
Some users would like to include lustre_user.h or lustreapi.h in C++ applications. There are a few compatibility issues currently preventing this.
$ cat a.c #include <lustre/lustre_user.h> $ g++ -c a.c In file included from a.c:1: /usr/include/lustre/lustre_user.h:185: error: 'struct ost_id::<anonymous union>::ostid' invalid; an anonymous union can only have non-static data members /usr/include/lustre/lustre_user.h: In function 'hsm_event hsm_get_cl_event(__u16)': /usr/include/lustre/lustre_user.h:728: error: invalid conversion from 'int' to 'hsm_event' /usr/include/lustre/lustre_user.h: In function 'int hur_len(hsm_user_request*)': /usr/include/lustre/lustre_user.h:1002: error: 'hur' cannot appear in a constant-expression /usr/include/lustre/lustre_user.h:1002: error: '->' cannot appear in a constant-expression /usr/include/lustre/lustre_user.h:1002: error: '.' cannot appear in a constant-expression /usr/include/lustre/lustre_user.h: In function 'char* hai_dump_data_field(hsm_action_item*, char*, int)': /usr/include/lustre/lustre_user.h:1068: error: 'snprintf' was not declared in this scope
While we're at it, we may also want to clean up these warnings which are normally suppressed because they're in a system header.
$ g++ -Wall -Wsystem-headers -c a.c In file included from a.c:1: /usr/include/lustre/lustre_user.h:185: error: 'struct ost_id::<anonymous union>::ostid' invalid; an anonymous union can only have non-static data members /usr/include/lustre/lustre_user.h: In function 'hsm_event hsm_get_cl_event(__u16)': /usr/include/lustre/lustre_user.h:728: error: invalid conversion from 'int' to 'hsm_event' /usr/include/lustre/lustre_user.h: In function 'char* hsm_progress_state2name(hsm_progress_states)': /usr/include/lustre/lustre_user.h:889: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:890: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:891: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:892: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h: In function 'char* hsm_user_action2name(hsm_user_action)': /usr/include/lustre/lustre_user.h:951: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:952: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:953: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:954: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:955: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:956: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:957: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h: In function 'int hur_len(hsm_user_request*)': /usr/include/lustre/lustre_user.h:1002: error: 'hur' cannot appear in a constant-expression /usr/include/lustre/lustre_user.h:1002: error: '->' cannot appear in a constant-expression /usr/include/lustre/lustre_user.h:1002: error: '.' cannot appear in a constant-expression /usr/include/lustre/lustre_user.h: In function 'char* hsm_copytool_action2name(hsm_copytool_action)': /usr/include/lustre/lustre_user.h:1025: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:1026: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:1027: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:1028: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:1029: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:1030: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h: In function 'char* hai_dump_data_field(hsm_action_item*, char*, int)': /usr/include/lustre/lustre_user.h:1068: error: 'snprintf' was not declared in this scope /usr/include/lustre/lustre_user.h: In function 'int hal_size(hsm_action_list*)': /usr/include/lustre/lustre_user.h:1121: warning: comparison between signed and unsigned integer expressions