Index: wp-includes/taxonomy.php
===================================================================
--- wp-includes/taxonomy.php	(revision 15595)
+++ wp-includes/taxonomy.php	(working copy)
@@ -70,6 +70,19 @@
 		'show_ui' => false,
 		'_builtin' => true,
 	) ) ;
+
+	register_taxonomy( 'post_mode', array('post', 'page', 'attachment'), array(
+		'hierarchical' => false,
+		'labels' => array(
+			'name' => '',
+			'singular_name' => '',
+		),
+		'query_var' => false,
+		'rewrite' => false,
+		'show_ui' => false,
+		'_builtin' => true,
+		'show_in_nav_menus' => false,
+	) ) ;
 }
 add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
 
Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 15595)
+++ wp-includes/post.php	(working copy)
@@ -471,6 +471,52 @@
 }
 
 /**
+ * Register support for a post mode.
+ *
+ * @param string|array $mode A mode or array of modes to register.  Valid modes are 'aside', 'chat', 'gallery', 'image', 'link', 'quote', or 'video'.
+ * @param string|array 
+ * @return mixed WP_Error on error.
+ */
+function register_post_mode( $modes, $post_types = array('post', 'page', 'attachment') ) {
+	global $wp_post_modes;
+
+	if ( !isset($wp_post_modes) )
+		$wp_post_modes = array();
+
+	$the_modes = array('aside', 'chat', 'gallery', 'image', 'link', 'quote', 'video');
+	// Dummy gettext calls to get translations for modes into the default catalog.
+	// @todo gettext context.  Move to an admin function?
+	__('Aside'); __('Chat'); __('Gallery'); __('Image'); __('Link'); __('Quote'); __('Video');
+
+	foreach ( (array) $modes as $mode ) {
+		if ( !in_array($mode, $the_modes) )
+			return new WP_Error('invalid_mode', __('Invalid mode'));
+		$wp_post_modes[$mode] = (array) $post_types;
+	}
+}
+
+/**
+ * Assign a mode to a post
+ *
+ * @param int|object $post The post for which to assign a mode
+ * @param string $mode  A mode to assign.  The mode must have already been registered with register_post_mode().
+ * @return mixed WP_Error on error. Array of affected term IDs on success.
+ */
+function set_post_mode( $post, $mode ) {
+	global $wp_post_modes;
+
+	$post = get_post($post);
+
+	if ( empty($post) )
+		return new WP_Error('invalid_post', __('Invalid post'));
+
+	if ( !isset($wp_post_nodes) || ! in_array($mode, $wp_post_modes) )
+		return new WP_Error('invalid_mode', __('Invalid mode'));
+
+	return wp_set_post_terms($post_id, array('mode-' . $mode), 'post_mode');
+}
+
+/**
  * Retrieve the post status based on the Post ID.
  *
  * If the post ID is of an attachment, then the parent post status will be given
