-#define PATH_MAX 256
-#define OWRT 0x4f575254
-#define DATA 0x44415441
-#define CONF 0x434f4e46
-
-struct file_header {
- uint32_t magic;
- uint32_t type;
- uint32_t seq;
- uint32_t length;
- uint32_t md5[4];
-};
-
-static inline int
-is_config(struct file_header *h)
-{
- return ((h->magic == OWRT) && (h->type == CONF));
-}
-
-static inline int
-valid_file_size(int fs)
-{
- if ((fs > 8 * 1024 * 1204) || (fs <= 0))
- return -1;
-
- return 0;
-}
-
-static void
-hdr_to_be32(struct file_header *hdr)
-{
- uint32_t *h = (uint32_t *) hdr;
- int i;
-
- for (i = 0; i < sizeof(struct file_header) / sizeof(uint32_t); i++)
- h[i] = cpu_to_be32(h[i]);
-}
-
-static void
-be32_to_hdr(struct file_header *hdr)
-{
- uint32_t *h = (uint32_t *) hdr;
- int i;
-
- for (i = 0; i < sizeof(struct file_header) / sizeof(uint32_t); i++)
- h[i] = be32_to_cpu(h[i]);
-}
-
-static int
-pad_file_size(struct volume *v, int size)
-{
- int mod;
-
- size += sizeof(struct file_header);
- mod = size % v->block_size;
- if (mod) {
- size -= mod;
- size += v->block_size;
- }
-
- return size;
-}
-
-static int