plugins ext FEATURE initial schema-mount support

Only for XML data for now. Includes lots of other
changes needed to support this extension.
diff --git a/src/context.h b/src/context.h
index fdd87e2..8752e56 100644
--- a/src/context.h
+++ b/src/context.h
@@ -224,7 +224,7 @@
 LIBYANG_API_DECL LY_ERR ly_ctx_new(const char *search_dir, uint16_t options, struct ly_ctx **new_ctx);
 
 /**
- * @brief Create libyang context according to the content of the given yang-library data.
+ * @brief Create libyang context according to the provided yang-library data in a file.
  *
  * This function loads the yang-library data from the given path. If you need to pass the data as
  * string, use ::::ly_ctx_new_ylmem(). Both functions extend functionality of ::ly_ctx_new() by loading
@@ -244,20 +244,13 @@
  * @param[out] ctx Pointer to the created libyang context if LY_SUCCESS returned.
  * @return LY_ERR return value
  */
-LIBYANG_API_DECL LY_ERR ly_ctx_new_ylpath(const char *search_dir, const char *path, LYD_FORMAT format, int options, struct ly_ctx **ctx);
+LIBYANG_API_DECL LY_ERR ly_ctx_new_ylpath(const char *search_dir, const char *path, LYD_FORMAT format, int options,
+        struct ly_ctx **ctx);
 
 /**
- * @brief Create libyang context according to the content of the given yang-library data.
+ * @brief Create libyang context according to the provided yang-library data in a string.
  *
- * This function loads the yang-library data from the given string. If you need to pass the data as
- * path to a file holding the data, use ::ly_ctx_new_ylpath(). Both functions extend functionality of
- * ::ly_ctx_new() by loading modules specified in the ietf-yang-library form into the context being created.
- * The preferred tree model revision is 2019-01-04. However, only the first module-set is processed and loaded
- * into the context. If there are no matching nodes from this tree, the legacy tree (originally from model revision 2016-04-09)
- * is processed. Note, that the modules are loaded the same way as in case of ::ly_ctx_load_module(), so the schema paths in the
- * yang-library data are ignored and the modules are loaded from the context's search locations. On the other hand, YANG features
- * of the modules are set as specified in the yang-library data.
- * To get yang library data from a libyang context, use ::ly_ctx_get_yanglib_data().
+ * Details in ::ly_ctx_new_ylpath().
  *
  * @param[in] search_dir Directory where libyang will search for the imported or included modules and submodules.
  * If no such directory is available, NULL is accepted.
@@ -267,7 +260,23 @@
  * @param[out] ctx Pointer to the created libyang context if LY_SUCCESS returned.
  * @return LY_ERR return value
  */
-LIBYANG_API_DECL LY_ERR ly_ctx_new_ylmem(const char *search_dir, const char *data, LYD_FORMAT format, int options, struct ly_ctx **ctx);
+LIBYANG_API_DECL LY_ERR ly_ctx_new_ylmem(const char *search_dir, const char *data, LYD_FORMAT format, int options,
+        struct ly_ctx **ctx);
+
+/**
+ * @brief Create libyang context according to the provided yang-library data in a data tree.
+ *
+ * Details in ::ly_ctx_new_ylpath().
+ *
+ * @param[in] search_dir Directory where libyang will search for the imported or included modules and submodules.
+ * If no such directory is available, NULL is accepted.
+ * @param[in] tree Data tree containing yang-library data.
+ * @param[in] options Context options, see @ref contextoptions.
+ * @param[out] ctx Pointer to the created libyang context if LY_SUCCESS returned.
+ * @return LY_ERR return value
+ */
+LIBYANG_API_DECL LY_ERR ly_ctx_new_yldata(const char *search_dir, const struct lyd_node *tree, int options,
+        struct ly_ctx **ctx);
 
 /**
  * @brief Compile (recompile) the context applying all the performed changes after the last context compilation.
@@ -410,6 +419,11 @@
  */
 LIBYANG_API_DECL void ly_ctx_set_module_imp_clb(struct ly_ctx *ctx, ly_module_imp_clb clb, void *user_data);
 
+typedef LY_ERR (*ly_ext_data_clb)(const struct lysc_ext_instance *ext, void *user_data, void **ext_data,
+        ly_bool *ext_data_free);
+
+LIBYANG_API_DECL ly_ext_data_clb ly_ctx_set_ext_data_clb(struct ly_ctx *ctx, ly_ext_data_clb clb, void *user_data);
+
 /**
  * @brief Get YANG module of the given name and revision.
  *