Commit Graph

1228 Commits

Author SHA1 Message Date
Karel Zak 3c1e47c61f build-sys: cleanup disk-utils/Makefile.am (use $utils_common)
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-11-21 02:38:25 +01:00
Matthias Koenig 16726585e3 mkfs.minix: device size cleanup
Use blkdev_get_size() function and some size related cleanup.

Signed-off-by: Matthias Koenig <mkoenig@suse.de>
2007-11-21 02:35:09 +01:00
Matthias Koenig a28a3ad26d mkfs.minix: add sectorsize check
Minix filesystem until version 2 has a fixed blocksize of 1024 bytes.
If you try to create a filsystem on a device with a physical sectorsize
larger than 1024 bytes, this resulting minix fs cannot be mounted,
because the physical sectorsize must be smaller than the filesystem
blocksize.
This patch adds a check for this and will refuse to create a filesystem
if the sectorsize is bigger than the blocksize.

Signed-off-by: Matthias Koenig <mkoenig@suse.de>
2007-11-21 02:35:00 +01:00
Samuel Thibault 3bbc932079 build-sys: non-linux support
Here is a patch that disables linux-specific tools on non-linux targets.

Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-Off-By: Karel Zak <kzak@redhat.com>
2007-11-08 02:26:36 +01:00
Karel Zak 8505ff35cf elvtune: use get_linux_version()
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-11-07 21:25:48 +01:00
Karel Zak bc8b63833e blockdev: use lib/blkdev.c, fix --report
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>
2007-11-07 20:59:28 +01:00
Karel Zak b7188e932e mkswap: cleanup kB vs. KiB usage in error messages
mkswap(8) man page is talking about KiB (2^10), but the mkswap binary
uses kB (10^3) in error messages. That's strange. Let's use KiB
everywhere.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-11-07 13:46:34 +01:00
Karel Zak 54e377b386 mkswap: BLKGETSIZE cleanup
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-11-07 13:26:27 +01:00
Karel Zak 8023c83bd5 mkswap: linux_version() code consolidation
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-11-06 02:40:49 +01:00
lizf bbc9abce3f mkfs.cramfs: remove unused header file
Remove including of assert.h

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
2007-11-06 01:09:04 +01:00
lizf 122db55d60 blockdev: fix: opened file leaving unclosed
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
2007-10-26 01:02:45 +02:00
Benno Schulenberg 6557c51226 docs: tweak a few messages for clarity
Add a missing period, a missing space, a comma and a word for clarity,
plus a period and an uppercase letter to match surrounding messages.
Further add a missing call to gettext, and undo an unneeded linewrap.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2007-10-26 01:02:44 +02:00
KaiGai Kohei 71bf788444 mkswap: possible to crash with SELinux relabeling support
When fgetfilecon() is failed with -ENODATA, this process does not
exit.  However, "oldcontext" is not initialized in this case, so
context_new() will be called with uninitialized "oldcontext" at the
next.

Finally, it makes a segmentation fault, because context_new() have to
refer an incorrect memory region.

The attached patch fixes this matter using matchpathcon().  If we
cannot obtain actual file context due to -ENODATA, a context which is
returned by matchpathcon() is applied as oldcontext.  Then, the type
of the context is relabeled to "swapfile_t" explicitly.

Signed-off-by: KaiGai Kohei <kaigai@kaigai.gr.jp>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-10-25 21:50:36 +02:00
Randy Dunlap 3c7c38e1b3 mkfs.cramfs: clean up gcc warnings
* clean up code, gcc warnings
  (try compilation with "-Wall -Wp,-D_FORTIFY_SOURCE=2")

Builds cleanly on x86_32 and x86_64.

