lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230420112946.2869956-3-yukuai1@huaweicloud.com>
Date:   Thu, 20 Apr 2023 19:29:40 +0800
From:   Yu Kuai <yukuai1@...weicloud.com>
To:     song@...nel.org, neilb@...e.de, akpm@...l.org
Cc:     linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
        yukuai3@...wei.com, yukuai1@...weicloud.com, yi.zhang@...wei.com,
        yangerkun@...wei.com
Subject: [PATCH -next 2/8] md/raid1-10: rename raid1-10.c to raid1-10.h

From: Yu Kuai <yukuai3@...wei.com>

raid1-10.c contains definitions that are used both for raid1 and raid10,
it's werid to use ".c" suffix.

Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
 drivers/md/{raid1-10.c => raid1-10.h} | 10 +++++++---
 drivers/md/raid1.c                    |  2 --
 drivers/md/raid1.h                    |  2 ++
 drivers/md/raid10.c                   |  2 --
 drivers/md/raid10.h                   |  2 ++
 5 files changed, 11 insertions(+), 7 deletions(-)
 rename drivers/md/{raid1-10.c => raid1-10.h} (92%)

diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.h
similarity index 92%
rename from drivers/md/raid1-10.c
rename to drivers/md/raid1-10.h
index e61f6cad4e08..04beef35142d 100644
--- a/drivers/md/raid1-10.c
+++ b/drivers/md/raid1-10.h
@@ -1,4 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef _RAID1_10_H
+#define _RAID1_10_H
+
 /* Maximum size of each resync request */
 #define RESYNC_BLOCK_SIZE (64*1024)
 #define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE)
@@ -33,7 +36,7 @@ struct raid1_plug_cb {
 	struct bio_list		pending;
 };
 
-static void rbio_pool_free(void *rbio, void *data)
+static inline void rbio_pool_free(void *rbio, void *data)
 {
 	kfree(rbio);
 }
@@ -91,8 +94,8 @@ static inline struct resync_pages *get_resync_pages(struct bio *bio)
 }
 
 /* generally called after bio_reset() for reseting bvec */
-static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp,
-			       int size)
+static inline void md_bio_reset_resync_pages(struct bio *bio,
+					     struct resync_pages *rp, int size)
 {
 	int idx = 0;
 
@@ -109,3 +112,4 @@ static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp,
 		size -= len;
 	} while (idx++ < RESYNC_PAGES && size > 0);
 }
+#endif
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 2f1011ffdf09..84724b9b20b8 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -49,8 +49,6 @@ static void lower_barrier(struct r1conf *conf, sector_t sector_nr);
 #define raid1_log(md, fmt, args...)				\
 	do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid1 " fmt, ##args); } while (0)
 
-#include "raid1-10.c"
-
 #define START(node) ((node)->start)
 #define LAST(node) ((node)->last)
 INTERVAL_TREE_DEFINE(struct serial_info, node, sector_t, _subtree_last,
diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h
index 468f189da7a0..80de4d66f010 100644
--- a/drivers/md/raid1.h
+++ b/drivers/md/raid1.h
@@ -2,6 +2,8 @@
 #ifndef _RAID1_H
 #define _RAID1_H
 
+#include "raid1-10.h"
+
 /*
  * each barrier unit size is 64MB fow now
  * note: it must be larger than RESYNC_DEPTH
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index a116b7c9d9f3..50d56b6af42f 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -77,8 +77,6 @@ static void end_reshape(struct r10conf *conf);
 #define raid10_log(md, fmt, args...)				\
 	do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid10 " fmt, ##args); } while (0)
 
-#include "raid1-10.c"
-
 #define NULL_CMD
 #define cmd_before(conf, cmd) \
 	do { \
diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h
index 63e48b11b552..63e88dd774f7 100644
--- a/drivers/md/raid10.h
+++ b/drivers/md/raid10.h
@@ -2,6 +2,8 @@
 #ifndef _RAID10_H
 #define _RAID10_H
 
+#include "raid1-10.h"
+
 /* Note: raid10_info.rdev can be set to NULL asynchronously by
  * raid10_remove_disk.
  * There are three safe ways to access raid10_info.rdev.
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