*参照元 [#c270f447] #backlinks *説明 [#ofeb965b] -パス: [[linux-2.6.33/mm/filemap.c]] -FIXME: これは何? --説明 **引数 [#g51d9c69] -const struct iovec *iov -- --[[linux-2.6.33/iovec]] -unsigned long *nr_segs -- -size_t *count -- -int access_flags -- **返り値 [#e27d5b13] - -- **参考 [#wb3f9297] *実装 [#u1347f59] /* * Performs necessary checks before doing a write * @iov: io vector request * @nr_segs: number of segments in the iovec * @count: number of bytes to write * @access_flags: type of access: %VERIFY_READ or %VERIFY_WRITE * * Adjust number of segments and amount of bytes to write (nr_segs should be * properly initialized first). Returns appropriate error code that caller * should return or zero in case that write should be allowed. */ int generic_segment_checks(const struct iovec *iov, unsigned long *nr_segs, size_t *count, int access_flags) { unsigned long seg; size_t cnt = 0; for (seg = 0; seg < *nr_segs; seg++) { const struct iovec *iv = &iov[seg]; /* * If any segment has a negative length, or the cumulative * length ever wraps negative then return -EINVAL. */ cnt += iv->iov_len; if (unlikely((ssize_t)(cnt|iv->iov_len) < 0)) return -EINVAL; - --[[linux-2.6.33/unlikely()]] if (access_ok(access_flags, iv->iov_base, iv->iov_len)) continue; - --[[linux-2.6.33/access_ok()]] if (seg == 0) return -EFAULT; *nr_segs = seg; cnt -= iv->iov_len; /* This segment is no good */ break; } *count = cnt; return 0; } EXPORT_SYMBOL(generic_segment_checks); -特にライセンスを区別せずシンボルを公開する。 --[[linux-2.6.33/EXPORT_SYMBOL()]] *コメント [#e619c6a6]