Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359616
b: refs/heads/master
c: 1ec3911
h: refs/heads/master
v: v3
  • Loading branch information
Cong Ding authored and Alex Elder committed Jan 25, 2013
1 parent 79f36e3 commit d709cd4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c04306471ad93f1daf60771a0373316d4c3494ae
refs/heads/master: 1ec3911dbd19076bcdfe5540096ff67f91a6ec02
28 changes: 10 additions & 18 deletions trunk/net/ceph/osdmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,18 @@

char *ceph_osdmap_state_str(char *str, int len, int state)
{
int flag = 0;

if (!len)
goto done;

*str = '\0';
if (state) {
if (state & CEPH_OSD_EXISTS) {
snprintf(str, len, "exists");
flag = 1;
}
if (state & CEPH_OSD_UP) {
snprintf(str, len, "%s%s%s", str, (flag ? ", " : ""),
"up");
flag = 1;
}
} else {
return str;

if ((state & CEPH_OSD_EXISTS) && (state & CEPH_OSD_UP))
snprintf(str, len, "exists, up");
else if (state & CEPH_OSD_EXISTS)
snprintf(str, len, "exists");
else if (state & CEPH_OSD_UP)
snprintf(str, len, "up");
else
snprintf(str, len, "doesn't exist");
}
done:

return str;
}

Expand Down

0 comments on commit d709cd4

Please sign in to comment.