mkfs.cramfs.c:211: warning: pointer targets in passing argument 2 of 'MD5Update' differ in signedness
mkfs.cramfs.c:336: warning: format '%u' expects type 'unsigned int', but argument 4 has type 'size_t'
mkfs.cramfs.c:355: warning: pointer targets in assignment differ in signedness
mkfs.cramfs.c:448: warning: pointer targets in passing argument 1 of '__builtin___strncpy_chk' differ in signedness
mkfs.cramfs.c:448: warning: pointer targets in passing argument 1 of '__strncpy_ichk' differ in signedness
mkfs.cramfs.c:450: warning: pointer targets in passing argument 1 of '__builtin___strncpy_chk' differ in signedness
mkfs.cramfs.c:450: warning: pointer targets in passing argument 1 of '__strncpy_ichk' differ in signedness
mkfs.cramfs.c:490: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
mkfs.cramfs.c:620: warning: pointer targets in passing argument 1 of 'compress' differ in signedness
mkfs.cramfs.c:620: warning: pointer targets in passing argument 3 of 'compress' differ in signedness
mkfs.cramfs.c:671: warning: pointer targets in passing argument 3 of 'do_compress' differ in signedness
mkfs.cramfs.c:824: warning: format '%Ld' expects type 'long long int', but argument 4 has type 'loff_t'
mkfs.cramfs.c:872: warning: format '%d' expects type 'int', but argument 3 has type 'ssize_t'
mkfs.cramfs.c:880: warning: format '%d' expects type 'int', but argument 3 has type 'ssize_t'
mkfs.cramfs.c:885: warning: format '%d' expects type 'int', but argument 3 has type 'long unsigned int'
mkfs.cramfs.c:889: warning: pointer targets in passing argument 2 of 'crc32' differ in signedness
mkfs.cramfs.c:896: warning: format '%Ld' expects type 'long long int', but argument 4 has type 'loff_t'
mkfs.cramfs.c:896: warning: format '%d' expects type 'int', but argument 5 has type 'ssize_t'
mkfs.cramfs.c:909: warning: format '%d' expects type 'int', but argument 4 has type 'ssize_t'
mkfs.cramfs.c:909: warning: format '%d' expects type 'int', but argument 5 has type 'ssize_t'

Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-10-11 01:22:14 +02:00
Randy Dunlap e30cb0ed72 mkfs.minix: clean up gcc warnings
* clean up code, gcc warnings
  (try compilation with "-Wall -Wp,-D_FORTIFY_SOURCE=2")

Builds cleanly on x86_32 and x86_64.

mkfs.minix.c:595: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-10-11 00:30:06 +02:00
Randy Dunlap 5f8416478d fsck.cramfs: clean up gcc warnings
* clean up code, gcc warnings
  (try compilation with "-Wall -Wp,-D_FORTIFY_SOURCE=2")

Builds cleanly on x86_32 and x86_64.

fsck.cramfs.c:235: warning: ignoring return value of 'read', declared with attribute warn_unused_result

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
2007-10-03 23:08:34 +02:00
Rajeev V. Pillai 2b00dd6d54 pg: fix segfault on search
Run pg(1) and type '/<CR>' which is supposed to forward search for the
previously remembered search string. pg(1) will segfault after printing
"No remembered search string:".

Signed-off-by: Rajeev V. Pillai <rajeevvp@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-10-03 22:39:27 +02:00
Karel Zak bf928360f2 build-sys: remove hardcoded _GNU_SOURCE
We have AC_GNU_SOURCE, so we needn't any extra hardcoded _GNU_SOURCE.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-09-20 00:57:01 +02:00
Li Zefan 45be3f7d8d blockdev: add missing description about option --report in manpage
The manpage does not mention the option --report.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
2007-09-19 23:14:09 +02:00
Benno Schulenberg 65b27d3669 po: gettextizing some overlooked messages.
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>
2007-08-14 14:46:28 +02:00
Karel Zak a512390d92 mkfs: remove nonsense from man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-08-02 14:23:38 +02:00
Karel Zak 1dea05a811 blockdev: use LU and LLU for BLKGETSIZE and BLKGETSIZE64
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>
2007-08-01 15:47:33 +02:00
Karel Zak 3281d4268a blockdev: fix "blockdev --getsz" for large devices
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>
2007-08-01 15:06:18 +02:00
Matthias Koenig 2018629905 disk-utils: let mkfs tools open with O_EXCL
Let mkswap, mkfs.bfs, mkfs.minix open with O_EXCL if
used on block devices to prevent writing to the device
even if they are busy (mounted).

Unfortunately, O_EXCL has zero effect for 2.4 kernels where
in-kernel code doesn't use O_EXCL-like access locks. (Tested
on RHEL3.)

