[PATCH 1/2] mkfs.ubifs: UBI I/O Library

Corentin Chary corentin.chary at gmail.com
Fri May 8 08:07:38 EDT 2009

On Fri, May 8, 2009 at 10:49 AM, Artem Bityutskiy
<dedekind at infradead.org> wrote:
> Hi,
> thanks for patches. Could you please avoid synchronizing
> include/mtd/ubi-user.h for now? There is nothing new there
> except of this insane s/int32_t/__s32/ type change, right?

Ho, I believed that new ioctl weren't in ubi-user.h .. So it's ok to
keep the old one.

> On Thu, 2009-05-07 at 12:21 +0200, Corentin Chary wrote:
>>  include/mtd/ubi-user.h    |   72 ++--
>>  include/ubi.h             |  192 +++++++++
>>  mkfs.ubifs/libubiio.c     |  936 +++++++++++++++++++++++++++++++++++++++++++++
>>  mkfs.ubifs/libubiio.h     |   47 +++
>>  mkfs.ubifs/libubiio_int.h |  187 +++++++++
>>  5 files changed, 1399 insertions(+), 35 deletions(-)
>>  create mode 100644 include/ubi.h
>>  create mode 100644 mkfs.ubifs/libubiio.c
>>  create mode 100644 mkfs.ubifs/libubiio.h
>>  create mode 100644 mkfs.ubifs/libubiio_int.h
> What is the point of making a second copy of libubi?
> AFAICS, libubio is libubi + other stuff, right?
> Why not to just improve libubi instead of having yet
> another copy? How much sense does it make?

No, not really, libubiio provide what you can find in ubi.h, nothing
more (open/close/read/write/change/erase/map/unmap).
There some code in common to read sysfs properties, it's all.
There is libubiio_int.h with some duplicate code from
ubi-utils/src/common.h which could be removed.
libubi on the other hand provide functions to manipulate volume and
devices (rename, create, etc..).

Another way to teach ubifs to write on UBI volume could be libubi +
direct pread/pwrite/ioctl but it seems a lot less clean
to me. libubiio could be used later for fsck.ubifs or tuneubifs programs =).

But the current tree/build system make it hard to share code between
ubi-utils/mtd-utils/mkfs. It what
If you check, there is also three crc32.c/h in mtd-utils ...
(See http://git.iksaif.net/?p=users/iksaif/mtd-utils.git;a=tree;hb=HEAD
to check what a clean tree could be)

Corentin Chary
http://xf.iksaif.net - http://uffs.org

More information about the linux-mtd mailing list