MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zfs_ioc_create

Function zfs_ioc_create

freebsd/contrib/openzfs/module/zfs/zfs_ioctl.c:3215–3336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3213};
3214
3215static int
3216zfs_ioc_create(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl)
3217{
3218 int error = 0;
3219 zfs_creat_t zct = { 0 };
3220 nvlist_t *nvprops = NULL;
3221 nvlist_t *hidden_args = NULL;
3222 void (*cbfunc)(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx);
3223 dmu_objset_type_t type;
3224 boolean_t is_insensitive = B_FALSE;
3225 dsl_crypto_params_t *dcp = NULL;
3226
3227 type = (dmu_objset_type_t)fnvlist_lookup_int32(innvl, "type");
3228 (void) nvlist_lookup_nvlist(innvl, "props", &nvprops);
3229 (void) nvlist_lookup_nvlist(innvl, ZPOOL_HIDDEN_ARGS, &hidden_args);
3230
3231 switch (type) {
3232 case DMU_OST_ZFS:
3233 cbfunc = zfs_create_cb;
3234 break;
3235
3236 case DMU_OST_ZVOL:
3237 cbfunc = zvol_create_cb;
3238 break;
3239
3240 default:
3241 cbfunc = NULL;
3242 break;
3243 }
3244 if (strchr(fsname, '@') ||
3245 strchr(fsname, '%'))
3246 return (SET_ERROR(EINVAL));
3247
3248 zct.zct_props = nvprops;
3249
3250 if (cbfunc == NULL)
3251 return (SET_ERROR(EINVAL));
3252
3253 if (type == DMU_OST_ZVOL) {
3254 uint64_t volsize, volblocksize;
3255
3256 if (nvprops == NULL)
3257 return (SET_ERROR(EINVAL));
3258 if (nvlist_lookup_uint64(nvprops,
3259 zfs_prop_to_name(ZFS_PROP_VOLSIZE), &volsize) != 0)
3260 return (SET_ERROR(EINVAL));
3261
3262 if ((error = nvlist_lookup_uint64(nvprops,
3263 zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE),
3264 &volblocksize)) != 0 && error != ENOENT)
3265 return (SET_ERROR(EINVAL));
3266
3267 if (error != 0)
3268 volblocksize = zfs_prop_default_numeric(
3269 ZFS_PROP_VOLBLOCKSIZE);
3270
3271 if ((error = zvol_check_volblocksize(fsname,
3272 volblocksize)) != 0 ||

Callers

nothing calls this directly

Calls 15

fnvlist_lookup_int32Function · 0.85
nvlist_lookup_nvlistFunction · 0.85
strchrFunction · 0.85
nvlist_lookup_uint64Function · 0.85
zfs_prop_to_nameFunction · 0.85
zfs_prop_default_numericFunction · 0.85
zvol_check_volblocksizeFunction · 0.85
zvol_check_volsizeFunction · 0.85
nvlist_allocFunction · 0.85
zfs_fill_zplpropsFunction · 0.85
dmu_objset_createFunction · 0.85

Tested by

no test coverage detected