I was thinking in a similar manner, but you know :
static void drop_pagecache_sb(struct super_block *sb)
static void drop_pagecache(void)
I mean these are static function, how to export them ? Just asking, shall I take help of pointer or some wrapper to export these function or is it safe to export these as usual .
Thanks & Best Regards,
Krishna
On Sat, Jul 18, 2009 at 5:05 PM, Peter Teoh <htmldeveloper@xxxxxxxxx> wrote:
On Sat, Jul 18, 2009 at 4:24 PM, Peter Teoh<htmldeveloper@xxxxxxxxx> wrote:just ignore these parameters.
> sorry i have lots of questions for you too!!!!
>
> On Sat, Jul 18, 2009 at 2:16 PM, er krishna<erkrishna@xxxxxxxxx> wrote:
>> Peter,
>>
>> Thats' fine. I have already gone through those articles, and user space
>> techniques are fine with me. But here I have to do it
>> ( flush the cache ) from kernel module, so I have to do all the things that
>> kernel does when it get argument 3 into /proc/sys/vm/dropcaches.
>>
>> Now again drop_caches_sysctl_handler function accepts lots of argument and
>> its not defined in .h file, so what I have to do is, I have to pass those
>> arguments to this function and include it in my module by exporting this
>> function. This is a bit of cumbersome and I really don't know weather it
>> will work or not !!!!!
>
> 64After some thought, I think u can SAFELY just use drop_pagecache() and
> 65 int drop_caches_sysctl_handler(ctl_table *table, int write,
> 66 struct file *file, void __user *buffer, size_t *length,
> loff_t *ppos )
> 67 {
> 68 proc_dointvec_minmax(table, write, file, buffer, length, ppos);
> 69 if (write) {
> 70 if (sysctl_drop_caches & 1)
> 71 drop_pagecache();
> 72 if (sysctl_drop_caches & 2)
> 73 drop_slab();
> 74 }
drop_slab() (since u are echoing "3" into the syctl). So yes, just
export it, recompile the kernel, and use the API in your module.
as for all the input parameters, just ignore it.
--
Regards,
Peter Teoh