My confussion on how general kernel functions work

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

 




	I have asked this question before, but I didnt get a response from 
somebody who understood my question correctly. So.. I will try showing a 
couple more examples.

Basicly when your writing... how shall I say....?? *normal code*, you use 
your functions in such a manner as follows.

int foo;
char *bar = "5";

foo = atoi(bar);

now here we give our funtion an argument

while when you have kernel code, instead of writing the actual args, you 
basicly make up your own function like...

static ssize_t wdt_write(struct file *file, const char *buf, size_t count, 
loff_t *ppos)
{
        /*  Can't seek (pwrite) on this device  */
        if (ppos != &file->f_pos)
                return -ESPIPE;

        if(count)
        {
                foo();
                return 1;
        }
        return 0;
}


What has me confussed is.... what gives this function the arguments so it 
can function properly. Ie) as bar is the arg to atoi() earlier.

Thanks for your help

-Dan Erickson-
-ColdOneKnight@rogers.com-

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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