libfdisk: add docs for BSD functions
libfdisk: add docs for DOS functions
libfdisk: add docs for GPT functions
libfdisk: add docs for init functions
libfdisk: add docs for iterator
libfdisk: fix typo
libfdisk: cleanup fdisk_partition_to_string() comment
libfdisk: add docs for SUN functions
libfdisk: add docs for SGI functions
libfdisk: add comments to header file

Signed-off-by: Karel Zak <kzak@redhat.com>
build-sys: cleanup in libmount Makemodule

Signed-off-by: Karel Zak <kzak@redhat.com>
blkdiscard: fix compiler warning

Signed-off-by: Karel Zak <kzak@redhat.com>
build-sys: create a regular shared libfdisk.so

- symbols versioning
- SONAME from configure.ac
- library version to header file
- modify build-sys to compile and install shared lib

Signed-off-by: Karel Zak <kzak@redhat.com>
build-sys: add fdiskP.h to sources

Signed-off-by: Karel Zak <kzak@redhat.com>
build-sys: add fdisk.pc

Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols: fix docs namespace

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: rename and move function

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: add API docs

Signed-off-by: Karel Zak <kzak@redhat.com>
include/carefulputc: encode also ' and $ in fputs_quoted() output

This change is important for commands linked with libsmartcols (e.g. lsblk(1))
to make it more safe for crazy scenarios like

   eval $(lsblk --fs --pairs /dev/sdb1)

where the command returns NAME="value" from filesystem LABELS (etc.)

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid: care about unsafe chars in cache

The high-level libblkid API uses /run/blkid/blkid.tab cache to
store probing results. The cache format is

   <device NAME="value" ...>devname</device>

and unfortunately the cache code does not escape quotation marks:

   # mkfs.ext4 -L 'AAA"BBB'

   # cat /run/blkid/blkid.tab
   ...
   <device ... LABEL="AAA"BBB" ...>/dev/sdb1</device>

such string is later incorrectly parsed and blkid(8) returns
nonsenses. And for use-cases like

   # eval $(blkid -o export /dev/sdb1)

it's also insecure.

Note that mount, udevd and blkid -p are based on low-level libblkid
API, it bypass the cache and directly read data from the devices.

The current udevd upstream does not depend on blkid(8) output at all,
it's directly linked with the library and all unsafe chars are encoded by
\x<hex> notation.

   # mkfs.ext4 -L 'X"`/tmp/foo` "' /dev/sdb1
   # udevadm info --export-db | grep LABEL
   ...
   E: ID_FS_LABEL=X__/tmp/foo___
   E: ID_FS_LABEL_ENC=X\x22\x60\x2ftmp\x2ffoo\x60\x20\x22

Signed-off-by: Karel Zak <kzak@redhat.com>