Signed-off-by: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-27 13:39:29 +02:00
Karel Zak 8e522bb7e9 remove hardcoded package name from some utils
We have PACKAGE_STRING in config.h that includes package name and
version. It's better to use this macro that hardcoded strings.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-27 12:12:00 +02:00
Karel Zak f88c89db4f mkswap: fix signedness problems and remove obsolete code
The UUID is unsigned char *

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-25 17:18:57 +02:00
Matthias Koenig 30294a2fe8 mkswap: default to V1 in any case
mkswap(8) enforces to use v0 swap format when pagesize > 16kB.
(use case might be ppc64 with CONFIG_PPC_64K_PAGES).

As version 0 swap is not supported anymore by recent kernels, the
behaviour in this case is rather strange.

Here is a testcase:

for i in 4 8 16 32 64; do mkswap -p `expr $i \* 1024` ./swap.file; done
Setting up swapspace version 1, size = 4294963 kB

Using user-specified page size 8192, instead of the system values
4096/4096
Setting up swapspace version 1, size = 4294959 kB

Using user-specified page size 16384, instead of the system values
4096/4096
Setting up swapspace version 1, size = 4294950 kB

Using user-specified page size 32768, instead of the system values
4096/4096
Setting up swapspace version 0, size = 4294934 kB

Using user-specified page size 65536, instead of the system values
4096/4096
Setting up swapspace version 0, size = 4294901 kB

Signed-off-by: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-24 14:59:32 +02:00
Karel Zak 86d62711a9 man pages: add "AVAILABILITY" section
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-07-03 01:17:04 +02:00
Karel Zak a424171cd1 blockdev: cleanup usage() and update man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-06-29 12:06:58 +02:00
Karel Zak c2a1e78808 blockdev: add BLKFRAGET/BLKFRASET ioctls
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>
2007-06-29 11:38:54 +02:00
Karel Zak 94ed908c8d mkfs.cramfs: cleanup HAVE_ macros usage
It's bad to use any HAVE_* macros for anything other than
for build-system (autotools) stuff.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-06-14 13:55:37 +02:00
Matthias Koenig 766dd75716 disk-utils: fix libuuid usage in mkswap
Fix libuuid usage in mkswap.

