mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Add linux kernel memory support
Required kmem/vmem changes Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
+15
-13
@@ -1107,25 +1107,27 @@ ksiddomain_rele(ksiddomain_t *ksid)
|
||||
umem_free(ksid, sizeof (ksiddomain_t));
|
||||
}
|
||||
|
||||
/*
|
||||
* Do not change the length of the returned string; it must be freed
|
||||
* with strfree().
|
||||
*/
|
||||
char *
|
||||
kmem_vasprintf(const char *fmt, va_list adx)
|
||||
{
|
||||
char *buf = NULL;
|
||||
va_list adx_copy;
|
||||
|
||||
va_copy(adx_copy, adx);
|
||||
VERIFY(vasprintf(&buf, fmt, adx_copy) != -1);
|
||||
va_end(adx_copy);
|
||||
|
||||
return (buf);
|
||||
}
|
||||
|
||||
char *
|
||||
kmem_asprintf(const char *fmt, ...)
|
||||
{
|
||||
int size;
|
||||
char *buf = NULL;
|
||||
va_list adx;
|
||||
char *buf;
|
||||
|
||||
va_start(adx, fmt);
|
||||
size = vsnprintf(NULL, 0, fmt, adx) + 1;
|
||||
va_end(adx);
|
||||
|
||||
buf = kmem_alloc(size, KM_SLEEP);
|
||||
|
||||
va_start(adx, fmt);
|
||||
size = vsnprintf(buf, size, fmt, adx);
|
||||
VERIFY(vasprintf(&buf, fmt, adx) != -1);
|
||||
va_end(adx);
|
||||
|
||||
return (buf);
|
||||
|
||||
Reference in New Issue
Block a user