{"push_id":3082542077,"size":1,"distinct_size":1,"ref":"refs/heads/2018-11-21/binderfs","head":"5430bff69cf37442aefb3352934aa691e5608f35","before":"da1889686d3946fd39feecfaa6422aa01236ce5b","commits":[{"sha":"5430bff69cf37442aefb3352934aa691e5608f35","author":{"name":"Christian Brauner","email":"2314b2e3a4a1f7db165be2aafbf1efd78f28cc97@brauner.io"},"message":"binder: implement binderfs\n\nAs discussed at Linux Plumbers Conference 2018 in Vancouver this is the\nimplementation of binderfs.\n\nAbstract:\nbinderfs is a backwards-compatible filesystem for Android's binder ipc\nmechanism. Each ipc namespace can mount binderfs as a new instance.\nMounting binderfs multiple times at different locations in the same ipc\nnamespace will not cause a new super block to be allocated and hence it\nwill be the same filesystem instance.\nEach new binderfs mount will have its own set of binder devices only\nvisible in the ipc namespace it has been mounted in. All devices in a new\nbinderfs mount will follow the scheme binder%d and numbering will always\nstart at 0.\n\n1. Backwards compatibility:\nDevices requested for the initial ipc namespace in\nCONFIG_ANDROID_BINDER_DEVICES will work as before. They will be registered\nvia misc_register() and appear in the devtmpfs mount of the initial ipc\nmount namespace. Specifically, the standard devices binder, hwbinder, and\nvndbinder will all appear in their standard locations in /dev.\nMounting or unmounting the binderfs mount in the initial ipc namespace will\nhave no effect on these devices, i.e. they will neither show up in the\nbinderfs mount nor will they disappear when the binderfs mount is gone.\nHowever, the devices can be removed via an ioctl() on the binder control\ndevice.\n\n2. binder-control:\nEach new binderfs instance comes with a binder-control device. No other\ndevices will be present at first. The binder-control device can be used to\ndynamically allocate and deallocate binder devices:\n- a new binder device node with the next free index can be allocated with:\n  ioctl(binder_ctl_fd, BINDER_CTL_GET_FREE)\n- a new binder device node with a specific index can be allocated with:\n  ioctl(binder_ctl_fd, BINDER_CTL_ADD, 23)\n- an existing binder device node can be destroyed with:\n  ioctl(binder_ctl_fd, BINDER_CTL_REMOVE, minor-number-of-device)\nAssuming a new instance of binderfs has been mounted at /dev/binderfs via\nmount -t binderfs binderfs /dev/binderfs. Then a request to create a new\nbinder device can be made via:\nint fd = open(\"/dev/binderfs/binder\", O_RDONLY);\nioctl(fd, BINDER_CTL_GET_FREE);\nwhich will create a new binder device e.g. /dev/binderfs/binder2 .\n\nImplementation details:\n- Each binderfs mount has its own tracker for the devices associated with\n  this mount, the indeces that have currently been given out (idr tracker),\n  it's own mutex to protect the devices list and the idr tracker\n- New binder devices associated with a binderfs mount do not use the\n  full misc_register() infrastructure. The misc_register() infrastructure\n  can only create new devices in the host's devtmpfs mount. binderfs does\n  however only make devices appear under its own mountpoint and thus\n  allocates new character devices nodes from the inode of the root dentry of\n  the super block. This will have the side-effect that binderfs specific\n  device nodes do not appear in sysfs. This behavior is similar to devpts\n  allocated pts devices and has no effect on the functionality of the ipc\n  mechanism itself.\n  Since binder does not have it's own major device number it needs to use\n  minor numbers from the MISC_MAJOR pool. These need to be reserved when\n  the new inode is created. This is done by splitting out two small and\n  clean helpers from misc_register() and misc_deregister(). They can be\n  used to reserve and release a dynamic minor number.\n\nSigned-off-by: Christian Brauner <christian.brauner@ubuntu.com>","distinct":true,"url":"https://api.github.com/repos/brauner/linux/commits/5430bff69cf37442aefb3352934aa691e5608f35"}]}
{"actor":{"display_login":"brauner"}}