Messages in this thread | | | Date | Wed, 3 Sep 2008 15:56:16 +0200 | From | Louis Rilling <> | Subject | Re: [PATCH 3/9] Introduce context structure needed during checkpointing/restart |
| |
On Wed, Sep 03, 2008 at 02:57:50PM +0400, Andrey Mirkin wrote: > Add functions for context allocation/destroy. > Introduce functions to read/write image. > Introduce image header and object header. >
[...]
> diff --git a/cpt/cpt_image.h b/cpt/cpt_image.h > new file mode 100644 > index 0000000..3d26229 > --- /dev/null > +++ b/cpt/cpt_image.h > @@ -0,0 +1,63 @@ > +/* > + * Copyright (C) 2008 Parallels, Inc. > + * > + * Author: Andrey Mirkin <major@openvz.org> > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License as > + * published by the Free Software Foundation, version 2 of the > + * License. > + * > + */ > + > +#ifndef __CPT_IMAGE_H_ > +#define __CPT_IMAGE_H_ 1 > + > +enum _cpt_object_type > +{ > + CPT_OBJ_TASK = 0, > + CPT_OBJ_MAX, > + /* The objects above are stored in memory while checkpointing */ > + > + CPT_OBJ_HEAD = 1024, > +}; > + > +enum _cpt_content_type { > + CPT_CONTENT_VOID, > + CPT_CONTENT_ARRAY, > + CPT_CONTENT_DATA, > + CPT_CONTENT_NAME, > + CPT_CONTENT_REF, > + CPT_CONTENT_MAX > +}; > + > +#define CPT_SIGNATURE0 0x79 > +#define CPT_SIGNATURE1 0x1c > +#define CPT_SIGNATURE2 0x01 > +#define CPT_SIGNATURE3 0x63 > + > +struct cpt_head > +{ > + __u8 cpt_signature[4]; /* Magic number */ > + __u32 cpt_hdrlen; /* Header length */ > + __u16 cpt_image_major; /* Format of this file */ > + __u16 cpt_image_minor; /* Format of this file */ > + __u16 cpt_image_sublevel; /* Format of this file */ > + __u16 cpt_image_extra; /* Format of this file */ > + __u16 cpt_arch; /* Architecture */ > + __u16 cpt_pad1; > + __u32 cpt_pad2; > +#define CPT_ARCH_I386 0
Why is this constant precisely defined after the padding?
> + __u64 cpt_time; /* Time */ > +} __attribute__ ((aligned (8))); > + > +/* Common object header. */ > +struct cpt_object_hdr > +{ > + __u64 cpt_len; /* Size of current chunk of data */ > + __u16 cpt_type; /* Type of object */ > + __u32 cpt_hdrlen; /* Size of header */ > + __u16 cpt_content; /* Content type: array, reference... */
This layout looks a bit awkward for 32bits/64bits compatibility. Maybe put cpt_hdrlen before cpt_type?
Louis
-- Dr Louis Rilling Kerlabs Skype: louis.rilling Batiment Germanium Phone: (+33|0) 6 80 89 08 23 80 avenue des Buttes de Coesmes http://www.kerlabs.com/ 35700 Rennes [unhandled content-type:application/pgp-signature] | |