《Operating systems design and oragnization》3rd, page 351. The keyboard interrupt service routine is kbd_interrupt (line 15335), called whenever a key is pressed or released. It calls scode to get the scan code from the keyboard controller chip. ... all raw scan codes are placed in the circular buffer and the tp->tty _events flag for the current console is raised (line 15350). ...and that kbd_interrupt returns immediately after this. ... A continue statement at line 13795 causes a new iteration of the main loop to begin immediately, at line 13764. When execution transfers to the top of the loop the tp->tty _events flag for the console device is now found to be set, and kb _read (line 15360), the device-specific routine, is called using the pointer in the tp->tty _devread field of the console's tty structure. Kb_read takes scan codes from the keyboard's circular buffer and places ASCII codes in its local buffer.
I think the ibuf cann't have more than one scan code. so I think a char variable is enough. Why does the circular ibuf exist?