| 1276 | } |
| 1277 | |
| 1278 | int |
| 1279 | dmu_objset_create(const char *name, dmu_objset_type_t type, uint64_t flags, |
| 1280 | dsl_crypto_params_t *dcp, dmu_objset_create_sync_func_t func, void *arg) |
| 1281 | { |
| 1282 | dmu_objset_create_arg_t doca; |
| 1283 | dsl_crypto_params_t tmp_dcp = { 0 }; |
| 1284 | |
| 1285 | doca.doca_name = name; |
| 1286 | doca.doca_cred = CRED(); |
| 1287 | doca.doca_proc = curproc; |
| 1288 | doca.doca_flags = flags; |
| 1289 | doca.doca_userfunc = func; |
| 1290 | doca.doca_userarg = arg; |
| 1291 | doca.doca_type = type; |
| 1292 | |
| 1293 | /* |
| 1294 | * Some callers (mostly for testing) do not provide a dcp on their |
| 1295 | * own but various code inside the sync task will require it to be |
| 1296 | * allocated. Rather than adding NULL checks throughout this code |
| 1297 | * or adding dummy dcp's to all of the callers we simply create a |
| 1298 | * dummy one here and use that. This zero dcp will have the same |
| 1299 | * effect as asking for inheritance of all encryption params. |
| 1300 | */ |
| 1301 | doca.doca_dcp = (dcp != NULL) ? dcp : &tmp_dcp; |
| 1302 | |
| 1303 | int rv = dsl_sync_task(name, |
| 1304 | dmu_objset_create_check, dmu_objset_create_sync, &doca, |
| 1305 | 6, ZFS_SPACE_CHECK_NORMAL); |
| 1306 | |
| 1307 | if (rv == 0) |
| 1308 | zvol_create_minor(name); |
| 1309 | return (rv); |
| 1310 | } |
| 1311 | |
| 1312 | typedef struct dmu_objset_clone_arg { |
| 1313 | const char *doca_clone; |