<font size=2 face="sans-serif">If you're using policy rules and the xattr()
SQL function, then you should consider using the setXattr() SQL function,
to set or change the value of any particular extended attributes.</font><br><br><font size=2 face="sans-serif">Notice that the doc says: </font><font size=4 color=#212100 face="}"><b>gpfs_igetattrs()
subroutine: </b></font><font size=2 color=#212100 face="}">Retrieves extended
file attributes in opaque format.</font><br><font size=2 color=#212100 face="}">What it does is pickup all the
extended attributes of a given file and return them in a "blob".
 The structure of the blob is undocumented,</font><br><font size=2 color=#212100 face="}">so you should not use it to set
individual extended attributes.  The intended use is for backup and
restore of a file's extended attributes,</font><br><font size=2 color=#212100 face="}">and you get an ACL also as a bonus.
The doc says:</font><br><font size=2 color=#212100 face="}">"This subroutine is intended
for use by a backup program to save all extended file attributes (ACLs,
attributes, and so forth)."</font><br><br><font size=2 color=#212100 face="}">If you are determined to use a
C API to manipulate extended attributes,  I personally recommend that
you first see and try if</font><br><font size=2 color=#212100 face="}">the standard OS methods will work
for you.  That means your code will work for any file system that
can be mounted on you OS that supports extended attributes.  BUT,
unfortunately I have found that some extended attribute names with special
prefix values cannot be accessed with the standard Linux or AIX or Posix
commands or APIs.   In that case you need to use the gpfs API, GPFS_FCNTL_SET_XATTR
(see gpfs_fcntl.h) Which is indeed what setXattr() is using and what the
mmchattr command ultimately uses.</font><br><br><font size=2 color=#212100 face="}">Notice that setXattr() requires
you pass the new value as an SQL string.  So what if you need to store
a numeric value as a "binary" value?  </font><br><font size=2 color=#212100 face="}">Well first figure out how to represent
the value as a hexadecimal constant and then use this notation:</font><br><font size=2 color=#212100 face="}">  setXattr('user.whatever',
X'0123456789ABCDEF')</font><br><br><font size=2 color=#212100 face="}">In some common situations you can
use the m4 processor to build or tear down binary and/or hexadecimal values
and strings.</font><br><font size=2 color=#212100 face="}">For some examples of how to do
that add this to a test policy rules file:</font><br><br><font size=2 color=#212100 face="}">debugfile(/tmp/m4xdeb)</font><br><font size=2 color=#212100 face="}">dumpdef</font><br><br><font size=2 color=#212100 face="}">And peek into the resulting m4xdeb
file!</font><br><br><br><br><br><BR>