cc [flags…] –I /usr/cluster/include file –L /usr/cluster/lib –l scha#include <scha.h>scha_err_t scha_resourcetype_open( const char *rtname, scha_resourcetype_t *handle);
scha_err_t scha_resourcetype_open_zone(const char *cluster, const char *rt_name, scha_resourcetype_t *handlep);
scha_err_t scha_resourcetype_close(scha_resourcetype_t handle);
scha_err_t scha_resourcetype_get(scha_resourcetype_t handle, const char *tag...);
scha_err_t scha_resourcetype_get_zone(const char *cluster, scha_resourcetype_t handlep,const char *rt_tag, ...);
使用 scha_resourcetype_open()、scha_resourcetype_get () 和 scha_resourcetype_close() 函数可以访问资源组管理器 (Resource Group Manager, RGM) 群集工具使用的资源类型的相关信息。
scha_resourcetype_open() 初始化资源类型访问,并返回一个将由 scha_resourcetype_get() 使用的句柄。
scha_resourcetype_open () 的 rtname 参数指定要访问的资源类型。
handle 参数是用于保存函数调用返回值的某个变量的地址。
scha_resourcetype_get() 根据 tag 参数的指示访问资源类型信息。tag 参数应该是 scha_tags.h 头文件中的某个宏定义的一个字符串值。标记后面的参数取决于 tag 的值。
可能需要在标记后面额外添加一个参数,用于指示要从中检索信息的群集节点或者指示特定于标记的其他信息。参数列表中最后一个参数的类型应该适合用于保存 tag 指定的信息。该参数是资源类型信息的“输出”参数。如果该函数失败,则不会返回该“输出”参数的值。对用于 scha_resourcetype_get() 的句柄调用 scha_resourcetype_close() 之前,所分配的用于保存 scha_resourcetype_get () 返回的信息的内存将保持不变。
scha_resourcetype_close() 接受上次调用 scha_resourcetype_open() 时返回的 handle 参数。该函数将使该句柄失效,并释放为了保存使用该句柄执行的 scha_resourcetype_get() 调用的返回值而分配的内存。请注意,如果需要返回值,则会为每个 get 调用分配内存。在一个调用中为返回值而分配的空间不会被后续调用覆盖和重新使用。
下文中列出了 scha_tags.h 中定义的可以用作 scha_resourcetype_get() 的 tag 参数的宏。指示输出参数和任何其他参数的类型。scha_calls(3HA) 中介绍了结构和 enum 类型。
scha_resourcetype_open_zone() 和 scha_resourcetype_get_zone() 函数的作用分别与 scha_resourcetype_open() 和 scha_resourcetype_get() 相同,且带有一个额外的 cluster 参数,用于指定资源组存在于其中且您要在其上执行操作的区域群集的名称。当代码在全局区域中执行,但需要在指定区域群集上操作时,这些函数十分有用。无法在某一区域群集中使用它们来访问其他区域群集。
如果 scha_resourcetype_open_zone() 或 scha_resourcetype_get_zone() 的 cluster 参数为 NULL,则会对从中执行调用的群集执行查询;换句话说,带有 NULL 参数的调用分别等效于 scha_resourcetype_open() 或 scha_resourcetype_get()。
要关闭由 scha_resourcetype_open_zone() 返回的句柄,请使用 scha_resourcetype_close()。不需要 cluster 参数。
下列宏用于指定资源类型属性名称。输出是资源类型的指定属性的值。
输出参数的类型为 int*。
输出参数的类型为 char **。
输出参数的类型为 boolean_t *。
输出参数的类型为 char **。
输出参数的类型为 boolean_t *。
输出参数的类型为 char **。
输出参数的类型为 scha_initnodes_flag_t *。
输出参数的类型为 scha_str_array_t **。
输出参数的类型为 boolean_t *。
输出参数的类型为 boolean_t *。
输出参数的类型为 char **。
输出参数的类型为 char **。
输出参数的类型为 char **。
输出参数的类型为 boolean_t *。
输出参数的类型为 scha_str_array_t **。
输出参数的类型为 char **。
输出参数的类型为 char **。
输出参数的类型为 boolean_t *。
输出参数的类型为 scha_str_array_t **。
输出参数的类型为 char **。
输出参数的类型为 char **。
输出参数的类型为 boolean_t *。
输出参数的类型为 char **。
输出参数的类型为 boolean_t *。
输出参数的类型为 char **。
输出参数的类型为 char **。
输出参数的类型为 char **。
输出参数的类型为 char **。
这些函数返回以下值:
该函数成功。
该函数失败。
该函数成功。
有关其他错误代码的描述,请参见 scha_calls(3HA) 手册页。
头文件
库
有关以下属性的描述,请参见 attributes(5):
|
scha_resource_get(1HA)、scha_calls(3HA)、scha_strerror(3HA)、scha_strerror_i18n(3HA)、attributes(5)、rt_properties(5)