提交 22b02f44 编写于 作者: P Pavel Hrdina

util: virqemu: introduce virQEMUBuildBufferEscape

This will eventually replace virQEMUBuildBufferEscapeComma, however
it's not possible right now.  Some parts of the code that uses the
old function needs to be refactored.
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 72640346
...@@ -2298,6 +2298,7 @@ virProcessWait; ...@@ -2298,6 +2298,7 @@ virProcessWait;
# util/virqemu.h # util/virqemu.h
virQEMUBuildBufferEscape;
virQEMUBuildBufferEscapeComma; virQEMUBuildBufferEscapeComma;
virQEMUBuildCommandLineJSON; virQEMUBuildCommandLineJSON;
virQEMUBuildCommandLineJSONArrayBitmap; virQEMUBuildCommandLineJSONArrayBitmap;
......
...@@ -299,6 +299,23 @@ virQEMUBuildBufferEscapeComma(virBufferPtr buf, const char *str) ...@@ -299,6 +299,23 @@ virQEMUBuildBufferEscapeComma(virBufferPtr buf, const char *str)
} }
/**
* virQEMUBuildBufferEscape:
* @buf: buffer to append the escaped string
* @str: the string to escape
*
* Some characters passed as values on the QEMU command line must be escaped.
*
* - ',' must by escaped by ','
* - '=' must by escaped by '\'
*/
void
virQEMUBuildBufferEscape(virBufferPtr buf, const char *str)
{
virBufferEscapeN(buf, "%s", str, ',', ",", '\\', "=", NULL);
}
/** /**
* virQEMUBuildLuksOpts: * virQEMUBuildLuksOpts:
* @buf: buffer to build the string into * @buf: buffer to build the string into
......
...@@ -50,6 +50,7 @@ char *virQEMUBuildObjectCommandlineFromJSON(const char *type, ...@@ -50,6 +50,7 @@ char *virQEMUBuildObjectCommandlineFromJSON(const char *type,
char *virQEMUBuildDriveCommandlineFromJSON(virJSONValuePtr src); char *virQEMUBuildDriveCommandlineFromJSON(virJSONValuePtr src);
void virQEMUBuildBufferEscapeComma(virBufferPtr buf, const char *str); void virQEMUBuildBufferEscapeComma(virBufferPtr buf, const char *str);
void virQEMUBuildBufferEscape(virBufferPtr buf, const char *str);
void virQEMUBuildLuksOpts(virBufferPtr buf, void virQEMUBuildLuksOpts(virBufferPtr buf,
virStorageEncryptionInfoDefPtr enc, virStorageEncryptionInfoDefPtr enc,
const char *alias) const char *alias)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册