Programs written for releases of OS/2 and DOS that do not support extended attributes (EAs) will tend to lose EAs simply because they do not know that they exist. OS/2 provides some controls that prevent old programs from destroying critical data without unduly restricting their activities. This is done by classifying programs and marking the extended attributes that are associated with files.
Programs are classified as:
EAs associated with files are marked as critical or non-critical. Programs that do not recognize EAs are not permitted to manipulate files that have critical EAs associated with them. This protection does not apply to directories. EAs associated with directories cannot be marked as critical.
Critical Extended Attributes Extended attributes (EAs) are non-critical by default. A non-critical EA is one that is not necessary to the functionality of the application. That is, if a non-critical EA is lost, the system continues to operate correctly. For example, losing the icons associated with data files does not generally cause any ill effect other than the inability to show the icon.
A critical extended attribute is one which is necessary to the correct operation of OS/2 or of a particular application. EAs should be marked as critical if their loss would cause the system or program to perform incorrectly. For example, a mail program might store mail headers in EAs. The loss of the header from a message would normally render the mail program completely unable to further use that message. This would be unacceptable, so the mail program should mark this EA as critical.
A file has critical extended attributes (EAs) if at least one EA attached to the file is marked as critical.
Marking EAs as critical only prevents programs that do not recognize EAs from losing the EAs from the file. It does not prevent deletion of files by any application.
Applications must be careful how they mark their EAs. If they are too aggressive marking EAs as critical, users might be prevented from accessing files that their application uses. EAs are marked as critical by setting the critical bit. The critical bit is bit 7 of the flags byte of the FEA2 data structure. If this bit is 0, the EA is a non-critical EA. If it is 1, it is a critical EA. The symbolic constant FEA_NEEDEA can be used to indicate a critical EA.
The creator of the EA determines whether it is critical or not.
Programs that do not recognize extended attributes (EAs) are prevented from performing certain operations on files that have critical EAs associated with them. For example, a program that does not recognize EAs is not permitted to perform a non-truncating open on a file with critical EAs associated with it, because programs cannot be permitted to read the data and ignore the EAs.
Programs that do not recognize EAs are, however, permitted to perform those operations that they can do completely. For example, they can delete files with critical EAs associated with them. Programs that do not recognize EAs are not prevented from accessing files whose EAs are not critical.
Programs that recognize EAs have no restrictions placed on their actions with respect to critical EAs.
Programs that recognize extended attributes must identify themselves to OS/2. This is done by including the NEWFILES declaration in the program's module definition file. The NEWFILES declaration is also how programs indicate that they understand and use long file names.