Yes you are right, we always need to take care of "f_pos" element in the "file" structure of our own ...... whenever we read /write the device file, we also need to modify "f_pos" ourself. You are doing right by setting the "f_pos" to the size of the device (end of device), whenever you are opening it in append mode. Cheers !! Gaurav -----Original Message----- From: kernelnewbies-bounce@xxxxxxxxxxxx [mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of Dinesh Ahuja Sent: Sunday, October 10, 2004 6:47 PM To: kernelnewbies@xxxxxxxxxxxx Subject: Appending functionality in Character Device Driver I want to provide a appending functionality in a character device driver and I have done the following thing in a device_open function. if (pfile->f_flags & O_APPEND) { // Opening a device file in Append Mode. printk("<1> Append Flag has been Used\n"); pfile->f_pos = pdevice_data->size; } else if ((pfile->f_flags & O_ACCMODE) == O_WRONLY) { // Opening a device file in Write Mode if (pdevice_data->data) { kfree(pdevice_data->data); pdevice_data->data = NULL; pdevice_data->size = 0; } } In this , pdevice_data is a pointer to Device_Data structure which is defined as follows: typedef struct Device_Data { void * data; unsigned long size; unsigned long max_size; }Device_Data; Is my approach fine and is it fine If I modify on my own pfile->f_pos in the device_open ? Is there any way by which Kernel takes cares of this on its own and set the file position at the end of the file when I use the following commmand cat >> /dev/CharDev0 Regards Dinesh ________________________________________________________________________ Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/