From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: Christoph Hellwig <hch@infradead.org>, linux-kernel@vger.kernel.org
Cc: Brian Jackson <brian@mdrx.com>, Mark Hahn <hahn@physics.mcmaster.ca>
Subject: Re: [PATCH] make cramfs look less hostile
Date: Sun, 15 Jun 2003 19:58:15 +0200 [thread overview]
Message-ID: <20030615175815.GI1063@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <20030615184417.A19712@infradead.org>
On Sun, 15 June 2003 18:44:17 +0100, Christoph Hellwig wrote:
> On Sun, Jun 15, 2003 at 07:39:26PM +0200, Jörn Engel wrote:
> > > Umm, cramfs_fill_super has a silent parameter that's true for
> > > probing the root filesystem. I'd suggest disabling the printk
> > > completly if it's set.
> >
> > Good idea, but only at first glance. cramfs_fill_super() always gets
> > called with silent=1. So if "(!silent) printk(...);" is functionally
> > equivalent to ";".
>
> It's not. The rootfs is mounted with the (grossly misnamed) MS_VERBOSE
> flag which translates to the last argument of the fill_super callback
> set to 1.
Ok, you win this one. Leaves this case:
$ mount /dev/somewhere /mnt
cramfs: wrong magic
$ echo $?
0
$
Here I consider the message evil as well. The patch below on the
other hand might go a little too far. All the other printk()s are
rare and might hold some useful information for normal users as well.
Any arguments for or against this patch?
Jörn
--
To recognize individual spam features you have to try to get into the
mind of the spammer, and frankly I want to spend as little time inside
the minds of spammers as possible.
-- Paul Graham
--- linux-2.5.71/fs/cramfs/inode.c~cramfs_message 2003-06-05 17:47:36.000000000 +0200
+++ linux-2.5.71/fs/cramfs/inode.c 2003-06-15 19:39:03.000000000 +0200
@@ -27,6 +27,14 @@
#include <asm/uaccess.h>
+#define DEBUG 0 /* set to 1 for verbose messages during system bringup */
+
+#if DEBUG
+# define dprintk(fmt,args...) printk(fmt , ##args)
+#else
+# define dprintk(fmt,args...)
+#endif
+
static struct super_operations cramfs_ops;
static struct inode_operations cramfs_dir_inode_operations;
static struct file_operations cramfs_directory_operations;
@@ -218,20 +226,20 @@
/* check at 512 byte offset */
memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super));
if (super.magic != CRAMFS_MAGIC) {
- printk(KERN_ERR "cramfs: wrong magic\n");
+ dprintk(KERN_INFO "cramfs: magic not found\n");
goto out;
}
}
/* get feature flags first */
if (super.flags & ~CRAMFS_SUPPORTED_FLAGS) {
- printk(KERN_ERR "cramfs: unsupported filesystem features\n");
+ dprintk(KERN_ERR "cramfs: unsupported filesystem features\n");
goto out;
}
/* Check that the root inode is in a sane state */
if (!S_ISDIR(super.root.mode)) {
- printk(KERN_ERR "cramfs: root is not a directory\n");
+ dprintk(KERN_ERR "cramfs: root is not a directory\n");
goto out;
}
root_offset = super.root.offset << 2;
@@ -247,12 +255,12 @@
sbi->magic=super.magic;
sbi->flags=super.flags;
if (root_offset == 0)
- printk(KERN_INFO "cramfs: empty filesystem");
+ dprintk(KERN_INFO "cramfs: empty filesystem");
else if (!(super.flags & CRAMFS_FLAG_SHIFTED_ROOT_OFFSET) &&
((root_offset != sizeof(struct cramfs_super)) &&
(root_offset != 512 + sizeof(struct cramfs_super))))
{
- printk(KERN_ERR "cramfs: bad root offset %lu\n", root_offset);
+ dprintk(KERN_ERR "cramfs: bad root offset %lu\n", root_offset);
goto out;
}
next prev parent reply other threads:[~2003-06-15 17:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-15 16:05 Jörn Engel
[not found] ` <Pine.LNX.4.44.0306151245070.29663-100000@coffee.psychology.mcmaster.ca>
2003-06-15 17:17 ` Jörn Engel
[not found] ` <200306151157.10493.brian@mdrx.com>
2003-06-15 17:19 ` Jörn Engel
2003-06-15 17:26 ` Christoph Hellwig
2003-06-15 17:39 ` Jörn Engel
2003-06-15 17:44 ` Christoph Hellwig
2003-06-15 17:58 ` Jörn Engel [this message]
2003-06-15 18:03 ` Christoph Hellwig
2003-06-15 18:14 ` Jörn Engel
2003-06-15 18:18 ` Christoph Hellwig
2003-06-15 21:49 ` Andries Brouwer
2003-06-16 9:12 ` Jörn Engel
2003-06-16 11:21 ` Andries Brouwer
2003-06-16 11:37 ` Jörn Engel
2003-06-18 0:24 ` Robert White
2003-06-15 17:27 ` Jörn Engel
2003-06-16 5:54 ` H. Peter Anvin
[not found] <20030615161009$6dde@gated-at.bofh.it>
[not found] ` <20030615174004$76d0@gated-at.bofh.it>
[not found] ` <20030615175007$7f59@gated-at.bofh.it>
[not found] ` <20030615175012$0573@gated-at.bofh.it>
[not found] ` <20030615181004$3663@gated-at.bofh.it>
[not found] ` <20030615181010$7f10@gated-at.bofh.it>
[not found] ` <20030615182013$7a4e@gated-at.bofh.it>
[not found] ` <20030615183011$3fc0@gated-at.bofh.it>
2003-06-15 21:20 ` Pascal Schmidt
2003-06-16 5:37 ` Christoph Hellwig
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=20030615175815.GI1063@wohnheim.fh-wedel.de \
--to=joern@wohnheim.fh-wedel.de \
--cc=brian@mdrx.com \
--cc=hahn@physics.mcmaster.ca \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®