Difference between revisions of "Containers/Zap Patch"
DaveHansen (talk | contribs) (New page: > +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_uwri...) |
m (formatting) |
||
| Line 1: | Line 1: | ||
| − | + | <pre> | |
> +int cr_kwrite(struct cr_ctx *ctx, void *buf, int count) | > +int cr_kwrite(struct cr_ctx *ctx, void *buf, int count) | ||
> +{ | > +{ | ||
| Line 12: | Line 12: | ||
> + return ret; | > + return ret; | ||
> +} | > +} | ||
| + | </pre> | ||
get_fs()/set_fs() always feels a bit ouch, and this way you have | get_fs()/set_fs() always feels a bit ouch, and this way you have | ||
Latest revision as of 04:16, 13 August 2008
> +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.