summaryrefslogtreecommitdiff
path: root/ubi-utils/include/libubigen.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-09-01 15:52:33 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-11-17 11:36:56 +0100
commitdb4146e84f3310a1e1de6f6d45f2ac35a0b0a604 (patch)
tree4046be3c7f438e5ae2ed4ea9a28bb6f435e2f619 /ubi-utils/include/libubigen.h
parentf4ec4511d0729802e783b1757d6bcd556737510e (diff)
Move ubi-utils libraries to common library location
Historically, the mtd-utils and ubi-utils were seperate packages. The ubi-utils were at some point merged into the mtd-utils. They first appeared in the release tar-ball in version 1.1.0 in their own sub-hirarchy with their own buildsystem, readme, documentation, etc. A lot of the duplicated stuff got centralized/removed over time. This patch further cleans up the directory hirarchy duplication by moving common libraries from the ubi-utils/ into the central lib/ and include/ directories in the top directory of the mtd-utils package. This includes: - libuib.a & libubigen.a used by the ubi utilities - libscan.a currently only used by ubiformat - libiniparser.a used by ubinize Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubi-utils/include/libubigen.h')
-rw-r--r--ubi-utils/include/libubigen.h195
1 files changed, 0 insertions, 195 deletions
diff --git a/ubi-utils/include/libubigen.h b/ubi-utils/include/libubigen.h
deleted file mode 100644
index c25ac20..0000000
--- a/ubi-utils/include/libubigen.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) International Business Machines Corp., 2006
- * Copyright (C) 2008 Nokia Corporation
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- * the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- * Authors: Frank Haverkamp
- * Artem Bityutskiy
- */
-
-#ifndef __LIBUBIGEN_H__
-#define __LIBUBIGEN_H__
-
-#include <stdint.h>
-#include <mtd/ubi-media.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * struct ubigen_info - libubigen information.
- * @leb_size: logical eraseblock size
- * @peb_size: size of the physical eraseblock
- * @min_io_size: minimum input/output unit size
- * @vid_hdr_offs: offset of the VID header
- * @data_offs: data offset
- * @ubi_ver: UBI version
- * @vtbl_size: volume table size
- * @max_volumes: maximum amount of volumes
- * @image_seq: UBI image sequence number
- */
-struct ubigen_info
-{
- int leb_size;
- int peb_size;
- int min_io_size;
- int vid_hdr_offs;
- int data_offs;
- int ubi_ver;
- int vtbl_size;
- int max_volumes;
- uint32_t image_seq;
-};
-
-/**
- * struct ubigen_vol_info - information about a volume.
- * @id: volume id
- * @type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC)
- * @alignment: volume alignment
- * @data_pad: how many bytes are unused at the end of the each physical
- * eraseblock to satisfy the requested alignment
- * @usable_leb_size: LEB size accessible for volume users
- * @name: volume name
- * @name_len: volume name length
- * @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE,
- * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT)
- * @used_ebs: total number of used logical eraseblocks in this volume (relevant
- * for static volumes only)
- * @bytes: size of the volume contents in bytes (relevant for static volumes
- * only)
- * @flags: volume flags (%UBI_VTBL_AUTORESIZE_FLG)
- */
-struct ubigen_vol_info
-{
- int id;
- int type;
- int alignment;
- int data_pad;
- int usable_leb_size;
- const char *name;
- int name_len;
- int compat;
- int used_ebs;
- long long bytes;
- uint8_t flags;
-};
-
-/**
- * ubigen_info_init - initialize libubigen.
- * @ui: libubigen information
- * @peb_size: flash physical eraseblock size
- * @min_io_size: flash minimum input/output unit size
- * @subpage_size: flash sub-page, if present (has to be equivalent to
- * @min_io_size if does not exist)
- * @vid_hdr_offs: offset of the VID header
- * @ubi_ver: UBI version
- * @image_seq: UBI image sequence number
- */
-void ubigen_info_init(struct ubigen_info *ui, int peb_size, int min_io_size,
- int subpage_size, int vid_hdr_offs, int ubi_ver,
- uint32_t image_seq);
-
-/**
- * ubigen_create_empty_vtbl - creates empty volume table.
- * @ui: libubigen information
- *
- * This function creates an empty volume table and returns a pointer to it in
- * case of success and %NULL in case of failure. The returned object has to be
- * freed with 'free()' call.
- */
-struct ubi_vtbl_record *ubigen_create_empty_vtbl(const struct ubigen_info *ui);
-
-/**
- * ubigen_init_ec_hdr - initialize EC header.
- * @ui: libubigen information
- * @hdr: the EC header to initialize
- * @ec: erase counter value
- */
-void ubigen_init_ec_hdr(const struct ubigen_info *ui,
- struct ubi_ec_hdr *hdr, long long ec);
-
-/**
- * ubigen_init_vid_hdr - initialize VID header.
- * @ui: libubigen information
- * @vi: volume information
- * @hdr: the VID header to initialize
- * @lnum: logical eraseblock number
- * @data: the contents of the LEB (static volumes only)
- * @data_size: amount of data in this LEB (static volumes only)
- *
- * Note, @used_ebs, @data and @data_size are ignored in case of dynamic
- * volumes.
- */
-void ubigen_init_vid_hdr(const struct ubigen_info *ui,
- const struct ubigen_vol_info *vi,
- struct ubi_vid_hdr *hdr, int lnum,
- const void *data, int data_size);
-
-/**
- * ubigen_add_volume - add a volume to the volume table.
- * @ui: libubigen information
- * @vi: volume information
- * @vtbl: volume table to add to
- *
- * This function adds volume described by input parameters to the volume table
- * @vtbl.
- */
-int ubigen_add_volume(const struct ubigen_info *ui,
- const struct ubigen_vol_info *vi,
- struct ubi_vtbl_record *vtbl);
-
-/**
- * ubigen_write_volume - write UBI volume.
- * @ui: libubigen information
- * @vi: volume information
- * @ec: erase counter value to put to EC headers
- * @bytes: volume size in bytes
- * @in: input file descriptor (has to be properly seeked)
- * @out: output file descriptor
- *
- * This function reads the contents of the volume from the input file @in and
- * writes the UBI volume to the output file @out. Returns zero on success and
- * %-1 on failure.
- */
-int ubigen_write_volume(const struct ubigen_info *ui,
- const struct ubigen_vol_info *vi, long long ec,
- long long bytes, int in, int out);
-
-/**
- * ubigen_write_layout_vol - write UBI layout volume
- * @ui: libubigen information
- * @peb1: physical eraseblock number to write the first volume table copy
- * @peb2: physical eraseblock number to write the second volume table copy
- * @ec1: erase counter value for @peb1
- * @ec2: erase counter value for @peb1
- * @vtbl: volume table
- * @fd: output file descriptor seeked to the proper position
- *
- * This function creates the UBI layout volume which contains 2 copies of the
- * volume table. Returns zero in case of success and %-1 in case of failure.
- */
-int ubigen_write_layout_vol(const struct ubigen_info *ui, int peb1, int peb2,
- long long ec1, long long ec2,
- struct ubi_vtbl_record *vtbl, int fd);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !__LIBUBIGEN_H__ */