当前位置: 技术问答>linux和unix
linux0.12内核问题,关于SWAP_DEV
来源: 互联网 发布时间:2017-04-05
本文导语: void init_swapping(void) { extern int *blk_size[]; int swap_size,i,j; if (!SWAP_DEV) return; if (!blk_size[MAJOR(SWAP_DEV)]) { printk("Unable to get size of swap devicenr"); return; } swap_size = blk_size[MAJOR(SWAP_DEV)][MINOR(SWAP_DEV)]; if (!swap_size) return; i...
void init_swapping(void)
{
extern int *blk_size[];
int swap_size,i,j;
if (!SWAP_DEV)
return;
if (!blk_size[MAJOR(SWAP_DEV)]) {
printk("Unable to get size of swap devicenr");
return;
}
swap_size = blk_size[MAJOR(SWAP_DEV)][MINOR(SWAP_DEV)];
if (!swap_size)
return;
if (swap_size >= 2;
if (swap_size > SWAP_BITS)
swap_size = SWAP_BITS;
swap_bitmap = (char *) get_free_page();
if (!swap_bitmap) {
printk("Unable to start swapping: out of memory :-)nr");
return;
}
read_swap_page(0,swap_bitmap);
if (strncmp("SWAP-SPACE",swap_bitmap+4086,10)) {
printk("Unable to find swap-space signaturenr");
free_page((long) swap_bitmap);
swap_bitmap = NULL;
return;
}
memset(swap_bitmap+4086,0,10);
for (i = 0 ; i