Remove all trailing whitespaces

parent 37fc7b9e
...@@ -871,7 +871,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ...@@ -871,7 +871,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<listitem> The hook type (i.e. 'clone' or 'pre-mount'). </listitem> <listitem> The hook type (i.e. 'clone' or 'pre-mount'). </listitem>
<listitem> Additional arguments In the <listitem> Additional arguments In the
case of the clone hook, any extra arguments passed to case of the clone hook, any extra arguments passed to
lxc-clone will appear as further arguments to the hook. </listitem> lxc-clone will appear as further arguments to the hook. </listitem>
</itemizedlist> </itemizedlist>
The following environment variables are set: The following environment variables are set:
<itemizedlist> <itemizedlist>
......
...@@ -48,7 +48,7 @@ static int netlink_socket(void) ...@@ -48,7 +48,7 @@ static int netlink_socket(void)
{ {
return -1; return -1;
} }
struct sockaddr_nl l_addr; struct sockaddr_nl l_addr;
memset(&l_addr, 0, sizeof(l_addr)); memset(&l_addr, 0, sizeof(l_addr));
l_addr.nl_family = AF_NETLINK; l_addr.nl_family = AF_NETLINK;
...@@ -57,7 +57,7 @@ static int netlink_socket(void) ...@@ -57,7 +57,7 @@ static int netlink_socket(void)
close(l_socket); close(l_socket);
return -1; return -1;
} }
return l_socket; return l_socket;
} }
...@@ -67,14 +67,14 @@ static int netlink_send(int p_socket, int p_request) ...@@ -67,14 +67,14 @@ static int netlink_send(int p_socket, int p_request)
memset(l_buffer, 0, sizeof(l_buffer)); memset(l_buffer, 0, sizeof(l_buffer));
struct nlmsghdr *l_hdr = (struct nlmsghdr *)l_buffer; struct nlmsghdr *l_hdr = (struct nlmsghdr *)l_buffer;
struct rtgenmsg *l_msg = (struct rtgenmsg *)NLMSG_DATA(l_hdr); struct rtgenmsg *l_msg = (struct rtgenmsg *)NLMSG_DATA(l_hdr);
l_hdr->nlmsg_len = NLMSG_LENGTH(sizeof(*l_msg)); l_hdr->nlmsg_len = NLMSG_LENGTH(sizeof(*l_msg));
l_hdr->nlmsg_type = p_request; l_hdr->nlmsg_type = p_request;
l_hdr->nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST; l_hdr->nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
l_hdr->nlmsg_pid = 0; l_hdr->nlmsg_pid = 0;
l_hdr->nlmsg_seq = p_socket; l_hdr->nlmsg_seq = p_socket;
l_msg->rtgen_family = AF_UNSPEC; l_msg->rtgen_family = AF_UNSPEC;
struct sockaddr_nl l_addr; struct sockaddr_nl l_addr;
memset(&l_addr, 0, sizeof(l_addr)); memset(&l_addr, 0, sizeof(l_addr));
l_addr.nl_family = AF_NETLINK; l_addr.nl_family = AF_NETLINK;
...@@ -97,7 +97,7 @@ static int netlink_recv(int p_socket, void *p_buffer, size_t p_len) ...@@ -97,7 +97,7 @@ static int netlink_recv(int p_socket, void *p_buffer, size_t p_len)
l_msg.msg_controllen = 0; l_msg.msg_controllen = 0;
l_msg.msg_flags = 0; l_msg.msg_flags = 0;
int l_result = recvmsg(p_socket, &l_msg, 0); int l_result = recvmsg(p_socket, &l_msg, 0);
if(l_result < 0) if(l_result < 0)
{ {
if(errno == EINTR) if(errno == EINTR)
...@@ -106,7 +106,7 @@ static int netlink_recv(int p_socket, void *p_buffer, size_t p_len) ...@@ -106,7 +106,7 @@ static int netlink_recv(int p_socket, void *p_buffer, size_t p_len)
} }
return -2; return -2;
} }
if(l_msg.msg_flags & MSG_TRUNC) if(l_msg.msg_flags & MSG_TRUNC)
{ // buffer was too small { // buffer was too small
return -1; return -1;
...@@ -119,12 +119,12 @@ static struct nlmsghdr *getNetlinkResponse(int p_socket, int *p_size, int *p_don ...@@ -119,12 +119,12 @@ static struct nlmsghdr *getNetlinkResponse(int p_socket, int *p_size, int *p_don
{ {
size_t l_size = 4096; size_t l_size = 4096;
void *l_buffer = NULL; void *l_buffer = NULL;
for(;;) for(;;)
{ {
free(l_buffer); free(l_buffer);
l_buffer = malloc(l_size); l_buffer = malloc(l_size);
int l_read = netlink_recv(p_socket, l_buffer, l_size); int l_read = netlink_recv(p_socket, l_buffer, l_size);
*p_size = l_read; *p_size = l_read;
if(l_read == -2) if(l_read == -2)
...@@ -142,13 +142,13 @@ static struct nlmsghdr *getNetlinkResponse(int p_socket, int *p_size, int *p_don ...@@ -142,13 +142,13 @@ static struct nlmsghdr *getNetlinkResponse(int p_socket, int *p_size, int *p_don
{ {
continue; continue;
} }
if(l_hdr->nlmsg_type == NLMSG_DONE) if(l_hdr->nlmsg_type == NLMSG_DONE)
{ {
*p_done = 1; *p_done = 1;
break; break;
} }
if(l_hdr->nlmsg_type == NLMSG_ERROR) if(l_hdr->nlmsg_type == NLMSG_ERROR)
{ {
free(l_buffer); free(l_buffer);
...@@ -157,7 +157,7 @@ static struct nlmsghdr *getNetlinkResponse(int p_socket, int *p_size, int *p_don ...@@ -157,7 +157,7 @@ static struct nlmsghdr *getNetlinkResponse(int p_socket, int *p_size, int *p_don
} }
return l_buffer; return l_buffer;
} }
l_size *= 2; l_size *= 2;
} }
} }
...@@ -202,7 +202,7 @@ static NetlinkList *getResultList(int p_socket, int p_request) ...@@ -202,7 +202,7 @@ static NetlinkList *getResultList(int p_socket, int p_request)
freeResultList(l_list); freeResultList(l_list);
return NULL; return NULL;
} }
NetlinkList *l_item = newListItem(l_hdr, l_size); NetlinkList *l_item = newListItem(l_hdr, l_size);
if(!l_list) if(!l_list)
{ {
...@@ -282,7 +282,7 @@ static void interpretLink(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru ...@@ -282,7 +282,7 @@ static void interpretLink(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru
size_t l_nameSize = 0; size_t l_nameSize = 0;
size_t l_addrSize = 0; size_t l_addrSize = 0;
size_t l_dataSize = 0; size_t l_dataSize = 0;
size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg)); size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg));
struct rtattr *l_rta; struct rtattr *l_rta;
for(l_rta = (struct rtattr *)(((char *)l_info) + NLMSG_ALIGN(sizeof(struct ifinfomsg))); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) for(l_rta = (struct rtattr *)(((char *)l_info) + NLMSG_ALIGN(sizeof(struct ifinfomsg))); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize))
...@@ -304,17 +304,17 @@ static void interpretLink(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru ...@@ -304,17 +304,17 @@ static void interpretLink(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru
break; break;
} }
} }
struct ifaddrs *l_entry = malloc(sizeof(struct ifaddrs) + l_nameSize + l_addrSize + l_dataSize); struct ifaddrs *l_entry = malloc(sizeof(struct ifaddrs) + l_nameSize + l_addrSize + l_dataSize);
memset(l_entry, 0, sizeof(struct ifaddrs)); memset(l_entry, 0, sizeof(struct ifaddrs));
l_entry->ifa_name = ""; l_entry->ifa_name = "";
char *l_name = ((char *)l_entry) + sizeof(struct ifaddrs); char *l_name = ((char *)l_entry) + sizeof(struct ifaddrs);
char *l_addr = l_name + l_nameSize; char *l_addr = l_name + l_nameSize;
char *l_data = l_addr + l_addrSize; char *l_data = l_addr + l_addrSize;
l_entry->ifa_flags = l_info->ifi_flags; l_entry->ifa_flags = l_info->ifi_flags;
l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg)); l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg));
for(l_rta = (struct rtattr *)(((char *)l_info) + NLMSG_ALIGN(sizeof(struct ifinfomsg))); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) for(l_rta = (struct rtattr *)(((char *)l_info) + NLMSG_ALIGN(sizeof(struct ifinfomsg))); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize))
{ {
...@@ -353,7 +353,7 @@ static void interpretLink(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru ...@@ -353,7 +353,7 @@ static void interpretLink(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru
break; break;
} }
} }
addToEnd(p_resultList, l_entry); addToEnd(p_resultList, l_entry);
p_links[l_info->ifi_index - 1] = l_entry; p_links[l_info->ifi_index - 1] = l_entry;
} }
...@@ -364,9 +364,9 @@ static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru ...@@ -364,9 +364,9 @@ static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru
size_t l_nameSize = 0; size_t l_nameSize = 0;
size_t l_addrSize = 0; size_t l_addrSize = 0;
int l_addedNetmask = 0; int l_addedNetmask = 0;
size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg)); size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg));
struct rtattr *l_rta; struct rtattr *l_rta;
for(l_rta = (struct rtattr *)(((char *)l_info) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) for(l_rta = (struct rtattr *)(((char *)l_info) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize))
...@@ -376,7 +376,7 @@ static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru ...@@ -376,7 +376,7 @@ static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru
{ {
continue; continue;
} }
switch(l_rta->rta_type) switch(l_rta->rta_type)
{ {
case IFA_ADDRESS: case IFA_ADDRESS:
...@@ -396,16 +396,16 @@ static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru ...@@ -396,16 +396,16 @@ static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru
break; break;
} }
} }
struct ifaddrs *l_entry = malloc(sizeof(struct ifaddrs) + l_nameSize + l_addrSize); struct ifaddrs *l_entry = malloc(sizeof(struct ifaddrs) + l_nameSize + l_addrSize);
memset(l_entry, 0, sizeof(struct ifaddrs)); memset(l_entry, 0, sizeof(struct ifaddrs));
l_entry->ifa_name = p_links[l_info->ifa_index - 1]->ifa_name; l_entry->ifa_name = p_links[l_info->ifa_index - 1]->ifa_name;
char *l_name = ((char *)l_entry) + sizeof(struct ifaddrs); char *l_name = ((char *)l_entry) + sizeof(struct ifaddrs);
char *l_addr = l_name + l_nameSize; char *l_addr = l_name + l_nameSize;
l_entry->ifa_flags = l_info->ifa_flags | p_links[l_info->ifa_index - 1]->ifa_flags; l_entry->ifa_flags = l_info->ifa_flags | p_links[l_info->ifa_index - 1]->ifa_flags;
l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg)); l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg));
for(l_rta = (struct rtattr *)(((char *)l_info) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) for(l_rta = (struct rtattr *)(((char *)l_info) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize))
{ {
...@@ -426,7 +426,7 @@ static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru ...@@ -426,7 +426,7 @@ static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru
((struct sockaddr_in6 *)l_addr)->sin6_scope_id = l_info->ifa_index; ((struct sockaddr_in6 *)l_addr)->sin6_scope_id = l_info->ifa_index;
} }
} }
if(l_rta->rta_type == IFA_ADDRESS) if(l_rta->rta_type == IFA_ADDRESS)
{ // apparently in a point-to-point network IFA_ADDRESS contains the dest address and IFA_LOCAL contains the local address { // apparently in a point-to-point network IFA_ADDRESS contains the dest address and IFA_LOCAL contains the local address
if(l_entry->ifa_addr) if(l_entry->ifa_addr)
...@@ -462,7 +462,7 @@ static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru ...@@ -462,7 +462,7 @@ static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru
break; break;
} }
} }
if(l_entry->ifa_addr && (l_entry->ifa_addr->sa_family == AF_INET || l_entry->ifa_addr->sa_family == AF_INET6)) if(l_entry->ifa_addr && (l_entry->ifa_addr->sa_family == AF_INET || l_entry->ifa_addr->sa_family == AF_INET6))
{ {
unsigned l_maxPrefix = (l_entry->ifa_addr->sa_family == AF_INET ? 32 : 128); unsigned l_maxPrefix = (l_entry->ifa_addr->sa_family == AF_INET ? 32 : 128);
...@@ -474,11 +474,11 @@ static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru ...@@ -474,11 +474,11 @@ static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, stru
l_mask[i] = 0xff; l_mask[i] = 0xff;
} }
l_mask[i] = 0xff << (8 - (l_prefix % 8)); l_mask[i] = 0xff << (8 - (l_prefix % 8));
makeSockaddr(l_entry->ifa_addr->sa_family, (struct sockaddr *)l_addr, l_mask, l_maxPrefix / 8); makeSockaddr(l_entry->ifa_addr->sa_family, (struct sockaddr *)l_addr, l_mask, l_maxPrefix / 8);
l_entry->ifa_netmask = (struct sockaddr *)l_addr; l_entry->ifa_netmask = (struct sockaddr *)l_addr;
} }
addToEnd(p_resultList, l_entry); addToEnd(p_resultList, l_entry);
} }
...@@ -495,12 +495,12 @@ static void interpret(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs * ...@@ -495,12 +495,12 @@ static void interpret(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs *
{ {
continue; continue;
} }
if(l_hdr->nlmsg_type == NLMSG_DONE) if(l_hdr->nlmsg_type == NLMSG_DONE)
{ {
break; break;
} }
if(l_hdr->nlmsg_type == RTM_NEWLINK) if(l_hdr->nlmsg_type == RTM_NEWLINK)
{ {
interpretLink(l_hdr, p_links, p_resultList); interpretLink(l_hdr, p_links, p_resultList);
...@@ -527,19 +527,19 @@ static unsigned countLinks(int p_socket, NetlinkList *p_netlinkList) ...@@ -527,19 +527,19 @@ static unsigned countLinks(int p_socket, NetlinkList *p_netlinkList)
{ {
continue; continue;
} }
if(l_hdr->nlmsg_type == NLMSG_DONE) if(l_hdr->nlmsg_type == NLMSG_DONE)
{ {
break; break;
} }
if(l_hdr->nlmsg_type == RTM_NEWLINK) if(l_hdr->nlmsg_type == RTM_NEWLINK)
{ {
++l_links; ++l_links;
} }
} }
} }
return l_links; return l_links;
} }
...@@ -550,20 +550,20 @@ int getifaddrs(struct ifaddrs **ifap) ...@@ -550,20 +550,20 @@ int getifaddrs(struct ifaddrs **ifap)
return -1; return -1;
} }
*ifap = NULL; *ifap = NULL;
int l_socket = netlink_socket(); int l_socket = netlink_socket();
if(l_socket < 0) if(l_socket < 0)
{ {
return -1; return -1;
} }
NetlinkList *l_linkResults = getResultList(l_socket, RTM_GETLINK); NetlinkList *l_linkResults = getResultList(l_socket, RTM_GETLINK);
if(!l_linkResults) if(!l_linkResults)
{ {
close(l_socket); close(l_socket);
return -1; return -1;
} }
NetlinkList *l_addrResults = getResultList(l_socket, RTM_GETADDR); NetlinkList *l_addrResults = getResultList(l_socket, RTM_GETADDR);
if(!l_addrResults) if(!l_addrResults)
{ {
...@@ -571,11 +571,11 @@ int getifaddrs(struct ifaddrs **ifap) ...@@ -571,11 +571,11 @@ int getifaddrs(struct ifaddrs **ifap)
freeResultList(l_linkResults); freeResultList(l_linkResults);
return -1; return -1;
} }
unsigned l_numLinks = countLinks(l_socket, l_linkResults) + countLinks(l_socket, l_addrResults); unsigned l_numLinks = countLinks(l_socket, l_linkResults) + countLinks(l_socket, l_addrResults);
struct ifaddrs *l_links[l_numLinks]; struct ifaddrs *l_links[l_numLinks];
memset(l_links, 0, l_numLinks * sizeof(struct ifaddrs *)); memset(l_links, 0, l_numLinks * sizeof(struct ifaddrs *));
interpret(l_socket, l_linkResults, l_links, ifap); interpret(l_socket, l_linkResults, l_links, ifap);
interpret(l_socket, l_addrResults, l_links, ifap); interpret(l_socket, l_addrResults, l_links, ifap);
......
...@@ -630,7 +630,7 @@ static char *record_visited(char *opts, char *all_subsystems) ...@@ -630,7 +630,7 @@ static char *record_visited(char *opts, char *all_subsystems)
return visited; return visited;
} }
static char *get_all_subsystems(void) static char *get_all_subsystems(void)
{ {
FILE *f; FILE *f;
......
...@@ -37,7 +37,7 @@ char** ...@@ -37,7 +37,7 @@ char**
convert_tuple_to_char_pointer_array(PyObject *argv) { convert_tuple_to_char_pointer_array(PyObject *argv) {
int argc; int argc;
int i, j; int i, j;
/* not a list or tuple */ /* not a list or tuple */
if (!PyList_Check(argv) && !PyTuple_Check(argv)) { if (!PyList_Check(argv) && !PyTuple_Check(argv)) {
PyErr_SetString(PyExc_TypeError, "Expected list or tuple."); PyErr_SetString(PyExc_TypeError, "Expected list or tuple.");
...@@ -707,7 +707,7 @@ static int lxc_attach_python_exec(void* _payload) ...@@ -707,7 +707,7 @@ static int lxc_attach_python_exec(void* _payload)
{ {
struct lxc_attach_python_payload *payload = (struct lxc_attach_python_payload *)_payload; struct lxc_attach_python_payload *payload = (struct lxc_attach_python_payload *)_payload;
PyObject *result = PyObject_CallFunctionObjArgs(payload->fn, payload->arg, NULL); PyObject *result = PyObject_CallFunctionObjArgs(payload->fn, payload->arg, NULL);
if (!result) { if (!result) {
PyErr_Print(); PyErr_Print();
return -1; return -1;
...@@ -741,7 +741,7 @@ static lxc_attach_options_t *lxc_attach_parse_options(PyObject *kwds) ...@@ -741,7 +741,7 @@ static lxc_attach_options_t *lxc_attach_parse_options(PyObject *kwds)
} }
memcpy(options, &default_options, sizeof(*options)); memcpy(options, &default_options, sizeof(*options));
/* we need some dummy variables because we can't be sure /* we need some dummy variables because we can't be sure
* the data types match completely */ * the data types match completely */
temp_uid = -1; temp_uid = -1;
temp_gid = -1; temp_gid = -1;
......
...@@ -428,7 +428,7 @@ def list_containers(as_object=False, config_path=None): ...@@ -428,7 +428,7 @@ def list_containers(as_object=False, config_path=None):
def attach_run_command(cmd): def attach_run_command(cmd):
""" """
Run a command when attaching Run a command when attaching
Please do not call directly, this will execvp the command. Please do not call directly, this will execvp the command.
This is to be used in conjunction with the attach method This is to be used in conjunction with the attach method
of a container. of a container.
...@@ -443,7 +443,7 @@ def attach_run_command(cmd): ...@@ -443,7 +443,7 @@ def attach_run_command(cmd):
def attach_run_shell(): def attach_run_shell():
""" """
Run a shell when attaching Run a shell when attaching
Please do not call directly, this will execvp the shell. Please do not call directly, this will execvp the shell.
This is to be used in conjunction with the attach method This is to be used in conjunction with the attach method
of a container. of a container.
......
...@@ -290,12 +290,12 @@ create_main() { ...@@ -290,12 +290,12 @@ create_main() {
if [ -b "$rootfs_d/dev/random" ]; then if [ -b "$rootfs_d/dev/random" ]; then
rm -f "$rootfs_d/dev/random" && rm -f "$rootfs_d/dev/random" &&
mknod --mode=666 "$rootfs_d/dev/random" c 1 8 || mknod --mode=666 "$rootfs_d/dev/random" c 1 8 ||
{ error "failed to fix /dev/random"; return 1; } { error "failed to fix /dev/random"; return 1; }
fi fi
if [ -b "$rootfs_d/dev/urandom" ]; then if [ -b "$rootfs_d/dev/urandom" ]; then
rm -f "$rootfs_d/dev/urandom" && rm -f "$rootfs_d/dev/urandom" &&
mknod --mode=666 "$rootfs_d/dev/urandom" c 1 9 || mknod --mode=666 "$rootfs_d/dev/urandom" c 1 9 ||
{ error "failed to fix /dev/urandom"; return 1; } { error "failed to fix /dev/urandom"; return 1; }
fi fi
if [ "$version" = "0.3.2~pre1" ]; then if [ "$version" = "0.3.2~pre1" ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment