diff mbox series

[06/10] block/rnbd-srv: rename one member in rnbd_srv_dev

Message ID 20230523075331.32250-7-guoqing.jiang@linux.dev (mailing list archive)
State New, archived
Headers show
Series misc patches for rnbd | expand

Commit Message

Guoqing Jiang May 23, 2023, 7:53 a.m. UTC
It actually represents the name of rnbd_srv_dev.

Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
 drivers/block/rnbd/rnbd-srv.c | 14 +++++++-------
 drivers/block/rnbd/rnbd-srv.h |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

Comments

Jinpu Wang May 23, 2023, 9:30 a.m. UTC | #1
On Tue, May 23, 2023 at 9:53 AM Guoqing Jiang <guoqing.jiang@linux.dev> wrote:
>
> It actually represents the name of rnbd_srv_dev.
>
> Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
> ---
>  drivers/block/rnbd/rnbd-srv.c | 14 +++++++-------
>  drivers/block/rnbd/rnbd-srv.h |  2 +-
>  2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c
> index b4c880759a52..e51eb4b7f6e6 100644
> --- a/drivers/block/rnbd/rnbd-srv.c
> +++ b/drivers/block/rnbd/rnbd-srv.c
> @@ -176,7 +176,7 @@ static void destroy_device(struct kref *kref)
>
>         WARN_ONCE(!list_empty(&dev->sess_dev_list),
>                   "Device %s is being destroyed but still in use!\n",
> -                 dev->id);
> +                 dev->name);
>
>         spin_lock(&dev_lock);
>         list_del(&dev->list);
> @@ -427,7 +427,7 @@ static struct rnbd_srv_dev *rnbd_srv_init_srv_dev(struct block_device *bdev)
>         if (!dev)
>                 return ERR_PTR(-ENOMEM);
>
> -       snprintf(dev->id, sizeof(dev->id), "%pg", bdev);
> +       snprintf(dev->name, sizeof(dev->name), "%pg", bdev);
>         kref_init(&dev->kref);
>         INIT_LIST_HEAD(&dev->sess_dev_list);
>         mutex_init(&dev->lock);
> @@ -442,7 +442,7 @@ rnbd_srv_find_or_add_srv_dev(struct rnbd_srv_dev *new_dev)
>
>         spin_lock(&dev_lock);
>         list_for_each_entry(dev, &dev_list, list) {
> -               if (!strncmp(dev->id, new_dev->id, sizeof(dev->id))) {
> +               if (!strncmp(dev->name, new_dev->name, sizeof(dev->name))) {
>                         if (!kref_get_unless_zero(&dev->kref))
>                                 /*
>                                  * We lost the race, device is almost dead.
> @@ -477,7 +477,7 @@ static int rnbd_srv_check_update_open_perm(struct rnbd_srv_dev *srv_dev,
>                         ret = 0;
>                 } else {
>                         pr_err("Mapping device '%s' for session %s with RW permissions failed. Device already opened as 'RW' by %d client(s), access mode %s.\n",
> -                              srv_dev->id, srv_sess->sessname,
> +                              srv_dev->name, srv_sess->sessname,
>                                srv_dev->open_write_cnt,
>                                rnbd_access_modes[access_mode].str);
>                 }
> @@ -488,14 +488,14 @@ static int rnbd_srv_check_update_open_perm(struct rnbd_srv_dev *srv_dev,
>                         ret = 0;
>                 } else {
>                         pr_err("Mapping device '%s' for session %s with migration permissions failed. Device already opened as 'RW' by %d client(s), access mode %s.\n",
> -                              srv_dev->id, srv_sess->sessname,
> +                              srv_dev->name, srv_sess->sessname,
>                                srv_dev->open_write_cnt,
>                                rnbd_access_modes[access_mode].str);
>                 }
>                 break;
>         default:
>                 pr_err("Received mapping request for device '%s' on session %s with invalid access mode: %d\n",
> -                      srv_dev->id, srv_sess->sessname, access_mode);
> +                      srv_dev->name, srv_sess->sessname, access_mode);
>                 ret = -EINVAL;
>         }
>
> @@ -770,7 +770,7 @@ static int process_msg_open(struct rnbd_srv_session *srv_sess,
>         list_add(&srv_sess_dev->dev_list, &srv_dev->sess_dev_list);
>         mutex_unlock(&srv_dev->lock);
>
> -       rnbd_srv_info(srv_sess_dev, "Opened device '%s'\n", srv_dev->id);
> +       rnbd_srv_info(srv_sess_dev, "Opened device '%s'\n", srv_dev->name);
>
>         kfree(full_path);
>
> diff --git a/drivers/block/rnbd/rnbd-srv.h b/drivers/block/rnbd/rnbd-srv.h
> index f5962fd31d62..6b5e5ade18ae 100644
> --- a/drivers/block/rnbd/rnbd-srv.h
> +++ b/drivers/block/rnbd/rnbd-srv.h
> @@ -35,7 +35,7 @@ struct rnbd_srv_dev {
>         struct kobject                  dev_kobj;
>         struct kobject                  *dev_sessions_kobj;
>         struct kref                     kref;
> -       char                            id[NAME_MAX];
> +       char                            name[NAME_MAX];
>         /* List of rnbd_srv_sess_dev structs */
>         struct list_head                sess_dev_list;
>         struct mutex                    lock;
> --
> 2.35.3
>
diff mbox series

Patch

diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c
index b4c880759a52..e51eb4b7f6e6 100644
--- a/drivers/block/rnbd/rnbd-srv.c
+++ b/drivers/block/rnbd/rnbd-srv.c
@@ -176,7 +176,7 @@  static void destroy_device(struct kref *kref)
 
 	WARN_ONCE(!list_empty(&dev->sess_dev_list),
 		  "Device %s is being destroyed but still in use!\n",
-		  dev->id);
+		  dev->name);
 
 	spin_lock(&dev_lock);
 	list_del(&dev->list);
@@ -427,7 +427,7 @@  static struct rnbd_srv_dev *rnbd_srv_init_srv_dev(struct block_device *bdev)
 	if (!dev)
 		return ERR_PTR(-ENOMEM);
 
-	snprintf(dev->id, sizeof(dev->id), "%pg", bdev);
+	snprintf(dev->name, sizeof(dev->name), "%pg", bdev);
 	kref_init(&dev->kref);
 	INIT_LIST_HEAD(&dev->sess_dev_list);
 	mutex_init(&dev->lock);
@@ -442,7 +442,7 @@  rnbd_srv_find_or_add_srv_dev(struct rnbd_srv_dev *new_dev)
 
 	spin_lock(&dev_lock);
 	list_for_each_entry(dev, &dev_list, list) {
-		if (!strncmp(dev->id, new_dev->id, sizeof(dev->id))) {
+		if (!strncmp(dev->name, new_dev->name, sizeof(dev->name))) {
 			if (!kref_get_unless_zero(&dev->kref))
 				/*
 				 * We lost the race, device is almost dead.
@@ -477,7 +477,7 @@  static int rnbd_srv_check_update_open_perm(struct rnbd_srv_dev *srv_dev,
 			ret = 0;
 		} else {
 			pr_err("Mapping device '%s' for session %s with RW permissions failed. Device already opened as 'RW' by %d client(s), access mode %s.\n",
-			       srv_dev->id, srv_sess->sessname,
+			       srv_dev->name, srv_sess->sessname,
 			       srv_dev->open_write_cnt,
 			       rnbd_access_modes[access_mode].str);
 		}
@@ -488,14 +488,14 @@  static int rnbd_srv_check_update_open_perm(struct rnbd_srv_dev *srv_dev,
 			ret = 0;
 		} else {
 			pr_err("Mapping device '%s' for session %s with migration permissions failed. Device already opened as 'RW' by %d client(s), access mode %s.\n",
-			       srv_dev->id, srv_sess->sessname,
+			       srv_dev->name, srv_sess->sessname,
 			       srv_dev->open_write_cnt,
 			       rnbd_access_modes[access_mode].str);
 		}
 		break;
 	default:
 		pr_err("Received mapping request for device '%s' on session %s with invalid access mode: %d\n",
-		       srv_dev->id, srv_sess->sessname, access_mode);
+		       srv_dev->name, srv_sess->sessname, access_mode);
 		ret = -EINVAL;
 	}
 
@@ -770,7 +770,7 @@  static int process_msg_open(struct rnbd_srv_session *srv_sess,
 	list_add(&srv_sess_dev->dev_list, &srv_dev->sess_dev_list);
 	mutex_unlock(&srv_dev->lock);
 
-	rnbd_srv_info(srv_sess_dev, "Opened device '%s'\n", srv_dev->id);
+	rnbd_srv_info(srv_sess_dev, "Opened device '%s'\n", srv_dev->name);
 
 	kfree(full_path);
 
diff --git a/drivers/block/rnbd/rnbd-srv.h b/drivers/block/rnbd/rnbd-srv.h
index f5962fd31d62..6b5e5ade18ae 100644
--- a/drivers/block/rnbd/rnbd-srv.h
+++ b/drivers/block/rnbd/rnbd-srv.h
@@ -35,7 +35,7 @@  struct rnbd_srv_dev {
 	struct kobject                  dev_kobj;
 	struct kobject                  *dev_sessions_kobj;
 	struct kref                     kref;
-	char				id[NAME_MAX];
+	char				name[NAME_MAX];
 	/* List of rnbd_srv_sess_dev structs */
 	struct list_head		sess_dev_list;
 	struct mutex			lock;