On Fri, 2006-05-19 at 07:01 -0700, UZAIR LAKHANI wrote: > Hello All, > > Suppose I want to implement read/write file operations > of a simple file system. Consider the read system > call. The file system's struct file_operations > function that will be called is this > > ssize_t (*read) (struct file *, char *, size_t, loff_t > *); > > The char * in the arguments of read is a user-space > buffer pointer. Suppose I don't want to send this > buffer that we have got to the generic_file_read > function or some other function and instead want to > create a new buffer and send it to the > generic_file_read (or other) function. Then copy this > buffer that we have sent to the generic_file_read to > the actual buffer that we had received so that the > call can be completed and the buffer received is > filled. If you want to pass a kernel address to a function that takes a user address, you need to call set_fs(KERNEL_DS) first. A few examples are in fs/nfsd/vfs.c, such as: oldfs = get_fs(); set_fs(KERNEL_DS); err = inode->i_op->readlink(dentry, buf, *lenp); set_fs(oldfs); -- David Kleikamp IBM Linux Technology Center - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html