[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: nfblock vs udev



On Sat, 30 Aug 2008, Roman Zippel wrote:
> On Sat, 30 Aug 2008, Petr Stehl�wrote:
> > In other words: your kernel works OK with udev. Sounds like Stephen
> > doesn't have the latest nfblock patch? Or maybe his gcc-4.2 compiled it
> > differently than compiler you've used?
> 
> I tried it now with the debian kernel .config and the difference is 
> CONFIG_LBD, which changes sector_t to a 64bit variable and thus a 64bit 
> value is pushed on the stack.
> It's easy to fix, but enabling LBD on m68k by default is a utter waste of 
> time...

Something like the patch below?

However, adding CONFIG_LBD=y to my Atari config doesn't cause the
problem, without the patch below.

I did manage to make `randconfig' give me a kernel that causes the
double bus fault (and has CONFIG_LBD=y) on ARAnyM, but the patch below
doesn't fix it...

Subject: [PATCH/RFC] m68k: Wrap nfblock natfeat calls

Add wrappers with proper prototypes for the natfeat calls in nfblock.
This fixes the problem where sector_t was pushed on the stack as a 64-bit value
if CONFIG_LBD=y, while all parameters of the nf_call() varargs function are
32-bit.
---
 arch/m68k/emu/nfblock.c |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

--- a/arch/m68k/emu/nfblock.c
+++ b/arch/m68k/emu/nfblock.c
@@ -30,6 +30,20 @@ enum {
 	NFHD_DEV_OFFSET = 8,
 };
 
+static inline s32 nfhd_read_write(u32 major, u32 minor, u32 rwflag, u32 recno,
+				  u32 count, u32 buf)
+{
+	return nf_call(nfhd_id + NFHD_READ_WRITE, major, minor, rwflag, recno,
+		       count, buf);
+}
+
+static inline s32 nfhd_get_capacity(u32 major, u32 minor, u32 *blocks,
+				    u32 *blocksize)
+{
+	return nf_call(nfhd_id + NFHD_GET_CAPACITY, major, minor, blocks,
+		       blocksize);
+}
+
 static LIST_HEAD(nfhd_list);
 
 static int major_num;
@@ -56,8 +70,8 @@ static int nfhd_make_request(struct requ
 	bio_for_each_segment(bvec, bio, i) {
 		len = bvec->bv_len;
 		len >>= 9;
-		nf_call(nfhd_id + NFHD_READ_WRITE, dev->id, 0, dir,
-			sec >> shift, len >> shift, bvec_to_phys(bvec));
+		nfhd_read_write(dev->id, 0, dir, sec >> shift, len >> shift,
+				bvec_to_phys(bvec));
 		sec += len;
 	}
 	bio_endio(bio, 0);
@@ -152,7 +166,7 @@ static int __init nfhd_init(void)
 	}
 
 	for (i = NFHD_DEV_OFFSET; i < 24; i++) {
-		if (nf_call(nfhd_id + NFHD_GET_CAPACITY, i, 0, &blocks, &bsize))
+		if (nfhd_get_capacity(i, 0, &blocks, &bsize))
 			continue;
 		nfhd_init_one(i, blocks, bsize);
 	}
Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

Reply to: