Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/string.h
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | kmemdup(const void *src, size_t len, gfp_t gfp) | |||||||||
dst = kmalloc(len, gfp); | dst = kmalloc(len, gfp); | |||||||||
if (dst != NULL) | if (dst != NULL) | |||||||||
memcpy(dst, src, len); | memcpy(dst, src, len); | |||||||||
return (dst); | return (dst); | |||||||||
} | } | |||||||||
static inline char * | static inline char * | |||||||||
strndup_user(const char __user *ustr, long n) | ||||||||||
{ | ||||||||||
char *kstr; | ||||||||||
kstr = memdup_user(ustr, n); | ||||||||||
if (IS_ERR(kstr)) | ||||||||||
return kstr; | ||||||||||
markjUnsubmitted Done Inline Actions
markj: | ||||||||||
kstr[n-1] = '\0'; | ||||||||||
return (kstr); | ||||||||||
} | ||||||||||
markjUnsubmitted Done Inline ActionsI think this could probably be committed separately? markj: I think this could probably be committed separately? | ||||||||||
static inline char * | ||||||||||
kstrdup(const char *string, gfp_t gfp) | kstrdup(const char *string, gfp_t gfp) | |||||||||
{ | { | |||||||||
char *retval; | char *retval; | |||||||||
size_t len; | size_t len; | |||||||||
if (string == NULL) | if (string == NULL) | |||||||||
return (NULL); | return (NULL); | |||||||||
len = strlen(string) + 1; | len = strlen(string) + 1; | |||||||||
▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines |