How to add custom attributes to a field?
The database table "content_node_field_instance" has a "widget_settings" column which can be used to store field attributes.  Use hook_widget_settings_alter() to associate attributes with a field.  Admin will then be able to set attribute values from the cck UI.  For example, to associate a binary attribute "my_attribute" with every filefield:

function mymodule_widget_settings_alter(&amp;$settings, $op, $widget) {

  // Apply to all FileFields 
  $widget_types = _content_widget_types();
  $widget_type = isset($widget['widget_type']) ? $widget['widget_type'] : $widget['type'];
  if (!in_array('filefield', $widget_types[$widget_type]['field types'])) {
    return;
  }

  switch ($op) {
      case 'form': 
        $settings['my_attribute'] = array(
          '#type' =&gt; 'checkbox',
          '#title' =&gt; t('my attribute'),
          '#options' =&gt; array(0 =&gt; t('Disabled'), 1 =&gt; t('Enabled')),
          '#default_value' =&gt; !empty($widget['my_attribute']),
        );

        break;
      case 'save':
        $settings[] = 'my_attribute';
        break;
  }
}


In this example, the filefield form will contain a checkbox labeled "my attribute".  Admin checks the box to set my_attribute to true, for the particular filefield.

To get the attribute value of a particular field:

$attribute_value = $field['widget']['my_attribute'];