diff mbox series

[19/19] mpathpersist: remove logsink and udev

Message ID 20200916153718.582-20-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipath-tools: shutdown, libdevmapper races, globals | expand

Commit Message

Martin Wilck Sept. 16, 2020, 3:37 p.m. UTC
From: Martin Wilck <mwilck@suse.com>

We can use libmultipath's internal symbols now.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 mpathpersist/main.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Benjamin Marzinski Sept. 21, 2020, 8:15 p.m. UTC | #1
On Wed, Sep 16, 2020 at 05:37:18PM +0200, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> We can use libmultipath's internal symbols now.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>  mpathpersist/main.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/mpathpersist/main.c b/mpathpersist/main.c
> index 0f0db4b..729857f 100644
> --- a/mpathpersist/main.c
> +++ b/mpathpersist/main.c

I'm pretty sure that without this patch, mpathpersist is not directly
calling functions from libmultipath, and if so, it should stay that way.
I don't see any problem with adding the libmultipath_init() and
libmultipath_exit() calls to libmpathpersist_init() and
libmpathpersist_exit().

-Ben 

> @@ -42,13 +42,10 @@ void * mpath_alloc_prin_response(int prin_sa);
>  void mpath_print_transport_id(struct prin_fulldescr *fdesc);
>  int construct_transportid(const char * inp, struct transportid transid[], int num_transportids);
>  
> -int logsink;
> -
>  void rcu_register_thread_memb(void) {}
>  
>  void rcu_unregister_thread_memb(void) {}
>  
> -struct udev *udev;
>  
>  static int verbose, loglevel, noisy;
>  
> @@ -608,16 +605,17 @@ int main(int argc, char *argv[])
>  		exit (1);
>  	}
>  
> -	udev = udev_new();
> +	if (libmultipath_init())
> +		exit(1);
>  	if (libmpathpersist_init()) {
> -		udev_unref(udev);
> +		libmultipath_exit();
>  		exit(1);
>  	}
>  
>  	ret = handle_args(argc, argv, 0);
>  
>  	libmpathpersist_exit();
> -	udev_unref(udev);
> +	libmultipath_exit();
>  
>  	return (ret >= 0) ? ret : MPATH_PR_OTHER;
>  }
> -- 
> 2.28.0

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
Martin Wilck Sept. 22, 2020, 11:32 a.m. UTC | #2
On Mon, 2020-09-21 at 15:15 -0500, Benjamin Marzinski wrote:
> On Wed, Sep 16, 2020 at 05:37:18PM +0200, mwilck@suse.com wrote:
> > From: Martin Wilck <mwilck@suse.com>
> > 
> > We can use libmultipath's internal symbols now.
> > 
> > Signed-off-by: Martin Wilck <mwilck@suse.com>
> > ---
> >  mpathpersist/main.c | 10 ++++------
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/mpathpersist/main.c b/mpathpersist/main.c
> > index 0f0db4b..729857f 100644
> > --- a/mpathpersist/main.c
> > +++ b/mpathpersist/main.c
> 
> I'm pretty sure that without this patch, mpathpersist is not directly
> calling functions from libmultipath

Yes, this is so.

> , and if so, it should stay that way.
> 
> I don't see any problem with adding the libmultipath_init() and
> libmultipath_exit() calls to libmpathpersist_init() and
> libmpathpersist_exit().

Will do.

Martin



--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox series

Patch

diff --git a/mpathpersist/main.c b/mpathpersist/main.c
index 0f0db4b..729857f 100644
--- a/mpathpersist/main.c
+++ b/mpathpersist/main.c
@@ -42,13 +42,10 @@  void * mpath_alloc_prin_response(int prin_sa);
 void mpath_print_transport_id(struct prin_fulldescr *fdesc);
 int construct_transportid(const char * inp, struct transportid transid[], int num_transportids);
 
-int logsink;
-
 void rcu_register_thread_memb(void) {}
 
 void rcu_unregister_thread_memb(void) {}
 
-struct udev *udev;
 
 static int verbose, loglevel, noisy;
 
@@ -608,16 +605,17 @@  int main(int argc, char *argv[])
 		exit (1);
 	}
 
-	udev = udev_new();
+	if (libmultipath_init())
+		exit(1);
 	if (libmpathpersist_init()) {
-		udev_unref(udev);
+		libmultipath_exit();
 		exit(1);
 	}
 
 	ret = handle_args(argc, argv, 0);
 
 	libmpathpersist_exit();
-	udev_unref(udev);
+	libmultipath_exit();
 
 	return (ret >= 0) ? ret : MPATH_PR_OTHER;
 }