resource_data_input 信息

用途

提供有关使用输入文件将资源类和资源属性名称和值传递到资源监视和控制 (RMC) 命令行界面 (CLI) 的信息。

描述

您可以使用 -f 命令行标志来指定资源数据输入文件的名称,以在直接使用命令行时将资源持久属性值传递到 RMC CLI 将过于繁琐或太容易发生排版错误。 此文件中的数据用于定义资源或者用于更改资源或资源类的持久性属性值。 此文件没有设置位置。 它可以是临时文件,也可以是永久文件,具体取决于需求。

当使用 -f 标志发出 mkrsrcchrsrc 命令时,它们将读取此文件。 当使用 -i 标志发出时, lsrsrcdeflsactdef 命令将生成具有此格式的文件。

PersistentResourceAttributes
特定资源类(用来定义新资源或更改现有资源的属性值)的一个或多个资源的持久性属性名称和值。 持久资源属性由命令 mkrsrcchrsrc读取。 如果输入文件由使用 -c 标志指定的 chrsrc 命令读取,那么将忽略这些属性。
PersistentResourceClassAttributes
资源类的持久性属性名称和值(用来更改现有资源类的属性值)。 仅当指定了 -c 标志时, chrsrc 命令才会读取持久资源类属性。
通常, resource_data_input 文件是具有以下格式的纯文本文件。 粗体单词是字面值。 位于单个冒号 (:) 之前的文本是任意标签,可以是任何字母数字文本。
PersistentResourceAttributes::
# This is a comment
    label:
      AttrName1  = value 
      AttrName2  = value 
      AttrName3  = value 
    another label:
        Name        = name
        NodeNumber  = 1
        ::
PersistentResourceClassAttributes::
    label:
      SomeSettableAttrName 		= value
      SomeOtherSettableAttrName 	= value
    ::
请参阅 Examples 部分以获取更多详细信息。
有关格式的一些注释如下所示:
  • 关键字 PersistentResourceAttributesPersistentResourceClassAttributes 后跟双冒号 (::)。
  • 关键字节的顺序在文件中并不重要。 例如, PersistentResourceClassAttributes 可以在 PersistentResourceClass之前。 它不会影响通过调用 CLI 来读入的数据部分。
  • 单个节标题 (在关键字下) 后跟单个冒号 (:) ,例如: c175n05 resource info:
  • 行首的空白字符不重要。 建议使用制表符或空格来增强可读性。
  • 任何以井号 (#) 作为第一个可打印字符的行都是注释。
  • 单独的行上每个条目均使用空白字符(空格或制表符)分隔。
  • 文件中的空白行不重要,但建议使用以增强可读性。
  • 对于特定 PersistentResourceAttributes 节中包含的资源属性节数没有限制。
  • 对于特定 PersistentResourceClassAttributes 节中包含的资源类属性节数没有限制。 通常,资源类只有一个实例。 在这种情况下,只需要一个节。
  • 如果在特定 PersistentResourceAttributes 部分中仅包含一个资源属性节,那么可以省略 label: 行。
  • 如果特定 PersistentResourceClassAttributes 节中仅包含一个资源类属性节,那么可以省略 label: 行。
  • 包含空格的值必须用引号引起。
  • 双冒号 (::) 指示节的结尾。 如果找不到终止的双冒号,那么下一个 Reserved Keywordend of file 将指示节结束。
  • 包含在双引号括起的字符串中的双引号必须进行转义。 (\")。
    注: 双引号可以嵌套在单引号内。
    以下是示例:
    • "Name == \"testing\""
    • 'Name == "testing"'

      如果您的字符串是选择字符串,并且您会将其剪切并粘贴至命令行,那么此语法是首选语法。

  • 必须对以单引号括起的字符串中包含的单引号进行转义。 (\')。
    注: 单引号可以嵌套在双引号内。
    以下是示例:
    • 'Isn\'t that true'
    • "Isn't that true"

      如果将字符串剪切并粘贴至命令行,那么此语法是首选语法。

  • 用于在 a resource_data_input 文件中输入数据的格式可能与命令行上使用的格式不同。 您选择在其中运行命令的 shell 在引号方面有自己的规则。 请参阅 shell 的文档以获取这些规则,以确定如何在命令行上输入数据。

示例

  1. 以下样本 mkrsrc 命令:
    mkrsrc -f /tmp/my_resource_data_input_file IBM.Example
    将样本输入文件 /tmp/my_resource_data_input_file 用于 IBM.Example 资源类。 输入文件的内容类似如下:
    PersistentResourceAttributes::
    # Resource 1 - only set required attributes
    resource 1:
        Name="c175n04"
        NodeList = {1}
    # Resource 2 - setting both required and optional attributes
    # mkrsrc -e2 IBM.Example displays required and optional
    # persistent attributes
    resource 2:
        Name="c175n05"
        NodeList = {1}
        Int32 = -99
        Uint32 = 99
        Int64 = -123456789123456789
        Uint64 = 123456789123456789
        Float32 = -9.89
        Float64 = 123456789.123456789
        String = "testing 123"
        Binary = 0xaabbccddeeff
        RH = "0x0000 0x0000 0x00000000 0x00000000 0x00000000 0x00000000"
        SD = [hello,1,{2,4,6,8}]
        Int32Array = {-4, -3, -2, -1, 0, 1, 2, 3, 4}
        Int64Array = {-4,-3,-2,-1,0,1,2,3,4}
        Uint32Array = {0,1,2,3,4,5,6}
        Uint64Array = {0,1,2,3,4,5,6}
        Float32Array = {-3.3, -2.2, -1.2, 0, 1, 2.2, 3.3}
        Float64Array = {-3.3, -2.2, -1.2, 0, 1, 2.2, 3.3}
        StringArray = {abc,"do re mi", 123}
        BinaryArray = {"0x01", "0x02", "0x0304"}
        RHArray     = {"0x0000 0x0000 0x00000000 0x00000000 0x00000000 0x00000000",
                       "0xaaaa 0xaaaa 0xbbbbbbbb 0xcccccccc 0xdddddddd 0xeeeeeeee"}
        SDArray     = {[hello,1,{0,1,2,3}],[hello2,2,{2,4,6,8}]}
        
    
  2. 以下样本 chrsrc 命令:
    chrsrc -f  /tmp/Example/ch_resources -s 'Name == "c175n05"' IBM.Example
    使用样本输入文件 /tmp/Example/ch_resources 来更改现有 IBM.Example 资源的属性值。 输入文件的内容类似如下:
    PersistentResourceAttributes::
    # Changing resources that match the selection string entered
    # when running chrsrc command.
    	resource 1:
            String            = "this is a string test" 
            Int32Array        = {10,-20,30,-40,50,-60}