dsl_prop.c (185029) | dsl_prop.c (209962) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* |
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. | 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
23 * Use is subject to license terms. 24 */ 25 | 23 * Use is subject to license terms. 24 */ 25 |
26#pragma ident "%Z%%M% %I% %E% SMI" 27 | |
28#include <sys/dmu.h> 29#include <sys/dmu_objset.h> 30#include <sys/dmu_tx.h> 31#include <sys/dsl_dataset.h> 32#include <sys/dsl_dir.h> 33#include <sys/dsl_prop.h> 34#include <sys/dsl_synctask.h> 35#include <sys/spa.h> --- 375 unchanged lines hidden (view full) --- 411 valstr = (char *)psa->buf; 412 } 413 spa_history_internal_log((psa->numints == 0) ? LOG_DS_INHERIT : 414 LOG_DS_PROPSET, ds->ds_dir->dd_pool->dp_spa, tx, cr, 415 "%s=%s dataset = %llu", psa->name, valstr, ds->ds_object); 416} 417 418void | 26#include <sys/dmu.h> 27#include <sys/dmu_objset.h> 28#include <sys/dmu_tx.h> 29#include <sys/dsl_dataset.h> 30#include <sys/dsl_dir.h> 31#include <sys/dsl_prop.h> 32#include <sys/dsl_synctask.h> 33#include <sys/spa.h> --- 375 unchanged lines hidden (view full) --- 409 valstr = (char *)psa->buf; 410 } 411 spa_history_internal_log((psa->numints == 0) ? LOG_DS_INHERIT : 412 LOG_DS_PROPSET, ds->ds_dir->dd_pool->dp_spa, tx, cr, 413 "%s=%s dataset = %llu", psa->name, valstr, ds->ds_object); 414} 415 416void |
417dsl_props_set_sync(void *arg1, void *arg2, cred_t *cr, dmu_tx_t *tx) 418{ 419 dsl_dataset_t *ds = arg1; 420 nvlist_t *nvl = arg2; 421 nvpair_t *elem = NULL; 422 423 while ((elem = nvlist_next_nvpair(nvl, elem)) != NULL) { 424 struct prop_set_arg psa; 425 426 psa.name = nvpair_name(elem); 427 428 if (nvpair_type(elem) == DATA_TYPE_STRING) { 429 VERIFY(nvpair_value_string(elem, 430 (char **)&psa.buf) == 0); 431 psa.intsz = 1; 432 psa.numints = strlen(psa.buf) + 1; 433 } else { 434 uint64_t intval; 435 VERIFY(nvpair_value_uint64(elem, &intval) == 0); 436 psa.intsz = sizeof (intval); 437 psa.numints = 1; 438 psa.buf = &intval; 439 } 440 dsl_prop_set_sync(ds, &psa, cr, tx); 441 } 442} 443 444void |
|
419dsl_prop_set_uint64_sync(dsl_dir_t *dd, const char *name, uint64_t val, 420 cred_t *cr, dmu_tx_t *tx) 421{ 422 objset_t *mos = dd->dd_pool->dp_meta_objset; 423 uint64_t zapobj = dd->dd_phys->dd_props_zapobj; 424 425 ASSERT(dmu_tx_is_syncing(tx)); 426 --- 39 unchanged lines hidden (view full) --- 466 psa.buf = buf; 467 err = dsl_sync_task_do(ds->ds_dir->dd_pool, 468 NULL, dsl_prop_set_sync, ds, &psa, 2); 469 470 dsl_dataset_rele(ds, FTAG); 471 return (err); 472} 473 | 445dsl_prop_set_uint64_sync(dsl_dir_t *dd, const char *name, uint64_t val, 446 cred_t *cr, dmu_tx_t *tx) 447{ 448 objset_t *mos = dd->dd_pool->dp_meta_objset; 449 uint64_t zapobj = dd->dd_phys->dd_props_zapobj; 450 451 ASSERT(dmu_tx_is_syncing(tx)); 452 --- 39 unchanged lines hidden (view full) --- 492 psa.buf = buf; 493 err = dsl_sync_task_do(ds->ds_dir->dd_pool, 494 NULL, dsl_prop_set_sync, ds, &psa, 2); 495 496 dsl_dataset_rele(ds, FTAG); 497 return (err); 498} 499 |
500int 501dsl_props_set(const char *dsname, nvlist_t *nvl) 502{ 503 dsl_dataset_t *ds; 504 nvpair_t *elem = NULL; 505 int err; 506 507 /* 508 * Do these checks before the syncfunc, since it can't fail. 509 */ 510 while ((elem = nvlist_next_nvpair(nvl, elem)) != NULL) { 511 if (strlen(nvpair_name(elem)) >= ZAP_MAXNAMELEN) 512 return (ENAMETOOLONG); 513 if (nvpair_type(elem) == DATA_TYPE_STRING) { 514 char *valstr; 515 VERIFY(nvpair_value_string(elem, &valstr) == 0); 516 if (strlen(valstr) >= ZAP_MAXVALUELEN) 517 return (E2BIG); 518 } 519 } 520 521 if (err = dsl_dataset_hold(dsname, FTAG, &ds)) 522 return (err); 523 524 if (dsl_dataset_is_snapshot(ds) && 525 spa_version(ds->ds_dir->dd_pool->dp_spa) < SPA_VERSION_SNAP_PROPS) { 526 dsl_dataset_rele(ds, FTAG); 527 return (ENOTSUP); 528 } 529 530 err = dsl_sync_task_do(ds->ds_dir->dd_pool, 531 NULL, dsl_props_set_sync, ds, nvl, 2); 532 533 dsl_dataset_rele(ds, FTAG); 534 return (err); 535} 536 |
|
474/* 475 * Iterate over all properties for this dataset and return them in an nvlist. 476 */ 477int 478dsl_prop_get_all(objset_t *os, nvlist_t **nvp, boolean_t local) 479{ 480 dsl_dataset_t *ds = os->os->os_dsl_dataset; 481 dsl_dir_t *dd = ds->ds_dir; --- 121 unchanged lines hidden --- | 537/* 538 * Iterate over all properties for this dataset and return them in an nvlist. 539 */ 540int 541dsl_prop_get_all(objset_t *os, nvlist_t **nvp, boolean_t local) 542{ 543 dsl_dataset_t *ds = os->os->os_dsl_dataset; 544 dsl_dir_t *dd = ds->ds_dir; --- 121 unchanged lines hidden --- |