]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd nbd: just move signal handler
authorMike Christie <mchristi@redhat.com>
Wed, 1 May 2019 01:26:08 +0000 (20:26 -0500)
committerMike Christie <mchristi@redhat.com>
Wed, 5 Jun 2019 04:56:53 +0000 (23:56 -0500)
This just moves the signal handler to make it easier to call the netlink
disconnect helpers in the next patches.

Signed-off-by: Mike Christie <mchristi@redhat.com>
src/tools/rbd_nbd/rbd-nbd.cc

index c51a64b36c775dfc88e1b434c9a16e1131dd64cd..d0abdff5a8140452794d77903b9513ec8cc1fcc9 100644 (file)
@@ -131,18 +131,6 @@ static Command cmd = None;
 static int parse_args(vector<const char*>& args, std::ostream *err_msg,
                       Command *command, Config *cfg);
 
-static void handle_signal(int signum)
-{
-  ceph_assert(signum == SIGINT || signum == SIGTERM);
-  derr << "*** Got signal " << sig_str(signum) << " ***" << dendl;
-  dout(20) << __func__ << ": " << "sending NBD_DISCONNECT" << dendl;
-  if (ioctl(nbd, NBD_DISCONNECT) < 0) {
-    derr << "rbd-nbd: disconnect failed: " << cpp_strerror(errno) << dendl;
-  } else {
-    dout(20) << __func__ << ": " << "disconnected" << dendl;
-  }
-}
-
 class NBDServer
 {
 private:
@@ -764,6 +752,18 @@ done:
   return r;
 }
 
+static void handle_signal(int signum)
+{
+  ceph_assert(signum == SIGINT || signum == SIGTERM);
+  derr << "*** Got signal " << sig_str(signum) << " ***" << dendl;
+  dout(20) << __func__ << ": " << "sending NBD_DISCONNECT" << dendl;
+  if (ioctl(nbd, NBD_DISCONNECT) < 0) {
+    derr << "rbd-nbd: disconnect failed: " << cpp_strerror(errno) << dendl;
+  } else {
+    dout(20) << __func__ << ": " << "disconnected" << dendl;
+  }
+}
+
 static NBDServer *start_server(Preforker& forker, int fd, librbd::Image& image)
 {
   NBDServer *server;