Lines Matching refs:state

46 zcp_clones_iter(lua_State *state)  in zcp_clones_iter()  argument
50 uint64_t dsobj = lua_tonumber(state, lua_upvalueindex(1)); in zcp_clones_iter()
51 uint64_t cursor = lua_tonumber(state, lua_upvalueindex(2)); in zcp_clones_iter()
52 dsl_pool_t *dp = zcp_run_info(state)->zri_pool; in zcp_clones_iter()
61 return (luaL_error(state, in zcp_clones_iter()
79 return (luaL_error(state, in zcp_clones_iter()
91 return (luaL_error(state, in zcp_clones_iter()
99 lua_pushnumber(state, cursor); in zcp_clones_iter()
100 lua_replace(state, lua_upvalueindex(2)); in zcp_clones_iter()
102 (void) lua_pushstring(state, clonename); in zcp_clones_iter()
121 zcp_clones_list(lua_State *state) in zcp_clones_list() argument
123 const char *snapname = lua_tostring(state, 1); in zcp_clones_list()
124 dsl_pool_t *dp = zcp_run_info(state)->zri_pool; in zcp_clones_list()
133 dsl_dataset_t *ds = zcp_dataset_hold(state, dp, snapname, FTAG); in zcp_clones_list()
142 return (zcp_argerror(state, 1, "%s is not a snapshot", in zcp_clones_list()
146 lua_pushnumber(state, dsobj); in zcp_clones_list()
147 lua_pushnumber(state, cursor); in zcp_clones_list()
148 lua_pushcclosure(state, &zcp_clones_iter, 2); in zcp_clones_list()
153 zcp_snapshots_iter(lua_State *state) in zcp_snapshots_iter() argument
157 uint64_t dsobj = lua_tonumber(state, lua_upvalueindex(1)); in zcp_snapshots_iter()
158 uint64_t cursor = lua_tonumber(state, lua_upvalueindex(2)); in zcp_snapshots_iter()
159 dsl_pool_t *dp = zcp_run_info(state)->zri_pool; in zcp_snapshots_iter()
166 return (luaL_error(state, in zcp_snapshots_iter()
184 return (luaL_error(state, in zcp_snapshots_iter()
188 lua_pushnumber(state, cursor); in zcp_snapshots_iter()
189 lua_replace(state, lua_upvalueindex(2)); in zcp_snapshots_iter()
191 (void) lua_pushstring(state, snapname); in zcp_snapshots_iter()
210 zcp_snapshots_list(lua_State *state) in zcp_snapshots_list() argument
212 const char *fsname = lua_tostring(state, 1); in zcp_snapshots_list()
213 dsl_pool_t *dp = zcp_run_info(state)->zri_pool; in zcp_snapshots_list()
217 dsl_dataset_t *ds = zcp_dataset_hold(state, dp, fsname, FTAG); in zcp_snapshots_list()
225 return (zcp_argerror(state, 1, in zcp_snapshots_list()
229 lua_pushnumber(state, dsobj); in zcp_snapshots_list()
230 lua_pushnumber(state, 0); in zcp_snapshots_list()
231 lua_pushcclosure(state, &zcp_snapshots_iter, 2); in zcp_snapshots_list()
250 zcp_children_iter(lua_State *state) in zcp_children_iter() argument
254 uint64_t dsobj = lua_tonumber(state, lua_upvalueindex(1)); in zcp_children_iter()
255 uint64_t cursor = lua_tonumber(state, lua_upvalueindex(2)); in zcp_children_iter()
256 zcp_run_info_t *ri = zcp_run_info(state); in zcp_children_iter()
264 return (luaL_error(state, in zcp_children_iter()
284 return (luaL_error(state, in zcp_children_iter()
289 lua_pushnumber(state, cursor); in zcp_children_iter()
290 lua_replace(state, lua_upvalueindex(2)); in zcp_children_iter()
292 (void) lua_pushstring(state, childname); in zcp_children_iter()
311 zcp_children_list(lua_State *state) in zcp_children_list() argument
313 const char *fsname = lua_tostring(state, 1); in zcp_children_list()
314 dsl_pool_t *dp = zcp_run_info(state)->zri_pool; in zcp_children_list()
318 dsl_dataset_t *ds = zcp_dataset_hold(state, dp, fsname, FTAG); in zcp_children_list()
327 return (zcp_argerror(state, 1, in zcp_children_list()
331 lua_pushnumber(state, dsobj); in zcp_children_list()
332 lua_pushnumber(state, 0); in zcp_children_list()
333 lua_pushcclosure(state, &zcp_children_iter, 2); in zcp_children_list()
338 zcp_props_list_gc(lua_State *state) in zcp_props_list_gc() argument
340 nvlist_t **props = lua_touserdata(state, 1); in zcp_props_list_gc()
347 zcp_props_iter(lua_State *state) in zcp_props_iter() argument
351 nvlist_t **props = lua_touserdata(state, lua_upvalueindex(1)); in zcp_props_iter()
352 nvpair_t *pair = lua_touserdata(state, lua_upvalueindex(2)); in zcp_props_iter()
363 lua_pushlightuserdata(state, pair); in zcp_props_iter()
364 lua_replace(state, lua_upvalueindex(2)); in zcp_props_iter()
370 (void) lua_pushstring(state, nvpair_name(pair)); in zcp_props_iter()
371 (void) lua_pushstring(state, val); in zcp_props_iter()
372 (void) lua_pushstring(state, source); in zcp_props_iter()
392 zcp_props_list(lua_State *state) in zcp_props_list() argument
394 const char *dsname = lua_tostring(state, 1); in zcp_props_list()
395 dsl_pool_t *dp = zcp_run_info(state)->zri_pool; in zcp_props_list()
397 nvlist_t **props = lua_newuserdata(state, sizeof (nvlist_t *)); in zcp_props_list()
399 dsl_dataset_t *ds = zcp_dataset_hold(state, dp, dsname, FTAG); in zcp_props_list()
409 luaL_getmetatable(state, zcp_props_list_info.name); in zcp_props_list()
410 (void) lua_setmetatable(state, -2); in zcp_props_list()
412 lua_pushlightuserdata(state, NULL); in zcp_props_list()
413 lua_pushcclosure(state, &zcp_props_iter, 2); in zcp_props_list()
454 zcp_system_props_list(lua_State *state) in zcp_system_props_list() argument
459 dsl_pool_t *dp = zcp_run_info(state)->zri_pool; in zcp_system_props_list()
461 zcp_parse_args(state, libinfo->name, libinfo->pargs, libinfo->kwargs); in zcp_system_props_list()
462 dataset_name = lua_tostring(state, 1); in zcp_system_props_list()
465 dsl_dataset_t *ds = zcp_dataset_hold(state, dp, dataset_name, FTAG); in zcp_system_props_list()
474 error = zcp_nvlist_to_lua(state, nv, errbuf, sizeof (errbuf)); in zcp_system_props_list()
477 return (luaL_error(state, in zcp_system_props_list()
484 zcp_list_func(lua_State *state) in zcp_list_func() argument
486 zcp_list_info_t *info = lua_touserdata(state, lua_upvalueindex(1)); in zcp_list_func()
488 zcp_parse_args(state, info->name, info->pargs, info->kwargs); in zcp_list_func()
490 return (info->func(state)); in zcp_list_func()
494 zcp_load_list_lib(lua_State *state) in zcp_load_list_lib() argument
506 lua_newtable(state); in zcp_load_list_lib()
517 (void) luaL_newmetatable(state, info->name); in zcp_load_list_lib()
518 (void) lua_pushstring(state, "__gc"); in zcp_load_list_lib()
519 lua_pushcfunction(state, info->gc); in zcp_load_list_lib()
520 lua_settable(state, -3); in zcp_load_list_lib()
521 lua_pop(state, 1); in zcp_load_list_lib()
524 lua_pushlightuserdata(state, info); in zcp_load_list_lib()
525 lua_pushcclosure(state, &zcp_list_func, 1); in zcp_load_list_lib()
526 lua_setfield(state, -2, info->name); in zcp_load_list_lib()