分类: LINUX
2007-07-09 21:09:57
new_bh = alloc_buffer_head(GFP_BUFFER);
new_bh->b_page = alloc_page(GFP_BUFFER);
do data copy, data encryption and set various fields of new_bh
new_bh->b_private = old_bh;
new_bh->b_end_io = my_end_write_io;
void my_end_write_io(struct buffer_head *bh, int uptodate)
{
struct buffer_head *old = h->b_private;
__free_page(bh->b_page)
free_buffer_head(bh);
old->b_end_io(old, uptodate);
}
new_bh = alloc_buffer_head(GFP_BUFFER);
new_bh->b_page = alloc_page(GFP_BUFFER);
set various fields of new_bh
new_bh->b_private = old_bh;
new_bh->b_end_io = my_end_read_io;
void my_end_read_io(struct buffer_head *bh, int uptodate)
{
struct buffer_head *old = h->b_private;
do data decryption, copy
__free_page(bh->b_page)
free_buffer_head(bh);
old->b_end_io(old, uptodate);
}