All of lore.kernel.org
 help / color / mirror / Atom feed
From: Enrico Jorns <ejo@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Enrico Jorns <ejo@pengutronix.de>
Subject: [PATCH 4/5] Add filetype and detection for squashfs images
Date: Tue,  4 Oct 2016 12:10:47 +0200	[thread overview]
Message-ID: <20161004101048.12970-5-ejo@pengutronix.de> (raw)
In-Reply-To: <20161004101048.12970-1-ejo@pengutronix.de>

This adds `filetype_squashfs` to the list of known filetypes and adds a
detection for squashfs files to file_detect_type(). This currently
matches on the `hsqs` start sequence of an image file.

Additionally, the newly introduced filetype is registered as the type of
the squashfs_driver which allows, for example, to mount squashfs without
the need to specify a type parameter.

This changes enable booting a squashfs with the simple `boot` command
pointing to the location (device) that holds the squashfs.

Note that booting with blspec is limited as the current squashfs driver
is not capable of handling symbolic links.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 common/filetype.c      | 4 ++++
 fs/squashfs/squashfs.c | 1 +
 include/filetype.h     | 1 +
 3 files changed, 6 insertions(+)

diff --git a/common/filetype.c b/common/filetype.c
index 4728f87..8d72933 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -40,6 +40,7 @@ static const struct filetype_str filetype_str[] = {
 	[filetype_uimage] = { "U-Boot uImage", "u-boot" },
 	[filetype_ubi] = { "UBI image", "ubi" },
 	[filetype_jffs2] = { "JFFS2 image", "jffs2" },
+	[filetype_squashfs] = { "Squashfs image", "squashfs" },
 	[filetype_gzip] = { "GZIP compressed", "gzip" },
 	[filetype_bzip2] = { "BZIP2 compressed", "bzip2" },
 	[filetype_oftree] = { "open firmware Device Tree flattened Binary", "dtb" },
@@ -278,6 +279,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
 	if (buf8[0] == 0xfd && buf8[1] == 0x37 && buf8[2] == 0x7a &&
 			buf8[3] == 0x58 && buf8[4] == 0x5a && buf8[5] == 0x00)
 		return filetype_xz_compressed;
+	if (buf8[0] == 'h' && buf8[1] == 's' && buf8[2] == 'q' &&
+			buf8[3] == 's')
+		return filetype_squashfs;
 	if (buf[0] == be32_to_cpu(0xd00dfeed))
 		return filetype_oftree;
 	if (strncmp(buf8, "ANDROID!", 8) == 0)
diff --git a/fs/squashfs/squashfs.c b/fs/squashfs/squashfs.c
index d00dee6..6d04681 100644
--- a/fs/squashfs/squashfs.c
+++ b/fs/squashfs/squashfs.c
@@ -353,6 +353,7 @@ static struct fs_driver_d squashfs_driver = {
 	.readdir	= squashfs_readdir,
 	.closedir	= squashfs_closedir,
 	.stat		= squashfs_stat,
+	.type		= filetype_squashfs,
 	.drv = {
 		.probe = squashfs_probe,
 		.remove = squashfs_remove,
diff --git a/include/filetype.h b/include/filetype.h
index cde73c1..65bd6ef 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -16,6 +16,7 @@ enum filetype {
 	filetype_uimage,
 	filetype_ubi,
 	filetype_jffs2,
+	filetype_squashfs,
 	filetype_gzip,
 	filetype_bzip2,
 	filetype_oftree,
-- 
2.9.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2016-10-04 10:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-04 10:10 [PATCH 0/5] Extend squashfs support Enrico Jorns
2016-10-04 10:10 ` [PATCH 1/5] fs: squashfs: port lzo compression support from kernel Enrico Jorns
2016-10-04 19:34   ` Sascha Hauer
2016-10-12  6:26     ` Yegor Yefremov
2016-10-04 10:10 ` [PATCH 2/5] fs: squashfs: port lz4 " Enrico Jorns
2016-10-04 10:10 ` [PATCH 3/5] fs: squashfs: port zlib " Enrico Jorns
2016-10-04 19:40   ` Sascha Hauer
2016-10-21  6:04     ` Yegor Yefremov
2016-10-21  6:53       ` Sascha Hauer
2016-10-04 10:10 ` Enrico Jorns [this message]
2016-10-06 13:55   ` [PATCH 4/5] Add filetype and detection for squashfs images Yegor Yefremov
2016-10-06 14:10     ` Enrico Joerns
2016-10-07 12:08       ` Yegor Yefremov
2016-10-04 10:10 ` [PATCH 5/5] fs: squashfs: append linux rootarg for ubi volume Enrico Jorns

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161004101048.12970-5-ejo@pengutronix.de \
    --to=ejo@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.