]> git.pld-linux.org Git - packages/open-iscsi.git/blob - 0058-iscsiuio-IPC-newroot-command.patch
fa3f4c729d7adb0771c1174de559c282a91541d8
[packages/open-iscsi.git] / 0058-iscsiuio-IPC-newroot-command.patch
1 From 6e979154c9c51dedd54c91e46106e495a65ced43 Mon Sep 17 00:00:00 2001
2 From: Chris Leech <cleech@redhat.com>
3 Date: Wed, 2 Jan 2013 14:45:05 -0800
4 Subject: [PATCH 58/58] iscsiuio IPC newroot command
5
6 ---
7  usr/mgmt_ipc.c     | 11 +++++++++++
8  usr/transport.c    |  1 +
9  usr/transport.h    |  1 +
10  usr/uip_mgmt_ipc.c | 14 ++++++++++++++
11  usr/uip_mgmt_ipc.h |  5 +++++
12  5 files changed, 32 insertions(+)
13
14 diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c
15 index 5cb7143..a8f8473 100644
16 --- a/usr/mgmt_ipc.c
17 +++ b/usr/mgmt_ipc.c
18 @@ -36,6 +36,7 @@
19  #include "sysdeps.h"
20  #include "iscsi_ipc.h"
21  #include "iscsi_err.h"
22 +#include "iscsi_sysfs.h"
23  
24  #define PEERUSER_MAX   64
25  #define EXTMSG_MAX     (64 * 1024)
26 @@ -229,8 +230,18 @@ static int
27  mgmt_ipc_newroot(queue_task_t *qtask)
28  {
29         char *newroot = qtask->req.u.newroot.path;
30 +       struct iscsi_transport *t;
31 +
32         if (chdir(newroot) || chroot(".") || chdir("/"))
33                 return ISCSI_ERR;
34 +
35 +       /* if a registered transport has a separate userspace process,
36 +        * notify it of the root change as well */
37 +       list_for_each_entry(t, &transports, list) {
38 +               if (t->template->newroot)
39 +                       t->template->newroot(t, newroot);
40 +       }
41 +
42         mgmt_ipc_write_rsp(qtask, ISCSI_SUCCESS);
43         return ISCSI_SUCCESS;
44  }
45 diff --git a/usr/transport.c b/usr/transport.c
46 index 4d030a8..e0488ad 100644
47 --- a/usr/transport.c
48 +++ b/usr/transport.c
49 @@ -83,6 +83,7 @@ struct iscsi_transport_template bnx2i = {
50         .ep_poll        = ktransport_ep_poll,
51         .ep_disconnect  = ktransport_ep_disconnect,
52         .set_net_config = uip_broadcast_params,
53 +       .newroot        = uip_broadcast_newroot,
54  };
55  
56  struct iscsi_transport_template be2iscsi = {
57 diff --git a/usr/transport.h b/usr/transport.h
58 index 388e4b1..d4d9ec7 100644
59 --- a/usr/transport.h
60 +++ b/usr/transport.h
61 @@ -39,6 +39,7 @@ struct iscsi_transport_template {
62         int (*set_net_config) (struct iscsi_transport *t,
63                                struct iface_rec *iface,
64                                struct iscsi_session *session);
65 +       void (*newroot) (struct iscsi_transport *t, char *path);
66  };
67  
68  /* represents data path provider */
69 diff --git a/usr/uip_mgmt_ipc.c b/usr/uip_mgmt_ipc.c
70 index f3074ee..d5d496a 100644
71 --- a/usr/uip_mgmt_ipc.c
72 +++ b/usr/uip_mgmt_ipc.c
73 @@ -39,3 +39,17 @@ int uip_broadcast_params(struct iscsi_transport *t,
74                              sizeof(iscsid_uip_broadcast_header_t) +
75                              sizeof(*iface));
76  }
77 +
78 +int uip_broadcast_newroot(struct iscsi_transport *t, char *newroot)
79 +{
80 +       struct iscsid_uip_broadcast broadcast;
81 +
82 +       memset(&broadcast, 0, sizeof(broadcast));
83 +
84 +       broadcast.header.command = ISCSID_UIP_NEWROOT;
85 +       strncpy(broadcast.u.newroot.path, newroot, PATH_MAX);
86 +
87 +       return uip_broadcast(&broadcast,
88 +                            sizeof(iscsid_uip_broadcast_header_t) +
89 +                            PATH_MAX + 1);
90 +}
91 diff --git a/usr/uip_mgmt_ipc.h b/usr/uip_mgmt_ipc.h
92 index 29a4769..3ca4fb1 100644
93 --- a/usr/uip_mgmt_ipc.h
94 +++ b/usr/uip_mgmt_ipc.h
95 @@ -29,6 +29,7 @@
96  typedef enum iscsid_uip_cmd {
97         ISCSID_UIP_IPC_UNKNOWN                  = 0,
98         ISCSID_UIP_IPC_GET_IFACE                = 1,
99 +       ISCSID_UIP_NEWROOT                      = 2,
100  
101         __ISCSID_UIP_IPC_MAX_COMMAND
102  } iscsid_uip_cmd_e;
103 @@ -47,6 +48,9 @@ typedef struct iscsid_uip_broadcast {
104                 struct ipc_broadcast_iface_rec {
105                         struct iface_rec rec;
106                 } iface_rec;
107 +               struct ipc_broadcast_newroot {
108 +                       char path[PATH_MAX + 1];
109 +               } newroot;
110         } u;
111  } iscsid_uip_broadcast_t;
112  
113 @@ -69,5 +73,6 @@ extern int uip_broadcast_params(struct iscsi_transport *t,
114                                 struct iface_rec *iface,
115                                 struct iscsi_session *session);
116  
117 +extern int uip_broadcast_newroot(struct iscsi_transport *t, char *path);
118  
119  #endif /* UIP_MGMT_IPC_H */
120 -- 
121 1.8.1.4
122
This page took 0.054778 seconds and 2 git commands to generate.