The first one is to truncate the memory limit to
VIR_DOMAIN_MEMORY_PARAM_UNLIMITED if the value is greater and the second
one is to decide whether the memory limit is set or not, unlimited means
that it's not set.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
virIsDevMapperDevice;
virIsSUID;
virManageVport;
+virMemoryLimitIsSet;
+virMemoryLimitTruncate;
virParseNumber;
virParseOwnershipIds;
virParseVersionString;
return val;
return val / 1024;
}
+
+/**
+ * virMemoryLimitTruncate
+ *
+ * Return truncated memory limit to VIR_DOMAIN_MEMORY_PARAM_UNLIMITED as maximum
+ * which means that the limit is not set => unlimited.
+ */
+unsigned long long
+virMemoryLimitTruncate(unsigned long long value)
+{
+ return value < VIR_DOMAIN_MEMORY_PARAM_UNLIMITED ? value :
+ VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
+}
+
+/**
+ * virMemoryLimitIsSet
+ *
+ * Returns true if the limit is set and false for unlimited value.
+ */
+bool
+virMemoryLimitIsSet(unsigned long long value)
+{
+ return value < VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
+}
long virGetSystemPageSize(void);
long virGetSystemPageSizeKB(void);
+unsigned long long virMemoryLimitTruncate(unsigned long long value);
+bool virMemoryLimitIsSet(unsigned long long value);
+
#endif /* __VIR_UTIL_H__ */