diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 16:40:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 16:40:20 -0400 |
commit | dc690d8ef842b464f1c429a376ca16cb8dbee6ae (patch) | |
tree | 77955849af5a15755f5e55e24ae4b9c520583a72 /include/linux/idr.h | |
parent | 57399ec9077a4b962b81037aaa279fab52f5e989 (diff) | |
parent | 91a6902958f052358899f58683d44e36228d85c2 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (61 commits)
sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
sysfs: make directory dentries and inodes reclaimable
sysfs: implement sysfs_get_dentry()
sysfs: move sysfs_drop_dentry() to dir.c and make it static
sysfs: restructure add/remove paths and fix inode update
sysfs: use sysfs_mutex to protect the sysfs_dirent tree
sysfs: consolidate sysfs spinlocks
sysfs: make kobj point to sysfs_dirent instead of dentry
sysfs: implement sysfs_find_dirent() and sysfs_get_dirent()
sysfs: implement SYSFS_FLAG_REMOVED flag
sysfs: rename sysfs_dirent->s_type to s_flags and make room for flags
sysfs: make sysfs_drop_dentry() access inodes using ilookup()
sysfs: Fix oops in sysfs_drop_dentry on x86_64
sysfs: use singly-linked list for sysfs_dirent tree
sysfs: slim down sysfs_dirent->s_active
sysfs: move s_active functions to fs/sysfs/dir.c
sysfs: fix root sysfs_dirent -> root dentry association
sysfs: use iget_locked() instead of new_inode()
sysfs: reorganize sysfs_new_indoe() and sysfs_create()
sysfs: fix parent refcounting during rename and move
...
Diffstat (limited to 'include/linux/idr.h')
-rw-r--r-- | include/linux/idr.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/idr.h b/include/linux/idr.h index 826803449db7..915572fa030b 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h | |||
@@ -83,4 +83,33 @@ void idr_remove(struct idr *idp, int id); | |||
83 | void idr_destroy(struct idr *idp); | 83 | void idr_destroy(struct idr *idp); |
84 | void idr_init(struct idr *idp); | 84 | void idr_init(struct idr *idp); |
85 | 85 | ||
86 | |||
87 | /* | ||
88 | * IDA - IDR based id allocator, use when translation from id to | ||
89 | * pointer isn't necessary. | ||
90 | */ | ||
91 | #define IDA_CHUNK_SIZE 128 /* 128 bytes per chunk */ | ||
92 | #define IDA_BITMAP_LONGS (128 / sizeof(long) - 1) | ||
93 | #define IDA_BITMAP_BITS (IDA_BITMAP_LONGS * sizeof(long) * 8) | ||
94 | |||
95 | struct ida_bitmap { | ||
96 | long nr_busy; | ||
97 | unsigned long bitmap[IDA_BITMAP_LONGS]; | ||
98 | }; | ||
99 | |||
100 | struct ida { | ||
101 | struct idr idr; | ||
102 | struct ida_bitmap *free_bitmap; | ||
103 | }; | ||
104 | |||
105 | #define IDA_INIT(name) { .idr = IDR_INIT(name), .free_bitmap = NULL, } | ||
106 | #define DEFINE_IDA(name) struct ida name = IDA_INIT(name) | ||
107 | |||
108 | int ida_pre_get(struct ida *ida, gfp_t gfp_mask); | ||
109 | int ida_get_new_above(struct ida *ida, int starting_id, int *p_id); | ||
110 | int ida_get_new(struct ida *ida, int *p_id); | ||
111 | void ida_remove(struct ida *ida, int id); | ||
112 | void ida_destroy(struct ida *ida); | ||
113 | void ida_init(struct ida *ida); | ||
114 | |||
86 | #endif /* __IDR_H__ */ | 115 | #endif /* __IDR_H__ */ |