Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\string_helpers.c Create Date:2022-07-28 06:25:57
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Return an allocated string that has been escaped of special characters* and double quotes, making it safe to log in quotes.

Proto:char *kstrdup_quotable(const char *src, gfp_t gfp)

Type:char

Parameter:

TypeParameterName
const char *src
gfp_tgfp
573  flags = ESCAPE_HEX
574  esc[] = "\f\n\r\t\v\a\e\\\""
576  If Not src Then Return NULL
578  slen = strlen(src)
580  dlen = string_escape_mem - quote characters in the given memory buffer*@src: source buffer (unescaped)*@isz: source buffer size*@dst: destination buffer (escaped)*@osz: destination buffer size*@flags: combination of the flags*@only: NULL-terminated string
581  dst = kmalloc(dlen + 1, gfp)
582  If Not dst Then Return NULL
585  WARN_ON(string_escape_mem - quote characters in the given memory buffer*@src: source buffer (unescaped)*@isz: source buffer size*@dst: destination buffer (escaped)*@osz: destination buffer size*@flags: combination of the flags*@only: NULL-terminated string != dlen)
586  dst[dlen] = '\0'
588  Return dst
Caller
NameDescribe
kstrdup_quotable_cmdlineReturns allocated NULL-terminated string containing process* command line, with inter-argument NULLs replaced with spaces,* and other special characters escaped.
kstrdup_quotable_fileReturns allocated NULL-terminated string containing pathname,* with special characters escaped, able to be safely logged. If* there is an error, the leading character will be "<".