阅读:1977回复:2
文件系统的加密问题。
generic_file_write()
{ struct inode *inode = file->f_dentry->d_inode->i_mapping->host; ssize_t err; int i = 0; //printk(KERN_INFO,\"generic_file_write\\r\\n\"); if ((ssize_t) count < 0) return -EINVAL; while( i < count) { buf = buf + 0x10; i ++; } //*/ if (!access_ok(VERIFY_READ, buf, count)) return -EFAULT; if (file->f_flags & O_DIRECT) { /* do_generic_direct_write may drop i_sem during the actual IO */ down_read(&inode->i_alloc_sem); down(&inode->i_sem); err = do_generic_direct_write(file, buf, count, ppos); up(&inode->i_sem); up_read(&inode->i_alloc_sem); if (unlikely(err == -ENOTBLK)) err = do_odirect_fallback(file, inode, buf, count, ppos); } else { down(&inode->i_sem); err = do_generic_file_write(file, buf, count, ppos); up(&inode->i_sem); } return err; } while( i < count) { buf = buf + 0x10; i ++; } //* 是我增加的内容。 ssize_t generic_file_read(struct file * filp, char * buf, size_t count, loff_t *ppos) { ssize_t retval; int i = 0; if ((ssize_t) count < 0) return -EINVAL; if (filp->f_flags & O_DIRECT) goto o_direct; retval = -EFAULT; if (access_ok(VERIFY_WRITE, buf, count)) { retval = 0; if (count) { read_descriptor_t desc; desc.written = 0; desc.count = count; desc.buf = buf; desc.error = 0; do_generic_file_read(filp, ppos, &desc, file_read_actor); retval = desc.written; if (!retval) retval = desc.error; } } out: while(i < strlen(buf)) { buf = buf-0x10; i ++; } //*/ return retval; o_direct: { loff_t pos = *ppos, size; struct address_space *mapping = filp->f_dentry->d_inode->i_mapping; struct inode *inode = mapping->host; retval = 0; if (!count) goto out; /* skip atime */ down_read(&inode->i_alloc_sem); down(&inode->i_sem); size = inode->i_size; if (pos < size) { retval = generic_file_direct_IO(READ, filp, buf, count, pos); if (retval > 0) *ppos = pos + retval; } up(&inode->i_sem); up_read(&inode->i_alloc_sem); UPDATE_ATIME(filp->f_dentry->d_inode); goto out; } } while(i < strlen(buf)) { buf = buf-0x10; i ++; } //*/ return retval; 是我增加的代码。 可是启动后,系统提示Kernel panic:No init found.Try passing int= option to kernel. why? |
|
沙发#
发布于:2007-09-15 22:16
你好!
我也在做文件系统的加密! 可以留下你的联系方式吗? 我的QQ:458415986 |
|
板凳#
发布于:2007-09-19 17:46
有问题来一起讨论
|
|
|