Re: [PATCH 26/35] Unionfs: Privileged operations workqueue

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

 



On Wed, Dec 06, 2006 at 07:46:50PM +0100, Jan Engelhardt wrote:
> I smell a big conspiracy! So yet again it's mixed mixed
> 
> fs$ grep __init */*.c | grep -v ' init_'
> sysfs/mount.c:int __init sysfs_init(void)
> sysv/inode.c:int __init sysv_init_icache(void)
> proc/vmcore.c:static int __init vmcore_init(void)
> proc/nommu.c:static int __init proc_nommu_init(void)
> proc/proc_misc.c:void __init proc_misc_init(void)
> proc/proc_tty.c:void __init proc_tty_init(void)
> proc/root.c:void __init proc_root_init(void)
 
Yep.
 
> >> > >+void __unionfs_mknod(void *data)
> >> > >+{
> >> > >+	struct sioq_args *args = data;
> >> > >+	struct mknod_args *m = &args->mknod;
> >> > 
> >> > Care to make that: const struct mknod_args *m = &args->mknod;?
> >> > (Same for other places)
> >>  
> >> Right.
> > 
> >If I make the *args = data line const, then gcc (4.1) yells about modifying
> >a const variable 3 lines down..
> >
> >args->err = vfs_mknod(m->parent, m->dentry, m->mode, m->dev);
> >
> >Sure, I could cast, but that seems like adding cruft for no good reason.
> 
> No I despise casts more than missing consts. Why would gcc throw a warning?
> Let's take this super simple program

No, this program doesn't tickle the problem.. Try to compile this one:

<<<
struct mknod_args {
	int mode;
	int dev;
};

void  __mknod(const void *data)
{
	const struct mknod_args *args = data;
	args->mode = 0;
}

int main(void) {
	const struct mknod_args *m;
	__mknod(m);
	return 0;
}
>>>

$ gcc -Wall -c test.c
test.c: In function âmknodâtest.c:10: error: assignment of read-only location


Josef "Jeff" Sipek.

-- 
Reality is merely an illusion, albeit a very persistent one.
		- Albert Einstein
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux