]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Fix indentation
authorStéphane Graber <stgraber@ubuntu.com>
Mon, 21 Sep 2015 20:25:47 +0000 (16:25 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 21 Sep 2015 20:25:47 +0000 (16:25 -0400)
I've noticed that a bunch of the code we've included over the past few
weeks has been using 8-spaces rather than tabs, making it all very hard
to read depending on your tabstop setting.

This commit attempts to revert all of that back to proper tabs and fix a
few more cases I've noticed here and there.

No functional changes are included in this commit.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
19 files changed:
src/lxc/caps.c
src/lxc/caps.h
src/lxc/cgmanager.c
src/lxc/confile.c
src/lxc/genl.c
src/lxc/genl.h
src/lxc/list.h
src/lxc/lxc_attach.c
src/lxc/lxc_init.c
src/lxc/lxc_start.c
src/lxc/lxc_unshare.c
src/lxc/lxccontainer.c
src/lxc/lxccontainer.h
src/lxc/nl.c
src/lxc/nl.h
src/lxc/start.c
src/python-lxc/lxc.c
src/tests/concurrent.c
src/tests/reboot.c

index 9f3e96cfe9da85ee18955591e0029d22db7a5498..9712e11d20a6d2c81ead691a085ad64dadbae82c 100644 (file)
@@ -71,7 +71,7 @@ int lxc_caps_down(void)
 
 out:
        cap_free(caps);
-        return 0;
+       return 0;
 }
 
 int lxc_caps_up(void)
@@ -121,7 +121,7 @@ int lxc_caps_up(void)
 
 out:
        cap_free(caps);
-        return 0;
+       return 0;
 }
 
 int lxc_caps_init(void)
index ac508e321ed7fe766e2fdb1ab1032b90f6371114..f39fec65a30e0ff0479ad3e586528e9fff2a5821 100644 (file)
@@ -33,17 +33,17 @@ extern int lxc_caps_init(void);
 extern int lxc_caps_last_cap(void);
 #else
 static inline int lxc_caps_down(void) {
-        return 0;
+       return 0;
 }
 static inline int lxc_caps_up(void) {
-        return 0;
+       return 0;
 }
 static inline int lxc_caps_init(void) {
-        return 0;
+       return 0;
 }
 
 static inline int lxc_caps_last_cap(void) {
-        return 0;
+       return 0;
 }
 #endif
 
index c143beab95b403aa7a66e5c55c641b10da4c96e6..8386d83abd0015c17ac771ed85bfde9874ffc471 100644 (file)
@@ -122,13 +122,13 @@ static void cull_user_controllers(void);
 
 static void cgm_dbus_disconnect(void)
 {
-       if (cgroup_manager) {
-              dbus_connection_flush(cgroup_manager->connection);
-              dbus_connection_close(cgroup_manager->connection);
-               nih_free(cgroup_manager);
-       }
-       cgroup_manager = NULL;
-       cgm_unlock();
+       if (cgroup_manager) {
+               dbus_connection_flush(cgroup_manager->connection);
+               dbus_connection_close(cgroup_manager->connection);
+               nih_free(cgroup_manager);
+       }
+       cgroup_manager = NULL;
+       cgm_unlock();
 }
 
 #define CGMANAGER_DBUS_SOCK "unix:path=/sys/fs/cgroup/cgmanager/sock"
