Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1258310

[PATCH 05/10] staging: lustre: change cfs_hash_head*_t to struct

From James Simmons <jsimmons@infradead.org>
Newsgroups linux.kernel
Subject [PATCH 05/10] staging: lustre: change cfs_hash_head*_t to struct
Date 2015-10-28 18:00 +0100
Message-ID <qoCeT-5cz-35@gated-at.bofh.it> (permalink)
References <qoCeS-5cz-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: James Simmons <uja.ornl@yahoo.com>

Change cfs_hash_head_t and cfs_head_head_dep_t
from typedef to true structures.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/include/linux/libcfs/libcfs_hash.h      |    4 +-
 drivers/staging/lustre/lustre/libcfs/hash.c        |   33 +++++++++++--------
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
index 805f298..c9f550e 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
@@ -88,8 +88,8 @@ union cfs_hash_lock {
  * cfs_hash_bucket is a container of:
  * - lock, counter ...
  * - array of hash-head starting from hsb_head[0], hash-head can be one of
- *   . cfs_hash_head_t
- *   . cfs_hash_head_dep_t
+ *   . struct cfs_hash_head
+ *   . struct cfs_hash_head_dep
  *   . struct cfs_hash_dhead
  *   . struct cfs_hash_dhead_dep
  *   which depends on requirement of user
diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c
index 575e8a8..c267f8a 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -239,21 +239,22 @@ cfs_hash_lock_setup(struct cfs_hash *hs)
  * Simple hash head without depth tracking
  * new element is always added to head of hlist
  */
-typedef struct {
+struct cfs_hash_head {
 	struct hlist_head	hh_head;	/**< entries list */
-} cfs_hash_head_t;
+};
 
 static int
 cfs_hash_hh_hhead_size(struct cfs_hash *hs)
 {
-	return sizeof(cfs_hash_head_t);
+	return sizeof(struct cfs_hash_head);
 }
 
 static struct hlist_head *
 cfs_hash_hh_hhead(struct cfs_hash *hs, struct cfs_hash_bd *bd)
 {
-	cfs_hash_head_t *head = (cfs_hash_head_t *)&bd->bd_bucket->hsb_head[0];
+	struct cfs_hash_head *head;
 
+	head = (struct cfs_hash_head *)&bd->bd_bucket->hsb_head[0];
 	return &head[bd->bd_offset].hh_head;
 }
 
@@ -277,23 +278,23 @@ cfs_hash_hh_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd,
  * Simple hash head with depth tracking
  * new element is always added to head of hlist
  */
-typedef struct {
+struct cfs_hash_head_dep {
 	struct hlist_head	hd_head;	/**< entries list */
-	unsigned int	    hd_depth;       /**< list length */
-} cfs_hash_head_dep_t;
+	unsigned int		hd_depth;       /**< list length */
+};
 
 static int
 cfs_hash_hd_hhead_size(struct cfs_hash *hs)
 {
-	return sizeof(cfs_hash_head_dep_t);
+	return sizeof(struct cfs_hash_head_dep);
 }
 
 static struct hlist_head *
 cfs_hash_hd_hhead(struct cfs_hash *hs, struct cfs_hash_bd *bd)
 {
-	cfs_hash_head_dep_t   *head;
+	struct cfs_hash_head_dep   *head;
 
-	head = (cfs_hash_head_dep_t *)&bd->bd_bucket->hsb_head[0];
+	head = (struct cfs_hash_head_dep *)&bd->bd_bucket->hsb_head[0];
 	return &head[bd->bd_offset].hd_head;
 }
 
@@ -301,8 +302,10 @@ static int
 cfs_hash_hd_hnode_add(struct cfs_hash *hs, struct cfs_hash_bd *bd,
 		      struct hlist_node *hnode)
 {
-	cfs_hash_head_dep_t *hh = container_of(cfs_hash_hd_hhead(hs, bd),
-					       cfs_hash_head_dep_t, hd_head);
+	struct cfs_hash_head_dep *hh;
+
+	hh = container_of(cfs_hash_hd_hhead(hs, bd),
+			  struct cfs_hash_head_dep, hd_head);
 	hlist_add_head(hnode, &hh->hd_head);
 	return ++hh->hd_depth;
 }
@@ -311,8 +314,10 @@ static int
 cfs_hash_hd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd,
 		      struct hlist_node *hnode)
 {
-	cfs_hash_head_dep_t *hh = container_of(cfs_hash_hd_hhead(hs, bd),
-					       cfs_hash_head_dep_t, hd_head);
+	struct cfs_hash_head_dep *hh;
+
+	hh = container_of(cfs_hash_hd_hhead(hs, bd),
+			  struct cfs_hash_head_dep, hd_head);
 	hlist_del_init(hnode);
 	return --hh->hd_depth;
 }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/10] staging: lustre: cleanup up libcfs hash code for upstream James Simmons <jsimmons@infradead.org> - 2015-10-28 18:00 +0100
  [PATCH 10/10] staging: lustre: remove white space in hash.c James Simmons <jsimmons@infradead.org> - 2015-10-28 18:00 +0100
    Re: [PATCH 10/10] staging: lustre: remove white space in hash.c Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-29 00:10 +0100
  [PATCH 03/10] staging: lustre: change cfs_hash_ops_t to struct James Simmons <jsimmons@infradead.org> - 2015-10-28 18:00 +0100
  [PATCH 02/10] staging: lustre: change cfs_hash_hlist_ops_t to struct James Simmons <jsimmons@infradead.org> - 2015-10-28 18:00 +0100
  [PATCH 05/10] staging: lustre: change cfs_hash_head*_t to struct James Simmons <jsimmons@infradead.org> - 2015-10-28 18:00 +0100
  [PATCH 07/10] staging: lustre: cleanup over 80 characters in libcfs_hash.h James Simmons <jsimmons@infradead.org> - 2015-10-28 18:00 +0100

csiph-web