Dear Nigel,
Thanks very much for your explanation. It's very excited that my guess
is similarly with your opinion.Besides,now I am sure about what the
binder driver acts.
Best regards!

On 9月29日, 上午11时22分, Nigel Sheridan-Smith <[email protected]> wrote:
> Hi,
>
> The 'binder' kernel driver registers itself with the kernel under a device
> name, e.g. /dev/binder. Using "binder_fops" is passes all of the module's
> functions to the kernel as callbacks for different events (open, mmap,
> flush, release, etc against that device name).
>
> So the Binder IPC client must open("/dev/binder", ...) as a file descriptor
> and then read and write to the descriptor to pass data to the binder kernel
> driver. An 'mmap' in this case, maps memory between processes, but it is
> associated with this file descriptor to tell the kernel that the binder
> module is responsible for managing the process of memory sharing between the
> kernel module and the client process.
>
> Cheers,
>
> Nigel
>
>
>
>
>
>
>
> On Wed, Sep 28, 2011 at 11:48 AM, AndroidHolder <[email protected]> wrote:
> > First,to be honest,my doubt comes from the binder driver part in /
> > kernel/drivers/android/binder.c
> > // 1. register binder as a misc device
> > static int __init binder_init(void){
> >    int ret;
> > ...
> >    ret = misc_register(&binder_miscdev);
> > ...
> > }
> > // 2.declare fops as &binder_fops
> > static struct miscdevice binder_miscdev = {
> >    .minor = MISC_DYNAMIC_MINOR,
> >    .name = "binder",
> >    .fops = &binder_fops
> > };
> > // 3.binder_fops is defined as follows
> > static struct file_operations binder_fops = {
> >    .owner = THIS_MODULE,
> >    .poll = binder_poll,
> >    .unlocked_ioctl = binder_ioctl,
> >    .mmap = binder_mmap,
> >    .open = binder_open,
> >    .flush = binder_flush,
> >    .release = binder_release,
> > };
> > Then take a look at /framework/base/cmds/servicemanager/binder.c,there
> > are one place where runs ioctl and another place where runs mmap.
> > int binder_become_context_manager(struct binder_state *bs)
> > {
> >    return ioctl(bs->fd, BINDER_SET_CONTEXT_MGR, 0);
> > }
> > struct binder_state *binder_open(unsigned mapsize)
> > {
> >    struct binder_state *bs;
>
> > ...
> >    bs->mapped = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, bs->fd,
> > 0);
> > ...
> > }
> > Since above,I am not sure the relationship between ioctl() and
> > binder_ioctl() defined in driver ,along with the relationship between
> > mmap() and binder_mmap() defined in driver,could someone help me to
> > make it clear,thanks.
>
> > --
> > unsubscribe: [email protected]
> > website:http://groups.google.com/group/android-porting

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to