Changeset View
Standalone View
sys/kern/vfs_vnops.c
Show First 20 Lines • Show All 1,154 Lines • ▼ Show 20 Lines | vn_io_fault(struct file *fp, struct uio *uio, struct ucred *active_cred, | ||||
fo_rdwr_t *doio; | fo_rdwr_t *doio; | ||||
struct vnode *vp; | struct vnode *vp; | ||||
void *rl_cookie; | void *rl_cookie; | ||||
struct vn_io_fault_args args; | struct vn_io_fault_args args; | ||||
int error; | int error; | ||||
doio = uio->uio_rw == UIO_READ ? vn_read : vn_write; | doio = uio->uio_rw == UIO_READ ? vn_read : vn_write; | ||||
vp = fp->f_vnode; | vp = fp->f_vnode; | ||||
if (vp->v_type == VDIR) | |||||
return (EISDIR); | |||||
foffset_lock_uio(fp, uio, flags); | foffset_lock_uio(fp, uio, flags); | ||||
if (do_vn_io_fault(vp, uio)) { | if (do_vn_io_fault(vp, uio)) { | ||||
args.kind = VN_IO_FAULT_FOP; | args.kind = VN_IO_FAULT_FOP; | ||||
args.args.fop_args.fp = fp; | args.args.fop_args.fp = fp; | ||||
args.args.fop_args.doio = doio; | args.args.fop_args.doio = doio; | ||||
args.cred = active_cred; | args.cred = active_cred; | ||||
args.flags = flags | FOF_OFFSET; | args.flags = flags | FOF_OFFSET; | ||||
kib: There should be a blank line after the last line of code that is described by multi-line… | |||||
Done Inline ActionsFixed in my local copy, will roll it into next update if others request changes. kevans: Fixed in my local copy, will roll it into next update if others request changes. | |||||
Not Done Inline ActionsWhere is this in style(9)? bdrewery: Where is this in style(9)? | |||||
Not Done Inline ActionsI cannot find it in style(9), but I also cannot find there a rule that multi-line comment should be preceded by a blank line. kib: I cannot find it in style(9), but I also cannot find there a rule that multi-line comment… | |||||
Not Done Inline ActionsSo are we saying the style should be this? code_thing_A; code_thing_B; /* * Comment describing code doing thing C */ code_thing_C; code_thing_D; code_thing_E; I can add an example of this to style(9) if that's what you're saying. The blank line rules always confused me. bdrewery: So are we saying the style should be this?
```
code_thing_A;
code_thing_B;
/*
* Comment… | |||||
Not Done Inline ActionsYes, I definitely was told to use this style very early. I do not remember, was it bde or alc. The corner cases are the following: statement; something (if/for...) { /* * Multi-line, no blank line before. */ statement; and statement; /* * Multi-line. */ } statement; so no blank line after '{ and multi-line, and no blank line after multi-line if next is '}'. kib: Yes, I definitely was told to use this style very early. I do not remember, was it bde or alc. | |||||
if (uio->uio_rw == UIO_READ) { | if (uio->uio_rw == UIO_READ) { | ||||
rl_cookie = vn_rangelock_rlock(vp, uio->uio_offset, | rl_cookie = vn_rangelock_rlock(vp, uio->uio_offset, | ||||
uio->uio_offset + uio->uio_resid); | uio->uio_offset + uio->uio_resid); | ||||
Not Done Inline ActionsThis is not described in the summary of what you are changing. I really fail why we need to panic the system if we reach this point, just return an error and prevent the write. rgrimes: This is not described in the summary of what you are changing. I really fail why we need to… | |||||
Done Inline ActionsAh, I'll mention it in the commit message... this isn't a situation that can reasonably happen, as it should be prevented higher up because you cannot open a directory writable. If we've reached this point with a directory/write, then something has gone horribly terribly wrong and it must be debugged. kevans: Ah, I'll mention it in the commit message... this isn't a situation that can reasonably happen… | |||||
Not Done Inline ActionsI agree with Kyle. Getting here with a write is a kernel logic error that should be debugged. mckusick: I agree with Kyle. Getting here with a write is a kernel logic error that should be debugged. | |||||
} else if ((fp->f_flag & O_APPEND) != 0 || | } else if ((fp->f_flag & O_APPEND) != 0 || | ||||
(flags & FOF_OFFSET) == 0) { | (flags & FOF_OFFSET) == 0) { | ||||
/* For appenders, punt and lock the whole range. */ | /* For appenders, punt and lock the whole range. */ | ||||
rl_cookie = vn_rangelock_wlock(vp, 0, OFF_MAX); | rl_cookie = vn_rangelock_wlock(vp, 0, OFF_MAX); | ||||
} else { | } else { | ||||
rl_cookie = vn_rangelock_wlock(vp, uio->uio_offset, | rl_cookie = vn_rangelock_wlock(vp, uio->uio_offset, | ||||
uio->uio_offset + uio->uio_resid); | uio->uio_offset + uio->uio_resid); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,005 Lines • Show Last 20 Lines |
There should be a blank line after the last line of code that is described by multi-line comment, style(9).