summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2010-06-01taskset: move NR_CPUS determination to lib/cpuset.cKarel Zak1-1/+40
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-01lib: add fallback for libc (uClibc) without CPU_ALLOCKarel Zak2-1/+37
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-01taskset: use libc based cpu_set_tKarel Zak1-109/+106
The glibc already supports dynamically allocated CPU sets. We don't have to maintains our private non-compatible implementation. Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-01tests: add cpuset regression testKarel Zak2-1/+72
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-06-01taskset: move bitmap routines to lib/cpuset.cKarel Zak1-0/+241
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-05-07cfdisk: support non-ascii characters in inputKarel Zak1-0/+34
On Sat, Apr 03, 2010 at 12:58:48PM +0000, Jorge wrote: > When you want to write changes to disk you're asked for a > confirmation, like this one: > > Are you sure you want to write the partition table to disk? (yes > or no) > > There is no problem on the English version, but when you launch the > program in Spanish you get this: > > ¿Está seguro de que desea escribir la tabla de particiones en el > disco? > (sí o no): > > You can't type the "í" character. Trying to do so will end in no > input at all. That is, typing in my keyboard "´" then "i" leads to > nothing. So you can't write changes to disk, and you must launch the > program in English for it to operate. Reported-by: Jorge <yo@jorgesuarezdelis.name> Addresses: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/205327 Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-27mount: revert ugly ENOMEDIUM supportKarel Zak1-24/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-30lib: add strtosize() functionKarel Zak2-1/+151
This function int strtosize(const char *str, uintmax_t *res) supports {K,M,G,T,E,P}iB and {K,M,G,T,E,P}B suffixes. Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-16lib: fix blkdev_find_size()Karel Zak1-4/+16
echo l | fdisk/fdisk /dev/zero FYI that however now spins forever doing: offset=3074457345618258603) at ../lib/blkdev.c:31 at ../lib/blkdev.c:151 at ../lib/blkdev.c:161 Reported-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-16cal: factor out and update multibyte alignment codePádraig Brady1-0/+254
* include/mbsalign.h: New module interface * lib/mbsalign.c: Updated implementation synced from coreutils * include/Makefile.am: Add mbsalign.h * misc-utils/Makefile.am: Make cal dependent on mbsalign module * misc-utils/cal.c: Call mbsalign() [kzak@redhat.com: - use min() macro from c.h] Signed-off-by: Pádraig Brady <P@draigBrady.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-16lib: avoid compilation failure on rawhideJim Meyering1-0/+1
* lib/blkdev.c: Include <sys/stat.h>, for use of S_ISREG.
2010-03-15mount: report ambivalent FS detection, improve brute force detectionKarel Zak1-9/+24
The ambivalent probing result should be properly reported and user should be informed that the problem is possible to bypass by "-t <type>" or resolved by wipefs(8). The mount(8) command uses a brute force stage (calls mount(2) for all /{proc,etc}/fylesystems) if there is not any other way how to detect the filesystem type. The brute force stage should not be restricted by libblkid. It's possible that libblkid is not able to detect slightly corrupted filesystem, but kernel is able to mount such filesystem. Note that the brute force stage should not be used if libblkid returns ambivalent probing result. In this case user's intervention is required (e.g. mount -t <type>). Reported-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-11lib: use fstat() as fallback in blkdev_get_size()Karel Zak1-0/+9
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-10lib: add mangle.c for mtab (fstab or swaps) encodingKarel Zak2-1/+118
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-10liblkid: move getsize.c code to lib/Karel Zak1-8/+79
.. and cleanup blkdev_get_size() usage in libblkid. Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-12build-sys: remove duplicate #includesKarel Zak1-1/+0
$ make checkincludes fsck/fsck.c: errno.h is included more than once. lib/canonicalize.c: string.h is included more than once. shlibs/blkid/src/blkidP.h: stdio.h is included more than once. shlibs/blkid/src/devname.c: string.h is included more than once. shlibs/blkid/src/devno.c: string.h is included more than once. Signed-off-by: Karel Zak <kzak@redhat.com>
2009-12-10lib: bug (typo) in function MD5Final()Karel Zak1-1/+1
On Wed, Dec 09, 2009 at 10:08:38PM +0000, Jochen Voss wrote: > while experimenting with coccinelle, I accidentally found what I > believe is a bug in util-linux-ng release 2.17-rc2 (downloaded > today). The problem is the following code in lib/md5.c (around line > 153): > > void MD5Final(unsigned char digest[16], struct MD5Context *ctx) > { > [...] > memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ > } > > The third argument of memset should probably be the size of 'struct > MD5Context' instead of the size of the pointer. So my guess is > that the memset line should be > > memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ > > instead. I don't know whether this actually causes a problem, > but the comment makes it seem possible that it does. Note, this typo does not have any impact on the utils in the util-linux-ng project, because we don't use MD5 for any security sensitive data or cryptographic stuff. The typo also does not have any impact to the final MD5 hashes. Reported-by: Jochen Voss <voss@seehuhn.de> Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-27build-sys: add HAVE_LIBBLKID_INTERNALKarel Zak1-4/+4
It's better to use one macro for all situations where we depends on in-tree (internal) libblkid. Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-26mount: and libblkid: covert /dev/dm-N to /dev/mapper/<name>Karel Zak1-4/+44
* mount(8) uses private device-mapper names in mtab * libblkid returns private device-mapper names when evaluate udev /dev/disk-by symlinks. * on systems where DM is fully integrated with udev the /dev/mapper/<name> files are symlinks to /dev/dm-N. It means we need a special care to hide private device-mapper names. Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-22libblkid: use BLKSSZGET for GPT sectorsKarel Zak1-1/+5
The current implementation uses fixed sector size (512 bytes), that's wrong. UEFI standard requires real logical sector size -- it means BLKSSZGET for Linux. The size of GPT header is not static, but whole sector is allocated for the header. In theory the HeaderSize field could be greater than sizeof(struct gpt_header). It means we have to read whole sector with the header, because the header crc32 checksum is counted according to HeaderSize. Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-14lib: import whole ismounted.c code from e2fsprogsKarel Zak1-70/+232
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-05Merge branch 'for_upstream' of ↵Karel Zak1-3/+0
git://git.kernel.org/pub/scm/utils/util-linux-ng/tytso/util-linux-ng
2009-10-03lib: fix file descriptor leak in is_mounted()Theodore Ts'o1-3/+0
Remove an extraneous fopen() that leaks memory and a file descriptor. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-30lib: fix lib/Makefile.am (remove pttype.c)Karel Zak1-1/+0
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-09-29lib: remove pttype.cKarel Zak2-293/+1
The libblkid library supports partition tables detection now. Signed-off-by: Karel Zak <kzak@redhat.com>
2009-09-16lib: add a generic crc32()Karel Zak1-0/+116
This is public domain implementation, based on static crc32_table[]. This implementation is used on may places (libparted, FreeBSD kernel, PostgreSQL, ...). The Linux kernel uses on-the-fly generated and allocated tables. That's useless in shared libraries. Signed-off-by: Karel Zak <kzak@redhat.com>
2009-09-16libblkid: use the new API in whole u-l-ngKarel Zak1-3/+6
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-05-29mount: use TAG parsing function from libblkidKarel Zak1-22/+4
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-05-22mount: (and fsck) remove libvolume_id supportKarel Zak1-130/+3
The libvolume_id is deprecated in favor of libblkid. The libblkid from u-l-ng provides the same functionality as libvolume_id. Signed-off-by: Karel Zak <kzak@redhat.com>
2009-05-11build-sys: fix blkid.h include for old e2fsprogsKarel Zak1-0/+4
When building util-linux-ng-2.15, I get this: ../lib/fsprobe.c:10:19: error: blkid.h: No such file or directory Unfortunately, the blkid.pc uses -I${includedir}/blkidi since e2fsprogs v1.41.2. The old versions use -I${includedir} only. Reported-by: Robert Schwebel <r.schwebel@pengutronix.de> Signed-off-by: Karel Zak <kzak@redhat.com>
2009-04-29blkid: rename blkid_evaluate_spec to blkid_evaluate_tagKarel Zak1-7/+7
"SPEC" is usually used in mount(8) as a generic term for device name or tag (LABEL, UUID). The function blkid_evaluate_* works with TAGs only. Signed-off-by: Karel Zak <kzak@redhat.com>
2009-04-20lib: do not include <linux/fd.h> in ismounted.cAurelien Jarno1-1/+0
<linux/fd.h> is included for no reason in lib/ismounted.c. This obviously breaks on non-Linux systems. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-03-16lib: fsprobe - fix gcc warningKarel Zak1-1/+1
lib/fsprobe.c: In function ‘fsprobe_get_fstype_by_devname’: lib/fsprobe.c:243: warning: return discards qualifiers from pointer target type Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-12lib: wholedisk - extend API, add test programKarel Zak3-16/+40
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-12lib: pttype - extend the API to work with file descriptorsKarel Zak1-7/+15
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-12lib: pttype: fix DOS detectionKarel Zak1-7/+7
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-12lib: pttype: add BSD subpartitions supportKarel Zak1-2/+26
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-12lib: add pttype.c for PT types detectionKarel Zak3-2/+264
This is a small fragment from libdisk (from xfsprogs). The final solution will be to move the library to util-linux-ng. Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-11lib: add is_whole_disk() from fdisk codeKarel Zak1-0/+31
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-03lib: fix fsprobe wrapper (const char * is nonsense)Karel Zak1-21/+21
The fsprobe_ functions return newly allocated strings. Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-03lib: gcc warning in fix fsprobeKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18build-sys: add fsck binary to .gitignoreKarel Zak1-0/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18tests: add fsck:ismounted reg.testKarel Zak1-4/+7
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18lib: add test_ismounted for regression testKarel Zak3-6/+8
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18fsck: cosmetic changes (NLS, paths, ...)Karel Zak1-3/+4
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18lib: make open_device() optional in fsprobe.cKarel Zak1-0/+2
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-18fsck: move fsck from e2fsprogs to util-linux-ngKarel Zak1-0/+199
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-17build-sys: use pkg-config for blkid and volume_idKarel Zak1-1/+1
It seems that blkid.pc from e2fsprogs has been fixed: $ pkg-config --libs blkid -lblkid and the pkg-config does not return any other extra libraries (such -luuid or -ldevmapper). Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-17mount: generic blkid/volume_id wrapper, use blkid_evaluate_*Karel Zak1-0/+388
* moves the generic libblkid/libvolume_id wrapper (fsprobe.c) from mount/ to lib/. We'll use the wrapper in cfdisk and fsck. The wrapper supports: - obsolete volume_id (udev) - obsolete libblkid (e2fsprogs) - libblkid (util-linux-ng) * mount, umount and swapon when linked against the new libblkid use - low-level probing code to read LABEL, UUID or FSTYPE from a device - high-level blkid_evaluate_spec() to convert LABEL/UUID to devname Signed-off-by: Karel Zak <kzak@redhat.com>
2009-02-11mount: move realpath.c code to lib/Karel Zak1-0/+152
Signed-off-by: Karel Zak <kzak@redhat.com>