Commit Graph

45 Commits

Author SHA1 Message Date
Karel Zak dab3357387 blkid: add DEVNAME= to export output format
Reported-by: Balamurugan Arumugam <barumuga@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-02 14:05:26 +01:00
Karel Zak fec1339f9f blkid: remove dead assigment
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-02 14:33:18 +01:00
Karel Zak 7113ddecf8 blkid: add comment to keep static analysers happy 2012-01-31 21:16:28 +01:00
Karel Zak d75bcac49a blkid: check fd before use [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-31 14:19:27 +01:00
Karel Zak b82590ad46 blkid: move cache to /run on new systems
Why?

 * read-only root

 * /etc is pretty bad place for caches

 * all is usually cached by udev in /dev/disk/by-* and libblkid
   is able to use these symlinks

 * boot persistent cache is attractive for very small subset of
   Linux machines (and they already need extra udev tunning otherwise
   udev will probe all block devices during boot)

 * the default is possible to override in /etc/blkid.conf

The systems without /run directory will not be affected by this
change.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-25 13:20:37 +01:00
Karel Zak 077b15dcaa blkid: remove -w option from man page and usage() output
The option does not have any effect, the original functionality was
removed from e2fsprogs in year 2003 by

 commit	50b380b4d4ab668bad45033e3a8aaf93c7f42844
 git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git

So.. don't propagate the option to users in year 2012 :-)

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-25 12:34:02 +01:00
Karel Zak 6a2f2f58a4 blkid: print ID_PART_ENTRY_* for small devices
The current optimization for small devices (1.4MiB) is broken. It
checks for partition table, but if nothing is detected then details
(ID_PART_ENTRY_*) about the current partition are not gathered.

The optimization should be enabled for small *whole* disks only.

Reported-by: David Zeuthen <davidz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-10-21 00:37:06 +02:00
Petr Uzel 960cf5737e misc: use %m in format string instead of %s and strerror(errno)
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-09-27 15:46:07 +02:00
Karel Zak 54a00b5c79 blkid: potential null derefence [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-12 16:10:45 +02:00
Karel Zak 2327e2d6d7 blkid: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 17:05:12 +02:00
Karel Zak bf0128d631 blkid: indent usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 12:12:46 +02:00
Karel Zak 525f3c28cb blkid: fix compiler warnings [-Wunused-parameter]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-01 12:48:55 +02:00
Karel Zak 70db6c7ef4 blkid: list all known filesystems/RAIDs (add -k option)
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-20 16:42:03 +02:00
Karel Zak bc867ea388 blkid: don't free() uninitialized variable
blkid.c: In function ‘main’:
blkid.c:656:6: warning: ‘res’ may be used uninitialized in this function [-Wuninitialized]
blkid.c:623:9: note: ‘res’ was declared here

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-08 12:16:08 +02:00
Sergey Gusarov 305a612251 blkid: small fix for safe_print()
This small fix makes it possible to print the first unprintable character
with code 128 from ASCII table.

Signed-off-by: Sergey Gusarov <laborer2008@gmail.com>
2011-03-29 17:07:24 +02:00
Karel Zak 36a74e1b45 blkid: add -d option to print non-printable chars
Reported-by: laborer2008 laborer <laborer2008@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-29 11:44:29 +02:00
Karel Zak 37beb702a8 blkid: fix double free [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-11 16:12:20 +01:00
Karel Zak 4b5f7895b4 blkid: don't ignore -i
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-08 13:32:05 +01:00
Benno Schulenberg dcf22239e8 blkid: uniformize the synopsis, remove "the the"
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-03-08 13:14:56 +01:00
Eric Sandeen ea51c09c11 blkid: dynamically allocate devicename array
If more than 128 devices are specified on the blkid cmdline,
the devices[] array will overflow.

We can dynamically allocate the devices[] array based on number
of arguments to avoid this problem.

[kzak@redhat.com: - add "if (optind < argc)" check]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-08 15:55:59 +01:00
Karel Zak 68c88d942f blkid: add new return code 8 for ambivalent low-level probing result
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-03 12:59:58 +01:00
Karel Zak 53a4d69ddf blkid: don't return PART_ENTRY_* if partition is empty
The PART_ENTRY_* has nothing to do with the _contents_ of the block
device. So if the device is empty these values should not be printed
and blkid(8) has to return 2.

The PART_ENTRY_* for empty devices should be printed for "-o udev"
output only.

Reported-by: Thomas Bächler <thomas@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-03 12:12:37 +01:00
Karel Zak dbcafb870f blkid: don't print devname if nothing detected
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-03 12:01:45 +01:00
Davidlohr Bueso 8abcf29002 lib: [strutils] general purpose string handling functions
This patch replaces a few functions used throughout the source:
* Renames getnum (from schedutils) to strtol_or_err
* Moves strtosize (from lib/strtosize.c)
* Moves xstrncpy (from include/xstrncpy.h)
* Adds strnlen, strnchr and strndup if not available (remove it from libmount utils)

A few Makefile.am files were modified to compile accordingly along with trivial renaming
in schedutils source code.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-23 21:06:49 +01:00
Karel Zak 0159857e0d blkid: remove _ENC from ID_PART_ENTRY_{NAME,TYPE} variables
The *_ENC variables are deprecated. All stuff for udev should be
encoded.

Reported-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-02 16:11:52 +02:00
Karel Zak ab978962b1 blkid: add 'export' output format
This output format is similar to 'udev' but without udev specific
prefixed (e.g. ID_FS_*). The 'export' format is automatically enabled
for I/O Limits (-i).

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-05-14 12:02:57 +02:00
Karel Zak 0979291016 blkid: add -i option to print I/O limits
blkid -i /dev/sdb /dev/sda
/dev/sdb: MINIMUM_IO_SIZE="512" OPTIMAL_IO_SIZE="32768" PHYSICAL_SECTOR_SIZE="512" LOGICAL_SECTOR_SIZE="512"
/dev/sda: MINIMUM_IO_SIZE="512" PHYSICAL_SECTOR_SIZE="512" LOGICAL_SECTOR_SIZE="512"

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-05-13 23:27:22 +02:00
Karel Zak 25636f8263 blkid: update man page/usage()
The "-s <tag>" options is usable for low-level probing more too. This
feature should be documented.

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-05-13 20:42:28 +02:00
Karel Zak cba1f9757a blkid: improve RAIDs and tiny devices probing
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-22 21:52:31 +02:00
Karel Zak 9eb44c28f8 blkid: add \n to the "-o udev" output when probe more devices
Old output:
	# blkid -p -o udev /dev/sda{1,3}
	ID_FS_LABEL=/boot
	ID_FS_LABEL_ENC=\x2fboot
	ID_FS_UUID=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
	ID_FS_UUID_ENC=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
	ID_FS_VERSION=1.0
	ID_FS_TYPE=ext3
	ID_FS_USAGE=filesystem
	ID_FS_LABEL=BAR
	ID_FS_LABEL_ENC=BAR
	ID_FS_UUID=1f2aa318-9c34-462e-8d29-260819ffd657
	ID_FS_UUID_ENC=1f2aa318-9c34-462e-8d29-260819ffd657
	ID_FS_VERSION=2
	ID_FS_TYPE=swap
	ID_FS_USAGE=other

new output:
	# blkid -p -o udev /dev/sda{1,3}
	ID_FS_LABEL=/boot
	ID_FS_LABEL_ENC=\x2fboot
	ID_FS_UUID=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
	ID_FS_UUID_ENC=f1cd38fa-c887-4ab8-834b-c8ee659b97fe
	ID_FS_VERSION=1.0
	ID_FS_TYPE=ext3
	ID_FS_USAGE=filesystem

	ID_FS_LABEL=BAR
	ID_FS_LABEL_ENC=BAR
	ID_FS_UUID=1f2aa318-9c34-462e-8d29-260819ffd657
	ID_FS_UUID_ENC=1f2aa318-9c34-462e-8d29-260819ffd657
	ID_FS_VERSION=2
	ID_FS_TYPE=swap
	ID_FS_USAGE=other

Reported-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-15 13:15:35 +02:00
Karel Zak 8ab912cfa6 blkid: support suffixes for -O <offset> and -S <size>
for example:  blkid -p -O 17816085KiB /dev/sda

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-30 14:42:42 +02:00
Karel Zak 4f946f530c blkid: add -n <list> option
This option allows to restrict low-level probing to the defined list
of superbocks (filesystems or RAIDs). For example:

	blkid -p -n ext3,ext4,vfat /dev/sda1
or
	blkid -p -n novfat /dev/sda1

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-23 14:06:54 +01:00
Karel Zak 962496d401 blkid: cleanup -u <list> parsing
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-22 15:16:01 +01:00
Karel Zak aaf8fffb35 blkid: fix blkid_probe_lookup_value() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-19 10:15:11 +01:00
Karel Zak dcc58f62c4 blkid: encode PART_ENTRY_TYPE
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18 23:04:22 +01:00
Karel Zak 4f74ffdbfe blkid: export ID_PART_ENTRY_* variables for udev
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18 16:46:56 +01:00
Karel Zak 4fc5d65bf2 blkid: report open() errors in low-level probing
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-16 09:43:26 +01:00
Karel Zak 06b1e27aaf blkid: fix #ifdef HAVE_TERMIO[S]_H
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-12 10:32:34 +01:00
Karel Zak f00aae6d7b blkid: add newline when only one value is printed
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-01-27 18:16:06 +01:00
Karel Zak e3d8933aaa blkid: probe for PT, don't probe for FS on small whole-disks
* blkid(8) in low-level mode probes for PT now (blkid is replacement
   for devkit-disks-part-id)

 * add ID_PART_TABLE_TYPE=<name> to blkid(8) udev output

 * don't probe for FS/RAIDs on small devices when PT is detected

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-01-21 00:16:19 +01:00
Karel Zak c54670d564 blkid: add ID_FS_AMBIVALENT for udev output
UI tools that read information from udev need a way how inform users
about ambivalent probing result (more valid filesystems on the
device).

This patch add a new ID_FS_AMBIVALENT variable:

	ID_FS_AMBIVALENT=<info> <info> [ ...]

where <info> is:

	<usage>:<type>[:<version>]

all strings are encoded (white spaces and utf8 are replaced with \hex).

For example:

	# blkid -p -o udev /dev/sda1
	ID_FS_AMBIVALEN=filesystem:vfat:FAT12 other:swap:2

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-11-11 17:21:36 +01:00
Karel Zak 2d71a92941 blkid: add pretty output, document -L incompatibility with e2fsprogs
... sad story, I have temporary disabled pretty-output code
in very early version of blkid.c in u-l-ng. (It was also in
time when pretty-output was very new feature in e2fsprogs.)

Unfortunately, the -L option (shortcut to "-o list") in u-l-ng version
was reused for for any other functionality few months later.... this
stupid thing was released in u-l-ng 2.15 and 2.16 without any negative
feedback from users.

It means the blkid from u-l-ng is not backwardly compatible with
the original version from e2fsprogs. The -L option has a different
meaning there.

I'm sorry about this bug...

This patch:

  * enable pretty-output (-o line)
  * add a note about incompatibility between u-l-ng and e2fsprogs
    to blkid.8 man page

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-14 02:51:30 +02:00
Karel Zak 7711e2150b blkid: allow to use -s <TAG> for low-level probing (-p mode)
# blkid -p -s TYPE /dev/sda3
 /dev/sda3: TYPE="swap"

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-09-24 14:44:47 +02:00
Karel Zak 1b780848b0 libblkid: use the new API in whole u-l-ng
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-09-16 10:57:24 +02:00
Karel Zak 5663298c2c blkid: move to misc-utils/ directory
The others utilities are in one of the top-level directories. That's
confusing to have blkid(8) and findfs(8) in shlibs/ tree.

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-07-02 14:38:23 +02:00