EmbLogic's Blog

lseek doubt

in write and read functions we are provided with a pointer to the file structure namely filp and we know this can change the position of the current read/write position namely the f_pos field in the struct file….but when in my write function i want to update the current read/write position using the statement filp->f_pos=nobsw(number of bytes successfully written),then this change is not visible in the f_pos field of the struct file,but when i do the same change using the last argument of the write function which is a pointer to the current read /write position using this statement *offp=nobsw,then the change is visible in the f_pos fileld of the struct file and i am able to read/write from SEEK_CUR and SEEK_END…why this happens….though both *offp(i.e the last argument of the write function in driver and filp->f_pos point to the same f_pos in the struct file. do they really point to the same f_pos in the struct file,a point to ponder upon….pls post if anybody knows why this happens

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>