コンパイル(3)



しばらくして

CC block/elevator.o
CC block/ll_rw_blk.o
block/ll_rw_blk.c: In function '__end_that_request_first':
block/ll_rw_blk.c:3591: warning: unused variable 'bio'
block/ll_rw_blk.c:3590: warning: unused variable 'next_idx'
block/ll_rw_blk.c:3590: warning: unused variable 'bio_nbytes'
block/ll_rw_blk.c:3590: warning: unused variable 'total_bytes'
block/ll_rw_blk.c:3628: warning: no return statement in function returning non-void
block/ll_rw_blk.c: At top level:
block/ll_rw_blk.c:3630: error: expected identifier or '(' before 'if'
block/ll_rw_blk.c:3636: warning: data definition has no type or storage class
block/ll_rw_blk.c:3636: warning: type defaults to 'int' in declaration of 'total_bytes'
block/ll_rw_blk.c:3636: error: 'bio_nbytes' undeclared here (not in a function)
block/ll_rw_blk.c:3637: error: expected identifier or '(' before 'while'
block/ll_rw_blk.c:3692: error: expected identifier or '(' before 'if'
block/ll_rw_blk.c:3698: error: expected identifier or '(' before 'if'
block/ll_rw_blk.c:3706: error: expected ')' before '>>' token
block/ll_rw_blk.c:3707: warning: data definition has no type or storage class
block/ll_rw_blk.c:3707: warning: type defaults to 'int' in declaration of 'blk_recalc_rq_segments'
block/ll_rw_blk.c:3707: warning: parameter names (without types) in function declaration
block/ll_rw_blk.c:3707: error: conflicting types for 'blk_recalc_rq_segments'
block/ll_rw_blk.c:3517: error: previous definition of 'blk_recalc_rq_segments' was here
block/ll_rw_blk.c:3708: error: expected identifier or '(' before 'return'
block/ll_rw_blk.c:3709: error: expected identifier or '(' before '}' token
make[1]: *** [block/ll_rw_blk.o] Error 1
make: *** [block] Error 2

expected identifierということは単純なカッコセットのミス

if (!blk_pc_request(req))
req->errors = 0;

if (!uptodate) {
if (blk_fs_request(req) && !(req->cmd_flags & REQ_QUIET))
printk("end_request: I/O error, dev %s, sector %llu\n",
req->rq_disk ? req->rq_disk->disk_name : "?",
(unsigned long long)req->sector);
#ifdef CONFIG_BUFFALO_ERRCNT
if(req->rq_disk){
if(atomic_inc_return(&req->rq_disk->nr_errs) < 0)
atomic_set(&req->rq_disk->nr_errs, INT_MAX);
#endif /* CONFIG_BUFFALO_ERRCNT */
#ifdef CONFIG_BUFFALO_PLATFORM
// end_request: I/O error, dev sda, sector 16
{
//char str[32];
//sprintf(str,"%02x:%02x",req->rq_disk->major,req->rq_disk->minors);
kernevnt_IOErr(req->rq_disk->disk_name /*str*/, (rq_data_dir(req)==WRITE)? "WRITE":"READ", req->sector, ++req->rq_disk->io_errors);
}
}
#endif
}

明らかにifdefの場所がおかしい。ERRCNTがアンセットのときカッコの数がおかしくなる。
タブ付きでわかりやすく書き直すと(htmlでタブ表示がつぶれてます。あとで修正します)

if (!blk_pc_request(req)) {
req->errors = 0;
}

if (!uptodate) {
if (blk_fs_request(req) && !(req->cmd_flags & REQ_QUIET)) {
printk("end_request: I/O error, dev %s, sector %llu\n",
req->rq_disk ? req->rq_disk->disk_name : "?",
(unsigned long long)req->sector);
}
#ifdef CONFIG_BUFFALO_ERRCNT
if(req->rq_disk){
if(atomic_inc_return(&req->rq_disk->nr_errs) < 0) {
atomic_set(&req->rq_disk->nr_errs, INT_MAX);
#endif /* CONFIG_BUFFALO_ERRCNT */
#ifdef CONFIG_BUFFALO_PLATFORM
// end_request: I/O error, dev sda, sector 16
//char str[32];
//sprintf(str,"%02x:%02x",req->rq_disk->major,req->rq_disk->minors);
kernevnt_IOErr(req->rq_disk->disk_name /*str*/, (rq_data_dir(req)==WRITE)? "WRITE":"READ", req->sector, ++req->rq_disk->io_errors);
}
}
#endif
}

一見どうでもいいように見える整形も問題も、
タブとカッコを省略しているため書いてる本人がわからなくなったいい例。
こういう細かいところは結構大切とわかります。

では続きのコンパイル