Signed-off-by: Matthias Koenig <mkoenig@suse.de>
2007-05-16 23:55:23 +02:00
Stepan Kasal 2984313a46 build-sys: do not build convenience libraries in lib/
Build lib/*.c individually for each project which uses it, so that the
right set of flags is applied each time.

Signed-off-by: Stepan Kasal <skasal@redhat.com>
2007-05-16 11:43:29 +02:00
Karel Zak 2bfcd20b8d mkfs.cramfs: fix a way how mkfs works with empty files
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-02-27 16:49:25 +01:00
Karel Zak 3e52b13e91 mkfs.cramfs: remove hardcoded limit for directories
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-02-27 16:31:21 +01:00
Karel Zak 3e18b040af mkswap: automatically add selinux label to swapfile
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-02-08 15:22:37 +01:00
Karel Zak 8abb4c2e00 mkswap: avoid mkswap usage on already mounted device
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-02-07 10:32:02 +01:00
Karel Zak 6b9a290adf mkswap: gcc happy: unsigned long usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-02-07 10:10:22 +01:00
Karel Zak 7ac3b5b8e3 Clean up pagesize/PAGE_SIZE usage.
Now all code in util-linux uses sysconf(_SC_PAGESIZE) that is standardized and
preferred way of querying page size. The asm/page.h file is not included to the
code anymore. (This patch doesn't change mount's FS detection code which will
be removed later).

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-02-06 11:35:15 +01:00
Karel Zak 3f88ee9731 raw: move the raw command to /sbin
The raw command could be used from udev scripts.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-01-26 20:01:39 +01:00
Karel Zak 34ab1590bd raw: don't accept raw0 as a target name
The raw0 is rawctl and cannot be used as a normal raw device. The patch
also enlarge range of <N> for raw<N> and improve the query mode.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-01-26 19:55:41 +01:00
Karel Zak 69616d88d4 raw: update man page (about dd and O_DIRECT)
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-01-25 11:22:42 +01:00
Karel Zak 562218e6ea build-sys: add missing files
This patch add all missing headers, man pages and README files to automake
stuff and "make dist-gzip" produces useful tarball now.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-01-04 11:57:07 +01:00
Karel Zak 8eeb575c0d build-sys: remove generated autotools stuff from git
The generated autotools stuff shouldn't be maintained by SCM. After check out
from git use ./autogen.sh. For more details see README.devel.

Signed-off-by: Karel Zak <kzak@redhat.com>
2007-01-03 22:20:44 +01:00
Karel Zak cf6d7faebb Imported from util-linux-2.13-pre6 tarball. 2006-12-07 00:27:13 +01:00
Karel Zak 19922f22a1 Imported from util-linux-2.13-pre5 tarball. 2006-12-07 00:27:10 +01:00
Karel Zak ca3ea756e7 Imported from util-linux-2.13-pre4 tarball. 2006-12-07 00:27:06 +01:00
Karel Zak 9cb689775c Imported from util-linux-2.13-pre3 tarball. 2006-12-07 00:27:03 +01:00
Karel Zak baf39af15b Imported from util-linux-2.13-pre2 tarball. 2006-12-07 00:26:58 +01:00
Karel Zak 48d7b13a1e Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
Karel Zak bf3baa9907 Imported from util-linux-2.12p tarball. 2006-12-07 00:26:33 +01:00
Karel Zak 756bfd018e Imported from util-linux-2.12o tarball. 2006-12-07 00:26:31 +01:00
Karel Zak b22550fa15 Imported from util-linux-2.12k tarball. 2006-12-07 00:26:26 +01:00
Karel Zak d26aa358f4 Imported from util-linux-2.12h tarball. 2006-12-07 00:26:19 +01:00
Karel Zak 2cccd0ff2b Imported from util-linux-2.12d tarball. 2006-12-07 00:26:18 +01:00
Karel Zak c129767e06 Imported from util-linux-2.12b tarball. 2006-12-07 00:26:16 +01:00
Karel Zak d03dd60840 Imported from util-linux-2.12a tarball. 2006-12-07 00:26:14 +01:00
Karel Zak df1dddf9ff Imported from util-linux-2.12 tarball. 2006-12-07 00:26:12 +01:00
Karel Zak 95f1bdeee4 Imported from util-linux-2.11x tarball. 2006-12-07 00:26:05 +01:00
Karel Zak 0e6f4a203d Imported from util-linux-2.11v tarball. 2006-12-07 00:26:02 +01:00
Karel Zak f0c8eda12c Imported from util-linux-2.11u tarball. 2006-12-07 00:26:00 +01:00
Karel Zak 63cccae468 Imported from util-linux-2.11t tarball. 2006-12-07 00:25:58 +01:00
Karel Zak a2c5f3cadc Imported from util-linux-2.11r tarball. 2006-12-07 00:25:56 +01:00
Karel Zak 1d4ad1decc Imported from util-linux-2.11q tarball. 2006-12-07 00:25:54 +01:00
Karel Zak ffc4374869 Imported from util-linux-2.11o tarball. 2006-12-07 00:25:53 +01:00
Karel Zak 612721dba8 Imported from util-linux-2.11n tarball. 2006-12-07 00:25:52 +01:00
Karel Zak e8f2641919 Imported from util-linux-2.11m tarball. 2006-12-07 00:25:49 +01:00
Karel Zak 364cda4857 Imported from util-linux-2.11f tarball. 2006-12-07 00:25:48 +01:00
Karel Zak c07ebfa1e0 Imported from util-linux-2.11b tarball. 2006-12-07 00:25:46 +01:00
Karel Zak 66ee8158b6 Imported from util-linux-2.10s tarball. 2006-12-07 00:25:44 +01:00
Karel Zak 22853e4a82 Imported from util-linux-2.10m tarball. 2006-12-07 00:25:43 +01:00
Karel Zak eb63b9b8f4 Imported from util-linux-2.10f tarball. 2006-12-07 00:25:41 +01:00
Karel Zak 7eda085c41 Imported from util-linux-2.9v tarball. 2006-12-07 00:25:39 +01:00
Karel Zak 5c36a0eb7c Imported from util-linux-2.9i tarball. 2006-12-07 00:25:37 +01:00
Karel Zak 2b6fc908bc Imported from util-linux-2.8 tarball. 2006-12-07 00:25:35 +01:00
Karel Zak fd6b7a7ffc Imported from util-linux-2.7.1 tarball. 2006-12-07 00:25:34 +01:00
Karel Zak 726f69e29c Imported from util-linux-2.5 tarball. 2006-12-07 00:25:33 +01:00
Karel Zak 6dbe3af945 Imported from util-linux-2.2 tarball. 2006-12-07 00:25:32 +01:00