Commit 066ec066 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

crtools: remove unused variables (v3)

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7454ab1c
......@@ -866,8 +866,6 @@ err:
static int dump_task_core(struct core_entry *core, int fd_core)
{
int ret;
pr_info("Dumping header ... ");
core->header.version = HEADER_VERSION;
......@@ -1378,7 +1376,6 @@ static int dump_pstree(pid_t pid, const struct list_head *pstree_list)
{
const struct pstree_item *item;
struct pstree_entry e;
unsigned long i;
int ret = -1;
int pstree_fd;
......@@ -1653,7 +1650,7 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
{
LIST_HEAD(pstree_list);
struct pstree_item *item;
int i, ret = -1;
int ret = -1;
pr_info("========================================\n");
pr_info("Dumping process %s(pid: %d)\n", !opts->leader_only ? "group " : "", pid);
......
......@@ -268,7 +268,7 @@ static int prepare_sigactions(int pid)
rt_sigaction_t act, oact;
int fd_sigact;
struct sa_entry e;
int sig, i;
int sig;
int ret = -1;
fd_sigact = open_image_ro(CR_FD_SIGACT, pid);
......@@ -521,8 +521,6 @@ err:
static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
{
int status, pid;
if (siginfo->si_code & CLD_EXITED)
pr_err("%d exited, status=%d\n",
siginfo->si_pid, siginfo->si_status);
......@@ -656,7 +654,7 @@ static int restore_task_with_children(void *_arg)
static int restore_root_task(pid_t pid, struct cr_options *opts)
{
int ret, i;
int ret;
struct sigaction act, old_act;
struct pstree_item *init;
......@@ -957,8 +955,6 @@ static int sigreturn_restore(pid_t pid, struct list_head *tgt_vmas, int nr_vmas)
int fd_pages = -1;
int i;
int *fd_core_threads;
pr_info("Restore via sigreturn\n");
restore_code_len = 0;
......
......@@ -182,9 +182,6 @@ void show_pipes_data(int fd_pipes, struct cr_options *o)
pr_img_head(CR_FD_PIPES_DATA);
while (1) {
int ret;
off_t off;
ret = read_img_eof(fd_pipes, &e);
if (ret <= 0)
goto out;
......@@ -206,8 +203,6 @@ void show_pipes(int fd_pipes, struct cr_options *o)
pr_img_head(CR_FD_PIPES);
while (1) {
int ret;
ret = read_img_eof(fd_pipes, &e);
if (ret <= 0)
goto out;
......@@ -311,7 +306,7 @@ void show_pages(int fd_pages, struct cr_options *o)
} else {
while (1) {
struct page_entry e;
int i, j;
int i;
pr_msg("\t");
for (i = 0; i < DEF_PAGES_PER_LINE; i++) {
......@@ -483,8 +478,6 @@ void show_pstree(int fd_pstree, struct cr_options *o)
static void show_core_regs(int fd_core)
{
struct user_regs_entry regs;
struct desc_struct tls;
int i;
pr_msg("\n\t---[GP registers set]---\n");
......@@ -521,7 +514,6 @@ static inline char *task_state_str(int state)
static void show_core_rest(int fd_core)
{
struct task_core_entry tc;
int i;
lseek(fd_core, GET_FILE_OFF(struct core_entry, tc), SEEK_SET);
if (read_img(fd_core, &tc) < 0)
......
......@@ -114,7 +114,6 @@ int dump_eventfd(struct fd_parms *p, int lfd, const struct cr_fdset *set)
static int eventfd_open(struct file_desc *d)
{
struct eventfd_file_info *info;
size_t size;
int tmp;
info = container_of(d, struct eventfd_file_info, d);
......
......@@ -337,7 +337,6 @@ int collect_reg_files(void)
static int collect_fd(int pid, struct fdinfo_entry *e, struct rst_info *rst_info)
{
int i;
struct fdinfo_list_entry *l, *le = &fdinfo_list[nr_fdinfo_list];
struct file_desc *fdesc;
......@@ -376,7 +375,6 @@ static int collect_fd(int pid, struct fdinfo_entry *e, struct rst_info *rst_info
int prepare_fd_pid(int pid, struct rst_info *rst_info)
{
int fdinfo_fd, ret = 0;
u32 type = 0;
INIT_LIST_HEAD(&rst_info->fds);
INIT_LIST_HEAD(&rst_info->eventpoll);
......@@ -551,7 +549,7 @@ int send_fd_to_peer(int fd, struct fdinfo_list_entry *fle, int tsk)
static int open_fd(int pid, struct fdinfo_entry *fe, struct file_desc *d)
{
int tmp;
int serv, sock;
int sock;
struct fdinfo_list_entry *fle;
fle = file_master(d);
......@@ -602,7 +600,6 @@ static int open_fd(int pid, struct fdinfo_entry *fe, struct file_desc *d)
}
close(sock);
out:
return 0;
}
......@@ -634,7 +631,6 @@ static int receive_fd(int pid, struct fdinfo_entry *fe, struct file_desc *d)
static int open_fdinfo(int pid, struct fdinfo_entry *fe, int state)
{
u32 mag;
int ret = 0;
struct file_desc *fdesc;
......@@ -658,10 +654,9 @@ static int open_fdinfo(int pid, struct fdinfo_entry *fe, int state)
int prepare_fds(struct pstree_item *me)
{
u32 type = 0, ret;
u32 ret;
int state;
struct fdinfo_list_entry *fle;
int nr = 0;
pr_info("Opening fdinfo-s\n");
......
......@@ -226,7 +226,7 @@ static int restore_one_inotify(int inotify_fd, struct inotify_wd_entry *iwe)
{
char path[32];
int mntfd, ret = -1;
int i, wd, target;
int wd, target;
mntfd = open_mount(iwe->s_dev);
if (mntfd < 0) {
......@@ -277,7 +277,6 @@ static int open_inotify_fd(struct file_desc *d)
{
struct inotify_file_info *info;
struct inotify_wd_info *wd_info;
struct file_desc *p;
int tmp;
info = container_of(d, struct inotify_file_info, d);
......@@ -356,8 +355,6 @@ int collect_inotify(void)
goto err;
while (1) {
int idx;
mark = xmalloc(sizeof(*mark));
if (!mark)
goto err;
......
......@@ -141,7 +141,7 @@ static int dump_ipc_sem(int fd)
{
int i, maxid;
struct seminfo info;
int err, slot;
int slot;
maxid = semctl(0, 0, SEM_INFO, &info);
if (maxid < 0) {
......@@ -264,7 +264,7 @@ static int dump_ipc_msg(int fd)
{
int i, maxid;
struct msginfo info;
int err, slot;
int slot;
maxid = msgctl(0, MSG_INFO, (struct msqid_ds *)&info);
if (maxid < 0) {
......@@ -445,7 +445,7 @@ static int dump_ipc_data(const struct cr_fdset *fdset)
int dump_ipc_ns(int ns_pid, const struct cr_fdset *fdset)
{
int fd, ret;
int ret;
ret = switch_ns(ns_pid, CLONE_NEWIPC, "ipc");
if (ret < 0)
......@@ -648,9 +648,8 @@ static int prepare_ipc_sem(int pid)
return -1;
while (1) {
int ret, id;
int ret;
struct ipc_sem_entry entry;
struct semid_ds ds;
ret = read_img_eof(fd, &entry);
if (ret < 0)
......@@ -759,9 +758,8 @@ static int prepare_ipc_msg(int pid)
return -1;
while (1) {
int ret, id;
int ret;
struct ipc_msg_entry entry;
struct msqid_ds ds;
ret = read_img_eof(fd, &entry);
if (ret < 0) {
......@@ -852,7 +850,7 @@ static int prepare_ipc_shm(int pid)
return -1;
while (1) {
int ret, id;
int ret;
struct ipc_shm_entry shm;
ret = read_img_eof(fd, &shm);
......
......@@ -604,7 +604,6 @@ out:
int parasite_cure_seized(struct parasite_ctl *ctl)
{
parasite_status_t args = { };
int ret = 0;
if (ctl->parasite_ip) {
......
......@@ -32,8 +32,6 @@
static void *brk_start, *brk_end, *brk_tail;
static struct page_entry page;
static struct vma_entry vma;
static int logfd = -1;
static int tsock = -1;
......@@ -77,6 +75,7 @@ static void brk_free(unsigned long bytes)
brk_tail -= bytes;
}
#if 0
static const unsigned char hex[] = "0123456789abcdef";
static char *long2hex(unsigned long v)
{
......@@ -92,6 +91,7 @@ static char *long2hex(unsigned long v)
return buf;
}
#endif
static void sys_write_msg(const char *msg)
{
......@@ -331,9 +331,7 @@ static int dump_itimer(int which, int fd, parasite_status_t *st)
static int dump_itimers(parasite_status_t *st)
{
rt_sigaction_t act;
struct sa_entry e;
int fd, sig;
int fd;
int ret = -1;
fd = recv_fd(tsock);
......@@ -364,8 +362,6 @@ static int reset_blocked = 0;
static int dump_misc(struct parasite_dump_misc *args)
{
parasite_status_t *st = &args->status;
args->secbits = sys_prctl(PR_GET_SECUREBITS, 0, 0, 0, 0);
args->brk = sys_brk(0);
args->blocked = old_blocked;
......
......@@ -48,8 +48,6 @@ int collect_pipes(void)
return -1;
while (1) {
int len;
pi = xmalloc(sizeof(*pi));
ret = -1;
if (pi == NULL)
......@@ -290,7 +288,6 @@ static int open_pipe(struct file_desc *d)
close(sock);
out:
close(pfd[!(pi->pe.flags & O_WRONLY)]);
tmp = pfd[pi->pe.flags & O_WRONLY];
......
......@@ -16,11 +16,6 @@ void restorer_set_logfd(int fd)
c += 'a' - 10; \
} while (0)
static void write_char(char c)
{
sys_write(logfd, &c, 1);
}
void write_string(char *str)
{
int len = 0;
......@@ -43,7 +38,6 @@ void write_num(long num)
{
unsigned long d = 1000000000000000000;
unsigned int started = 0;
unsigned int minus = 0;
unsigned int c;
if (num < 0) {
......@@ -78,7 +72,6 @@ long vprint_num(char *buf, long num)
{
unsigned long d = 1000000000000000000;
unsigned int started = 0;
unsigned int minus = 0;
unsigned int i = 0;
unsigned int c;
......
......@@ -37,8 +37,6 @@ static struct task_entries *task_entries;
static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
{
int status, pid;
write_num(siginfo->si_pid);
if (siginfo->si_code & CLD_EXITED)
write_string(" exited, status=");
......@@ -294,7 +292,6 @@ static u64 restore_mapping(const struct vma_entry *vma_entry)
long __export_restore_task(struct task_restore_core_args *args)
{
long ret = -1;
struct task_entry *task_entry;
struct core_entry *core_entry;
struct vma_entry *vma_entry;
u64 va;
......
......@@ -23,8 +23,6 @@ void show_saved_shmems(void)
static int collect_shmem(int pid, struct vma_entry *vi)
{
int i;
struct shmem_info *entries = rst_shmems->entries;
int nr_shmems = rst_shmems->nr_shmems;
unsigned long size = vi->pgoff + vi->end - vi->start;
struct shmem_info *si;
......@@ -79,8 +77,6 @@ int prepare_shmem_pid(int pid)
{
int fd, ret = -1;
struct vma_entry vi;
struct task_core_entry tc;
struct image_header hdr;
fd = open_image_ro(CR_FD_VMAS, pid);
if (fd < 0) {
......@@ -108,14 +104,12 @@ int prepare_shmem_pid(int pid)
break;
}
out:
close(fd);
return ret;
}
static int shmem_wait_and_open(int pid, struct shmem_info *si)
{
unsigned long time = 1;
char path[128];
int ret;
......@@ -164,7 +158,6 @@ static int restore_shmem_content(void *addr, struct shmem_info *si)
int get_shmem_fd(int pid, struct vma_entry *vi)
{
struct shmem_info *si;
int sh_fd;
void *addr;
int f;
......@@ -278,7 +271,6 @@ int add_shmem_area(pid_t pid, struct vma_entry *vma)
int cr_dump_shmem(void)
{
int err, fd;
struct cr_fdset *cr_fdset = NULL;
unsigned char *map = NULL;
void *addr = NULL;
struct shmem_info_dump *si;
......
......@@ -33,8 +33,6 @@ int read_sk_queues(void)
return -1;
while (1) {
struct sk_packet_entry tmp;
pkt = xmalloc(sizeof(*pkt));
if (!pkt) {
pr_err("Failed to allocate packet header\n");
......
......@@ -96,7 +96,7 @@ err1:
static void tcp_unlock_one(struct inet_sk_desc *sk)
{
int ret, aux = 0;
int ret;
list_del(&sk->rlist);
......
......@@ -222,7 +222,7 @@ err:
static int unix_collect_one(const struct unix_diag_msg *m,
struct rtattr **tb)
{
struct unix_sk_desc *d, **h;
struct unix_sk_desc *d;
d = xzalloc(sizeof(*d));
if (!d)
......@@ -365,7 +365,6 @@ int unix_receive_one(struct nlmsghdr *h)
int fix_external_unix_sockets(void)
{
struct unix_sk_desc *sk;
int i, ret = -1;
pr_debug("Dumping external sockets\n");
......
......@@ -241,7 +241,6 @@ int collect_sockets(void)
{
int err = 0, tmp;
int nl;
int supp_type = 0;
struct {
struct nlmsghdr hdr;
union {
......@@ -327,7 +326,7 @@ int collect_sockets(void)
tmp = collect_sockets_nl(nl, &req, sizeof(req), inet6_udplite_receive_one);
if (tmp)
err = tmp;
out:
close(nl);
return err;
}
......@@ -395,8 +394,6 @@ static void sk_show_timeval(char *name, u64 *tmo)
void show_socket_opts(struct sk_opts_entry *soe)
{
struct sk_option *o;
pr_msg("\t");
pr_msg("sndbuf: %u ", soe->so_sndbuf);
......
......@@ -70,7 +70,6 @@ static int read_uts_str(int fd, char *n, int size)
int prepare_utsns(int pid)
{
int fd, ret;
u32 len;
char hostname[65];
char domainname[65];
......
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