Discussion:
[Libstoragemgmt-devel] [PATCH] uniform return 0 to LSM_ERR_OK
Ma Shimiao
2014-02-19 09:02:04 UTC
Permalink
Value 0 makes no sense.

Signed-off-by: Ma Shimiao <***@cn.fujitsu.com>
---
src/lsm_mgmt.cpp | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/lsm_mgmt.cpp b/src/lsm_mgmt.cpp
index 694e10a..cec1984 100644
--- a/src/lsm_mgmt.cpp
+++ b/src/lsm_mgmt.cpp
@@ -371,7 +371,7 @@ int lsmConnectSetTimeout(lsmConnect *c, uint32_t timeout, lsmFlag_t flags)

int lsmConnectGetTimeout(lsmConnect *c, uint32_t *timeout, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -400,7 +400,7 @@ static int jobStatus( lsmConnect *c, const char *job,
lsmJobStatus *status, uint8_t *percentComplete,
Value &returned_value, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( !job || !status || !percentComplete ) {
@@ -449,7 +449,7 @@ int lsmJobStatusVolumeGet( lsmConnect *c, const char *job,
lsmVolume **vol, lsmFlag_t flags)
{
Value rv;
- int rc = 0;
+ int rc = LSM_ERR_OK;

CONN_SETUP(c);

@@ -479,7 +479,7 @@ int lsmJobStatusFsGet(lsmConnect *c, const char *job,
lsmJobStatus *status, uint8_t *percentComplete,
lsmFs **fs, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
Value rv;

if( CHECK_RP(fs) || LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -508,7 +508,7 @@ int lsmJobStatusSsGet(lsmConnect *c, const char *job,
lsmJobStatus *status, uint8_t *percentComplete,
lsmSs **ss, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
Value rv;

if( CHECK_RP(ss) || LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -560,7 +560,7 @@ int lsmJobFree(lsmConnect *c, char **job, lsmFlag_t flags)
int lsmCapabilities(lsmConnect *c, lsmSystem *system,
lsmStorageCapabilities **cap, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( !LSM_IS_SYSTEM(system) ) {
@@ -596,7 +596,7 @@ int lsmCapabilities(lsmConnect *c, lsmSystem *system,
int lsmPoolList(lsmConnect *c, lsmPool **poolArray[],
uint32_t *count, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( !poolArray || !count || CHECK_RP(poolArray) || LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -941,7 +941,7 @@ int lsmVolumeReplicate(lsmConnect *c, lsmPool *pool,
int lsmVolumeReplicateRangeBlockSize(lsmConnect *c, lsmSystem *system,
uint32_t *bs, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( !bs || LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -1009,7 +1009,7 @@ int lsmVolumeReplicateRange(lsmConnect *c,
int lsmVolumeDelete(lsmConnect *c, lsmVolume *volume, char **job,
lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( !LSM_IS_VOL(volume) ) {
@@ -1409,7 +1409,7 @@ int lsmVolumesAccessibleByAccessGroup(lsmConnect *c,
lsmVolume **volumes[],
uint32_t *count, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( !LSM_IS_ACCESS_GROUP(group)) {
@@ -1483,7 +1483,7 @@ int lsmAccessGroupsGrantedToVolume(lsmConnect *c,
int lsmVolumeChildDependency(lsmConnect *c, lsmVolume *volume,
uint8_t *yes, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( !LSM_IS_VOL(volume)) {
@@ -1549,7 +1549,7 @@ int lsmVolumeChildDependencyRm(lsmConnect *c, lsmVolume *volume,
int lsmSystemList(lsmConnect *c, lsmSystem **systems[],
uint32_t *systemCount, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( !systems || ! systemCount || LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -1600,7 +1600,7 @@ int lsmSystemList(lsmConnect *c, lsmSystem **systems[],
int lsmFsList(lsmConnect *c, lsmFs **fs[], uint32_t *fsCount,
lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( !fs || !fsCount || LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -1794,7 +1794,7 @@ int lsmFsFileClone(lsmConnect *c, lsmFs *fs, const char *src_file_name,
int lsmFsChildDependency( lsmConnect *c, lsmFs *fs, lsmStringList *files,
uint8_t *yes, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( !LSM_IS_FS(fs) ) {
@@ -1874,7 +1874,7 @@ int lsmFsChildDependencyRm( lsmConnect *c, lsmFs *fs, lsmStringList *files,
int lsmFsSsList(lsmConnect *c, lsmFs *fs, lsmSs **ss[],
uint32_t *ssCount, lsmFlag_t flags )
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( !LSM_IS_FS(fs) ) {
@@ -2040,7 +2040,7 @@ int lsmFsSsRevert(lsmConnect *c, lsmFs *fs, lsmSs *ss,
int lsmNfsList( lsmConnect *c, lsmNfsExport **exports[], uint32_t *count,
lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);

if( CHECK_RP(exports) || !count || LSM_FLAG_UNUSED_CHECK(flags) ) {
--
1.8.3.1
Ma Shimiao
2014-02-19 09:02:05 UTC
Permalink
When I try to complie the source code, it told me to install json.
I searched and found many packeages, but not sure which one is right.
I think we should tell user what exactly the package name is.

Signed-off-by: Ma Shimiao <***@cn.fujitsu.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index df3457a..2d1a629 100644
--- a/configure.ac
+++ b/configure.ac
@@ -141,7 +141,7 @@ AC_ARG_WITH([rest-api],
[with_rest_api=yes])
if test "x$with_rest_api" = "xyes"; then
PKG_CHECK_MODULES([LIBMICROHTTPD], [libmicrohttpd >= 0.9])
- PKG_CHECK_MODULES([JSON], [json >= 0.10])
+ PKG_CHECK_MODULES([JSON], [json-c >= 0.10])
fi
AM_CONDITIONAL([WITH_REST_API], [test "x$with_rest_api" = "xyes"])
--
1.8.3.1
Tony Asleson
2014-02-19 14:48:18 UTC
Permalink
Post by Ma Shimiao
When I try to complie the source code, it told me to install json.
I searched and found many packeages, but not sure which one is right.
I think we should tell user what exactly the package name is.
On EL6 package config for json-c was just json. On newer releases they
changed it to json-c, but kept json for backwards compatibility so it
works for older and newer.

Sorry this caused an issue with finding the package, but it needs to
remain this way to build.

I try to keep the wiki page
http://sourceforge.net/p/libstoragemgmt/wiki/RunningDevel/ up to date on
such things.

Regards,
Tony
Gris Ge
2014-02-19 15:09:58 UTC
Permalink
Post by Ma Shimiao
When I try to complie the source code, it told me to install json.
I searched and found many packeages, but not sure which one is right.
I think we should tell user what exactly the package name is.
- PKG_CHECK_MODULES([JSON], [json >= 0.10])
+ PKG_CHECK_MODULES([JSON], [json-c >= 0.10])
fi
We are using 'json' is to supporting RHEL 6(json-c-0.10).
Since json-c-devel 0.11, they are providing both 'json.pc' and 'json-c.pc'.

For 'PKG_CHECK_MODULES([XXX], [xxx])', you can use one of these command
to search out the correct package:
yum provides \*/xxx.pc
zypper wp xxx.pc
apt-file search xxx.pc

Thanks.
Best regards.
--
Gris Ge
Gris Ge
2014-02-19 15:12:36 UTC
Permalink
Post by Ma Shimiao
When I try to complie the source code, it told me to install json.
I searched and found many packeages, but not sure which one is right.
I think we should tell user what exactly the package name is.
- PKG_CHECK_MODULES([JSON], [json >= 0.10])
+ PKG_CHECK_MODULES([JSON], [json-c >= 0.10])
fi
Sorry I missed your point about 'miss-leading' package name.
I will investigate out whether autoconf allow us to print something if
error.

Thanks for the suggestion.
Best regards.
--
Gris Ge
Tony Asleson
2014-02-19 16:00:53 UTC
Permalink
Post by Gris Ge
Sorry I missed your point about 'miss-leading' package name.
I will investigate out whether autoconf allow us to print something if
error.
Patch posted that does this, see:

[PATCH] configure.ac: Make json-c requirement more explicit

Regards,
Tony
Tony Asleson
2014-02-20 15:30:00 UTC
Permalink
Thanks, patch pushed!

Regards,
Tony
Post by Ma Shimiao
Value 0 makes no sense.
---
src/lsm_mgmt.cpp | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/lsm_mgmt.cpp b/src/lsm_mgmt.cpp
index 694e10a..cec1984 100644
--- a/src/lsm_mgmt.cpp
+++ b/src/lsm_mgmt.cpp
@@ -371,7 +371,7 @@ int lsmConnectSetTimeout(lsmConnect *c, uint32_t timeout, lsmFlag_t flags)
int lsmConnectGetTimeout(lsmConnect *c, uint32_t *timeout, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -400,7 +400,7 @@ static int jobStatus( lsmConnect *c, const char *job,
lsmJobStatus *status, uint8_t *percentComplete,
Value &returned_value, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( !job || !status || !percentComplete ) {
@@ -449,7 +449,7 @@ int lsmJobStatusVolumeGet( lsmConnect *c, const char *job,
lsmVolume **vol, lsmFlag_t flags)
{
Value rv;
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
@@ -479,7 +479,7 @@ int lsmJobStatusFsGet(lsmConnect *c, const char *job,
lsmJobStatus *status, uint8_t *percentComplete,
lsmFs **fs, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
Value rv;
if( CHECK_RP(fs) || LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -508,7 +508,7 @@ int lsmJobStatusSsGet(lsmConnect *c, const char *job,
lsmJobStatus *status, uint8_t *percentComplete,
lsmSs **ss, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
Value rv;
if( CHECK_RP(ss) || LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -560,7 +560,7 @@ int lsmJobFree(lsmConnect *c, char **job, lsmFlag_t flags)
int lsmCapabilities(lsmConnect *c, lsmSystem *system,
lsmStorageCapabilities **cap, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( !LSM_IS_SYSTEM(system) ) {
@@ -596,7 +596,7 @@ int lsmCapabilities(lsmConnect *c, lsmSystem *system,
int lsmPoolList(lsmConnect *c, lsmPool **poolArray[],
uint32_t *count, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( !poolArray || !count || CHECK_RP(poolArray) || LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -941,7 +941,7 @@ int lsmVolumeReplicate(lsmConnect *c, lsmPool *pool,
int lsmVolumeReplicateRangeBlockSize(lsmConnect *c, lsmSystem *system,
uint32_t *bs, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( !bs || LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -1009,7 +1009,7 @@ int lsmVolumeReplicateRange(lsmConnect *c,
int lsmVolumeDelete(lsmConnect *c, lsmVolume *volume, char **job,
lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( !LSM_IS_VOL(volume) ) {
@@ -1409,7 +1409,7 @@ int lsmVolumesAccessibleByAccessGroup(lsmConnect *c,
lsmVolume **volumes[],
uint32_t *count, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( !LSM_IS_ACCESS_GROUP(group)) {
@@ -1483,7 +1483,7 @@ int lsmAccessGroupsGrantedToVolume(lsmConnect *c,
int lsmVolumeChildDependency(lsmConnect *c, lsmVolume *volume,
uint8_t *yes, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( !LSM_IS_VOL(volume)) {
@@ -1549,7 +1549,7 @@ int lsmVolumeChildDependencyRm(lsmConnect *c, lsmVolume *volume,
int lsmSystemList(lsmConnect *c, lsmSystem **systems[],
uint32_t *systemCount, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( !systems || ! systemCount || LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -1600,7 +1600,7 @@ int lsmSystemList(lsmConnect *c, lsmSystem **systems[],
int lsmFsList(lsmConnect *c, lsmFs **fs[], uint32_t *fsCount,
lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( !fs || !fsCount || LSM_FLAG_UNUSED_CHECK(flags) ) {
@@ -1794,7 +1794,7 @@ int lsmFsFileClone(lsmConnect *c, lsmFs *fs, const char *src_file_name,
int lsmFsChildDependency( lsmConnect *c, lsmFs *fs, lsmStringList *files,
uint8_t *yes, lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( !LSM_IS_FS(fs) ) {
@@ -1874,7 +1874,7 @@ int lsmFsChildDependencyRm( lsmConnect *c, lsmFs *fs, lsmStringList *files,
int lsmFsSsList(lsmConnect *c, lsmFs *fs, lsmSs **ss[],
uint32_t *ssCount, lsmFlag_t flags )
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( !LSM_IS_FS(fs) ) {
@@ -2040,7 +2040,7 @@ int lsmFsSsRevert(lsmConnect *c, lsmFs *fs, lsmSs *ss,
int lsmNfsList( lsmConnect *c, lsmNfsExport **exports[], uint32_t *count,
lsmFlag_t flags)
{
- int rc = 0;
+ int rc = LSM_ERR_OK;
CONN_SETUP(c);
if( CHECK_RP(exports) || !count || LSM_FLAG_UNUSED_CHECK(flags) ) {
Loading...