Unverified Commit cd1372e2 by Stéphane Graber Committed by GitHub

Merge pull request #2864 from brauner/2019-02-18/rename_pointer_macros

tree-wide: s/steal_{fd,ptr}/move_{fd,ptr}/g
parents 005f822b 240fecd0
......@@ -1451,7 +1451,7 @@ __cgfsng_ops static inline bool cgfsng_payload_create(struct cgroup_ops *ops,
return false;
INFO("The container process uses \"%s\" as cgroup", container_cgroup);
ops->container_cgroup = steal_ptr(container_cgroup);
ops->container_cgroup = move_ptr(container_cgroup);
return true;
}
......
......@@ -245,7 +245,7 @@ static int lxc_cmd_send(const char *name, struct lxc_cmd_rr *cmd,
return -1;
if (cmd->req.datalen <= 0)
return steal_fd(client_fd);
return move_fd(client_fd);
errno = EMSGSIZE;
ret = lxc_send_nointr(client_fd, (void *)cmd->req.data,
......@@ -253,7 +253,7 @@ static int lxc_cmd_send(const char *name, struct lxc_cmd_rr *cmd,
if (ret < 0 || ret != (ssize_t)cmd->req.datalen)
return -1;
return steal_fd(client_fd);
return move_fd(client_fd);
}
/*
......@@ -304,7 +304,7 @@ static int lxc_cmd(const char *name, struct lxc_cmd_rr *cmd, int *stopped,
*stopped = 1;
if (stay_connected && ret > 0)
cmd->rsp.ret = steal_fd(client_fd);
cmd->rsp.ret = move_fd(client_fd);
return ret;
}
......@@ -866,7 +866,7 @@ int lxc_cmd_add_state_client(const char *name, const char *lxcpath,
return state;
}
*state_client_fd = steal_fd(clientfd);
*state_client_fd = move_fd(clientfd);
TRACE("Added state client %d to state client list", *state_client_fd);
return MAX_STATE;
}
......@@ -1184,7 +1184,7 @@ static int lxc_cmd_accept(int fd, uint32_t events, void *data,
return ret;
}
steal_fd(connection);
move_fd(connection);
return ret;
}
......@@ -1214,7 +1214,7 @@ int lxc_cmd_init(const char *name, const char *lxcpath, const char *suffix)
}
TRACE("Created abstract unix socket \"%s\"", &path[1]);
return steal_fd(fd);
return move_fd(fd);
}
int lxc_cmd_mainloop_add(const char *name, struct lxc_epoll_descr *descr,
......@@ -1229,6 +1229,6 @@ int lxc_cmd_mainloop_add(const char *name, struct lxc_epoll_descr *descr,
return ret;
}
steal_fd(fd);
move_fd(fd);
return ret;
}
......@@ -234,13 +234,13 @@ int lxc_make_tmpfile(char *template, bool rm)
return -1;
if (!rm)
return steal_fd(fd);
return move_fd(fd);
ret = unlink(template);
if (ret < 0)
return -1;
return steal_fd(fd);
return move_fd(fd);
}
bool is_fs_type(const struct statfs *fs, fs_type_magic magic_val)
......
......@@ -393,18 +393,18 @@ enum {
/* Maximum number of bytes sendfile() is able to send in one go. */
#define LXC_SENDFILE_MAX 0x7ffff000
#define steal_ptr(ptr) \
({ \
typeof(ptr) _ptr_ = (ptr); \
(ptr) = NULL; \
_ptr_; \
#define move_ptr(ptr) \
({ \
typeof(ptr) __internal_ptr__ = (ptr); \
(ptr) = NULL; \
__internal_ptr__; \
})
#define steal_fd(fd) \
({ \
int _fd_ = (fd); \
(fd) = -EBADF; \
_fd_; \
#define move_fd(fd) \
({ \
int __internal_fd__ = (fd); \
(fd) = -EBADF; \
__internal_fd__; \
})
#endif /* __LXC_MACRO_H */
......@@ -77,7 +77,7 @@ static int parse_argv(char ***argv)
if (ret <= 0)
return -1;
steal_ptr(cmdline);
move_ptr(cmdline);
return 0;
}
......
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