index 5f8540e300356a016f5caad9d187c08017940ad8..670d95740077af0f1fbed21d86167a4b96825624 100644 (file)
@@ -1157,10 +1157,10 @@ static int config_group(const char *key, const char *value,
        /* in case several groups are specified in a single line
         * split these groups in a single element for the list */
        for (groupptr = groups;;groupptr = NULL) {
-                token = strtok_r(groupptr, " \t", &sptr);
-                if (!token) {
+               token = strtok_r(groupptr, " \t", &sptr);
+               if (!token) {
                        ret = 0;
-                        break;
+                       break;
                }
 
                grouplist = malloc(sizeof(*grouplist));
@@ -1177,7 +1177,7 @@ static int config_group(const char *key, const char *value,
                }
 
                lxc_list_add_tail(&lxc_conf->groups, grouplist);
-        }
+       }
 
        free(groups);
 
@@ -1552,10 +1552,10 @@ static int config_mount_auto(const char *key, const char *value,
        }
 
        for (autoptr = autos; ; autoptr = NULL) {
-                token = strtok_r(autoptr, " \t", &sptr);
-                if (!token) {
+               token = strtok_r(autoptr, " \t", &sptr);
+               if (!token) {
                        ret = 0;
-                        break;
+                       break;
                }
 
                for (i = 0; allowed_auto_mounts[i].token; i++) {
@@ -1570,7 +1570,7 @@ static int config_mount_auto(const char *key, const char *value,
 
                lxc_conf->auto_mounts &= ~allowed_auto_mounts[i].mask;
                lxc_conf->auto_mounts |= allowed_auto_mounts[i].flag;
-        }
+       }
 
        free(autos);
 
@@ -1621,10 +1621,10 @@ static int config_cap_keep(const char *key, const char *value,
        /* in case several capability keep is specified in a single line
         * split these caps in a single element for the list */
        for (keepptr = keepcaps;;keepptr = NULL) {
-                token = strtok_r(keepptr, " \t", &sptr);
-                if (!token) {
+               token = strtok_r(keepptr, " \t", &sptr);
+               if (!token) {
                        ret = 0;
-                        break;
+                       break;
                }
 
                if (!strcmp(token, "none"))
@@ -1644,7 +1644,7 @@ static int config_cap_keep(const char *key, const char *value,
                }
 
                lxc_list_add_tail(&lxc_conf->keepcaps, keeplist);
-        }
+       }
 
        free(keepcaps);
 
@@ -1670,10 +1670,10 @@ static int config_cap_drop(const char *key, const char *value,
        /* in case several capability drop is specified in a single line
         * split these caps in a single element for the list */
        for (dropptr = dropcaps;;dropptr = NULL) {
-                token = strtok_r(dropptr, " \t", &sptr);
-                if (!token) {
+               token = strtok_r(dropptr, " \t", &sptr);
+               if (!token) {
                        ret = 0;
-                        break;
+                       break;
                }
 
                droplist = malloc(sizeof(*droplist));
@@ -1690,7 +1690,7 @@ static int config_cap_drop(const char *key, const char *value,
                }
 
                lxc_list_add_tail(&lxc_conf->caps, droplist);
-        }
+       }
 
        free(dropcaps);
 
@@ -2047,7 +2047,7 @@ int lxc_fill_elevated_privileges(char *flaglist, int *flags)
                /* for the sake of backward compatibility, drop all privileges
                   if none is specified */
                for (i = 0; all_privs[i].token; i++) {
-                       *flags |= all_privs[i].flag;
+                       *flags |= all_privs[i].flag;
                }
                return 0;
        }
index 64177648cdd9d8532b6256ced1f748976638bebc..b5a582e8ae0c5f783632cb404279b5b710ef058f 100644 (file)
@@ -53,10 +53,10 @@ static int genetlink_resolve_family(const char *family)
 
        request->nlmsghdr.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
        request->nlmsghdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
-        request->nlmsghdr.nlmsg_type = GENL_ID_CTRL;
+       request->nlmsghdr.nlmsg_type = GENL_ID_CTRL;
 
        genlmsghdr = NLMSG_DATA(&request->nlmsghdr);
-        genlmsghdr->cmd = CTRL_CMD_GETFAMILY;
+       genlmsghdr->cmd = CTRL_CMD_GETFAMILY;
 
        ret = netlink_open(&handler, NETLINK_GENERIC);
        if (ret)
index 30806186ff6904059933ff499ef46e9e26b90b5d..a83b7a7a9fc63401c9986c737646cc038e2d6eca 100644 (file)
@@ -59,7 +59,7 @@ struct genlmsg {
 
 static inline int genetlink_len(const struct genlmsg *genlmsg)
 {
-        return ((genlmsg->nlmsghdr.nlmsg_len) - GENL_HDRLEN - NLMSG_HDRLEN);
+       return ((genlmsg->nlmsghdr.nlmsg_len) - GENL_HDRLEN - NLMSG_HDRLEN);
 }
 
 /*
index f16af54f6052d2c21bfea0e9aa671dce96305787..2d8a2a84da51bac3bce23061473334ef227fb310 100644 (file)
@@ -72,10 +72,10 @@ static inline void __lxc_list_add(struct lxc_list *new,
                                  struct lxc_list *prev,
                                  struct lxc_list *next)
 {
-        next->prev = new;
-        new->next = next;
-        new->prev = prev;
-        prev->next = new;
+       next->prev = new;
+       new->next = next;
+       new->prev = prev;
+       prev->next = new;
 }
 
 static inline void lxc_list_add(struct lxc_list *head, struct lxc_list *list)
index 94f0f7a142cddd5fe0fa67e9dbb7aa985a58adc2..1c2434982d38688dbd5114818e645be78466eaae 100644 (file)
@@ -113,12 +113,12 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
                /* -s implies -e */
                lxc_fill_elevated_privileges(NULL, &elevated_privileges);
                break;
-        case 500: /* clear-env */
-                env_policy = LXC_ATTACH_CLEAR_ENV;
-                break;
-        case 501: /* keep-env */
-                env_policy = LXC_ATTACH_KEEP_ENV;
-                break;
+       case 500: /* clear-env */
+               env_policy = LXC_ATTACH_CLEAR_ENV;
+               break;
+       case 501: /* keep-env */
+               env_policy = LXC_ATTACH_KEEP_ENV;
+               break;
        case 502: /* keep-var */
                ret = add_to_simple_array(&extra_keep, &extra_keep_size, arg);
                if (ret < 0) {
index f4b120db0f299cb90d91cf3b707e71065d4d60e8..5dd29afbefeee5c1020598b4c37d3e08a79acf6c 100644 (file)
@@ -117,7 +117,7 @@ int main(int argc, char *argv[])
 
        aargv = &argv[optind];
 
-        /*
+       /*
         * mask all the signals so we are safe to install a
         * signal handler and to fork
         */
index ec6ee219ccd99158737979330aca00aad404a801..6b942acd1888326b18202a6f3309b2750dfb2f53 100644 (file)
@@ -190,7 +190,7 @@ Options :\n\
   -L, --console-log=FILE Log container console output to FILE\n\
   -C, --close-all-fds    If any fds are inherited, close them\n\
                          If not specified, exit with failure instead\n\
-                        Note: --daemon implies --close-all-fds\n\
+                         Note: --daemon implies --close-all-fds\n\
   -s, --define KEY=VAL   Assign VAL to configuration variable KEY\n\
       --share-[net|ipc|uts]=NAME Share a namespace with another container or pid\n\
 ",
index 59a231e578201a625573fbbafa35fad0174adc74..e629525c674ef608e36d92dc5c3d4335bd05ad28 100644 (file)
@@ -115,8 +115,8 @@ struct start_arg {
        int *flags;
        uid_t *uid;
        bool setuid;
-        int want_default_mounts;
-        const char *want_hostname;
+       int want_default_mounts;
+       const char *want_hostname;
 };
 
 static int do_start(void *arg)
index dd891dc95d6274dce5216f42d1f57a196952b118..42e23e736ee206d7230902f8689dcaab3608aa77 100644 (file)
@@ -2049,49 +2049,49 @@ static bool mod_rdep(struct lxc_container *c0, struct lxc_container *c, bool inc
                                goto out;
                        }
                } else if (!inc) {
-                        if ((fd = open(path, O_RDWR | O_CLOEXEC)) < 0)
-                                goto out;
-
-                        if (fstat(fd, &fbuf) < 0) {
-                                close(fd);
-                                goto out;
-                        }
-
-                        if (fbuf.st_size != 0) {
-                                /* write terminating \0-byte to file */
-                                if (pwrite(fd, "", 1, fbuf.st_size) <= 0) {
-                                        close(fd);
-                                        goto out;
-                                }
-
-                                buf = mmap(NULL, fbuf.st_size + 1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-                                if (buf == MAP_FAILED) {
-                                        SYSERROR("Failed to create mapping %s", path);
-                                        close(fd);
-                                        goto out;
-                                }
-
-                                len = strlen(newpath);
-                                while ((del = strstr((char *)buf, newpath))) {
-                                        memmove(del, del + len, strlen(del) - len + 1);
-                                        bytes += len;
-                                }
-
-                                munmap(buf, fbuf.st_size + 1);
-                                if (ftruncate(fd, fbuf.st_size - bytes) < 0) {
-                                        SYSERROR("Failed to truncate file %s", path);
-                                        close(fd);
-                                        goto out;
-                                }
-                        }
-                        close(fd);
-                }
+                       if ((fd = open(path, O_RDWR | O_CLOEXEC)) < 0)
+                               goto out;
+
+                       if (fstat(fd, &fbuf) < 0) {
+                               close(fd);
+                               goto out;
+                       }
+
+                       if (fbuf.st_size != 0) {
+                               /* write terminating \0-byte to file */
+                               if (pwrite(fd, "", 1, fbuf.st_size) <= 0) {
+                                       close(fd);
+                                       goto out;
+                               }
+
+                               buf = mmap(NULL, fbuf.st_size + 1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+                               if (buf == MAP_FAILED) {
+                                       SYSERROR("Failed to create mapping %s", path);
+                                       close(fd);
+                                       goto out;
+                               }
+
+                               len = strlen(newpath);
+                               while ((del = strstr((char *)buf, newpath))) {
+                                       memmove(del, del + len, strlen(del) - len + 1);
+                                       bytes += len;
+                               }
+
+                               munmap(buf, fbuf.st_size + 1);
+                               if (ftruncate(fd, fbuf.st_size - bytes) < 0) {
+                                       SYSERROR("Failed to truncate file %s", path);
+                                       close(fd);
+                                       goto out;
+                               }
+                       }
+                       close(fd);
+               }
 
                /* If the lxc-snapshot file is empty, remove it. */
                if (stat(path, &fbuf) < 0)
                        goto out;
-                if (!fbuf.st_size) {
-                        remove(path);
+               if (!fbuf.st_size) {
+                       remove(path);
                }
        }
 
@@ -2212,12 +2212,12 @@ static bool has_snapshots(struct lxc_container *c)
 }
 
 static bool do_destroy_container(struct lxc_conf *conf) {
-        if (am_unpriv()) {
-                if (userns_exec_1(conf, bdev_destroy_wrapper, conf) < 0)
-                        return false;
-                return true;
-        }
-        return bdev_destroy(conf);
+       if (am_unpriv()) {
+               if (userns_exec_1(conf, bdev_destroy_wrapper, conf) < 0)
+                       return false;
+               return true;
+       }
+       return bdev_destroy(conf);
 }
 
 static int lxc_rmdir_onedev_wrapper(void *data)
@@ -2281,13 +2281,13 @@ static bool container_destroy(struct lxc_container *c)
                }
        }
 
-        if (conf && conf->rootfs.path && conf->rootfs.mount) {
-                if (!do_destroy_container(conf)) {
-                        ERROR("Error destroying rootfs for %s", c->name);
-                        goto out;
-                }
-                INFO("Destroyed rootfs for %s", c->name);
-        }
+       if (conf && conf->rootfs.path && conf->rootfs.mount) {
+               if (!do_destroy_container(conf)) {
+                       ERROR("Error destroying rootfs for %s", c->name);
+                       goto out;
+               }
+               INFO("Destroyed rootfs for %s", c->name);
+       }
 
        mod_all_rdeps(c, false);
 
@@ -2302,7 +2302,7 @@ static bool container_destroy(struct lxc_container *c)
                ERROR("Error destroying container directory for %s", c->name);
                goto out;
        }
-        INFO("Destroyed directory for %s", c->name);
+       INFO("Destroyed directory for %s", c->name);
 
        bret = true;
 
@@ -2889,7 +2889,7 @@ static int create_file_dirname(char *path, struct lxc_conf *conf)
        if (!p)
                return -1;
        *p = '\0';
-        ret = do_create_container_dir(path, conf);
+       ret = do_create_container_dir(path, conf);
        *p = '/';
        return ret;
 }
index d60e19af1488f659436a520621d073b3aebde5ff..d8b20ecd7914616a1088dcdd3b00ac44ed466b8b 100644 (file)
@@ -831,17 +831,17 @@ struct lxc_snapshot {
  * \brief Specifications for how to create a new backing store
  */
 struct bdev_specs {
-    char *fstype; /*!< Filesystem type */
-    uint64_t fssize;  /*!< Filesystem size in bytes */
-    struct {
-        char *zfsroot; /*!< ZFS root path */
-    } zfs;
-    struct {
-        char *vg; /*!< LVM Volume Group name */
-        char *lv; /*!< LVM Logical Volume name */
-        char *thinpool; /*!< LVM thin pool to use, if any */
-    } lvm;
-    char *dir; /*!< Directory path */
+       char *fstype; /*!< Filesystem type */
+       uint64_t fssize;  /*!< Filesystem size in bytes */
+       struct {
+               char *zfsroot; /*!< ZFS root path */
+       } zfs;
+       struct {
+               char *vg; /*!< LVM Volume Group name */
+               char *lv; /*!< LVM Logical Volume name */
+               char *thinpool; /*!< LVM thin pool to use, if any */
+       } lvm;
+       char *dir; /*!< Directory path */
 };
 
 /*!
index dd044f0f70737c592da1a0f76a3bd04ee1498e98..cfa5cdf2237482128f8d636ba8028c80a15df5c4 100644 (file)
@@ -74,7 +74,7 @@ extern int nla_put_buffer(struct nlmsg *nlmsg, int attr,
 
 extern int nla_put_string(struct nlmsg *nlmsg, int attr, const char *string)
 {
-        return nla_put(nlmsg, attr, string, strlen(string) + 1);
+       return nla_put(nlmsg, attr, string, strlen(string) + 1);
 }
 
 extern int nla_put_u32(struct nlmsg *nlmsg, int attr, int value)
@@ -173,23 +173,23 @@ extern void nlmsg_free(struct nlmsg *nlmsg)
 extern int netlink_rcv(struct nl_handler *handler, struct nlmsg *answer)
 {
        int ret;
-        struct sockaddr_nl nladdr;
-        struct iovec iov = {
-                .iov_base = answer->nlmsghdr,
-                .iov_len = answer->nlmsghdr->nlmsg_len,
-        };
+       struct sockaddr_nl nladdr;
+       struct iovec iov = {
+               .iov_base = answer->nlmsghdr,
+               .iov_len = answer->nlmsghdr->nlmsg_len,
+       };
        
        struct msghdr msg = {
-                .msg_name = &nladdr,
-                .msg_namelen = sizeof(nladdr),
-                .msg_iov = &iov,
-                .msg_iovlen = 1,
-        };
+               .msg_name = &nladdr,
+               .msg_namelen = sizeof(nladdr),
+               .msg_iov = &iov,
+               .msg_iovlen = 1,
+       };
        
-        memset(&nladdr, 0, sizeof(nladdr));
-        nladdr.nl_family = AF_NETLINK;
-        nladdr.nl_pid = 0;
-        nladdr.nl_groups = 0;
+       memset(&nladdr, 0, sizeof(nladdr));
+       nladdr.nl_family = AF_NETLINK;
+       nladdr.nl_pid = 0;
+       nladdr.nl_groups = 0;
 
 again:
        ret = recvmsg(handler->fd, &msg, 0);
@@ -211,23 +211,23 @@ again:
 
 extern int netlink_send(struct nl_handler *handler, struct nlmsg *nlmsg)
 {
-        struct sockaddr_nl nladdr;
-        struct iovec iov = {
-                .iov_base = nlmsg->nlmsghdr,
-                .iov_len = nlmsg->nlmsghdr->nlmsg_len,
-        };
+       struct sockaddr_nl nladdr;
+       struct iovec iov = {
+               .iov_base = nlmsg->nlmsghdr,
+               .iov_len = nlmsg->nlmsghdr->nlmsg_len,
+       };
        struct msghdr msg = {
-                .msg_name = &nladdr,
-                .msg_namelen = sizeof(nladdr),
-                .msg_iov = &iov,
-                .msg_iovlen = 1,
-        };
+               .msg_name = &nladdr,
+               .msg_namelen = sizeof(nladdr),
+               .msg_iov = &iov,
+               .msg_iovlen = 1,
+       };
        int ret;
        
-        memset(&nladdr, 0, sizeof(nladdr));
-        nladdr.nl_family = AF_NETLINK;
-        nladdr.nl_pid = 0;
-        nladdr.nl_groups = 0;
+       memset(&nladdr, 0, sizeof(nladdr));
+       nladdr.nl_family = AF_NETLINK;
+       nladdr.nl_pid = 0;
+       nladdr.nl_groups = 0;
 
        ret = sendmsg(handler->fd, &msg, 0);
        if (ret < 0)
@@ -263,45 +263,45 @@ extern int netlink_transaction(struct nl_handler *handler,
 extern int netlink_open(struct nl_handler *handler, int protocol)
 {
        socklen_t socklen;
-        int sndbuf = 32768;
-        int rcvbuf = 32768;
+       int sndbuf = 32768;
+       int rcvbuf = 32768;
 
-        memset(handler, 0, sizeof(*handler));
+       memset(handler, 0, sizeof(*handler));
 
-        handler->fd = socket(AF_NETLINK, SOCK_RAW, protocol);
-        if (handler->fd < 0)
-                return -errno;
+       handler->fd = socket(AF_NETLINK, SOCK_RAW, protocol);
+       if (handler->fd < 0)
+               return -errno;
 
-        if (setsockopt(handler->fd, SOL_SOCKET, SO_SNDBUF,
+       if (setsockopt(handler->fd, SOL_SOCKET, SO_SNDBUF,
                       &sndbuf, sizeof(sndbuf)) < 0)
-                return -errno;
+               return -errno;
 
-        if (setsockopt(handler->fd, SOL_SOCKET, SO_RCVBUF,
+       if (setsockopt(handler->fd, SOL_SOCKET, SO_RCVBUF,
                       &rcvbuf,sizeof(rcvbuf)) < 0)
-                return -errno;
+               return -errno;
 
-        memset(&handler->local, 0, sizeof(handler->local));
-        handler->local.nl_family = AF_NETLINK;
-        handler->local.nl_groups = 0;
+       memset(&handler->local, 0, sizeof(handler->local));
+       handler->local.nl_family = AF_NETLINK;
+       handler->local.nl_groups = 0;
 
-        if (bind(handler->fd, (struct sockaddr*)&handler->local,
+       if (bind(handler->fd, (struct sockaddr*)&handler->local,
                 sizeof(handler->local)) < 0)
-                return -errno;
+               return -errno;
 
-        socklen = sizeof(handler->local);
-        if (getsockname(handler->fd, (struct sockaddr*)&handler->local,
+       socklen = sizeof(handler->local);
+       if (getsockname(handler->fd, (struct sockaddr*)&handler->local,
                        &socklen) < 0)
-                return -errno;
+               return -errno;
 
-        if (socklen != sizeof(handler->local))
-                return -EINVAL;
+       if (socklen != sizeof(handler->local))
+               return -EINVAL;
 
-        if (handler->local.nl_family != AF_NETLINK)
-                return -EINVAL;
+       if (handler->local.nl_family != AF_NETLINK)
+               return -EINVAL;
 
        handler->seq = time(NULL);
 
-        return 0;
+       return 0;
 }
 
 extern int netlink_close(struct nl_handler *handler)
index f6f2fd0bf92d9afb7bdc8d15c9f7d551e28339bc..d347835fa589626e876fb04e2b0082c5d64636e6 100644 (file)
  * @peer: the peer address
  */
 struct nl_handler {
-        int fd;
+       int fd;
        int seq;
-        struct sockaddr_nl local;
-        struct sockaddr_nl peer;
+       struct sockaddr_nl local;
+       struct sockaddr_nl peer;
 };
 
 /*
index 4e977c52fd9e5d8a3adee7034f1c7e43e8334c79..0601333e28559bdc6b2728769fffbb148b0edb4c 100644 (file)
@@ -529,10 +529,10 @@ void lxc_abort(const char *name, struct lxc_handler *handler)
  */
 static int container_reboot_supported(void *arg)
 {
-        int *cmd = arg;
+       int *cmd = arg;
        int ret;
 
-        ret = reboot(*cmd);
+       ret = reboot(*cmd);
        if (ret == -1 && errno == EINVAL)
                return 1;
        return 0;
@@ -542,10 +542,10 @@ static int must_drop_cap_sys_boot(struct lxc_conf *conf)
 {
        FILE *f;
        int ret, cmd, v, flags;
-        long stack_size = 4096;
-        void *stack = alloca(stack_size);
-        int status;
-        pid_t pid;
+       long stack_size = 4096;
+       void *stack = alloca(stack_size);
+       int status;
+       pid_t pid;
 
        f = fopen("/proc/sys/kernel/ctrl-alt-del", "r");
        if (!f) {
@@ -645,7 +645,7 @@ static int do_start(void *data)
                return -1;
        }
 
-        /* This prctl must be before the synchro, so if the parent
+       /* This prctl must be before the synchro, so if the parent
         * dies before we set the parent death signal, we will detect
         * its death with the synchro right after, otherwise we have
         * a window where the parent can exit before we set the pdeath
@@ -1214,7 +1214,7 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
         * lxc-execute which simply exited.  In any case, treat
         * it as a 'halt'
         */
-        if (WIFSIGNALED(status)) {
+       if (WIFSIGNALED(status)) {
                switch(WTERMSIG(status)) {
                case SIGINT: /* halt */
                        DEBUG("Container halting");
@@ -1230,7 +1230,7 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
                        DEBUG("unknown exit status for init: %d", WTERMSIG(status));
                        break;
                }
-        }
+       }
 
        DEBUG("Pushing physical nics back to host namespace");
        lxc_rename_phys_nics_on_shutdown(netnsfd, handler->conf);
@@ -1356,11 +1356,11 @@ static int lxc_rmdir_onedev_wrapper(void *data)
 }
 
 static bool do_destroy_container(struct lxc_conf *conf) {
-        if (am_unpriv()) {
-                if (userns_exec_1(conf, bdev_destroy_wrapper, conf) < 0)
-                        return false;
-                return true;
-        }
-        return bdev_destroy(conf);
+       if (am_unpriv()) {
+               if (userns_exec_1(conf, bdev_destroy_wrapper, conf) < 0)
+                       return false;
+               return true;
+       }
+       return bdev_destroy(conf);
 }
 
index d349287d52fcd5bf3ac9bed135e2709501e42758..b4698ad7081f110608e0f055ea712fd6c2d90080 100644 (file)
@@ -542,8 +542,7 @@ Container_attach_interface(Container *self, PyObject *args, PyObject *kwds)
         assert(dst_name != NULL);
     }
 
-    if (self->container->attach_interface(self->container, src_name,
-                                       dst_name)) {
+    if (self->container->attach_interface(self->container, src_name, dst_name)) {
         Py_XDECREF(py_src_name);
         Py_XDECREF(py_dst_name);
         Py_RETURN_TRUE;
index f32411afe6cc515b4702b1490bfbff50819c2c20..e6899adc5012e85260127cb3b4a4822fd3c23632 100644 (file)
@@ -85,8 +85,8 @@ static void do_function(void *arguments)
     }
 
     if (debug) {
-       c->set_config_item(c, "lxc.loglevel", "DEBUG");
-       c->set_config_item(c, "lxc.logfile", name);
+        c->set_config_item(c, "lxc.loglevel", "DEBUG");
+        c->set_config_item(c, "lxc.logfile", name);
     }
 
     if (strcmp(args->mode, "create") == 0) {
@@ -132,7 +132,7 @@ static void do_function(void *arguments)
 out:
     lxc_container_put(c);
     if (debug)
-       lxc_log_close();
+        lxc_log_close();
 }
 
 static void *concurrent(void *arguments)
@@ -171,9 +171,9 @@ int main(int argc, char *argv[]) {
         case 'q':
             quiet = 1;
             break;
-       case 'D':
-           debug = 1;
-           break;
+        case 'D':
+            debug = 1;
+            break;
         case 'm': {
             char *mode_tok, *tok, *saveptr = NULL;
 
@@ -187,10 +187,10 @@ int main(int argc, char *argv[]) {
                     exit(EXIT_FAILURE);
                 }
                 modes[i] = tok;
-           }
+            }
             modes[i] = NULL;
             break;
-       }
+        }
         default: /* '?' */
             usage();
             exit(EXIT_FAILURE);
index 5583332ac7a7c5884e4e0a47279e0ddfe37519cb..754984ef8039e4254d5f22e615f5eac52f968a66 100644 (file)
@@ -35,43 +35,43 @@ int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...);
 
 static int do_reboot(void *arg)
 {
-        int *cmd = arg;
+       int *cmd = arg;
 
-        if (reboot(*cmd))
-                printf("failed to reboot(%d): %m\n", *cmd);
+       if (reboot(*cmd))
+               printf("failed to reboot(%d): %m\n", *cmd);
        return 0;
 }
 
 static int test_reboot(int cmd, int sig)
 {
-        long stack_size = 4096;
-        void *stack = alloca(stack_size) + stack_size;
-        int status;
-        pid_t ret;
-
-        ret = clone(do_reboot, stack, CLONE_NEWPID | SIGCHLD, &cmd);
-        if (ret < 0) {
-                printf("failed to clone: %m\n");
-                return -1;
-        }
-
-        if (wait(&status) < 0) {
-                printf("unexpected wait error: %m\n");
-                return -1;
-        }
-
-        if (!WIFSIGNALED(status)) {
+       long stack_size = 4096;
+       void *stack = alloca(stack_size) + stack_size;
+       int status;
+       pid_t ret;
+
+       ret = clone(do_reboot, stack, CLONE_NEWPID | SIGCHLD, &cmd);
+       if (ret < 0) {
+               printf("failed to clone: %m\n");
+               return -1;
+       }
+
+       if (wait(&status) < 0) {
+               printf("unexpected wait error: %m\n");
+               return -1;
+       }
+
+       if (!WIFSIGNALED(status)) {
                if (sig != -1)
                        printf("child process exited but was not signaled\n");
-                return -1;
-        }
+               return -1;
+       }
 
-        if (WTERMSIG(status) != sig) {
-                printf("signal termination is not the one expected\n");
-                return -1;
-        }
+       if (WTERMSIG(status) != sig) {
+               printf("signal termination is not the one expected\n");
+               return -1;
+       }
 
-        return 0;
+       return 0;
 }
 
 static int have_reboot_patch(void)
