summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan BrĂ¼ns <stefan.bruens@rwth-aachen.de>2021-12-13 19:59:06 +0100
committerStefanBruens <stefan.bruens@rwth-aachen.de>2022-04-19 15:19:22 +0000
commitd9d5fc1666f2de03ba44d9a5ea9d2a26e545db76 (patch)
tree4d511d7ea0a0a7d4fe275ddfd5b45478d0419af3
parent13695c7225c2f525a435e72739c33ac32bbfbbb9 (diff)
downloadshared-mime-info-d9d5fc1666f2de03ba44d9a5ea9d2a26e545db76.tar.gz
Add mimetype for Devicetree source code
Make sure at least the first two characters are ASCII, to guard against any binary files. The maximum offset is fairly large, as many files start with a large license stanza.
-rw-r--r--data/freedesktop.org.xml.in22
-rw-r--r--tests/mime-detection/devicetree.dtsi3
-rw-r--r--tests/mime-detection/devicetree1.dts4
-rw-r--r--tests/mime-detection/devicetree2.dts1
-rw-r--r--tests/mime-detection/list5
5 files changed, 35 insertions, 0 deletions
diff --git a/data/freedesktop.org.xml.in b/data/freedesktop.org.xml.in
index 2c09cdb0..68476bb3 100644
--- a/data/freedesktop.org.xml.in
+++ b/data/freedesktop.org.xml.in
@@ -7898,6 +7898,28 @@ command to generate the output files.
<glob pattern="*.kt"/>
</mime-type>
+ <mime-type type="text/x-devicetree-source">
+ <comment>Devicetree source code</comment>
+ <acronym>DTS</acronym>
+ <expanded-acronym>Device Tree Source</expanded-acronym>
+ <sub-class-of type="text/plain"/>
+ <glob pattern="*.dts"/>
+ <glob pattern="*.dtsi"/>
+ <magic>
+ <match type="string" mask="0x8080" value="\000\000" offset="0">
+ <match type="string" value="/dts-v1/" offset="0:4080"/>
+ </match>
+ </magic>
+ <magic priority="40">
+ <match type="string" mask="0x8080" value="\000\000" offset="0">
+ <match type="string" value="/ {" offset="0:4090"/>
+ <match type="string" value="include " offset="0:4080">
+ <match type="string" value=".dts" offset="10:4090"/>
+ </match>
+ </match>
+ </magic>
+ </mime-type>
+
<mime-type type="image/avif">
<comment>AVIF image</comment>
<acronym>AVIF</acronym>
diff --git a/tests/mime-detection/devicetree.dtsi b/tests/mime-detection/devicetree.dtsi
new file mode 100644
index 00000000..68d518c6
--- /dev/null
+++ b/tests/mime-detection/devicetree.dtsi
@@ -0,0 +1,3 @@
+/ {
+ node { };
+};
diff --git a/tests/mime-detection/devicetree1.dts b/tests/mime-detection/devicetree1.dts
new file mode 100644
index 00000000..48772d1f
--- /dev/null
+++ b/tests/mime-detection/devicetree1.dts
@@ -0,0 +1,4 @@
+/* @ 2021 */
+/dts-v1/;
+/ {
+};
diff --git a/tests/mime-detection/devicetree2.dts b/tests/mime-detection/devicetree2.dts
new file mode 100644
index 00000000..805e6674
--- /dev/null
+++ b/tests/mime-detection/devicetree2.dts
@@ -0,0 +1 @@
+#include <foo/bar.dtsi>
diff --git a/tests/mime-detection/list b/tests/mime-detection/list
index ac907977..cb20f435 100644
--- a/tests/mime-detection/list
+++ b/tests/mime-detection/list
@@ -899,6 +899,11 @@ test.gd application/x-gdscript ox
# Kotlin source code
test.kt text/x-kotlin ox
+# Device Tree Source
+devicetree1.dts text/x-devicetree-source xoo
+devicetree2.dts text/x-devicetree-source xoo
+devicetree.dtsi text/x-devicetree-source
+
# AV1 Image File Format (AVIF)
# https://aomediacodec.github.io/av1-avif/
test.avif image/avif