diff options
author | Jonathan Blandford <jrb@redhat.com> | 2005-04-01 19:35:06 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@redhat.com> | 2005-04-01 19:35:06 +0000 |
commit | 0239582644c9edffa7edd4562ccb967d14d63e73 (patch) | |
tree | 5c6a736df34b7d979a2f3589e14ebb437b4df3f3 /shared-mime-info-spec.xml | |
parent | 13caacd00efe9d021d5216d3ba58b1bf263f4487 (diff) | |
download | shared-mime-info-0239582644c9edffa7edd4562ccb967d14d63e73.tar.gz |
Fri Apr 1 14:33:54 2005 Jonathan Blandford <jrb@redhat.com>
* shared-mime-info-spec.xml:
* update-mime-database.c: Patch from Matthias Clasen
<mclasen@redhat.com> to make the MIME Cache contain an mmappable
binary format.
Diffstat (limited to 'shared-mime-info-spec.xml')
-rw-r--r-- | shared-mime-info-spec.xml | 130 |
1 files changed, 127 insertions, 3 deletions
diff --git a/shared-mime-info-spec.xml b/shared-mime-info-spec.xml index 537417fa..274c3c64 100644 --- a/shared-mime-info-spec.xml +++ b/shared-mime-info-spec.xml @@ -1,8 +1,8 @@ <?xml version="1.0" standalone="no"?> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "/usr/share/sgml/docbook/dtd/xml/4.1.2/docbookx.dtd" [ - <!ENTITY updated "15 Oct 2003"> - <!ENTITY version "0.13"> + <!ENTITY updated "1 April 2005"> + <!ENTITY version "0.14"> ]> <article id="index"> @@ -174,10 +174,15 @@ The files created by <command>update-mime-database</command> are: <filename><MIME>/XMLnamespaces</filename> (contains a mapping from XML (namespaceURI, localName) pairs to MIME types) </para></listitem> - <listitem><para> + <listitem><para> <filename><MIME>/MEDIA/SUBTYPE.xml</filename> (one file for each MIME type, giving details about the type) </para></listitem> + <listitem><para> +<filename><MIME>/mime.cache</filename> (contains the same information as the <filename>globs</filename>, +<filename>magic</filename>, <filename>subclasses</filename>, <filename>aliases</filename> and +<filename>XMLnamespaces</filename> files, in a binary, mmappable format) + </para></listitem> </itemizedlist> The format of these generated files and the source files in <filename>packages</filename> are explained in the following sections. This step serves several purposes. First, it allows @@ -490,6 +495,122 @@ the namespaceURI. </para> </sect2> <sect2> + <title>The mime.cache files</title> + <para> +The <filename>mime.cache</filename> files contain the same information as the +<filename>globs</filename>, <filename>magic</filename>, <filename>subclasses</filename>, +<filename>aliases</filename> and <filename>XMLnamespaces</filename> files, in a binary, +mmappable format: +</para> +<programlisting> +Header: +2 CARD16 MAJOR_VERSION 1 +2 CARD16 MINOR_VERSION 0 +4 CARD32 ALIAS_LIST_OFFSET +4 CARD32 PARENT_LIST_OFFSET +4 CARD32 LITERAL_LIST_OFFSET +4 CARD32 SUFFIX_LIST_OFFSET +4 CARD32 GLOB_LIST_OFFSET +4 CARD32 MAGIC_LIST_OFFSET +4 CARD32 NAMESPACE_LIST_OFFSET + +AliasList: +4 CARD32 N_ALIASES +8*N_ALIASES AliasListEntry + +AliasListEntry: +4 CARD32 ALIAS_OFFSET +4 CARD32 MIME_TYPE_OFFSET + +ParentList: +4 CARD32 N_ENTRIES +8*N_ENTRIES ParentListEntry + +ParentListEntry: +4 CARD32 MIME_TYPE_OFFSET +4 CARD32 PARENTS_OFFSET + +Parents: +4 CARD32 N_PARENTS +4*N_PARENTS CARD32 MIME_TYPE_OFFSET + +LiteralList: +4 CARD32 N_LITERALS +8*N_LITERALS LiteralEntry + +LiteralEntry: +4 CARD32 LITERAL_OFFSET +4 CARD32 MIME_TYPE_OFFSET + +GlobList: +4 CARD32 N_GLOBS +8*N_GLOBS GlobEntry + +GlobEntry: +4 CARD32 GLOB_OFFSET +4 CARD32 MIME_TYPE_OFFSET + +SuffixTree: +4 CARD32 N_ROOTS +4 CARD32 FIRST_ROOT_OFFSET + +SuffixTreeNode: +4 CARD32 CHARACTER +4 CARD32 MIME_TYPE_OFFSET +4 CARD32 N_CHILDREN +4 CARD32 FIRST_CHILD_OFFSET + +MagicList: +4 CARD32 N_MATCHES +4 CARD32 MAX_EXTENT +4 CARD32 FIRST_MATCH_OFFSET + +Match: +4 CARD32 PRIORITY +4 CARD32 MIME_TYPE_OFFSET +4 CARD32 N_MATCHLETS +4 CARD32 FIRST_MATCHLET_OFFSET + +Matchlet: +4 CARD32 RANGE_START +4 CARD32 RANGE_LENGTH +4 CARD32 WORD_SIZE +4 CARD32 VALUE_LENGTH +4 CARD32 VALUE +4 CARD32 MASK +4 CARD32 N_CHILDREN +4 CARD32 FIRST_CHILD_OFFSET + +NamespaceList: +4 CARD32 N_NAMESPACES +12*N_NAMESPACES NamespaceEntry + +NamespaceEntry: +4 CARD32 NAMESPACE_URI_OFFSET +4 CARD32 LOCAL_NAME_OFFSET +4 CARD32 MIME_TYPE_OFFSET +</programlisting> +<para> +Lists in the file are sorted, to enable binary searching. The list of aliases is sorted by alias, +the list of literal globs is sorted by the literal. The SuffixTreeNode siblings are sorted by character. +The list of namespaces is sorted by namespace uri. +</para> +<para> +All offsets are in bytes from the beginning of the file. +</para> +<para> +Strings are zero-terminated. +</para> +<para> +All numbers are in network (big-endian) order. This is necessary because the data will be stored in +arch-independent directories like <filename>/usr/share/mime</filename> or even in user's home directories. +</para> +<para> +Cache files have to be written atomically - write to a temporary name, then move over the old file - so +that clients that have the old cache file open and mmap'ed won't get corrupt data. +</para> + </sect2> + <sect2> <title>Storing the MIME type using Extended Attributes</title> <para> An implementation MAY also get a file's MIME type from the @@ -658,6 +779,9 @@ Override.xml mentioned in <xref linkend="s2_layout"/>. Information such as <member> Christos Zoulas <email>christos at zoulas.com</email> </member> + <member> + Matthias Clasen <email>mclasen at redhat.com</email> + </member> </simplelist> </sect1> |