LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Johannes Stezenbach <js@linuxtv.org>
To: Blaisorblade <blaisorblade@yahoo.it>
Cc: user-mode-linux-devel@lists.sourceforge.net,
Jeff Dike <jdike@karaya.com>, Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: [uml-devel] [PATCH] [UML] fix mknod
Date: Tue, 23 Jan 2007 14:17:30 +0100 [thread overview]
Message-ID: <20070123131730.GA9286@linuxtv.org> (raw)
In-Reply-To: <200701230902.30715.blaisorblade@yahoo.it>
On Tue, Jan 23, 2007 at 09:02:30AM +0100, Blaisorblade wrote:
> On Monday 22 January 2007 21:13, Johannes Stezenbach wrote:
> >
> > I was playing with user-mode Linux and found that mknod creates
> > devices node in hostfs with wrong major/minor numbers.
> > The patch below fixes it for me.
>
> Hmpf. Still having this bug on hostfs is quite bad. Thanks for reporting.
>
> It should be hostfs_user.c to take major and minor and to combine them
> correctly - it can use libc's macros.
Right, below is a better patch.
Thanks,
Johannes
---
Fix UML hostfs mknod(): userspace has differernt
dev_t size and encoding than kernel, so extract major/minor
and reencode using glibc makedev() macro.
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
diff -rup linux-2.6.19.orig/fs/hostfs/hostfs.h linux-2.6.19/fs/hostfs/hostfs.h
--- linux-2.6.19.orig/fs/hostfs/hostfs.h 2006-11-29 22:57:37.000000000 +0100
+++ linux-2.6.19/fs/hostfs/hostfs.h 2007-01-23 14:11:03.000000000 +0100
@@ -76,7 +76,7 @@ extern int make_symlink(const char *from
extern int unlink_file(const char *file);
extern int do_mkdir(const char *file, int mode);
extern int do_rmdir(const char *file);
-extern int do_mknod(const char *file, int mode, int dev);
+extern int do_mknod(const char *file, int mode, unsigned int major, unsigned int minor);
extern int link_file(const char *from, const char *to);
extern int do_readlink(char *file, char *buf, int size);
extern int rename_file(char *from, char *to);
diff -rup linux-2.6.19.orig/fs/hostfs/hostfs_kern.c linux-2.6.19/fs/hostfs/hostfs_kern.c
--- linux-2.6.19.orig/fs/hostfs/hostfs_kern.c 2006-11-29 22:57:37.000000000 +0100
+++ linux-2.6.19/fs/hostfs/hostfs_kern.c 2007-01-23 14:11:20.000000000 +0100
@@ -755,7 +755,7 @@ int hostfs_mknod(struct inode *dir, stru
goto out_put;
init_special_inode(inode, mode, dev);
- err = do_mknod(name, mode, dev);
+ err = do_mknod(name, mode, MAJOR(dev), MINOR(dev));
if(err)
goto out_free;
diff -rup linux-2.6.19.orig/fs/hostfs/hostfs_user.c linux-2.6.19/fs/hostfs/hostfs_user.c
--- linux-2.6.19.orig/fs/hostfs/hostfs_user.c 2006-11-29 22:57:37.000000000 +0100
+++ linux-2.6.19/fs/hostfs/hostfs_user.c 2007-01-23 14:11:39.000000000 +0100
@@ -295,11 +295,11 @@ int do_rmdir(const char *file)
return(0);
}
-int do_mknod(const char *file, int mode, int dev)
+int do_mknod(const char *file, int mode, unsigned int major, unsigned int minor)
{
int err;
- err = mknod(file, mode, dev);
+ err = mknod(file, mode, makedev(major, minor));
if(err) return(-errno);
return(0);
}
next prev parent reply other threads:[~2007-01-23 13:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-22 20:13 Johannes Stezenbach
2007-01-23 8:02 ` [uml-devel] " Blaisorblade
2007-01-23 13:17 ` Johannes Stezenbach [this message]
2007-01-23 22:33 ` Blaisorblade
2007-01-25 4:31 ` Andrew Morton
2007-01-26 18:49 ` Blaisorblade
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=20070123131730.GA9286@linuxtv.org \
--to=js@linuxtv.org \
--cc=akpm@osdl.org \
--cc=blaisorblade@yahoo.it \
--cc=jdike@karaya.com \
--cc=linux-kernel@vger.kernel.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
--subject='Re: [uml-devel] [PATCH] [UML] fix mknod' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).