summaryrefslogtreecommitdiffstats
path: root/disk-utils/blockdev.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-5/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: use new ul_path_* APIKarel Zak2018-06-211-12/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-1/+1
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* blockdev: correct man page name in --helpRuediger Meier2017-06-291-1/+1
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* blockdev: improve --help and man pageRuediger Meier2017-06-271-11/+23
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: cleanup and fix --unknownopt issuesRuediger Meier2017-06-261-10/+17
| | | | | | | | | | | | | | | | Fixed checkusage.sh warnings: rtcwake: --unknownopt, non-empty stdout rtcwake: --unknownopt, stderr too long: 21 blockdev: --unknownopt, stderr too long: 28 lsipc: --unknownopt, stderr too long: 77 pg: --unknownopt, stderr too long: 23 renice: --unknownopt, stderr too long: 18 sulogin: --unknownopt, stderr too long: 17 write: --unknownopt, stderr too long: 12 Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* Since 569d1dac7bc64457aac11163b6a91ce9b41a6715 we read device startKarel Zak2015-03-171-2/+3
| | | | | | | | sector from the /sys/block/.../start file. The file exists only for partitions, for wholedisk is the start of the device always zero. References: https://bugzilla.redhat.com/show_bug.cgi?id=1202443 Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: check return when read from sysfs [coverity scan]Karel Zak2015-01-281-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: improve error messagesSami Kerola2014-12-091-1/+1
| | | | | | | Use error printing facilities that add command name in front of the error message, and add explanation that is part of existing translations. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blockdev: don't use HDIO_GETGEOPhillip Susi2013-11-041-5/+15
| | | | | | | | | | | | | blockdev was still using this depreciated ioctl and that was causing blockdev --report to fail on loop and nbd devices. Switch to reading the partition start from sysfs instead. This also allows it to correctly report > 2^32 sector counts. [kzak@redhat.com: - check sysfs_init() return, - use uint64_t rather than unsigned long long] Signed-off-by: Phillip Susi <psusi@ubuntu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: add note about --setbsz usabilityKarel Zak2013-10-111-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Revert "blockdev: Remove the --setbsz (set blocksize) option which has never ↵Karel Zak2013-10-111-0/+7
| | | | | | | | | | | | | worked." This reverts commit b1555acc2f709ac4f3b1e6c686a11cadb7b04f72. It seems that the option is used by kernel guys to test kernel, so let's keep the option in the blockdev(8) although it's almost useless in userspace. All we need is to improve docs to make things more obvious to end users. Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: Remove the --setbsz (set blocksize) option which has never worked.Richard W.M. Jones2013-10-081-7/+0Star
| | | | | | | | | | | | | | | | | | | This option has never worked. If you try setting the block size on a block device, and then read it using --getbsz, you will see that the block size never changes. The reason for this is because the block size is specific to the current file descriptor opening the block device, so the change of block size only persists for as long as blockdev has the device open, and is lost once blockdev exits. Also the block size is not really used anywhere. Filesystems, for example, have their own idea of block size and ignore this setting completely. (Thanks Masayoshi Mizuma for diagnosing the problem) Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
* textual: use UTIL_LINUX_VERSION everywhereKarel Zak2013-01-251-2/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: standardize reporting of program name plus package versionBenno Schulenberg2013-01-251-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* fix buffer overrun in some calls to sscanfKarel Zak2012-07-091-1/+1
| | | | | Reported-by: Sergei Antonov <saproj@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* disk-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blockdev: make the code more readable for static analysersKarel Zak2012-02-021-7/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: remove non-ANSI function declaration [smatch scan]Karel Zak2012-01-171-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: make functions staticWanlong Gao2012-01-051-8/+8
| | | | | | make the functions in blockdev to statics. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
* blockdev: indent usage()Karel Zak2011-08-161-6/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: coding style fixSami Kerola2011-06-301-29/+31
| | | | | | Sync with README.devel Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blockdev: type mismatch fixSami Kerola2011-06-301-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blockdev: broken compiler warning circumvention removedSami Kerola2011-06-301-4/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blockdev: use pathnames.h to find partitionsSami Kerola2011-06-301-4/+3Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blockdev: use libc error facilitiesSami Kerola2011-06-301-11/+9Star
| | | | | | | Favour symbolic return values and use {err,warn}{,x} where ever applies. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blockdev: add --help optionSami Kerola2011-06-301-24/+23Star
| | | | | | | | The option is also accepted in format `-h'. As a side effect usage function is now able to return success, and since it had to be touched the printing is cleaned up. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blockdev: remove prognameSami Kerola2011-06-291-24/+10Star
| | | | | | Use errx, warnx or program_invocation_short_name instead. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blockdev: set options read onlySami Kerola2011-06-291-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* blockdev: sync man page with codeKarel Zak2010-08-241-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: add BLKDISCARDZEROESKarel Zak2010-08-241-0/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* messages: gettextize a few skipped or forgotten onesBenno Schulenberg2010-06-141-2/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* blockdev: reduce usage text widthFrancesco Cosoleto2010-03-311-4/+4
| | | | | | | | | | Use spaces in usage text instead of tabs and reduce the distance between option names and descriptions. This helps to minimize problems due to limited number of columns and translated texts which take up more space than English. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
* blockdev: use c.hKarel Zak2009-10-161-4/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: fix topology ioctlsKarel Zak2009-10-151-1/+1
| | | | | | | | | | | | | | kernel 2.6.32-rc4 (kvm): # blockdev -v --getss --getpbsz --getiomin --getioopt --getmaxsect --getalignoff /dev/sda get logical block (sector) size: 512 get physical block (sector) size: 512 get minimum I/O size: 512 get optimal I/O size: 0 get max sectors per request: 1024 get alignment offset: 0 Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: add topology ioctls supportKarel Zak2009-10-151-1/+31
| | | | | | | | | | | | new options: --getpbsz get physical block (sector) size --getiomin get minimum I/O size --getioopt get optimal I/O size --getalignoff get alignment offset --getmaxsect get max sectors per request Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: add support for uint and ushort ioctlsKarel Zak2009-10-151-0/+18
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: refactoring (better commands definition)Karel Zak2009-10-141-92/+162
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: fix possible buffer overflowKarel Zak2009-04-291-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: use lib/blkdev.c, fix --reportKarel Zak2007-11-071-83/+9Star
| | | | | | | | | | This patch replaces duplicate code with blkdev_ functions from lib/blkdev.c. The patch also fix the output from "blockdev --report". The Size field was in 512-byte sectors instead in real size in bytes. Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: fix: opened file leaving unclosedlizf2007-10-261-0/+4
| | | | Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
* po: gettextizing some overlooked messages.Benno Schulenberg2007-08-141-2/+2
| | | | | | | | Gettextize three new strings, make two strings indentical to two others, and gettextize three strings that are already gettextized elsewhere. Signed-off-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: use LU and LLU for BLKGETSIZE and BLKGETSIZE64Karel Zak2007-08-011-2/+28
| | | | | | | | | | | The "blkockdev --getsize" returns negative numbers on i386 for 1Tb devices. The BLKGETSIZE and BLKGETSIZE64 have to use unsigned long and unsigned long long. $ blockdev --getsize /dev/mapper/huge -2147483648 Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: fix "blockdev --getsz" for large devicesKarel Zak2007-08-011-2/+5
| | | | | | | The "blockdev --getsz" command doesn't try to use BLKGETSIZE64 when previous BLKGETSIZE failed with EFBIG. This patch fixes this problem. Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: cleanup usage() and update man pageKarel Zak2007-06-291-6/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blockdev: add BLKFRAGET/BLKFRASET ioctlsKarel Zak2007-06-291-0/+8
| | | | | | | | | | | | | | In Linux 2.6 the BLKRASET ioctl has the desired effect for mounted file-systems. In Linux 2.4 it appears to set the number of blocks to read-ahead on the *device* as opposed to within a *file*, and the maximum value of this number is 255. As a result the invocation of blockdev will fail on Linux 2.4 for any usefully large value of READAHEAD, and will not in any case have the desired affect for fragmented files. (Based on the blockdev-getfra-setfra.patch Debian patch.) Signed-off-by: Karel Zak <kzak@redhat.com>
* Imported from util-linux-2.13-pre2 tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.13-pre1 tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.12b tarball.Karel Zak2006-12-071-9/+55
|
* Imported from util-linux-2.11o tarball.Karel Zak2006-12-071-1/+0Star
|