Containers/Zap Patch

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
> +int cr_kwrite(struct cr_ctx *ctx, void *buf, int count)
> +{
> +     mm_segment_t oldfs;
> +     int ret;
> +
> +     oldfs = get_fs();
> +     set_fs(KERNEL_DS);
> +     ret = cr_uwrite(ctx, buf, count);
> +     set_fs(oldfs);
> +
> +     return ret;
> +}

get_fs()/set_fs() always feels a bit ouch, and this way you have to use __force to avoid the warnings about __user pointer casts in sparse. I wonder if you can use splice_read/splice_write to get around this problem.