@@ -95,46 +95,46 @@ static int have_reboot_patch(void)
 
 int main(int argc, char *argv[])
 {
-        int status;
+       int status;
 
        if (getuid() != 0) {
-                printf("Must run as root.\n");
-                return 1;
+               printf("Must run as root.\n");
+               return 1;
        }
 
        status = have_reboot_patch();
        if (status != 0) {
-                printf("Your kernel does not have the container reboot patch\n");
-                return 1;
+               printf("Your kernel does not have the container reboot patch\n");
+               return 1;
        }
 
-        status = test_reboot(LINUX_REBOOT_CMD_CAD_ON, -1);
-        if (status >= 0) {
-                printf("reboot(LINUX_REBOOT_CMD_CAD_ON) should have failed\n");
-                return 1;
-        }
-        printf("reboot(LINUX_REBOOT_CMD_CAD_ON) has failed as expected\n");
-
-        status = test_reboot(LINUX_REBOOT_CMD_RESTART, SIGHUP);
-        if (status < 0)
-                return 1;
-        printf("reboot(LINUX_REBOOT_CMD_RESTART) succeed\n");
-
-        status = test_reboot(LINUX_REBOOT_CMD_RESTART2, SIGHUP);
-        if (status < 0)
-                return 1;
-        printf("reboot(LINUX_REBOOT_CMD_RESTART2) succeed\n");
-
-        status = test_reboot(LINUX_REBOOT_CMD_HALT, SIGINT);
-        if (status < 0)
-                return 1;
-        printf("reboot(LINUX_REBOOT_CMD_HALT) succeed\n");
-
-        status = test_reboot(LINUX_REBOOT_CMD_POWER_OFF, SIGINT);
-        if (status < 0)
-                return 1;
-        printf("reboot(LINUX_REBOOT_CMD_POWERR_OFF) succeed\n");
-
-        printf("All tests passed\n");
-        return 0;
+       status = test_reboot(LINUX_REBOOT_CMD_CAD_ON, -1);
+       if (status >= 0) {
+               printf("reboot(LINUX_REBOOT_CMD_CAD_ON) should have failed\n");
+               return 1;
+       }
+       printf("reboot(LINUX_REBOOT_CMD_CAD_ON) has failed as expected\n");
+
+       status = test_reboot(LINUX_REBOOT_CMD_RESTART, SIGHUP);
+       if (status < 0)
+               return 1;
+       printf("reboot(LINUX_REBOOT_CMD_RESTART) succeed\n");
+
+       status = test_reboot(LINUX_REBOOT_CMD_RESTART2, SIGHUP);
+       if (status < 0)
+               return 1;
+       printf("reboot(LINUX_REBOOT_CMD_RESTART2) succeed\n");
+
+       status = test_reboot(LINUX_REBOOT_CMD_HALT, SIGINT);
+       if (status < 0)
+               return 1;
+       printf("reboot(LINUX_REBOOT_CMD_HALT) succeed\n");
+
+       status = test_reboot(LINUX_REBOOT_CMD_POWER_OFF, SIGINT);
+       if (status < 0)
+               return 1;
+       printf("reboot(LINUX_REBOOT_CMD_POWERR_OFF) succeed\n");
+
+       printf("All tests passed\n");
+       return 0;
 }