Move group_profile_str() in utils.c

Move the group_profile_str() function from cmds-filesystem.c to utils.c
to be re-used from other modules (in this case from mkfs.c)

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Add verbose option to btrfs_add_to_fsid()


Add verbose option to btrfs_add_to_fsid() in order to avoid to print
the information to console when not needed.
The same information is print in the summary of the mkfs.btrfs command.

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Add strdup in btrfs_add_to_fsid() to track the device path.

When creating a new btrfs_device, copy the path to track it.
This path is then used by mkfs.btrfs to list all devices.

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Return the fsid from make_btrfs()

The function make_btrfs() has as argument the fsid of the filesystem.
If this fsid is empty or null make_btrfs() generates a new fsid. However
If the buffer is valid (but the string is empty) the generated fsid is
copied back to the caller.

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Print the summary

This patch print the summary of the filesystem after the creation.
The main fileds printed are:
- devices list with their uuid, devid, path and size
- raid profile (dup,single,raid0...)
- leafsize/nodesize/sectorsize
- filesystem features (raid56, extref, mixed-bg)

If the '-v' switched is passed, the output is more verbose; if the '-q'
switched is passed, only the errors are printed.


Below an example:

# mkfs.btrfs -L btrfs-test -f -m raid5 -d raid5 /dev/vd[b-k]"
BTRFS filesystem summary:
  Label:		btrfs-test
  UUID:			1073cb19-b675-423d-9aba-caad7f1508a8

  Node size:		16384
  Leaf size:		16384
  Sector size:		4096
  Initial chunks:
    Data:		9.01GiB
    Metadata:		3.61GiB
    System:		18.06MiB
  Metadata profile:	RAID5
  Data profile:		RAID5
  Mixed mode:		NO
  SSD detected:		NO
  Features:		extref, raid56
  Number of devices:	10
    UUID                                  ID    SIZE    PATH
    ------------------------------------  --  --------- -----------
    62121322-5666-4ecf-bc8e-c9b3d9f60db9   1   50.00GiB /dev/vdb
    6158cb13-3ae8-42b6-8603-660f1e5c8a7a   2   50.00GiB /dev/vdc
    b49516db-ddf5-4f54-8831-a4babc79e901   3   50.00GiB /dev/vdd
    00b03d81-7d29-4894-8050-9dd205f97c41   4   50.00GiB /dev/vde
    f119a2ec-5ef0-436c-805e-c1b0612b05ca   5   50.00GiB /dev/vdf
    adee4f58-e094-4bd4-8c56-941527524f8d   6   50.00GiB /dev/vdg
    a8299171-2024-4057-ba56-1f83bf6d7e2e   7   50.00GiB /dev/vdh
    b694e275-e454-4dbd-beb0-e33c388cffa2   8    2.00GiB /dev/vdi
    7cbe04b5-36cd-4ea7-be82-206d5487914e   9    2.00GiB /dev/vdj
    7c320654-675e-456b-ac23-cfb148b8ea57  10    2.00GiB /dev/vdk

  Total disks size:                           356.01GiB


Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Add -v and -o switches

Add -v and -o switches to the mkfs.btrfs man page.

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>