int VFS_FS_SIZE(AGENT_REQUEST *request, AGENT_RESULT *result) { char *fsname, *mode; int ret = SYSINFO_RET_FAIL; if (2 < request->nparam) return SYSINFO_RET_FAIL; fsname = get_rparam(request, 0); mode = get_rparam(request, 1); if (NULL == fsname || '\0' == *fsname) return SYSINFO_RET_FAIL; if (NULL == mode || '\0' == *mode || 0 == strcmp(mode, "total")) ret = VFS_FS_TOTAL(fsname, result); else if (0 == strcmp(mode, "free")) ret = VFS_FS_FREE(fsname, result); else if (0 == strcmp(mode, "used")) ret = VFS_FS_USED(fsname, result); else if (0 == strcmp(mode, "pfree")) ret = VFS_FS_PFREE(fsname, result); else if (0 == strcmp(mode, "pused")) ret = VFS_FS_PUSED(fsname, result); else ret = SYSINFO_RET_FAIL; return ret; }
int VFS_FS_SIZE(AGENT_REQUEST *request, AGENT_RESULT *result) { char *fsname, *mode; int ret = SYSINFO_RET_FAIL; if (2 < request->nparam) { SET_MSG_RESULT(result, zbx_strdup(NULL, "Too many parameters.")); return SYSINFO_RET_FAIL; } fsname = get_rparam(request, 0); mode = get_rparam(request, 1); if (NULL == fsname || '\0' == *fsname) { SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid first parameter.")); return SYSINFO_RET_FAIL; } if (NULL == mode || '\0' == *mode || 0 == strcmp(mode, "total")) ret = VFS_FS_TOTAL(fsname, result); else if (0 == strcmp(mode, "free")) ret = VFS_FS_FREE(fsname, result); else if (0 == strcmp(mode, "pfree")) ret = VFS_FS_PFREE(fsname, result); else if (0 == strcmp(mode, "used")) ret = VFS_FS_USED(fsname, result); else if (0 == strcmp(mode, "pused")) ret = VFS_FS_PUSED(fsname, result); else { SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid second parameter.")); return SYSINFO_RET_FAIL; } return ret; }