From: Konstantin Khlebnikov Date: Sat, 7 Jun 2008 15:26:21 +0000 (+0400) Subject: CPT: fix compilation with CONFIG_SYSVIPC=n X-Git-Url: http://git.openvz.org/?p=linux-2.6.24-openvz;a=commitdiff_plain;h=64d5598cc99d99dad8ead28ac93de7fae4b55896 CPT: fix compilation with CONFIG_SYSVIPC=n http://bugzilla.openvz.org/show_bug.cgi?id=851 --- diff --git a/kernel/cpt/cpt_dump.c b/kernel/cpt/cpt_dump.c index ea84dcb..fbbce83 100644 --- a/kernel/cpt/cpt_dump.c +++ b/kernel/cpt/cpt_dump.c @@ -743,7 +743,9 @@ static int cpt_dump_veinfo(cpt_context_t *ctx) struct cpt_veinfo_image *i = cpt_get_buf(ctx); struct ve_struct *ve; struct timespec delta; +#ifdef CONFIG_SYSVIPC struct ipc_namespace *ns; +#endif cpt_open_section(ctx, CPT_SECT_VEINFO); cpt_open_object(NULL, ctx); @@ -756,6 +758,7 @@ static int cpt_dump_veinfo(cpt_context_t *ctx) i->cpt_content = CPT_CONTENT_VOID; ve = get_exec_env(); +#ifdef CONFIG_SYSVIPC ns = ve->ve_ns->ipc_ns; if (ns->shm_ctlall > 0xFFFFFFFFU) @@ -773,6 +776,7 @@ static int cpt_dump_veinfo(cpt_context_t *ctx) i->sem_ctl_arr[1] = ns->sem_ctls[1]; i->sem_ctl_arr[2] = ns->sem_ctls[2]; i->sem_ctl_arr[3] = ns->sem_ctls[3]; +#endif do_posix_clock_monotonic_gettime(&delta); _set_normalized_timespec(&delta, diff --git a/kernel/cpt/cpt_files.c b/kernel/cpt/cpt_files.c index fbba10b..e89d1ed 100644 --- a/kernel/cpt/cpt_files.c +++ b/kernel/cpt/cpt_files.c @@ -546,6 +546,7 @@ static int dump_one_file(cpt_object_t *obj, struct file *file, cpt_context_t *ct return err; } +#ifdef CONFIG_SYSVIPC /* About this weird function... Crappy code dealing with SYSV shared memory * defines TMPFS inode and file with f_op doing only mmap. So... * Maybe, this is wrong and leaks something. It is clear access to @@ -580,6 +581,7 @@ static int dump_content_shm(struct file *file, struct cpt_context *ctx) cpt_pop_object(&saved_pos, ctx); return 0; } +#endif static int data_is_zero(char *addr, int len) { @@ -609,6 +611,7 @@ static int dump_content_regular(struct file *file, struct cpt_context *ctx) return -EINVAL; do_read = file->f_op->read; +#ifdef CONFIG_SYSVIPC if (file->f_op == &shm_file_operations) { struct shm_file_data *sfd = file->private_data; @@ -624,7 +627,7 @@ static int dump_content_regular(struct file *file, struct cpt_context *ctx) return dump_content_shm(file, ctx); } } - +#endif if (!(file->f_mode & FMODE_READ) || (file->f_flags & O_DIRECT)) { file = dentry_open(dget(file->f_dentry), diff --git a/kernel/cpt/cpt_mm.c b/kernel/cpt/cpt_mm.c index 08aefe2..4b02f46 100644 --- a/kernel/cpt/cpt_mm.c +++ b/kernel/cpt/cpt_mm.c @@ -653,12 +653,14 @@ static int dump_one_vma(cpt_object_t *mmobj, cpt_object_t *obj = lookup_cpt_object(CPT_OBJ_FILE, vma->vm_file, ctx); if (obj == NULL) BUG(); filp = obj->o_obj; +#ifdef CONFIG_SYSVIPC if (filp->f_op == &shm_file_operations) { struct shm_file_data *sfd = filp->private_data; v->cpt_type = CPT_VMA_TYPE_SHM; obj = lookup_cpt_object(CPT_OBJ_FILE, sfd->file, ctx); } +#endif v->cpt_file = obj->o_pos; } diff --git a/kernel/cpt/cpt_process.c b/kernel/cpt/cpt_process.c index 12e9bf1..b020824 100644 --- a/kernel/cpt/cpt_process.c +++ b/kernel/cpt/cpt_process.c @@ -862,11 +862,13 @@ static int dump_one_process(cpt_object_t *obj, struct cpt_context *ctx) "process " CPT_FID "\n", CPT_TID(tsk)); } v->cpt_sysvsem_undo = CPT_NULL; +#ifdef CONFIG_SYSVIPC if (tsk->sysvsem.undo_list && !tsk->exit_state) { tobj = lookup_cpt_object(CPT_OBJ_SYSVSEM_UNDO, tsk->sysvsem.undo_list, ctx); if (!tobj) BUG(); v->cpt_sysvsem_undo = tobj->o_pos; } +#endif v->cpt_sighand = CPT_NULL; if (tsk->sighand) { tobj = lookup_cpt_object(CPT_OBJ_SIGHAND_STRUCT, tsk->sighand, ctx); diff --git a/kernel/cpt/cpt_sysvipc.c b/kernel/cpt/cpt_sysvipc.c index 8117307..067a474 100644 --- a/kernel/cpt/cpt_sysvipc.c +++ b/kernel/cpt/cpt_sysvipc.c @@ -31,6 +31,8 @@ #include "cpt_context.h" #include "cpt_kernel.h" +#ifdef CONFIG_SYSVIPC + struct _warg { struct file *file; struct cpt_sysvshm_image *v; @@ -401,3 +403,27 @@ int cpt_collect_sysv(cpt_context_t * ctx) return 0; } + +#else + +int cpt_dump_content_sysvshm(struct file *file, struct cpt_context *ctx) +{ + return 0; +} + +int cpt_dump_sysvsem(struct cpt_context *ctx) +{ + return 0; +} + +int cpt_collect_sysv(cpt_context_t * ctx) +{ + return 0; +} + +int cpt_dump_sysvmsg(struct cpt_context *ctx) +{ + return 0; +} + +#endif /* CONFIG_SYSVIPC */ diff --git a/kernel/cpt/rst_sysvipc.c b/kernel/cpt/rst_sysvipc.c index 8803de5..32c0ec4 100644 --- a/kernel/cpt/rst_sysvipc.c +++ b/kernel/cpt/rst_sysvipc.c @@ -33,6 +33,8 @@ #include "cpt_context.h" #include "cpt_kernel.h" +#ifdef CONFIG_SYSVIPC + struct _warg { struct file *file; struct cpt_sysvshm_image *v; @@ -634,3 +636,37 @@ int rst_sysv_ipc(struct cpt_context *ctx) return err; } + +#else + +int rst_semundo_complete(struct cpt_task_image *ti, struct cpt_context *ctx) +{ + if (ti->cpt_sysvsem_undo != CPT_NULL) + return -EINVAL; + return 0; +} + +int rst_sysv_ipc(struct cpt_context *ctx) +{ + if (ctx->sections[CPT_SECT_SYSV_SEM] != CPT_NULL || + ctx->sections[CPT_SECT_SYSV_MSG] != CPT_NULL) + return -EINVAL; + return 0; +} + +__u32 rst_semundo_flag(struct cpt_task_image *ti, struct cpt_context *ctx) +{ + return 0; +} + +struct file * rst_sysv_shm_itself(loff_t pos, struct cpt_context *ctx) +{ + return ERR_PTR(-EINVAL); +} + +struct file * rst_sysv_shm_vma(struct cpt_vma_image *vmai, struct cpt_context *ctx) +{ + return ERR_PTR(-EINVAL); +} + +#endif /* CONFIG_SYSVIPC */ diff --git a/kernel/cpt/rst_undump.c b/kernel/cpt/rst_undump.c index 13aa020..46d3a5c 100644 --- a/kernel/cpt/rst_undump.c +++ b/kernel/cpt/rst_undump.c @@ -68,7 +68,9 @@ static int vps_rst_veinfo(struct cpt_context *ctx) struct ve_struct *ve; struct timespec delta; loff_t start, end; +#ifdef CONFIG_SYSVIPC struct ipc_namespace *ns; +#endif err = rst_get_section(CPT_SECT_VEINFO, ctx, &start, &end); if (err) @@ -81,6 +83,7 @@ static int vps_rst_veinfo(struct cpt_context *ctx) goto out_rel; ve = get_exec_env(); +#ifdef CONFIG_SYSVIPC ns = ve->ve_ns->ipc_ns; /* Damn. Fatal mistake, these two values are size_t! */ @@ -97,6 +100,7 @@ static int vps_rst_veinfo(struct cpt_context *ctx) ns->sem_ctls[1] = i->sem_ctl_arr[1]; ns->sem_ctls[2] = i->sem_ctl_arr[2]; ns->sem_ctls[3] = i->sem_ctl_arr[3]; +#endif cpt_timespec_import(&delta, i->start_timespec_delta); _set_normalized_timespec(&ve->start_timespec,