Skip to contentSkip to conversation

block: drop force_dup parameter of raw_reconfigure_getfd()

PATCH Applied Denis V. Lunev via 3 participants 4 messages Apr 30, 2024 – May 28, 2024 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: drop force_dup parameter of raw_reconfigure_getfd()

This parameter is always passed as 'false' from the caller.

CC Andrey Zhadchenko <[email protected]>
CC Kevin Wolf <[email protected]>
CC Hanna Reitz <[email protected]>
---
 block/file-posix.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
block/file-posix.c +3 -5
index 35684f7e21..5c46938936 100644
@@ -1039,8 +1039,7 @@ static int fcntl_setfl(int fd, int flag)
 }
 
 static int raw_reconfigure_getfd(BlockDriverState *bs, int flags,
-                                 int *open_flags, uint64_t perm, bool force_dup,
-                                 Error **errp)
+                                 int *open_flags, uint64_t perm, Error **errp)
 {
     BDRVRawState *s = bs->opaque;
     int fd = -1;
@@ -1068,7 +1067,7 @@ static int raw_reconfigure_getfd(BlockDriverState *bs, int flags,
     assert((s->open_flags & O_ASYNC) == 0);
 #endif
 
-    if (!force_dup && *open_flags == s->open_flags) {
+    if (*open_flags == s->open_flags) {
         /* We're lucky, the existing fd is fine */
         return s->fd;
     }
@@ -3748,8 +3747,7 @@ static int raw_check_perm(BlockDriverState *bs, uint64_t perm, uint64_t shared,
     int ret;
 
     /* We may need a new fd if auto-read-only switches the mode */
-    ret = raw_reconfigure_getfd(bs, input_flags, &open_flags, perm,
-                                false, errp);
+    ret = raw_reconfigure_getfd(bs, input_flags, &open_flags, perm, errp);
     if (ret < 0) {
         return ret;
     } else if (ret != s->fd) {
Signature · 1 line
2.40.1
#1 lore raw
Quoted 34 lines · Denis V. Lunev

This parameter is always passed as 'false' from the caller.

CC Andrey Zhadchenko <[email protected]>
CC Kevin Wolf <[email protected]>
CC Hanna Reitz <[email protected]>
---
  block/file-posix.c | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)
block/file-posix.c +2 -3
index 35684f7e21..5c46938936 100644
@@ -1039,8 +1039,7 @@ static int fcntl_setfl(int fd, int flag)
  }
 
  static int raw_reconfigure_getfd(BlockDriverState *bs, int flags,
-                                 int *open_flags, uint64_t perm, bool force_dup,
-                                 Error **errp)
+                                 int *open_flags, uint64_t perm, Error **errp)
  {
      BDRVRawState *s = bs->opaque;
      int fd = -1;
@@ -1068,7 +1067,7 @@ static int raw_reconfigure_getfd(BlockDriverState *bs, int flags,
      assert((s->open_flags & O_ASYNC) == 0);
  #endif
 
-    if (!force_dup && *open_flags == s->open_flags) {
+    if (*open_flags == s->open_flags) {
          /* We're lucky, the existing fd is fine */
          return s->fd;
      }

block/file-posix.c static int raw_check_perm(BlockDriverState *bs, uint64_t perm, uint64_t shared, · line 3753

Quoted 9 lines
block/file-posix.c +1 -2
@@ -3748,8 +3747,7 @@ static int raw_check_perm(BlockDriverState *bs, uint64_t perm, uint64_t shared,
      int ret;
 
      /* We may need a new fd if auto-read-only switches the mode */
-    ret = raw_reconfigure_getfd(bs, input_flags, &open_flags, perm,
-                                false, errp);
+    ret = raw_reconfigure_getfd(bs, input_flags, &open_flags, perm, errp);
      if (ret < 0) {
          return ret;
      } else if (ret != s->fd) {

ping

#2 lore raw
In reply to Denis V. Lunev via
Quoted 34 lines · Denis V. Lunev

This parameter is always passed as 'false' from the caller.

CC Andrey Zhadchenko <[email protected]>
CC Kevin Wolf <[email protected]>
CC Hanna Reitz <[email protected]>
---
  block/file-posix.c | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)
block/file-posix.c +2 -3
index 35684f7e21..5c46938936 100644
@@ -1039,8 +1039,7 @@ static int fcntl_setfl(int fd, int flag)
  }
 
  static int raw_reconfigure_getfd(BlockDriverState *bs, int flags,
-                                 int *open_flags, uint64_t perm, bool force_dup,
-                                 Error **errp)
+                                 int *open_flags, uint64_t perm, Error **errp)
  {
      BDRVRawState *s = bs->opaque;
      int fd = -1;
@@ -1068,7 +1067,7 @@ static int raw_reconfigure_getfd(BlockDriverState *bs, int flags,
      assert((s->open_flags & O_ASYNC) == 0);
  #endif
 
-    if (!force_dup && *open_flags == s->open_flags) {
+    if (*open_flags == s->open_flags) {
          /* We're lucky, the existing fd is fine */
          return s->fd;
      }

block/file-posix.c static int raw_check_perm(BlockDriverState *bs, uint64_t perm, uint64_t shared, · line 3753

Quoted 9 lines
block/file-posix.c +1 -2
@@ -3748,8 +3747,7 @@ static int raw_check_perm(BlockDriverState *bs, uint64_t perm, uint64_t shared,
      int ret;
 
      /* We may need a new fd if auto-read-only switches the mode */
-    ret = raw_reconfigure_getfd(bs, input_flags, &open_flags, perm,
-                                false, errp);
+    ret = raw_reconfigure_getfd(bs, input_flags, &open_flags, perm, errp);
      if (ret < 0) {
          return ret;
      } else if (ret != s->fd) {

ping v2