On 05/12/2015 14:47, Mike Holmes wrote:


On 12 May 2015 at 04:14, Savolainen, Petri (Nokia - FI/Espoo) <[email protected] <mailto:[email protected]>> wrote:

    Hi,

    I may have missed some mail but ... don't get why the third string
    is needed. API string (odp_version_api_str()) is the API version
    number in string format (in addition to macros in numeric format).
    Implementation string (odp_version_impl_str()) is a free form
    string containing whatever information the implementation decides
    to put there. I’d expect a user to print out both of those into a
    log or bug report.


The current implementation string needs to remain as a simple value that the application can compare, forcing an application to parse a long string does not make any sense to me, in fact I think this should become part of the API and not implementation defined.

I.e. in my application I can compare API version and then implementation number to determine if I have the code at the level I require, possibly I need some important patch level.

To retain that capability and meet your suggestion of an easy way to get a lot of debug information out then a verbose string is valuable in addition.


Yes, ok. How then how about move

#define ODP_IMPL_VERSION to the api?

Maxim.





    What would be the use case for the third one? I expect
    odp_version_impl_str() include all information needed to identify
    an implementation, including the build number.

    Examples of odp_version_impl_str():

    linux-generic 1.0.4-0 (v1.0.4) May 6 2015 07:54:33
    linux-generic 1.0.4-13 (v1.0.4) July 12 2015 08:23:09
    linux-generic 1.0.4-22 (v1.0.4) Oct 1 2015 18:01:34
    https://git.linaro.org/lng/odp.git hash 812ea78445
    odp-for-xyz 1.0.4 build 1826 (API version 1.0.4) May 6 2015 07:54:33
    odp-foo-bar 1.0.1-17 https://git.foo.org/foo_bar.git hash 75ed2758902

    User would not compare or expect any format on the implementation
    specific strings. The intention is that each implementation
    release/build would produces a unique string, which helps then
    identify bugs,etc ... but implementation decides.


    -Petri




    From: lng-odp [mailto:[email protected]
    <mailto:[email protected]>] On Behalf Of ext Mike
    Holmes
    Sent: Monday, May 11, 2015 7:45 PM
    To: Bill Fischofer
    Cc: LNG ODP Mailman List
    Subject: Re: [lng-odp] [API-NEXT PATCH] api: version.h: add
    odp_version_str

    Thanks Bill.

    Just need Petri or Robbies confirmation that 1.1 forward will use
    the implementation version as a number and not a long string,
    essentially as it was before but  we failed to take advantage of it.

    Mike

    On 11 May 2015 at 12:40, Bill Fischofer <[email protected]
    <mailto:[email protected]>> wrote:


    On Fri, May 8, 2015 at 10:47 AM, Mike Holmes
    <[email protected] <mailto:[email protected]>> wrote:
    Signed-off-by: Mike Holmes <[email protected]
    <mailto:[email protected]>>

    Reviewed-by: Bill Fischofer <[email protected]
    <mailto:[email protected]>>

    ---
     include/odp/api/version.h                 | 17 +++++++++++++++++
     platform/linux-generic/odp_impl.c         | 16 ++++++++++++++++
     test/miscellaneous/odp_api_from_cpp.cpp   |  1 +
     test/validation/common/odp_cunit_common.c |  1 +
     test/validation/odp_init.c                |  1 +
     test/validation/odp_init_abort.c          |  1 +
     test/validation/odp_init_log.c            |  1 +
     7 files changed, 38 insertions(+)

    diff --git a/include/odp/api/version.h b/include/odp/api/version.h
    index 027095d..f64e4ef 100644
    --- a/include/odp/api/version.h
    +++ b/include/odp/api/version.h
    @@ -50,6 +50,8 @@ extern "C" {

     /**
      * Returns ODP API version string
    + * @sa odp_version_impl_str()
    + * @sa odp_version_str()
      */
     const char *odp_version_api_str(void);

    @@ -61,10 +63,25 @@ const char *odp_version_api_str(void);
      * of the API changing, this function returns that indication string.
      * @note This string is implementation specific.
      * @sa odp_version_api_str()
    + * @sa odp_version_str()
      *
      * @return null terminated implementation specific version
    identifier string
       */
     const char *odp_version_impl_str(void);
    +
    +/**
    + * Returns ODP version string
    + *
    + * Verbosely describe the build in use, typicaly for use in log file.
    + * @note This string is implementation specific.
    + * @sa odp_version_api_str()
    + * @sa odp_version_impl_str()
    + *
    + * @return null terminated implementation specific version string
    +  */
    +const char *odp_version_str(void);
    +
    +
     /**
      * @}
      */
    diff --git a/platform/linux-generic/odp_impl.c
    b/platform/linux-generic/odp_impl.c
    index 46d0e40..26ee3f9 100644
    --- a/platform/linux-generic/odp_impl.c
    +++ b/platform/linux-generic/odp_impl.c
    @@ -38,6 +38,22 @@ const char *odp_version_impl_str(void)
            return ODP_VERSION_IMPL_STR;
     }

    +#define ODP_VERSION_STR \
    +               ODP_VERSION_TO_STR(PLATFORM) " " \
    +  ODP_VERSION_TO_STR(ODP_VERSION_API_GENERATION) "." \
    +  ODP_VERSION_TO_STR(ODP_VERSION_API_MAJOR) "." \
    +  ODP_VERSION_TO_STR(ODP_VERSION_API_MINOR) "-" \
    +               ODP_VERSION_TO_STR(ODP_VERSION_IMPL) " (v" \
    +  ODP_VERSION_TO_STR(ODP_VERSION_API_GENERATION) "." \
    +  ODP_VERSION_TO_STR(ODP_VERSION_API_MAJOR) "." \
    +  ODP_VERSION_TO_STR(ODP_VERSION_API_MINOR) ") " \
    +               __DATE__ " " __TIME__ " " \
    +               ODP_VERSION_TO_STR(GIT_HASH)
    +
    +const char *odp_version_str(void)
    +{
    +       return ODP_VERSION_STR;
    +}
     #ifdef __cplusplus
     }
     #endif
    diff --git a/test/miscellaneous/odp_api_from_cpp.cpp
    b/test/miscellaneous/odp_api_from_cpp.cpp
    index e62ef8d..f044f92 100644
    --- a/test/miscellaneous/odp_api_from_cpp.cpp
    +++ b/test/miscellaneous/odp_api_from_cpp.cpp
    @@ -7,6 +7,7 @@ int main(int argc, const char *argv[])

            printf("\tODP API version: %s\n", odp_version_api_str());
            printf("\tODP implementation version: %s\n",
    odp_version_impl_str());
    +       printf("\tODP version: %s\n", odp_version_str());

            return 0;
     }
    diff --git a/test/validation/common/odp_cunit_common.c
    b/test/validation/common/odp_cunit_common.c
    index 2af4410..315a902 100644
    --- a/test/validation/common/odp_cunit_common.c
    +++ b/test/validation/common/odp_cunit_common.c
    @@ -55,6 +55,7 @@ int main(void)

            printf("\tODP API version: %s\n", odp_version_api_str());
            printf("\tODP implementation version: %s\n",
    odp_version_impl_str());
    +       printf("\tODP version: %s\n", odp_version_str());

            if (0 != odp_init_global(NULL, NULL)) {
                    fprintf(stderr, "error: odp_init_global() failed.\n");
    diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c
    index 82f8849..08e0b08 100644
    --- a/test/validation/odp_init.c
    +++ b/test/validation/odp_init.c
    @@ -37,6 +37,7 @@ int main(void)

            printf("\tODP API version: %s\n", odp_version_api_str());
            printf("\tODP implementation version: %s\n",
    odp_version_impl_str());
    +       printf("\tODP version: %s\n", odp_version_str());

            CU_set_error_action(CUEA_ABORT);

    diff --git a/test/validation/odp_init_abort.c
    b/test/validation/odp_init_abort.c
    index ceb82b5..7844066 100644
    --- a/test/validation/odp_init_abort.c
    +++ b/test/validation/odp_init_abort.c
    @@ -42,6 +42,7 @@ int main(void)

            printf("\tODP API version: %s\n", odp_version_api_str());
            printf("\tODP implementation version: %s\n",
    odp_version_impl_str());
    +       printf("\tODP version: %s\n", odp_version_str());

            CU_set_error_action(CUEA_ABORT);

    diff --git a/test/validation/odp_init_log.c
    b/test/validation/odp_init_log.c
    index 275d343..f905850 100644
    --- a/test/validation/odp_init_log.c
    +++ b/test/validation/odp_init_log.c
    @@ -48,6 +48,7 @@ int main(void)

            printf("\tODP API version: %s\n", odp_version_api_str());
            printf("\tODP implementation version: %s\n",
    odp_version_impl_str());
    +       printf("\tODP version: %s\n", odp_version_str());

            CU_set_error_action(CUEA_ABORT);

    --
    2.1.4

    _______________________________________________
    lng-odp mailing list
    [email protected] <mailto:[email protected]>
    https://lists.linaro.org/mailman/listinfo/lng-odp





    --
    Mike Holmes
    Technical Manager - Linaro Networking Group
    Linaro.org │ Open source software for ARM SoCs




--
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs



_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to