Record format
The format of the records in each file list file can be expressed as shown in the following example.
iAggregate:WEIGHT:INODE:GENERATION:SIZE:iRule:resourceID:attr_flags:
path-length!PATH_NAME:pool-length!POOL_NAME
[;show-length>!SHOW]end-of-record-character
where:- iAggregate is a grouping index that is assigned by mmapplypolicy.
- WEIGHT represents the WEIGHT policy language file attribute.
- INODE represents the INODE policy language file attribute.
- GENERATION represents the GENERATION policy language file attribute.
- SIZE represents the SIZE policy language file attribute.
- iRule is a rule index number assigned by mmapplypolicy, which relates to the policy rules file that is supplied with the -P argument.
- resourceID represents a pool index, USER_ID, GROUP_ID, or fileset identifier, depending on whether thresholding is done with respect to pool usage or to user, group, or fileset quotas.
- attr_flags represents a hexadecimal encoding of some of the attributes that are also encoded by the policy language variable MISC_ATTRIBUTES. The low-order 20 bits of attr_flags are taken from the ia_flags word that is defined in the gpfs.h API definition.
- path-length represents the length of the character string PATH_NAME.
- pool-length represents the length of the character string POOL_NAME.
- show-length represents the length of the character string SHOW.
- end-of-record-character is \n or \0.
All of the numeric fields are represented as hexadecimal strings, except the path-length, pool-length, and show-length fields, which are decimal encoded. These fields can be preceded by a minus sign ( - ), which indicates that the string that follows it contains escape sequences. In this case, the string might contain occurrences of the character pair \n, which represents a single newline character with a hexadecimal value of 0xA in the filename. Also, the string might contain occurrences of the character pair \\, which represents a single \ character in the filename. A \ will only be represented by \\ if there are also newline characters in the filename. The value of the length field within the record counts any escape characters.
The encoding of WEIGHT is based on the 64-bit IEEE floating format, but its bits are flipped so that when a file list is sorted using a conventional collating sequence, the files appear in decreasing order, according to their WEIGHT.
double w = - WEIGHT;
/* This code works correctly on big-endian and little-endian systems */
uint64 u = *(uint64*)&w; /* u is a 64 bit long unsigned integer
containing the IEEE 64 bit encoding of the double floating point
value of variable w */
uint64 hibit64 = ((uint64)1<<63);
if (w < 0.0) u = ~u; /* flip all bits */
else u = u | hibit64; /* force the high bit from 0 to 1,
also handles both “negatively” and “positively” signed 0.0 */
printf(“%016llx”,u);
printf("%03x:%016llx:%016llx:%llx:%llx:%x:%x:%llx:%d!%s:%d!%s",
iAggregate, u /*encoding of –1*WEIGHT from above*/, INODE, … );
Notice that the first three fields are fixed in length to facilitate the sorting of the records by the field values iAggregate, WEIGHT, and INODE.
if(SHOW && SHOW[0]) printf(“;%d!%s",strlen(SHOW),SHOW);
For more information, see the topic mmapplypolicy command in the IBM Spectrum Scale: Administration and Programming Reference.