#include <sys/dmu_objset.h>
#include <sys/dsl_dataset.h>
#include <sys/dsl_dir.h>
-#include <sys/utsname.h>
#include <sys/cmn_err.h>
#include <sys/sunddi.h>
#include <sys/cred.h>
#endif
fnvlist_add_uint64(nvl, ZPOOL_HIST_TIME, gethrestime_sec());
-#ifdef _KERNEL
- fnvlist_add_string(nvl, ZPOOL_HIST_HOST, utsname.nodename);
-#endif
+ fnvlist_add_string(nvl, ZPOOL_HIST_HOST, utsname()->nodename);
+
if (nvlist_exists(nvl, ZPOOL_HIST_CMD)) {
zfs_dbgmsg("command: %s",
fnvlist_lookup_string(nvl, ZPOOL_HIST_CMD));
}
VERIFY3U(nvlist_pack(nvl, &record_packed, &reclen, NV_ENCODE_NATIVE,
- KM_PUSHPAGE), ==, 0);
+ KM_SLEEP), ==, 0);
mutex_enter(&spa->spa_history_lock);
spa_history_log(spa_t *spa, const char *msg)
{
int err;
- nvlist_t *nvl;
-
- VERIFY0(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_PUSHPAGE));
+ nvlist_t *nvl = fnvlist_alloc();
fnvlist_add_string(nvl, ZPOOL_HIST_CMD, msg);
err = spa_history_log_nvl(spa, nvl);
return (err);
}
- VERIFY0(nvlist_dup(nvl, &nvarg, KM_PUSHPAGE));
+ VERIFY0(nvlist_dup(nvl, &nvarg, KM_SLEEP));
if (spa_history_zone() != NULL) {
fnvlist_add_string(nvarg, ZPOOL_HIST_ZONE,
spa_history_zone());
dmu_tx_t *tx, const char *fmt, va_list adx)
{
char *msg;
- va_list adx1;
- int size;
/*
* If this is part of creating a pool, not everything is
return;
}
- va_copy(adx1, adx);
- size = vsnprintf(NULL, 0, fmt, adx1) + 1;
- msg = kmem_alloc(size, KM_PUSHPAGE);
- va_end(adx1);
- va_copy(adx1, adx);
- (void) vsprintf(msg, fmt, adx1);
- va_end(adx1);
+ msg = kmem_vasprintf(fmt, adx);
fnvlist_add_string(nvl, ZPOOL_HIST_INT_STR, msg);
- kmem_free(msg, size);
+ strfree(msg);
fnvlist_add_string(nvl, ZPOOL_HIST_INT_NAME, operation);
fnvlist_add_uint64(nvl, ZPOOL_HIST_TXG, tx->tx_txg);
{
dmu_tx_t *htx = tx;
va_list adx;
- nvlist_t *nvl;
/* create a tx if we didn't get one */
if (tx == NULL) {
}
va_start(adx, fmt);
- VERIFY0(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_PUSHPAGE));
- log_internal(nvl, operation, spa, htx, fmt, adx);
+ log_internal(fnvlist_alloc(), operation, spa, htx, fmt, adx);
va_end(adx);
/* if we didn't get a tx from the caller, commit the one we made */
{
va_list adx;
char namebuf[MAXNAMELEN];
- nvlist_t *nvl;
+ nvlist_t *nvl = fnvlist_alloc();
ASSERT(tx != NULL);
dsl_dataset_name(ds, namebuf);
- VERIFY0(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_PUSHPAGE));
fnvlist_add_string(nvl, ZPOOL_HIST_DSNAME, namebuf);
fnvlist_add_uint64(nvl, ZPOOL_HIST_DSID, ds->ds_object);
{
va_list adx;
char namebuf[MAXNAMELEN];
- nvlist_t *nvl;
+ nvlist_t *nvl = fnvlist_alloc();
ASSERT(tx != NULL);
dsl_dir_name(dd, namebuf);
- VERIFY0(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_PUSHPAGE));
fnvlist_add_string(nvl, ZPOOL_HIST_DSNAME, namebuf);
fnvlist_add_uint64(nvl, ZPOOL_HIST_DSID,
- dd->dd_phys->dd_head_dataset_obj);
+ dsl_dir_phys(dd)->dd_head_dataset_obj);
va_start(adx, fmt);
log_internal(nvl, operation, dd->dd_pool->dp_spa, tx, fmt, adx);
void
spa_history_log_version(spa_t *spa, const char *operation)
{
+ utsname_t *u = utsname();
+
spa_history_log_internal(spa, operation, NULL,
"pool version %llu; software version %llu/%d; uts %s %s %s %s",
(u_longlong_t)spa_version(spa), SPA_VERSION, ZPL_VERSION,
- utsname.nodename, utsname.release, utsname.version,
- utsname.machine);
+ u->nodename, u->release, u->version, u->machine);
}
#if defined(_KERNEL) && defined(HAVE_SPL)