public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* cramfs and mtd
@ 2001-04-19  9:21 Bjorn Wesen
  2001-04-19 11:33 ` David Woodhouse
  0 siblings, 1 reply; 20+ messages in thread
From: Bjorn Wesen @ 2001-04-19  9:21 UTC (permalink / raw)
  To: mtd

When using cramfs directly on a ROM chip like below.. can we make
cramfs/inode.c talk to mtd to find a chip maybe instead of using direct
pointers like I do in my small patch below ? That is, would it mess up
inode.c to the degree that it would not be accepted in the mainline kernel
? :) Or is there a better way to do this ?

(Yes of course - JFFS2 - but except that, then :)

/BW

--- inode.c     2001/04/02 12:48:08     1.1.1.3
+++ inode.c     2001/04/04 14:57:00     1.9
@@ -22,6 +22,8 @@

 #include "cramfs.h"

+#define CRAMFS_AS_IMAGE 
+ 
 static struct super_operations cramfs_ops;
 static struct inode_operations cramfs_dir_inode_operations;
 static struct file_operations cramfs_directory_operations;
@@ -97,6 +99,29 @@
  * Returns a pointer to a buffer containing at least LEN bytes of
  * filesystem starting at byte offset OFFSET into the filesystem.
  */
+ 
+#ifdef CRAMFS_AS_IMAGE
+
+/* Normally, cramfs_read reads from offset and len bytes on a block
device.
+ * But if we have an attached image piggybacked on the end of the kernel
+ * (a la krom/romfs) we can use this trivial routine.
+ */
+
+extern unsigned char *romfs_start;  /* set in head.S during boot */
+extern unsigned int romfs_length;   /* dito */
+  
+/*
+ * Returns a pointer to a buffer containing at least LEN bytes of
+ * filesystem starting at byte offset OFFSET into the filesystem.
+ */
+static inline void *cramfs_read(struct super_block *sb, unsigned int
offset, unsigned int len)
+{
+       return romfs_start + offset;
+}
+
+#else /* CRAMFS_AS_IMAGE */
+
 static void *cramfs_read(struct super_block *sb, unsigned int offset,
unsigned int len)
 {
        struct buffer_head * bh_array[BLKS_PER_BUF];
@@ -146,6 +171,7 @@
        return read_buffers[buffer] + offset;
 }

+#endif

 static struct super_block * cramfs_read_super(struct super_block *sb,
void *data, int silent)
 {





To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2001-04-24  1:56 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-19  9:21 cramfs and mtd Bjorn Wesen
2001-04-19 11:33 ` David Woodhouse
2001-04-19 13:44   ` mkfs.jffs2 again Joakim Tjernlund
2001-04-19 13:52     ` David Woodhouse
2001-04-19 13:56       ` Joakim Tjernlund
2001-04-19 20:06       ` JFFS2 as root FS Joakim Tjernlund
2001-04-20 16:26         ` David Woodhouse
2001-04-21  8:07           ` Joakim Tjernlund
2001-04-21 11:22             ` David Woodhouse
2001-04-21 20:22               ` Joakim Tjernlund
2001-04-23  1:52                 ` David Schleef
2001-04-23  6:15                   ` Joakim Tjernlund
2001-04-23  9:28                   ` Joakim Tjernlund
2001-04-23  9:31                     ` David Woodhouse
2001-04-23 11:00                       ` David Schleef
2001-04-23 11:04                         ` David Woodhouse
2001-04-24  1:56                           ` David Schleef
2001-04-21 12:08             ` David Woodhouse
2001-04-21 20:14               ` Joakim Tjernlund
2001-04-21 22:18                 ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox