Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109124003
D48754.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D48754.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/xarray.h b/sys/compat/linuxkpi/common/include/linux/xarray.h
--- a/sys/compat/linuxkpi/common/include/linux/xarray.h
+++ b/sys/compat/linuxkpi/common/include/linux/xarray.h
@@ -49,14 +49,14 @@
#define xa_limit_32b XA_LIMIT(0, 0xFFFFFFFF)
-#define XA_ASSERT_LOCKED(xa) mtx_assert(&(xa)->mtx, MA_OWNED)
-#define xa_lock(xa) mtx_lock(&(xa)->mtx)
-#define xa_unlock(xa) mtx_unlock(&(xa)->mtx)
+#define XA_ASSERT_LOCKED(xa) mtx_assert(&(xa)->xa_lock, MA_OWNED)
+#define xa_lock(xa) mtx_lock(&(xa)->xa_lock)
+#define xa_unlock(xa) mtx_unlock(&(xa)->xa_lock)
struct xarray {
- struct radix_tree_root root;
- struct mtx mtx; /* internal mutex */
- uint32_t flags; /* see XA_FLAGS_XXX */
+ struct radix_tree_root xa_head;
+ struct mtx xa_lock; /* internal mutex */
+ uint32_t xa_flags; /* see XA_FLAGS_XXX */
};
/*
diff --git a/sys/compat/linuxkpi/common/src/linux_xarray.c b/sys/compat/linuxkpi/common/src/linux_xarray.c
--- a/sys/compat/linuxkpi/common/src/linux_xarray.c
+++ b/sys/compat/linuxkpi/common/src/linux_xarray.c
@@ -52,7 +52,7 @@
XA_ASSERT_LOCKED(xa);
- retval = radix_tree_delete(&xa->root, index);
+ retval = radix_tree_delete(&xa->xa_head, index);
if (retval == NULL_VALUE)
retval = NULL;
@@ -81,7 +81,7 @@
void *retval;
xa_lock(xa);
- retval = radix_tree_lookup(&xa->root, index);
+ retval = radix_tree_lookup(&xa->xa_head, index);
xa_unlock(xa);
if (retval == NULL_VALUE)
@@ -122,16 +122,16 @@
XA_ASSERT_LOCKED(xa);
/* mask should allow to allocate at least one item */
- MPASS(mask > ((xa->flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0));
+ MPASS(mask > ((xa->xa_flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0));
/* mask can be any power of two value minus one */
MPASS((mask & (mask + 1)) == 0);
- *pindex = (xa->flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0;
+ *pindex = (xa->xa_flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0;
if (ptr == NULL)
ptr = NULL_VALUE;
retry:
- retval = radix_tree_insert(&xa->root, *pindex, ptr);
+ retval = radix_tree_insert(&xa->xa_head, *pindex, ptr);
switch (retval) {
case -EEXIST:
@@ -184,16 +184,16 @@
XA_ASSERT_LOCKED(xa);
/* mask should allow to allocate at least one item */
- MPASS(mask > ((xa->flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0));
+ MPASS(mask > ((xa->xa_flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0));
/* mask can be any power of two value minus one */
MPASS((mask & (mask + 1)) == 0);
- *pnext_index = (xa->flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0;
+ *pnext_index = (xa->xa_flags & XA_FLAGS_ALLOC1) != 0 ? 1 : 0;
if (ptr == NULL)
ptr = NULL_VALUE;
retry:
- retval = radix_tree_insert(&xa->root, *pnext_index, ptr);
+ retval = radix_tree_insert(&xa->xa_head, *pnext_index, ptr);
switch (retval) {
case -EEXIST:
@@ -203,7 +203,7 @@
}
(*pnext_index)++;
(*pnext_index) &= mask;
- if (*pnext_index == 0 && (xa->flags & XA_FLAGS_ALLOC1) != 0)
+ if (*pnext_index == 0 && (xa->xa_flags & XA_FLAGS_ALLOC1) != 0)
(*pnext_index)++;
goto retry;
case -ENOMEM:
@@ -262,7 +262,7 @@
if (ptr == NULL)
ptr = NULL_VALUE;
retry:
- retval = radix_tree_insert(&xa->root, index, ptr);
+ retval = radix_tree_insert(&xa->xa_head, index, ptr);
switch (retval) {
case -ENOMEM:
@@ -306,7 +306,7 @@
if (ptr == NULL)
ptr = NULL_VALUE;
retry:
- retval = radix_tree_store(&xa->root, index, &ptr);
+ retval = radix_tree_store(&xa->xa_head, index, &ptr);
switch (retval) {
case 0:
@@ -347,9 +347,9 @@
{
memset(xa, 0, sizeof(*xa));
- mtx_init(&xa->mtx, "lkpi-xarray", NULL, MTX_DEF | MTX_RECURSE);
- xa->root.gfp_mask = GFP_NOWAIT;
- xa->flags = flags;
+ mtx_init(&xa->xa_lock, "lkpi-xarray", NULL, MTX_DEF | MTX_RECURSE);
+ xa->xa_head.gfp_mask = GFP_NOWAIT;
+ xa->xa_flags = flags;
}
/*
@@ -362,9 +362,9 @@
struct radix_tree_iter iter;
void **ppslot;
- radix_tree_for_each_slot(ppslot, &xa->root, &iter, 0)
- radix_tree_iter_delete(&xa->root, &iter, ppslot);
- mtx_destroy(&xa->mtx);
+ radix_tree_for_each_slot(ppslot, &xa->xa_head, &iter, 0)
+ radix_tree_iter_delete(&xa->xa_head, &iter, ppslot);
+ mtx_destroy(&xa->xa_lock);
}
/*
@@ -379,7 +379,7 @@
XA_ASSERT_LOCKED(xa);
- return (!radix_tree_iter_find(&xa->root, &iter, &temp));
+ return (!radix_tree_iter_find(&xa->xa_head, &iter, &temp));
}
bool
@@ -416,7 +416,7 @@
return (NULL);
}
- found = radix_tree_iter_find(&xa->root, &iter, &ppslot);
+ found = radix_tree_iter_find(&xa->xa_head, &iter, &ppslot);
if (likely(found)) {
retval = *ppslot;
if (retval == NULL_VALUE)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 2, 2:54 AM (21 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16388045
Default Alt Text
D48754.diff (4 KB)
Attached To
Mode
D48754: linuxkpi: Use same field names in `struct xarray` as Linux
Attached
Detach File
Event Timeline
Log In to Comment