mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-09 03:35:20 +00:00
cgroup: change unfreeze_fromhandler to return bool
To be more consistent with other cgroup_ops methods, in the hopes of having less return-value-related mixups. Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
c476bdce46
commit
ecfcb3f00a
@ -570,7 +570,7 @@ static inline bool cgm_init(struct lxc_handler *handler)
|
|||||||
return collect_subsytems();
|
return collect_subsytems();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cgm_unfreeze_fromhandler(struct lxc_handler *handler)
|
static bool cgm_unfreeze_fromhandler(struct lxc_handler *handler)
|
||||||
{
|
{
|
||||||
char *cgroup_path = handler->cgroup_info->data;
|
char *cgroup_path = handler->cgroup_info->data;
|
||||||
|
|
||||||
@ -581,9 +581,9 @@ static int cgm_unfreeze_fromhandler(struct lxc_handler *handler)
|
|||||||
ERROR("call to cgmanager_set_value_sync failed: %s", nerr->message);
|
ERROR("call to cgmanager_set_value_sync failed: %s", nerr->message);
|
||||||
nih_free(nerr);
|
nih_free(nerr);
|
||||||
ERROR("Error unfreezing %s", cgroup_path);
|
ERROR("Error unfreezing %s", cgroup_path);
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool setup_limits(struct lxc_handler *h, bool do_devices)
|
static bool setup_limits(struct lxc_handler *h, bool do_devices)
|
||||||
|
@ -2279,7 +2279,7 @@ static char *cgfs_get_cgroup(struct lxc_handler *handler, const char *subsystem)
|
|||||||
return lxc_cgroup_get_hierarchy_path_handler(subsystem, handler);
|
return lxc_cgroup_get_hierarchy_path_handler(subsystem, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cgfs_unfreeze_fromhandler(struct lxc_handler *handler)
|
static bool cgfs_unfreeze_fromhandler(struct lxc_handler *handler)
|
||||||
{
|
{
|
||||||
char *cgabspath, *cgrelpath;
|
char *cgabspath, *cgrelpath;
|
||||||
int ret;
|
int ret;
|
||||||
@ -2287,11 +2287,11 @@ static int cgfs_unfreeze_fromhandler(struct lxc_handler *handler)
|
|||||||
cgrelpath = lxc_cgroup_get_hierarchy_path_handler("freezer", handler);
|
cgrelpath = lxc_cgroup_get_hierarchy_path_handler("freezer", handler);
|
||||||
cgabspath = lxc_cgroup_find_abs_path("freezer", cgrelpath, true, NULL);
|
cgabspath = lxc_cgroup_find_abs_path("freezer", cgrelpath, true, NULL);
|
||||||
if (!cgabspath)
|
if (!cgabspath)
|
||||||
return -1;
|
return false;
|
||||||
|
|
||||||
ret = do_cgroup_set(cgabspath, "freezer.state", "THAWED");
|
ret = do_cgroup_set(cgabspath, "freezer.state", "THAWED");
|
||||||
free(cgabspath);
|
free(cgabspath);
|
||||||
return ret;
|
return ret == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cgroupfs_setup_limits(struct lxc_handler *h, bool with_devices)
|
bool cgroupfs_setup_limits(struct lxc_handler *h, bool with_devices)
|
||||||
@ -2431,7 +2431,7 @@ int lxc_cgroup_get(const char *filename, char *value, size_t len, const char *na
|
|||||||
return active_cg_ops->get(filename, value, len, name, lxcpath);
|
return active_cg_ops->get(filename, value, len, name, lxcpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
int lxc_unfreeze_fromhandler(struct lxc_handler *handler)
|
bool lxc_unfreeze_fromhandler(struct lxc_handler *handler)
|
||||||
{
|
{
|
||||||
return active_cg_ops->unfreeze_fromhandler(handler);
|
return active_cg_ops->unfreeze_fromhandler(handler);
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ struct cgroup_ops {
|
|||||||
char *(*get_cgroup)(struct lxc_handler *handler, const char *subsystem);
|
char *(*get_cgroup)(struct lxc_handler *handler, const char *subsystem);
|
||||||
int (*set)(const char *filename, const char *value, const char *name, const char *lxcpath);
|
int (*set)(const char *filename, const char *value, const char *name, const char *lxcpath);
|
||||||
int (*get)(const char *filename, char *value, size_t len, const char *name, const char *lxcpath);
|
int (*get)(const char *filename, char *value, size_t len, const char *name, const char *lxcpath);
|
||||||
int (*unfreeze_fromhandler)(struct lxc_handler *handler);
|
bool (*unfreeze_fromhandler)(struct lxc_handler *handler);
|
||||||
bool (*setup_limits)(struct lxc_handler *handler, bool with_devices);
|
bool (*setup_limits)(struct lxc_handler *handler, bool with_devices);
|
||||||
bool (*chown)(struct lxc_handler *handler);
|
bool (*chown)(struct lxc_handler *handler);
|
||||||
bool (*attach)(const char *name, const char *lxcpath, pid_t pid);
|
bool (*attach)(const char *name, const char *lxcpath, pid_t pid);
|
||||||
@ -220,8 +220,8 @@ extern bool cgroup_create_legacy(struct lxc_handler *handler);
|
|||||||
extern char *cgroup_get_cgroup(struct lxc_handler *handler, const char *subsystem);
|
extern char *cgroup_get_cgroup(struct lxc_handler *handler, const char *subsystem);
|
||||||
extern bool lxc_cgroup_attach(const char *name, const char *lxcpath, pid_t pid);
|
extern bool lxc_cgroup_attach(const char *name, const char *lxcpath, pid_t pid);
|
||||||
extern bool lxc_setup_mount_cgroup(const char *root, struct lxc_cgroup_info *cgroup_info, int type);
|
extern bool lxc_setup_mount_cgroup(const char *root, struct lxc_cgroup_info *cgroup_info, int type);
|
||||||
|
extern bool lxc_unfreeze_fromhandler(struct lxc_handler *handler);
|
||||||
extern int lxc_cgroup_set(const char *filename, const char *value, const char *name, const char *lxcpath);
|
extern int lxc_cgroup_set(const char *filename, const char *value, const char *name, const char *lxcpath);
|
||||||
extern int lxc_cgroup_get(const char *filename, char *value, size_t len, const char *name, const char *lxcpath);
|
extern int lxc_cgroup_get(const char *filename, char *value, size_t len, const char *name, const char *lxcpath);
|
||||||
extern int lxc_unfreeze_fromhandler(struct lxc_handler *handler);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -583,7 +583,6 @@ static int lxc_cmd_stop_callback(int fd, struct lxc_cmd_req *req,
|
|||||||
struct lxc_handler *handler)
|
struct lxc_handler *handler)
|
||||||
{
|
{
|
||||||
struct lxc_cmd_rsp rsp;
|
struct lxc_cmd_rsp rsp;
|
||||||
int ret;
|
|
||||||
int stopsignal = SIGKILL;
|
int stopsignal = SIGKILL;
|
||||||
|
|
||||||
if (handler->conf->stopsignal)
|
if (handler->conf->stopsignal)
|
||||||
@ -591,11 +590,10 @@ static int lxc_cmd_stop_callback(int fd, struct lxc_cmd_req *req,
|
|||||||
memset(&rsp, 0, sizeof(rsp));
|
memset(&rsp, 0, sizeof(rsp));
|
||||||
rsp.ret = kill(handler->pid, stopsignal);
|
rsp.ret = kill(handler->pid, stopsignal);
|
||||||
if (!rsp.ret) {
|
if (!rsp.ret) {
|
||||||
ret = lxc_unfreeze_fromhandler(handler);
|
if (lxc_unfreeze_fromhandler(handler))
|
||||||
if (!ret)
|
|
||||||
return 0;
|
return 0;
|
||||||
ERROR("Failed to unfreeze %s:%s", handler->lxcpath, handler->name);
|
ERROR("Failed to unfreeze %s:%s", handler->lxcpath, handler->name);
|
||||||
rsp.ret = ret;
|
rsp.ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return lxc_cmd_rsp_send(fd, &rsp);
|
return lxc_cmd_rsp_send(fd, &rsp);
|
||||||
|
Loading…
Reference in New Issue
Block a user