Increasing the size of seq_file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am trying to increase the size of the seqfile buffer from PAGE_SIZE to 2*PAGE_SIZE to read the file zoneinfo in /proc. I created the seq_file structure in zoneinfo_open (code snippet attached) and kmalloc'ked the buffer as

activePages->buf = kmalloc(activePages->size = 2*PAGE_SIZE, GFP_KERNEL);

Then file->private_data field points to the created seq_file. Finally seq_open is called with the file.

However, when I print out the size of the seq_file "zoneinfo" it always return 4096 Bytes which is the PAGE_SIZE in my system. It is not set to 2*PAGE_SIZE as desired.

What am I doing wrong?

Thanks
Bithika

******************************************************************

static int zoneinfo_open(struct inode *inode, struct file *file)
{
      
        struct seq_file *activePages = file->private_data;

        if (!activePages) {
                activePages = kmalloc(sizeof(*activePages), GFP_KERNEL);
                if (!activePages)
                        return -ENOMEM;

                activePages->buf = kmalloc(activePages->size = 2*PAGE_SIZE, GFP_KERNEL);

                if (!activePages->buf)
                         return -ENOMEM;
                      
                file->private_data = activePages;
        }

        return seq_open(file, &zoneinfo_op);
}

******************************************************************


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux