The patch titled devscontrol: provide functions to manipulate char device mappings has been removed from the -mm tree. Its filename was devscontrol-provide-functions-to-manipulate-char-device-mappings.patch This patch was dropped because of bunfight The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: devscontrol: provide functions to manipulate char device mappings From: Pavel Emelyanov <xemul@xxxxxxxxxx> The character devices currently have a global map for devices and their own locks and callbacks for device probing. So here are the functions that provide the way to play with character devices maps. They are cdev_map_init/cdev_map_fini to create/destroy one, cdev_add_to_map/cdev_del_from_map to map/unmap devices, and cdev_iterate_map for uniformity. Signed-off-by: Pavel Emelyanov <xemul@xxxxxxxxxx> Cc: Paul Menage <menage@xxxxxxxxxx> Cc: Sukadev Bhattiprolu <sukadev@xxxxxxxxxx> Cc: Serge Hallyn <serue@xxxxxxxxxx> Cc: Greg KH <greg@xxxxxxxxx> Cc: Kay Sievers <kay.sievers@xxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/char_dev.c | 63 +++++++++++++++++++++++++++++++++++++++++ include/linux/cdev.h | 7 ++++ 2 files changed, 70 insertions(+) diff -puN fs/char_dev.c~devscontrol-provide-functions-to-manipulate-char-device-mappings fs/char_dev.c --- a/fs/char_dev.c~devscontrol-provide-functions-to-manipulate-char-device-mappings +++ a/fs/char_dev.c @@ -476,6 +476,69 @@ int cdev_add(struct cdev *p, dev_t dev, return kobj_map(cdev_map, dev, count, NULL, exact_match, exact_lock, p); } +#ifdef CONFIG_CGROUP_DEVS +int cdev_add_to_map(struct kobj_map *map, dev_t dev, int all, mode_t mode) +{ + int tmp; + struct kobject *k; + struct cdev *c; + + k = kobj_lookup(cdev_map, dev, NULL, &tmp); + if (k == NULL) + return -ENODEV; + + c = container_of(k, struct cdev, kobj); + tmp = kobj_remap(map, dev, mode, all ? MINORMASK : 1, NULL, + exact_match, exact_lock, c); + if (tmp < 0) { + cdev_put(c); + return tmp; + } + + return 0; +} + +int cdev_del_from_map(struct kobj_map *map, dev_t dev, int all) +{ + int tmp; + struct kobject *k; + struct cdev *c; + + k = kobj_lookup(map, dev, NULL, &tmp); + if (k == NULL) + return -ENODEV; + + c = container_of(k, struct cdev, kobj); + kobj_unmap(map, dev, all ? MINORMASK : 1); + + /* + * one put for the kobj_lookup above and one for + * the kobj_lookup in cdev_add_to_map + */ + cdev_put(c); + cdev_put(c); + return 0; +} + +void cdev_iterate_map(struct kobj_map *map, + int (*fn)(dev_t, int, mode_t, void *), void *x) +{ + kobj_map_iterate(map, fn, x); +} + +static struct kobject *base_probe(dev_t dev, int *part, void *data); + +struct kobj_map *cdev_map_init(void) +{ + return kobj_map_init(base_probe, &chrdevs_lock); +} + +void cdev_map_fini(struct kobj_map *map) +{ + kobj_map_fini(map); +} +#endif + static void cdev_unmap(dev_t dev, unsigned count) { kobj_unmap(cdev_map, dev, count); diff -puN include/linux/cdev.h~devscontrol-provide-functions-to-manipulate-char-device-mappings include/linux/cdev.h --- a/include/linux/cdev.h~devscontrol-provide-functions-to-manipulate-char-device-mappings +++ a/include/linux/cdev.h @@ -33,5 +33,12 @@ void cd_forget(struct inode *); extern struct backing_dev_info directly_mappable_cdev_bdi; +struct kobj_map; +int cdev_add_to_map(struct kobj_map *map, dev_t dev, int all, mode_t mode); +int cdev_del_from_map(struct kobj_map *map, dev_t dev, int all); +struct kobj_map *cdev_map_init(void); +void cdev_map_fini(struct kobj_map *map); +void cdev_iterate_map(struct kobj_map *, + int (*fn)(dev_t, int, mode_t, void *), void *); #endif #endif _ Patches currently in -mm which might be from xemul@xxxxxxxxxx are git-kgdb-light.patch use-find_task_by_vpid-in-audit-code.patch ia64-fix-getpid-and-set_tid_address-fast-system-calls-for-pid-namespaces.patch git-udf.patch cgroup-api-files-rename-read-write_uint-methods-to-read_write_u64.patch cgroup-api-files-add-res_counter_read_u64.patch cgroup-api-files-use-read_u64-in-memory-controller.patch cgroup-api-files-strip-all-trailing-whitespace-in-cgroup_write_u64.patch cgroup-api-files-update-cpusets-to-use-cgroup-structured-file-api.patch cgroup-api-files-update-cpusets-to-use-cgroup-structured-file-api-fix.patch cgroup-api-files-add-cgroup-map-data-type.patch cgroup-api-files-use-cgroup-map-for-memcontrol-stats-file.patch cgroup-api-files-drop-mem_cgroup_force_empty.patch cgroup-api-files-move-releasable-to-cgroup_debug-subsystem.patch cgroup-api-files-make-cgroup_debug-default-to-off.patch cgroups-add-cgroup-support-for-enabling-controllers-at-boot-time.patch memory-controller-make-memory-resource-control-aware-of-boot-options.patch devscontrol-provide-functions-to-manipulate-char-device-mappings.patch devscontrol-provide-functions-to-manipulate-block-device-mappings.patch devscontrol-devices-accessibility-control-group-itself.patch remove-unused-variable-from-send_signal.patch turn-legacy_queue-macro-into-static-inline-function.patch consolidate-checking-for-ignored-legacy-signals.patch consolidate-checking-for-ignored-legacy-signals-simplify.patch signals-consolidate-checks-for-whether-or-not-to-ignore-a-signal.patch signals-clean-dequeue_signal-from-excess-checks-and-assignments.patch signals-consolidate-send_sigqueue-and-send_group_sigqueue.patch signals-cleanup-security_task_kill-usage-implementation.patch signals-use-__group_complete_signal-for-the-specific-signals-too.patch signals-fold-complete_signal-into-send_signal-do_send_sigqueue.patch signals-unify-send_sigqueue-send_group_sigqueue-completely.patch sysctl-merge-equal-proc_sys_read-and-proc_sys_write.patch sysctl-clean-from-unneeded-extern-and-forward-declarations.patch sysctl-add-the-permissions-callback-on-the-ctl_table_root.patch free_pidmap-turn-it-into-free_pidmapstruct-upid.patch use-find_task_by_vpid-in-taskstats.patch deprecate-find_task_by_pid.patch deprecate-find_task_by_pid-warning-fix.patch pidns-make-pid-level-and-pid_ns-level-unsigned.patch reiser4.patch put_pid-make-sure-we-dont-free-the-live-pid.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html