Re: [PATCH] diskquota: 32bit quota tools on 64bit architectures

From: Randy Dunlap
Date: Thu Oct 19 2006 - 11:21:08 EST


On Thu, 19 Oct 2006 16:32:07 +0400 Vasily Tarasov wrote:

> --- linux-2.6.18/arch/ia64/ia32/sys_ia32.c.quot32 2006-09-20 07:42:06.000000000 +0400
> +++ linux-2.6.18/arch/ia64/ia32/sys_ia32.c 2006-10-19 11:17:50.000000000 +0400
> @@ -2545,6 +2545,54 @@ long sys32_fadvise64_64(int fd, __u32 of
> advice);
> }
>
> +asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
> + qid_t id, void __user *addr)
> +{
> +
> + switch (cmds) {
> + case Q_GETQUOTA:
> + old_fs = get_fs();
> + set_fs(KERNEL_DS);
> + ret = sys_quotactl(cmd, special, id, &dqblk);
> + set_fs(old_fs);
> + memcpy(&dqblk32, &dqblk, sizeof(dqblk32));
> + dqblk32.dqb_valid = dqblk.dqb_valid;
> + if (copy_to_user(addr, &dqblk32, sizeof(dqblk32)))
> + return -EFAULT;
> + break;
> + case Q_SETQUOTA:
> + if (copy_from_user(&dqblk32, addr, sizeof(dqblk32)))
> + return -EFAULT;
> + memcpy(&dqblk, &dqblk32, sizeof(dqblk32));
> + dqblk.dqb_valid = dqblk32.dqb_valid;
> + old_fs = get_fs();
> + set_fs(KERNEL_DS);
> + ret = sys_quotactl(cmd, special, id, &dqblk);
> + set_fs(old_fs);
> + break;
> + default:
> + return sys_quotactl(cmd, special, id, addr);
> + }
> + return ret;
> +}

Please align the switch and case/default source lines.
We prefer not to "double-indent" each case block inside a switch.

I suppose I should try to add this to CodingStyle since it's
not there.

> --- linux-2.6.18/arch/x86_64/ia32/sys_ia32.c.quot32 2006-09-20 07:42:06.000000000 +0400
> +++ linux-2.6.18/arch/x86_64/ia32/sys_ia32.c 2006-10-19 11:00:18.000000000 +0400
> @@ -915,3 +915,50 @@ long sys32_lookup_dcookie(u32 addr_low,
> return sys_lookup_dcookie(((u64)addr_high << 32) | addr_low, buf, len);
> }
>
> +asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
> + qid_t id, void __user *addr)
> +{
> +
> + switch (cmds) {
> + case Q_GETQUOTA:
> + old_fs = get_fs();
> + set_fs(KERNEL_DS);
> + ret = sys_quotactl(cmd, special, id, &dqblk);
> + set_fs(old_fs);
> + memcpy(&dqblk32, &dqblk, sizeof(dqblk32));
> + dqblk32.dqb_valid = dqblk.dqb_valid;
> + if (copy_to_user(addr, &dqblk32, sizeof(dqblk32)))
> + return -EFAULT;
> + break;
> + case Q_SETQUOTA:
> + if (copy_from_user(&dqblk32, addr, sizeof(dqblk32)))
> + return -EFAULT;
> + memcpy(&dqblk, &dqblk32, sizeof(dqblk32));
> + dqblk.dqb_valid = dqblk32.dqb_valid;
> + old_fs = get_fs();
> + set_fs(KERNEL_DS);
> + ret = sys_quotactl(cmd, special, id, &dqblk);
> + set_fs(old_fs);
> + break;
> + default:
> + return sys_quotactl(cmd, special, id, addr);
> + }


---
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/