From f0bef3ca0fed141eff28f972c03c3a10ae01fcaf Mon Sep 17 00:00:00 2001 From: Hajime Taira Date: Thu, 13 May 2010 13:23:49 +0200 Subject: fsfreeze: new command [kzak@redhat.com: - cleanup - add long options - add note about DM to the man page - use err.h and nls.h] Signed-off-by: Hajime Taira Signed-off-by: Karel Zak --- include/blkdev.h | 5 ++ sys-utils/.gitignore | 1 + sys-utils/Makefile.am | 4 +- sys-utils/fsfreeze.8 | 75 ++++++++++++++++++++++++++++ sys-utils/fsfreeze.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 215 insertions(+), 2 deletions(-) create mode 100644 sys-utils/fsfreeze.8 create mode 100644 sys-utils/fsfreeze.c diff --git a/include/blkdev.h b/include/blkdev.h index 34e4e924..0eea01cd 100644 --- a/include/blkdev.h +++ b/include/blkdev.h @@ -45,6 +45,11 @@ #define BLKPBSZGET _IO(0x12,123) #endif +#ifndef FIFREEZE +#define FIFREEZE _IOWR('X', 119, int) /* Freeze */ +#define FITHAW _IOWR('X', 120, int) /* Thaw */ +#endif + #ifndef HDIO_GETGEO # ifdef __linux__ # define HDIO_GETGEO 0x0301 diff --git a/sys-utils/.gitignore b/sys-utils/.gitignore index 7985d7a5..f82d1072 100644 --- a/sys-utils/.gitignore +++ b/sys-utils/.gitignore @@ -4,6 +4,7 @@ cytune dmesg fallocate flock +fsfreeze i386.8 ia64.8 ipcmk diff --git a/sys-utils/Makefile.am b/sys-utils/Makefile.am index 76828cc1..957fd6e8 100644 --- a/sys-utils/Makefile.am +++ b/sys-utils/Makefile.am @@ -10,12 +10,12 @@ dist_man_MANS = flock.1 ipcrm.1 ipcs.1 ipcmk.1 renice.1 setsid.1 \ if LINUX bin_PROGRAMS += dmesg -sbin_PROGRAMS += ctrlaltdel +sbin_PROGRAMS += ctrlaltdel fsfreeze usrbin_exec_PROGRAMS += cytune setarch lscpu usrsbin_exec_PROGRAMS += ldattach tunelp rtcwake dist_man_MANS += dmesg.1 ctrlaltdel.8 cytune.8 setarch.8 \ - ldattach.8 lscpu.1 tunelp.8 rtcwake.8 + ldattach.8 lscpu.1 tunelp.8 rtcwake.8 fsfreeze.8 endif cytune_SOURCES = cytune.c cyclades.h diff --git a/sys-utils/fsfreeze.8 b/sys-utils/fsfreeze.8 new file mode 100644 index 00000000..4408bddd --- /dev/null +++ b/sys-utils/fsfreeze.8 @@ -0,0 +1,75 @@ +.\" -*- nroff -*- +.TH FSFREEZE 8 "May 2010" +.SH NAME +fsfreeze \- suspend access to an filesystem (Linux Ext3/4, ReiserFS, JFS, XFS). +.SH SYNOPSIS +.B fsfreeze +.RB \-f +.I mountpoint + +.B fsfreeze +.RB \-u +.I mountpoint + +.SH DESCRIPTION +.B fsfreeze +suspends and resumes access to an filesystem +.PP +.B fsfreeze +halts new access to the filesystem and creates a stable image on disk. +.B fsfreeze +is intended to be used with hardware RAID devices that support the creation +of snapshots. +.PP +.B fsfreeze +is unncessary for +.B device-mapper +devices. The device-mapper (and LVM) +automatically freezes filesystem on the device when a snapshot creation is requested. +For more details see the +.BR dmsetup (8) +man page. +.PP +The +.I mount-point +argument is the pathname of the directory where the filesystem +is mounted. +The filesystem must be mounted to be frozen (see +.BR mount (8)). +.SH OPTIONS +.IP "\fB\-h, \-\-help\fP" +Print help and exit. +.IP "\fB\-f, \-\-freeze\fP" +This option requests the specified a filesystem to be frozen from new +modifications. When this is selected, all ongoing transactions in the +filesystem are allowed to complete, new write system calls are halted, other +calls which modify the filesystem are halted, and all dirty data, metadata, and +log information are written to disk. Any process attempting to write to the +frozen filesystem will block waiting for the filesystem to be unfrozen. + +Note that even after freezing, the on-disk filesystem can contain +information on files that are still in the process of unlinking. +These files will not be unlinked until the filesystem is unfrozen +or a clean mount of the snapshot is complete. +.IP "\fB\-u, \-\-unfreeze\fP +This option is used to un-freeze the filesystem and allow operations to +continue. Any filesystem modifications that were blocked by the freeze are +unblocked and allowed to complete. +.SH AUTHOR +.PP +Written by Hajime Taira. +.SH NOTES +.PP +This man page based on xfs_freeze. +One of +.B \-f +or +.B \-u +must be supplied to +.BR fsfreeze . +.SH SEE ALSO +.BR mount (8) +.SH AVAILABILITY +The fsfreeze command is part of the util-linux-ng package and is available from +ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. + diff --git a/sys-utils/fsfreeze.c b/sys-utils/fsfreeze.c new file mode 100644 index 00000000..4ca6e5e2 --- /dev/null +++ b/sys-utils/fsfreeze.c @@ -0,0 +1,132 @@ +/* + * fsfreeze.c -- Filesystem freeze/unfreeze IO for Linux + * + * Copyright (C) 2010 Hajime Taira + * Masatake Yamato + * + * This program is free software. You can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation: either version 1 or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "blkdev.h" +#include "nls.h" +#include "c.h" + +static int freeze_f(int fd) +{ + return ioctl(fd, FIFREEZE, 0); +} + +static int unfreeze_f(int fd) +{ + return ioctl(fd, FITHAW, 0); +} + +static void __attribute__((__noreturn__)) usage(FILE *out) +{ + fprintf(out, _("Usage: %s [options] \n\nOptions:\n"), + program_invocation_short_name); + + fprintf(out, _( + " -h, --help this help\n" + " -f, --freeze freeze the filesystem\n" + " -u, --unfreeze unfreeze the filesystem\n")); + + fprintf(out, _("\nFor more information see fsfreeze(8).\n")); + + exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); +} + +int main(int argc, char **argv) +{ + int fd = -1, c; + int freeze = -1, rc = EXIT_FAILURE; + char *path; + struct stat sb; + + struct option longopts[] = { + { "help", 0, 0, 'h' }, + { "freeze", 0, 0, 'f' }, + { "unfreeze", 0, 0, 'u' }, + { NULL, 0, 0, 0 } + }; + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + while ((c = getopt_long(argc, argv, "hfu", longopts, NULL)) != -1) { + switch(c) { + case 'h': + usage(stdout); + break; + case 'f': + freeze = TRUE; + break; + case 'u': + freeze = FALSE; + break; + default: + usage(stderr); + break; + } + } + + if (freeze == -1) + errx(EXIT_FAILURE, _("no action specified")); + if (optind == argc) + errx(EXIT_FAILURE, _("no filename specified")); + path = argv[optind++]; + + if (optind != argc) { + warnx(_("unexpected number of arguments")); + usage(stderr); + } + + fd = open(path, O_RDONLY); + if (fd < 0) + err(EXIT_FAILURE, _("%s: open failed"), path); + + if (fstat(fd, &sb) == -1) { + warn(_("%s: fstat failed"), path); + goto done; + } + + if (!S_ISDIR(sb.st_mode)) { + warnx(_("%s: is not a directory"), path); + goto done; + } + + if (freeze) { + if (freeze_f(fd)) { + warn(_("%s: freeze failed"), path); + goto done; + } + } else { + if (unfreeze_f(fd)) { + warn(_("%s: unfreeze failed"), path); + goto done; + } + } + + rc = EXIT_SUCCESS; +done: + if (fd >= 0) + close(fd); + return rc; +} + -- cgit v1.2.3 From fd1ee3b92e08b17a67099371e647da54632b2f8a Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 14 May 2010 13:04:50 +0200 Subject: fallocate: check for number of arguments Signed-off-by: Karel Zak --- sys-utils/fallocate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c index e41643a2..d1f43c24 100644 --- a/sys-utils/fallocate.c +++ b/sys-utils/fallocate.c @@ -122,6 +122,11 @@ int main(int argc, char **argv) fname = argv[optind++]; + if (optind != argc) { + warnx(_("unexpected number of arguments")); + usage(stderr); + } + fd = open(fname, O_WRONLY|O_CREAT, 0644); if (fd < 0) err(EXIT_FAILURE, _("%s: open failed"), fname); -- cgit v1.2.3 From 192f1e15793d1f0f161970fdec8ec2f802c84e9f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 17 May 2010 23:34:50 +0200 Subject: libblkid: improve MD 1.0 detection, add UUID_SUB Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=592958 Signed-off-by: Karel Zak --- shlibs/blkid/src/superblocks/linux_raid.c | 70 ++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/shlibs/blkid/src/superblocks/linux_raid.c b/shlibs/blkid/src/superblocks/linux_raid.c index 6f823f15..d25b3959 100644 --- a/shlibs/blkid/src/superblocks/linux_raid.c +++ b/shlibs/blkid/src/superblocks/linux_raid.c @@ -34,15 +34,68 @@ struct mdp0_super_block { uint32_t set_uuid3; }; +/* + * Version-1, little-endian. + */ struct mdp1_super_block { - uint32_t magic; - uint32_t major_version; - uint32_t feature_map; - uint32_t pad0; - uint8_t set_uuid[16]; - uint8_t set_name[32]; + /* constant array information - 128 bytes */ + uint32_t magic; /* MD_SB_MAGIC: 0xa92b4efc - little endian */ + uint32_t major_version; /* 1 */ + uint32_t feature_map; /* 0 for now */ + uint32_t pad0; /* always set to 0 when writing */ + + uint8_t set_uuid[16]; /* user-space generated. */ + unsigned char set_name[32]; /* set and interpreted by user-space */ + + uint64_t ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/ + uint32_t level; /* -4 (multipath), -1 (linear), 0,1,4,5 */ + uint32_t layout; /* only for raid5 currently */ + uint64_t size; /* used size of component devices, in 512byte sectors */ + + uint32_t chunksize; /* in 512byte sectors */ + uint32_t raid_disks; + uint32_t bitmap_offset; /* sectors after start of superblock that bitmap starts + * NOTE: signed, so bitmap can be before superblock + * only meaningful of feature_map[0] is set. + */ + + /* These are only valid with feature bit '4' */ + uint32_t new_level; /* new level we are reshaping to */ + uint64_t reshape_position; /* next address in array-space for reshape */ + uint32_t delta_disks; /* change in number of raid_disks */ + uint32_t new_layout; /* new layout */ + uint32_t new_chunk; /* new chunk size (bytes) */ + uint8_t pad1[128-124]; /* set to 0 when written */ + + /* constant this-device information - 64 bytes */ + uint64_t data_offset; /* sector start of data, often 0 */ + uint64_t data_size; /* sectors in this device that can be used for data */ + uint64_t super_offset; /* sector start of this superblock */ + uint64_t recovery_offset;/* sectors before this offset (from data_offset) have been recovered */ + uint32_t dev_number; /* permanent identifier of this device - not role in raid */ + uint32_t cnt_corrected_read; /* number of read errors that were corrected by re-writing */ + uint8_t device_uuid[16]; /* user-space setable, ignored by kernel */ + uint8_t devflags; /* per-device flags. Only one defined...*/ + uint8_t pad2[64-57]; /* set to 0 when writing */ + + /* array state information - 64 bytes */ + uint64_t utime; /* 40 bits second, 24 btes microseconds */ + uint64_t events; /* incremented when superblock updated */ + uint64_t resync_offset; /* data before this offset (from data_offset) known to be in sync */ + uint32_t sb_csum; /* checksum upto dev_roles[max_dev] */ + uint32_t max_dev; /* size of dev_roles[] array to consider */ + uint8_t pad3[64-32]; /* set to 0 when writing */ + + /* device state information. Indexed by dev_number. + * 2 bytes per device + * Note there are no per-device state flags. State information is rolled + * into the 'roles' value. If a device is spare or faulty, then it doesn't + * have a meaningful role. + */ + uint16_t dev_roles[0]; /* role in array, or 0xffff for a spare, or 0xfffe for faulty */ }; + #define MD_RESERVED_BYTES 0x10000 #define MD_SB_MAGIC 0xa92b4efc @@ -115,8 +168,13 @@ static int probe_raid1(blkid_probe pr, off_t off) return -1; if (le32_to_cpu(mdp1->major_version) != 1) return -1; + if (le64_to_cpu(mdp1->super_offset) != off >> 9) + return -1; if (blkid_probe_set_uuid(pr, (unsigned char *) mdp1->set_uuid) != 0) return -1; + if (blkid_probe_set_uuid_as(pr, + (unsigned char *) mdp1->device_uuid, "UUID_SUB") != 0) + return -1; if (blkid_probe_set_label(pr, mdp1->set_name, sizeof(mdp1->set_name)) != 0) return -1; -- cgit v1.2.3 From c42063316f9e568593f9c915b12c1166b933c947 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 17 May 2010 23:45:13 +0200 Subject: libblkid: tiny change in debug output Use uint64_t rather than ssize_t for number of read bytes. Signed-off-by: Karel Zak --- shlibs/blkid/src/probe.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c index 89c59504..370ef133 100644 --- a/shlibs/blkid/src/probe.c +++ b/shlibs/blkid/src/probe.c @@ -103,6 +103,7 @@ #ifdef HAVE_ERRNO_H #include #endif +#include #include #include @@ -542,7 +543,7 @@ unsigned char *blkid_probe_get_buffer(blkid_probe pr, static void blkid_probe_reset_buffer(blkid_probe pr) { - ssize_t read_ct = 0, len_ct = 0; + uint64_t read_ct = 0, len_ct = 0; if (!pr || list_empty(&pr->buffers)) return; @@ -560,7 +561,8 @@ static void blkid_probe_reset_buffer(blkid_probe pr) } DBG(DEBUG_LOWPROBE, - printf("buffers summary: %jd bytes by %jd read() call(s)\n", + printf("buffers summary: %"PRIu64" bytes " + "by %"PRIu64" read() call(s)\n", len_ct, read_ct)); INIT_LIST_HEAD(&pr->buffers); -- cgit v1.2.3 From 66d8e050ca3c243094545ce8b0e4c53d54a11715 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 18 May 2010 12:13:48 +0200 Subject: libblkid: improve MD 0.90 detection We don't have to check for collision between partition table and RAID on all RAIDs. This problem is specific to MD, where underlying device could be a partition. The RAIDs like via, intel, ... always use whole-disks only. Signed-off-by: Karel Zak --- shlibs/blkid/src/partitions/partitions.c | 13 +++++++++++++ shlibs/blkid/src/superblocks/linux_raid.c | 31 +++++++++++++++++++----------- shlibs/blkid/src/superblocks/superblocks.c | 16 --------------- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/shlibs/blkid/src/partitions/partitions.c b/shlibs/blkid/src/partitions/partitions.c index c670cc18..5597181a 100644 --- a/shlibs/blkid/src/partitions/partitions.c +++ b/shlibs/blkid/src/partitions/partitions.c @@ -829,6 +829,19 @@ int blkid_probe_is_covered_by_pt(blkid_probe pr, end = (offset + size) >> 9; start = offset >> 9; + /* check if the partition table fits into the device */ + for (i = 0; i < nparts; i++) { + blkid_partition par = &ls->parts[i]; + + if (par->start + par->size > pr->size) { + DBG(DEBUG_LOWPROBE, printf("partition #%d overflows " + "device (off=%lu size=%lu)\n", + par->partno, par->start, par->size)); + goto done; + } + } + + /* check if the requested area is covered by PT */ for (i = 0; i < nparts; i++) { blkid_partition par = &ls->parts[i]; diff --git a/shlibs/blkid/src/superblocks/linux_raid.c b/shlibs/blkid/src/superblocks/linux_raid.c index d25b3959..41ef261a 100644 --- a/shlibs/blkid/src/superblocks/linux_raid.c +++ b/shlibs/blkid/src/superblocks/linux_raid.c @@ -106,6 +106,7 @@ static int probe_raid0(blkid_probe pr, off_t off) uint32_t ints[4]; uint8_t bytes[16]; } uuid; + uint32_t ma, mi, pa; if (pr->size < 0x10000) return -1; @@ -125,11 +126,9 @@ static int probe_raid0(blkid_probe pr, off_t off) uuid.ints[2] = swab32(mdp0->set_uuid2); uuid.ints[3] = swab32(mdp0->set_uuid3); } - if (blkid_probe_sprintf_version(pr, "%u.%u.%u", - le32_to_cpu(mdp0->major_version), - le32_to_cpu(mdp0->minor_version), - le32_to_cpu(mdp0->patch_version)) != 0) - return -1; + ma = le32_to_cpu(mdp0->major_version); + mi = le32_to_cpu(mdp0->minor_version); + pa = le32_to_cpu(mdp0->patch_version); } else if (be32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) { uuid.ints[0] = mdp0->set_uuid0; @@ -138,14 +137,24 @@ static int probe_raid0(blkid_probe pr, off_t off) uuid.ints[2] = mdp0->set_uuid2; uuid.ints[3] = mdp0->set_uuid3; } - if (blkid_probe_sprintf_version(pr, "%u.%u.%u", - be32_to_cpu(mdp0->major_version), - be32_to_cpu(mdp0->minor_version), - be32_to_cpu(mdp0->patch_version)) != 0) - return -1; + ma = be32_to_cpu(mdp0->major_version); + mi = be32_to_cpu(mdp0->minor_version); + pa = be32_to_cpu(mdp0->patch_version); } else - return -1; + return 1; + /* + * Check for collisions between RAID and partition table + */ + if ((S_ISREG(pr->mode) || blkid_probe_is_wholedisk(pr)) && + blkid_probe_is_covered_by_pt(pr, off, 0x200)) { + /* ignore this superblock, it's within any partition and + * we are working with whole-disk now */ + return 1; + } + + if (blkid_probe_sprintf_version(pr, "%u.%u.%u", ma, mi, pa) != 0) + return -1; if (blkid_probe_set_uuid(pr, (unsigned char *) uuid.bytes) != 0) return -1; if (blkid_probe_set_magic(pr, off, sizeof(mdp0->md_magic), diff --git a/shlibs/blkid/src/superblocks/superblocks.c b/shlibs/blkid/src/superblocks/superblocks.c index 1d952737..2a463c85 100644 --- a/shlibs/blkid/src/superblocks/superblocks.c +++ b/shlibs/blkid/src/superblocks/superblocks.c @@ -527,22 +527,6 @@ static int superblocks_safeprobe(blkid_probe pr, struct blkid_chain *chn) superblocks_copy_data(chn->data, sb); chn->idx = idx; - /* - * Check for collisions between RAID and partition table - */ - if (sb && sb->usage == BLKID_USAGE_RAID && - sb->magic_off > pr->size / 2 && - (S_ISREG(pr->mode) || blkid_probe_is_wholedisk(pr)) && - blkid_probe_is_covered_by_pt(pr, sb->magic_off, 0x200)) { - /* - * Ignore the result if the detected RAID superblock is - * within some existing partition (for example RAID on - * the last partition). - */ - blkid_probe_chain_reset_vals(pr, chn); - return 1; - } - /* * The RAID device could be partitioned. The problem are RAID1 devices * where the partition table is visible from underlaying devices. We -- cgit v1.2.3 From 90a2086e51cb7427ce5aff68da63afc289f81bec Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 18 May 2010 12:51:48 +0200 Subject: libblkid: cleanup superblocks_safeprobe() Signed-off-by: Karel Zak --- shlibs/blkid/src/superblocks/superblocks.c | 104 +++++------------------------ 1 file changed, 18 insertions(+), 86 deletions(-) diff --git a/shlibs/blkid/src/superblocks/superblocks.c b/shlibs/blkid/src/superblocks/superblocks.c index 2a463c85..caa169fa 100644 --- a/shlibs/blkid/src/superblocks/superblocks.c +++ b/shlibs/blkid/src/superblocks/superblocks.c @@ -71,7 +71,6 @@ static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn); static int superblocks_safeprobe(blkid_probe pr, struct blkid_chain *chn); -static void superblocks_free(blkid_probe pr, void *data); static int blkid_probe_set_usage(blkid_probe pr, int usage); @@ -156,23 +155,8 @@ const struct blkid_chaindrv superblocks_drv = { .has_fltr = TRUE, .probe = superblocks_probe, .safeprobe = superblocks_safeprobe, - .free_data = superblocks_free }; -/* - * Private chain data - * - * TODO: export this data by binary interface (see topology.c or partitions.c - * for more details) by blkid_probe_get_superblock() or so. - */ -struct blkid_struct_superblock { - blkid_loff_t magic_off; /* offset of the magic string */ - int usage; -}; - -/* TODO: move to blkid.h */ -typedef struct blkid_struct_superblock *blkid_superblock; - /** * blkid_probe_enable_superblocks: * @pr: probe @@ -311,39 +295,6 @@ int blkid_known_fstype(const char *fstype) return 0; } -/* init and returns private data */ -static blkid_superblock superblocks_init_data(blkid_probe pr, - struct blkid_chain *chn) -{ - DBG(DEBUG_LOWPROBE, printf("initialize superblocks binary data\n")); - - if (chn->data) - memset(chn->data, 0, - sizeof(struct blkid_struct_superblock)); - else { - chn->data = calloc(1, - sizeof(struct blkid_struct_superblock)); - if (!chn->data) - return NULL; - } - return chn->data; -} - -static void superblocks_free(blkid_probe pr, void *data) -{ - free(data); -} - -static blkid_superblock superblocks_copy_data(blkid_superblock dest, - blkid_superblock src) -{ - if (!src || !dest) - return NULL; - - memcpy(dest, src, sizeof(struct blkid_struct_superblock)); - return dest; -} - /* * The blkid_do_probe() backend. */ @@ -365,9 +316,6 @@ static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn) * is 1 byte */ goto nothing; - if (chn->binary) - superblocks_init_data(pr, chn); - i = chn->idx + 1; for ( ; i < ARRAY_SIZE(idinfos); i++) { @@ -472,44 +420,37 @@ nothing: */ static int superblocks_safeprobe(blkid_probe pr, struct blkid_chain *chn) { - blkid_superblock sb = NULL; - struct blkid_struct_superblock sb_buff; - struct blkid_prval vals[BLKID_NVALS_SUBLKS]; int nvals = BLKID_NVALS_SUBLKS; int idx = -1; int count = 0; int intol = 0; - int rc, bin_org = chn->binary; - - chn->binary = TRUE; + int rc; while ((rc = superblocks_probe(pr, chn)) == 0) { - if (blkid_probe_is_tiny(pr) && !count) { + if (blkid_probe_is_tiny(pr) && !count) /* floppy or so -- returns the first result. */ - chn->binary = bin_org; return 0; - } - if (!count) { - /* save the first result */ - nvals = blkid_probe_chain_copy_vals(pr, chn, vals, nvals); - idx = chn->idx; - if (chn->data) - sb = superblocks_copy_data(&sb_buff, chn->data); - } + count++; if (idinfos[chn->idx]->usage & (BLKID_USAGE_RAID | BLKID_USAGE_CRYPTO)) break; + if (!(idinfos[chn->idx]->flags & BLKID_IDINFO_TOLERANT)) intol++; - } - chn->binary = bin_org; + if (count == 1) { + /* save the first result */ + nvals = blkid_probe_chain_copy_vals(pr, chn, vals, nvals); + idx = chn->idx; + } + } if (rc < 0) return rc; /* error */ + if (count > 1 && intol) { DBG(DEBUG_LOWPROBE, printf("ERROR: superblocks chain: " @@ -520,19 +461,19 @@ static int superblocks_safeprobe(blkid_probe pr, struct blkid_chain *chn) if (!count) return 1; /* nothing detected */ - /* restore the first result */ - blkid_probe_chain_reset_vals(pr, chn); - blkid_probe_append_vals(pr, vals, nvals); - if (sb && chn->data) - superblocks_copy_data(chn->data, sb); - chn->idx = idx; + if (idx != -1) { + /* restore the first result */ + blkid_probe_chain_reset_vals(pr, chn); + blkid_probe_append_vals(pr, vals, nvals); + chn->idx = idx; + } /* * The RAID device could be partitioned. The problem are RAID1 devices * where the partition table is visible from underlaying devices. We * have to ignore such partition tables. */ - if (sb && sb->usage == BLKID_USAGE_RAID) + if (chn->idx >= 0 && idinfos[chn->idx]->usage & BLKID_USAGE_RAID) pr->prob_flags |= BLKID_PARTS_IGNORE_PT; return 0; @@ -551,10 +492,6 @@ int blkid_probe_set_magic(blkid_probe pr, blkid_loff_t offset, rc = blkid_probe_sprintf_value(pr, "SBMAGIC_OFFSET", "%llu", offset); } - if (!rc && chn->data) { - blkid_superblock sb = (blkid_superblock) chn->data; - sb->magic_off = offset; - } return rc; } @@ -588,11 +525,6 @@ static int blkid_probe_set_usage(blkid_probe pr, int usage) struct blkid_chain *chn = blkid_probe_get_chain(pr); char *u = NULL; - if (chn->data) { - blkid_superblock sb = (blkid_superblock) chn->data; - sb->usage = usage; - } - if (!(chn->flags & BLKID_SUBLKS_USAGE)) return 0; -- cgit v1.2.3 From 508e438b5604206108c9ba03f5323df49805f89c Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 18 May 2010 14:31:28 +0200 Subject: libblkid: probe for (non-linux) RAIDs on whole devices only Signed-off-by: Karel Zak --- shlibs/blkid/src/probe.c | 10 +++++++--- shlibs/blkid/src/superblocks/adaptec_raid.c | 3 +++ shlibs/blkid/src/superblocks/highpoint_raid.c | 11 +++++++++++ shlibs/blkid/src/superblocks/isw_raid.c | 2 ++ shlibs/blkid/src/superblocks/jmicron_raid.c | 2 ++ shlibs/blkid/src/superblocks/lsi_raid.c | 2 ++ shlibs/blkid/src/superblocks/nvidia_raid.c | 2 ++ shlibs/blkid/src/superblocks/promise_raid.c | 2 ++ shlibs/blkid/src/superblocks/silicon_raid.c | 2 ++ shlibs/blkid/src/superblocks/via_raid.c | 2 ++ 10 files changed, 35 insertions(+), 3 deletions(-) diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c index 370ef133..200a52c5 100644 --- a/shlibs/blkid/src/probe.c +++ b/shlibs/blkid/src/probe.c @@ -652,9 +652,6 @@ int blkid_probe_set_device(blkid_probe pr, int fd, pr->size -= pr->off; } - DBG(DEBUG_LOWPROBE, printf("ready for low-probing, offset=%jd, size=%jd\n", - pr->off, pr->size)); - if (pr->size <= 1440 * 1024 && !S_ISCHR(sb.st_mode)) pr->flags |= BLKID_TINY_DEV; @@ -662,6 +659,13 @@ int blkid_probe_set_device(blkid_probe pr, int fd, if (S_ISBLK(sb.st_mode) && ioctl(fd, CDROM_GET_CAPABILITY, NULL) >= 0) pr->flags |= BLKID_CDROM_DEV; #endif + + DBG(DEBUG_LOWPROBE, printf("ready for low-probing, offset=%jd, size=%jd\n", + pr->off, pr->size)); + DBG(DEBUG_LOWPROBE, printf("whole-disk: %s, regfile: %s\n", + blkid_probe_is_wholedisk(pr) ?"YES" : "NO", + S_ISREG(pr->mode) ? "YES" : "NO")); + return 0; err: DBG(DEBUG_LOWPROBE, diff --git a/shlibs/blkid/src/superblocks/adaptec_raid.c b/shlibs/blkid/src/superblocks/adaptec_raid.c index 73b146c6..570e75e9 100644 --- a/shlibs/blkid/src/superblocks/adaptec_raid.c +++ b/shlibs/blkid/src/superblocks/adaptec_raid.c @@ -81,6 +81,9 @@ static int probe_adraid(blkid_probe pr, const struct blkid_idmag *mag) if (pr->size < 0x10000) return -1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) + return -1; + off = ((pr->size / 0x200)-1) * 0x200; ad = (struct adaptec_metadata *) blkid_probe_get_buffer(pr, diff --git a/shlibs/blkid/src/superblocks/highpoint_raid.c b/shlibs/blkid/src/superblocks/highpoint_raid.c index 98343c41..25e3114b 100644 --- a/shlibs/blkid/src/superblocks/highpoint_raid.c +++ b/shlibs/blkid/src/superblocks/highpoint_raid.c @@ -30,6 +30,8 @@ static int probe_highpoint45x(blkid_probe pr, const struct blkid_idmag *mag) if (pr->size < 0x10000) return -1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) + return -1; off = ((pr->size / 0x200) - 11) * 0x200; hpt = (struct hpt45x_metadata *) @@ -47,6 +49,14 @@ static int probe_highpoint45x(blkid_probe pr, const struct blkid_idmag *mag) return 0; } +static int probe_highpoint37x(blkid_probe pr, const struct blkid_idmag *mag) +{ + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) + return -1; + return 0; +} + + const struct blkid_idinfo highpoint45x_idinfo = { .name = "hpt45x_raid_member", .usage = BLKID_USAGE_RAID, @@ -57,6 +67,7 @@ const struct blkid_idinfo highpoint45x_idinfo = { const struct blkid_idinfo highpoint37x_idinfo = { .name = "hpt37x_raid_member", .usage = BLKID_USAGE_RAID, + .probefunc = probe_highpoint37x, .magics = { /* * Superblok offset: 4608 bytes (9 sectors) diff --git a/shlibs/blkid/src/superblocks/isw_raid.c b/shlibs/blkid/src/superblocks/isw_raid.c index 5149c38a..ac6251d7 100644 --- a/shlibs/blkid/src/superblocks/isw_raid.c +++ b/shlibs/blkid/src/superblocks/isw_raid.c @@ -33,6 +33,8 @@ static int probe_iswraid(blkid_probe pr, const struct blkid_idmag *mag) if (pr->size < 0x10000) return -1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) + return -1; off = ((pr->size / 0x200) - 2) * 0x200; isw = (struct isw_metadata *) diff --git a/shlibs/blkid/src/superblocks/jmicron_raid.c b/shlibs/blkid/src/superblocks/jmicron_raid.c index 24430bf9..d35b17f8 100644 --- a/shlibs/blkid/src/superblocks/jmicron_raid.c +++ b/shlibs/blkid/src/superblocks/jmicron_raid.c @@ -32,6 +32,8 @@ static int probe_jmraid(blkid_probe pr, const struct blkid_idmag *mag) if (pr->size < 0x10000) return -1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) + return -1; off = ((pr->size / 0x200) - 1) * 0x200; jm = (struct jm_metadata *) diff --git a/shlibs/blkid/src/superblocks/lsi_raid.c b/shlibs/blkid/src/superblocks/lsi_raid.c index 3010eb6b..5217a009 100644 --- a/shlibs/blkid/src/superblocks/lsi_raid.c +++ b/shlibs/blkid/src/superblocks/lsi_raid.c @@ -30,6 +30,8 @@ static int probe_lsiraid(blkid_probe pr, const struct blkid_idmag *mag) if (pr->size < 0x10000) return -1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) + return -1; off = ((pr->size / 0x200) - 1) * 0x200; lsi = (struct lsi_metadata *) diff --git a/shlibs/blkid/src/superblocks/nvidia_raid.c b/shlibs/blkid/src/superblocks/nvidia_raid.c index e75bec84..c3db949a 100644 --- a/shlibs/blkid/src/superblocks/nvidia_raid.c +++ b/shlibs/blkid/src/superblocks/nvidia_raid.c @@ -32,6 +32,8 @@ static int probe_nvraid(blkid_probe pr, const struct blkid_idmag *mag) if (pr->size < 0x10000) return -1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) + return -1; off = ((pr->size / 0x200) - 2) * 0x200; nv = (struct nv_metadata *) diff --git a/shlibs/blkid/src/superblocks/promise_raid.c b/shlibs/blkid/src/superblocks/promise_raid.c index 1cc70e65..0e91d3c2 100644 --- a/shlibs/blkid/src/superblocks/promise_raid.c +++ b/shlibs/blkid/src/superblocks/promise_raid.c @@ -33,6 +33,8 @@ static int probe_pdcraid(blkid_probe pr, const struct blkid_idmag *mag) if (pr->size < 0x40000) return -1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) + return -1; for (i = 0; sectors[i] != 0; i++) { uint64_t off; diff --git a/shlibs/blkid/src/superblocks/silicon_raid.c b/shlibs/blkid/src/superblocks/silicon_raid.c index 11277ad6..b72b7276 100644 --- a/shlibs/blkid/src/superblocks/silicon_raid.c +++ b/shlibs/blkid/src/superblocks/silicon_raid.c @@ -48,6 +48,8 @@ static int probe_silraid(blkid_probe pr, const struct blkid_idmag *mag) if (pr->size < 0x10000) return -1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) + return -1; off = ((pr->size / 0x200) - 1) * 0x200; diff --git a/shlibs/blkid/src/superblocks/via_raid.c b/shlibs/blkid/src/superblocks/via_raid.c index 58650454..20131380 100644 --- a/shlibs/blkid/src/superblocks/via_raid.c +++ b/shlibs/blkid/src/superblocks/via_raid.c @@ -52,6 +52,8 @@ static int probe_viaraid(blkid_probe pr, const struct blkid_idmag *mag) if (pr->size < 0x10000) return -1; + if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr)) + return -1; off = ((pr->size / 0x200)-1) * 0x200; -- cgit v1.2.3 From 577cbb4df0f4d21d4ae0990832b467f1023f71b4 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 18 May 2010 16:09:58 +0200 Subject: libblkid: improbe DDF detection Signed-off-by: Karel Zak --- shlibs/blkid/src/superblocks/ddf_raid.c | 71 +++++++++++++++++++++++++++--- tests/expected/blkid/low-probe-ddf-raid | 6 +-- tests/ts/blkid/images-fs/ddf-raid.img.bz2 | Bin 535 -> 599 bytes 3 files changed, 68 insertions(+), 9 deletions(-) diff --git a/shlibs/blkid/src/superblocks/ddf_raid.c b/shlibs/blkid/src/superblocks/ddf_raid.c index a48735d2..c0ba3351 100644 --- a/shlibs/blkid/src/superblocks/ddf_raid.c +++ b/shlibs/blkid/src/superblocks/ddf_raid.c @@ -18,12 +18,57 @@ /* http://www.snia.org/standards/home */ #define DDF_GUID_LENGTH 24 #define DDF_REV_LENGTH 8 +#define DDF_MAGIC 0xDE11DE11 + struct ddf_header { - uint8_t signature[4]; + uint32_t signature; uint32_t crc; uint8_t guid[DDF_GUID_LENGTH]; - uint8_t ddf_rev[DDF_REV_LENGTH]; + char ddf_rev[8]; /* 01.02.00 */ + uint32_t seq; /* starts at '1' */ + uint32_t timestamp; + uint8_t openflag; + uint8_t foreignflag; + uint8_t enforcegroups; + uint8_t pad0; /* 0xff */ + uint8_t pad1[12]; /* 12 * 0xff */ + /* 64 bytes so far */ + uint8_t header_ext[32]; /* reserved: fill with 0xff */ + uint64_t primary_lba; + uint64_t secondary_lba; + uint8_t type; + uint8_t pad2[3]; /* 0xff */ + uint32_t workspace_len; /* sectors for vendor space - + * at least 32768(sectors) */ + uint64_t workspace_lba; + uint16_t max_pd_entries; /* one of 15, 63, 255, 1023, 4095 */ + uint16_t max_vd_entries; /* 2^(4,6,8,10,12)-1 : i.e. as above */ + uint16_t max_partitions; /* i.e. max num of configuration + record entries per disk */ + uint16_t config_record_len; /* 1 +ROUNDUP(max_primary_element_entries + *12/512) */ + uint16_t max_primary_element_entries; /* 16, 64, 256, 1024, or 4096 */ + uint8_t pad3[54]; /* 0xff */ + /* 192 bytes so far */ + uint32_t controller_section_offset; + uint32_t controller_section_length; + uint32_t phys_section_offset; + uint32_t phys_section_length; + uint32_t virt_section_offset; + uint32_t virt_section_length; + uint32_t config_section_offset; + uint32_t config_section_length; + uint32_t data_section_offset; + uint32_t data_section_length; + uint32_t bbm_section_offset; + uint32_t bbm_section_length; + uint32_t diag_space_offset; + uint32_t diag_space_length; + uint32_t vendor_offset; + uint32_t vendor_length; + /* 256 bytes so far */ + uint8_t pad4[256]; /* 0xff */ } __attribute__((packed)); static int probe_ddf(blkid_probe pr, const struct blkid_idmag *mag) @@ -32,7 +77,7 @@ static int probe_ddf(blkid_probe pr, const struct blkid_idmag *mag) int i; struct ddf_header *ddf = NULL; char version[DDF_REV_LENGTH + 1]; - uint64_t off; + uint64_t off, lba; if (pr->size < 0x30000) return -1; @@ -46,8 +91,8 @@ static int probe_ddf(blkid_probe pr, const struct blkid_idmag *mag) if (!ddf) return -1; - if (memcmp(ddf->signature, "\x11\xde\x11\xde", 4) == 0 || - memcmp(ddf->signature, "\xde\x11\xde\x11", 4) == 0) + if (ddf->signature == cpu_to_be32(DDF_MAGIC) || + ddf->signature == cpu_to_le32(DDF_MAGIC)) break; ddf = NULL; } @@ -55,6 +100,20 @@ static int probe_ddf(blkid_probe pr, const struct blkid_idmag *mag) if (!ddf) return -1; + lba = ddf->signature == cpu_to_be32(DDF_MAGIC) ? + be64_to_cpu(ddf->primary_lba) : + le64_to_cpu(ddf->primary_lba); + + if (lba > 0) { + /* check primary header */ + unsigned char *buf; + + buf = blkid_probe_get_buffer(pr, + lba << 9, sizeof(ddf->signature)); + if (!buf || memcmp(buf, &ddf->signature, 4)) + return -1; + } + blkid_probe_strncpy_uuid(pr, ddf->guid, sizeof(ddf->guid)); memcpy(version, ddf->ddf_rev, sizeof(ddf->ddf_rev)); @@ -64,7 +123,7 @@ static int probe_ddf(blkid_probe pr, const struct blkid_idmag *mag) return -1; if (blkid_probe_set_magic(pr, off, sizeof(ddf->signature), - (unsigned char *) ddf->signature)) + (unsigned char *) &ddf->signature)) return -1; return 0; } diff --git a/tests/expected/blkid/low-probe-ddf-raid b/tests/expected/blkid/low-probe-ddf-raid index 08329501..7956dcd0 100644 --- a/tests/expected/blkid/low-probe-ddf-raid +++ b/tests/expected/blkid/low-probe-ddf-raid @@ -1,5 +1,5 @@ ID_FS_TYPE=ddf_raid_member ID_FS_USAGE=raid -ID_FS_UUID=8Z_I__B_8Z_I_e_I_q_I____ -ID_FS_UUID_ENC=8Z\xb0I\x95\x10B\x028Z\xb0I\xc8e\xb0I\xb8q\xb0I\xff\xff\xff\xff -ID_FS_VERSION=02.00.00 +ID_FS_UUID=Linux-MDޭ__ +ID_FS_UUID_ENC=Linux-MDޭ\xbe\xef +ID_FS_VERSION=01.02.00 diff --git a/tests/ts/blkid/images-fs/ddf-raid.img.bz2 b/tests/ts/blkid/images-fs/ddf-raid.img.bz2 index c8f0c8ac..b0934933 100644 Binary files a/tests/ts/blkid/images-fs/ddf-raid.img.bz2 and b/tests/ts/blkid/images-fs/ddf-raid.img.bz2 differ -- cgit v1.2.3 From a3e40c14651fccf18e7954f081e601389baefe3f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 13 May 2010 13:58:16 +0200 Subject: rdev: remove this deprecated command Signed-off-by: Karel Zak --- DEPRECATED | 5 - configure.ac | 7 -- sys-utils/.gitignore | 4 - sys-utils/Makefile.am | 14 --- sys-utils/rdev.8 | 207 ------------------------------------- sys-utils/rdev.c | 279 -------------------------------------------------- 6 files changed, 516 deletions(-) delete mode 100644 sys-utils/rdev.8 delete mode 100644 sys-utils/rdev.c diff --git a/DEPRECATED b/DEPRECATED index a4236017..f5202434 100644 --- a/DEPRECATED +++ b/DEPRECATED @@ -53,8 +53,3 @@ Why: nobody uses this implementation What: shutdown(1) Why: nobody uses this implementation ----------------------------- - -What: rdev(8), ramsize(8), vidmode(8) and rootflags(8) -Why: i386 specific and probably useless - diff --git a/configure.ac b/configure.ac index 7fe2d111..7fe91a1a 100644 --- a/configure.ac +++ b/configure.ac @@ -878,13 +878,6 @@ AC_ARG_ENABLE([raw], AM_CONDITIONAL(BUILD_RAW, test "x$enable_raw" = xyes) -AC_ARG_ENABLE([rdev], - AS_HELP_STRING([--enable-rdev], [build rdev on i386]), - [], enable_rdev=no -) -AM_CONDITIONAL(BUILD_RDEV, test "x$enable_rdev" = xyes) - - AC_ARG_ENABLE([rename], AS_HELP_STRING([--disable-rename], [do not build rename]), [], enable_rename=yes diff --git a/sys-utils/.gitignore b/sys-utils/.gitignore index f82d1072..7af5ffbf 100644 --- a/sys-utils/.gitignore +++ b/sys-utils/.gitignore @@ -24,11 +24,8 @@ pivot_root ppc32.8 ppc64.8 ppc.8 -ramsize.8 -rdev readprofile renice -rootflags.8 rtcwake s390.8 s390x.8 @@ -41,5 +38,4 @@ sparc.8 switch_root tunelp unshare -vidmode.8 x86_64.8 diff --git a/sys-utils/Makefile.am b/sys-utils/Makefile.am index 957fd6e8..06d991c3 100644 --- a/sys-utils/Makefile.am +++ b/sys-utils/Makefile.am @@ -49,13 +49,6 @@ bin_PROGRAMS += arch dist_man_MANS += arch.1 endif -RDEV_LINKS = -if BUILD_RDEV -usrsbin_exec_PROGRAMS += rdev -RDEV_LINKS += ramsize vidmode rootflags -dist_man_MANS += rdev.8 -endif - SETARCH_LINKS = linux32 linux64 if ARCH_S390 @@ -83,21 +76,14 @@ if ARCH_HPPA SETARCH_LINKS += parisc parisc64 parisc32 endif -RDEV_MAN_LINKS = $(RDEV_LINKS:=.8) SETARCH_MAN_LINKS = $(SETARCH_LINKS:=.8) man_MANS = $(RDEV_MAN_LINKS) $(SETARCH_MAN_LINKS) CLEANFILES = $(man_MANS) -$(RDEV_MAN_LINKS): rdev.8 - echo ".so man8/rdev.8" > $@ - $(SETARCH_MAN_LINKS): setarch.8 echo ".so man8/setarch.8" > $@ install-exec-hook: - for I in $(RDEV_LINKS); do \ - cd $(DESTDIR)$(usrsbin_execdir) && ln -sf rdev $$I ; \ - done for I in $(SETARCH_LINKS); do \ cd $(DESTDIR)$(usrbin_execdir) && ln -sf setarch $$I ; \ done diff --git a/sys-utils/rdev.8 b/sys-utils/rdev.8 deleted file mode 100644 index 16d6420f..00000000 --- a/sys-utils/rdev.8 +++ /dev/null @@ -1,207 +0,0 @@ -.\" Copyright 1992, 1993 Rickard E. Faith (faith@cs.unc.edu) -.\" May be distributed under the GNU General Public License -.\" Changes from sct@dcs.ed.ac.uk added Sat Oct 9 09:54:00 1993. -.TH RDEV 8 "20 November 1993" "Linux 0.99" "Linux Programmer's Manual" -.SH NAME -rdev \- query/set image root device, RAM disk size, or video mode -.SH SYNOPSIS -.B rdev -.RB [ \-Rrvh ] -.RB [ \-o -.IR offset ] -.RI [ image -.RI [ value -.RI [ offset ]]] -.br -.B rdev -.RB [ \-o -.IR offset ] -.RI [ image -.RI [ root_device -.RI [ offset ]]] -.br -.B ramsize -.RB [ \-o -.IR offset ] -.RI [ image -.RI [ size -.RI [ offset ]]] -.br -.B vidmode -.RB [ \-o -.IR offset ] -.RI [ image -.RI [ mode -.RI [ offset ]]] -.br -.B rootflags -.RB [ \-o -.IR offset ] -.RI [ image -.RI [ flags -.RI [ offset ]]] -.SH DESCRIPTION -With no arguments, -.B rdev -outputs an -.I /etc/mtab -line for the current root file system. -With no arguments, -.BR ramsize ", " vidmode ", and " rootflags -print usage information. - -In a bootable image for the Linux kernel on i386, there are several pairs -of bytes which specify the root device, the video mode, and the size of -the RAM disk. These pairs of bytes, by default, begin -at offset 504 (decimal) in the kernel image: - -.nf -.RS - 498 Root flags -(500 and 502 Reserved) - 504 RAM Disk Size - 506 VGA Mode - 508 Root Device -(510 Boot Signature) -.RE -.fi - -.B rdev -will change these values. - -Typical values for the -.I image -parameter, which is a bootable Linux kernel image, might be: - -.nf -.RS -/vmlinux -/vmunix -/boot/bzImage-2.4.0 -/dev/fd0 -/dev/fd1 -.RE -.fi - -When using the -.B rdev -command, the -.I root_device -parameter might be something like: - -.nf -.RS -/dev/hda1 -/dev/hdf13 -/dev/sda2 -/dev/sdc4 -/dev/ida/c0d0p1 -.RE -.fi - -One may also specify the device by a comma-separated pair -of decimal integers -.IR major , minor . - -For the -.B ramsize -command, the -.I size -parameter specifies the size of the RAM disk in kilobytes. 2.0.x kernels -and newer dynamically allocate the ramdisk and do not need this setting. - -For the -.B rootflags -command, the -.I flags -parameter contains extra information used when mounting root. -Currently the only effect of these flags is to force the kernel to -mount the root filesystem in readonly mode if -.I flags -is non-zero. - -For the -.B vidmode -command, the -.I mode -parameter specifies the video mode: - -.nf -.RS --3 = Prompt --2 = Extended VGA --1 = Normal VGA - 0 = as if "0" was pressed at the prompt - 1 = as if "1" was pressed at the prompt - 2 = as if "2" was pressed at the prompt - n = as if "n" was pressed at the prompt -.RE -.fi - -If the -.I value -is not specified, the -.I image -will be examined to determine the current settings. -.SH OPTIONS -.TP -.B \-r -Causes -.B rdev -to act like -.BR ramsize -(Not relevant for 2.0.x and newer kernels). -.TP -.B \-R -Causes -.B rdev -to act like -.BR rootflags . -.TP -.B \-v -Causes -.B rdev -to act like -.BR vidmode . -.TP -.B \-h -Provides help. -.SH BUGS -The -.B rdev -utility, when used other than to find a name for the current root device, -is an ancient hack that works by patching a kernel image at a magic offset -with magic numbers. It does not work on architectures other than i386. -Its use is strongly discouraged. Use a boot loader like SysLinux or LILO -instead. -.SH HISTORY -At offset 502 there used to be the device number of the swap device -(in Linux 0.12), and "rdev -s" or "swapdev" would set this. -However, since Linux 0.95 this constant is not used any longer, -and the swap device is specified using the -.BR swapon (2) -system call. - -At offset 504 there used to be the size of the ramdisk in kilobytes. -One would specify a size, and this much was grabbed off the top of memory. -In Linux 1.1.39 it became also possible to set this value on the kernel -command line. -In Linux 1.3.48 the ramdisk setup was changed. Ramdisk memory is now -taken from the buffer cache, so that the ramdisk can grow dynamically. -The interpretation of the ramdisk word was changed to a word of which -the high order bit is a prompt flag (1: prompt for ramdisk: -"VFS: Insert ramdisk floppy and press ENTER" - this is needed with a -two-floppy boot), the next bit a load flag (1: load ramdisk), -and the low order 11 bits give the starting block number of the -root filesystem image (so that one can have a single floppy boot). -See also -.IR linux/Documentation/ramdisk.txt . -.SH AUTHORS -.nf -Originally by Werner Almesberger (almesber@nessie.cs.id.ethz.ch) -Modified by Peter MacDonald (pmacdona@sanjuan.UVic.CA) -rootflags support added by Stephen Tweedie (sct@dcs.ed.ac.uk) -.fi -.SH AVAILABILITY -The rdev command is part of the util-linux-ng package and is available from -ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. diff --git a/sys-utils/rdev.c b/sys-utils/rdev.c deleted file mode 100644 index 14fac814..00000000 --- a/sys-utils/rdev.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - - rdev.c - query/set root device. - -------------------------------------------------------------------------- - -Date: Sun, 27 Dec 1992 15:55:31 +0000 -Subject: Re: rdev -From: almesber@nessie.cs.id.ethz.ch (Werner Almesberger) -To: Rik Faith - -There are quite a few versions of rdev: - - - the original rootdev that only printed the current root device, by - Linus. - - rdev that does what rootdev did and that also allows you to change - the root (and swap) device, by me. - - rdev got renamed to setroot and I think even to rootdev on various - distributions. - - Peter MacDonald added video mode and RAM disk setting and included - this version on SLS, called rdev again. I've attached his rdev.c to - this mail. - -------------------------------------------------------------------------- - -Date: 11 Mar 92 21:37:37 GMT -Subject: rdev - query/set root device -From: almesber@nessie.cs.id.ethz.ch (Werner Almesberger) -Organization: Swiss Federal Institute of Technology (ETH), Zurich, CH - -With all that socket, X11, disk driver and FS hacking going on, apparently -nobody has found time to address one of the minor nuisances of life: set- -ting the root FS device is still somewhat cumbersome. I've written a little -utility which can read and set the root device in boot images: - -rdev accepts an optional offset argument, just in case the address should -ever move from 508. If called without arguments, rdev outputs an mtab line -for the current root FS, just like /etc/rootdev does. - -ramsize sets the size of the ramdisk. If size is zero, no ramdisk is used. - -vidmode sets the default video mode at bootup time. -1 uses default video -mode, -2 uses menu. - -------------------------------------------------------------------------- - -Sun Dec 27 10:42:16 1992: Minor usage changes, faith@cs.unc.edu. -Tue Mar 30 09:31:52 1993: rdev -Rn to set root readonly flag, sct@dcs.ed.ac.uk -Wed Jun 22 21:12:29 1994: Applied patches from Dave - (gentzel@nova.enet.dec.com) to prevent dereferencing - the NULL pointer, faith@cs.unc.edu -1999-02-22 Arkadiusz Mikiewicz -- added Native Language Support - -------------------------------------------------------------------------- - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "nls.h" - -/* rdev.c - query/set root device. */ - -static void -usage(void) { - - puts(_("usage: rdev [ -rv ] [ -o OFFSET ] [ IMAGE [ VALUE [ OFFSET ] ] ]")); - puts(_(" rdev /dev/fd0 (or rdev /linux, etc.) displays the current ROOT device")); - puts(_(" rdev /dev/fd0 /dev/hda2 sets ROOT to /dev/hda2")); - puts(_(" rdev -R /dev/fd0 1 set the ROOTFLAGS (readonly status)")); - puts(_(" rdev -r /dev/fd0 627 set the RAMDISK size")); - puts(_(" rdev -v /dev/fd0 1 set the bootup VIDEOMODE")); - puts(_(" rdev -o N ... use the byte offset N")); - puts(_(" rootflags ... same as rdev -R")); - puts(_(" ramsize ... same as rdev -r")); - puts(_(" vidmode ... same as rdev -v")); - puts(_("Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,...")); - puts(_(" use -R 1 to mount root readonly, -R 0 for read/write.")); - exit(-1); -} - - -#define DEFAULT_OFFSET 508 - - -static void -die(char *msg) { - perror(msg); - exit(1); -} - -/* Earlier rdev fails on /dev/ida/c0d0p1 so we allow for - recursion in /dev. -- Paul Clements */ -/* In fact devfs needs deep recursion. */ - -static int -find_dev_recursive(char *dirnamebuf, int number) { - DIR *dp; - struct dirent *dir; - struct stat s; - int dirnamelen = 0; - - if ((dp = opendir(dirnamebuf)) == NULL) - die("opendir"); - dirnamelen = strlen(dirnamebuf); - while ((dir = readdir(dp)) != NULL) { - if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, "..")) - continue; - if (dirnamelen + 1 + strlen(dir->d_name) > PATH_MAX) - continue; - dirnamebuf[dirnamelen] = '/'; - strcpy(dirnamebuf+dirnamelen+1, dir->d_name); - if (lstat(dirnamebuf, &s) < 0) - continue; - if ((s.st_mode & S_IFMT) == S_IFBLK && s.st_rdev == number) - return 1; - if ((s.st_mode & S_IFMT) == S_IFDIR && - find_dev_recursive(dirnamebuf, number)) - return 1; - } - dirnamebuf[dirnamelen] = 0; - closedir(dp); - return 0; -} - -static char * -find_dev(int number) { - static char name[PATH_MAX+1]; - - if (!number) - return "Boot device"; - strcpy(name, "/dev"); - if (find_dev_recursive(name, number)) - return name; - sprintf(name, "0x%04x", number); - return name; -} - -/* The enum values are significant, things are stored in this order, - see bootsect.S */ -enum { RDEV, VIDMODE, RAMSIZE, __swapdev__, __syssize__, ROOTFLAGS }; -char *cmdnames[6] = { "rdev", "vidmode", "ramsize", "", - "", "rootflags"}; -char *desc[6] = { "Root device", "Video mode", "Ramsize", "", - "", "Root flags"}; -#define shift(n) argv+=n,argc-=n - -int -main(int argc, char **argv) { - int image, offset, dev_nr, i, newoffset=-1; - char *ptr; - unsigned short val, have_val; - struct stat s; - int cmd; - - setlocale(LC_ALL, ""); - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); - - /* use the command name to figure out what we have to do - ugly */ - cmd = RDEV; - if ((ptr = strrchr(argv[0],'/')) != NULL) - ptr++; - else - ptr = argv[0]; - for (i=0; i<=5; i++) { - if (!strcmp(ptr,cmdnames[i])) { - cmd = i; - break; - } - } - - while (argc > 1) { - if (argv[1][0] != '-') - break; - switch (argv[1][1]) { - case 'R': - cmd = ROOTFLAGS; - shift(1); - break; - case 'r': - cmd = RAMSIZE; - shift(1); - break; - case 'v': - cmd = VIDMODE; - shift(1); - break; - case 'o': - if (argv[1][2]) { - newoffset = atoi(argv[1]+2); - shift(1); - break; - } else if (argc > 2) { - newoffset = atoi(argv[2]); - shift(2); - break; - } - /* Fall through. . . */ - default: - usage(); - } - } - - /* Here the only sensible way of using rdev */ - if (argc == 1) { - if (cmd == RDEV) { - if (stat("/",&s) < 0) die("/"); - printf("%s /\n", find_dev(s.st_dev)); - exit(0); - } - usage(); - } - - if (argc > 4) - usage(); - - /* Ancient garbage.. */ - offset = DEFAULT_OFFSET-cmd*2; - if (newoffset >= 0) - offset = newoffset; - if (argc == 4) - offset = atoi(argv[3]); - - have_val = 0; - - if (argc >= 3) { - if (cmd == RDEV) { - if (isdigit(*argv[2])) { - /* earlier: specify offset */ - /* now: specify major,minor */ - char *p; - unsigned int ma,mi; - if ((p = strchr(argv[2], ',')) == NULL) - die(_("missing comma")); - ma = atoi(argv[2]); - mi = atoi(p+1); - val = ((ma<<8) | mi); - } else { - char *device = argv[2]; - if (stat(device,&s) < 0) - die(device); - val = s.st_rdev; - } - } else { - val = atoi(argv[2]); - } - have_val = 1; - } - - if (have_val) { - if ((image = open(argv[1],O_WRONLY)) < 0) die(argv[1]); - if (lseek(image,offset,0) < 0) die("lseek"); - if (write(image,(char *)&val,2) != 2) die(argv[1]); - if (close(image) < 0) die("close"); - } else { - if ((image = open(argv[1],O_RDONLY)) < 0) die(argv[1]); - if (lseek(image,offset,0) < 0) die("lseek"); - dev_nr = 0; - if (read(image,(char *)&dev_nr,2) != 2) die(argv[1]); - if (close(image) < 0) die("close"); - fputs(desc[cmd], stdout); - if (cmd == RDEV) - printf(" %s\n", find_dev(dev_nr)); - else - printf(" %d\n", dev_nr); - } - return 0; -} -- cgit v1.2.3 From b541b8ec56b5783ee7f9aec505a916a98e99f61f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 19 May 2010 11:16:50 +0200 Subject: tests: update fdisk tests Signed-off-by: Karel Zak --- tests/expected/fdisk/align-512-4K | 6 +++--- tests/expected/fdisk/align-512-4K-63 | 6 +++--- tests/expected/fdisk/align-512-4K-md | 8 ++++---- tests/expected/fdisk/align-512-512 | 6 +++--- tests/expected/fdisk/align-512-512-topology | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/expected/fdisk/align-512-4K b/tests/expected/fdisk/align-512-4K index 9613e176..0857e378 100644 --- a/tests/expected/fdisk/align-512-4K +++ b/tests/expected/fdisk/align-512-4K @@ -21,17 +21,17 @@ Command (m for help): Changing display/entry units to sectors Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (2048-102399, default 2048): Using default value 2048 +Partition number (1-4, default 1): First sector (2048-102399, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399): Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (22528-102399, default 22528): Using default value 22528 +Partition number (1-4, default 2): First sector (22528-102399, default 22528): Using default value 22528 Last sector, +sectors or +size{K,M,G} (22528-102399, default 102399): Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (43008-102399, default 43008): Using default value 43008 +Partition number (1-4, default 3): First sector (43008-102399, default 43008): Using default value 43008 Last sector, +sectors or +size{K,M,G} (43008-102399, default 102399): Command (m for help): Command action e extended diff --git a/tests/expected/fdisk/align-512-4K-63 b/tests/expected/fdisk/align-512-4K-63 index 95e3bd9b..75998891 100644 --- a/tests/expected/fdisk/align-512-4K-63 +++ b/tests/expected/fdisk/align-512-4K-63 @@ -21,17 +21,17 @@ Command (m for help): Changing display/entry units to sectors Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (7-102399, default 7): Using default value 7 +Partition number (1-4, default 1): First sector (7-102399, default 7): Using default value 7 Last sector, +sectors or +size{K,M,G} (7-102399, default 102399): Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (20487-102399, default 20487): Using default value 20487 +Partition number (1-4, default 2): First sector (20487-102399, default 20487): Using default value 20487 Last sector, +sectors or +size{K,M,G} (20487-102399, default 102399): Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (40967-102399, default 40967): Using default value 40967 +Partition number (1-4, default 3): First sector (40967-102399, default 40967): Using default value 40967 Last sector, +sectors or +size{K,M,G} (40967-102399, default 102399): Command (m for help): Command action e extended diff --git a/tests/expected/fdisk/align-512-4K-md b/tests/expected/fdisk/align-512-4K-md index 026b94a6..4ac8ccc7 100644 --- a/tests/expected/fdisk/align-512-4K-md +++ b/tests/expected/fdisk/align-512-4K-md @@ -21,12 +21,12 @@ Command (m for help): Changing display/entry units to sectors Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (2048-102399, default 2048): Using default value 2048 +Partition number (1-4, default 1): First sector (2048-102399, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399): Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (43008-102399, default 43008): Using default value 43008 +Partition number (1-4, default 2): First sector (43008-102399, default 43008): Using default value 43008 Last sector, +sectors or +size{K,M,G} (43008-102399, default 102399): Using default value 102399 Command (m for help): @@ -71,12 +71,12 @@ Command (m for help): Changing display/entry units to sectors Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (2048-100095, default 2048): Using default value 2048 +Partition number (1-4, default 1): First sector (2048-100095, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-100095, default 100095): Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (22528-100095, default 22528): Using default value 22528 +Partition number (1-4, default 2): First sector (22528-100095, default 22528): Using default value 22528 Last sector, +sectors or +size{K,M,G} (22528-100095, default 100095): Command (m for help): Disk /dev/md8: 51 MB, 51249152 bytes diff --git a/tests/expected/fdisk/align-512-512 b/tests/expected/fdisk/align-512-512 index e984d6bc..6f49256e 100644 --- a/tests/expected/fdisk/align-512-512 +++ b/tests/expected/fdisk/align-512-512 @@ -17,17 +17,17 @@ Command (m for help): Changing display/entry units to sectors Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (2048-102399, default 2048): Using default value 2048 +Partition number (1-4, default 1): First sector (2048-102399, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399): Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (22528-102399, default 22528): Using default value 22528 +Partition number (1-4, default 2): First sector (22528-102399, default 22528): Using default value 22528 Last sector, +sectors or +size{K,M,G} (22528-102399, default 102399): Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (43008-102399, default 43008): Using default value 43008 +Partition number (1-4, default 3): First sector (43008-102399, default 43008): Using default value 43008 Last sector, +sectors or +size{K,M,G} (43008-102399, default 102399): Command (m for help): Command action e extended diff --git a/tests/expected/fdisk/align-512-512-topology b/tests/expected/fdisk/align-512-512-topology index 91cd1b4f..c99a1745 100644 --- a/tests/expected/fdisk/align-512-512-topology +++ b/tests/expected/fdisk/align-512-512-topology @@ -17,17 +17,17 @@ Command (m for help): Changing display/entry units to sectors Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (2048-102399, default 2048): Using default value 2048 +Partition number (1-4, default 1): First sector (2048-102399, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399): Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (22528-102399, default 22528): Using default value 22528 +Partition number (1-4, default 2): First sector (22528-102399, default 22528): Using default value 22528 Last sector, +sectors or +size{K,M,G} (22528-102399, default 102399): Command (m for help): Command action e extended p primary partition (1-4) -Partition number (1-4): First sector (43008-102399, default 43008): Using default value 43008 +Partition number (1-4, default 3): First sector (43008-102399, default 43008): Using default value 43008 Last sector, +sectors or +size{K,M,G} (43008-102399, default 102399): Command (m for help): Command action e extended -- cgit v1.2.3 From 208525a7f45014e19a54d411c35cd8ef6a2e5dc5 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 21 May 2010 12:35:37 +0200 Subject: libblkid: improve MD 0.90.0 detection (use sb->size) Signed-off-by: Karel Zak --- shlibs/blkid/src/superblocks/linux_raid.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/shlibs/blkid/src/superblocks/linux_raid.c b/shlibs/blkid/src/superblocks/linux_raid.c index 41ef261a..b73214a4 100644 --- a/shlibs/blkid/src/superblocks/linux_raid.c +++ b/shlibs/blkid/src/superblocks/linux_raid.c @@ -99,7 +99,7 @@ struct mdp1_super_block { #define MD_RESERVED_BYTES 0x10000 #define MD_SB_MAGIC 0xa92b4efc -static int probe_raid0(blkid_probe pr, off_t off) +static int probe_raid0(blkid_probe pr, blkid_loff_t off) { struct mdp0_super_block *mdp0; union { @@ -107,8 +107,9 @@ static int probe_raid0(blkid_probe pr, off_t off) uint8_t bytes[16]; } uuid; uint32_t ma, mi, pa; + uint64_t size; - if (pr->size < 0x10000) + if (pr->size < MD_RESERVED_BYTES) return -1; mdp0 = (struct mdp0_super_block *) blkid_probe_get_buffer(pr, @@ -129,6 +130,7 @@ static int probe_raid0(blkid_probe pr, off_t off) ma = le32_to_cpu(mdp0->major_version); mi = le32_to_cpu(mdp0->minor_version); pa = le32_to_cpu(mdp0->patch_version); + size = le32_to_cpu(mdp0->size); } else if (be32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) { uuid.ints[0] = mdp0->set_uuid0; @@ -140,14 +142,31 @@ static int probe_raid0(blkid_probe pr, off_t off) ma = be32_to_cpu(mdp0->major_version); mi = be32_to_cpu(mdp0->minor_version); pa = be32_to_cpu(mdp0->patch_version); + size = be32_to_cpu(mdp0->size); } else return 1; + size <<= 10; /* convert KiB to bytes */ + + if (pr->size < size + MD_RESERVED_BYTES) + /* device is too small */ + return 1; + + if (off < size) + /* no space before superblock */ + return 1; + /* * Check for collisions between RAID and partition table + * + * For example the superblock is at the end of the last partition, it's + * the same possition as at the end of the disk... */ if ((S_ISREG(pr->mode) || blkid_probe_is_wholedisk(pr)) && - blkid_probe_is_covered_by_pt(pr, off, 0x200)) { + blkid_probe_is_covered_by_pt(pr, + off - size, /* min. start */ + size + MD_RESERVED_BYTES)) { /* min. length */ + /* ignore this superblock, it's within any partition and * we are working with whole-disk now */ return 1; -- cgit v1.2.3 From 76f47165b0077e1fba8e32b503c03cdbd4bb58fb Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 21 May 2010 15:56:44 +0200 Subject: blkid: remove duplicate option from man page Signed-off-by: Karel Zak --- misc-utils/blkid.8 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/misc-utils/blkid.8 b/misc-utils/blkid.8 index d42074f0..8968bb29 100644 --- a/misc-utils/blkid.8 +++ b/misc-utils/blkid.8 @@ -33,8 +33,6 @@ blkid \- command\-line utility to locate/print block device attributes .B blkid .RB -p -.RB [ \-s -.IR tag ] .RB [ \-O .IR offset ] .RB [ \-S @@ -54,8 +52,6 @@ blkid \- command\-line utility to locate/print block device attributes .B blkid .RB -i -.RB [ \-s -.IR tag ] .RB [ \-o .IR format ] .RB [ \-s -- cgit v1.2.3 From 5dfc518c2e2a02b9011295dbfc3015f239acde00 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 24 May 2010 12:37:12 +0200 Subject: build-sys: replace ../ with $top_srcdir Signed-off-by: Karel Zak --- disk-utils/Makefile.am | 10 +++++----- fdisk/Makefile.am | 7 ++++--- fsck/Makefile.am | 4 ++-- login-utils/Makefile.am | 4 ++-- misc-utils/Makefile.am | 7 ++++--- mount/Makefile.am | 19 +++++++++++-------- partx/Makefile.am | 4 ++-- sys-utils/Makefile.am | 2 +- 8 files changed, 31 insertions(+), 26 deletions(-) diff --git a/disk-utils/Makefile.am b/disk-utils/Makefile.am index 67aeae40..664c9980 100644 --- a/disk-utils/Makefile.am +++ b/disk-utils/Makefile.am @@ -1,8 +1,8 @@ include $(top_srcdir)/config/include-Makefile.am -utils_common = ../lib/blkdev.c +utils_common = $(top_srcdir)/lib/blkdev.c if LINUX -utils_common += ../lib/linux_version.c +utils_common += $(top_srcdir)/lib/linux_version.c endif if HAVE_UUID @@ -28,7 +28,7 @@ swaplabel_SOURCES = swaplabel.c $(utils_common) swaplabel_LDADD = $(uuid_ldadd) swaplabel_CFLAGS = $(AM_CFLAGS) $(uuid_cflags) -mkswap_SOURCES = mkswap.c $(utils_common) ../lib/wholedisk.c +mkswap_SOURCES = mkswap.c $(utils_common) $(top_srcdir)/lib/wholedisk.c mkswap_LDADD = $(uuid_ldadd) mkswap_CFLAGS = $(AM_CFLAGS) $(uuid_cflags) @@ -52,7 +52,7 @@ endif if BUILD_ELVTUNE sbin_PROGRAMS += elvtune dist_man_MANS += elvtune.8 -elvtune_SOURCES = elvtune.c ../lib/linux_version.c +elvtune_SOURCES = elvtune.c $(top_srcdir)/lib/linux_version.c endif if HAVE_RAW @@ -66,7 +66,7 @@ if BUILD_CRAMFS cramfs_common = $(utils_common) cramfs.h cramfs_common.c cramfs_common.h sbin_PROGRAMS += fsck.cramfs mkfs.cramfs fsck_cramfs_SOURCES = fsck.cramfs.c $(cramfs_common) -mkfs_cramfs_SOURCES = mkfs.cramfs.c $(cramfs_common) ../lib/md5.c +mkfs_cramfs_SOURCES = mkfs.cramfs.c $(cramfs_common) $(top_srcdir)/lib/md5.c fsck_cramfs_LDADD = -lz mkfs_cramfs_LDADD = -lz endif diff --git a/fdisk/Makefile.am b/fdisk/Makefile.am index 7b87d6cf..9a9db0c2 100644 --- a/fdisk/Makefile.am +++ b/fdisk/Makefile.am @@ -3,10 +3,11 @@ include $(top_srcdir)/config/include-Makefile.am EXTRA_DIST = README.fdisk README.cfdisk sfdisk.examples partitiontype.c fdisk_common = i386_sys_types.c common.h gpt.c gpt.h \ - ../lib/blkdev.c ../lib/wholedisk.c ../lib/mbsalign.c + $(top_srcdir)/lib/blkdev.c $(top_srcdir)/lib/wholedisk.c \ + $(top_srcdir)/lib/mbsalign.c if LINUX -fdisk_common += ../lib/linux_version.c +fdisk_common += $(top_srcdir)/lib/linux_version.c endif if !ARCH_M68K @@ -53,7 +54,7 @@ endif if USE_SLANG sbin_PROGRAMS += cfdisk dist_man_MANS += cfdisk.8 -cfdisk_SOURCES = cfdisk.c $(fdisk_common) ../lib/mbsalign.c +cfdisk_SOURCES = cfdisk.c $(fdisk_common) $(top_srcdir)/lib/mbsalign.c cfdisk_CFLAGS = $(cflags_blkid) cfdisk_LDADD = -lslang $(ldadd_blkid) else diff --git a/fsck/Makefile.am b/fsck/Makefile.am index 203d36b0..b0949e25 100644 --- a/fsck/Makefile.am +++ b/fsck/Makefile.am @@ -3,8 +3,8 @@ include $(top_srcdir)/config/include-Makefile.am sbin_PROGRAMS = fsck dist_man_MANS = fsck.8 -fsck_SOURCES = base_device.c fsck.c fsck.h ../lib/ismounted.c \ - ../lib/fsprobe.c ../lib/canonicalize.c +fsck_SOURCES = base_device.c fsck.c fsck.h $(top_srcdir)/lib/ismounted.c \ + $(top_srcdir)/lib/fsprobe.c $(top_srcdir)/lib/canonicalize.c fsck_LDADD = fsck_CFLAGS = $(AM_CFLAGS) diff --git a/login-utils/Makefile.am b/login-utils/Makefile.am index 920a6e7c..9ebd0b7c 100644 --- a/login-utils/Makefile.am +++ b/login-utils/Makefile.am @@ -46,8 +46,8 @@ login_ldadd_common = chfn_SOURCES = chfn.c $(chfn_chsh_common) chsh_SOURCES = chsh.c $(chfn_chsh_common) chfn_chsh_common = islocal.c setpwnam.c islocal.h my_crypt.h setpwnam.h \ - ../lib/env.c -login_SOURCES = login.c login.h my_crypt.h ../lib/setproctitle.c + $(top_srcdir)/lib/env.c +login_SOURCES = login.c login.h my_crypt.h $(top_srcdir)/lib/setproctitle.c newgrp_SOURCES = newgrp.c my_crypt.h vipw_SOURCES = vipw.c setpwnam.h diff --git a/misc-utils/Makefile.am b/misc-utils/Makefile.am index ca272560..c98107d6 100644 --- a/misc-utils/Makefile.am +++ b/misc-utils/Makefile.am @@ -10,7 +10,7 @@ usrbin_exec_PROGRAMS = cal ddate logger look mcookie \ namei script whereis scriptreplay EXTRA_DIST += README.cal README.ddate README.namei README.namei2 -mcookie_SOURCES = mcookie.c ../lib/md5.c +mcookie_SOURCES = mcookie.c $(top_srcdir)/lib/md5.c script_LDADD = usrbin_exec_SCRIPTS = chkdupexe @@ -36,12 +36,13 @@ endif if BUILD_LIBBLKID sbin_PROGRAMS += blkid findfs wipefs dist_man_MANS += blkid.8 findfs.8 wipefs.8 -blkid_SOURCES = blkid.c $(top_srcdir)/lib/ismounted.c ../lib/strtosize.c +blkid_SOURCES = blkid.c $(top_srcdir)/lib/ismounted.c \ + $(top_srcdir)/lib/strtosize.c blkid_LDADD = $(ul_libblkid_la) blkid_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir) findfs_LDADD = $(ul_libblkid_la) findfs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir) -wipefs_SOURCES = wipefs.c ../lib/strtosize.c +wipefs_SOURCES = wipefs.c $(top_srcdir)/lib/strtosize.c wipefs_LDADD = $(ul_libblkid_la) wipefs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir) if HAVE_STATIC_BLKID diff --git a/mount/Makefile.am b/mount/Makefile.am index 8465d11e..83e1fcdd 100644 --- a/mount/Makefile.am +++ b/mount/Makefile.am @@ -7,7 +7,7 @@ sbin_PROGRAMS = losetup swapon dist_man_MANS = fstab.5 mount.8 swapoff.8 swapon.8 umount.8 losetup.8 # generic sources for all programs (mount, umount, losetup) -srcs_common = sundries.c xmalloc.c ../lib/canonicalize.c sundries.h xmalloc.h +srcs_common = sundries.c xmalloc.c $(top_srcdir)/lib/canonicalize.c sundries.h xmalloc.h # generic header for mount and umount hdrs_mount = fstab.h mount_mntent.h mount_constants.h \ @@ -15,8 +15,9 @@ hdrs_mount = fstab.h mount_mntent.h mount_constants.h \ # generic sources for mount and umount srcs_mount = fstab.c mount_mntent.c getusername.c lomount.c devname.c devname.h \ - $(srcs_common) $(hdrs_mount) ../lib/env.c ../lib/linux_version.c \ - ../lib/blkdev.c ../lib/fsprobe.c ../lib/mangle.c + $(srcs_common) $(hdrs_mount) $(top_srcdir)/lib/env.c \ + $(top_srcdir)/lib/linux_version.c $(top_srcdir)/lib/blkdev.c \ + $(top_srcdir)/lib/fsprobe.c $(top_srcdir)/lib/mangle.c # generic flags for all programs (except losetup) # -- note that pkg-config autoconf macros (pkg.m4) does not differentiate @@ -26,7 +27,8 @@ ldadd_static = cflags_common = $(AM_CFLAGS) ldflags_static = -all-static -mount_SOURCES = mount.c $(srcs_mount) ../lib/setproctitle.c ../lib/strtosize.c +mount_SOURCES = mount.c $(srcs_mount) $(top_srcdir)/lib/setproctitle.c \ + $(top_srcdir)/lib/strtosize.c mount_CFLAGS = $(SUID_CFLAGS) $(cflags_common) mount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS) mount_LDADD = $(ldadd_common) @@ -36,13 +38,14 @@ umount_CFLAGS = $(SUID_CFLAGS) $(cflags_common) umount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS) umount_LDADD = $(ldadd_common) -swapon_SOURCES = swapon.c swap_constants.h ../lib/linux_version.c \ - ../lib/blkdev.c ../lib/fsprobe.c ../lib/canonicalize.c \ - ../lib/mangle.c +swapon_SOURCES = swapon.c swap_constants.h $(top_srcdir)/lib/linux_version.c \ + $(top_srcdir)/lib/blkdev.c $(top_srcdir)/lib/fsprobe.c \ + $(top_srcdir)/lib/canonicalize.c $(top_srcdir)/lib/mangle.c swapon_CFLAGS = $(cflags_common) swapon_LDADD = $(ldadd_common) -losetup_SOURCES = lomount.c $(srcs_common) loop.h lomount.h ../lib/strtosize.c +losetup_SOURCES = lomount.c $(srcs_common) loop.h lomount.h \ + $(top_srcdir)/lib/strtosize.c losetup_CPPFLAGS = -DMAIN $(AM_CPPFLAGS) mount_static_LDADD = diff --git a/partx/Makefile.am b/partx/Makefile.am index 238f3228..36163aa9 100644 --- a/partx/Makefile.am +++ b/partx/Makefile.am @@ -4,10 +4,10 @@ if BUILD_PARTX usrsbin_exec_PROGRAMS = addpart delpart partx partx_SOURCES = bsd.c dos.c partx.c solaris.c unixware.c gpt.c crc32.c \ - efi.h gpt.h crc32.h partx.h dos.h ../lib/blkdev.c + efi.h gpt.h crc32.h partx.h dos.h $(top_srcdir)/lib/blkdev.c if LINUX -partx_SOURCES += ../lib/linux_version.c +partx_SOURCES += $(top_srcdir)/lib/linux_version.c endif dist_man_MANS = addpart.8 delpart.8 partx.8 diff --git a/sys-utils/Makefile.am b/sys-utils/Makefile.am index 06d991c3..0d9b3798 100644 --- a/sys-utils/Makefile.am +++ b/sys-utils/Makefile.am @@ -25,7 +25,7 @@ info_TEXINFOS = ipc.texi if BUILD_FALLOCATE usrbin_exec_PROGRAMS += fallocate -fallocate_SOURCES = fallocate.c ../lib/strtosize.c +fallocate_SOURCES = fallocate.c $(top_srcdir)/lib/strtosize.c dist_man_MANS += fallocate.1 endif -- cgit v1.2.3 From 7ccfa4dd66c59b01b81e30e7789b06cf574d631a Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 19 May 2010 14:27:22 -0400 Subject: mount: fix information about XFS log buffers in mount.8 Signed-off-by: Christoph Hellwig --- mount/mount.8 | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/mount/mount.8 b/mount/mount.8 index 06ea3acd..093001b8 100644 --- a/mount/mount.8 +++ b/mount/mount.8 @@ -2415,13 +2415,7 @@ was specified. .BI logbufs= value Set the number of in-memory log buffers. Valid numbers range from 2-8 inclusive. -The default value is 8 buffers for filesystems with a -blocksize of 64KiB, 4 buffers for filesystems with a blocksize -of 32KiB, 3 buffers for filesystems with a blocksize of 16KiB -and 2 buffers for all other configurations. Increasing the -number of buffers may increase performance on some workloads -at the cost of the memory used for the additional log buffers -and their associated control structures. +The default value is 8 buffers for any recent kernel. .TP .BI logbsize= value Set the size of each in-memory log buffer. @@ -2429,8 +2423,7 @@ Size may be specified in bytes, or in kilobytes with a "k" suffix. Valid sizes for version 1 and version 2 logs are 16384 (16k) and 32768 (32k). Valid sizes for version 2 logs also include 65536 (64k), 131072 (128k) and 262144 (256k). -The default value for machines with more than 32MiB of memory -is 32768, machines with less memory use 16384 by default. +The default value for any recent kernel is 32768. .TP \fBlogdev=\fP\fIdevice\fP and \fBrtdev=\fP\fIdevice\fP Use an external log (metadata journal) and/or real-time device. -- cgit v1.2.3 From 10852b82e292e8b1dafdd7ca10ffd6fa13437e94 Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Thu, 20 May 2010 16:58:16 +0200 Subject: mount: fix typo in comment Signed-off-by: Petr Uzel --- mount/mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mount/mount.c b/mount/mount.c index 969e81fc..576fed6b 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -1425,7 +1425,7 @@ try_mount_one (const char *spec0, const char *node0, const char *types0, } /* Kernel allows to use MS_RDONLY for bind mounts, but the read-only request - * could be silently ignored. Check it to avoid 'ro' in ntab and 'rw' in + * could be silently ignored. Check it to avoid 'ro' in mtab and 'rw' in * /proc/mounts. */ if (!fake && mnt5_res == 0 && -- cgit v1.2.3 From ff14168beedfc05598b77fe490bbbe347c4bf3cb Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Fri, 21 May 2010 14:18:31 +0200 Subject: umount: do not sync() as the kernel does it by itself On Fri, May 21, 2010 at 08:00:09AM -0400, Christoph Hellwig wrote: > On Fri, May 21, 2010 at 01:55:17PM +0200, Petr Uzel wrote: > > SUSE-based distributions have the following patch for some time. More > > info here: https://bugzilla.novell.com/show_bug.cgi?id=447036 > > > > From the Novell bugzilla: > > > > > I cannot see any justification for that sync call at all so I'd > > > probably just remove it. Your > > > patch is possibly safer so maybe it should be used as is. > > > > > > So, does anybody know why/if the sync() is actually needed? > > It's not needed. The kernel performs a sync by itself. Thanks, Christoph. Signed-off-by: Petr Uzel --- mount/umount.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mount/umount.c b/mount/umount.c index 6786ac57..75507b76 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -379,7 +379,6 @@ umount_all (char *types, char *test_opts) { } } - sync (); return errors; } -- cgit v1.2.3 From 1bb08542618958f554a740bf72d423d5029f1ab0 Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Fri, 21 May 2010 15:23:35 +0200 Subject: git: ignore index files generated by ctags and cscope Signed-off-by: Petr Uzel --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index a845cf2e..b73e83ce 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,8 @@ depcomp install-sh missing libtool +cscope.out +tags .deps .libs -- cgit v1.2.3 From 81694f8c60dffb7851f941e69a1b79bc573ace53 Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Fri, 21 May 2010 15:19:31 +0200 Subject: mount: detect when kernel silently adds MS_RDONLY flag Linux kernel can silently add MS_RDONLY flag when mounting file system that does not have write support. Check this to avoid 'ro' in /proc/mounts and 'rw' in mtab. [kzak@redhat.com: - don't check for 'ro' for MS_MOVE and MS_PROPAGATION] Reported-by: James Foris Signed-off-by: Petr Uzel Signed-off-by: Karel Zak --- mount/mount.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mount/mount.c b/mount/mount.c index 576fed6b..4f2dcd24 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -1435,6 +1435,18 @@ try_mount_one (const char *spec0, const char *node0, const char *types0, flags &= ~MS_RDONLY; } + /* Kernel can silently add MS_RDONLY flag when mounting file system that + * does not have write support. Check this to avoid 'ro' in /proc/mounts + * and 'rw' in mtab. + */ + if (!fake && mnt5_res == 0 && + !(flags & MS_RDONLY) && !(flags & MS_PROPAGATION) && !(flags & MS_MOVE) && + is_readonly(node)) { + + printf(_("mount: warning: %s seems to be mounted read-only.\n"), node); + flags |= MS_RDONLY; + } + if (fake || mnt5_res == 0) { /* Mount succeeded, report this (if verbose) and write mtab entry. */ -- cgit v1.2.3 From 87c9548fe513db6d4da2d7f0197ef1b9bb009bad Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 28 May 2010 14:58:22 +0200 Subject: mount: fix coding style Signed-off-by: Karel Zak --- mount/mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mount/mount.c b/mount/mount.c index 4f2dcd24..865665bf 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -1440,7 +1440,7 @@ try_mount_one (const char *spec0, const char *node0, const char *types0, * and 'rw' in mtab. */ if (!fake && mnt5_res == 0 && - !(flags & MS_RDONLY) && !(flags & MS_PROPAGATION) && !(flags & MS_MOVE) && + !(flags & (MS_RDONLY | MS_PROPAGATION | MS_MOVE)) && is_readonly(node)) { printf(_("mount: warning: %s seems to be mounted read-only.\n"), node); -- cgit v1.2.3 From efcb71f8ff36a5d9f56f04cc8b7cef82ecd98831 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 24 May 2010 12:44:39 +0200 Subject: taskset: move bitmap routines to lib/cpuset.c Signed-off-by: Karel Zak --- include/cpuset.h | 23 +++++ lib/cpuset.c | 241 +++++++++++++++++++++++++++++++++++++++++++++++++ schedutils/Makefile.am | 1 + schedutils/taskset.c | 238 +----------------------------------------------- 4 files changed, 266 insertions(+), 237 deletions(-) create mode 100644 include/cpuset.h create mode 100644 lib/cpuset.c diff --git a/include/cpuset.h b/include/cpuset.h new file mode 100644 index 00000000..373fd9ba --- /dev/null +++ b/include/cpuset.h @@ -0,0 +1,23 @@ +#ifndef UTIL_LINUX_CPUSET_H +#define UTIL_LINUX_CPUSET_H + +struct bitmask { + unsigned int size; + unsigned long *maskp; +}; + + +#define howmany(x,y) (((x)+((y)-1))/(y)) +#define bitsperlong (8 * sizeof(unsigned long)) +#define longsperbits(n) howmany(n, bitsperlong) +#define bytesperbits(x) ((x+7)/8) + +extern unsigned int bitmask_nbytes(struct bitmask *bmp); +extern struct bitmask *bitmask_alloc(unsigned int n); + +extern char *cpuset_to_cstr(struct bitmask *mask, char *str); +extern char *cpuset_to_str(struct bitmask *mask, char *str); +extern int str_to_cpuset(struct bitmask *mask, const char* str); +extern int cstr_to_cpuset(struct bitmask *mask, const char* str); + +#endif /* UTIL_LINUX_CPUSET_H */ diff --git a/lib/cpuset.c b/lib/cpuset.c new file mode 100644 index 00000000..abdd4090 --- /dev/null +++ b/lib/cpuset.c @@ -0,0 +1,241 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cpuset.h" + +static inline int val_to_char(int v) +{ + if (v >= 0 && v < 10) + return '0' + v; + else if (v >= 10 && v < 16) + return ('a' - 10) + v; + else + return -1; +} + +/* + * The following bitmask declarations, bitmask_*() routines, and associated + * _setbit() and _getbit() routines are: + * Copyright (c) 2004 Silicon Graphics, Inc. (SGI) All rights reserved. + * SGI publishes it under the terms of the GNU General Public License, v2, + * as published by the Free Software Foundation. + */ + +static unsigned int _getbit(const struct bitmask *bmp, unsigned int n) +{ + if (n < bmp->size) + return (bmp->maskp[n/bitsperlong] >> (n % bitsperlong)) & 1; + else + return 0; +} + +static void _setbit(struct bitmask *bmp, unsigned int n, unsigned int v) +{ + if (n < bmp->size) { + if (v) + bmp->maskp[n/bitsperlong] |= 1UL << (n % bitsperlong); + else + bmp->maskp[n/bitsperlong] &= ~(1UL << (n % bitsperlong)); + } +} + +static int bitmask_isbitset(const struct bitmask *bmp, unsigned int i) +{ + return _getbit(bmp, i); +} + +struct bitmask *bitmask_clearall(struct bitmask *bmp) +{ + unsigned int i; + for (i = 0; i < bmp->size; i++) + _setbit(bmp, i, 0); + return bmp; +} + +struct bitmask *bitmask_setbit(struct bitmask *bmp, unsigned int i) +{ + _setbit(bmp, i, 1); + return bmp; +} + +unsigned int bitmask_nbytes(struct bitmask *bmp) +{ + return longsperbits(bmp->size) * sizeof(unsigned long); +} + + +struct bitmask *bitmask_alloc(unsigned int n) +{ + struct bitmask *bmp; + + bmp = malloc(sizeof(*bmp)); + if (!bmp) + return 0; + bmp->size = n; + bmp->maskp = calloc(longsperbits(n), sizeof(unsigned long)); + if (!bmp->maskp) { + free(bmp); + return 0; + } + return bmp; +} + +static inline int char_to_val(int c) +{ + int cl; + + cl = tolower(c); + if (c >= '0' && c <= '9') + return c - '0'; + else if (cl >= 'a' && cl <= 'f') + return cl + (10 - 'a'); + else + return -1; +} + +static const char *nexttoken(const char *q, int sep) +{ + if (q) + q = strchr(q, sep); + if (q) + q++; + return q; +} + +char *cpuset_to_cstr(struct bitmask *mask, char *str) +{ + int i; + char *ptr = str; + int entry_made = 0; + + for (i = 0; i < mask->size; i++) { + if (bitmask_isbitset(mask, i)) { + int j; + int run = 0; + entry_made = 1; + for (j = i + 1; j < mask->size; j++) { + if (bitmask_isbitset(mask, j)) + run++; + else + break; + } + if (!run) + sprintf(ptr, "%d,", i); + else if (run == 1) { + sprintf(ptr, "%d,%d,", i, i + 1); + i++; + } else { + sprintf(ptr, "%d-%d,", i, i + run); + i += run; + } + while (*ptr != 0) + ptr++; + } + } + ptr -= entry_made; + *ptr = 0; + + return str; +} + +char *cpuset_to_str(struct bitmask *mask, char *str) +{ + int base; + char *ptr = str; + char *ret = 0; + + for (base = mask->size - 4; base >= 0; base -= 4) { + char val = 0; + if (bitmask_isbitset(mask, base)) + val |= 1; + if (bitmask_isbitset(mask, base + 1)) + val |= 2; + if (bitmask_isbitset(mask, base + 2)) + val |= 4; + if (bitmask_isbitset(mask, base + 3)) + val |= 8; + if (!ret && val) + ret = ptr; + *ptr++ = val_to_char(val); + } + *ptr = 0; + return ret ? ret : ptr - 1; +} + +int str_to_cpuset(struct bitmask *mask, const char* str) +{ + int len = strlen(str); + const char *ptr = str + len - 1; + int base = 0; + + /* skip 0x, it's all hex anyway */ + if (len > 1 && !memcmp(str, "0x", 2L)) + str += 2; + + bitmask_clearall(mask); + while (ptr >= str) { + char val = char_to_val(*ptr); + if (val == (char) -1) + return -1; + if (val & 1) + bitmask_setbit(mask, base); + if (val & 2) + bitmask_setbit(mask, base + 1); + if (val & 4) + bitmask_setbit(mask, base + 2); + if (val & 8) + bitmask_setbit(mask, base + 3); + len--; + ptr--; + base += 4; + } + + return 0; +} + +int cstr_to_cpuset(struct bitmask *mask, const char* str) +{ + const char *p, *q; + q = str; + bitmask_clearall(mask); + + while (p = q, q = nexttoken(q, ','), p) { + unsigned int a; /* beginning of range */ + unsigned int b; /* end of range */ + unsigned int s; /* stride */ + const char *c1, *c2; + + if (sscanf(p, "%u", &a) < 1) + return 1; + b = a; + s = 1; + + c1 = nexttoken(p, '-'); + c2 = nexttoken(p, ','); + if (c1 != NULL && (c2 == NULL || c1 < c2)) { + if (sscanf(c1, "%u", &b) < 1) + return 1; + c1 = nexttoken(c1, ':'); + if (c1 != NULL && (c2 == NULL || c1 < c2)) + if (sscanf(c1, "%u", &s) < 1) { + return 1; + } + } + + if (!(a <= b)) + return 1; + while (a <= b) { + bitmask_setbit(mask, a); + a += s; + } + } + + return 0; +} diff --git a/schedutils/Makefile.am b/schedutils/Makefile.am index 88439f2b..13d45c85 100644 --- a/schedutils/Makefile.am +++ b/schedutils/Makefile.am @@ -14,6 +14,7 @@ endif if HAVE_SCHED_GETAFFINITY usrbin_exec_PROGRAMS += taskset +taskset_SOURCES = taskset.c $(top_srcdir)/lib/cpuset.c dist_man_MANS += taskset.1 endif diff --git a/schedutils/taskset.c b/schedutils/taskset.c index 7abb9cbb..ed63a236 100644 --- a/schedutils/taskset.c +++ b/schedutils/taskset.c @@ -36,10 +36,7 @@ #include #include -struct bitmask { - unsigned int size; - unsigned long *maskp; -}; +#include "cpuset.h" static void show_usage(const char *cmd) { @@ -67,239 +64,6 @@ static void show_usage(const char *cmd) fprintf(stderr, " e.g. 0-31:2 is equivalent to mask 0x55555555\n\n"); } -static inline int val_to_char(int v) -{ - if (v >= 0 && v < 10) - return '0' + v; - else if (v >= 10 && v < 16) - return ('a' - 10) + v; - else - return -1; -} - -/* - * The following bitmask declarations, bitmask_*() routines, and associated - * _setbit() and _getbit() routines are: - * Copyright (c) 2004 Silicon Graphics, Inc. (SGI) All rights reserved. - * SGI publishes it under the terms of the GNU General Public License, v2, - * as published by the Free Software Foundation. - */ -#define howmany(x,y) (((x)+((y)-1))/(y)) -#define bitsperlong (8 * sizeof(unsigned long)) -#define longsperbits(n) howmany(n, bitsperlong) -#define bytesperbits(x) ((x+7)/8) - -static unsigned int _getbit(const struct bitmask *bmp, unsigned int n) -{ - if (n < bmp->size) - return (bmp->maskp[n/bitsperlong] >> (n % bitsperlong)) & 1; - else - return 0; -} - -static void _setbit(struct bitmask *bmp, unsigned int n, unsigned int v) -{ - if (n < bmp->size) { - if (v) - bmp->maskp[n/bitsperlong] |= 1UL << (n % bitsperlong); - else - bmp->maskp[n/bitsperlong] &= ~(1UL << (n % bitsperlong)); - } -} - -int bitmask_isbitset(const struct bitmask *bmp, unsigned int i) -{ - return _getbit(bmp, i); -} - -struct bitmask *bitmask_clearall(struct bitmask *bmp) -{ - unsigned int i; - for (i = 0; i < bmp->size; i++) - _setbit(bmp, i, 0); - return bmp; -} - -struct bitmask *bitmask_setbit(struct bitmask *bmp, unsigned int i) -{ - _setbit(bmp, i, 1); - return bmp; -} - -unsigned int bitmask_nbytes(struct bitmask *bmp) -{ - return longsperbits(bmp->size) * sizeof(unsigned long); -} - -static char * cpuset_to_str(struct bitmask *mask, char *str) -{ - int base; - char *ptr = str; - char *ret = 0; - - for (base = mask->size - 4; base >= 0; base -= 4) { - char val = 0; - if (bitmask_isbitset(mask, base)) - val |= 1; - if (bitmask_isbitset(mask, base + 1)) - val |= 2; - if (bitmask_isbitset(mask, base + 2)) - val |= 4; - if (bitmask_isbitset(mask, base + 3)) - val |= 8; - if (!ret && val) - ret = ptr; - *ptr++ = val_to_char(val); - } - *ptr = 0; - return ret ? ret : ptr - 1; -} - -struct bitmask *bitmask_alloc(unsigned int n) -{ - struct bitmask *bmp; - - bmp = malloc(sizeof(*bmp)); - if (!bmp) - return 0; - bmp->size = n; - bmp->maskp = calloc(longsperbits(n), sizeof(unsigned long)); - if (!bmp->maskp) { - free(bmp); - return 0; - } - return bmp; -} - -static char * cpuset_to_cstr(struct bitmask *mask, char *str) -{ - int i; - char *ptr = str; - int entry_made = 0; - - for (i = 0; i < mask->size; i++) { - if (bitmask_isbitset(mask, i)) { - int j; - int run = 0; - entry_made = 1; - for (j = i + 1; j < mask->size; j++) { - if (bitmask_isbitset(mask, j)) - run++; - else - break; - } - if (!run) - sprintf(ptr, "%d,", i); - else if (run == 1) { - sprintf(ptr, "%d,%d,", i, i + 1); - i++; - } else { - sprintf(ptr, "%d-%d,", i, i + run); - i += run; - } - while (*ptr != 0) - ptr++; - } - } - ptr -= entry_made; - *ptr = 0; - - return str; -} - -static inline int char_to_val(int c) -{ - int cl; - - cl = tolower(c); - if (c >= '0' && c <= '9') - return c - '0'; - else if (cl >= 'a' && cl <= 'f') - return cl + (10 - 'a'); - else - return -1; -} - -static int str_to_cpuset(struct bitmask *mask, const char* str) -{ - int len = strlen(str); - const char *ptr = str + len - 1; - int base = 0; - - /* skip 0x, it's all hex anyway */ - if (len > 1 && !memcmp(str, "0x", 2L)) - str += 2; - - bitmask_clearall(mask); - while (ptr >= str) { - char val = char_to_val(*ptr); - if (val == (char) -1) - return -1; - if (val & 1) - bitmask_setbit(mask, base); - if (val & 2) - bitmask_setbit(mask, base + 1); - if (val & 4) - bitmask_setbit(mask, base + 2); - if (val & 8) - bitmask_setbit(mask, base + 3); - len--; - ptr--; - base += 4; - } - - return 0; -} - -static const char *nexttoken(const char *q, int sep) -{ - if (q) - q = strchr(q, sep); - if (q) - q++; - return q; -} - -static int cstr_to_cpuset(struct bitmask *mask, const char* str) -{ - const char *p, *q; - q = str; - bitmask_clearall(mask); - - while (p = q, q = nexttoken(q, ','), p) { - unsigned int a; /* beginning of range */ - unsigned int b; /* end of range */ - unsigned int s; /* stride */ - const char *c1, *c2; - - if (sscanf(p, "%u", &a) < 1) - return 1; - b = a; - s = 1; - - c1 = nexttoken(p, '-'); - c2 = nexttoken(p, ','); - if (c1 != NULL && (c2 == NULL || c1 < c2)) { - if (sscanf(c1, "%u", &b) < 1) - return 1; - c1 = nexttoken(c1, ':'); - if (c1 != NULL && (c2 == NULL || c1 < c2)) - if (sscanf(c1, "%u", &s) < 1) { - return 1; - } - } - - if (!(a <= b)) - return 1; - while (a <= b) { - bitmask_setbit(mask, a); - a += s; - } - } - - return 0; -} - /* * Number of bits in a CPU bitmask on current system */ -- cgit v1.2.3 From 125b6a9191a1b09dbeaa1a068e7b0a966fca03fa Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 24 May 2010 14:13:33 +0200 Subject: tests: add cpuset regression test Signed-off-by: Karel Zak --- lib/Makefile.am | 3 +- lib/cpuset.c | 70 ++++++++++++++++++++++++++++++++++++++++ tests/commands.sh.in | 1 + tests/expected/schedutils/cpuset | 24 ++++++++++++++ tests/ts/schedutils/cpuset | 57 ++++++++++++++++++++++++++++++++ 5 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 tests/expected/schedutils/cpuset create mode 100755 tests/ts/schedutils/cpuset diff --git a/lib/Makefile.am b/lib/Makefile.am index 0f008b30..93b79a5a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -3,13 +3,14 @@ include $(top_srcdir)/config/include-Makefile.am AM_CPPFLAGS += -DTEST_PROGRAM noinst_PROGRAMS = test_blkdev test_ismounted test_wholedisk test_mangle \ - test_strtosize + test_strtosize test_cpuset test_blkdev_SOURCES = blkdev.c test_ismounted_SOURCES = ismounted.c test_wholedisk_SOURCES = wholedisk.c test_mangle_SOURCES = mangle.c test_strtosize_SOURCES = strtosize.c +test_cpuset_SOURCES = cpuset.c if LINUX test_blkdev_SOURCES += linux_version.c diff --git a/lib/cpuset.c b/lib/cpuset.c index abdd4090..92ed7304 100644 --- a/lib/cpuset.c +++ b/lib/cpuset.c @@ -239,3 +239,73 @@ int cstr_to_cpuset(struct bitmask *mask, const char* str) return 0; } + +#ifdef TEST_PROGRAM + +#include +#include + +int main(int argc, char *argv[]) +{ + struct bitmask *set; + char *buf, *mask = NULL, *range = NULL; + int ncpus = 2048, rc, c; + + struct option longopts[] = { + { "ncpus", 1, 0, 'n' }, + { "mask", 1, 0, 'm' }, + { "range", 1, 0, 'r' }, + { NULL, 0, 0, 0 } + }; + + while ((c = getopt_long(argc, argv, "n:m:r:", longopts, NULL)) != -1) { + switch(c) { + case 'n': + ncpus = atoi(optarg); + break; + case 'm': + mask = strdup(optarg); + break; + case 'r': + range = strdup(optarg); + break; + default: + goto usage_err; + } + } + + if (!mask && !range) + goto usage_err; + + set = bitmask_alloc(ncpus); + if (!set) + err(EXIT_FAILURE, "failed to allocate cpu set"); + + buf = malloc(7 * ncpus); + if (!buf) + err(EXIT_FAILURE, "failed to allocate cpu set buffer"); + + if (mask) + rc = str_to_cpuset(set, mask); + else + rc = cstr_to_cpuset(set, range); + + if (rc) + errx(EXIT_FAILURE, "failed to parse string: %s", mask ? : range); + + printf("%-15s = %15s ", mask ? : range, cpuset_to_str(set, buf)); + printf("[%s]\n", cpuset_to_cstr(set, buf)); + + free(buf); + free(set->maskp); + free(set); + + return EXIT_SUCCESS; + +usage_err: + fprintf(stderr, + "usage: %s [--ncpus ] --mask | --range ", + program_invocation_short_name); + exit(EXIT_FAILURE); +} +#endif diff --git a/tests/commands.sh.in b/tests/commands.sh.in index f52a6868..94f6521e 100644 --- a/tests/commands.sh.in +++ b/tests/commands.sh.in @@ -11,6 +11,7 @@ TS_HELPER_MD5="$TS_TOPDIR/helpers/test_md5" TS_HELPER_ISMOUNTED="$TOPDIR/lib/test_ismounted" TS_HELPER_STRTOSIZE="$TOPDIR/lib/test_strtosize" +TS_HELPER_CPUSET="$TOPDIR/lib/test_cpuset" # TODO: use partx TS_HELPER_PARTITIONS="$TOPDIR/shlibs/blkid/samples/partitions" diff --git a/tests/expected/schedutils/cpuset b/tests/expected/schedutils/cpuset new file mode 100644 index 00000000..10e17606 --- /dev/null +++ b/tests/expected/schedutils/cpuset @@ -0,0 +1,24 @@ +masks: +0x00000001 = 1 [0] +0x00000002 = 2 [1] +0x00000003 = 3 [0,1] +0x00000004 = 4 [2] +0x00000005 = 5 [0,2] +0x00000006 = 6 [1,2] +0x00000007 = 7 [0-2] +0x00000008 = 8 [3] +0x00000009 = 9 [0,3] +0x00005555 = 5555 [0,2,4,6,8,10,12,14] +0x00007777 = 7777 [0-2,4-6,8-10,12-14] +strings: +0 = 1 [0] +1 = 2 [1] +0,1 = 3 [0,1] +2 = 4 [2] +0,2 = 5 [0,2] +1,2 = 6 [1,2] +0-2 = 7 [0-2] +3 = 8 [3] +0,3 = 9 [0,3] +0,2,4,6,8,10,12,14 = 5555 [0,2,4,6,8,10,12,14] +0-2,4-6,8-10,12-14 = 7777 [0-2,4-6,8-10,12-14] diff --git a/tests/ts/schedutils/cpuset b/tests/ts/schedutils/cpuset new file mode 100755 index 00000000..6ad240dc --- /dev/null +++ b/tests/ts/schedutils/cpuset @@ -0,0 +1,57 @@ +#!/bin/bash + +# +# This file is part of util-linux-ng. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + +TS_TOPDIR="$(dirname $0)/../.." +TS_DESC="cpuset" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +MASKS=" 0x00000001 \ + 0x00000002 \ + 0x00000003 \ + 0x00000004 \ + 0x00000005 \ + 0x00000006 \ + 0x00000007 \ + 0x00000008 \ + 0x00000009 \ + 0x00005555 \ + 0x00007777" + +RANGES="0 \ + 1 \ + 0,1 \ + 2 \ + 0,2 \ + 1,2 \ + 0-2 \ + 3 \ + 0,3 \ + 0,2,4,6,8,10,12,14 \ + 0-2,4-6,8-10,12-14" + +ts_log "masks:" +for i in $MASKS; do + $TS_HELPER_CPUSET --mask $i >> $TS_OUTPUT +done + +ts_log "strings:" +for i in $RANGES; do + $TS_HELPER_CPUSET --range $i >> $TS_OUTPUT +done + +ts_finalize -- cgit v1.2.3 From ff5a6d206752f305b0552be13a4cb9f4b68e717b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 27 May 2010 11:32:50 +0200 Subject: taskset: use libc based cpu_set_t The glibc already supports dynamically allocated CPU sets. We don't have to maintains our private non-compatible implementation. Signed-off-by: Karel Zak --- include/cpuset.h | 23 +++--- lib/cpuset.c | 215 +++++++++++++++++++++++++-------------------------- schedutils/taskset.c | 82 +++++++++++--------- 3 files changed, 162 insertions(+), 158 deletions(-) diff --git a/include/cpuset.h b/include/cpuset.h index 373fd9ba..bc7961ca 100644 --- a/include/cpuset.h +++ b/include/cpuset.h @@ -1,23 +1,18 @@ #ifndef UTIL_LINUX_CPUSET_H #define UTIL_LINUX_CPUSET_H -struct bitmask { - unsigned int size; - unsigned long *maskp; -}; +#include -#define howmany(x,y) (((x)+((y)-1))/(y)) -#define bitsperlong (8 * sizeof(unsigned long)) -#define longsperbits(n) howmany(n, bitsperlong) -#define bytesperbits(x) ((x+7)/8) +#define cpuset_nbits(setsize) (8 * (setsize)) -extern unsigned int bitmask_nbytes(struct bitmask *bmp); -extern struct bitmask *bitmask_alloc(unsigned int n); +extern cpu_set_t *cpuset_alloc(int ncpus, size_t *setsize, size_t *nbits); +extern void cpuset_free(cpu_set_t *set); -extern char *cpuset_to_cstr(struct bitmask *mask, char *str); -extern char *cpuset_to_str(struct bitmask *mask, char *str); -extern int str_to_cpuset(struct bitmask *mask, const char* str); -extern int cstr_to_cpuset(struct bitmask *mask, const char* str); +extern char *cpulist_create(char *str, size_t len, cpu_set_t *set, size_t setsize); +extern int cpulist_parse(const char *str, cpu_set_t *set, size_t setsize); + +extern char *cpumask_create(char *str, size_t len, cpu_set_t *set, size_t setsize); +extern int cpumask_parse(const char *str, cpu_set_t *set, size_t setsize); #endif /* UTIL_LINUX_CPUSET_H */ diff --git a/lib/cpuset.c b/lib/cpuset.c index 92ed7304..189c23ea 100644 --- a/lib/cpuset.c +++ b/lib/cpuset.c @@ -1,3 +1,15 @@ +/* + * Terminology: + * + * cpuset - (libc) cpu_set_t data structure represents set of CPUs + * cpumask - string with hex mask (e.g. "0x00000001") + * cpulist - string with CPU ranges (e.g. "0-3,5,7,8") + * + * Based on code from taskset.c and Linux kernel. + * + * Copyright (C) 2010 Karel Zak + */ + #include #include #include @@ -6,7 +18,6 @@ #include #include #include -#include #include "cpuset.h" @@ -20,73 +31,6 @@ static inline int val_to_char(int v) return -1; } -/* - * The following bitmask declarations, bitmask_*() routines, and associated - * _setbit() and _getbit() routines are: - * Copyright (c) 2004 Silicon Graphics, Inc. (SGI) All rights reserved. - * SGI publishes it under the terms of the GNU General Public License, v2, - * as published by the Free Software Foundation. - */ - -static unsigned int _getbit(const struct bitmask *bmp, unsigned int n) -{ - if (n < bmp->size) - return (bmp->maskp[n/bitsperlong] >> (n % bitsperlong)) & 1; - else - return 0; -} - -static void _setbit(struct bitmask *bmp, unsigned int n, unsigned int v) -{ - if (n < bmp->size) { - if (v) - bmp->maskp[n/bitsperlong] |= 1UL << (n % bitsperlong); - else - bmp->maskp[n/bitsperlong] &= ~(1UL << (n % bitsperlong)); - } -} - -static int bitmask_isbitset(const struct bitmask *bmp, unsigned int i) -{ - return _getbit(bmp, i); -} - -struct bitmask *bitmask_clearall(struct bitmask *bmp) -{ - unsigned int i; - for (i = 0; i < bmp->size; i++) - _setbit(bmp, i, 0); - return bmp; -} - -struct bitmask *bitmask_setbit(struct bitmask *bmp, unsigned int i) -{ - _setbit(bmp, i, 1); - return bmp; -} - -unsigned int bitmask_nbytes(struct bitmask *bmp) -{ - return longsperbits(bmp->size) * sizeof(unsigned long); -} - - -struct bitmask *bitmask_alloc(unsigned int n) -{ - struct bitmask *bmp; - - bmp = malloc(sizeof(*bmp)); - if (!bmp) - return 0; - bmp->size = n; - bmp->maskp = calloc(longsperbits(n), sizeof(unsigned long)); - if (!bmp->maskp) { - free(bmp); - return 0; - } - return bmp; -} - static inline int char_to_val(int c) { int cl; @@ -109,102 +53,148 @@ static const char *nexttoken(const char *q, int sep) return q; } -char *cpuset_to_cstr(struct bitmask *mask, char *str) +/* + * Allocates a new set for ncpus and returns size in bytes and size in bits + */ +cpu_set_t *cpuset_alloc(int ncpus, size_t *setsize, size_t *nbits) +{ + cpu_set_t *set = CPU_ALLOC(ncpus); + + if (!set) + return NULL; + if (setsize) + *setsize = CPU_ALLOC_SIZE(ncpus); + if (nbits) + *nbits = cpuset_nbits(CPU_ALLOC_SIZE(ncpus)); + return set; +} + +void cpuset_free(cpu_set_t *set) +{ + CPU_FREE(set); +} + +/* + * Returns human readable representation of the cpuset. The output format is + * a list of CPUs with ranges (for example, "0,1,3-9"). + */ +char *cpulist_create(char *str, size_t len, + cpu_set_t *set, size_t setsize) { int i; char *ptr = str; int entry_made = 0; + size_t max = cpuset_nbits(setsize); - for (i = 0; i < mask->size; i++) { - if (bitmask_isbitset(mask, i)) { - int j; + for (i = 0; i < max; i++) { + if (CPU_ISSET_S(i, setsize, set)) { + int j, rlen; int run = 0; entry_made = 1; - for (j = i + 1; j < mask->size; j++) { - if (bitmask_isbitset(mask, j)) + for (j = i + 1; j < max; j++) { + if (CPU_ISSET_S(j, setsize, set)) run++; else break; } if (!run) - sprintf(ptr, "%d,", i); + rlen = snprintf(ptr, len, "%d,", i); else if (run == 1) { - sprintf(ptr, "%d,%d,", i, i + 1); + rlen = snprintf(ptr, len, "%d,%d,", i, i + 1); i++; } else { - sprintf(ptr, "%d-%d,", i, i + run); + rlen = snprintf(ptr, len, "%d-%d,", i, i + run); i += run; } - while (*ptr != 0) - ptr++; + if (rlen < 0 || rlen + 1 > len) + return NULL; + ptr += rlen; + len -= rlen; } } ptr -= entry_made; - *ptr = 0; + *ptr = '\0'; return str; } -char *cpuset_to_str(struct bitmask *mask, char *str) +/* + * Returns string with CPU mask. + */ +char *cpumask_create(char *str, size_t len, + cpu_set_t *set, size_t setsize) { - int base; char *ptr = str; - char *ret = 0; + char *ret = NULL; + int cpu; - for (base = mask->size - 4; base >= 0; base -= 4) { + for (cpu = cpuset_nbits(setsize) - 4; cpu >= 0; cpu -= 4) { char val = 0; - if (bitmask_isbitset(mask, base)) + + if (len == (ptr - str)) + break; + + if (CPU_ISSET_S(cpu, setsize, set)) val |= 1; - if (bitmask_isbitset(mask, base + 1)) + if (CPU_ISSET_S(cpu + 1, setsize, set)) val |= 2; - if (bitmask_isbitset(mask, base + 2)) + if (CPU_ISSET_S(cpu + 2, setsize, set)) val |= 4; - if (bitmask_isbitset(mask, base + 3)) + if (CPU_ISSET_S(cpu + 3, setsize, set)) val |= 8; + if (!ret && val) ret = ptr; *ptr++ = val_to_char(val); } - *ptr = 0; + *ptr = '\0'; return ret ? ret : ptr - 1; } -int str_to_cpuset(struct bitmask *mask, const char* str) +/* + * Parses string with list of CPU ranges. + */ +int cpumask_parse(const char *str, cpu_set_t *set, size_t setsize) { int len = strlen(str); const char *ptr = str + len - 1; - int base = 0; + int cpu = 0; /* skip 0x, it's all hex anyway */ if (len > 1 && !memcmp(str, "0x", 2L)) str += 2; - bitmask_clearall(mask); + CPU_ZERO_S(setsize, set); + while (ptr >= str) { char val = char_to_val(*ptr); if (val == (char) -1) return -1; if (val & 1) - bitmask_setbit(mask, base); + CPU_SET_S(cpu, setsize, set); if (val & 2) - bitmask_setbit(mask, base + 1); + CPU_SET_S(cpu + 1, setsize, set); if (val & 4) - bitmask_setbit(mask, base + 2); + CPU_SET_S(cpu + 2, setsize, set); if (val & 8) - bitmask_setbit(mask, base + 3); + CPU_SET_S(cpu + 3, setsize, set); len--; ptr--; - base += 4; + cpu += 4; } return 0; } -int cstr_to_cpuset(struct bitmask *mask, const char* str) +/* + * Parses string with CPUs mask. + */ +int cpulist_parse(const char *str, cpu_set_t *set, size_t setsize) { const char *p, *q; q = str; - bitmask_clearall(mask); + + CPU_ZERO_S(setsize, set); while (p = q, q = nexttoken(q, ','), p) { unsigned int a; /* beginning of range */ @@ -232,7 +222,7 @@ int cstr_to_cpuset(struct bitmask *mask, const char* str) if (!(a <= b)) return 1; while (a <= b) { - bitmask_setbit(mask, a); + CPU_SET_S(a, setsize, set); a += s; } } @@ -247,7 +237,8 @@ int cstr_to_cpuset(struct bitmask *mask, const char* str) int main(int argc, char *argv[]) { - struct bitmask *set; + cpu_set_t *set; + size_t setsize, buflen, nbits; char *buf, *mask = NULL, *range = NULL; int ncpus = 2048, rc, c; @@ -277,28 +268,34 @@ int main(int argc, char *argv[]) if (!mask && !range) goto usage_err; - set = bitmask_alloc(ncpus); + set = cpuset_alloc(ncpus, &setsize, &nbits); if (!set) err(EXIT_FAILURE, "failed to allocate cpu set"); - buf = malloc(7 * ncpus); + /* + fprintf(stderr, "ncpus: %d, cpuset bits: %zd, cpuset bytes: %zd\n", + ncpus, nbits, setsize); + */ + + buflen = 7 * nbits; + buf = malloc(buflen); if (!buf) err(EXIT_FAILURE, "failed to allocate cpu set buffer"); if (mask) - rc = str_to_cpuset(set, mask); + rc = cpumask_parse(mask, set, setsize); else - rc = cstr_to_cpuset(set, range); + rc = cpulist_parse(range, set, setsize); if (rc) errx(EXIT_FAILURE, "failed to parse string: %s", mask ? : range); - printf("%-15s = %15s ", mask ? : range, cpuset_to_str(set, buf)); - printf("[%s]\n", cpuset_to_cstr(set, buf)); + printf("%-15s = %15s ", mask ? : range, + cpumask_create(buf, buflen, set, setsize)); + printf("[%s]\n", cpulist_create(buf, buflen, set, setsize)); free(buf); - free(set->maskp); - free(set); + cpuset_free(set); return EXIT_SUCCESS; diff --git a/schedutils/taskset.c b/schedutils/taskset.c index ed63a236..154268eb 100644 --- a/schedutils/taskset.c +++ b/schedutils/taskset.c @@ -72,19 +72,31 @@ max_number_of_cpus(void) { int n; int cpus = 2048; + size_t setsize; + cpu_set_t *set = cpuset_alloc(cpus, &setsize, NULL); + + if (!set) + goto err; for (;;) { - unsigned long buffer[longsperbits(cpus)]; - memset(buffer, 0, sizeof(buffer)); + CPU_ZERO_S(setsize, set); + /* the library version does not return size of cpumask_t */ - n = syscall(SYS_sched_getaffinity, 0, bytesperbits(cpus), - &buffer); + n = syscall(SYS_sched_getaffinity, 0, setsize, set); + if (n < 0 && errno == EINVAL && cpus < 1024*1024) { + cpuset_free(set); cpus *= 2; + set = cpuset_alloc(cpus, &setsize, NULL); + if (!set) + goto err; continue; } + cpuset_free(set); return n*8; } + +err: fprintf (stderr, "cannot determine NR_CPUS; aborting"); exit(1); return 0; @@ -92,14 +104,13 @@ max_number_of_cpus(void) int main(int argc, char *argv[]) { - struct bitmask *new_mask, *cur_mask; + cpu_set_t *new_set, *cur_set; pid_t pid = 0; int opt, err; - char *mstr; - char *cstr; + char *buf; int c_opt = 0; - unsigned int cpus_configured; - int new_mask_byte_size, cur_mask_byte_size; + unsigned int ncpus; + size_t new_setsize, cur_setsize, cur_nbits, buflen; struct option longopts[] = { { "pid", 0, NULL, 'p' }, @@ -136,37 +147,34 @@ int main(int argc, char *argv[]) return 1; } - cpus_configured = max_number_of_cpus(); + ncpus = max_number_of_cpus(); /* * cur_mask is always used for the sched_getaffinity call * On the sched_getaffinity the kernel demands a user mask of * at least the size of its own cpumask_t. */ - cur_mask = bitmask_alloc(cpus_configured); - if (!cur_mask) { - fprintf (stderr, "bitmask_alloc failed\n"); + cur_set = cpuset_alloc(ncpus, &cur_setsize, &cur_nbits); + if (!cur_set) { + fprintf (stderr, "cpuset_alloc failed\n"); exit(1); } - cur_mask_byte_size = bitmask_nbytes(cur_mask); - mstr = malloc(1 + cur_mask->size / 4); - cstr = malloc(7 * cur_mask->size); + buflen = 7 * cur_nbits; + buf = malloc(buflen); /* * new_mask is always used for the sched_setaffinity call * On the sched_setaffinity the kernel will zero-fill its * cpumask_t if the user's mask is shorter. */ - new_mask = bitmask_alloc(cpus_configured); - if (!new_mask) { - fprintf (stderr, "bitmask_alloc failed\n"); + new_set = cpuset_alloc(ncpus, &new_setsize, NULL); + if (!new_set) { + fprintf (stderr, "cpuset_alloc failed\n"); exit(1); } - new_mask_byte_size = bitmask_nbytes(new_mask); if (pid) { - if (sched_getaffinity(pid, cur_mask_byte_size, - (cpu_set_t *)cur_mask->maskp) < 0) { + if (sched_getaffinity(pid, cur_setsize, cur_set) < 0) { perror("sched_getaffinity"); fprintf(stderr, "failed to get pid %d's affinity\n", pid); @@ -174,19 +182,19 @@ int main(int argc, char *argv[]) } if (c_opt) printf("pid %d's current affinity list: %s\n", pid, - cpuset_to_cstr(cur_mask, cstr)); + cpulist_create(buf, buflen, cur_set, cur_setsize)); else printf("pid %d's current affinity mask: %s\n", pid, - cpuset_to_str(cur_mask, mstr)); + cpumask_create(buf, buflen, cur_set, cur_setsize)); if (argc - optind == 1) return 0; } if (c_opt) - err = cstr_to_cpuset(new_mask, argv[optind]); + err = cpulist_parse(argv[optind], new_set, new_setsize); else - err = str_to_cpuset(new_mask, argv[optind]); + err = cpumask_parse(argv[optind], new_set, new_setsize); if (err) { if (c_opt) @@ -198,15 +206,13 @@ int main(int argc, char *argv[]) return 1; } - if (sched_setaffinity(pid, new_mask_byte_size, - (cpu_set_t *) new_mask->maskp) < 0) { + if (sched_setaffinity(pid, new_setsize, new_set) < 0) { perror("sched_setaffinity"); fprintf(stderr, "failed to set pid %d's affinity.\n", pid); return 1; } - if (sched_getaffinity(pid, cur_mask_byte_size, - (cpu_set_t *)cur_mask->maskp) < 0) { + if (sched_getaffinity(pid, cur_setsize, cur_set) < 0) { perror("sched_getaffinity"); fprintf(stderr, "failed to get pid %d's affinity.\n", pid); return 1; @@ -214,12 +220,18 @@ int main(int argc, char *argv[]) if (pid) { if (c_opt) - printf("pid %d's new affinity list: %s\n", pid, - cpuset_to_cstr(cur_mask, cstr)); + printf("pid %d's new affinity list: %s\n", pid, + cpulist_create(buf, buflen, cur_set, cur_setsize)); else - printf("pid %d's new affinity mask: %s\n", pid, - cpuset_to_str(cur_mask, mstr)); - } else { + printf("pid %d's new affinity mask: %s\n", pid, + cpumask_create(buf, buflen, cur_set, cur_setsize)); + } + + free(buf); + cpuset_free(cur_set); + cpuset_free(new_set); + + if (!pid) { argv += optind + 1; execvp(argv[0], argv); perror("execvp"); -- cgit v1.2.3 From ee32c514b5d61765a3ca6305d247b91fc8d15d0e Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 27 May 2010 13:32:12 +0200 Subject: lib: add fallback for libc (uClibc) without CPU_ALLOC Signed-off-by: Karel Zak --- configure.ac | 11 +++++++++++ include/cpuset.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ lib/Makefile.am | 5 ++++- lib/cpuset.c | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7fe91a1a..fae8db14 100644 --- a/configure.ac +++ b/configure.ac @@ -682,6 +682,17 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( ]) +AC_CHECK_TYPES([cpu_set_t], [have_cpu_set_t=yes], [], [[ +#include +]]) + +AM_CONDITIONAL(HAVE_CPU_SET_T, [test "x$have_cpu_set_t" = xyes]) + +AC_CHECK_DECLS([CPU_ALLOC], [], [], [[ +#include +]]) + + dnl UTIL_SET_ARCH(ARCHNAME, PATTERN) dnl --------------------------------- AC_DEFUN([UTIL_SET_ARCH], [ diff --git a/include/cpuset.h b/include/cpuset.h index bc7961ca..197476ed 100644 --- a/include/cpuset.h +++ b/include/cpuset.h @@ -3,6 +3,51 @@ #include +/* + * Fallback for old or obscure libcs without dynamically allocated cpusets + * + * The following macros are based on code from glibc. + * + * The GNU C Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ +#if !HAVE_DECL_CPU_ALLOC + +# define CPU_ZERO_S(setsize, cpusetp) \ + do { \ + size_t __i; \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ + __cpu_mask *__bits = (cpusetp)->__bits; \ + for (__i = 0; __i < __imax; ++__i) \ + __bits[__i] = 0; \ + } while (0) + +# define CPU_SET_S(cpu, setsize, cpusetp) \ + ({ size_t __cpu = (cpu); \ + __cpu < 8 * (setsize) \ + ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ + |= __CPUMASK (__cpu)) \ + : 0; }) + +# define CPU_ISSET_S(cpu, setsize, cpusetp) \ + ({ size_t __cpu = (cpu); \ + __cpu < 8 * (setsize) \ + ? ((((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ + & __CPUMASK (__cpu))) != 0 \ + : 0; }) + +extern int __cpuset_count_s(size_t setsize, const cpu_set_t *set); +# define CPU_COUNT_S(setsize, cpusetp) __cpuset_count_s(setsize, cpusetp) + +# define CPU_ALLOC_SIZE(count) \ + ((((count) + __NCPUBITS - 1) / __NCPUBITS) * sizeof (__cpu_mask)) +# define CPU_ALLOC(count) (malloc(CPU_ALLOC_SIZE(count))) +# define CPU_FREE(cpuset) (free(cpuset)) + +#endif /* !HAVE_DECL_CPU_ALLOC */ + #define cpuset_nbits(setsize) (8 * (setsize)) diff --git a/lib/Makefile.am b/lib/Makefile.am index 93b79a5a..c66deef0 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -3,7 +3,10 @@ include $(top_srcdir)/config/include-Makefile.am AM_CPPFLAGS += -DTEST_PROGRAM noinst_PROGRAMS = test_blkdev test_ismounted test_wholedisk test_mangle \ - test_strtosize test_cpuset + test_strtosize +if HAVE_CPU_SET_T +noinst_PROGRAMS += test_cpuset +endif test_blkdev_SOURCES = blkdev.c test_ismounted_SOURCES = ismounted.c diff --git a/lib/cpuset.c b/lib/cpuset.c index 189c23ea..d6cbf5d3 100644 --- a/lib/cpuset.c +++ b/lib/cpuset.c @@ -74,6 +74,39 @@ void cpuset_free(cpu_set_t *set) CPU_FREE(set); } +#if !HAVE_DECL_CPU_ALLOC +/* Please, use CPU_COUNT_S() macro. This is fallback */ +int __cpuset_count_s(size_t setsize, const cpu_set_t *set) +{ + int s = 0; + const __cpu_mask *p = set->__bits; + const __cpu_mask *end = &set->__bits[setsize / sizeof (__cpu_mask)]; + + while (p < end) { + __cpu_mask l = *p++; + + if (l == 0) + continue; +# if LONG_BIT > 32 + l = (l & 0x5555555555555555ul) + ((l >> 1) & 0x5555555555555555ul); + l = (l & 0x3333333333333333ul) + ((l >> 2) & 0x3333333333333333ul); + l = (l & 0x0f0f0f0f0f0f0f0ful) + ((l >> 4) & 0x0f0f0f0f0f0f0f0ful); + l = (l & 0x00ff00ff00ff00fful) + ((l >> 8) & 0x00ff00ff00ff00fful); + l = (l & 0x0000ffff0000fffful) + ((l >> 16) & 0x0000ffff0000fffful); + l = (l & 0x00000000fffffffful) + ((l >> 32) & 0x00000000fffffffful); +# else + l = (l & 0x55555555ul) + ((l >> 1) & 0x55555555ul); + l = (l & 0x33333333ul) + ((l >> 2) & 0x33333333ul); + l = (l & 0x0f0f0f0ful) + ((l >> 4) & 0x0f0f0f0ful); + l = (l & 0x00ff00fful) + ((l >> 8) & 0x00ff00fful); + l = (l & 0x0000fffful) + ((l >> 16) & 0x0000fffful); +# endif + s += l; + } + return s; +} +#endif + /* * Returns human readable representation of the cpuset. The output format is * a list of CPUs with ranges (for example, "0,1,3-9"). -- cgit v1.2.3 From de878776623b120fc1e96568f4cd69c349ec2677 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 27 May 2010 16:29:56 +0200 Subject: taskset: add NLS support, use err.h, cleanup Signed-off-by: Karel Zak --- schedutils/taskset.c | 179 ++++++++++++++++++++++----------------------------- 1 file changed, 78 insertions(+), 101 deletions(-) diff --git a/schedutils/taskset.c b/schedutils/taskset.c index 154268eb..66387c82 100644 --- a/schedutils/taskset.c +++ b/schedutils/taskset.c @@ -1,14 +1,6 @@ /* - * taskset.c - taskset - * Command-line utility for setting and retrieving a task's CPU affinity - * - * Robert Love 25 April 2002 - * - * Linux kernels as of 2.5.8 provide the needed syscalls for - * working with a task's cpu affinity. Currently 2.4 does not - * support these syscalls, but patches are available at: - * - * http://www.kernel.org/pub/linux/kernel/people/rml/cpu-affinity/ + * taskset.c - command-line utility for setting and retrieving + * a task's CPU affinity * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, v2, as @@ -24,6 +16,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Copyright (C) 2004 Robert Love + * Copyright (C) 2010 Karel Zak */ #include @@ -35,43 +28,48 @@ #include #include #include +#include #include "cpuset.h" +#include "nls.h" -static void show_usage(const char *cmd) +static void __attribute__((__noreturn__)) usage(FILE *out) { - fprintf(stderr, "taskset (%s)\n", PACKAGE_STRING); - fprintf(stderr, "usage: %s [options] [mask | cpu-list] [pid |"\ - " cmd [args...]]\n", cmd); - fprintf(stderr, "set or get the affinity of a process\n\n"); - fprintf(stderr, " -p, --pid " - "operate on existing given pid\n"); - fprintf(stderr, " -c, --cpu-list "\ - "display and specify cpus in list format\n"); - fprintf(stderr, " -h, --help display this help\n"); - fprintf(stderr, " -V, --version "\ - "output version information\n\n"); - fprintf(stderr, "The default behavior is to run a new command:\n"); - fprintf(stderr, " %s 03 sshd -b 1024\n", cmd); - fprintf(stderr, "You can retrieve the mask of an existing task:\n"); - fprintf(stderr, " %s -p 700\n", cmd); - fprintf(stderr, "Or set it:\n"); - fprintf(stderr, " %s -p 03 700\n", cmd); - fprintf(stderr, "List format uses a comma-separated list instead"\ - " of a mask:\n"); - fprintf(stderr, " %s -pc 0,3,7-11 700\n", cmd); - fprintf(stderr, "Ranges in list format can take a stride argument:\n"); - fprintf(stderr, " e.g. 0-31:2 is equivalent to mask 0x55555555\n\n"); + fprintf(out, + _("Usage: %s [options] [mask | cpu-list] [pid|cmd [args...]]\n\n"), + program_invocation_short_name); + + fprintf(out, _( + "Options:\n" + " -p, --pid operate on existing given pid\n" + " -c, --cpu-list display and specify cpus in list format\n" + " -h, --help display this help\n" + " -V, --version output version information\n\n")); + + fprintf(out, _( + "The default behavior is to run a new command:\n" + " %1$s 03 sshd -b 1024\n" + "You can retrieve the mask of an existing task:\n" + " %1$s -p 700\n" + "Or set it:\n" + " %1$s -p 03 700\n" + "List format uses a comma-separated list instead of a mask:\n" + " %1$s -pc 0,3,7-11 700\n" + "Ranges in list format can take a stride argument:\n" + " e.g. 0-31:2 is equivalent to mask 0x55555555\n"), + program_invocation_short_name); + + fprintf(out, _("\nFor more information see taskset(1).\n")); + + exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); } /* * Number of bits in a CPU bitmask on current system */ -static int -max_number_of_cpus(void) +static int max_number_of_cpus(void) { - int n; - int cpus = 2048; + int n, cpus = 2048; size_t setsize; cpu_set_t *set = cpuset_alloc(cpus, &setsize, NULL); @@ -84,7 +82,7 @@ max_number_of_cpus(void) /* the library version does not return size of cpumask_t */ n = syscall(SYS_sched_getaffinity, 0, setsize, set); - if (n < 0 && errno == EINVAL && cpus < 1024*1024) { + if (n < 0 && errno == EINVAL && cpus < 1024 * 1024) { cpuset_free(set); cpus *= 2; set = cpuset_alloc(cpus, &setsize, NULL); @@ -93,12 +91,10 @@ max_number_of_cpus(void) continue; } cpuset_free(set); - return n*8; + return n * 8; } - err: - fprintf (stderr, "cannot determine NR_CPUS; aborting"); - exit(1); + errx(EXIT_FAILURE, _("cannot determine NR_CPUS; aborting")); return 0; } @@ -106,9 +102,8 @@ int main(int argc, char *argv[]) { cpu_set_t *new_set, *cur_set; pid_t pid = 0; - int opt, err; + int opt, c_opt = 0, rc; char *buf; - int c_opt = 0; unsigned int ncpus; size_t new_setsize, cur_setsize, cur_nbits, buflen; @@ -120,9 +115,11 @@ int main(int argc, char *argv[]) { NULL, 0, NULL, 0 } }; - while ((opt = getopt_long(argc, argv, "+pchV", longopts, NULL)) != -1) { - int ret = 1; + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + while ((opt = getopt_long(argc, argv, "+pchV", longopts, NULL)) != -1) { switch (opt) { case 'p': pid = atoi(argv[argc - 1]); @@ -132,98 +129,80 @@ int main(int argc, char *argv[]) break; case 'V': printf("taskset (%s)\n", PACKAGE_STRING); - return 0; + return EXIT_SUCCESS; case 'h': - ret = 0; + usage(stdout); + break; default: - show_usage(argv[0]); - return ret; + usage(stderr); + break; } } if ((!pid && argc - optind < 2) - || (pid && (argc - optind < 1 || argc - optind > 2))) { - show_usage(argv[0]); - return 1; - } + || (pid && (argc - optind < 1 || argc - optind > 2))) + usage(stderr); ncpus = max_number_of_cpus(); /* - * cur_mask is always used for the sched_getaffinity call + * cur_set is always used for the sched_getaffinity call * On the sched_getaffinity the kernel demands a user mask of * at least the size of its own cpumask_t. */ cur_set = cpuset_alloc(ncpus, &cur_setsize, &cur_nbits); - if (!cur_set) { - fprintf (stderr, "cpuset_alloc failed\n"); - exit(1); - } + if (!cur_set) + err(EXIT_FAILURE, _("cpuset_alloc failed")); + buflen = 7 * cur_nbits; buf = malloc(buflen); + if (!buf) + err(EXIT_FAILURE, _("malloc failed")); /* - * new_mask is always used for the sched_setaffinity call + * new_set is always used for the sched_setaffinity call * On the sched_setaffinity the kernel will zero-fill its * cpumask_t if the user's mask is shorter. */ new_set = cpuset_alloc(ncpus, &new_setsize, NULL); - if (!new_set) { - fprintf (stderr, "cpuset_alloc failed\n"); - exit(1); - } + if (!new_set) + err(EXIT_FAILURE, _("cpuset_alloc failed")); if (pid) { - if (sched_getaffinity(pid, cur_setsize, cur_set) < 0) { - perror("sched_getaffinity"); - fprintf(stderr, "failed to get pid %d's affinity\n", - pid); - return 1; - } + if (sched_getaffinity(pid, cur_setsize, cur_set) < 0) + err(EXIT_FAILURE, _("failed to get pid %d's affinity"), pid); + if (c_opt) - printf("pid %d's current affinity list: %s\n", pid, + printf(_("pid %d's current affinity list: %s\n"), pid, cpulist_create(buf, buflen, cur_set, cur_setsize)); else - printf("pid %d's current affinity mask: %s\n", pid, + printf(_("pid %d's current affinity mask: %s\n"), pid, cpumask_create(buf, buflen, cur_set, cur_setsize)); if (argc - optind == 1) - return 0; + return EXIT_SUCCESS; } - if (c_opt) - err = cpulist_parse(argv[optind], new_set, new_setsize); - else - err = cpumask_parse(argv[optind], new_set, new_setsize); + rc = c_opt ? cpulist_parse(argv[optind], new_set, new_setsize) : + cpumask_parse(argv[optind], new_set, new_setsize); - if (err) { - if (c_opt) - fprintf(stderr, "failed to parse CPU list %s\n", - argv[optind]); - else - fprintf(stderr, "failed to parse CPU mask %s\n", + if (rc) + errx(EXIT_FAILURE, _("failed to parse %s %s"), + c_opt ? _("CPU list") : _("CPU mask"), argv[optind]); - return 1; - } - if (sched_setaffinity(pid, new_setsize, new_set) < 0) { - perror("sched_setaffinity"); - fprintf(stderr, "failed to set pid %d's affinity.\n", pid); - return 1; - } + if (sched_setaffinity(pid, new_setsize, new_set) < 0) + err(EXIT_FAILURE, _("failed to set pid %d's affinity"), pid); - if (sched_getaffinity(pid, cur_setsize, cur_set) < 0) { - perror("sched_getaffinity"); - fprintf(stderr, "failed to get pid %d's affinity.\n", pid); - return 1; - } + if (sched_getaffinity(pid, cur_setsize, cur_set) < 0) + err(EXIT_FAILURE, _("failed to get pid %d's affinity"), pid); if (pid) { if (c_opt) - printf("pid %d's new affinity list: %s\n", pid, + printf(_("pid %d's new affinity list: %s\n"), pid, cpulist_create(buf, buflen, cur_set, cur_setsize)); else - printf("pid %d's new affinity mask: %s\n", pid, + printf(_("pid %d's new affinity mask: %s\n"), pid, cpumask_create(buf, buflen, cur_set, cur_setsize)); } @@ -234,10 +213,8 @@ int main(int argc, char *argv[]) if (!pid) { argv += optind + 1; execvp(argv[0], argv); - perror("execvp"); - fprintf(stderr, "failed to execute %s\n", argv[0]); - return 1; + err(EXIT_FAILURE, _("executing %s failed"), argv[0]); } - return 0; + return EXIT_SUCCESS; } -- cgit v1.2.3 From ef173bde3fda2db510e0b3b72c9654c9dcffa9b7 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 27 May 2010 17:24:28 +0200 Subject: lscpu: cleanup path_scanstr() Signed-off-by: Karel Zak --- sys-utils/lscpu.c | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 77a3e5c2..e104dfc9 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -122,8 +122,10 @@ struct cpu_desc { char pathbuf[PATH_MAX] = "/"; -static void path_scanstr(char *result, const char *path, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); +static void path_getstr(char *result, size_t len, const char *path, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); +static int path_getnum(const char *path, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); static int path_exist(const char *path, ...) __attribute__ ((__format__ (__printf__, 1, 2))); static int path_sibling(const char *path, ...) @@ -146,22 +148,43 @@ path_vfopen(const char *mode, const char *path, va_list ap) } static void -path_scanstr(char *result, const char *path, ...) +path_getstr(char *result, size_t len, const char *path, ...) +{ + FILE *fd; + va_list ap; + + va_start(ap, path); + fd = path_vfopen("r", path, ap); + va_end(ap); + + if (!fgets(result, len, fd)) + err(EXIT_FAILURE, _("failed to read: %s"), pathbuf); + fclose(fd); + + len = strlen(result); + if (result[len - 1] == '\n') + result[len - 1] = '\0'; +} + +static int +path_getnum(const char *path, ...) { FILE *fd; va_list ap; + int result; va_start(ap, path); fd = path_vfopen("r", path, ap); va_end(ap); - if (fscanf(fd, "%s", result) != 1) { + if (fscanf(fd, "%d", &result) != 1) { if (ferror(fd)) err(EXIT_FAILURE, _("error: %s"), pathbuf); else errx(EXIT_FAILURE, _("error parse: %s"), pathbuf); } fclose(fd); + return result; } static int @@ -461,7 +484,8 @@ read_cache(struct cpu_desc *cpu) continue; /* cache type */ - path_scanstr(buf, _PATH_SYS_CPU0 "/cache/%s/type", dir->d_name); + path_getstr(buf, sizeof(buf), + _PATH_SYS_CPU0 "/cache/%s/type", dir->d_name); if (!strcmp(buf, "Data")) type = 'd'; else if (!strcmp(buf, "Instruction")) @@ -470,8 +494,8 @@ read_cache(struct cpu_desc *cpu) type = 0; /* cache level */ - path_scanstr(buf, _PATH_SYS_CPU0 "/cache/%s/level", dir->d_name); - level = atoi(buf); + level = path_getnum(_PATH_SYS_CPU0 "/cache/%s/level", + dir->d_name); if (type) snprintf(buf, sizeof(buf), "L%d%c", level, type); @@ -481,7 +505,8 @@ read_cache(struct cpu_desc *cpu) cpu->cache[cpu->ct_cache].caname = xstrdup(buf); /* cache size */ - path_scanstr(buf, _PATH_SYS_CPU0 "/cache/%s/size", dir->d_name); + path_getstr(buf, sizeof(buf), + _PATH_SYS_CPU0 "/cache/%s/size", dir->d_name); cpu->cache[cpu->ct_cache].casize = xstrdup(buf); /* information about how CPUs share different caches */ -- cgit v1.2.3 From e8aa16eedd16a86877e6df5a042eb39768406b9f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 27 May 2010 23:39:41 +0200 Subject: lscpu: cleanup used names Signed-off-by: Karel Zak --- sys-utils/lscpu.c | 229 +++++++++++++++++++++++++++--------------------------- 1 file changed, 115 insertions(+), 114 deletions(-) diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index e104dfc9..3f1c3275 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -47,12 +47,6 @@ int have_topology; int have_cache; int have_node; -/* cache(s) description */ -struct ca_desc { - char *caname; - char *casize; - int camap; -}; /* virtualization types */ enum { @@ -87,8 +81,15 @@ enum { MODE_LONG = (1 << 3) }; -/* CPU(s) description */ -struct cpu_desc { +/* cache(s) description */ +struct cpu_cache { + char *name; + char *size; + int map; +}; + +/* global description */ +struct lscpu_desc { /* counters */ int ct_cpu; int ct_thread; @@ -107,7 +108,7 @@ struct cpu_desc { int virtype; /* VIRT_PARA|FULL|NONE ? */ /* caches */ - struct ca_desc cache[CACHE_MAX]; + struct cpu_cache cache[CACHE_MAX]; /* misc */ char *mhz; @@ -279,7 +280,7 @@ int lookup(char *line, char *pattern, char **value) } static void -read_basicinfo(struct cpu_desc *cpu) +read_basicinfo(struct lscpu_desc *desc) { FILE *fp = xfopen(_PATH_PROC_CPUINFO, "r"); char buf[BUFSIZ]; @@ -288,41 +289,41 @@ read_basicinfo(struct cpu_desc *cpu) /* architecture */ if (uname(&utsbuf) == -1) err(EXIT_FAILURE, _("error: uname failed")); - cpu->arch = xstrdup(utsbuf.machine); + desc->arch = xstrdup(utsbuf.machine); /* count CPU(s) */ - while(path_exist(_PATH_SYS_SYSTEM "/cpu/cpu%d", cpu->ct_cpu)) - cpu->ct_cpu++; + while(path_exist(_PATH_SYS_SYSTEM "/cpu/cpu%d", desc->ct_cpu)) + desc->ct_cpu++; /* details */ while (fgets(buf, sizeof(buf), fp) != NULL) { /* IA64 */ - if (lookup(buf, "vendor", &cpu->vendor)) ; - else if (lookup(buf, "vendor_id", &cpu->vendor)) ; + if (lookup(buf, "vendor", &desc->vendor)) ; + else if (lookup(buf, "vendor_id", &desc->vendor)) ; /* IA64 */ - else if (lookup(buf, "family", &cpu->family)) ; - else if (lookup(buf, "cpu family", &cpu->family)) ; - else if (lookup(buf, "model", &cpu->model)) ; - else if (lookup(buf, "stepping", &cpu->stepping)) ; - else if (lookup(buf, "cpu MHz", &cpu->mhz)) ; - else if (lookup(buf, "flags", &cpu->flags)) ; + else if (lookup(buf, "family", &desc->family)) ; + else if (lookup(buf, "cpu family", &desc->family)) ; + else if (lookup(buf, "model", &desc->model)) ; + else if (lookup(buf, "stepping", &desc->stepping)) ; + else if (lookup(buf, "cpu MHz", &desc->mhz)) ; + else if (lookup(buf, "flags", &desc->flags)) ; else continue; } - if (cpu->flags) { - snprintf(buf, sizeof(buf), " %s ", cpu->flags); + if (desc->flags) { + snprintf(buf, sizeof(buf), " %s ", desc->flags); if (strstr(buf, " svm ")) - cpu->virtflag = strdup("svm"); + desc->virtflag = strdup("svm"); else if (strstr(buf, " vmx ")) - cpu->virtflag = strdup("vmx"); + desc->virtflag = strdup("vmx"); if (strstr(buf, " rm ")) - cpu->mode |= MODE_REAL; + desc->mode |= MODE_REAL; if (strstr(buf, " tm ")) - cpu->mode |= MODE_TRANSPARENT; + desc->mode |= MODE_TRANSPARENT; if (strstr(buf, " lm ")) - cpu->mode |= MODE_LONG; + desc->mode |= MODE_LONG; } fclose(fp); @@ -387,7 +388,7 @@ cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, } static void -read_hypervisor_cpuid(struct cpu_desc *cpu) +read_hypervisor_cpuid(struct lscpu_desc *desc) { unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0; char hyper_vendor_id[13]; @@ -404,28 +405,28 @@ read_hypervisor_cpuid(struct cpu_desc *cpu) return; if (!strncmp("XenVMMXenVMM", hyper_vendor_id, 12)) - cpu->hyper = HYPER_XEN; + desc->hyper = HYPER_XEN; else if (!strncmp("KVMKVMKVM", hyper_vendor_id, 9)) - cpu->hyper = HYPER_KVM; + desc->hyper = HYPER_KVM; else if (!strncmp("Microsoft Hv", hyper_vendor_id, 12)) - cpu->hyper = HYPER_MSHV; + desc->hyper = HYPER_MSHV; } #else /* ! __x86_64__ */ static void -read_hypervisor_cpuid(struct cpu_desc *cpu) +read_hypervisor_cpuid(struct lscpu_desc *desc) { } #endif static void -read_hypervisor(struct cpu_desc *cpu) +read_hypervisor(struct lscpu_desc *desc) { - read_hypervisor_cpuid(cpu); + read_hypervisor_cpuid(desc); - if (cpu->hyper) + if (desc->hyper) /* hvm */ - cpu->virtype = VIRT_FULL; + desc->virtype = VIRT_FULL; else if (!access(_PATH_PROC_XEN, F_OK)) { /* Xen para-virt or dom0 */ @@ -440,34 +441,34 @@ read_hypervisor(struct cpu_desc *cpu) dom0 = 1; fclose(fd); } - cpu->virtype = dom0 ? VIRT_NONE : VIRT_PARA; - cpu->hyper = HYPER_XEN; + desc->virtype = dom0 ? VIRT_NONE : VIRT_PARA; + desc->hyper = HYPER_XEN; } else if (has_pci_device(0x5853, 0x0001)) { /* Xen full-virt on non-x86_64 */ - cpu->hyper = HYPER_XEN; - cpu->virtype = VIRT_FULL; + desc->hyper = HYPER_XEN; + desc->virtype = VIRT_FULL; } } static void -read_topology(struct cpu_desc *cpu) +read_topology(struct lscpu_desc *desc) { /* number of threads */ - cpu->ct_thread = path_sibling( + desc->ct_thread = path_sibling( _PATH_SYS_CPU0 "/topology/thread_siblings"); /* number of cores */ - cpu->ct_core = path_sibling( + desc->ct_core = path_sibling( _PATH_SYS_CPU0 "/topology/core_siblings") - / cpu->ct_thread; + / desc->ct_thread; /* number of sockets */ - cpu->ct_socket = cpu->ct_cpu / cpu->ct_core / cpu->ct_thread; + desc->ct_socket = desc->ct_cpu / desc->ct_core / desc->ct_thread; } static void -read_cache(struct cpu_desc *cpu) +read_cache(struct lscpu_desc *desc) { char buf[256]; DIR *dp; @@ -502,37 +503,37 @@ read_cache(struct cpu_desc *cpu) else snprintf(buf, sizeof(buf), "L%d", level); - cpu->cache[cpu->ct_cache].caname = xstrdup(buf); + desc->cache[desc->ct_cache].name = xstrdup(buf); /* cache size */ path_getstr(buf, sizeof(buf), _PATH_SYS_CPU0 "/cache/%s/size", dir->d_name); - cpu->cache[cpu->ct_cache].casize = xstrdup(buf); + desc->cache[desc->ct_cache].size = xstrdup(buf); /* information about how CPUs share different caches */ - cpu->cache[cpu->ct_cache].camap = path_sibling( + desc->cache[desc->ct_cache].map = path_sibling( _PATH_SYS_CPU0 "/cache/%s/shared_cpu_map", dir->d_name); - cpu->ct_cache++; + desc->ct_cache++; } } static void -read_nodes(struct cpu_desc *cpu) +read_nodes(struct lscpu_desc *desc) { int i; /* number of NUMA node */ - while (path_exist(_PATH_SYS_SYSTEM "/node/node%d", cpu->ct_node)) - cpu->ct_node++; + while (path_exist(_PATH_SYS_SYSTEM "/node/node%d", desc->ct_node)) + desc->ct_node++; - cpu->nodecpu = (int *) malloc(cpu->ct_node * sizeof(int)); - if (!cpu->nodecpu) + desc->nodecpu = (int *) malloc(desc->ct_node * sizeof(int)); + if (!desc->nodecpu) err(EXIT_FAILURE, _("error: malloc failed")); /* information about how nodes share different CPUs */ - for (i = 0; i < cpu->ct_node; i++) - cpu->nodecpu[i] = path_sibling( + for (i = 0; i < desc->ct_node; i++) + desc->nodecpu[i] = path_sibling( _PATH_SYS_SYSTEM "/node/node%d/cpumap", i); } @@ -556,7 +557,7 @@ check_system(void) } static void -print_parsable(struct cpu_desc *cpu) +print_parsable(struct lscpu_desc *desc) { int i, j; @@ -570,26 +571,26 @@ print_parsable(struct cpu_desc *cpu) /* separator between CPU topology and cache information */ putchar(','); - for (i = cpu->ct_cache - 1; i >= 0; i--) - printf(",%s", cpu->cache[i].caname); + for (i = desc->ct_cache - 1; i >= 0; i--) + printf(",%s", desc->cache[i].name); } putchar('\n'); - for (i = 0; i < cpu->ct_cpu; i++) { + for (i = 0; i < desc->ct_cpu; i++) { printf("%d", i); if (have_topology) printf(",%d,%d", - i / cpu->ct_thread, - i / cpu->ct_core / cpu->ct_thread); + i / desc->ct_thread, + i / desc->ct_core / desc->ct_thread); else printf(",,"); if (have_node) { int c = 0; - for (j = 0; j < cpu->ct_node; j++) { - c += cpu->nodecpu[j]; + for (j = 0; j < desc->ct_node; j++) { + c += desc->nodecpu[j]; if (i < c) { printf(",%d", j); break; @@ -601,14 +602,14 @@ print_parsable(struct cpu_desc *cpu) if (have_cache) { putchar(','); - for (j = cpu->ct_cache - 1; j >= 0; j--) { + for (j = desc->ct_cache - 1; j >= 0; j--) { /* If shared_cpu_map is 0, all CPUs share the same cache. */ - if (cpu->cache[j].camap == 0) - cpu->cache[j].camap = cpu->ct_core * - cpu->ct_thread; + if (desc->cache[j].map == 0) + desc->cache[j].map = desc->ct_core * + desc->ct_thread; - printf(",%d", i / cpu->cache[j].camap); + printf(",%d", i / desc->cache[j].map); } } putchar('\n'); @@ -621,22 +622,22 @@ print_parsable(struct cpu_desc *cpu) #define print_n(_key, _val) printf("%-23s%d\n", _key, _val) static void -print_readable(struct cpu_desc *cpu) +print_readable(struct lscpu_desc *desc) { - print_s("Architecture:", cpu->arch); + print_s("Architecture:", desc->arch); - if (cpu->mode & (MODE_REAL | MODE_TRANSPARENT | MODE_LONG)) { + if (desc->mode & (MODE_REAL | MODE_TRANSPARENT | MODE_LONG)) { char buf[64], *p = buf; - if (cpu->mode & MODE_REAL) { + if (desc->mode & MODE_REAL) { strcpy(p, "16-bit, "); p += 8; } - if (cpu->mode & MODE_TRANSPARENT) { + if (desc->mode & MODE_TRANSPARENT) { strcpy(p, "32-bit, "); p += 8; } - if (cpu->mode & MODE_LONG) { + if (desc->mode & MODE_LONG) { strcpy(p, "64-bit, "); p += 8; } @@ -644,44 +645,44 @@ print_readable(struct cpu_desc *cpu) print_s(_("CPU op-mode(s):"), buf); } - print_n("CPU(s):", cpu->ct_cpu); + print_n("CPU(s):", desc->ct_cpu); if (have_topology) { - print_n(_("Thread(s) per core:"), cpu->ct_thread); - print_n(_("Core(s) per socket:"), cpu->ct_core); - print_n(_("CPU socket(s):"), cpu->ct_socket); + print_n(_("Thread(s) per core:"), desc->ct_thread); + print_n(_("Core(s) per socket:"), desc->ct_core); + print_n(_("CPU socket(s):"), desc->ct_socket); } if (have_node) - print_n(_("NUMA node(s):"), cpu->ct_node); - if (cpu->vendor) - print_s(_("Vendor ID:"), cpu->vendor); - if (cpu->family) - print_s(_("CPU family:"), cpu->family); - if (cpu->model) - print_s(_("Model:"), cpu->model); - if (cpu->stepping) - print_s(_("Stepping:"), cpu->stepping); - if (cpu->mhz) - print_s(_("CPU MHz:"), cpu->mhz); - if (cpu->virtflag) { - if (!strcmp(cpu->virtflag, "svm")) + print_n(_("NUMA node(s):"), desc->ct_node); + if (desc->vendor) + print_s(_("Vendor ID:"), desc->vendor); + if (desc->family) + print_s(_("CPU family:"), desc->family); + if (desc->model) + print_s(_("Model:"), desc->model); + if (desc->stepping) + print_s(_("Stepping:"), desc->stepping); + if (desc->mhz) + print_s(_("CPU MHz:"), desc->mhz); + if (desc->virtflag) { + if (!strcmp(desc->virtflag, "svm")) print_s(_("Virtualization:"), "AMD-V"); - else if (!strcmp(cpu->virtflag, "vmx")) + else if (!strcmp(desc->virtflag, "vmx")) print_s(_("Virtualization:"), "VT-x"); } - if (cpu->hyper) { - print_s(_("Hypervisor vendor:"), hv_vendors[cpu->hyper]); - print_s(_("Virtualization type:"), virt_types[cpu->virtype]); + if (desc->hyper) { + print_s(_("Hypervisor vendor:"), hv_vendors[desc->hyper]); + print_s(_("Virtualization type:"), virt_types[desc->virtype]); } if (have_cache) { char buf[512]; int i; - for (i = cpu->ct_cache - 1; i >= 0; i--) { + for (i = desc->ct_cache - 1; i >= 0; i--) { snprintf(buf, sizeof(buf), - _("%s cache:"), cpu->cache[i].caname); - print_s(buf, cpu->cache[i].casize); + _("%s cache:"), desc->cache[i].name); + print_s(buf, desc->cache[i].size); } } } @@ -701,15 +702,15 @@ void usage(int rc) static int ca_compare(const void *a, const void *b) { - struct ca_desc *cache1 = (struct ca_desc *) a; - struct ca_desc *cache2 = (struct ca_desc *) b; + struct cpu_cache *c1 = (struct cpu_cache *) a; + struct cpu_cache *c2 = (struct cpu_cache *) b; - return strcmp(cache2->caname, cache1->caname); + return strcmp(c2->name, c1->name); } int main(int argc, char *argv[]) { - struct cpu_desc _cpu, *cpu = &_cpu; + struct lscpu_desc _desc, *desc = &_desc; int parsable = 0, c; struct option longopts[] = { @@ -742,28 +743,28 @@ int main(int argc, char *argv[]) errx(EXIT_FAILURE, _("error: change working directory to %s."), pathbuf); - memset(cpu, 0, sizeof(*cpu)); + memset(desc, 0, sizeof(*desc)); check_system(); - read_basicinfo(cpu); + read_basicinfo(desc); if (have_topology) - read_topology(cpu); + read_topology(desc); if (have_cache) { - read_cache(cpu); - qsort(cpu->cache, cpu->ct_cache, sizeof(struct ca_desc), ca_compare); + read_cache(desc); + qsort(desc->cache, desc->ct_cache, sizeof(struct cpu_cache), ca_compare); } if (have_node) - read_nodes(cpu); + read_nodes(desc); - read_hypervisor(cpu); + read_hypervisor(desc); /* Show time! */ if (parsable) - print_parsable(cpu); + print_parsable(desc); else - print_readable(cpu); + print_readable(desc); return EXIT_SUCCESS; } -- cgit v1.2.3 From d50363cd62f089c790bbbf37dfa641f584b2fb0b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 28 May 2010 10:45:41 +0200 Subject: lscpu: improve --sysroot code Signed-off-by: Karel Zak --- sys-utils/lscpu.c | 108 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 73 insertions(+), 35 deletions(-) diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 3f1c3275..d554f9b2 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -36,12 +36,12 @@ #define CACHE_MAX 100 /* /sys paths */ -#define _PATH_SYS_SYSTEM "sys/devices/system" +#define _PATH_SYS_SYSTEM "/sys/devices/system" #define _PATH_SYS_CPU0 _PATH_SYS_SYSTEM "/cpu/cpu0" -#define _PATH_PROC_XEN "proc/xen" +#define _PATH_PROC_XEN "/proc/xen" #define _PATH_PROC_XENCAP _PATH_PROC_XEN "/capabilities" -#define _PATH_PROC_CPUINFO "proc/cpuinfo" -#define _PATH_PROC_PCIDEVS "proc/bus/pci/devices" +#define _PATH_PROC_CPUINFO "/proc/cpuinfo" +#define _PATH_PROC_PCIDEVS "/proc/bus/pci/devices" int have_topology; int have_cache; @@ -121,8 +121,13 @@ struct lscpu_desc { int *nodecpu; }; -char pathbuf[PATH_MAX] = "/"; +static size_t sysrootlen; +static char pathbuf[PATH_MAX]; +static const char *path_create(const char *path, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); +static FILE *path_fopen(const char *mode, int exit_on_err, const char *path, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); static void path_getstr(char *result, size_t len, const char *path, ...) __attribute__ ((__format__ (__printf__, 3, 4))); static int path_getnum(const char *path, ...) @@ -132,20 +137,53 @@ static int path_exist(const char *path, ...) static int path_sibling(const char *path, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +static const char * +path_vcreate(const char *path, va_list ap) +{ + if (sysrootlen) + vsnprintf(pathbuf + sysrootlen, + sizeof(pathbuf) - sysrootlen, path, ap); + else + vsnprintf(pathbuf, sizeof(pathbuf), path, ap); + return pathbuf; +} + +static const char * +path_create(const char *path, ...) +{ + const char *p; + va_list ap; + + va_start(ap, path); + p = path_vcreate(path, ap); + va_end(ap); + + return p; +} + static FILE * -xfopen(const char *path, const char *mode) +path_vfopen(const char *mode, int exit_on_error, const char *path, va_list ap) { - FILE *fd = fopen(path, mode); - if (!fd) - err(EXIT_FAILURE, _("error: %s"), path); - return fd; + FILE *f; + const char *p = path_vcreate(path, ap); + + f = fopen(p, mode); + if (!f && exit_on_error) + err(EXIT_FAILURE, _("error: cannot open %s"), p); + return f; } static FILE * -path_vfopen(const char *mode, const char *path, va_list ap) +path_fopen(const char *mode, int exit_on_error, const char *path, ...) { - vsnprintf(pathbuf, sizeof(pathbuf), path, ap); - return xfopen(pathbuf, mode); + FILE *fd; + va_list ap; + + va_start(ap, path); + fd = path_vfopen("r", exit_on_error, path, ap); + va_end(ap); + + return fd; } static void @@ -155,7 +193,7 @@ path_getstr(char *result, size_t len, const char *path, ...) va_list ap; va_start(ap, path); - fd = path_vfopen("r", path, ap); + fd = path_vfopen("r", 1, path, ap); va_end(ap); if (!fgets(result, len, fd)) @@ -175,14 +213,14 @@ path_getnum(const char *path, ...) int result; va_start(ap, path); - fd = path_vfopen("r", path, ap); + fd = path_vfopen("r", 1, path, ap); va_end(ap); if (fscanf(fd, "%d", &result) != 1) { if (ferror(fd)) - err(EXIT_FAILURE, _("error: %s"), pathbuf); + err(EXIT_FAILURE, _("failed to read: %s"), pathbuf); else - errx(EXIT_FAILURE, _("error parse: %s"), pathbuf); + errx(EXIT_FAILURE, _("parse error: %s"), pathbuf); } fclose(fd); return result; @@ -192,12 +230,13 @@ static int path_exist(const char *path, ...) { va_list ap; + const char *p; va_start(ap, path); - vsnprintf(pathbuf, sizeof(pathbuf), path, ap); + p = path_vcreate(path, ap); va_end(ap); - return access(pathbuf, F_OK) == 0; + return access(p, F_OK) == 0; } char * @@ -220,7 +259,7 @@ path_sibling(const char *path, ...) va_list ap; va_start(ap, path); - fp = path_vfopen("r", path, ap); + fp = path_vfopen("r", 1, path, ap); va_end(ap); while ((c = fgetc(fp)) != EOF) { @@ -282,7 +321,7 @@ int lookup(char *line, char *pattern, char **value) static void read_basicinfo(struct lscpu_desc *desc) { - FILE *fp = xfopen(_PATH_PROC_CPUINFO, "r"); + FILE *fp = path_fopen("r", 1, _PATH_PROC_CPUINFO); char buf[BUFSIZ]; struct utsname utsbuf; @@ -336,7 +375,7 @@ has_pci_device(int vendor, int device) int num, fn, ven, dev; int res = 1; - f = fopen(_PATH_PROC_PCIDEVS, "r"); + f = path_fopen("r", 0, _PATH_PROC_PCIDEVS); if (!f) return 0; @@ -428,9 +467,9 @@ read_hypervisor(struct lscpu_desc *desc) /* hvm */ desc->virtype = VIRT_FULL; - else if (!access(_PATH_PROC_XEN, F_OK)) { + else if (path_exist(_PATH_PROC_XEN)) { /* Xen para-virt or dom0 */ - FILE *fd = fopen(_PATH_PROC_XENCAP, "r"); + FILE *fd = path_fopen("r", 0, _PATH_PROC_XENCAP); int dom0 = 0; if (fd) { @@ -474,10 +513,11 @@ read_cache(struct lscpu_desc *desc) DIR *dp; struct dirent *dir; int level, type; + const char *p = path_create(_PATH_SYS_CPU0 "/cache"); - dp = opendir(_PATH_SYS_CPU0 "/cache"); + dp = opendir(p); if (dp == NULL) - err(EXIT_FAILURE, _("error: %s"), _PATH_SYS_CPU0 "/cache"); + err(EXIT_FAILURE, _("error: %s"), p); while ((dir = readdir(dp)) != NULL) { if (!strcmp(dir->d_name, ".") @@ -542,17 +582,17 @@ static void check_system(void) { /* Read through sysfs. */ - if (access(_PATH_SYS_SYSTEM, F_OK)) + if (!path_exist(_PATH_SYS_SYSTEM)) errx(EXIT_FAILURE, - _("error: /sys filesystem is not accessable.")); + _("error: %s is not accessable."), pathbuf); - if (!access(_PATH_SYS_SYSTEM "/node", F_OK)) + if (path_exist(_PATH_SYS_SYSTEM "/node")) have_node = 1; - if (!access(_PATH_SYS_CPU0 "/topology/thread_siblings", F_OK)) + if (path_exist(_PATH_SYS_CPU0 "/topology/thread_siblings")) have_topology = 1; - if (!access(_PATH_SYS_CPU0 "/cache", F_OK)) + if (path_exist(_PATH_SYS_CPU0 "/cache")) have_cache = 1; } @@ -732,17 +772,15 @@ int main(int argc, char *argv[]) parsable = 1; break; case 's': + sysrootlen = strlen(optarg); strncpy(pathbuf, optarg, sizeof(pathbuf)); + pathbuf[sizeof(pathbuf) - 1] = '\0'; break; default: usage(EXIT_FAILURE); } } - if (chdir(pathbuf) == -1) - errx(EXIT_FAILURE, - _("error: change working directory to %s."), pathbuf); - memset(desc, 0, sizeof(*desc)); check_system(); -- cgit v1.2.3 From bae91ecf07384f09fcf94903b7c3d7e565f4f66d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 28 May 2010 11:08:39 +0200 Subject: taskset: move NR_CPUS determination to lib/cpuset.c Signed-off-by: Karel Zak --- include/cpuset.h | 2 ++ lib/cpuset.c | 41 ++++++++++++++++++++++++++++++++++++++++- schedutils/taskset.c | 39 +++------------------------------------ 3 files changed, 45 insertions(+), 37 deletions(-) diff --git a/include/cpuset.h b/include/cpuset.h index 197476ed..5f6b5bbf 100644 --- a/include/cpuset.h +++ b/include/cpuset.h @@ -51,6 +51,8 @@ extern int __cpuset_count_s(size_t setsize, const cpu_set_t *set); #define cpuset_nbits(setsize) (8 * (setsize)) +extern int get_max_number_of_cpus(void); + extern cpu_set_t *cpuset_alloc(int ncpus, size_t *setsize, size_t *nbits); extern void cpuset_free(cpu_set_t *set); diff --git a/lib/cpuset.c b/lib/cpuset.c index d6cbf5d3..27b23498 100644 --- a/lib/cpuset.c +++ b/lib/cpuset.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "cpuset.h" @@ -53,6 +54,38 @@ static const char *nexttoken(const char *q, int sep) return q; } +/* + * Number of bits in a CPU bitmask on current system + */ +int get_max_number_of_cpus(void) +{ + int n, cpus = 2048; + size_t setsize; + cpu_set_t *set = cpuset_alloc(cpus, &setsize, NULL); + + if (!set) + return -1; /* error */ + + for (;;) { + CPU_ZERO_S(setsize, set); + + /* the library version does not return size of cpumask_t */ + n = syscall(SYS_sched_getaffinity, 0, setsize, set); + + if (n < 0 && errno == EINVAL && cpus < 1024 * 1024) { + cpuset_free(set); + cpus *= 2; + set = cpuset_alloc(cpus, &setsize, NULL); + if (!set) + return -1; /* error */ + continue; + } + cpuset_free(set); + return n * 8; + } + return -1; +} + /* * Allocates a new set for ncpus and returns size in bytes and size in bits */ @@ -200,7 +233,13 @@ int cpumask_parse(const char *str, cpu_set_t *set, size_t setsize) CPU_ZERO_S(setsize, set); while (ptr >= str) { - char val = char_to_val(*ptr); + char val; + + /* cpu masks in /sys uses comma as a separator */ + if (*ptr == ',') + ptr--; + + val = char_to_val(*ptr); if (val == (char) -1) return -1; if (val & 1) diff --git a/schedutils/taskset.c b/schedutils/taskset.c index 66387c82..2f1bc745 100644 --- a/schedutils/taskset.c +++ b/schedutils/taskset.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "cpuset.h" @@ -64,40 +63,6 @@ static void __attribute__((__noreturn__)) usage(FILE *out) exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); } -/* - * Number of bits in a CPU bitmask on current system - */ -static int max_number_of_cpus(void) -{ - int n, cpus = 2048; - size_t setsize; - cpu_set_t *set = cpuset_alloc(cpus, &setsize, NULL); - - if (!set) - goto err; - - for (;;) { - CPU_ZERO_S(setsize, set); - - /* the library version does not return size of cpumask_t */ - n = syscall(SYS_sched_getaffinity, 0, setsize, set); - - if (n < 0 && errno == EINVAL && cpus < 1024 * 1024) { - cpuset_free(set); - cpus *= 2; - set = cpuset_alloc(cpus, &setsize, NULL); - if (!set) - goto err; - continue; - } - cpuset_free(set); - return n * 8; - } -err: - errx(EXIT_FAILURE, _("cannot determine NR_CPUS; aborting")); - return 0; -} - int main(int argc, char *argv[]) { cpu_set_t *new_set, *cur_set; @@ -143,7 +108,9 @@ int main(int argc, char *argv[]) || (pid && (argc - optind < 1 || argc - optind > 2))) usage(stderr); - ncpus = max_number_of_cpus(); + ncpus = get_max_number_of_cpus(); + if (ncpus <= 0) + errx(EXIT_FAILURE, _("cannot determine NR_CPUS; aborting")); /* * cur_set is always used for the sched_getaffinity call -- cgit v1.2.3 From 7e03f3831230f420f56b6d501f3af8ba2dea1b7b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 28 May 2010 14:23:15 +0200 Subject: lscpu: use cpuset masks, read data for all CPUs Signed-off-by: Karel Zak --- sys-utils/Makefile.am | 12 +- sys-utils/lscpu.1 | 7 +- sys-utils/lscpu.c | 467 +++++++++++++++++++++++++++++--------------------- 3 files changed, 285 insertions(+), 201 deletions(-) diff --git a/sys-utils/Makefile.am b/sys-utils/Makefile.am index 0d9b3798..1ed07bee 100644 --- a/sys-utils/Makefile.am +++ b/sys-utils/Makefile.am @@ -11,11 +11,18 @@ dist_man_MANS = flock.1 ipcrm.1 ipcs.1 ipcmk.1 renice.1 setsid.1 \ if LINUX bin_PROGRAMS += dmesg sbin_PROGRAMS += ctrlaltdel fsfreeze -usrbin_exec_PROGRAMS += cytune setarch lscpu +usrbin_exec_PROGRAMS += cytune setarch usrsbin_exec_PROGRAMS += ldattach tunelp rtcwake dist_man_MANS += dmesg.1 ctrlaltdel.8 cytune.8 setarch.8 \ - ldattach.8 lscpu.1 tunelp.8 rtcwake.8 fsfreeze.8 + ldattach.8 tunelp.8 rtcwake.8 fsfreeze.8 + +if HAVE_CPU_SET_T +usrbin_exec_PROGRAMS += lscpu +lscpu_SOURCES = lscpu.c $(top_srcdir)/lib/cpuset.c +dist_man_MANS += lscpu.1 +endif + endif cytune_SOURCES = cytune.c cyclades.h @@ -23,6 +30,7 @@ tunelp_SOURCES = tunelp.c lp.h info_TEXINFOS = ipc.texi + if BUILD_FALLOCATE usrbin_exec_PROGRAMS += fallocate fallocate_SOURCES = fallocate.c $(top_srcdir)/lib/strtosize.c diff --git a/sys-utils/lscpu.1 b/sys-utils/lscpu.1 index 2b8d33b1..fc3c46fa 100644 --- a/sys-utils/lscpu.1 +++ b/sys-utils/lscpu.1 @@ -23,12 +23,15 @@ Print a help message. .BR \-p , " \-\-parse" Print out in parsable instead of printable format. .SH BUGS -The program at the moment does not handle the system installed with -different types of physical processors. +The basic overview about CPU family, model, etc. is always based on the first +CPU only. Sometimes in Xen Dom0 kernel reports wrong data. .SH AUTHOR +.nf Cai Qian +Karel Zak +.fi .SH AVAILABILITY The setarch command is part of the util-linux-ng package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index d554f9b2..6b786e8c 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -31,23 +31,19 @@ #include #include +#include "cpuset.h" #include "nls.h" #define CACHE_MAX 100 /* /sys paths */ #define _PATH_SYS_SYSTEM "/sys/devices/system" -#define _PATH_SYS_CPU0 _PATH_SYS_SYSTEM "/cpu/cpu0" +#define _PATH_SYS_CPU _PATH_SYS_SYSTEM "/cpu" #define _PATH_PROC_XEN "/proc/xen" #define _PATH_PROC_XENCAP _PATH_PROC_XEN "/capabilities" #define _PATH_PROC_CPUINFO "/proc/cpuinfo" #define _PATH_PROC_PCIDEVS "/proc/bus/pci/devices" -int have_topology; -int have_cache; -int have_node; - - /* virtualization types */ enum { VIRT_NONE = 0, @@ -83,22 +79,15 @@ enum { /* cache(s) description */ struct cpu_cache { - char *name; - char *size; - int map; + char *name; + char *size; + + int nsharedmaps; + cpu_set_t **sharedmaps; }; /* global description */ struct lscpu_desc { - /* counters */ - int ct_cpu; - int ct_thread; - int ct_core; - int ct_socket; - int ct_node; - int ct_cache; - - /* who is who */ char *arch; char *vendor; char *family; @@ -106,26 +95,36 @@ struct lscpu_desc { char *virtflag; /* virtualization flag (vmx, svm) */ int hyper; /* hypervisor vendor ID */ int virtype; /* VIRT_PARA|FULL|NONE ? */ - - /* caches */ - struct cpu_cache cache[CACHE_MAX]; - - /* misc */ char *mhz; char *stepping; char *flags; - int mode; /* rm, lm or/and tm */ - /* NUMA */ - int *nodecpu; + int ncpus; /* number of CPUs */ + + int nnodes; /* number of NUMA modes */ + cpu_set_t **nodemaps; /* array with NUMA nodes */ + + /* sockets -- based on core_siblings (internal kernel map of cpuX's + * hardware threads within the same physical_package_id (socket)) */ + int nsockets; /* number of all sockets */ + cpu_set_t **socketmaps; /* unique core_siblings */ + + /* cores -- based on thread_siblings (internel kernel map of cpuX's + * hardware threads within the same core as cpuX) */ + int ncores; /* number of all cores */ + cpu_set_t **coremaps; /* unique thread_siblings */ + + int nthreads; /* number of threads */ + + int ncaches; + struct cpu_cache *caches; }; static size_t sysrootlen; static char pathbuf[PATH_MAX]; +static int maxcpus; /* size in bits of kernel cpu mask */ -static const char *path_create(const char *path, ...) - __attribute__ ((__format__ (__printf__, 1, 2))); static FILE *path_fopen(const char *mode, int exit_on_err, const char *path, ...) __attribute__ ((__format__ (__printf__, 3, 4))); static void path_getstr(char *result, size_t len, const char *path, ...) @@ -134,7 +133,7 @@ static int path_getnum(const char *path, ...) __attribute__ ((__format__ (__printf__, 1, 2))); static int path_exist(const char *path, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -static int path_sibling(const char *path, ...) +static cpu_set_t *path_cpuset(const char *path, ...) __attribute__ ((__format__ (__printf__, 1, 2))); static const char * @@ -148,19 +147,6 @@ path_vcreate(const char *path, va_list ap) return pathbuf; } -static const char * -path_create(const char *path, ...) -{ - const char *p; - va_list ap; - - va_start(ap, path); - p = path_vcreate(path, ap); - va_end(ap); - - return p; -} - static FILE * path_vfopen(const char *mode, int exit_on_error, const char *path, va_list ap) { @@ -239,7 +225,7 @@ path_exist(const char *path, ...) return access(p, F_OK) == 0; } -char * +static char * xstrdup(const char *str) { char *s = strdup(str); @@ -248,33 +234,35 @@ xstrdup(const char *str) return s; } -/* count the set bit in a mapping file */ -static int -path_sibling(const char *path, ...) +static cpu_set_t * +path_cpuset(const char *path, ...) { - int c, n; - int result = 0; - char s[2]; - FILE *fp; + FILE *fd; va_list ap; + cpu_set_t *set; + size_t setsize, len = maxcpus * 7; + char buf[len]; va_start(ap, path); - fp = path_vfopen("r", 1, path, ap); + fd = path_vfopen("r", 1, path, ap); va_end(ap); - while ((c = fgetc(fp)) != EOF) { - if (isxdigit(c)) { - s[0] = c; - s[1] = '\0'; - for (n = strtol(s, NULL, 16); n > 0; n /= 2) { - if (n % 2) - result++; - } - } - } - fclose(fp); + if (!fgets(buf, len, fd)) + err(EXIT_FAILURE, _("failed to read: %s"), pathbuf); + fclose(fd); - return result; + len = strlen(buf); + if (buf[len - 1] == '\n') + buf[len - 1] = '\0'; + + set = cpuset_alloc(maxcpus, &setsize, NULL); + if (!set) + err(EXIT_FAILURE, _("failed to callocate cpu set")); + + if (cpumask_parse(buf, set, setsize)) + errx(EXIT_FAILURE, _("faild to parse CPU mask %s"), buf); + + return set; } /* Lookup a pattern and get the value from cpuinfo. @@ -331,8 +319,8 @@ read_basicinfo(struct lscpu_desc *desc) desc->arch = xstrdup(utsbuf.machine); /* count CPU(s) */ - while(path_exist(_PATH_SYS_SYSTEM "/cpu/cpu%d", desc->ct_cpu)) - desc->ct_cpu++; + while(path_exist(_PATH_SYS_SYSTEM "/cpu/cpu%d", desc->ncpus)) + desc->ncpus++; /* details */ while (fgets(buf, sizeof(buf), fp) != NULL) { @@ -366,6 +354,17 @@ read_basicinfo(struct lscpu_desc *desc) } fclose(fp); + + if (path_exist(_PATH_SYS_SYSTEM "/cpu/kernel_max")) + maxcpus = path_getnum(_PATH_SYS_SYSTEM "/cpu/kernel_max"); + + else if (!sysrootlen) + /* the root is '/' so we are working with data from the current kernel */ + maxcpus = get_max_number_of_cpus(); + else + /* we are reading some /sys snapshot instead the real /sys, + * let's use any crazy number... */ + maxcpus = desc->ncpus > 2048 ? desc->ncpus : 2048; } static int @@ -490,71 +489,138 @@ read_hypervisor(struct lscpu_desc *desc) } } +/* add @set to the @ary, unnecesary set is deallocated. */ +static int add_cpuset_to_array(cpu_set_t **ary, int *items, cpu_set_t *set) +{ + int i; + size_t setsize = CPU_ALLOC_SIZE(maxcpus); + + if (!ary) + return -1; + + for (i = 0; i < *items; i++) { + if (CPU_EQUAL_S(setsize, set, ary[i])) + break; + } + if (i == *items) { + ary[*items] = set; + ++*items; + return 0; + } + CPU_FREE(set); + return 1; +} + static void -read_topology(struct lscpu_desc *desc) +read_topology(struct lscpu_desc *desc, int num) { - /* number of threads */ - desc->ct_thread = path_sibling( - _PATH_SYS_CPU0 "/topology/thread_siblings"); + cpu_set_t *thread_siblings, *core_siblings; + + if (!path_exist(_PATH_SYS_CPU "/cpu%d/topology/thread_siblings", num)) + return; - /* number of cores */ - desc->ct_core = path_sibling( - _PATH_SYS_CPU0 "/topology/core_siblings") - / desc->ct_thread; + thread_siblings = path_cpuset(_PATH_SYS_CPU + "/cpu%d/topology/thread_siblings", num); + core_siblings = path_cpuset(_PATH_SYS_CPU + "/cpu%d/topology/core_siblings", num); + if (num == 0) { + int ncores, nsockets, nthreads; + size_t setsize = CPU_ALLOC_SIZE(maxcpus); + + /* threads within one core */ + nthreads = CPU_COUNT_S(setsize, thread_siblings); + /* cores within one socket */ + ncores = CPU_COUNT_S(setsize, core_siblings) / nthreads; + /* number of sockets */ + nsockets = desc->ncpus / nthreads / ncores; + /* all threads */ + desc->nthreads = nsockets * ncores * nthreads; + + desc->socketmaps = calloc(nsockets, sizeof(cpu_set_t *)); + if (!desc->socketmaps) + err(EXIT_FAILURE, _("error: calloc failed")); + desc->coremaps = calloc(ncores * nsockets, sizeof(cpu_set_t *)); + if (!desc->coremaps) + err(EXIT_FAILURE, _("error: calloc failed")); + } - /* number of sockets */ - desc->ct_socket = desc->ct_cpu / desc->ct_core / desc->ct_thread; + add_cpuset_to_array(desc->socketmaps, &desc->nsockets, core_siblings); + add_cpuset_to_array(desc->coremaps, &desc->ncores, thread_siblings); +} + +static int +cachecmp(const void *a, const void *b) +{ + struct cpu_cache *c1 = (struct cpu_cache *) a; + struct cpu_cache *c2 = (struct cpu_cache *) b; + + return strcmp(c2->name, c1->name); } static void -read_cache(struct lscpu_desc *desc) +read_cache(struct lscpu_desc *desc, int num) { char buf[256]; - DIR *dp; - struct dirent *dir; - int level, type; - const char *p = path_create(_PATH_SYS_CPU0 "/cache"); - - dp = opendir(p); - if (dp == NULL) - err(EXIT_FAILURE, _("error: %s"), p); - - while ((dir = readdir(dp)) != NULL) { - if (!strcmp(dir->d_name, ".") - || !strcmp(dir->d_name, "..")) - continue; + int i; - /* cache type */ - path_getstr(buf, sizeof(buf), - _PATH_SYS_CPU0 "/cache/%s/type", dir->d_name); - if (!strcmp(buf, "Data")) - type = 'd'; - else if (!strcmp(buf, "Instruction")) - type = 'i'; - else - type = 0; + if (num == 0) { + while(path_exist(_PATH_SYS_SYSTEM "/cpu/cpu%d/cache/index%d", + num, desc->ncaches)) + desc->ncaches++; - /* cache level */ - level = path_getnum(_PATH_SYS_CPU0 "/cache/%s/level", - dir->d_name); + if (!desc->ncaches) + return; - if (type) - snprintf(buf, sizeof(buf), "L%d%c", level, type); - else - snprintf(buf, sizeof(buf), "L%d", level); + desc->caches = calloc(desc->ncaches, sizeof(*desc->caches)); + if (!desc->caches) + err(EXIT_FAILURE, _("calloc failed")); + } + for (i = 0; i < desc->ncaches; i++) { + struct cpu_cache *ca = &desc->caches[i]; + cpu_set_t *map; + + if (!ca->name) { + int type, level; + + /* cache type */ + path_getstr(buf, sizeof(buf), + _PATH_SYS_CPU "/cpu%d/cache/index%d/type", + num, i); + if (!strcmp(buf, "Data")) + type = 'd'; + else if (!strcmp(buf, "Instruction")) + type = 'i'; + else + type = 0; + + /* cache level */ + level = path_getnum(_PATH_SYS_CPU "/cpu%d/cache/index%d/level", + num, i); + if (type) + snprintf(buf, sizeof(buf), "L%d%c", level, type); + else + snprintf(buf, sizeof(buf), "L%d", level); + + ca->name = xstrdup(buf); + + /* cache size */ + path_getstr(buf, sizeof(buf), + _PATH_SYS_CPU "/cpu%d/cache/index%d/size", + num, i); + ca->size = xstrdup(buf); + } - desc->cache[desc->ct_cache].name = xstrdup(buf); + /* information about how CPUs share different caches */ + map = path_cpuset(_PATH_SYS_CPU "/cpu%d/cache/index%d/shared_cpu_map", + num, i); - /* cache size */ - path_getstr(buf, sizeof(buf), - _PATH_SYS_CPU0 "/cache/%s/size", dir->d_name); - desc->cache[desc->ct_cache].size = xstrdup(buf); + if (!ca->sharedmaps) { + ca->sharedmaps = calloc(desc->ncpus, sizeof(cpu_set_t *)); + if (!ca->sharedmaps) + err(EXIT_FAILURE, _("error: calloc failed")); + } - /* information about how CPUs share different caches */ - desc->cache[desc->ct_cache].map = path_sibling( - _PATH_SYS_CPU0 "/cache/%s/shared_cpu_map", - dir->d_name); - desc->ct_cache++; + add_cpuset_to_array(ca->sharedmaps, &ca->nsharedmaps, map); } } @@ -564,42 +630,28 @@ read_nodes(struct lscpu_desc *desc) int i; /* number of NUMA node */ - while (path_exist(_PATH_SYS_SYSTEM "/node/node%d", desc->ct_node)) - desc->ct_node++; + while (path_exist(_PATH_SYS_SYSTEM "/node/node%d", desc->nnodes)) + desc->nnodes++; + + if (!desc->nnodes) + return; - desc->nodecpu = (int *) malloc(desc->ct_node * sizeof(int)); - if (!desc->nodecpu) - err(EXIT_FAILURE, _("error: malloc failed")); + desc->nodemaps = calloc(desc->nnodes, sizeof(cpu_set_t *)); + if (!desc->nodemaps) + err(EXIT_FAILURE, _("error: calloc failed")); /* information about how nodes share different CPUs */ - for (i = 0; i < desc->ct_node; i++) - desc->nodecpu[i] = path_sibling( + for (i = 0; i < desc->nnodes; i++) + desc->nodemaps[i] = path_cpuset( _PATH_SYS_SYSTEM "/node/node%d/cpumap", i); } -static void -check_system(void) -{ - /* Read through sysfs. */ - if (!path_exist(_PATH_SYS_SYSTEM)) - errx(EXIT_FAILURE, - _("error: %s is not accessable."), pathbuf); - - if (path_exist(_PATH_SYS_SYSTEM "/node")) - have_node = 1; - - if (path_exist(_PATH_SYS_CPU0 "/topology/thread_siblings")) - have_topology = 1; - - if (path_exist(_PATH_SYS_CPU0 "/cache")) - have_cache = 1; -} - static void print_parsable(struct lscpu_desc *desc) { int i, j; + size_t setsize = CPU_ALLOC_SIZE(maxcpus); printf(_( "# The following is the parsable format, which can be fed to other\n" @@ -607,50 +659,66 @@ print_parsable(struct lscpu_desc *desc) "# starting from zero.\n" "# CPU,Core,Socket,Node")); - if (have_cache) { + if (desc->ncaches) { /* separator between CPU topology and cache information */ putchar(','); - for (i = desc->ct_cache - 1; i >= 0; i--) - printf(",%s", desc->cache[i].name); + for (i = desc->ncaches - 1; i >= 0; i--) + printf(",%s", desc->caches[i].name); } putchar('\n'); - for (i = 0; i < desc->ct_cpu; i++) { + for (i = 0; i < desc->ncpus; i++) { + + /* #CPU */ printf("%d", i); - if (have_topology) - printf(",%d,%d", - i / desc->ct_thread, - i / desc->ct_core / desc->ct_thread); - else - printf(",,"); + /* Core */ + for (j = 0; j < desc->ncores; j++) { + if (CPU_ISSET_S(i, setsize, desc->coremaps[j])) { + printf(",%d", j); + break; + } + } + if (j == desc->ncores) + putchar(','); - if (have_node) { - int c = 0; + /* Socket */ + for (j = 0; j < desc->nsockets; j++) { + if (CPU_ISSET_S(i, setsize, desc->socketmaps[j])) { + printf(",%d", j); + break; + } + } + if (j == desc->nsockets) + putchar(','); - for (j = 0; j < desc->ct_node; j++) { - c += desc->nodecpu[j]; - if (i < c) { - printf(",%d", j); - break; - } + /* Nodes */ + for (j = 0; j < desc->nnodes; j++) { + if (CPU_ISSET_S(i, setsize, desc->nodemaps[j])) { + printf(",%d", j); + break; } - } else + } + if (j == desc->nnodes) putchar(','); - if (have_cache) { + if (desc->ncaches) putchar(','); - for (j = desc->ct_cache - 1; j >= 0; j--) { - /* If shared_cpu_map is 0, all CPUs share the same - cache. */ - if (desc->cache[j].map == 0) - desc->cache[j].map = desc->ct_core * - desc->ct_thread; + /* Caches */ + for (j = desc->ncaches - 1; j >= 0; j--) { + struct cpu_cache *ca = &desc->caches[j]; + int x; - printf(",%d", i / desc->cache[j].map); + for (x = 0; x < ca->nsharedmaps; x++) { + if (CPU_ISSET_S(i, setsize, ca->sharedmaps[x])) { + printf(",%d", x); + break; + } } + if (x == ca->nsharedmaps) + putchar(','); } putchar('\n'); } @@ -664,6 +732,9 @@ print_parsable(struct lscpu_desc *desc) static void print_readable(struct lscpu_desc *desc) { + char buf[512]; + int i; + print_s("Architecture:", desc->arch); if (desc->mode & (MODE_REAL | MODE_TRANSPARENT | MODE_LONG)) { @@ -685,16 +756,16 @@ print_readable(struct lscpu_desc *desc) print_s(_("CPU op-mode(s):"), buf); } - print_n("CPU(s):", desc->ct_cpu); + print_n("CPU(s):", desc->ncpus); - if (have_topology) { - print_n(_("Thread(s) per core:"), desc->ct_thread); - print_n(_("Core(s) per socket:"), desc->ct_core); - print_n(_("CPU socket(s):"), desc->ct_socket); + if (desc->nsockets) { + print_n(_("Thread(s) per core:"), desc->nthreads / desc->ncores); + print_n(_("Core(s) per socket:"), desc->ncores / desc->nsockets); + print_n(_("CPU socket(s):"), desc->nsockets); } - if (have_node) - print_n(_("NUMA node(s):"), desc->ct_node); + if (desc->nnodes) + print_n(_("NUMA node(s):"), desc->nnodes); if (desc->vendor) print_s(_("Vendor ID:"), desc->vendor); if (desc->family) @@ -715,14 +786,27 @@ print_readable(struct lscpu_desc *desc) print_s(_("Hypervisor vendor:"), hv_vendors[desc->hyper]); print_s(_("Virtualization type:"), virt_types[desc->virtype]); } - if (have_cache) { + if (desc->ncaches) { char buf[512]; int i; - for (i = desc->ct_cache - 1; i >= 0; i--) { + for (i = desc->ncaches - 1; i >= 0; i--) { snprintf(buf, sizeof(buf), - _("%s cache:"), desc->cache[i].name); - print_s(buf, desc->cache[i].size); + _("%s cache:"), desc->caches[i].name); + print_s(buf, desc->caches[i].size); + } + } + + if (desc->nnodes) { + size_t setbuflen = 7 * maxcpus; + char setbuf[setbuflen]; + + for (i = 0; i < desc->nnodes; i++) { + snprintf(buf, sizeof(buf), _("NUMA node%d CPU(s):"), i); + print_s(buf, cpulist_create( + setbuf, setbuflen, + desc->nodemaps[i], + CPU_ALLOC_SIZE(maxcpus))); } } } @@ -739,19 +823,10 @@ void usage(int rc) exit(rc); } -static int -ca_compare(const void *a, const void *b) -{ - struct cpu_cache *c1 = (struct cpu_cache *) a; - struct cpu_cache *c2 = (struct cpu_cache *) b; - - return strcmp(c2->name, c1->name); -} - int main(int argc, char *argv[]) { struct lscpu_desc _desc, *desc = &_desc; - int parsable = 0, c; + int parsable = 0, c, i; struct option longopts[] = { { "help", no_argument, 0, 'h' }, @@ -783,18 +858,16 @@ int main(int argc, char *argv[]) memset(desc, 0, sizeof(*desc)); - check_system(); - read_basicinfo(desc); - if (have_topology) - read_topology(desc); - if (have_cache) { - read_cache(desc); - qsort(desc->cache, desc->ct_cache, sizeof(struct cpu_cache), ca_compare); + for (i = 0; i < desc->ncpus; i++) { + read_topology(desc, i); + read_cache(desc, i); } - if (have_node) - read_nodes(desc); + + qsort(desc->caches, desc->ncaches, sizeof(struct cpu_cache), cachecmp); + + read_nodes(desc); read_hypervisor(desc); -- cgit v1.2.3 From 68975d7eb182e3b08668d79cbcb68c365f101475 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 1 Jun 2010 10:44:41 +0200 Subject: tests: update lscpu Signed-off-by: Karel Zak --- tests/expected/lscpu/lscpu-ia64-hpmatterhorn | 19 +++++++++------- tests/expected/lscpu/lscpu-ia64-hprx1620 | 1 + tests/expected/lscpu/lscpu-ia64-pg0 | 34 +++++++++++++++------------- tests/expected/lscpu/lscpu-x86_64-hpdl585 | 28 +++++++++++++---------- tests/expected/lscpu/lscpu-x86_64-ibme326m | 1 + tests/expected/lscpu/lscpu-x86_64-necem14 | 1 + 6 files changed, 48 insertions(+), 36 deletions(-) diff --git a/tests/expected/lscpu/lscpu-ia64-hpmatterhorn b/tests/expected/lscpu/lscpu-ia64-hpmatterhorn index e38bf46d..e4446067 100644 --- a/tests/expected/lscpu/lscpu-ia64-hpmatterhorn +++ b/tests/expected/lscpu/lscpu-ia64-hpmatterhorn @@ -11,16 +11,19 @@ L1d cache: 16K L1i cache: 16K L2 cache: 256K L3 cache: 3072K +NUMA node0 CPU(s): 4-7 +NUMA node1 CPU(s): 0-3 +NUMA node2 CPU(s): # The following is the parsable format, which can be fed to other # programs. Each different item in every column has an unique ID # starting from zero. # CPU,Core,Socket,Node,,L1d,L1i,L2,L3 -0,0,0,0,,0,0,0,0 -1,1,1,0,,1,1,1,1 -2,2,2,0,,2,2,2,2 -3,3,3,0,,3,3,3,3 -4,4,4,1,,4,4,4,4 -5,5,5,1,,5,5,5,5 -6,6,6,1,,6,6,6,6 -7,7,7,1,,7,7,7,7 +0,0,0,1,,0,0,0,0 +1,1,1,1,,1,1,1,1 +2,2,2,1,,2,2,2,2 +3,3,3,1,,3,3,3,3 +4,4,4,0,,4,4,4,4 +5,5,5,0,,5,5,5,5 +6,6,6,0,,6,6,6,6 +7,7,7,0,,7,7,7,7 diff --git a/tests/expected/lscpu/lscpu-ia64-hprx1620 b/tests/expected/lscpu/lscpu-ia64-hprx1620 index 081d8788..4812be6a 100644 --- a/tests/expected/lscpu/lscpu-ia64-hprx1620 +++ b/tests/expected/lscpu/lscpu-ia64-hprx1620 @@ -11,6 +11,7 @@ L1d cache: 16K L1i cache: 16K L2 cache: 256K L3 cache: 3072K +NUMA node0 CPU(s): 0,1 # The following is the parsable format, which can be fed to other # programs. Each different item in every column has an unique ID diff --git a/tests/expected/lscpu/lscpu-ia64-pg0 b/tests/expected/lscpu/lscpu-ia64-pg0 index 7600b808..22c4539c 100644 --- a/tests/expected/lscpu/lscpu-ia64-pg0 +++ b/tests/expected/lscpu/lscpu-ia64-pg0 @@ -12,24 +12,26 @@ L1i cache: 16K L2d cache: 256K L2i cache: 1024K L3 cache: 6144K +NUMA node0 CPU(s): 0-7 +NUMA node1 CPU(s): 8-15 # The following is the parsable format, which can be fed to other # programs. Each different item in every column has an unique ID # starting from zero. # CPU,Core,Socket,Node,,L1d,L1i,L2d,L2i,L3 -0,0,0,0,,0,0,0,0,0 -1,1,0,0,,1,1,1,0,0 -2,2,1,0,,2,2,2,1,1 -3,3,1,0,,3,3,3,1,1 -4,4,2,0,,4,4,4,2,2 -5,5,2,0,,5,5,5,2,2 -6,6,3,0,,6,6,6,3,3 -7,7,3,0,,7,7,7,3,3 -8,8,4,1,,8,8,8,4,4 -9,9,4,1,,9,9,9,4,4 -10,10,5,1,,10,10,10,5,5 -11,11,5,1,,11,11,11,5,5 -12,12,6,1,,12,12,12,6,6 -13,13,6,1,,13,13,13,6,6 -14,14,7,1,,14,14,14,7,7 -15,15,7,1,,15,15,15,7,7 +0,0,0,0,,0,0,0,, +1,1,0,0,,1,1,1,, +2,2,1,0,,2,2,2,, +3,3,1,0,,3,3,3,, +4,4,2,0,,4,4,4,, +5,5,2,0,,5,5,5,, +6,6,3,0,,6,6,6,, +7,7,3,0,,7,7,7,, +8,8,4,1,,8,8,8,, +9,9,4,1,,9,9,9,, +10,10,5,1,,10,10,10,, +11,11,5,1,,11,11,11,, +12,12,6,1,,12,12,12,, +13,13,6,1,,13,13,13,, +14,14,7,1,,14,14,14,, +15,15,7,1,,15,15,15,, diff --git a/tests/expected/lscpu/lscpu-x86_64-hpdl585 b/tests/expected/lscpu/lscpu-x86_64-hpdl585 index 52bc8cb9..54a1a242 100644 --- a/tests/expected/lscpu/lscpu-x86_64-hpdl585 +++ b/tests/expected/lscpu/lscpu-x86_64-hpdl585 @@ -14,24 +14,28 @@ L1d cache: 512K L1i cache: 512K L2 cache: 512K L3 cache: 2048K +NUMA node0 CPU(s): 0,4,8,12 +NUMA node1 CPU(s): 1,5,9,13 +NUMA node2 CPU(s): 2,6,10,14 +NUMA node3 CPU(s): 3,7,11,15 # The following is the parsable format, which can be fed to other # programs. Each different item in every column has an unique ID # starting from zero. # CPU,Core,Socket,Node,,L1d,L1i,L2,L3 0,0,0,0,,0,0,0,0 -1,1,0,0,,1,1,1,1 -2,2,0,0,,2,2,2,2 -3,3,0,0,,3,3,3,3 -4,4,1,1,,4,4,4,4 +1,1,1,1,,1,1,1,1 +2,2,2,2,,2,2,2,2 +3,3,3,3,,3,3,3,3 +4,4,0,0,,4,4,4,4 5,5,1,1,,5,5,5,5 -6,6,1,1,,6,6,6,6 -7,7,1,1,,7,7,7,7 -8,8,2,2,,8,8,8,8 -9,9,2,2,,9,9,9,9 +6,6,2,2,,6,6,6,6 +7,7,3,3,,7,7,7,7 +8,8,0,0,,8,8,8,8 +9,9,1,1,,9,9,9,9 10,10,2,2,,10,10,10,10 -11,11,2,2,,11,11,11,11 -12,12,3,3,,12,12,12,12 -13,13,3,3,,13,13,13,13 -14,14,3,3,,14,14,14,14 +11,11,3,3,,11,11,11,11 +12,12,0,0,,12,12,12,12 +13,13,1,1,,13,13,13,13 +14,14,2,2,,14,14,14,14 15,15,3,3,,15,15,15,15 diff --git a/tests/expected/lscpu/lscpu-x86_64-ibme326m b/tests/expected/lscpu/lscpu-x86_64-ibme326m index a373aacc..ccc64a07 100644 --- a/tests/expected/lscpu/lscpu-x86_64-ibme326m +++ b/tests/expected/lscpu/lscpu-x86_64-ibme326m @@ -12,6 +12,7 @@ CPU MHz: 1995.058 L1d cache: 1024K L1i cache: 1024K L2 cache: 1024K +NUMA node0 CPU(s): 0,1 # The following is the parsable format, which can be fed to other # programs. Each different item in every column has an unique ID diff --git a/tests/expected/lscpu/lscpu-x86_64-necem14 b/tests/expected/lscpu/lscpu-x86_64-necem14 index 0cde9c31..c823f7e7 100644 --- a/tests/expected/lscpu/lscpu-x86_64-necem14 +++ b/tests/expected/lscpu/lscpu-x86_64-necem14 @@ -11,6 +11,7 @@ Stepping: 3 CPU MHz: 3790.599 L1d cache: 16K L2 cache: 2048K +NUMA node0 CPU(s): 0,1 # The following is the parsable format, which can be fed to other # programs. Each different item in every column has an unique ID -- cgit v1.2.3 From 3d9c5ba7b850255a14fad0fd8e41a9c896432c71 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 1 Jun 2010 10:55:37 +0200 Subject: tests: add lscpu dump from Dell R710, 8-core Nehalem w/HT (RHEL 5.5) Signed-off-by: Karel Zak --- tests/expected/lscpu/lscpu-x86_64-dellr710 | 39 ++++++++++++++++++++++++++++ tests/ts/lscpu/dumps/x86_64-dellr710.tar.gz | Bin 0 -> 14300 bytes 2 files changed, 39 insertions(+) create mode 100644 tests/expected/lscpu/lscpu-x86_64-dellr710 create mode 100644 tests/ts/lscpu/dumps/x86_64-dellr710.tar.gz diff --git a/tests/expected/lscpu/lscpu-x86_64-dellr710 b/tests/expected/lscpu/lscpu-x86_64-dellr710 new file mode 100644 index 00000000..43679dc4 --- /dev/null +++ b/tests/expected/lscpu/lscpu-x86_64-dellr710 @@ -0,0 +1,39 @@ +CPU op-mode(s): 32-bit, 64-bit +CPU(s): 16 +Thread(s) per core: 2 +Core(s) per socket: 4 +CPU socket(s): 2 +NUMA node(s): 2 +Vendor ID: GenuineIntel +CPU family: 6 +Model: 26 +Stepping: 5 +CPU MHz: 2527.073 +Virtualization: VT-x +L1d cache: 32K +L1i cache: 32K +L2 cache: 256K +L3 cache: 8192K +NUMA node0 CPU(s): 0,2,4,6,8,10,12,14 +NUMA node1 CPU(s): 1,3,5,7,9,11,13,15 + +# The following is the parsable format, which can be fed to other +# programs. Each different item in every column has an unique ID +# starting from zero. +# CPU,Core,Socket,Node,,L1d,L1i,L2,L3 +0,0,0,0,,0,0,0,0 +1,1,1,1,,1,1,1,1 +2,2,0,0,,2,2,2,0 +3,3,1,1,,3,3,3,1 +4,4,0,0,,4,4,4,0 +5,5,1,1,,5,5,5,1 +6,6,0,0,,6,6,6,0 +7,7,1,1,,7,7,7,1 +8,0,0,0,,0,0,0,0 +9,1,1,1,,1,1,1,1 +10,2,0,0,,2,2,2,0 +11,3,1,1,,3,3,3,1 +12,4,0,0,,4,4,4,0 +13,5,1,1,,5,5,5,1 +14,6,0,0,,6,6,6,0 +15,7,1,1,,7,7,7,1 diff --git a/tests/ts/lscpu/dumps/x86_64-dellr710.tar.gz b/tests/ts/lscpu/dumps/x86_64-dellr710.tar.gz new file mode 100644 index 00000000..2c163816 Binary files /dev/null and b/tests/ts/lscpu/dumps/x86_64-dellr710.tar.gz differ -- cgit v1.2.3 From f29922a5bc6f64e2876694bdc77ef6b59639fbb2 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Tue, 18 May 2010 01:07:46 +0200 Subject: ipcs: get rid of colons from header strings for consistency This changes output of -u, -l, and -c. Example of non consistent output: $ ipcs -u | grep ^--- ------ Shared Memory Status -------- ------ Semaphore Status -------- ------ Messages: Status -------- Signed-off-by: Francesco Cosoleto --- sys-utils/ipcs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c index 766e5869..7cc204e1 100644 --- a/sys-utils/ipcs.c +++ b/sys-utils/ipcs.c @@ -487,21 +487,21 @@ void do_msg (char format) case LIMITS: if ((msgctl (0, IPC_INFO, (struct msqid_ds *) (void *) &msginfo)) < 0 ) return; - printf (_("------ Messages: Limits --------\n")); + printf (_("------ Messages Limits --------\n")); printf (_("max queues system wide = %d\n"), msginfo.msgmni); printf (_("max size of message (bytes) = %d\n"), msginfo.msgmax); printf (_("default max size of queue (bytes) = %d\n"), msginfo.msgmnb); return; case STATUS: - printf (_("------ Messages: Status --------\n")); + printf (_("------ Messages Status --------\n")); printf (_("allocated queues = %d\n"), msginfo.msgpool); printf (_("used headers = %d\n"), msginfo.msgmap); printf (_("used space = %d bytes\n"), msginfo.msgtql); return; case CREATOR: - printf (_("------ Message Queues: Creators/Owners --------\n")); + printf (_("------ Message Queues Creators/Owners --------\n")); printf ("%-10s %-10s %-10s %-10s %-10s %-10s\n", _("msqid"),_("perms"),_("cuid"),_("cgid"),_("uid"),_("gid")); break; -- cgit v1.2.3 From 3c462efefe8b2ca9786fbaa667b2e275ccb24e59 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Tue, 18 May 2010 01:07:48 +0200 Subject: ipcs: add missing "PIDs" to related shared memory header text Signed-off-by: Francesco Cosoleto --- sys-utils/ipcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c index 7cc204e1..eb1e30a9 100644 --- a/sys-utils/ipcs.c +++ b/sys-utils/ipcs.c @@ -296,7 +296,7 @@ void do_shm (char format) break; case PID: - printf (_("------ Shared Memory Creator/Last-op --------\n")); + printf (_("------ Shared Memory Creator/Last-op PIDs --------\n")); printf ("%-10s %-10s %-10s %-10s\n", _("shmid"),_("owner"),_("cpid"),_("lpid")); break; -- cgit v1.2.3 From 75f037082038a4f9857d00e45254fcd4bce4cec2 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Tue, 18 May 2010 01:07:49 +0200 Subject: tests: update ipcs/headers test Signed-off-by: Francesco Cosoleto --- tests/expected/ipcs/headers | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/expected/ipcs/headers b/tests/expected/ipcs/headers index 155d3080..298d8c93 100644 --- a/tests/expected/ipcs/headers +++ b/tests/expected/ipcs/headers @@ -1,7 +1,7 @@ test: shm headers ------ Shared Memory Attach/Detach/Change Times -------- shmid owner attached detached changed ------- Shared Memory Creator/Last-op -------- +------ Shared Memory Creator/Last-op PIDs -------- shmid owner cpid lpid ------ Shared Memory Segment Creators/Owners -------- shmid perms cuid cgid uid gid @@ -13,10 +13,10 @@ test: mesg headers msqid owner send recv change ------ Message Queues PIDs -------- msqid owner lspid lrpid ------- Message Queues: Creators/Owners -------- +------ Message Queues Creators/Owners -------- msqid perms cuid cgid uid gid ------- Messages: Limits -------- ------- Messages: Status -------- +------ Messages Limits -------- +------ Messages Status -------- test: sem headers ------ Semaphore Operation/Change Times -------- @@ -43,7 +43,7 @@ semid owner last-op last-changed -- ------ Message Queues Send/Recv/Change Times -------- msqid owner send recv change ------- Shared Memory Creator/Last-op -------- +------ Shared Memory Creator/Last-op PIDs -------- shmid owner cpid lpid -- ------ Message Queues PIDs -------- @@ -54,11 +54,11 @@ shmid perms cuid cgid uid gid ------ Semaphore Arrays Creators/Owners -------- semid perms cuid cgid uid gid -- ------- Message Queues: Creators/Owners -------- +------ Message Queues Creators/Owners -------- msqid perms cuid cgid uid gid ------ Shared Memory Limits -------- ------ Semaphore Limits -------- ------- Messages: Limits -------- +------ Messages Limits -------- ------ Shared Memory Status -------- ------ Semaphore Status -------- ------- Messages: Status -------- +------ Messages Status -------- -- cgit v1.2.3 From 89074c16595d26c5ceaf112ed5385db97f88bbfe Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Tue, 18 May 2010 01:07:50 +0200 Subject: ipcs: reorganize help and usage texts Help text old version: ipcs provides information on ipc facilities for which you have read access. Resource Specification: -m : shared_mem -q : messages -s : semaphores -a : all (default) Output Format: -t : time -p : pid -c : creator -l : limits -u : summary -i id [-s -q -m] : details on resource identified by id usage : ipcs -asmq -tclup ipcs [-s -m -q] -i id ipcs -h for help. New version: Usage: ipcs [resource]... [output-format] ipcs [resource] -i id Provide information on IPC facilities for which you have read access. -h display this help -i id print details on resource identified by id Resource options: -m shared memory segments -q message queues -s semaphores -a all (default) Output format: -t time -p pid -c creator -l limits -u summary Usage text old version: usage : ipcs -asmq -tclup ipcs [-s -m -q] -i id ipcs -h for help. New version: Usage: ipcs [-asmq] [-t|-c|-l|-u|-p] ipcs [-s|-m|-q] -i id ipcs -h for help [kzak@redhat.com: - use program_invocation_short_name - minor cleanups] Signed-off-by: Francesco Cosoleto Signed-off-by: Karel Zak --- sys-utils/ipcs.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c index eb1e30a9..60cfe417 100644 --- a/sys-utils/ipcs.c +++ b/sys-utils/ipcs.c @@ -109,26 +109,41 @@ void print_shm (int id); void print_msg (int id); void print_sem (int id); -static char *progname; - static void usage(int rc) { - printf (_("usage : %s -asmq -tclup \n"), progname); - printf (_("\t%s [-s -m -q] -i id\n"), progname); - printf (_("\t%s -h for help.\n"), progname); + printf (_("Usage: %1$s [-asmq] [-t|-c|-l|-u|-p]\n" + " %1$s [-s|-m|-q] -i id\n" + " %1$s -h for help\n"), + program_invocation_short_name); exit(rc); } static void help (int rc) { - printf (_("%s provides information on ipc facilities for" - " which you have read access.\n"), progname); - printf (_("Resource Specification:\n\t-m : shared_mem\n\t-q : messages\n")); - printf (_("\t-s : semaphores\n\t-a : all (default)\n")); - printf (_("Output Format:\n\t-t : time\n\t-p : pid\n\t-c : creator\n")); - printf (_("\t-l : limits\n\t-u : summary\n")); - printf (_("-i id [-s -q -m] : details on resource identified by id\n")); - usage(rc); + printf (_("Usage: %1$s [resource]... [output-format]\n" + " %1$s [resource] -i id\n\n"), + program_invocation_short_name); + + printf (_("Provide information on IPC facilities for which you " + "have read access.\n\n")); + + printf (_( + " -h display this help\n" + " -i id print details on resource identified by id\n\n")); + + printf (_("Resource options:\n" + " -m shared memory segments\n" + " -q message queues\n" + " -s semaphores\n" + " -a all (default)\n\n")); + + printf (_("Output format:\n" + " -t time\n" + " -p pid\n" + " -c creator\n" + " -l limits\n" + " -u summary\n")); + exit(rc); } int @@ -141,7 +156,6 @@ main (int argc, char **argv) { bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - progname = argv[0]; while ((opt = getopt (argc, argv, options)) != -1) { switch (opt) { case 'i': -- cgit v1.2.3 From 8604c25570baaaf814b95199fd0592147d8616c1 Mon Sep 17 00:00:00 2001 From: Andrew Nayenko Date: Fri, 28 May 2010 23:22:00 +0400 Subject: libblkid: add exFAT file system detection support Add exFAT file system detection support. Signed-off-by: Andrew Nayenko --- shlibs/blkid/src/superblocks/Makefile.am | 3 +- shlibs/blkid/src/superblocks/exfat.c | 146 +++++++++++++++++++++++++++++ shlibs/blkid/src/superblocks/superblocks.c | 3 +- shlibs/blkid/src/superblocks/superblocks.h | 1 + tests/expected/blkid/low-probe-exfat | 7 ++ tests/ts/blkid/images-fs/exfat.img.bz2 | Bin 0 -> 6301 bytes 6 files changed, 158 insertions(+), 2 deletions(-) create mode 100644 shlibs/blkid/src/superblocks/exfat.c create mode 100644 tests/expected/blkid/low-probe-exfat create mode 100644 tests/ts/blkid/images-fs/exfat.img.bz2 diff --git a/shlibs/blkid/src/superblocks/Makefile.am b/shlibs/blkid/src/superblocks/Makefile.am index f5b88b8e..39b074ba 100644 --- a/shlibs/blkid/src/superblocks/Makefile.am +++ b/shlibs/blkid/src/superblocks/Makefile.am @@ -46,4 +46,5 @@ libblkid_superblocks_la_SOURCES = \ bfs.c \ drbd.c \ vmfs.c \ - befs.c + befs.c \ + exfat.c diff --git a/shlibs/blkid/src/superblocks/exfat.c b/shlibs/blkid/src/superblocks/exfat.c new file mode 100644 index 00000000..bada3a83 --- /dev/null +++ b/shlibs/blkid/src/superblocks/exfat.c @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2010 Andrew Nayenko + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ +#include "superblocks.h" + +struct exfat_super_block { + uint8_t jump[3]; + uint8_t oem_name[8]; + uint8_t __unused1[53]; + uint64_t block_start; + uint64_t block_count; + uint32_t fat_block_start; + uint32_t fat_block_count; + uint32_t cluster_block_start; + uint32_t cluster_count; + uint32_t rootdir_cluster; + uint8_t volume_serial[4]; + struct { + uint8_t minor; + uint8_t major; + } version; + uint16_t volume_state; + uint8_t block_bits; + uint8_t bpc_bits; + uint8_t fat_count; + uint8_t drive_no; + uint8_t allocated_percent; +} __attribute__((__packed__)); + +struct exfat_entry_label { + uint8_t type; + uint8_t length; + uint8_t name[30]; +} __attribute__((__packed__)); + +#define BLOCK_SIZE(sb) (1 << (sb)->block_bits) +#define CLUSTER_SIZE(sb) (BLOCK_SIZE(sb) << (sb)->bpc_bits) +#define EXFAT_FIRST_DATA_CLUSTER 2 +#define EXFAT_LAST_DATA_CLUSTER 0xffffff6 +#define EXFAT_ENTRY_SIZE 32 + +#define EXFAT_ENTRY_EOD 0x00 +#define EXFAT_ENTRY_LABEL 0x83 + +static blkid_loff_t block_to_offset(const struct exfat_super_block *sb, + blkid_loff_t block) +{ + return (blkid_loff_t) block << sb->block_bits; +} + +static blkid_loff_t cluster_to_block(const struct exfat_super_block *sb, + uint32_t cluster) +{ + return le32_to_cpu(sb->cluster_block_start) + + ((blkid_loff_t) (cluster - EXFAT_FIRST_DATA_CLUSTER) + << sb->bpc_bits); +} + +static blkid_loff_t cluster_to_offset(const struct exfat_super_block *sb, + uint32_t cluster) +{ + return block_to_offset(sb, cluster_to_block(sb, cluster)); +} + +static uint32_t next_cluster(blkid_probe pr, + const struct exfat_super_block *sb, uint32_t cluster) +{ + uint32_t *next; + blkid_loff_t fat_offset; + + fat_offset = block_to_offset(sb, le32_to_cpu(sb->fat_block_start)) + + (blkid_loff_t) cluster * sizeof(cluster); + next = (uint32_t *) blkid_probe_get_buffer(pr, fat_offset, + sizeof(uint32_t)); + if (!next) + return 0; + return le32_to_cpu(*next); +} + +static struct exfat_entry_label *find_label(blkid_probe pr, + const struct exfat_super_block *sb) +{ + uint32_t cluster = le32_to_cpu(sb->rootdir_cluster); + blkid_loff_t offset = cluster_to_offset(sb, cluster); + uint8_t *entry; + + for (;;) { + entry = (uint8_t *) blkid_probe_get_buffer(pr, offset, + EXFAT_ENTRY_SIZE); + if (!entry) + return NULL; + if (entry[0] == EXFAT_ENTRY_EOD) + return NULL; + if (entry[0] == EXFAT_ENTRY_LABEL) + return (struct exfat_entry_label *) entry; + offset += EXFAT_ENTRY_SIZE; + if (offset % CLUSTER_SIZE(sb) == 0) { + cluster = next_cluster(pr, sb, cluster); + if (cluster < EXFAT_FIRST_DATA_CLUSTER) + return NULL; + if (cluster > EXFAT_LAST_DATA_CLUSTER) + return NULL; + offset = cluster_to_offset(sb, cluster); + } + } +} + +static int probe_exfat(blkid_probe pr, const struct blkid_idmag *mag) +{ + struct exfat_super_block *sb; + struct exfat_entry_label *label; + + sb = blkid_probe_get_sb(pr, mag, struct exfat_super_block); + if (!sb) + return -1; + + label = find_label(pr, sb); + if (label) + blkid_probe_set_utf8label(pr, label->name, + min(label->length * 2, 30), BLKID_ENC_UTF16LE); + + blkid_probe_sprintf_uuid(pr, sb->volume_serial, 4, + "%02hhX%02hhX-%02hhX%02hhX", + sb->volume_serial[3], sb->volume_serial[2], + sb->volume_serial[1], sb->volume_serial[0]); + + blkid_probe_sprintf_version(pr, "%hu.%hu", + sb->version.major, sb->version.minor); + + return 0; +} + +const struct blkid_idinfo exfat_idinfo = +{ + .name = "exfat", + .usage = BLKID_USAGE_FILESYSTEM, + .probefunc = probe_exfat, + .magics = + { + { .magic = "EXFAT ", .len = 8, .sboff = 3 }, + { NULL } + } +}; diff --git a/shlibs/blkid/src/superblocks/superblocks.c b/shlibs/blkid/src/superblocks/superblocks.c index caa169fa..b80c10b7 100644 --- a/shlibs/blkid/src/superblocks/superblocks.c +++ b/shlibs/blkid/src/superblocks/superblocks.c @@ -139,7 +139,8 @@ static const struct blkid_idinfo *idinfos[] = &ubifs_idinfo, &bfs_idinfo, &vmfs_fs_idinfo, - &befs_idinfo + &befs_idinfo, + &exfat_idinfo }; /* diff --git a/shlibs/blkid/src/superblocks/superblocks.h b/shlibs/blkid/src/superblocks/superblocks.h index b1fa49d5..74cb9743 100644 --- a/shlibs/blkid/src/superblocks/superblocks.h +++ b/shlibs/blkid/src/superblocks/superblocks.h @@ -65,6 +65,7 @@ extern const struct blkid_idinfo vmfs_volume_idinfo; extern const struct blkid_idinfo vmfs_fs_idinfo; extern const struct blkid_idinfo drbd_idinfo; extern const struct blkid_idinfo befs_idinfo; +extern const struct blkid_idinfo exfat_idinfo; /* * superblock functions diff --git a/tests/expected/blkid/low-probe-exfat b/tests/expected/blkid/low-probe-exfat new file mode 100644 index 00000000..b9defbdf --- /dev/null +++ b/tests/expected/blkid/low-probe-exfat @@ -0,0 +1,7 @@ +ID_FS_LABEL=Новый_том +ID_FS_LABEL_ENC=Новый\x20том +ID_FS_TYPE=exfat +ID_FS_USAGE=filesystem +ID_FS_UUID=9C23-8877 +ID_FS_UUID_ENC=9C23-8877 +ID_FS_VERSION=1.0 diff --git a/tests/ts/blkid/images-fs/exfat.img.bz2 b/tests/ts/blkid/images-fs/exfat.img.bz2 new file mode 100644 index 00000000..f96c3f06 Binary files /dev/null and b/tests/ts/blkid/images-fs/exfat.img.bz2 differ -- cgit v1.2.3 From 0159857e0d2a2fc4b1fec78b9b8dcd9982c00105 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 2 Jun 2010 16:11:52 +0200 Subject: 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 Signed-off-by: Karel Zak --- misc-utils/blkid.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 48af7674..f94df06a 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -268,11 +268,8 @@ static void print_udev_format(const char *name, const char *value, size_t sz) } else if (!strcmp(name, "PART_ENTRY_NAME") || !strcmp(name, "PART_ENTRY_TYPE")) { - blkid_safe_string(value, safe, sizeof(safe)); - printf("ID_%s=%s\n", name, safe); - blkid_encode_string(value, enc, sizeof(enc)); - printf("ID_%s_ENC=%s\n", name, enc); + printf("ID_%s=%s\n", name, enc); } else if (!strncmp(name, "PART_ENTRY_", 11)) printf("ID_%s=%s\n", name, value); -- cgit v1.2.3 From f1cde479a3aa2659ffdee27e22d4a49a5cd9b0a5 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 26 Nov 2009 17:11:12 +0100 Subject: libmount: add basic dirs Signed-off-by: Karel Zak --- config/include-Makefile.am | 12 ++++++++++++ configure.ac | 21 ++++++++++++++++++++ shlibs/Makefile.am | 4 ++++ shlibs/mount/.gitignore | 2 ++ shlibs/mount/Makefile.am | 9 +++++++++ shlibs/mount/mount.pc.in | 11 +++++++++++ shlibs/mount/src/Makefile.am | 46 ++++++++++++++++++++++++++++++++++++++++++++ shlibs/mount/src/mount.h.in | 34 ++++++++++++++++++++++++++++++++ shlibs/mount/src/mount.sym | 11 +++++++++++ 9 files changed, 150 insertions(+) create mode 100644 shlibs/mount/.gitignore create mode 100644 shlibs/mount/Makefile.am create mode 100644 shlibs/mount/mount.pc.in create mode 100644 shlibs/mount/src/Makefile.am create mode 100644 shlibs/mount/src/mount.h.in create mode 100644 shlibs/mount/src/mount.sym diff --git a/config/include-Makefile.am b/config/include-Makefile.am index e13bb8ee..e7dbd34e 100644 --- a/config/include-Makefile.am +++ b/config/include-Makefile.am @@ -22,6 +22,7 @@ ul_libblkid_incdir = $(ul_libblkid_builddir) $(ul_libblkid_la): $(MAKE) -C $(ul_libblkid_builddir) + # uuid ul_libuuid_srcdir = $(top_srcdir)/shlibs/uuid/src ul_libuuid_builddir = $(top_builddir)/shlibs/uuid/src @@ -30,3 +31,14 @@ ul_libuuid_la = $(top_builddir)/shlibs/uuid/src/libuuid.la $(ul_libuuid_la): $(MAKE) -C $(ul_libuuid_builddir) + +# mount +ul_libmount_srcdir = $(top_srcdir)/shlibs/mount/src +ul_libmount_builddir = $(top_builddir)/shlibs/mount/src +ul_libmount_la = $(top_builddir)/shlibs/mount/src/libmount.la + +# mount.h is generated by ./configure script and stored in build directory +ul_libmount_incdir = $(ul_libmount_builddir) + +$(ul_libmount_la): + $(MAKE) -C $(ul_libmount_builddir) diff --git a/configure.ac b/configure.ac index fae8db14..286703b5 100644 --- a/configure.ac +++ b/configure.ac @@ -35,6 +35,13 @@ LIBUUID_LT_MINOR=3 LIBUUID_LT_MICRO=0 LIBUUID_VERSION_INFO=`expr $LIBUUID_LT_MAJOR + $LIBUUID_LT_MINOR`:$LIBUUID_LT_MICRO:$LIBUUID_LT_MINOR +dnl libmount version +LIBMOUNT_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE" +LIBMOUNT_LT_MAJOR=1 +LIBMOUNT_LT_MINOR=1 +LIBMOUNT_LT_MICRO=0 +LIBMOUNT_VERSION_INFO=`expr $LIBMOUNT_LT_MAJOR + $LIBMOUNT_LT_MINOR`:$LIBMOUNT_LT_MICRO:$LIBMOUNT_LT_MINOR + # Check whether exec_prefix=/usr: case $exec_prefix:$prefix in NONE:NONE | NONE:/usr | /usr:*) @@ -390,6 +397,16 @@ AM_CONDITIONAL(HAVE_BLKID, test "x$have_blkid" = xyes) AC_ARG_VAR([BLKID_LIBS_STATIC], [-l options for linking statically with blkid]) + +AC_ARG_ENABLE([libmount], + AS_HELP_STRING([--disable-libmount], [do not build libmount]), + [], enable_libmount=yes +) +AC_SUBST([LIBMOUNT_VERSION]) +AC_SUBST([LIBMOUNT_VERSION_INFO]) +AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$enable_libmount" = xyes) + + UTIL_CHECK_LIB(util, openpty) UTIL_CHECK_LIB(termcap, tgetnum) @@ -1122,6 +1139,10 @@ shlibs/blkid/src/superblocks/Makefile shlibs/blkid/src/topology/Makefile shlibs/blkid/src/partitions/Makefile shlibs/blkid/samples/Makefile +shlibs/mount/mount.pc +shlibs/mount/Makefile +shlibs/mount/src/Makefile +shlibs/mount/src/mount.h shlibs/uuid/uuid.pc shlibs/uuid/Makefile shlibs/uuid/man/Makefile diff --git a/shlibs/Makefile.am b/shlibs/Makefile.am index 3e757885..84c0cefc 100644 --- a/shlibs/Makefile.am +++ b/shlibs/Makefile.am @@ -7,3 +7,7 @@ endif if BUILD_LIBBLKID SUBDIRS += blkid endif + +if BUILD_LIBMOUNT +SUBDIRS += mount +endif diff --git a/shlibs/mount/.gitignore b/shlibs/mount/.gitignore new file mode 100644 index 00000000..1c7879de --- /dev/null +++ b/shlibs/mount/.gitignore @@ -0,0 +1,2 @@ +test_* +mount.h diff --git a/shlibs/mount/Makefile.am b/shlibs/mount/Makefile.am new file mode 100644 index 00000000..f90eacc1 --- /dev/null +++ b/shlibs/mount/Makefile.am @@ -0,0 +1,9 @@ +include $(top_srcdir)/config/include-Makefile.am + +SUBDIRS = src + +# pkg-config stuff +pkgconfigdir = $(usrlib_execdir)/pkgconfig +pkgconfig_DATA = mount.pc + +EXTRA_DIST = mount.pc.in diff --git a/shlibs/mount/mount.pc.in b/shlibs/mount/mount.pc.in new file mode 100644 index 00000000..94051b8b --- /dev/null +++ b/shlibs/mount/mount.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@usrlib_execdir@ +includedir=@includedir@ + +Name: mount +Description: mount library +Version: @LIBMOUNT_VERSION@ +Requires.private: blkid +Cflags: -I${includedir}/mount +Libs: -L${libdir} -lmount diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am new file mode 100644 index 00000000..5d6c32df --- /dev/null +++ b/shlibs/mount/src/Makefile.am @@ -0,0 +1,46 @@ +include $(top_srcdir)/config/include-Makefile.am + +AM_CPPFLAGS += -I$(ul_libmount_incdir) \ + -I$(ul_libmount_srcdir) \ + -I$(ul_libblkid_incdir) + +# includes +mountincdir = $(includedir)/mount +nodist_mountinc_HEADERS = mount.h + +usrlib_exec_LTLIBRARIES = libmount.la +libmount_la_SOURCES = $(mountinc_HEADERS) + +nodist_libmount_la_SOURCES = mount.h + +libmount_la_LIBADD = $(ul_libblkid_la) + +libmount_la_DEPENDENCIES = $(libmount_la_LIBADD) mount.sym mount.h.in + +libmount_la_LDFLAGS = -Wl,--version-script=$(ul_libmount_srcdir)/mount.sym \ + -version-info $(LIBMOUNT_VERSION_INFO) + +tests = + +EXTRA_DIST = mount.sym mount.h.in +CLEANFILES = $(tests) + +tests: all $(tests) +test_%: %.c + $(COMPILE) -DTEST_PROGRAM $< .libs/libmount.a -o $@ $(BLKID_LIBS) + + +# move lib from $(usrlib_execdir) to $(libdir) if needed +install-exec-hook: + if test "$(usrlib_execdir)" != "$(libdir)"; then \ + mkdir -p $(DESTDIR)$(libdir); \ + mv $(DESTDIR)$(usrlib_execdir)/libmount.so.* $(DESTDIR)$(libdir); \ + so_img_name=$$(readlink $(DESTDIR)$(usrlib_execdir)/libmount.so); \ + so_img_rel_target=$$(echo $(usrlib_execdir) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ + (cd $(DESTDIR)$(usrlib_execdir) && \ + rm -f libmount.so && \ + $(LN_S) $$so_img_rel_target$(libdir)/$$so_img_name libmount.so); \ + fi + +uninstall-hook: + rm -f $(DESTDIR)$(libdir)/libmount.so* diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in new file mode 100644 index 00000000..e9b0425c --- /dev/null +++ b/shlibs/mount/src/mount.h.in @@ -0,0 +1,34 @@ +/* + * mount.h - libmount API + * + * Copyright (C) 2008-2009 Karel Zak + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _LIBMOUNT_MOUNT_H +#define _LIBMOUNT_MOUNT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define LIBMOUNT_VERSION "@LIBMOUNT_VERSION@" + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBMOUNT_MOUNT_H */ diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym new file mode 100644 index 00000000..5922560b --- /dev/null +++ b/shlibs/mount/src/mount.sym @@ -0,0 +1,11 @@ +/* + * The symbol versioning ensures that a new application requiring symbol foo() + * can't run with old libblkid.so not providing foo() - the global SONAME + * version info can't enforce this since we never change the SONAME. + */ +MOUNT_2.18 { +global: + dummy; +local: + *; +}; -- cgit v1.2.3 From f4ab4ae8eb49b99e61f9f8ba59de7195342a8a02 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 26 Nov 2009 17:27:13 +0100 Subject: libmount: add version.c Signed-off-by: Karel Zak --- configure.ac | 1 + shlibs/mount/src/Makefile.am | 3 ++- shlibs/mount/src/mount.h.in | 4 ++++ shlibs/mount/src/mount.sym | 3 ++- shlibs/mount/src/mountP.h | 21 ++++++++++++++++++ shlibs/mount/src/version.c | 52 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 shlibs/mount/src/mountP.h create mode 100644 shlibs/mount/src/version.c diff --git a/configure.ac b/configure.ac index 286703b5..af92980e 100644 --- a/configure.ac +++ b/configure.ac @@ -404,6 +404,7 @@ AC_ARG_ENABLE([libmount], ) AC_SUBST([LIBMOUNT_VERSION]) AC_SUBST([LIBMOUNT_VERSION_INFO]) +AC_DEFINE_UNQUOTED(LIBMOUNT_VERSION, "$LIBMOUNT_VERSION", [libmount version string]) AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$enable_libmount" = xyes) diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index 5d6c32df..7b3aaaf0 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -11,7 +11,8 @@ nodist_mountinc_HEADERS = mount.h usrlib_exec_LTLIBRARIES = libmount.la libmount_la_SOURCES = $(mountinc_HEADERS) -nodist_libmount_la_SOURCES = mount.h +nodist_libmount_la_SOURCES = mount.h \ + version.c libmount_la_LIBADD = $(ul_libblkid_la) diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index e9b0425c..9767a0a9 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -27,6 +27,10 @@ extern "C" { #define LIBMOUNT_VERSION "@LIBMOUNT_VERSION@" +/* version.c */ +extern int mnt_parse_version_string(const char *ver_string); +extern int mnt_get_library_version(const char **ver_string); + #ifdef __cplusplus } #endif diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym index 5922560b..cf6907a9 100644 --- a/shlibs/mount/src/mount.sym +++ b/shlibs/mount/src/mount.sym @@ -5,7 +5,8 @@ */ MOUNT_2.18 { global: - dummy; + mnt_get_library_version; + mnt_parse_version_string; local: *; }; diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h new file mode 100644 index 00000000..2a486f02 --- /dev/null +++ b/shlibs/mount/src/mountP.h @@ -0,0 +1,21 @@ +/* + * mountP.h - private library header file + * + * Copyright (C) 2008-2009 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ + +#ifndef _LIBMOUNT_PRIVATE_H +#define _LIBMOUNT_PRIVATE_H + +/* features */ +#define CONFIG_LIBMOUNT_ASSERT + +#ifdef CONFIG_LIBMOUNT_ASSERT +#include +#endif + +#include "mount.h" +#endif diff --git a/shlibs/mount/src/version.c b/shlibs/mount/src/version.c new file mode 100644 index 00000000..8fd38a3c --- /dev/null +++ b/shlibs/mount/src/version.c @@ -0,0 +1,52 @@ +/* + * version.c - Return the version of the blkid library + * + * Copyright (C) 2008 Karel Zak + * [Based on libblkid/version.c by Theodore Ts'o] + * + * See COPYING.libmount for the License of this software. + */ + +#include +#include +#include +#include + +#include "mountP.h" + +static const char *lib_version = LIBMOUNT_VERSION; + +/** + * mnt_parse_version_string: + * @ver_string: version string (e.g "2.18.0") + * + * Returns: release version code. + */ +int mnt_parse_version_string(const char *ver_string) +{ + const char *cp; + int version = 0; + + for (cp = ver_string; *cp; cp++) { + if (*cp == '.') + continue; + if (!isdigit(*cp)) + break; + version = (version * 10) + (*cp - '0'); + } + return version; +} + +/** + * mnt_get_library_version: + * @ver_string: return pointer to the static library version string + * + * Returns: release version number. + */ +int mnt_get_library_version(const char **ver_string) +{ + if (ver_string) + *ver_string = lib_version; + + return mnt_parse_version_string(lib_version); +} -- cgit v1.2.3 From 69b7e41e999bbe8ac7402cd958bb3d4ba1d2e6fb Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 26 Nov 2009 17:45:01 +0100 Subject: libmount: add basic utils Signed-off-by: Karel Zak --- configure.ac | 3 + shlibs/mount/src/Makefile.am | 3 +- shlibs/mount/src/mount.h.in | 5 ++ shlibs/mount/src/mount.sym | 3 + shlibs/mount/src/mountP.h | 19 +++- shlibs/mount/src/utils.c | 208 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 239 insertions(+), 2 deletions(-) create mode 100644 shlibs/mount/src/utils.c diff --git a/configure.ac b/configure.ac index af92980e..11756409 100644 --- a/configure.ac +++ b/configure.ac @@ -188,6 +188,9 @@ AC_CHECK_FUNCS( srandom \ setresgid \ setresuid \ + strndup \ + strnlen \ + strnchr \ inotify_init \ prctl \ posix_fadvise \ diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index 7b3aaaf0..2ac06bd3 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -12,7 +12,8 @@ usrlib_exec_LTLIBRARIES = libmount.la libmount_la_SOURCES = $(mountinc_HEADERS) nodist_libmount_la_SOURCES = mount.h \ - version.c + version.c \ + utils.c libmount_la_LIBADD = $(ul_libblkid_la) diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 9767a0a9..6990e5ce 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -31,6 +31,11 @@ extern "C" { extern int mnt_parse_version_string(const char *ver_string); extern int mnt_get_library_version(const char **ver_string); +/* utils.c */ +extern int mnt_fstype_is_netfs(const char *type); +extern int mnt_fstype_is_pseudofs(const char *type); +extern int mnt_open_device(const char *devname, int flags); + #ifdef __cplusplus } #endif diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym index cf6907a9..0f2fc6b7 100644 --- a/shlibs/mount/src/mount.sym +++ b/shlibs/mount/src/mount.sym @@ -5,7 +5,10 @@ */ MOUNT_2.18 { global: + mnt_fstype_is_netfs; + mnt_fstype_is_pseudofs; mnt_get_library_version; + mnt_open_device; mnt_parse_version_string; local: *; diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index 2a486f02..17234134 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -10,12 +10,29 @@ #ifndef _LIBMOUNT_PRIVATE_H #define _LIBMOUNT_PRIVATE_H +#include +#include "mount.h" + /* features */ +#define CONFIG_CDROM_NOMEDIUM_RETRIES 5 #define CONFIG_LIBMOUNT_ASSERT #ifdef CONFIG_LIBMOUNT_ASSERT #include #endif -#include "mount.h" +/* utils.c */ +extern char *mnt_getenv_safe(const char *arg); +#ifndef HAVE_STRNLEN +extern size_t strnlen(const char *s, size_t maxlen); +#endif +#ifndef HAVE_STRNDUP +extern char *strndup(const char *s, size_t n); +#endif +#ifndef HAVE_STRNCHR +extern char *strnchr(const char *s, size_t maxlen, int c); +#endif +extern char *mnt_get_username(const uid_t uid); +extern char *mnt_strconcat3(char *s, const char *t, const char *u); + #endif diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c new file mode 100644 index 00000000..fbdfadb8 --- /dev/null +++ b/shlibs/mount/src/utils.c @@ -0,0 +1,208 @@ +/* + * Copyright (C) 2008-2009 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ + +#include +#include +#include +#include +#ifdef HAVE_SYS_PRCTL_H +#include +#else +#define PR_GET_DUMPABLE 3 +#endif +#if (!defined(HAVE_PRCTL) && defined(linux)) +#include +#endif +#include +#include +#include +#include +#include + +#include "mountP.h" + +char *mnt_getenv_safe(const char *arg) +{ + if ((getuid() != geteuid()) || (getgid() != getegid())) + return NULL; +#if HAVE_PRCTL + if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) + return NULL; +#else +#if (defined(linux) && defined(SYS_prctl)) + if (syscall(SYS_prctl, PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) + return NULL; +#endif +#endif + +#ifdef HAVE___SECURE_GETENV + return __secure_getenv(arg); +#else + return getenv(arg); +#endif +} + +/* TODO: move strn<...> functions to top-level lib/strn.c */ +#ifndef HAVE_STRNLEN +size_t strnlen(const char *s, size_t maxlen) +{ + int i; + + for (i = 0; i < maxlen; i++) { + if (s[i] == '\0') + return i + 1; + } + return maxlen; +} +#endif + +#ifndef HAVE_STRNCHR +char *strnchr(const char *s, size_t maxlen, int c) +{ + for (; maxlen-- && *s != '\0'; ++s) + if (*s == (char)c) + return (char *)s; + return NULL; +} +#endif + +#ifndef HAVE_STRNDUP +char *strndup(const char *s, size_t n) +{ + size_t len = strnlen (s, n); + char *new = (char *) malloc (len + 1); + + if (new == NULL) + return NULL; + + new[len] = '\0'; + return (char *) memcpy (new, s, len); +} +#endif + + +/** + * mnt_fstype_is_pseudofs: + * @type: filesystem name + * + * Returns: 1 for filesystems like proc, sysfs, ... or 0. + */ +int mnt_fstype_is_pseudofs(const char *type) +{ + if (!type) + return 0; + if (strcmp(type, "none") == 0 || + strcmp(type, "proc") == 0 || + strcmp(type, "tmpfs") == 0 || + strcmp(type, "sysfs") == 0 || + strcmp(type, "devpts") == 0|| + strcmp(type, "cgroups") == 0 || + strcmp(type, "devfs") == 0 || + strcmp(type, "dlmfs") == 0 || + strcmp(type, "cpuset") == 0 || + strcmp(type, "spufs") == 0) + return 1; + return 0; +} + +/** + * mnt_fstype_is_netfs: + * @type: filesystem name + * + * Returns: 1 for filesystems like cifs, nfs, ... or 0. + */ +int mnt_fstype_is_netfs(const char *type) +{ + if (!type) + return 0; + if (strcmp(type, "cifs") == 0 || + strcmp(type, "smbfs") == 0 || + strncmp(type, "nfs", 3) == 0 || + strcmp(type, "afs") == 0 || + strcmp(type, "ncpfs") == 0) + return 1; + return 0; +} + +/* + * Reallocates its first arg @s - typical use: s = mnt_strconcat3(s,t,u); + * Returns reallocated @s ion succes or NULL in case of error. + */ +char *mnt_strconcat3(char *s, const char *t, const char *u) +{ + size_t len = 0; + + len = (s ? strlen(s) : 0) + (t ? strlen(t) : 0) + (u ? strlen(u) : 0); + + if (!len) + return NULL; + if (!s) { + s = malloc(len + 1); + *s = '\0'; + } else + s = realloc(s, len + 1); + + if (!s) + return NULL; + if (t) + strcat(s, t); + if (u) + strcat(s, u); + return s; +} + +/** + * mnt_open_device: + * @devname: device path + * @flags: open(2) flags + * + * Opens device like open(2), but waits for cdrom medium (if errno=ENOMEDIUM). + * + * Returns: file descriptor or -1 in case of error. + */ +int mnt_open_device(const char *devname, int flags) +{ + int retries = 0; + + do { + int fd = open(devname, flags); + if (fd >= 0) + return fd; + if (errno != ENOMEDIUM) + break; + if (retries >= CONFIG_CDROM_NOMEDIUM_RETRIES) + break; + ++retries; + sleep(3); + } while(1); + + return -1; +} + +/* + * Returns allocated string with username or NULL. + */ +char *mnt_get_username(const uid_t uid) +{ + struct passwd pwd; + struct passwd *res; + size_t sz = sysconf(_SC_GETPW_R_SIZE_MAX); + char *buf, *username = NULL; + + if (sz <= 0) + sz = 16384; /* Should be more than enough */ + + buf = malloc(sz); + if (!buf) + return NULL; + + if (!getpwuid_r(uid, &pwd, buf, sz, &res) && res) + username = strdup(pwd.pw_name); + + free(buf); + return username; +} -- cgit v1.2.3 From c12cec75b09a9dc8711d4323fda017a0b77f1105 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 27 Nov 2009 00:33:37 +0100 Subject: libmount: add debug support Signed-off-by: Karel Zak --- shlibs/mount/src/Makefile.am | 4 +-- shlibs/mount/src/init.c | 31 +++++++++++++++++++++++ shlibs/mount/src/mountP.h | 32 ++++++++++++++++++++++++ shlibs/mount/src/test.c | 59 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 3 deletions(-) create mode 100644 shlibs/mount/src/init.c create mode 100644 shlibs/mount/src/test.c diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index 2ac06bd3..0483367a 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -11,9 +11,7 @@ nodist_mountinc_HEADERS = mount.h usrlib_exec_LTLIBRARIES = libmount.la libmount_la_SOURCES = $(mountinc_HEADERS) -nodist_libmount_la_SOURCES = mount.h \ - version.c \ - utils.c +nodist_libmount_la_SOURCES = mount.h version.c utils.c test.c init.c libmount_la_LIBADD = $(ul_libblkid_la) diff --git a/shlibs/mount/src/init.c b/shlibs/mount/src/init.c new file mode 100644 index 00000000..33da47b5 --- /dev/null +++ b/shlibs/mount/src/init.c @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2008 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ + +#include + +#include "mountP.h" + +#ifdef CONFIG_LIBMOUNT_DEBUG +int libmount_debug_mask; + +void mnt_init_debug(int mask) +{ + if (libmount_debug_mask & DEBUG_INIT) + return; + if (!mask) { + char *str = mnt_getenv_safe("LIBMOUNT_DEBUG"); + if (str) + libmount_debug_mask = strtoul(str, 0, 0); + } else + libmount_debug_mask = mask; + + if (libmount_debug_mask) + printf("libmount: debug mask set to 0x%04x.\n", + libmount_debug_mask); + libmount_debug_mask |= DEBUG_INIT; +} +#endif diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index 17234134..5ac3b6bc 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -16,11 +16,43 @@ /* features */ #define CONFIG_CDROM_NOMEDIUM_RETRIES 5 #define CONFIG_LIBMOUNT_ASSERT +#define CONFIG_LIBMOUNT_DEBUG #ifdef CONFIG_LIBMOUNT_ASSERT #include #endif +/* + * Debug + */ +#if defined(TEST_PROGRAM) && !defined(LIBMOUNT_DEBUG) +#define CONFIG_LIBMOUNT_DEBUG +#endif + +#define DEBUG_INIT (1 << 1) +#define DEBUG_ALL 0xFFFF + +#ifdef CONFIG_LIBMOUNT_DEBUG +#include +extern int libmount_debug_mask; +extern void mnt_init_debug(int mask); +#define DBG(m,x) if ((m) & libmount_debug_mask) x; +#else +#define DBG(m,x) +#define mnt_init_debug(x) +#endif + +#ifdef TEST_PROGRAM +struct mtest { + const char *name; + int (*body)(struct mtest *ts, int argc, char *argv[]); + const char *usage; +}; + +/* utils.c */ +extern int mnt_run_test(struct mtest *tests, int argc, char *argv[]); +#endif + /* utils.c */ extern char *mnt_getenv_safe(const char *arg); #ifndef HAVE_STRNLEN diff --git a/shlibs/mount/src/test.c b/shlibs/mount/src/test.c new file mode 100644 index 00000000..eb4f2d1d --- /dev/null +++ b/shlibs/mount/src/test.c @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2008-2009 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + * + * Routines for TEST_PROGRAMs + */ + +#include +#include +#include + +#ifndef TEST_PROGRAM +#define TEST_PROGRAM +#endif + +#include "mountP.h" + +int mnt_run_test(struct mtest *tests, int argc, char *argv[]) +{ + int rc = -1; + struct mtest *ts; + + assert(tests); + assert(argc); + assert(argv); + + if (argc < 2 || + strcmp(argv[1], "--help") == 0 || + strcmp(argv[1], "-h") == 0) + goto usage; + + mnt_init_debug(0); + + for (ts = tests; ts->name; ts++) { + if (strcmp(ts->name, argv[1]) == 0) { + rc = ts->body(ts, argc - 1, argv + 1); + if (rc) + printf("FAILED [rc=%d]", rc); + break; + } + } + + if (rc == -1 && ts->name == NULL) + goto usage; + + return rc == 0 ? EXIT_SUCCESS : EXIT_FAILURE; +usage: + printf("\nUsage:\n\t%s [testoptions]\nTests:\n", + program_invocation_short_name); + for (ts = tests; ts->name; ts++) { + printf("\t%-15s", ts->name); + if (ts->usage) + printf(" %s\n", ts->usage); + } + printf("\n"); + return EXIT_FAILURE; +} -- cgit v1.2.3 From 055927931ca5a6acc106366f1e097ac18401fc69 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 27 Nov 2009 01:13:01 +0100 Subject: libmount: add test_version Signed-off-by: Karel Zak --- shlibs/mount/src/Makefile.am | 2 +- shlibs/mount/src/version.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index 0483367a..f9cc68f9 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -20,7 +20,7 @@ libmount_la_DEPENDENCIES = $(libmount_la_LIBADD) mount.sym mount.h.in libmount_la_LDFLAGS = -Wl,--version-script=$(ul_libmount_srcdir)/mount.sym \ -version-info $(LIBMOUNT_VERSION_INFO) -tests = +tests = test_version EXTRA_DIST = mount.sym mount.h.in CLEANFILES = $(tests) diff --git a/shlibs/mount/src/version.c b/shlibs/mount/src/version.c index 8fd38a3c..0380e1c2 100644 --- a/shlibs/mount/src/version.c +++ b/shlibs/mount/src/version.c @@ -50,3 +50,31 @@ int mnt_get_library_version(const char **ver_string) return mnt_parse_version_string(lib_version); } + +#ifdef TEST_PROGRAM +int test_version(struct mtest *ts, int argc, char *argv[]) +{ + const char *ver; + + mnt_get_library_version(&ver); + + printf("Library version: %s\n", ver); + printf("Library API version: " LIBMOUNT_VERSION "\n"); + + if (mnt_get_library_version(NULL) == + mnt_parse_version_string(LIBMOUNT_VERSION)) + return 0; + + return -1; +} + +int main(int argc, char *argv[]) +{ + struct mtest ts[] = { + { "--print", test_version, "print versions" }, + { NULL } + }; + + return mnt_run_test(ts, argc, argv); +} +#endif -- cgit v1.2.3 From 7755ca95c943e8690a351c0580c2ad06950c057b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 27 Nov 2009 14:35:03 +0100 Subject: libblkid: add paths and tags cache Signed-off-by: Karel Zak --- shlibs/mount/src/Makefile.am | 5 +- shlibs/mount/src/cache.c | 533 +++++++++++++++++++++++++++++++++++++++++++ shlibs/mount/src/mount.h.in | 20 ++ shlibs/mount/src/mountP.h | 3 +- 4 files changed, 558 insertions(+), 3 deletions(-) create mode 100644 shlibs/mount/src/cache.c diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index f9cc68f9..59829631 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -11,7 +11,8 @@ nodist_mountinc_HEADERS = mount.h usrlib_exec_LTLIBRARIES = libmount.la libmount_la_SOURCES = $(mountinc_HEADERS) -nodist_libmount_la_SOURCES = mount.h version.c utils.c test.c init.c +nodist_libmount_la_SOURCES = mount.h version.c utils.c test.c init.c cache.c \ + $(top_srcdir)/lib/canonicalize.c libmount_la_LIBADD = $(ul_libblkid_la) @@ -20,7 +21,7 @@ libmount_la_DEPENDENCIES = $(libmount_la_LIBADD) mount.sym mount.h.in libmount_la_LDFLAGS = -Wl,--version-script=$(ul_libmount_srcdir)/mount.sym \ -version-info $(LIBMOUNT_VERSION_INFO) -tests = test_version +tests = test_version test_cache EXTRA_DIST = mount.sym mount.h.in CLEANFILES = $(tests) diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c new file mode 100644 index 00000000..7b9040ff --- /dev/null +++ b/shlibs/mount/src/cache.c @@ -0,0 +1,533 @@ +/* + * Copyright (C) 2009 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "canonicalize.h" +#include "mountP.h" + +/* + * Canonicalized (resolved) paths cache + */ +#define MNT_CACHE_CHUNKSZ 128 + +#define MNT_CACHE_ISTAG (1 << 1) /* entry is TAG */ +#define MNT_CACHE_ISPATH (1 << 2) /* entry is path */ +#define MNT_CACHE_TAGREAD (1 << 3) /* tag read by mnt_cache_read_tags() */ + +/* path cache entry */ +struct mnt_cache_entry { + char *native; /* the original path */ + char *real; /* canonicalized path */ + int flag; +}; + +struct _mnt_cache { + struct mnt_cache_entry *ents; + size_t nents; + size_t nallocs; + + /* blkid_evaluate_tag() works in two ways: + * + * 1/ all tags are evaluated by udev /dev/disk/by-* symlinks, + * then the blkid_cache is NULL. + * + * 2/ all tags are read from /etc/blkid.tab and verified by /dev + * scanning, then the blkid_cache is not NULL and then it's + * better to reuse the blkid_cache. + */ + blkid_cache bc; +}; + +/** + * mnt_new_cache: + * + * Returns new mnt_cache instance or NULL in case of ENOMEM error. + */ +mnt_cache *mnt_new_cache(void) +{ + return calloc(1, sizeof(struct _mnt_cache)); +} + +/** + * mnt_free_cache: + * @cache: pointer to mnt_cache instance + * + * Deallocates mnt_cache. + */ +void mnt_free_cache(mnt_cache *cache) +{ + int i; + + if (!cache) + return; + for (i = 0; i < cache->nents; i++) { + struct mnt_cache_entry *e = &cache->ents[i]; + if (e->real != e->native) + free(e->real); + free(e->native); + } + free(cache->ents); + if (cache->bc) + blkid_put_cache(cache->bc); + free(cache); +} + +/* note that the @native could be tha same pointer as @real */ +static int mnt_cache_add_entry(mnt_cache *cache, char *native, + char *real, int flag) +{ + struct mnt_cache_entry *e; + + assert(cache); + assert(real); + assert(native); + + if (cache->nents == cache->nallocs) { + size_t sz = cache->nallocs + MNT_CACHE_CHUNKSZ; + + e = realloc(cache->ents, sz * sizeof(struct mnt_cache_entry)); + if (!e) + return -1; + cache->ents = e; + cache->nallocs = sz; + } + + e = &cache->ents[cache->nents]; + e->native = native; + e->real = real; + e->flag = flag; + cache->nents++; + + DBG(DEBUG_CACHE, + printf("cache: [%zd entry] added %s\n", cache->nents, real)); + + return 0; +} + +/* add tag to the cache, @real has to be allocated string */ +static int mnt_cache_add_tag(mnt_cache *cache, const char *token, + const char *value, char *real, int flag) +{ + size_t tksz, vlsz; + char *native; + + assert(cache); + assert(real); + assert(token); + assert(value); + + /* add into cache -- cache format for TAGs is + * native = "NAME\0VALUE\0" + * real = "/dev/foo" + */ + tksz = strlen(token); + vlsz = strlen(value); + + native = malloc(tksz + vlsz + 2); + if (!native) + goto error; + + memcpy(native, token, tksz + 1); /* include '\0' */ + memcpy(native + tksz + 1, value, vlsz + 1); + + if (mnt_cache_add_entry(cache, native, real, flag)) + goto error; + return 0; +error: + free(native); + return -1; +} + + +/** + * mnt_cache_find_path: + * @cache: pointer to mnt_cache instance + * @path: requested "native" (non-canonicalized) path + * + * Returns cached canonicalized path or NULL. + */ +const char *mnt_cache_find_path(mnt_cache *cache, const char *path) +{ + int i; + + assert(cache); + assert(path); + + if (!cache || !path) + return NULL; + + for (i = 0; i < cache->nents; i++) { + struct mnt_cache_entry *e = &cache->ents[i]; + if (!(e->flag & MNT_CACHE_ISPATH)) + continue; + if (strcmp(path, e->native) == 0) + return e->real; + } + return NULL; +} + +/** + * mnt_cache_find_tag: + * @cache: pointer to mnt_cache instance + * @token: tag name + * @value: tag value + * + * Returns cached path or NULL. + */ +const char *mnt_cache_find_tag(mnt_cache *cache, + const char *token, const char *value) +{ + int i; + size_t tksz; + + assert(cache); + assert(token); + assert(value); + + if (!cache || !token || !value) + return NULL; + + tksz = strlen(token); + + for (i = 0; i < cache->nents; i++) { + struct mnt_cache_entry *e = &cache->ents[i]; + if (!(e->flag & MNT_CACHE_ISTAG)) + continue; + if (strcmp(token, e->native) == 0 && + strcmp(value, e->native + tksz + 1) == 0) + return e->real; + } + return NULL; +} + +/** + * mnt_cache_read_tags + * @cache: pointer to mnt_cache instance + * @devname: path device + * + * Reads @devname LABEL and UUID to the @cache. + * + * Returns: 1 if at least on tag was added, 0 no tag was added or + * -1 in case of error. + */ +int mnt_cache_read_tags(mnt_cache *cache, const char *devname) +{ + int i, ntags = 0; + int fd; + static blkid_probe pr; + const char *tags[] = { "LABEL", "UUID" }; + + assert(cache); + assert(devname); + + if (!cache || !devname) + return -1; + + /* check is device is already cached */ + for (i = 0; i < cache->nents; i++) { + struct mnt_cache_entry *e = &cache->ents[i]; + if (!(e->flag & MNT_CACHE_TAGREAD)) + continue; + if (strcmp(e->real, devname) == 0) + /* tags has been already read */ + return 0; + } + + DBG(DEBUG_CACHE, + printf("cache: reading tags for: %s\n", devname)); + + fd = mnt_open_device(devname, O_RDONLY); + if (fd < 0) + return -1; + pr = blkid_new_probe(); + if (!pr) + goto error; + if (blkid_probe_set_device(pr, fd, 0, 0)) + goto error; + + blkid_probe_enable_superblocks(pr, 1); + + blkid_probe_set_superblocks_flags(pr, + BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID); + + if (blkid_do_safeprobe(pr)) + goto error; + + for (i = 0; i < ARRAY_SIZE(tags); i++) { + const char *data; + char *dev; + + if (blkid_probe_lookup_value(pr, tags[i], &data, NULL)) + continue; + if (mnt_cache_find_tag(cache, tags[i], data)) + continue; /* already cached */ + + dev = strdup(devname); + if (!dev) + goto error; + if (mnt_cache_add_tag(cache, tags[i], data, dev, + (MNT_CACHE_ISTAG | MNT_CACHE_TAGREAD))) { + free(dev); + goto error; + } + ntags++; + } + + return ntags ? 1 : 0; +error: + blkid_free_probe(pr); + close(fd); + return -1; +} + +/** + * mnt_cache_device_has_tag: + * @cache: paths cache + * @devname: path to the device + * @token: tag name (e.g "LABEL") + * @value: tag value + * + * Look up @cache to check it @tag+@value are associated with @devname. + * + * Returns: 1 on success or 0. + */ +int mnt_cache_device_has_tag(mnt_cache *cache, const char *devname, + const char *token, const char *value) +{ + const char *path = mnt_cache_find_tag(cache, token, value); + + if (path && strcmp(path, devname) == 0) + return 1; + return 0; +} + +/** + * mnt_resolve_path: + * @path: "native" path + * @cache: cache for results or NULL + * + * Returns absolute path or NULL in case of error. The result has to be + * deallocated by free() if @cache is NULL. + */ +char *mnt_resolve_path(const char *path, mnt_cache *cache) +{ + char *p = NULL; + char *native = NULL; + char *real = NULL; + + assert(path); + + if (!path) + return NULL; + if (cache) + p = (char *) mnt_cache_find_path(cache, path); + + if (!p) { + p = canonicalize_path(path); + + if (p && cache) { + native = strdup(path); + real = strcmp(path, p) == 0 ? native : p; + + if (!native || !real) + goto error; + + if (mnt_cache_add_entry(cache, native, real, + MNT_CACHE_ISPATH)) + goto error; + } + } + + DBG(DEBUG_CACHE, printf("cache: %s --> %s\n", path, p)); + return p; +error: + if (real != native) + free(real); + free(native); + return NULL; +} + +/** + * mnt_resolve_tag: + * @token: tag name + * @value: tag value + * @cache: for results or NULL + * + * Returns device name or NULL in case of error. The result has to be + * deallocated by free() if @cache is NULL. + */ +char *mnt_resolve_tag(const char *token, const char *value, mnt_cache *cache) +{ + char *p = NULL; + + assert(token); + assert(value); + + if (!token || !value) + return NULL; + + if (cache) + p = (char *) mnt_cache_find_tag(cache, token, value); + + if (!p) { + /* returns newly allocated string */ + p = blkid_evaluate_tag(token, value, cache ? &cache->bc : NULL); + + if (p && cache && + mnt_cache_add_tag(cache, token, value, p, MNT_CACHE_ISTAG)) + goto error; + } + + DBG(DEBUG_CACHE, printf("cache: %s=%s --> %s\n", token, value, p)); + return p; +error: + free(p); + return NULL; +} + + + +/** + * mnt_resolve_spec: + * @spec: path or tag + * @cache: paths cache + * + * Returns canonicalized path or NULL. + */ +char *mnt_resolve_spec(const char *spec, mnt_cache *cache) +{ + char *cn = NULL; + + if (!spec) + return NULL; + + if (strchr(spec, '=')) { + char *tag, *val; + + if (!blkid_parse_tag_string(spec, &tag, &val)) { + cn = mnt_resolve_tag(tag, val, cache); + + free(tag); + free(val); + } + } else + cn = mnt_resolve_path(spec, cache); + + return cn; +} + + +#ifdef TEST_PROGRAM + +int test_resolve_path(struct mtest *ts, int argc, char *argv[]) +{ + char line[BUFSIZ]; + mnt_cache *cache; + + cache = mnt_new_cache(); + if (!cache) + return -1; + + while(fgets(line, sizeof(line), stdin)) { + size_t sz = strlen(line); + char *p; + + if (line[sz - 1] == '\n') + line[sz - 1] = '\0'; + + p = mnt_resolve_path(line, cache); + printf("%s : %s\n", line, p); + } + mnt_free_cache(cache); + return 0; +} + +int test_resolve_spec(struct mtest *ts, int argc, char *argv[]) +{ + char line[BUFSIZ]; + mnt_cache *cache; + + cache = mnt_new_cache(); + if (!cache) + return -1; + + while(fgets(line, sizeof(line), stdin)) { + size_t sz = strlen(line); + char *p; + + if (line[sz - 1] == '\n') + line[sz - 1] = '\0'; + + p = mnt_resolve_spec(line, cache); + printf("%s : %s\n", line, p); + } + mnt_free_cache(cache); + return 0; +} + +int test_read_tags(struct mtest *ts, int argc, char *argv[]) +{ + char line[BUFSIZ]; + mnt_cache *cache; + + cache = mnt_new_cache(); + if (!cache) + return -1; + + while(fgets(line, sizeof(line), stdin)) { + size_t sz = strlen(line); + + if (line[sz - 1] == '\n') + line[sz - 1] = '\0'; + + if (*line == '/') { + if (mnt_cache_read_tags(cache, line) < 0) + fprintf(stderr, "%s: read tags faild\n", line); + + } else if (strchr(line, '=')) { + char *tag, *val; + const char *cn = NULL; + + if (!blkid_parse_tag_string(line, &tag, &val)) { + cn = mnt_cache_find_tag(cache, tag, val); + + free(tag); + free(val); + } + if (cn) + printf("%s: %s\n", line, cn); + else + printf("%s: not cached\n", line); + } + } + mnt_free_cache(cache); + return 0; + +} + +int main(int argc, char *argv[]) +{ + struct mtest ts[] = { + { "--resolve-path", test_resolve_path, " resolve paths from stdin" }, + { "--resolve-spec", test_resolve_spec, " evaluate specs from stdin" }, + { "--read-tags", test_read_tags, " read devname or TAG stdin" }, + { NULL } + }; + + return mnt_run_test(ts, argc, argv); +} +#endif diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 6990e5ce..e0f95807 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -27,6 +27,13 @@ extern "C" { #define LIBMOUNT_VERSION "@LIBMOUNT_VERSION@" +/** + * mnt_cache + * + * Stores canonicalized paths and evaluated tags + */ +typedef struct _mnt_cache mnt_cache; + /* version.c */ extern int mnt_parse_version_string(const char *ver_string); extern int mnt_get_library_version(const char **ver_string); @@ -36,6 +43,19 @@ extern int mnt_fstype_is_netfs(const char *type); extern int mnt_fstype_is_pseudofs(const char *type); extern int mnt_open_device(const char *devname, int flags); +/* cache.c */ +extern mnt_cache *mnt_new_cache(void); +extern void mnt_free_cache(mnt_cache *cache); +extern const char *mnt_cache_find_path(mnt_cache *cache, const char *path); +extern const char *mnt_cache_find_tag(mnt_cache *cache, + const char *token, const char *value); +extern int mnt_cache_read_tags(mnt_cache *cache, const char *devname); +extern int mnt_cache_device_has_tag(mnt_cache *cache, const char *devname, + const char *token, const char *value); +extern char *mnt_resolve_path(const char *path, mnt_cache *cache); +extern char *mnt_resolve_tag(const char *token, const char *value, mnt_cache *cache); +extern char *mnt_resolve_spec(const char *spec, mnt_cache *cache); + #ifdef __cplusplus } #endif diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index 5ac3b6bc..21f3e67e 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -30,13 +30,14 @@ #endif #define DEBUG_INIT (1 << 1) +#define DEBUG_CACHE (1 << 2) #define DEBUG_ALL 0xFFFF #ifdef CONFIG_LIBMOUNT_DEBUG #include extern int libmount_debug_mask; extern void mnt_init_debug(int mask); -#define DBG(m,x) if ((m) & libmount_debug_mask) x; +#define DBG(m,x) if ((m) & libmount_debug_mask) x #else #define DBG(m,x) #define mnt_init_debug(x) -- cgit v1.2.3 From 9e272c68f51fa4e1fd0f6832bea9f82d6bceb007 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 4 Jan 2010 23:03:47 +0100 Subject: libmount: add mnt_optstr_* functions This set of functions allows to set/get/remove/append option in unparsed options string. Signed-off-by: Karel Zak --- shlibs/mount/src/Makefile.am | 3 +- shlibs/mount/src/mount.h.in | 11 ++ shlibs/mount/src/mountP.h | 1 + shlibs/mount/src/optstr.c | 416 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 430 insertions(+), 1 deletion(-) create mode 100644 shlibs/mount/src/optstr.c diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index 59829631..e9c7cc92 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -12,6 +12,7 @@ usrlib_exec_LTLIBRARIES = libmount.la libmount_la_SOURCES = $(mountinc_HEADERS) nodist_libmount_la_SOURCES = mount.h version.c utils.c test.c init.c cache.c \ + optstr.c \ $(top_srcdir)/lib/canonicalize.c libmount_la_LIBADD = $(ul_libblkid_la) @@ -21,7 +22,7 @@ libmount_la_DEPENDENCIES = $(libmount_la_LIBADD) mount.sym mount.h.in libmount_la_LDFLAGS = -Wl,--version-script=$(ul_libmount_srcdir)/mount.sym \ -version-info $(LIBMOUNT_VERSION_INFO) -tests = test_version test_cache +tests = test_version test_cache test_optstr EXTRA_DIST = mount.sym mount.h.in CLEANFILES = $(tests) diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index e0f95807..3426729b 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -56,6 +56,17 @@ extern char *mnt_resolve_path(const char *path, mnt_cache *cache); extern char *mnt_resolve_tag(const char *token, const char *value, mnt_cache *cache); extern char *mnt_resolve_spec(const char *spec, mnt_cache *cache); +/* optstr.c */ +extern int mnt_optstr_next_option(char **optstr, char **name, size_t *namesz, + char **value, size_t *valuesz); +extern int mnt_optstr_append_option(char **optstr, const char *name, + const char *value); +extern int mnt_optstr_get_option(char *optstr, const char *name, + char **value, size_t *valsz); +extern int mnt_optstr_set_option(char **optstr, const char *name, + const char *value); +extern int mnt_optstr_remove_option(char **optstr, const char *name); + #ifdef __cplusplus } #endif diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index 21f3e67e..74db2556 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -31,6 +31,7 @@ #define DEBUG_INIT (1 << 1) #define DEBUG_CACHE (1 << 2) +#define DEBUG_OPTIONS (1 << 3) #define DEBUG_ALL 0xFFFF #ifdef CONFIG_LIBMOUNT_DEBUG diff --git a/shlibs/mount/src/optstr.c b/shlibs/mount/src/optstr.c new file mode 100644 index 00000000..3e4eb482 --- /dev/null +++ b/shlibs/mount/src/optstr.c @@ -0,0 +1,416 @@ +/* + * Copyright (C) 2008-2009 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ + +#include +#include +#include +#include + +#include "nls.h" +#include "mountP.h" + +/* + * Parses the first option from @optstr. The @optstr pointer is set to begin of + * the next option. + * + * Returns -1 on parse error, 1 at the end of optstr and 0 on success. + */ +static int mnt_optstr_parse_next(char **optstr, char **name, size_t *namesz, + char **value, size_t *valsz) +{ + int open_quote = 0; + char *start = NULL, *stop = NULL, *p, *sep = NULL; + char *optstr0; + + assert(optstr); + assert(*optstr); + + optstr0 = *optstr; + + if (name) + *name = NULL; + if (namesz) + *namesz = 0; + if (value) + *value = NULL; + if (valsz) + *valsz = 0; + + for (p = optstr0; p && *p; p++) { + if (!start) + start = p; /* begin of the option item */ + if (*p == '"') + open_quote ^= 1; /* reverse the status */ + if (open_quote) + continue; /* still in quoted block */ + if (!sep && *p == '=') + sep = p; /* name and value separator */ + if (*p == ',') + stop = p; /* terminate the option item */ + else if (*(p + 1) == '\0') + stop = p + 1; /* end of optstr */ + if (!start || !stop) + continue; + if (stop <= start) + goto error; + + if (name) + *name = start; + if (namesz) + *namesz = sep ? sep - start : stop - start; + *optstr = *stop ? stop + 1 : stop; + + if (sep) { + if (value) + *value = sep + 1; + if (valsz) + *valsz = stop - sep - 1; + } + return 0; + } + + return 1; /* end of optstr */ + +error: + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: parse error: \"%s\"\n", optstr0)); + return -1; +} + +/* + * Locates the first option that match with @name. The @end is set to + * char behind the option (it means ',' or \0). + * + * Returns -1 on parse error, 1 when not found and 0 on success. + */ +static int mnt_optstr_locate_option(char *optstr, const char *name, char **begin, + char **end, char **value, size_t *valsz) +{ + char *n; + size_t namesz, nsz; + int rc; + + assert(name); + assert(optstr); + + namesz = strlen(name); + + do { + rc = mnt_optstr_parse_next(&optstr, &n, &nsz, value, valsz); + if (rc) + break; + + if (namesz == nsz && strncmp(n, name, nsz) == 0) { + if (begin) + *begin = n; + if (end) + *end = *(optstr - 1) == ',' ? + optstr - 1 : optstr; + return 0; + } + } while(1); + + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: can't found '%s' option\n", name)); + return rc; +} + +/** + * mnt_optstr_next_option: + * @optstr: option string, returns position to next option + * @name: returns option name + * @namesz: returns option name length + * @value: returns option value or NULL + * @valuesz: returns option value length or zero + * + * Parses the first option in @optstr or -1 in case of error. + * + * Returns 0 on success, 1 at the end of @optstr or -1 in case of error. + */ +int mnt_optstr_next_option(char **optstr, char **name, size_t *namesz, + char **value, size_t *valuesz) +{ + if (!optstr || !*optstr) + return -1; + return mnt_optstr_parse_next(optstr, name, namesz, value, valuesz); +} + +/** + * mnt_optstr_append_option: + * @optstr: option string or NULL + * @name: value name + * @value: value + * + * Returns: reallocated (or newly allocated) @optstr with ,name=value + */ +int mnt_optstr_append_option(char **optstr, const char *name, const char *value) +{ + char *p; + size_t sz, vsz, osz, nsz; + + if (!name) + return -1; + + osz = *optstr ? strlen(*optstr) : 0; + nsz = strlen(name); + vsz = value ? strlen(value) : 0; + + sz = osz + nsz + 1; /* 1: '\0' */ + if (osz) + sz++; /* ',' options separator */ + if (vsz) + sz += vsz + 1; /* 1: '=' */ + + p = realloc(*optstr, sz); + if (!p) + return -1; + *optstr = p; + + if (osz) { + p += osz; + *p++ = ','; + } + + memcpy(p, name, nsz); + p += nsz; + + if (vsz) { + *p++ = '='; + memcpy(p, value, vsz); + p += vsz; + } + *p = '\0'; + + return 0; +} + +/** + * mnt_optstr_get_option: + * @optstr: string with comma separated list of options + * @name: requested option name + * @value: returns pointer to the begin of the value (e.g. name=VALUE) or NULL + * @valsz: returns size of the value or 0 + * + * Returns: 0 on success, 1 when not found the @name or -1 in case of error. + */ +int mnt_optstr_get_option(char *optstr, const char *name, + char **value, size_t *valsz) +{ + return mnt_optstr_locate_option(optstr, name, NULL, NULL, value, valsz); +} + +/* Removes substring located between @begin and @end from @str + * -- result never starts or ends with comma or contains two commas + * (e.g. ",aaa,bbb" or "aaa,,bbb" or "aaa,") + */ +static void remove_substring(char *str, char *begin, char *end) +{ + size_t sz = strlen(end); + + if ((begin == str || *(begin - 1) == ',') && *end == ',') + end++; + + memmove(begin, end, sz + 1); + if (!*begin && *(begin - 1) == ',') + *(begin - 1) = '\0'; +} + +/* insert '=substr' to @str on position @pos */ +static int insert_substring(char **str, char *pos, const char *substr) +{ + char *p; + size_t ssz = strlen(substr); /* substring size */ + + p = realloc(*str, strlen(*str) + 1 + ssz); + if (!p) + return -1; + *str = p; + + memmove(pos + ssz + 1, pos, strlen(pos) + 1); + *pos++ = '='; + memcpy(pos, substr, ssz); + return 0; +} + +/** + * mnt_optstr_set_option: + * @optstr: string with comma separated list of options + * @name: requested option + * @value: new value or NULL + * + * Set or unset option @value. + * + * Returns: 0 on success, 1 when not found the @name or -1 in case of error. + */ +int mnt_optstr_set_option(char **optstr, const char *name, const char *value) +{ + char *val = NULL, *begin, *end, *nameend; + size_t valsz; + int rc = 1; + + if (!optstr) + return -1; + if (*optstr) + rc = mnt_optstr_locate_option(*optstr, name, + &begin, &end, &val, &valsz); + if (rc == -1) + /* parse error */ + return -1; + if (rc == 1) + /* not found */ + return mnt_optstr_append_option(optstr, name, value); + + nameend = begin + strlen(name); + + if (value == NULL && val && valsz) + /* remove unwanted "=value" */ + remove_substring(*optstr, nameend, end); + + else if (value && val == NULL) + /* insert "=value" */ + rc = insert_substring(optstr, nameend, value); + + else if (value && val && strlen(value) == valsz) + /* simply replace =value */ + memcpy(val, value, valsz); + + else if (value && val) { + remove_substring(*optstr, nameend, end); + rc = insert_substring(optstr, nameend, value); + } + + + return 0; +} + +/** + * mnt_optstr_remove_option: + * @optstr: string with comma separated list of options + * @name: requested option name + * + * Returns: 0 on success, 1 when not found the @name or -1 in case of error. + */ +int mnt_optstr_remove_option(char **optstr, const char *name) +{ + char *begin, *end; + int rc; + + rc = mnt_optstr_locate_option(*optstr, name, + &begin, &end, NULL, NULL); + if (rc != 0) + return rc; + + remove_substring(*optstr, begin, end); + return 0; +} + +#ifdef TEST_PROGRAM + +int test_append(struct mtest *ts, int argc, char *argv[]) +{ + const char *value = NULL, *name; + char *optstr; + + if (argc < 3) + goto done; + optstr = strdup(argv[1]); + name = argv[2]; + + if (argc == 4) + value = argv[3]; + + if (mnt_optstr_append_option(&optstr, name, value) == 0) { + printf("result: >%s<\n", optstr); + return 0; + } +done: + return -1; +} + +int test_set(struct mtest *ts, int argc, char *argv[]) +{ + const char *value = NULL, *name; + char *optstr; + + if (argc < 3) + goto done; + optstr = strdup(argv[1]); + name = argv[2]; + + if (argc == 4) + value = argv[3]; + + if (mnt_optstr_set_option(&optstr, name, value) == 0) { + printf("result: >%s<\n", optstr); + return 0; + } +done: + return -1; +} + +int test_get(struct mtest *ts, int argc, char *argv[]) +{ + char *optstr; + const char *name; + char *val = NULL; + size_t sz = 0; + int rc; + + if (argc < 2) + goto done; + optstr = argv[1]; + name = argv[2]; + + rc = mnt_optstr_get_option(optstr, name, &val, &sz); + if (rc == 0) { + printf("found; name: %s", name); + if (sz) { + printf(", argument: size=%zd data=", sz); + if (fwrite(val, 1, sz, stdout) != sz) + goto done; + } + printf("\n"); + return 0; + } else if (rc == 1) + printf("%s: not found\n", name); + else + printf("parse error: %s\n", optstr); +done: + return -1; +} + +int test_remove(struct mtest *ts, int argc, char *argv[]) +{ + const char *name; + char *optstr; + + if (argc < 3) + goto done; + optstr = strdup(argv[1]); + name = argv[2]; + + if (mnt_optstr_remove_option(&optstr, name) == 0) { + printf("result: >%s<\n", optstr); + return 0; + } +done: + return -1; +} + + +int main(int argc, char *argv[]) +{ + struct mtest tss[] = { + { "--append", test_append, " [] append value to optstr" }, + { "--set", test_set, " [] (un)set value" }, + { "--get", test_get, " search name in optstr" }, + { "--remove", test_remove, " remove name in optstr" }, + { NULL } + }; + return mnt_run_test(tss, argc, argv); +} +#endif /* TEST_PROGRAM */ -- cgit v1.2.3 From efab4b61572516f4c7579e345165e0094c1a2450 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 5 Jan 2010 14:58:16 +0100 Subject: libmount: add list routines and generic iterator Signed-off-by: Karel Zak --- shlibs/mount/src/Makefile.am | 2 +- shlibs/mount/src/iter.c | 54 +++++++++++++ shlibs/mount/src/list.h | 179 +++++++++++++++++++++++++++++++++++++++++++ shlibs/mount/src/mount.h.in | 18 +++++ shlibs/mount/src/mountP.h | 29 +++++++ 5 files changed, 281 insertions(+), 1 deletion(-) create mode 100644 shlibs/mount/src/iter.c create mode 100644 shlibs/mount/src/list.h diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index e9c7cc92..6f2b9502 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -12,7 +12,7 @@ usrlib_exec_LTLIBRARIES = libmount.la libmount_la_SOURCES = $(mountinc_HEADERS) nodist_libmount_la_SOURCES = mount.h version.c utils.c test.c init.c cache.c \ - optstr.c \ + optstr.c iter.c list.h \ $(top_srcdir)/lib/canonicalize.c libmount_la_LIBADD = $(ul_libblkid_la) diff --git a/shlibs/mount/src/iter.c b/shlibs/mount/src/iter.c new file mode 100644 index 00000000..d64f2d40 --- /dev/null +++ b/shlibs/mount/src/iter.c @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2009 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ +#include +#include +#include + +#include "mountP.h" + +/** + * mnt_new_iter: + * @direction: MNT_INTER_{FOR,BACK}WARD direction + * + * Returns newly allocated generic libmount iterator. + */ +mnt_iter *mnt_new_iter(int direction) +{ + mnt_iter *itr = calloc(1, sizeof(struct _mnt_iter)); + if (!itr) + return NULL; + itr->direction = direction; + return itr; +} + +/** + * mnt_free_iter: + * @itr: iterator pointer + * + * Deallocates iterator. + */ +void mnt_free_iter(mnt_iter *itr) +{ + free(itr); +} + +/** + * mnt_reset_iter: + * @itr: iterator pointer + * @direction: MNT_INTER_{FOR,BACK}WARD iterator direction + * + * Resets iterator. + */ +void mnt_reset_iter(mnt_iter *itr, int direction) +{ + assert(itr); + + if (itr) { + memset(itr, 0, sizeof(struct _mnt_iter)); + itr->direction = direction; + } +} diff --git a/shlibs/mount/src/list.h b/shlibs/mount/src/list.h new file mode 100644 index 00000000..9f8b88a2 --- /dev/null +++ b/shlibs/mount/src/list.h @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2008 Karel Zak + * Copyright (C) 1999-2008 by Theodore Ts'o + * + * (based on list.h from e2fsprogs) + */ + +#if !defined(_LIBMOUNT_LIST_H) && !defined(LIST_HEAD) +#define _LIBMOUNT_LIST_H + +/* TODO: use AC_C_INLINE */ +#ifdef __GNUC__ +#define _INLINE_ static __inline__ +#else /* For Watcom C */ +#define _INLINE_ static inline +#endif + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +_INLINE_ void __list_add(struct list_head * add, + struct list_head * prev, + struct list_head * next) +{ + next->prev = add; + add->next = next; + add->prev = prev; + prev->next = add; +} + +/** + * list_add - add a new entry + * @add: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +_INLINE_ void list_add(struct list_head *add, struct list_head *head) +{ + __list_add(add, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @add: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +_INLINE_ void list_add_tail(struct list_head *add, struct list_head *head) +{ + __list_add(add, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +_INLINE_ void __list_del(struct list_head * prev, + struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * + * list_empty() on @entry does not return true after this, @entry is + * in an undefined state. + */ +_INLINE_ void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +_INLINE_ void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +_INLINE_ int list_empty(struct list_head *head) +{ + return head->next == head; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +_INLINE_ void list_splice(struct list_head *list, struct list_head *head) +{ + struct list_head *first = list->next; + + if (first != list) { + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) + +/** + * list_for_each - iterate over elements in a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * list_for_each_safe - iterate over elements in a list, but don't dereference + * pos after the body is done (in case it is freed) + * @pos: the &struct list_head to use as a loop counter. + * @pnext: the &struct list_head to use as a pointer to the next item. + * @head: the head for your list (not included in iteration). + */ +#define list_for_each_safe(pos, pnext, head) \ + for (pos = (head)->next, pnext = pos->next; pos != (head); \ + pos = pnext, pnext = pos->next) + +#undef _INLINE_ + +#endif /* __LIBFSPROBE_LIST_H__ */ diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 3426729b..696c2940 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -34,6 +34,13 @@ extern "C" { */ typedef struct _mnt_cache mnt_cache; +/** + * mnt_iter + * + * Generic iterator (stores state about lists) + */ +typedef struct _mnt_iter mnt_iter; + /* version.c */ extern int mnt_parse_version_string(const char *ver_string); extern int mnt_get_library_version(const char **ver_string); @@ -67,6 +74,17 @@ extern int mnt_optstr_set_option(char **optstr, const char *name, const char *value); extern int mnt_optstr_remove_option(char **optstr, const char *name); + +/* iter.c */ +enum { + + MNT_ITER_FORWARD = 0, + MNT_ITER_BACKWARD +}; +extern mnt_iter *mnt_new_iter(int direction); +extern void mnt_free_iter(mnt_iter *mi); +extern void mnt_reset_iter(mnt_iter *mi, int direction); + #ifdef __cplusplus } #endif diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index 74db2556..ef3c1a66 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -11,7 +11,9 @@ #define _LIBMOUNT_PRIVATE_H #include + #include "mount.h" +#include "list.h" /* features */ #define CONFIG_CDROM_NOMEDIUM_RETRIES 5 @@ -69,4 +71,31 @@ extern char *strnchr(const char *s, size_t maxlen, int c); extern char *mnt_get_username(const uid_t uid); extern char *mnt_strconcat3(char *s, const char *t, const char *u); + +/* + * Generic iterator + */ +struct _mnt_iter { + struct list_head *p; /* current position */ + struct list_head *head; /* start position */ + int direction; /* MNT_ITER_{FOR,BACK}WARD */ +}; + +#define IS_ITER_FORWARD(_i) ((_i)->direction == MNT_ITER_FORWARD) +#define IS_ITER_BACKWARD(_i) ((_i)->direction == MNT_ITER_BACKWARD) + +#define MNT_ITER_INIT(itr, list) \ + do { \ + (itr)->p = IS_ITER_FORWARD(itr) ? \ + (list)->next : (list)->prev; \ + (itr)->head = (list); \ + } while(0) + +#define MNT_ITER_ITERATE(itr, res, restype, member) \ + do { \ + res = list_entry((itr)->p, restype, member); \ + (itr)->p = IS_ITER_FORWARD(itr) ? \ + (itr)->p->next : (itr)->p->prev; \ + } while(0) + #endif -- cgit v1.2.3 From 078edb2d6e4188963938b7be076db5382f6f802b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 11 Jan 2010 13:33:06 +0100 Subject: libmount: add optls (options container) Signed-off-by: Karel Zak --- shlibs/mount/src/Makefile.am | 4 +- shlibs/mount/src/mount.h.in | 200 ++++++++++- shlibs/mount/src/mountP.h | 53 ++- shlibs/mount/src/optent.c | 734 +++++++++++++++++++++++++++++++++++++++++ shlibs/mount/src/optls.c | 768 +++++++++++++++++++++++++++++++++++++++++++ shlibs/mount/src/optmap.c | 289 ++++++++++++++++ 6 files changed, 2042 insertions(+), 6 deletions(-) create mode 100644 shlibs/mount/src/optent.c create mode 100644 shlibs/mount/src/optls.c create mode 100644 shlibs/mount/src/optmap.c diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index 6f2b9502..8a265ecf 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -12,7 +12,7 @@ usrlib_exec_LTLIBRARIES = libmount.la libmount_la_SOURCES = $(mountinc_HEADERS) nodist_libmount_la_SOURCES = mount.h version.c utils.c test.c init.c cache.c \ - optstr.c iter.c list.h \ + optstr.c optmap.c optent.c optls.c iter.c list.h \ $(top_srcdir)/lib/canonicalize.c libmount_la_LIBADD = $(ul_libblkid_la) @@ -22,7 +22,7 @@ libmount_la_DEPENDENCIES = $(libmount_la_LIBADD) mount.sym mount.h.in libmount_la_LDFLAGS = -Wl,--version-script=$(ul_libmount_srcdir)/mount.sym \ -version-info $(LIBMOUNT_VERSION_INFO) -tests = test_version test_cache test_optstr +tests = test_version test_cache test_optstr test_optls EXTRA_DIST = mount.sym mount.h.in CLEANFILES = $(tests) diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 696c2940..ab644a23 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -25,22 +25,62 @@ extern "C" { #endif +#include + + #define LIBMOUNT_VERSION "@LIBMOUNT_VERSION@" /** - * mnt_cache + * mnt_cache: * * Stores canonicalized paths and evaluated tags */ typedef struct _mnt_cache mnt_cache; /** - * mnt_iter + * mnt_iter: * * Generic iterator (stores state about lists) */ typedef struct _mnt_iter mnt_iter; +/** + * mnt_optls: + * + * Mount options list (stores parsed mount options) + */ +typedef struct _mnt_optls mnt_optls; + +/** + * mnt_optent: + * + * Parsed mount option - "mnt_optls" entry + */ +typedef struct _mnt_optent mnt_optent; + +/** + * struct mnt_optmap: + * + * Mount options description (map) + * + * The libmount supports mount options with values in %: + * %s, %d, %u, %o, %x + */ +struct mnt_optmap +{ + const char *name; /* option name[=%] (e.g. "loop[=%s]") */ + int id; /* option ID or MS_* flags (e.g MS_RDONLY) */ + int mask; /* MNT_{MFLAG,MDATA,INVMASK,...} mask */ +}; + +/* + * mount options map masks + */ +#define MNT_MFLAG (1 << 1) /* use the mask as mount(2) flag */ +#define MNT_MDATA (1 << 2) /* use the option as mount(2) data */ +#define MNT_INVERT (1 << 3) /* invert the mountflag */ +#define MNT_NOMTAB (1 << 4) /* skip in the mtab option string */ + /* version.c */ extern int mnt_parse_version_string(const char *ver_string); extern int mnt_get_library_version(const char **ver_string); @@ -74,7 +114,6 @@ extern int mnt_optstr_set_option(char **optstr, const char *name, const char *value); extern int mnt_optstr_remove_option(char **optstr, const char *name); - /* iter.c */ enum { @@ -85,6 +124,161 @@ extern mnt_iter *mnt_new_iter(int direction); extern void mnt_free_iter(mnt_iter *mi); extern void mnt_reset_iter(mnt_iter *mi, int direction); +/* optmap.c */ +enum { + MNT_LINUX_MAP = 1, + MNT_USERSPACE_MAP +}; +extern const struct mnt_optmap *mnt_get_builtin_optmap(int id); + +/* optent.c */ +extern const struct mnt_optmap *mnt_optent_get_map(mnt_optent *op); +extern const struct mnt_optmap *mnt_optent_get_mapent(mnt_optent *op); +extern const char *mnt_optent_get_type(mnt_optent *op); +extern int mnt_optent_set_value(mnt_optent *op, const char *data); +extern int mnt_optent_has_value(mnt_optent *op); +extern int mnt_optent_require_value(mnt_optent *op); +extern int mnt_optent_is_inverted(mnt_optent *op); +extern int mnt_optent_strtoul_value(mnt_optent *op, unsigned long int *number); +extern int mnt_optent_strtol_value(mnt_optent *op, long int *number); +extern int mnt_optent_strtoull_value(mnt_optent *op, unsigned long long int *number); +extern const char *mnt_optent_get_value(mnt_optent *op); +extern int mnt_optent_strlen_value(mnt_optent *op); +extern int mnt_optent_snprintf_value(mnt_optent *op, char *str, size_t size); +extern char *mnt_optent_dup_value(mnt_optent *op); +extern const char *mnt_optent_get_name(mnt_optent *op); +extern int mnt_optent_get_mask(mnt_optent *op); +extern int mnt_optent_get_id(mnt_optent *op); +extern int mnt_optent_get_flag(mnt_optent *op, int *flags); +extern int mnt_optent_is_unknown(mnt_optent *op); +extern int mnt_optent_print_debug(mnt_optent *op, FILE *file); + +/* optls.c */ +extern mnt_optls *mnt_new_optls(void); +extern void mnt_free_optls(mnt_optls *ls); +extern int mnt_optls_add_map(mnt_optls *ls, const struct mnt_optmap *map); +extern int mnt_optls_add_builtin_map(mnt_optls *ls, int id); +extern mnt_optent *mnt_optls_add_option(mnt_optls *ls, + const char *name, const char *value); +extern int mnt_optls_parse_optstr(mnt_optls *ls, const char *optstr); +extern int mnt_optls_remove_option(mnt_optls *ls, const char *name); +extern int mnt_optls_remove_option_by_flags(mnt_optls *ls, + const struct mnt_optmap *map, const int flags); +extern int mnt_optls_remove_option_by_iflags(mnt_optls *ls, + const struct mnt_optmap *map, const int flags); +extern int mnt_optls_iterate_options(mnt_iter *itr, mnt_optls *ls, + const struct mnt_optmap *map, mnt_optent **option); +extern mnt_optent *mnt_optls_get_option(mnt_optls *ls, const char *name); +extern int mnt_optls_get_ids(mnt_optls *ls, const struct mnt_optmap *map); +extern int mnt_optls_create_mountflags(mnt_optls *ls); +extern char *mnt_optls_create_mountdata(mnt_optls *ls); +extern char *mnt_optls_create_mtab_optstr(mnt_optls *ls); +extern char *mnt_optls_create_userspace_optstr(mnt_optls *ls); +extern int mnt_optls_print_debug(mnt_optls *ls, FILE *file); + + +/* + * mount(8) userspace options masks (MNT_MAP_USERSPACE map) + */ +#define MNT_MS_DFLTS (1 << 1) +#define MNT_MS_NOAUTO (1 << 2) +#define MNT_MS_USER (1 << 3) +#define MNT_MS_USERS (1 << 4) +#define MNT_MS_OWNER (1 << 5) +#define MNT_MS_GROUP (1 << 6) +#define MNT_MS_NETDEV (1 << 7) +#define MNT_MS_COMMENT (1 << 8) +#define MNT_MS_LOOP (1 << 9) +#define MNT_MS_NOFAIL (1 << 10) + +/* + * mount(2) MS_* masks (MNT_MAP_LINUX map) + */ +#ifndef MS_RDONLY +#define MS_RDONLY 1 /* Mount read-only */ +#endif +#ifndef MS_NOSUID +#define MS_NOSUID 2 /* Ignore suid and sgid bits */ +#endif +#ifndef MS_NODEV +#define MS_NODEV 4 /* Disallow access to device special files */ +#endif +#ifndef MS_NOEXEC +#define MS_NOEXEC 8 /* Disallow program execution */ +#endif +#ifndef MS_SYNCHRONOUS +#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ +#endif +#ifndef MS_REMOUNT +#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ +#endif +#ifndef MS_MANDLOCK +#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ +#endif +#ifndef MS_DIRSYNC +#define MS_DIRSYNC 128 /* Directory modifications are synchronous */ +#endif +#ifndef MS_NOATIME +#define MS_NOATIME 0x400 /* 1024: Do not update access times. */ +#endif +#ifndef MS_NODIRATIME +#define MS_NODIRATIME 0x800 /* 2048: Don't update directory access times */ +#endif +#ifndef MS_BIND +#define MS_BIND 0x1000 /* 4096: Mount existing tree also elsewhere */ +#endif +#ifndef MS_MOVE +#define MS_MOVE 0x2000 /* 8192: Atomically move tree */ +#endif +#ifndef MS_REC +#define MS_REC 0x4000 /* 16384: Recursive loopback */ +#endif +#ifndef MS_VERBOSE +#define MS_VERBOSE 0x8000 /* 32768 */ +#endif +#ifndef MS_RELATIME +#define MS_RELATIME 0x200000 /* 200000: Update access times relative + to mtime/ctime */ +#endif +#ifndef MS_UNBINDABLE +#define MS_UNBINDABLE (1<<17) /* 131072 unbindable*/ +#endif +#ifndef MS_PRIVATE +#define MS_PRIVATE (1<<18) /* 262144 Private*/ +#endif +#ifndef MS_SLAVE +#define MS_SLAVE (1<<19) /* 524288 Slave*/ +#endif +#ifndef MS_SHARED +#define MS_SHARED (1<<20) /* 1048576 Shared*/ +#endif +#ifndef MS_I_VERSION +#define MS_I_VERSION (1<<23) /* update inode I_version field */ +#endif +#ifndef MS_STRICTATIME +#define MS_STRICTATIME (1<<24) /* strict atime semantics */ +#endif + +/* + * Magic mount flag number. Had to be or-ed to the flag values. + */ +#ifndef MS_MGC_VAL +#define MS_MGC_VAL 0xC0ED0000 /* magic flag number to indicate "new" flags */ +#endif +#ifndef MS_MGC_MSK +#define MS_MGC_MSK 0xffff0000 /* magic flag number mask */ +#endif + + +/* Shared-subtree options */ +#define MS_PROPAGATION (MS_SHARED|MS_SLAVE|MS_UNBINDABLE|MS_PRIVATE) + +/* Options that we make ordinary users have by default. */ +#define MS_SECURE (MS_NOEXEC|MS_NOSUID|MS_NODEV) + +/* Options that we make owner-mounted devices have by default */ +#define MS_OWNERSECURE (MS_NOSUID|MS_NODEV) + #ifdef __cplusplus } #endif diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index ef3c1a66..62a5eca9 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -98,4 +98,55 @@ struct _mnt_iter { (itr)->p->next : (itr)->p->prev; \ } while(0) -#endif + +/* + * mnt_optls entry + */ +struct _mnt_optent { + char *name; /* option name (allcocated when mapent is NULL) */ + char *value; /* option argument value */ + + int mask; /* MNT_{INVMASK,MDATA,MFLAG,NOMTAB,NOSYS} + * modifiable flags (initial value comes from map->mask) + */ + const struct mnt_optmap *mapent;/* the option description (msp entry) */ + const struct mnt_optmap *map; /* head of the map */ + + struct list_head opts; /* list of options */ +}; + +/* + * Container (list) for mount options + */ +struct _mnt_optls { + struct mnt_optmap const **maps; /* array with option maps */ + size_t nmaps; /* number of maps */ + + struct list_head opts; /* list of options */ +}; + +/* optmap.c */ +extern const struct mnt_optmap *mnt_optmap_get_entry(struct mnt_optmap const **maps, + int nmaps, const char *name, + size_t namelen, const struct mnt_optmap **mapent); +extern int mnt_optmap_enum_to_number(const struct mnt_optmap *mapent, + const char *rawdata, size_t len); +extern const char *mnt_optmap_get_type(const struct mnt_optmap *mapent); +extern int mnt_optmap_require_value(const struct mnt_optmap *mapent); + +/* optent.c */ + +/* private option masks -- see mount.h.in for the publick masks */ +#define MNT_HASVAL (1 << 10) + +extern mnt_optent *mnt_new_optent(const char *name, size_t namesz, + const char *value, size_t valsz, + struct mnt_optmap const **maps, int nmaps); +extern void mnt_free_optent(mnt_optent *op); +extern mnt_optent *mnt_new_optent_from_optstr(char **optstr, + struct mnt_optmap const **maps, int nmaps); +extern int mnt_optent_assign_map(mnt_optent *op, + struct mnt_optmap const **maps, int nmaps); + + +#endif /* _LIBMOUNT_PRIVATE_H */ diff --git a/shlibs/mount/src/optent.c b/shlibs/mount/src/optent.c new file mode 100644 index 00000000..4bb7db10 --- /dev/null +++ b/shlibs/mount/src/optent.c @@ -0,0 +1,734 @@ +/* + * Copyright (C) 2010 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ + +#include +#include +#include +#include + +#include "nls.h" +#include "mountP.h" + +static int mnt_init_optent(mnt_optent *op, const char *name, size_t namelen, + struct mnt_optmap const **maps, int nmaps); +static int __mnt_optent_set_value(mnt_optent *op, const char *data, size_t len); + + +/* + * Returns a new optent. + */ +mnt_optent *mnt_new_optent( const char *name, size_t namesz, + const char *value, size_t valsz, + struct mnt_optmap const **maps, int nmaps) +{ + mnt_optent *op; + + op = calloc(1, sizeof(struct _mnt_optent)); + if (!op) + return NULL; + + INIT_LIST_HEAD(&op->opts); + + if (mnt_init_optent(op, name, namesz, maps, nmaps)) + goto err; + + if (value) { + if (__mnt_optent_set_value(op, value, valsz)) + goto err; + } else if (mnt_optent_require_value(op)) + goto err; + + return op; +err: + free(op); + return NULL; +} + +/* + * Deallocates the optent. + */ +void mnt_free_optent(mnt_optent *op) +{ + if (!op) + return; + + if (!op->mapent || op->mapent->name != op->name) + free(op->name); + + free(op->value); + + if (!list_empty(&op->opts)) + list_del(&op->opts); + + free(op); +} + +/* + * initialize or reinitialize the option entry -- note that the option + * name is set to @name and the old name is not free()ed. If the @name + * is NULL the already existing option name is used. + */ +static int mnt_init_optent(mnt_optent *op, const char *name, size_t namelen, + struct mnt_optmap const **maps, int nmaps) +{ + const struct mnt_optmap *mapent = NULL, *map = NULL; + + assert(op); + + if (!op) + return -1; + + if (!name && op->name) { + name = op->name; + namelen = strlen(name); + } + if (!name) + return -1; + + if (nmaps && maps) + map = mnt_optmap_get_entry(maps, nmaps, name, namelen, &mapent); + + if (mapent == NULL || mnt_optmap_get_type(mapent) != NULL) { + /* we allocate the name for uknown options of for options with + * "=%" argument. This is not perfect... */ + if (op->name != name) + op->name = strndup(name, namelen); + } else + op->name = (char *) mapent->name; + + op->mapent = mapent; + op->map = map; + op->mask = mapent ? mapent->mask : 0; + if (op->value) + op->mask |= MNT_HASVAL; + + if (!op->name) + return -1; /* strdup() failed */ + + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: option %s: initialized\n", op->name)); + + return 0; +} + +static int mnt_optent_check_value(mnt_optent *op, const char *data, size_t len) +{ + const char *type; + char *end = NULL; + + assert(op); + if (!op) + return -1; + + type = mnt_optent_get_type(op); + if (!type) + goto err; /* value is unexpected */ + + if (!data) { + if (mnt_optent_require_value(op)) + goto err; + } else if (!strncmp(type, "%s", 2)) { + /* string type */ + ; + } else if (*type == '{') { + /* enum type */ + if (mnt_optmap_enum_to_number(op->mapent, data, len) < 0) + goto err; + } else { + /* numbers */ + int n; /* happy gcc */ + + errno = 0; + if (!strncmp(type, "%d", 2) || !strncmp(type, "%ld", 3)) + n = strtol(data, &end, 10); + else if (!strncmp(type, "%u", 2) || !strncmp(type, "%lu", 3)) + n = strtoul(data, &end, 10); + else if (!strncmp(type, "%lld", 4)) + n = strtoll(data, &end, 10); + else if (!strncmp(type, "%llu", 4)) + n = strtoull(data, &end, 10); + else if (!strncmp(type, "%o", 2)) + n = strtoul(data, &end, 8); + else if (!strncmp(type, "%x", 2)) + n = strtoul(data, &end, 16); + + if (errno == EINVAL || errno == ERANGE || end != data + len) + goto err; + } + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: option %s (type=%s): pass check\n", + op->name, type)); + return 0; +err: + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: option %s (type=%s): failed to check value %s\n", + op->name, type, data)); + return -1; +} + +/* + * Parses the first mount option from @optstr and move @optstr pointer + * to the next option. + * + * Returns: new optent (parsed option) or NULL in case of error. + */ +mnt_optent *mnt_new_optent_from_optstr(char **optstr, + struct mnt_optmap const **maps, int nmaps) +{ + char *name, *value; + size_t nsz, vsz; + + if (mnt_optstr_next_option(optstr, &name, &nsz, &value, &vsz) == 0) + return mnt_new_optent(name, nsz, value, vsz, maps, nmaps); + + return NULL; +} + +/* + * Lookups @maps and tries to found corresponding map entry for the @op option. + * If the map is found the option value is reverified. + * + * Returns 0 on success, 1 if map not found, -1 in case of error (revalidation + * failed or so). + */ +int mnt_optent_assign_map(mnt_optent *op, + struct mnt_optmap const **maps, int nmaps) +{ + char *oldval, *oldname = NULL; + const char *type; + + assert(op); + assert(op->name); + + if (!op || !op->name) + return -1; + + if (op->mapent && op->name != op->mapent->name) + oldname = op->name; /* old name is allocated */ + + op->map = op->mapent = NULL; + oldval = op->value; + + if (mnt_init_optent(op, NULL, 0, maps, nmaps)) + return -1; + + if (op->name != oldname) + free(oldname); + + if (!op->map) + return 1; /* uknown option, it's not error */ + + /* the new type */ + type = mnt_optent_get_type(op); + + if (type == NULL && oldval) + goto err; /* value is unexpected */ + if (mnt_optent_require_value(op) && !oldval) + goto err; /* value is required */ + if (oldval && mnt_optent_check_value(op, oldval, strlen(oldval)) != 0) + goto err; /* bad value */ + + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: option %s: assigned to \n", op->name)); + return 0; +err: + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: option %s: assign failed\n", op->name)); + return -1; +} + +/** + * mnt_optent_get_map: + * @op: pointer to mnt_optent instance + * + * Note that the @op has to be associated with any option map (see + * mnt_optent_assign_map()) or NULL is returned. + * + * Returns pointer to the head of the map that is associated with the option or + * NULL (for "extra options"). + */ +const struct mnt_optmap *mnt_optent_get_map(mnt_optent *op) +{ + assert(op); + return op ? op->map : NULL; +} + +/** + * mnt_optent_get_map_entry: + * @op: pointer to mnt_optent instance + * + * Note that the @op has to be associated with any option map (see + * mnt_optent_assign_map()) or NULL is returned. + + * Returns pointer to the map entry that describes the option or NULL (for + * "extra options"). + */ +const struct mnt_optmap *mnt_optent_get_mapent(mnt_optent *op) +{ + assert(op); + return op ? op->mapent : NULL; +} + +/** + * mnt_optent_get_type: + * @op: mnt_optent instance + * + * Note that the @op has to be associated with any option map (see + * mnt_optent_assign_map()) or the default "%s]" is returned. + * + * Returns pointer to the begin of type format string or NULL. For example: + * + * "%s" --> string, required argument (definition in the map is: "foo=%s") + * "%s]" --> string, optional argument (definition in the map is: "foo[=%s]") + */ +const char *mnt_optent_get_type(mnt_optent *op) +{ + assert(op); + if (!op) + return NULL; + return op->mapent ? mnt_optmap_get_type(op->mapent) : "%s]"; +} + + + +/** + * mnt_optent_set_value: + * @op: mnt_optent instance + * @data: option argument data or NULL + * + * The function unset (zeroize) the option value if the @data pointer is NULL. + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_optent_set_value(mnt_optent *op, const char *data) +{ + return __mnt_optent_set_value(op, data, data ? strlen(data) : 0); +} + +static int __mnt_optent_set_value(mnt_optent *op, const char *data, size_t len) +{ + assert(op); + if (!op) + return -1; + + free(op->value); + op->value = NULL; + op->mask &= ~MNT_HASVAL; + + if (mnt_optent_check_value(op, data, len) != 0) + goto err; + if (data) { + op->value = strndup(data, len); + if (!op->value) + goto err; + op->mask |= MNT_HASVAL; + } + + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: option %s: set argument value: %s\n", + op->name, op->value)); + return 0; +err: + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: option %s: set argument value failed\n", + op->name)); + return -1; + +} + +/** + * mnt_optent_has_value: + * @option: pointer to mnt_optent instance + * + * Returns 1 if the option has actually set an argument value, or 0. + */ +int mnt_optent_has_value(mnt_optent *op) +{ + return op && (op->mask & MNT_HASVAL) ? 1 : 0; +} + +/** + * mnt_optent_require_value: + * @op: pointer to mnt_optent instance + * + * Note that the @op has to be associated with any option map (see + * mnt_optent_assign_map()) or 0 is returned. + * + * Returns 1 if the option requires an argument (option=). + */ +int mnt_optent_require_value(mnt_optent *op) +{ + return op && op->mapent ? mnt_optmap_require_value(op->mapent) : 0; +} + +/** + * mnt_optent_is_inverted: + * @op: pointer to mnt_optent instance + * + * Returns 1 if the option has MNT_INVERT mask or 0. + */ +int mnt_optent_is_inverted(mnt_optent *op) +{ + return (op && (op->mask & MNT_INVERT)); +} + +static int get_number_base(const char *type) +{ + int base = 10; /* default */ + + if (!strncmp(type, "%o", 2)) + base = 8; + else if (!strncmp(type, "%x", 16)) + base = 16; + return base; +} + +/** + * mnt_optent_strtoul_value: + * @op: pointer to mnt_optent instance + * @number: resulting number + * + * Converts an option value to number. The strtoul() base (decimal, octan or + * hex) is determined from (%u, %o or %x) option format type -- default is + * decimal (for unknown options). + * + * The whole option value has to be possible to convert to the number + * (e.g "123ABC" returns -1). + * + * This function also converts {enum0,enumN} type to number 0..N. For more + * details see info about options maps. + * + * Returns 0 on success, -1 in case of error. + */ +int mnt_optent_strtoul_value(mnt_optent *op, unsigned long int *number) +{ + const char *type = NULL; + char *end; + size_t len; + + if (!mnt_optent_has_value(op) || !number) + goto err;; + type = mnt_optent_get_type(op); + if (!type) + goto err; + + if (*type == '{') { + int n; + + if (!op->mapent) + goto err; + n = mnt_optmap_enum_to_number(op->mapent, op->value, + strlen(op->value)); + if (n < 0) + goto err; + *number = n; + } else { + errno = 0; + *number = strtoul(op->value, &end, get_number_base(type)); + + if (errno == EINVAL || errno == ERANGE) + goto err; + len = strlen(op->value); + if (end != op->value + len) + goto err; + } + return 0; +err: + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: option %s (type=%s): strtoul failed\n", + op->name, type)); + return -1; +} + +/** + * mnt_optent_strtol_value: + * @op: pointer to mnt_optent instance + * @number: resulting number + * + * Converts an option value to number. The strtol() base (decimal, octan or + * hex) is determined from (%u, %o or %x) option format type -- default is + * decimal. + * + * The whole option value has to be possible to convert to the number + * (e.g "123ABC" returns -1). + * + * Returns 0 on success, -1 in case of error. + */ +int mnt_optent_strtol_value(mnt_optent *op, long int *number) +{ + const char *type; + char *end; + size_t len; + + if (!mnt_optent_has_value(op) || !number) + return -1; + + type = mnt_optent_get_type(op); + if (!type) + goto err; + + errno = 0; + *number = strtol(op->value, &end, get_number_base(type)); + + if (errno == EINVAL || errno == ERANGE) + goto err; + len = strlen(op->value); + if (end != op->value + len) + goto err; + + return 0; +err: + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: option %s (type=%s): strtol failed\n", + op->name, type)); + return -1; +} + +/** + * mnt_optent_strtoull_value: + * @op: pointer to mnt_optent instance + * @number: resulting number + * + * Converts an option value to number. The strtoull() base (decimal, octan or + * hex) is determined from (%u, %o or %x) option format type -- default is + * decimal. + * + * The whole option value has to be possible to convert to the number + * (e.g "123ABC" returns -1). + * + * Returns 0 on success, -1 in case of error. + */ +int mnt_optent_strtoull_value(mnt_optent *op, unsigned long long int *number) +{ + const char *type; + char *end; + size_t len; + + if (!mnt_optent_has_value(op) || !number) + return -1; + + type = mnt_optent_get_type(op); + if (!type) + goto err; + + errno = 0; + *number = strtoull(op->value, &end, get_number_base(type)); + + if (errno == EINVAL || errno == ERANGE) + goto err; + len = strlen(op->value); + if (end != op->value + len) + goto err; + return 0; +err: + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: option %s (type=%s): strtoull failed\n", + op->name, type)); + return -1; + +} + +/** + * mnt_optent_get_value: + * @op: pointer to mnt_optent instance + * @data: resulting string + * + * See also mnt_optent_has_value(). + * + * Returns pointer to value or NULL. + */ +const char *mnt_optent_get_value(mnt_optent *op) +{ + return op? op->value : NULL; +} + +/** + * mnt_optent_strlen_value: + * @op: pointer to mnt_optent instance + * + * Returns length of string that is necessary to print option value or -1 in + * case of error. + */ +int mnt_optent_strlen_value(mnt_optent *op) +{ + assert(op); + + if (!op) + return -1; + if (!mnt_optent_has_value(op)) + return 0; + return strlen(op->value); +} + +/** + * mnt_optent_snprintf_value: + * @op: pointer to mnt_optent instance + * @str: resulting string + * @size: size of string + * + * Returns number of printed characters or negative number in case of error. + */ +int mnt_optent_snprintf_value(mnt_optent *op, char *str, size_t size) +{ + assert(op); + assert(str); + + if (!op || !str || !size) + return -1; + if (!mnt_optent_has_value(op)) + return -1; + + /* TODO: use extra quotes for SELinux contexts */ + return snprintf(str, size, "%s", op->value); +} + +/** + * mnt_optent_dup_value: + * @op: pointer to mnt_optent instance + * + * Returns duplicate a option value. + */ +char *mnt_optent_dup_value(mnt_optent *op) +{ + assert(op); + + if (mnt_optent_has_value(op)) + return strdup(op->value); + return NULL; +} + +/** + * mnt_optent_get_name: + * @op: pointer to mnt_optent instance + * + * Returns option name or NULL in case of error. + */ +const char *mnt_optent_get_name(mnt_optent *op) +{ + assert(op); + return op ? op->name : NULL; +} + +/** + * mnt_optent_get_mask: + * @op: pointer to mnt_optent instance + * + * The initial value of the option mask is a copy from map->mask. + * Note that the mask is NOT a mountflag/ID. + * + * Returns option mask or 0. + */ +int mnt_optent_get_mask(mnt_optent *op) +{ + assert(op); + return op ? op->mask : 0; +} + +/** + * mnt_optent_get_id: + * @op: pointer to mnt_optent instance + * + * Note that the ID is also mountflag for all options with MNT_MFLAG mask. + * + * WARNING: the ID is usually shared between "option" (e.g. exec) and + * "nooption" (e.g. noexec) -- you have to carefully check for MNT_INVERT in + * the option mask. See mnt_optent_get_flag(). + * + * Returns option ID/mountflag or 0 for extra options (options with undefined + * options map). + */ +int mnt_optent_get_id(mnt_optent *op) +{ + assert(op); + return op && op->mapent ? op->mapent->id : 0; +} + +/** + * mnt_optent_get_flag: + * @op: pointer to mnt_optent instance + * @flags: resulting flags + * + * Adds option ID to @flags or removes option ID from @flags when the option + * is inverted option (e.g. "norelatime") + * + * Example: + * int flags = 0; + * + * while(mnt_iterate_options(&itr, opts, map, &op) == 0) + * mnt_optent_get_flag(op, &flags); + * + * if (flags & MS_RELATIME) + * printf("relatime is set\n"); + * + * Returns 0 on success, -1 in case of error. + */ +int mnt_optent_get_flag(mnt_optent *op, int *flags) +{ + int id; + + assert(op); + if (!op || !flags) + return -1; + + id = mnt_optent_get_id(op); + if (op->mask & MNT_INVERT) + *flags &= ~id; + else + *flags |= id; + return 0; +} + +/** + * mnt_optent_is_unknown: + * @op: pointer to mnt_optent instance + * + * The "extra option" is unknown option (undefined in any option map) + * + * Return 1 or 0. + */ +int mnt_optent_is_unknown(mnt_optent *op) +{ + assert(op); + return op && op->mapent ? 0 : 1; +} + +/** + * mnt_optent_print_debug: + * @file: output + * @op: pointer to mnt_optent instance + * + * Prints details about the option. + * + * Returns 0 on success, -1 in case of error. + */ +int mnt_optent_print_debug(mnt_optent *op, FILE *file) +{ + const struct mnt_optmap *map; + const char *type; + + if (!op) + return -1; + + fprintf(file, "------ option %p (%s):\n", op, mnt_optent_get_name(op)); + + fprintf(file, "\tID=0x%x\n", mnt_optent_get_id(op)); + fprintf(file, "\tMASK=%d\n", mnt_optent_get_mask(op)); + + map = mnt_optent_get_map(op); + fprintf(file, "\tMAP=%p\n", map ? map : NULL); + + map = mnt_optent_get_mapent(op); + fprintf(file, "\tMAPENT=%s\n", map ? map->name : NULL); + + fprintf(file, "\tHAS_VALUE=%s\n", + mnt_optent_has_value(op) ? "yes" : "not"); + + type = mnt_optent_get_type(op); + fprintf(file, "\tTYPE=%s\n", type ? : ""); + fprintf(file, "\tVALUE=%s\n", op->value); + return 0; +} diff --git a/shlibs/mount/src/optls.c b/shlibs/mount/src/optls.c new file mode 100644 index 00000000..4c1bea6e --- /dev/null +++ b/shlibs/mount/src/optls.c @@ -0,0 +1,768 @@ +/* + * Copyright (C) 2010 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ +#include +#include +#include +#include + +#include "nls.h" +#include "mountP.h" + +/** + * mnt_new_optls: + * + * Returns: newly allocated and initialized optls instance. The library + * uses this object as a container for mount options. + */ +mnt_optls *mnt_new_optls(void) +{ + mnt_optls *ls = calloc(1, sizeof(struct _mnt_optls)); + if (!ls) + return NULL; + INIT_LIST_HEAD(&ls->opts); + return ls; +} + +/** + * mnt_free_optls: + * @ls: pointer to mnt_optls instance. + * + * Deallocates mnt_optls and all stored options. + */ +void mnt_free_optls(mnt_optls *ls) +{ + if (!ls) + return; + while (!list_empty(&ls->opts)) { + mnt_optent *o = list_entry(ls->opts.next, mnt_optent, opts); + mnt_free_optent(o); + } + + free(ls->maps); + free(ls); +} + +/** + * mnt_optls_add_map: + * @ls: pointer to mnt_optls instance + * @map: pointer to the custom map + * + * Stores pointer to the custom options map (options description). The map has + * to be accessible all time when the libmount works with options. + * + * All already stored unknown mount options are reverified against the new map. + * Note, it's recommented to add all maps to the @optls container before options + * parsing. + * + * Example (add new options "foo" and "bar="): + * + * #define MY_MS_FOO (1 << 1) + * #define MY_MS_BAR (1 << 2) + * + * mnt_optmap myoptions[] = { + * { "foo", MY_MS_FOO, MNT_MFLAG }, + * { "nofoo", MY_MS_FOO, MNT_MFLAG | MNT_INVERT }, + * { "bar=%s",MY_MS_BAR, MNT_MDATA }, + * { NULL } + * }; + * + * mnt_optls_add_map(ls, myoptions); + * + * Returns: 0 on success, 1 on failed verification, or -1 in case of error. + */ +int mnt_optls_add_map(mnt_optls *ls, const struct mnt_optmap *map) +{ + mnt_optent *op; + mnt_iter itr; + + assert(ls); + assert(map || ls->maps == NULL); + + ls->maps = realloc(ls->maps, + sizeof(struct mnt_optmap *) * (ls->nmaps + 1)); + if (!ls->maps) + return -1; + + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: optls %p: add map[%zd]", ls, ls->nmaps)); + ls->maps[ls->nmaps] = map; + ls->nmaps++; + + mnt_reset_iter(&itr, MNT_ITER_FORWARD); + + while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) { + if (!mnt_optent_is_unknown(op)) + continue; + if (mnt_optent_assign_map(op, &map, 1) == -1) + return 1; + } + return 0; +} + +/** + * mnt_optls_add_builtin_map: + * @ls: pointer to mnt_optls instance + * @map_id: built-in map id (see mnt_get_builtin_map()) + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_optls_add_builtin_map(mnt_optls *ls, int id) +{ + const struct mnt_optmap *m = mnt_get_builtin_optmap(id); + + assert(ls); + assert(id); + + return m ? mnt_optls_add_map(ls, m) : -1; +} + + +/* + * Append the option to "ls" container. + */ +static void mnt_optls_add_optent(mnt_optls *ls, mnt_optent *op) +{ + assert(ls); + assert(op); + + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: opts %p: add option %s", + ls, mnt_optent_get_name(op))); + + list_add_tail(&op->opts, &ls->opts); +} + +/** + * mnt_optls_add_option: + * @ls: pointer to mnt_optls instance + * @name: option name + * @value: option value + * + * Returns: new option or NULL in case of error. + */ +mnt_optent *mnt_optls_add_option(mnt_optls *ls, + const char *name, const char *value) +{ + mnt_optent *op; + + if (!ls || !name) + return NULL; + + op = mnt_new_optent(name, strlen(name), + value, value ? strlen(value) : 0, + ls->maps, ls->nmaps); + if (op) + mnt_optls_add_optent(ls, op); + return op; +} + +/** + * mnt_optls_parse_optstr: + * @ls: pointer to mnt_optls instance. + * @optstr: zero terminated string with mount options (comma separaed list) + * + * Parses @optstr and all options from @optstr are added to @optls. It's + * possible to call this function more than once. The new options from @optstr + * will be appended to the container. +* + * The options are accessible by mnt_optls_iterate_options(). + * + * If the @optls container is associated with any options map(s), all new + * options are verified according to the descriptions from the map(s). + * + * For example: + * + * mnt_optls_parse_optstr(ls, "user=snake,noexec"); + * + * is same like: + * + * mnt_optls_add_option(ls, "user", "snake"); + * mnt_optls_add_option(ls, "noexec", NULL); + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_optls_parse_optstr(mnt_optls *ls, const char *optstr) +{ + char *p = (char *) optstr; + + assert(ls); + assert(optstr); + + if (!ls || !optstr) + return -1; + + while(p && *p) { + mnt_optent *op = mnt_new_optent_from_optstr(&p, + ls->maps, ls->nmaps); + if (!op) + return -1; + mnt_optls_add_optent(ls, op); + } + return 0; +} + +/** + * mnt_optls_remove_option: + * @ls: pointer to mnt_optls instance + * @name: option name + * + * Returns 0 on success, 1 if @name not found and -1 in case of error. + */ +int mnt_optls_remove_option(mnt_optls *ls, const char *name) +{ + struct list_head *p, *pnext; + + if (!ls || !name) + return -1; + + list_for_each_safe(p, pnext, &ls->opts) { + mnt_optent *op; + const char *n; + + if (!p) + break; + op = list_entry(p, mnt_optent, opts); + n = mnt_optent_get_name(op); + if (n && strcmp(name, n) == 0) { + mnt_free_optent(op); + return 0; + } + } + return 1; +} + + +/** + * mnt_optls_remove_option_by_flags: + * @ls: pointer to mnt_optls instance + * @map: pointer to the map with wanted options or NULL for all options + * @flags: option flags + * + * Removes options which match with @flags. The set of options could + * be restricted by @map. For exmaple: + * + * mnt_optls_remove_option_by_flags(ls, NULL, MS_NOEXEC); + * + * removes "noexec" option from "ls". + * + * Note that this function is useles for options with MNT_INVERT mask (e.g. + * "exec" is inverting MS_NOEXEC flag). + * + * See also mnt_optent_get_flag() and mnt_optls_remove_option_by_iflags(). + * + * Returns number of removed options or -1 in case of error. + */ +int mnt_optls_remove_option_by_flags(mnt_optls *ls, + const struct mnt_optmap *map, const int flags) +{ + struct list_head *p, *pnext; + int ct = 0; + + if (!ls) + return -1; + + list_for_each_safe(p, pnext, &ls->opts) { + mnt_optent *op; + int fl = 0; + + if (!p) + break; + op = list_entry(p, mnt_optent, opts); + + if (!map || mnt_optent_get_map(op) == map) { + mnt_optent_get_flag(op, &fl); + if (fl & flags) { + mnt_free_optent(op); + ct++; + } + } + } + return ct; +} + +/** + * mnt_optls_remove_option_by_iflags: + * @ls: pointer to mnt_optls instance + * @map: pointer to the map with wanted options or NULL for all options + * @flags: option flags + * + * Removes options which inverting any id from @flags. The set of options could + * be restricted by @map. For exmaple: + * + * mnt_optls_remove_option_by_iflags(ls, NULL, MS_NOEXEC); + * + * removes "exec" option from "ls". + * + * Note that this function is useles for options without MNT_INVERT mask (e.g. + * "noexec"). + * + * See also mnt_optent_get_flag() and mnt_optls_remove_option_by_flags(). + * + * Returns number of removed options or -1 in case of error. + */ +int mnt_optls_remove_option_by_iflags(mnt_optls *ls, + const struct mnt_optmap *map, const int flags) +{ + struct list_head *p, *pnext; + int ct = 0; + + if (!ls) + return -1; + + list_for_each_safe(p, pnext, &ls->opts) { + mnt_optent *op; + int fl = flags; + + if (!p) + break; + op = list_entry(p, mnt_optent, opts); + + if (!map || mnt_optent_get_map(op) == map) { + int id = mnt_optent_get_id(op); + + if (!(id & fl)) + continue; + + mnt_optent_get_flag(op, &fl); + + if (!(id & fl)) { + mnt_free_optent(op); + ct++; + } + } + } + return ct; +} + +/** + * mnt_optls_iterate_options: + * @ls: pointer to mnt_optls instance + * @map: pointer to the map of wanted options or NULL for all options + * @option: returns pointer to the option object + * + * Example (print all options): + * + * mnt_optent *option; + * mnt_optls *ls = mnt_optls_new(); + * + * mnt_optls_parse_optstr(ls, "noexec,nodev"); + * + * while(mnt_optls_iterate_options(itr, ls, NULL, &option )) + * printf("%s\n", mnt_optent_get_name(option))); + * + * Returns 0 on succes, -1 in case of error or 1 at end of list. + */ +int mnt_optls_iterate_options(mnt_iter *itr, mnt_optls *ls, + const struct mnt_optmap *map, mnt_optent **option) +{ + assert(itr); + assert(ls); + assert(option); + + if (!itr || !ls || !option) + return -1; + if (!itr->head) + MNT_ITER_INIT(itr, &ls->opts); + while (itr->p != itr->head) { + MNT_ITER_ITERATE(itr, *option, struct _mnt_optent, opts); + if (map == NULL || (*option)->map == map) + return 0; + } + + return 1; +} + +/** + * mnt_optls_get_option: + * @ls: pointer to mnt_optls instance + * @name: options name + * + * Returns the option or NULL. + */ +mnt_optent *mnt_optls_get_option(mnt_optls *ls, const char *name) +{ + mnt_optent *op; + mnt_iter itr; + + assert(ls); + assert(name); + + if (!ls || !name) + return NULL; + mnt_reset_iter(&itr, MNT_ITER_FORWARD); + + while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) { + const char *n = mnt_optent_get_name(op); + + if (n && !strcmp(n, name)) + return op; + } + return NULL; +} + +/** + * mnt_optls_get_ids: + * @ls: pointer to mnt_optls instance + * @map: pointer to the map of wanted options or NULL for all options + * + * Note that ID has to be unique in all maps when the @map is NULL. + * + * Note also that this function works with ALL options -- see also + * mnt_optls_create_mountflags() that returns MNT_MFLAG options + * (mount(2) flags) only. + * + * Return IDs from all options. + */ +int mnt_optls_get_ids(mnt_optls *ls, const struct mnt_optmap *map) +{ + int flags = 0; + mnt_iter itr; + mnt_optent *op; + + assert(ls); + if (!ls) + return 0; + mnt_reset_iter(&itr, MNT_ITER_FORWARD); + + while(mnt_optls_iterate_options(&itr, ls, map, &op) == 0) + mnt_optent_get_flag(op, &flags); + + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: opts %p: generated IDs 0x%08x", ls, flags)); + return flags; +} + +/** + * mnt_optls_create_mountflags: + * @ls: pointer to mnt_optls instance + * + * The mountflags are IDs from all MNT_MFLAG options. See "struct mnt_optmap". + * For more details about mountflags see mount(2) syscall. + * + * Returns mount flags or 0. + */ +int mnt_optls_create_mountflags(mnt_optls *ls) +{ + int flags = 0; + mnt_iter itr; + mnt_optent *op; + + assert(ls); + if (!ls) + return 0; + mnt_reset_iter(&itr, MNT_ITER_FORWARD); + + while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) { + if (!(op->mask & MNT_MFLAG)) + continue; + mnt_optent_get_flag(op, &flags); + } + + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: opts %p: generated mountflags 0x%08x", ls, flags)); + return flags; +} + +/** + * mnt_optls_create_mountdata: + * @ls: pointer to mnt_optls instance + * + * For more details about mountdata see mount(2) syscall. + * + * Returns newly allocated string with mount options or NULL in case of error. + */ +char *mnt_optls_create_mountdata(mnt_optls *ls) +{ + mnt_iter itr; + mnt_optent *op; + char *optstr = NULL; + + assert(ls); + if (!ls) + return NULL; + mnt_reset_iter(&itr, MNT_ITER_FORWARD); + + while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) { + if (!(op->mask & MNT_MDATA) && !mnt_optent_is_unknown(op)) + continue; + if (mnt_optstr_append_option(&optstr, + mnt_optent_get_name(op), + mnt_optent_get_value(op))) + goto err; + } + + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: opts %p: generated mountdata: %s", ls, optstr)); + return optstr; +err: + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: ls %p: generate mountdata failed", ls)); + free(optstr); + return NULL; +} + +/** + * mnt_optls_create_mtab_optstr: + * @ls: pointer to mnt_optls instance + * + * Returns newly allocated string with mount options for mtab. + */ +char *mnt_optls_create_mtab_optstr(mnt_optls *ls) +{ + mnt_iter itr; + mnt_optent *op; + char *optstr = NULL; + + assert(ls); + if (!ls) + return NULL; + + mnt_reset_iter(&itr, MNT_ITER_FORWARD); + + while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) { + if (op->mask & MNT_NOMTAB) + continue; + if (mnt_optstr_append_option(&optstr, + mnt_optent_get_name(op), + mnt_optent_get_value(op))) + goto err; + } + + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: opts %p: generated mtab options: %s", ls, optstr)); + return optstr; +err: + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: opts %p: generate mtab optstr failed", ls)); + free(optstr); + return NULL; +} + +/** + * mnt_optls_create_userspace_optstr: + * @ls: pointer to mnt_optls instance + * + * Returns newly allocated string with mount options that are + * userspace specific (e.g. uhelper=). + */ +char *mnt_optls_create_userspace_optstr(mnt_optls *ls) +{ + mnt_iter itr; + mnt_optent *op; + char *optstr = NULL; + + assert(ls); + if (!ls) + return NULL; + mnt_reset_iter(&itr, MNT_ITER_FORWARD); + + while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) { + if (mnt_optent_is_unknown(op)) + continue; + if (op->mask & (MNT_MDATA | MNT_MFLAG | MNT_NOMTAB)) + continue; + if (mnt_optstr_append_option(&optstr, + mnt_optent_get_name(op), + mnt_optent_get_value(op))) + goto err; + } + + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: opts %p: generated userspace-only options: %s", + ls, optstr)); + return optstr; +err: + DBG(DEBUG_OPTIONS, fprintf(stderr, + "libmount: opts %p: generate userspace optstr failed", ls)); + free(optstr); + return NULL; +} + +/** + * mnt_optls_print_debug: + * @file: output + * @ls: pointer to mnt_optls instance + * + * Prints details about options container. + */ +int mnt_optls_print_debug(mnt_optls *ls, FILE *file) +{ + mnt_iter itr; + mnt_optent *op; + + if (!ls) + return -1; + mnt_reset_iter(&itr, MNT_ITER_FORWARD); + + fprintf(file, "--- opts: %p\n", ls); + while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) + mnt_optent_print_debug(op, file); + + return 0; +} + +#ifdef TEST_PROGRAM +mnt_optls *mk_optls(const char *optstr) +{ + mnt_optls *ls = mnt_new_optls(); + if (!ls) + goto err; + + mnt_optls_add_builtin_map(ls, MNT_LINUX_MAP); + mnt_optls_add_builtin_map(ls, MNT_USERSPACE_MAP); + + if (mnt_optls_parse_optstr(ls, optstr) != 0) { + fprintf(stderr, "\tfailed to parse: %s\n", optstr); + goto err; + } + return ls; +err: + mnt_free_optls(ls); + return NULL; +} + +int test_parse(struct mtest *ts, int argc, char *argv[]) +{ + mnt_optls *ls = NULL; + int rc = -1; + + if (argc < 1) + goto done; + ls = mk_optls(argv[1]); + if (!ls) + goto done; + + mnt_optls_print_debug(ls, stdout); + rc = 0; +done: + mnt_free_optls(ls); + return rc; +} + +int test_flags(struct mtest *ts, int argc, char *argv[]) +{ + mnt_optls *ls = NULL; + int rc = -1; + int flags; + const struct mnt_optmap *map; + + if (argc < 1) + goto done; + ls = mk_optls(argv[1]); + if (!ls) + goto done; + + flags = mnt_optls_create_mountflags(ls); + printf("\tmount(2) flags: 0x%08x\n", flags); + + map = mnt_get_builtin_optmap(MNT_LINUX_MAP); + flags = mnt_optls_get_ids(ls, map); + printf("\tMNT_MAP_LINUX IDs: 0x%08x (map %p)\n", flags, map); + + map = mnt_get_builtin_optmap(MNT_USERSPACE_MAP); + flags = mnt_optls_get_ids(ls, map); + printf("\tMNT_USERSPACE_MAP IDs: 0x%08x (map %p)\n", flags, map); + + rc = 0; +done: + mnt_free_optls(ls); + return rc; +} + +int test_data(struct mtest *ts, int argc, char *argv[]) +{ + mnt_optls *ls = NULL; + char *optstr; + int rc = -1; + + if (argc < 1) + goto done; + ls = mk_optls(argv[1]); + if (!ls) + goto done; + + optstr = mnt_optls_create_mountdata(ls); + printf("\tmount(2) data: '%s'\n", optstr); + free(optstr); + rc = 0; +done: + mnt_free_optls(ls); + return rc; +} + +int test_mtabstr(struct mtest *ts, int argc, char *argv[]) +{ + mnt_optls *ls = NULL; + char *optstr; + int rc = -1; + + if (argc < 1) + goto done; + ls = mk_optls(argv[1]); + if (!ls) + goto done; + + optstr = mnt_optls_create_mtab_optstr(ls); + printf("\tmtab options: '%s'\n", optstr); + free(optstr); + rc = 0; +done: + mnt_free_optls(ls); + return rc; +} + +int test_reparse(struct mtest *ts, int argc, char *argv[]) +{ + const struct mnt_optmap *map; + mnt_optls *ls = NULL; + char *optstr; + int rc = -1; + + if (argc < 1) + goto done; + optstr = argv[1]; + ls = mnt_new_optls(); + if (!ls) + goto done; + + /* add description for kernel options */ + mnt_optls_add_builtin_map(ls, MNT_LINUX_MAP); + + if (mnt_optls_parse_optstr(ls, optstr) != 0) { + fprintf(stderr, "\tfailed to parse: %s\n", optstr); + goto done; + } + + fprintf(stdout, "------ parse\n"); + mnt_optls_print_debug(ls, stdout); + + /* add description for userspace options */ + map = mnt_get_builtin_optmap(MNT_USERSPACE_MAP); + mnt_optls_add_map(ls, map); + + fprintf(stdout, "------ re-parse\n"); + mnt_optls_print_debug(ls, stdout); + + rc = 0; +done: + mnt_free_optls(ls); + return rc; +} + +int main(int argc, char *argv[]) +{ + struct mtest tss[] = { + { "--parse", test_parse, " parse mount options string" }, + { "--ls-data", test_data, " parse and generate mountdata" }, + { "--ls-flags", test_flags, " parse and generate mountflags" }, + { "--ls-mtabstr",test_mtabstr," parse and generate mtab options" }, + { "--reparse", test_reparse, " test extra options reparsing" }, + { NULL } + }; + return mnt_run_test(tss, argc, argv); +} +#endif /* TEST_PROGRAM */ diff --git a/shlibs/mount/src/optmap.c b/shlibs/mount/src/optmap.c new file mode 100644 index 00000000..873c545c --- /dev/null +++ b/shlibs/mount/src/optmap.c @@ -0,0 +1,289 @@ +/* + * Copyright (C) 2010 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + * + * Option-maps + * ----------- + * The mount(2) linux syscall uses two arguments for mount options: + * + * 1) mountflags (see MS_* macros in linux/fs.h) + * 2) mountdata (usully a comma separated string of options) + * + * The libmount uses options-map(s) to describe mount options. The number of + * maps is unlimited. The libmount options parser could be easily extended + * (e.g. by mnt_optls_add_map()) to work with new options. + * + * The option description (map entry) includes: + * + * - option name and argument type (e.g. "loop[=%s]") + * - option ID (in the map unique identifier or a mountflags, e.g MS_RDONLY) + * - mask (MNT_INVERT, MNT_MDATA, MNT_MFLAG, MNT_NOMTAB) + * + * The option argument type is defined by: + * + * "=" -- required argument + * "[=]" -- optional argument + * + * where the is sscanf() format string or + * + * {item0,item1,...} -- enum (mnt_option_get_number() converts the value + * to 0..N number) + * + * The options argument format is used for parsing only. The library internally + * stores the option argument as a string. The conversion to the data type is + * on-demant by mnt_option_get_value_*() functions. + * + * The library checks options argument according to format for simple + * formats only: + * + * %s, %d, %ld, %lld, %u, %lu, %llu, %x, %o and {enum} + * + * The libmount defines two basic built-in options maps: + * + * - MNT_LINUX_MAP -- fs-independent kernel mount options (usually MS_* flags) + * - MNT_USERSPACE_MAP -- userspace specific mount options (e.g. "user", "loop") + * + */ +#include +#include +#include +#include + +#include "nls.h" +#include "mountP.h" + +/* + * fs-independent mount flags (built-in MNT_LINUX_MAP) + */ +static const struct mnt_optmap linux_flags_map[] = +{ + { "ro", MS_RDONLY, MNT_MFLAG }, /* read-only */ + { "rw", MS_RDONLY, MNT_MFLAG | MNT_INVERT }, /* read-write */ + { "exec", MS_NOEXEC, MNT_MFLAG | MNT_INVERT }, /* permit execution of binaries */ + { "noexec", MS_NOEXEC, MNT_MFLAG }, /* don't execute binaries */ + { "suid", MS_NOSUID, MNT_MFLAG | MNT_INVERT }, /* honor suid executables */ + { "nosuid", MS_NOSUID, MNT_MFLAG }, /* don't honor suid executables */ + { "dev", MS_NODEV, MNT_MFLAG | MNT_INVERT }, /* interpret device files */ + { "nodev", MS_NODEV, MNT_MFLAG }, /* don't interpret devices */ + + { "sync", MS_SYNCHRONOUS, MNT_MFLAG }, /* synchronous I/O */ + { "async", MS_SYNCHRONOUS, MNT_MFLAG | MNT_INVERT }, /* asynchronous I/O */ + + { "dirsync", MS_DIRSYNC, MNT_MFLAG }, /* synchronous directory modifications */ + { "remount", MS_REMOUNT, MNT_MFLAG }, /* Alter flags of mounted FS */ + { "bind", MS_BIND, MNT_MFLAG }, /* Remount part of tree elsewhere */ + { "rbind", MS_BIND|MS_REC, MNT_MFLAG }, /* Idem, plus mounted subtrees */ +#ifdef MS_NOSUB + { "sub", MS_NOSUB, MNT_MFLAG | MNT_INVERT }, /* allow submounts */ + { "nosub", MS_NOSUB, MNT_MFLAG }, /* don't allow submounts */ +#endif +#ifdef MS_SILENT + { "quiet", MS_SILENT, MNT_MFLAG }, /* be quiet */ + { "loud", MS_SILENT, MNT_MFLAG | MNT_INVERT }, /* print out messages. */ +#endif +#ifdef MS_MANDLOCK + { "mand", MS_MANDLOCK, MNT_MFLAG }, /* Allow mandatory locks on this FS */ + { "nomand", MS_MANDLOCK, MNT_MFLAG | MNT_INVERT },/* Forbid mandatory locks on this FS */ +#endif +#ifdef MS_NOATIME + { "atime", MS_NOATIME, MNT_MFLAG | MNT_INVERT }, /* Update access time */ + { "noatime", MS_NOATIME, MNT_MFLAG }, /* Do not update access time */ +#endif +#ifdef MS_I_VERSION + { "iversion", MS_I_VERSION, MNT_MFLAG }, /* Update inode I_version time */ + { "noiversion", MS_I_VERSION, MNT_MFLAG | MNT_INVERT}, /* Don't update inode I_version time */ +#endif +#ifdef MS_NODIRATIME + { "diratime", MS_NODIRATIME, MNT_MFLAG | MNT_INVERT }, /* Update dir access times */ + { "nodiratime", MS_NODIRATIME, MNT_MFLAG }, /* Do not update dir access times */ +#endif +#ifdef MS_RELATIME + { "relatime", MS_RELATIME, MNT_MFLAG }, /* Update access times relative to mtime/ctime */ + { "norelatime", MS_RELATIME, MNT_MFLAG | MNT_INVERT }, /* Update access time without regard to mtime/ctime */ +#endif +#ifdef MS_STRICTATIME + { "strictatime", MS_STRICTATIME, MNT_MFLAG }, /* Strict atime semantics */ + { "nostrictatime", MS_STRICTATIME, MNT_MFLAG | MNT_INVERT }, /* kernel default atime */ +#endif + { NULL, 0, 0 } +}; + +/* + * userspace mount option (built-in MNT_USERSPACE_MAP) + */ +static const struct mnt_optmap userspace_opts_map[] = +{ + { "defaults", MNT_MS_DFLTS, MNT_NOMTAB }, /* default options */ + + { "auto", MNT_MS_NOAUTO, MNT_INVERT | MNT_NOMTAB }, /* Can be mounted using -a */ + { "noauto", MNT_MS_NOAUTO, MNT_NOMTAB }, /* Can only be mounted explicitly */ + + { "user[=%s]", MNT_MS_USER }, /* Allow ordinary user to mount (mtab) */ + { "nouser", MNT_MS_USER, MNT_INVERT | MNT_NOMTAB }, /* Forbid ordinary user to mount */ + + { "users", MNT_MS_USERS, MNT_NOMTAB }, /* Allow ordinary users to mount */ + { "nousers", MNT_MS_USERS, MNT_INVERT | MNT_NOMTAB }, /* Forbid ordinary users to mount */ + + { "owner", MNT_MS_OWNER, MNT_NOMTAB }, /* Let the owner of the device mount */ + { "noowner", MNT_MS_OWNER, MNT_INVERT | MNT_NOMTAB }, /* Device owner has no special privs */ + + { "group", MNT_MS_GROUP, MNT_NOMTAB }, /* Let the group of the device mount */ + { "nogroup", MNT_MS_GROUP, MNT_INVERT | MNT_NOMTAB }, /* Device group has no special privs */ + + { "_netdev", MNT_MS_NETDEV }, /* Device requires network */ + + { "comment=%s", MNT_MS_COMMENT, MNT_NOMTAB }, /* fstab comment only */ + + { "loop[=%s]", MNT_MS_LOOP }, /* use the loop device */ + + { "nofail", MNT_MS_NOFAIL, MNT_NOMTAB }, /* Do not fail if ENOENT on dev */ + + { NULL, 0, 0 } +}; + +/** + * mnt_get_builtin_map: + * @id: map id -- MNT_LINUX_MAP or MNT_USERSPACE_MAP + * + * MNT_LINUX_MAP - Linux kernel fs-independent mount options + * (usually MS_* flags, see linux/fs.h) + * + * MNT_USERSPACE_MAP - userpace mount(8) specific mount options + * (e.g user=, _netdev, ...) + * + * Returns internal (static) libmount map. + */ +const struct mnt_optmap *mnt_get_builtin_optmap(int id) +{ + assert(id); + + if (id == MNT_LINUX_MAP) + return linux_flags_map; + else if (id == MNT_USERSPACE_MAP) + return userspace_opts_map; + return NULL; +} + +/* + * Lookups for the @name in @maps and returns a map and in @mapent + * returns the map entry + */ +const struct mnt_optmap *mnt_optmap_get_entry( + struct mnt_optmap const **maps, + int nmaps, + const char *name, + size_t namelen, + const struct mnt_optmap **mapent) +{ + int i; + + assert(maps); + assert(nmaps); + assert(name); + assert(namelen); + assert(mapent); + + *mapent = NULL; + + for (i = 0; i < nmaps; i++) { + const struct mnt_optmap *map = maps[i]; + const struct mnt_optmap *ent; + const char *p; + + for (ent = map; ent && ent->name; ent++) { + if (strncmp(ent->name, name, namelen)) + continue; + p = ent->name + namelen; + if (*p == '\0' || *p == '=' || *p == '[') { + *mapent = ent; + return map; + } + } + } + return NULL; +} + + +/* + * Converts @rawdata to number according to enum definition in the @mapent. + */ +int mnt_optmap_enum_to_number(const struct mnt_optmap *mapent, + const char *rawdata, size_t len) +{ + const char *p, *end = NULL, *begin = NULL; + int n = -1; + + if (!rawdata || !*rawdata || !mapent || !len) + return -1; + + p = strrchr(mapent->name, '='); + if (!p || *(p + 1) == '{') + return -1; /* value unexpected or not "enum" */ + p += 2; + if (!*p || *(p + 1) == '}') + return -1; /* hmm... option is "={" or "={}" */ + + /* we cannot use strstr(), @rawdata is not terminated */ + for (; p && *p; p++) { + if (!begin) + begin = p; /* begin of the item */ + if (*p == ',') + end = p; /* terminate the item */ + if (*(p + 1) == '}') + end = p + 1; /* end of enum definition */ + if (!begin || !end) + continue; + if (end <= begin) + return -1; + n++; + if (len == end - begin && strncasecmp(begin, rawdata, len) == 0) + return n; + p = end; + } + + return -1; +} + +/* + * Returns data type defined in the @mapent. + */ +const char *mnt_optmap_get_type(const struct mnt_optmap *mapent) +{ + char *type; + + assert(mapent); + assert(mapent->name); + + type = strrchr(mapent->name, '='); + if (!type) + return NULL; /* value is unexpected */ + if (type == mapent->name) + return NULL; /* wrong format of type definition */ + type++; + if (*type != '%' && *type != '{') + return NULL; /* wrong format of type definition */ + return type ? : NULL; +} + +/* + * Does the option (that is described by @mntent) require any value? (e.g. + * uid=) + */ +int mnt_optmap_require_value(const struct mnt_optmap *mapent) +{ + char *type; + + assert(mapent); + assert(mapent->name); + + type = strchr(mapent->name, '='); + if (!type) + return 0; /* value is unexpected */ + if (type == mapent->name) + return 0; /* wrong format of type definition */ + if (*(type - 1) == '[') + return 0; /* optional */ + return 1; +} -- cgit v1.2.3 From 6e2c394852e5d0d40beeffe0fd7949e3660417f6 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 11 Jan 2010 13:42:45 +0100 Subject: libmount: proper tests definition in Makefile.am Signed-off-by: Karel Zak --- shlibs/mount/src/Makefile.am | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index 8a265ecf..b525bf73 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -22,16 +22,9 @@ libmount_la_DEPENDENCIES = $(libmount_la_LIBADD) mount.sym mount.h.in libmount_la_LDFLAGS = -Wl,--version-script=$(ul_libmount_srcdir)/mount.sym \ -version-info $(LIBMOUNT_VERSION_INFO) -tests = test_version test_cache test_optstr test_optls - EXTRA_DIST = mount.sym mount.h.in CLEANFILES = $(tests) -tests: all $(tests) -test_%: %.c - $(COMPILE) -DTEST_PROGRAM $< .libs/libmount.a -o $@ $(BLKID_LIBS) - - # move lib from $(usrlib_execdir) to $(libdir) if needed install-exec-hook: if test "$(usrlib_execdir)" != "$(libdir)"; then \ @@ -46,3 +39,24 @@ install-exec-hook: uninstall-hook: rm -f $(DESTDIR)$(libdir)/libmount.so* + +# tests +noinst_PROGRAMS = test_version test_cache test_optstr test_optls +tests_cppflags = $(AM_CPPFLAGS) -DTEST_PROGRAM +tests_ldadd = .libs/libmount.a $(ul_libblkid_la) + +test_version_SOURCES = version.c +test_version_CPPFLAGS = $(tests_cppflags) +test_version_LDADD = $(tests_ldadd) + +test_cache_SOURCES = cache.c +test_cache_CPPFLAGS = $(tests_cppflags) +test_cache_LDADD = $(tests_ldadd) + +test_optstr_SOURCES = optstr.c +test_optstr_CPPFLAGS = $(tests_cppflags) +test_optstr_LDADD = $(tests_ldadd) + +test_optls_SOURCES = optls.c +test_optls_CPPFLAGS = $(tests_cppflags) +test_optls_LDADD = $(tests_ldadd) -- cgit v1.2.3 From 27c6d41518e139529feaac442716509bd8e31f43 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 11 Jan 2010 15:12:02 +0100 Subject: libmount: add mtab locking code Signed-off-by: Karel Zak --- shlibs/mount/src/Makefile.am | 8 +- shlibs/mount/src/lock.c | 510 +++++++++++++++++++++++++++++++++++++++++++ shlibs/mount/src/mount.h.in | 15 ++ shlibs/mount/src/mountP.h | 1 + 4 files changed, 532 insertions(+), 2 deletions(-) create mode 100644 shlibs/mount/src/lock.c diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index b525bf73..5cba0da9 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -12,7 +12,7 @@ usrlib_exec_LTLIBRARIES = libmount.la libmount_la_SOURCES = $(mountinc_HEADERS) nodist_libmount_la_SOURCES = mount.h version.c utils.c test.c init.c cache.c \ - optstr.c optmap.c optent.c optls.c iter.c list.h \ + optstr.c optmap.c optent.c optls.c iter.c list.h lock.c \ $(top_srcdir)/lib/canonicalize.c libmount_la_LIBADD = $(ul_libblkid_la) @@ -41,7 +41,7 @@ uninstall-hook: rm -f $(DESTDIR)$(libdir)/libmount.so* # tests -noinst_PROGRAMS = test_version test_cache test_optstr test_optls +noinst_PROGRAMS = test_version test_cache test_optstr test_optls test_lock tests_cppflags = $(AM_CPPFLAGS) -DTEST_PROGRAM tests_ldadd = .libs/libmount.a $(ul_libblkid_la) @@ -60,3 +60,7 @@ test_optstr_LDADD = $(tests_ldadd) test_optls_SOURCES = optls.c test_optls_CPPFLAGS = $(tests_cppflags) test_optls_LDADD = $(tests_ldadd) + +test_lock_SOURCES = lock.c +test_lock_CPPFLAGS = $(tests_cppflags) +test_lock_LDADD = $(tests_ldadd) diff --git a/shlibs/mount/src/lock.c b/shlibs/mount/src/lock.c new file mode 100644 index 00000000..2d2b3c07 --- /dev/null +++ b/shlibs/mount/src/lock.c @@ -0,0 +1,510 @@ +/* + * Copyright (C) 2009 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pathnames.h" +#include "nls.h" + +#include "mountP.h" + +/* + * lock handler + */ +struct _mnt_lock { + pid_t id; /* getpid() or so (see linkfile)... */ + char *lockfile; /* path to lock file (e.g. /etc/mtab~) */ + char *linkfile; /* path to link file (e.g. /etc/mtab~.) */ + int lockfile_fd; /* lock file descriptor */ + int locked; /* do we own the lock? */ +}; + + +/** + * mnt_new_lock: + * @lockfile: path to lockfile or NULL (default is _PATH_MOUNTED_LOCK) + * @id: unique linkfile identifier or 0 (default is getpid()) + * + * Returns newly allocated lock handler or NULL on case of error. + */ +mnt_lock *mnt_new_lock(const char *lockfile, pid_t id) +{ + mnt_lock *ml = calloc(1, sizeof(struct _mnt_lock)); + + if (!ml) + return NULL; + + ml->lockfile_fd = -1; + ml->id = id; + if (lockfile) { + ml->lockfile = strdup(lockfile); + if (!ml->lockfile) { + free(ml); + return NULL; + } + } + return ml; +} + +/** + * mnt_free_lock: + * @ml: mnt_lock handler + * + * Deallocates mnt_lock. + */ +void mnt_free_lock(mnt_lock *ml) +{ + if (!ml) + return; + free(ml->lockfile); + free(ml->linkfile); + free(ml); +} + +/** + * mnt_lock_get_lockfile: + * @ml: mnt_lock handler + * + * Returns path to lockfile. + */ +const char *mnt_lock_get_lockfile(mnt_lock *ml) +{ + if (!ml) + return NULL; + if (ml->lockfile) + return ml->lockfile; + return _PATH_MOUNTED_LOCK; +} + +/** + * mnt_lock_get_linkfile: + * @ml: mnt_lock handler + * + * Returns unique (per process) path to linkfile. + */ +const char *mnt_lock_get_linkfile(mnt_lock *ml) +{ + if (!ml) + return NULL; + + if (!ml->linkfile) { + const char *lf = mnt_lock_get_lockfile(ml); + size_t sz; + + if (!lf) + return NULL; + sz = strlen(lf) + 32; + + ml->linkfile = malloc(sz); + if (ml->linkfile) + snprintf(ml->linkfile, sz, "%s.%d", + lf, ml->id ? ml->id : getpid()); + } + return ml->linkfile; +} + +static void mnt_lockalrm_handler(int sig) +{ + /* do nothing, say nothing, be nothing */ +} + +/* + * Waits for F_SETLKW, unfortunately we have to use SIGALRM here to interrupt + * fcntl() to avoid never ending waiting. + * + * Returns 0 on success, 1 on timeout, -errno on error. + */ +static int mnt_wait_lock(mnt_lock *ml, struct flock *fl, time_t maxtime) +{ + struct timeval now; + struct sigaction sa, osa; + int ret = 0; + + gettimeofday(&now, NULL); + + if (now.tv_sec >= maxtime) + return 1; /* timeout */ + + /* setup ALARM handler -- we don't want to wait forever */ + sa.sa_flags = 0; + sa.sa_handler = mnt_lockalrm_handler; + sigfillset (&sa.sa_mask); + + sigaction(SIGALRM, &sa, &osa); + + DBG(DEBUG_LOCKS, fprintf(stderr, + "LOCK: (%d) waiting for F_SETLKW.\n", getpid())); + + alarm(maxtime - now.tv_sec); + if (fcntl(ml->lockfile_fd, F_SETLKW, fl) == -1) + ret = errno == EINTR ? 1 : -errno; + alarm(0); + + /* restore old sigaction */ + sigaction(SIGALRM, &osa, NULL); + + DBG(DEBUG_LOCKS, fprintf(stderr, + "LOCK: (%d) leaving mnt_wait_setlkw(), rc=%d.\n", getpid(), ret)); + return ret; +} + +/* + * Create the lock file. + * + * The old code here used flock on a lock file /etc/mtab~ and deleted + * this lock file afterwards. However, as rgooch remarks, that has a + * race: a second mount may be waiting on the lock and proceed as + * soon as the lock file is deleted by the first mount, and immediately + * afterwards a third mount comes, creates a new /etc/mtab~, applies + * flock to that, and also proceeds, so that the second and third mount + * now both are scribbling in /etc/mtab. + * + * The new code uses a link() instead of a creat(), where we proceed + * only if it was us that created the lock, and hence we always have + * to delete the lock afterwards. Now the use of flock() is in principle + * superfluous, but avoids an arbitrary sleep(). + * + * Where does the link point to? Obvious choices are mtab and mtab~~. + * HJLu points out that the latter leads to races. Right now we use + * mtab~. instead. + * + * + * The original mount locking code has used sleep(1) between attempts and + * maximal number of attempts has been 5. + * + * There was very small number of attempts and extremely long waiting (1s) + * that is useless on machines with large number of mount processes. + * + * Now we wait few thousand microseconds between attempts and we have global + * time limit (30s) rather than limit for number of attempts. The advantage + * is that this method also counts time which we spend in fcntl(F_SETLKW) and + * number of attempts is not restricted. + * -- kzak@redhat.com [Mar-2007] + * + * + * This mtab locking code has been refactored and moved to libmount. The mtab + * locking is really not perfect (e.g. SIGALRM), but it's stable, reliable and + * backwardly compatible code. Don't forget that this code has to be compatible + * with 3rd party mounts (/sbin/mount.) and has to work with NFS. + * -- kzak@redhat.com [May-2009] + */ + +/* maximum seconds between first and last attempt */ +#define MOUNTLOCK_MAXTIME 30 + +/* sleep time (in microseconds, max=999999) between attempts */ +#define MOUNTLOCK_WAITTIME 5000 + +/* Remove lock file. */ +void mnt_unlock_file(mnt_lock *ml) +{ + if (!ml) + return; + + DBG(DEBUG_LOCKS, fprintf(stderr, "LOCK: (%d) unlocking/cleaning.\n", getpid())); + + if (ml->locked == 0 && ml->lockfile && ml->linkfile) + { + /* We have (probably) all files, but we don't own the lock, + * Really? Check it! Maybe ml->locked wasn't set properly + * because code was interrupted by signal. Paranoia? Yes. + * + * We own the lock when linkfile == lockfile. + */ + struct stat lo, li; + + if (!stat(ml->lockfile, &lo) && !stat(ml->linkfile, &li) && + lo.st_dev == li.st_dev && lo.st_ino == li.st_ino) + ml->locked = 1; + } + if (ml->linkfile) + unlink(ml->linkfile); + if (ml->lockfile_fd >= 0) + close(ml->lockfile_fd); + if (ml->locked == 1 && ml->lockfile) + unlink(ml->lockfile); + + ml->locked = 0; + ml->lockfile_fd = -1; +} + +/** + * mnt_lock: + * @ml: pointer to mnt_lock instance + * + * Creates lock file (e.g. /etc/mtab~). Note that this function uses + * alarm(). + * + * Your application has to always call mnt_unlock_file() before exit. + * + * Locking scheme: + * + * 1. create linkfile (e.g. /etc/mtab~.) + * 2. link linkfile --> lockfile (e.g. /etc/mtab~. --> /etc/mtab~) + * + * 3. a) link() successful: setups F_SETLK lock (see fcnlt(2)) + * b) link() failed: wait (max 30s) on F_SETLKW lock, goto 2. + * + * Example: + * + * mnt_lock *ml; + * + * void unlock_fallback(void) + * { + * if (!ml) + * return; + * mnt_unlock_file(ml); + * mnt_free_lock(ml); + * } + * + * int update_mtab() + * { + * int sig = 0; + * + * atexit(unlock_fallback); + * + * ml = mnt_new_lock(NULL, 0); + * + * if (mnt_lock_file(ml) != 0) { + * printf(stderr, "cannot create %s lockfile\n", + * mnt_lock_get_lockfile(ml)); + * return -1; + * } + * + * ... modify mtab ... + * + * mnt_unlock_file(ml); + * mnt_free_lock(ml); + * ml = NULL; + * return 0; + * } + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_lock_file(mnt_lock *ml) +{ + int i; + struct timespec waittime; + struct timeval maxtime; + const char *lockfile, *linkfile; + + if (!ml) + return -1; + if (ml->locked) + return 0; + + lockfile = mnt_lock_get_lockfile(ml); + if (!lockfile) + return -1; + linkfile = mnt_lock_get_linkfile(ml); + if (!linkfile) + return -1; + + i = open(linkfile, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR); + if (i < 0) + /* linkfile does not exist (as a file) + and we cannot create it. Read-only filesystem? + Too many files open in the system? + Filesystem full? */ + goto failed; + + close(i); + + gettimeofday(&maxtime, NULL); + maxtime.tv_sec += MOUNTLOCK_MAXTIME; + + waittime.tv_sec = 0; + waittime.tv_nsec = (1000 * MOUNTLOCK_WAITTIME); + + /* Repeat until it was us who made the link */ + while (ml->locked == 0) { + struct timeval now; + struct flock flock; + int j; + + j = link(linkfile, lockfile); + if (j == 0) + ml->locked = 1; + + if (j < 0 && errno != EEXIST) + goto failed; + + ml->lockfile_fd = open(lockfile, O_WRONLY); + + if (ml->lockfile_fd < 0) { + /* Strange... Maybe the file was just deleted? */ + int errsv = errno; + gettimeofday(&now, NULL); + if (errsv == ENOENT && now.tv_sec < maxtime.tv_sec) { + ml->locked = 0; + continue; + } + goto failed; + } + + flock.l_type = F_WRLCK; + flock.l_whence = SEEK_SET; + flock.l_start = 0; + flock.l_len = 0; + + if (ml->locked) { + /* We made the link. Now claim the lock. */ + if (fcntl (ml->lockfile_fd, F_SETLK, &flock) == -1) { + DBG(DEBUG_LOCKS, fprintf(stderr, + "%s: can't F_SETLK lockfile, errno=%d\n", + lockfile, errno)); + /* proceed, since it was us who created the lockfile anyway */ + } + break; + } else { + /* Someone else made the link. Wait. */ + int err = mnt_wait_lock(ml, &flock, maxtime.tv_sec); + + if (err == 1) { + DBG(DEBUG_LOCKS, fprintf(stderr, + "%s: can't create link: time out (perhaps " + "there is a stale lock file?)", lockfile)); + goto failed; + + } else if (err < 0) + goto failed; + + nanosleep(&waittime, NULL); + close(ml->lockfile_fd); + ml->lockfile_fd = -1; + } + } + DBG(DEBUG_LOCKS, fprintf(stderr, + "LOCK: %s: (%d) successfully locked\n", + ml->lockfile, getpid())); + unlink(linkfile); + return 0; + +failed: + mnt_unlock_file(ml); + return -1; +} + +#ifdef TEST_PROGRAM +#include + +mnt_lock *lock; + +/* + * read number from @filename, increment the number and + * write the number back to the file + */ +void increment_data(const char *filename, int verbose, int loopno) +{ + long num; + FILE *f; + char buf[256]; + + if (!(f = fopen(filename, "r"))) + err(EXIT_FAILURE, "%d: failed to open: %s", getpid(), filename); + + if (!fgets(buf, sizeof(buf), f)) + err(EXIT_FAILURE, "%d failed read: %s", getpid(), filename); + + fclose(f); + num = atol(buf) + 1; + + if (!(f = fopen(filename, "w"))) + err(EXIT_FAILURE, "%d: failed to open: %s", getpid(), filename); + + fprintf(f, "%ld", num); + fclose(f); + + if (verbose) + fprintf(stderr, "%d: %s: %ld --> %ld (loop=%d)\n", getpid(), + filename, num - 1, num, loopno); +} + +void clean_lock(void) +{ + fprintf(stderr, "%d: cleaning\n", getpid()); + if (!lock) + return; + mnt_unlock_file(lock); + mnt_free_lock(lock); +} + +void sig_handler(int sig) +{ + errx(EXIT_FAILURE, "\n%d: catch signal: %s\n", getpid(), strsignal(sig)); +} + +int test_lock(struct mtest *ts, int argc, char *argv[]) +{ + const char *lockfile, *datafile; + int verbose = 0, loops, l; + + if (argc < 4) + return -1; + + lockfile = argv[1]; + datafile = argv[2]; + loops = atoi(argv[3]); + + if (argc == 5 && strcmp(argv[4], "--verbose") == 0) + verbose = 1; + + atexit(clean_lock); + + /* be paranoid and call exit() (=clean_lock()) for all signals */ + { + int sig = 0; + struct sigaction sa; + + sa.sa_handler = sig_handler; + sa.sa_flags = 0; + sigfillset(&sa.sa_mask); + + while (sigismember(&sa.sa_mask, ++sig) != -1 && sig != SIGCHLD) + sigaction (sig, &sa, (struct sigaction *) 0); + } + + for (l = 0; l < loops; l++) { + lock = mnt_new_lock(lockfile, 0); + + if (mnt_lock_file(lock) == -1) { + fprintf(stderr, "%d: failed to create lock file: %s\n", + getpid(), lockfile); + return -1; + } + + increment_data(datafile, verbose, l); + + mnt_unlock_file(lock); + mnt_free_lock(lock); + lock = NULL; + } + + return 0; +} + +int main(int argc, char *argv[]) +{ + struct mtest tss[] = { + { "--lock", test_lock, " [--verbose] increment number in datafile" }, + { NULL } + }; + + return mnt_run_test(tss, argc, argv); +} + +#endif /* TEST_PROGRAM */ diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index ab644a23..05912e11 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -37,6 +37,13 @@ extern "C" { */ typedef struct _mnt_cache mnt_cache; +/** + * mnt_lock: + * + * Stores information about locked file (e.g. /etc/mtab) + */ +typedef struct _mnt_lock mnt_lock; + /** * mnt_iter: * @@ -176,6 +183,14 @@ extern char *mnt_optls_create_mtab_optstr(mnt_optls *ls); extern char *mnt_optls_create_userspace_optstr(mnt_optls *ls); extern int mnt_optls_print_debug(mnt_optls *ls, FILE *file); +/* lock.c */ +extern mnt_lock *mnt_new_lock(const char *lockfile, pid_t id); +extern void mnt_free_lock(mnt_lock *ml); +extern const char *mnt_lock_get_lockfile(mnt_lock *ml); +extern const char *mnt_lock_get_linkfile(mnt_lock *ml); +extern void mnt_unlock_file(mnt_lock *ml); +extern int mnt_lock_file(mnt_lock *ml); + /* * mount(8) userspace options masks (MNT_MAP_USERSPACE map) diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index 62a5eca9..82c557b4 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -34,6 +34,7 @@ #define DEBUG_INIT (1 << 1) #define DEBUG_CACHE (1 << 2) #define DEBUG_OPTIONS (1 << 3) +#define DEBUG_LOCKS (1 << 4) #define DEBUG_ALL 0xFFFF #ifdef CONFIG_LIBMOUNT_DEBUG -- cgit v1.2.3 From d115ee9bd183412c41f2a8cc7b3485c1e286e34f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 12 Jan 2010 13:43:07 +0100 Subject: libmount: add mnt_entry Signed-off-by: Karel Zak --- shlibs/mount/src/Makefile.am | 1 + shlibs/mount/src/fs.c | 545 +++++++++++++++++++++++++++++++++++++++++++ shlibs/mount/src/mount.h.in | 45 ++++ shlibs/mount/src/mountP.h | 39 ++++ 4 files changed, 630 insertions(+) create mode 100644 shlibs/mount/src/fs.c diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index 5cba0da9..de265c9d 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -13,6 +13,7 @@ libmount_la_SOURCES = $(mountinc_HEADERS) nodist_libmount_la_SOURCES = mount.h version.c utils.c test.c init.c cache.c \ optstr.c optmap.c optent.c optls.c iter.c list.h lock.c \ + fs.c \ $(top_srcdir)/lib/canonicalize.c libmount_la_LIBADD = $(ul_libblkid_la) diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c new file mode 100644 index 00000000..0e12052d --- /dev/null +++ b/shlibs/mount/src/fs.c @@ -0,0 +1,545 @@ +/* + * Copyright (C) 2008-2009 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + * + * The mnt_fs is representation of one line in a fstab / mtab / mountinfo. + */ + +#include +#include +#include +#include +#include + +#include "nls.h" +#include "mountP.h" + +/** + * mnt_new_fs: + * + * Returns newly allocated mnt_file fs. + */ +mnt_fs *mnt_new_fs(void) +{ + mnt_fs *fs = calloc(1, sizeof(struct _mnt_fs)); + if (!fs) + return NULL; + + INIT_LIST_HEAD(&fs->ents); + return fs; +} + +/** + * mnt_free_fs: + * @fs: fs pointer + * + * Deallocates the fs. + */ +void mnt_free_fs(mnt_fs *fs) +{ + if (!fs) + return; + list_del(&fs->ents); + + free(fs->source); + free(fs->tagname); + free(fs->tagval); + free(fs->mntroot); + free(fs->target); + free(fs->fstype); + free(fs->optstr); + free(fs->vfs_optstr); + free(fs->fs_optstr); + + free(fs); +} + +/** + * mnt_fs_get_srcpath: + * @fs: mnt_file (fstab/mtab/mountinfo) fs + * + * The mount "source path" is: + * - a directory for 'bind' mounts (in fstab or mtab only) + * - a device name for standard mounts + * - NULL when path is not set (for example when TAG + * (LABEL/UUID) is defined) + * + * See also mnt_fs_get_tag() and mnt_fs_get_source(). + * + * Returns mount "source" path or NULL in case of error or when the path + * is not defined. + * + */ +const char *mnt_fs_get_srcpath(mnt_fs *fs) +{ + assert(fs); + if (!fs) + return NULL; + + /* fstab-like fs */ + if (fs->tagname) + return NULL; /* the source contains a "NAME=value" */ + return fs->source; +} + +/** + * @fs: mnt_file (fstab/mtab/mountinfo) fs + * + * Returns mount "source". Note that the source could be unparsed TAG + * (LABEL/UUID). See also mnt_fs_get_srcpath() and mnt_fs_get_tag(). + */ +const char *mnt_fs_get_source(mnt_fs *fs) +{ + return fs ? fs->source : NULL; +} + +/* Used by parser mnt_file ONLY (@source has to be allocated) */ +int __mnt_fs_set_source(mnt_fs *fs, char *source) +{ + assert(fs); + + if (!source) + return -1; + + if (strchr(source, '=')) { + char *name, *val; + + if (blkid_parse_tag_string(source, &name, &val) != 0) + return -1; + + fs->tagval = val; + fs->tagname = name; + } + + fs->source = source; + return 0; +} + +/** + * mnt_fs_set_source: + * @fs: fstab/mtab/mountinfo entry + * @source: new source + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_fs_set_source(mnt_fs *fs, const char *source) +{ + char *p; + + if (!fs && !source) + return -1; + + p = strdup(source); + if (!p) + return -1; + + free(fs->tagval); + free(fs->tagname); + free(fs->source); + fs->tagval = fs->tagname = fs->source = NULL; + + return __mnt_fs_set_source(fs, p); +} + +/** + * mnt_fs_get_tag: + * @fs: fs + * @name: returns pointer to NAME string + * @value: returns pointer to VALUE string + * + * "TAG" is NAME=VALUE (e.g. LABEL=foo) + * + * The TAG is the first column in the fstab file. The TAG + * or "srcpath" has to be always set for all entries. + * + * See also mnt_fs_get_source(). + * + * Example: + * char *src; + * mnt_fs *fs = mnt_file_find_target(mf, "/home"); + * + * if (!fs) + * goto err; + * + * src = mnt_fs_get_srcpath(fs); + * if (!src) { + * char *tag, *val; + * if (mnt_fs_get_tag(fs, &tag, &val) == 0) + * printf("%s: %s\n", tag, val); // LABEL or UUID + * } else + * printf("device: %s\n", src); // device or bind path + * + * Returns 0 on success or -1 in case that a TAG is not defined. + */ +int mnt_fs_get_tag(mnt_fs *fs, const char **name, const char **value) +{ + if (fs == NULL || !fs->tagname) + return -1; + if (name) + *name = fs->tagname; + if (value) + *value = fs->tagval; + return 0; +} + +/** + * mnt_fs_get_target: + * @fs: fstab/mtab/mountinfo entry pointer + * + * Returns pointer to mountpoint path or NULL + */ +const char *mnt_fs_get_target(mnt_fs *fs) +{ + assert(fs); + return fs ? fs->target : NULL; +} + +/** + * mnt_fs_set_target: + * @fs: fstab/mtab/mountinfo entry + * @target: mountpoint + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_fs_set_target(mnt_fs *fs, const char *target) +{ + char *p; + + assert(fs); + + if (!fs || !target) + return -1; + + p = strdup(target); + if (!p) + return -1; + free(fs->target); + fs->target = p; + + return 0; +} + +/** + * mnt_fs_get_fstype: + * @fs: fstab/mtab/mountinfo entry pointer + * + * Returns pointer to filesystem type. + */ +const char *mnt_fs_get_fstype(mnt_fs *fs) +{ + assert(fs); + return fs ? fs->fstype : NULL; +} + +/* Used by mnt_file parser only */ +int __mnt_fs_set_fstype(mnt_fs *fs, char *fstype) +{ + assert(fs); + + if (!fstype) + return -1; + + fs->fstype = fstype; + fs->flags &= ~MNT_FS_PSEUDO; + fs->flags &= ~MNT_FS_NET; + + /* save info about pseudo filesystems */ + if (mnt_fstype_is_pseudofs(fs->fstype)) + fs->flags |= MNT_FS_PSEUDO; + else if (mnt_fstype_is_netfs(fs->fstype)) + fs->flags |= MNT_FS_NET; + + return 0; +} + +/** + * mnt_fs_set_fstype: + * @fs: fstab/mtab/mountinfo entry + * @fstype: filesystem type + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_fs_set_fstype(mnt_fs *fs, const char *fstype) +{ + char *p; + + if (!fs || !fstype) + return -1; + + p = strdup(fstype); + if (!p) + return -1; + free(fs->fstype); + + return __mnt_fs_set_fstype(fs, p); +} + +/** + * mnt_fs_get_optstr: + * @fs: fstab/mtab/mountinfo entry pointer + * + * Returns pointer to mount option string with all options (FS and VFS) + */ +const char *mnt_fs_get_optstr(mnt_fs *fs) +{ + assert(fs); + return fs ? fs->optstr : NULL; +} + +/** + * mnt_fs_set_optstr: + * @fs: fstab/mtab/mountinfo entry + * @optstr: options string + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_fs_set_optstr(mnt_fs *fs, const char *optstr) +{ + assert(fs); + + if (!fs || !optstr) + return -1; + free(fs->optstr); + free(fs->fs_optstr); + free(fs->vfs_optstr); + fs->fs_optstr = fs->vfs_optstr = NULL; + + fs->optstr = strdup(optstr); + + return fs->optstr ? 0 : -1; +} + +/** + * mnt_fs_get_fs_optstr: + * @fs: fstab/mtab/mountinfo entry pointer + * + * This function works for "mountinfo" files only. + * + * Returns pointer to superblock (fs-depend) mount option string or NULL. + */ +const char *mnt_fs_get_fs_optstr(mnt_fs *fs) +{ + assert(fs); + return fs ? fs->fs_optstr : NULL; +} + +/** + * mnt_fs_get_vfs_optstr: + * @fs: fstab/mtab/mountinfo entry pointer + * + * This function works for "mountinfo" files only. + * + * Returns pointer to fs-independent (VFS) mount option string or NULL. + */ +const char *mnt_fs_get_vfs_optstr(mnt_fs *fs) +{ + assert(fs); + return fs ? fs->vfs_optstr : NULL; +} + + +/** + * mnt_fs_get_freq: + * @fs: fstab/mtab/mountinfo entry pointer + * + * Returns "dump frequency in days". + */ +int mnt_fs_get_freq(mnt_fs *fs) +{ + assert(fs); + return fs ? fs->freq : 0; +} + +/** + * mnt_fs_set_freq: + * @fs: fstab/mtab/mountinfo entry pointer + * @freq: dump frequency in days + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_fs_set_freq(mnt_fs *fs, int freq) +{ + assert(fs); + + if (!fs) + return -1; + fs->freq = freq; + return 0; +} + +/** + * mnt_fs_get_passno: + * @fs: fstab/mtab/mountinfo entry pointer + * + * Returns "pass number on parallel fsck". + */ +int mnt_fs_get_passno(mnt_fs *fs) +{ + assert(fs); + return fs ? fs->passno: 0; +} + +/** + * mnt_fs_set_passno: + * @fs: fstab/mtab/mountinfo entry pointer + * @passno: pass number + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_fs_set_passno(mnt_fs *fs, int passno) +{ + assert(fs); + + if (!fs) + return -1; + fs->passno = passno; + return 0; +} + +/** + * mnt_fs_get_option: + * @fs: fstab/mtab/mountinfo entry pointer + * @name: option name + * @value: returns pointer to the begin of the value (e.g. name=VALUE) or NULL + * @valsz: returns size of options value or 0 + * + * Returns 0 on success, 1 when not found the @name or -1 in case of error. + */ +int mnt_fs_get_option(mnt_fs *fs, const char *name, + char **value, size_t *valsz) +{ + char *optstr = (char *) mnt_fs_get_optstr(fs); + return optstr ? mnt_optstr_get_option(optstr, name, value, valsz) : 1; +} + + +/* Unfortunately the classical Unix /etc/mtab and /etc/fstab + do not handle directory names containing spaces. + Here we mangle them, replacing a space by \040. + What do other Unices do? */ + +static unsigned char need_escaping[] = { ' ', '\t', '\n', '\\' }; + +static char *mangle(const char *s) +{ + char *ss, *sp; + int n; + + n = strlen(s); + ss = sp = malloc(4*n+1); + if (!sp) + return NULL; + while(1) { + for (n = 0; n < sizeof(need_escaping); n++) { + if (*s == need_escaping[n]) { + *sp++ = '\\'; + *sp++ = '0' + ((*s & 0300) >> 6); + *sp++ = '0' + ((*s & 070) >> 3); + *sp++ = '0' + (*s & 07); + goto next; + } + } + *sp++ = *s; + if (*s == 0) + break; + next: + s++; + } + return ss; +} + +/** + * mnt_fprintf_line: + * @f: FILE + * @fmt: printf-like format string (see MNT_MFILE_PRINTFMT) + * @source: (spec) device name or tag=value + * @target: mountpoint + * @fstype: filesystem type + * @options: mount options + * @freq: dump frequency in days + * @passno: pass number on parallel fsck + * + * Returns return value from fprintf(). + */ +int mnt_fprintf_line( FILE *f, + const char *fmt, + const char *source, + const char *target, + const char *fstype, + const char *options, + int freq, + int passno) +{ + char *m1 = NULL, *m2 = NULL, *m3 = NULL, *m4 = NULL; + int rc = -1; + + if (!f || !fmt || !source || !target || !fstype || !options) + return -1; + + m1 = mangle(source); + m2 = mangle(target); + m3 = mangle(fstype); + m4 = mangle(options); + + if (!m1 || !m2 || !m3 || !m4) + goto done; + + rc = fprintf(f, fmt, m1, m2, m3, m4, freq, passno); +done: + free(m1); + free(m2); + free(m3); + free(m4); + + return rc; +} + +/** + * mnt_fs_fprintf: + * @fs: fstab/mtab/mountinfo entry + * @f: FILE + * @fmt: printf-like format string (see MNT_MFILE_PRINTFMT) + * + * Returns return value from fprintf(). + */ +int mnt_fs_fprintf(mnt_fs *fs, FILE *f, const char *fmt) +{ + assert(fs); + assert(f); + assert(fmt); + + if (!fs || !f) + return -1; + + return mnt_fprintf_line(f, fmt, + mnt_fs_get_source(fs), + mnt_fs_get_target(fs), + mnt_fs_get_fstype(fs), + mnt_fs_get_optstr(fs), + mnt_fs_get_freq(fs), + mnt_fs_get_passno(fs)); +} + +/** + * mnt_fs_print_debug + * @fs: fstab/mtab/mountinfo entry + * @file: output + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_fs_print_debug(mnt_fs *fs, FILE *file) +{ + if (!fs) + return -1; + fprintf(file, "------ fs: %p\n", fs); + fprintf(file, "source: %s\n", mnt_fs_get_source(fs)); + fprintf(file, "target: %s\n", mnt_fs_get_target(fs)); + fprintf(file, "fstype: %s\n", mnt_fs_get_fstype(fs)); + fprintf(file, "optstr: %s\n", mnt_fs_get_optstr(fs)); + fprintf(file, "freq: %d\n", mnt_fs_get_freq(fs)); + fprintf(file, "pass: %d\n", mnt_fs_get_passno(fs)); + + return 0; +} diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 05912e11..0c3f80bf 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -88,6 +88,14 @@ struct mnt_optmap #define MNT_INVERT (1 << 3) /* invert the mountflag */ #define MNT_NOMTAB (1 << 4) /* skip in the mtab option string */ +/** + * mnt_fs: + * + * Parsed fstab/mtab/mountinfo entry + */ +typedef struct _mnt_fs mnt_fs; + + /* version.c */ extern int mnt_parse_version_string(const char *ver_string); extern int mnt_get_library_version(const char **ver_string); @@ -191,6 +199,43 @@ extern const char *mnt_lock_get_linkfile(mnt_lock *ml); extern void mnt_unlock_file(mnt_lock *ml); extern int mnt_lock_file(mnt_lock *ml); +/* fs.c */ +extern mnt_fs *mnt_new_fs(void); +extern void mnt_free_fs(mnt_fs *ent); +extern const char *mnt_fs_get_source(mnt_fs *ent); +extern int mnt_fs_set_source(mnt_fs *ent, const char *source); +extern const char *mnt_fs_get_srcpath(mnt_fs *ent); +extern int mnt_fs_get_tag(mnt_fs *ent, const char **name, const char **value); +extern const char *mnt_fs_get_target(mnt_fs *ent); +extern int mnt_fs_set_target(mnt_fs *ent, const char *target); +extern const char *mnt_fs_get_fstype(mnt_fs *ent); +extern int mnt_fs_set_fstype(mnt_fs *ent, const char *fstype); +extern const char *mnt_fs_get_optstr(mnt_fs *ent); +extern int mnt_fs_set_optstr(mnt_fs *ent, const char *optstr); +extern const char *mnt_fs_get_optfs(mnt_fs *ent); +extern const char *mnt_fs_get_optvfs(mnt_fs *ent); +extern int mnt_fs_get_freq(mnt_fs *ent); +extern int mnt_fs_set_freq(mnt_fs *ent, int freq); +extern int mnt_fs_get_passno(mnt_fs *ent); +extern int mnt_fs_set_passno(mnt_fs *ent, int passno); +extern int mnt_fs_get_option(mnt_fs *ent, const char *name, + char **value, size_t *valsz); + +/* mtab/fstab line */ +#define MNT_MFILE_PRINTFMT "%s %s %s %s %d %d\n" + +extern int mnt_fprintf_line( + FILE *f, + const char *fmt, + const char *source, + const char *target, + const char *fstype, + const char *options, + int freq, + int passno); + +extern int mnt_fs_fprintf(mnt_fs *ent, FILE *f, const char *fmt); +extern int mnt_fs_print_debug(mnt_fs *ent, FILE *file); /* * mount(8) userspace options masks (MNT_MAP_USERSPACE map) diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index 82c557b4..b6eb8cd3 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -126,6 +126,42 @@ struct _mnt_optls { struct list_head opts; /* list of options */ }; +/* + * This struct represents one entry in mtab/fstab/mountinfo file. + */ +struct _mnt_fs { + struct list_head ents; + + int id; /* mountinfo[1]: ID */ + int parent; /* moutninfo[2]: parent */ + + char *source; /* fstab[1]: mountinfo[10]: + * source dev, file, dir or TAG */ + char *tagname; /* fstab[1]: tag name - "LABEL", "UUID", ..*/ + char *tagval; /* tag value */ + + char *mntroot; /* mountinfo[4]: root of the mount within the FS */ + char *target; /* mountinfo[5], fstab[2]: mountpoint */ + char *fstype; /* mountinfo[9], fstab[3]: filesystem type */ + + char *optstr; /* mountinfo[6,11], fstab[4]: option string */ + char *vfs_optstr; /* mountinfo[6]: fs-independent (VFS) options */ + char *fs_optstr; /* mountinfo[11]: fs-depend options */ + + int freq; /* fstab[5]: dump frequency in days */ + int passno; /* fstab[6]: pass number on parallel fsck */ + + int flags; /* MNT_ENTRY_* flags */ + int lineno; /* line number in the parental file */ +}; + +/* + * fs flags + */ +#define MNT_FS_ERROR (1 << 1) /* broken entry */ +#define MNT_FS_PSEUDO (1 << 2) /* pseudo filesystem */ +#define MNT_FS_NET (1 << 3) /* network filesystem */ + /* optmap.c */ extern const struct mnt_optmap *mnt_optmap_get_entry(struct mnt_optmap const **maps, int nmaps, const char *name, @@ -149,5 +185,8 @@ extern mnt_optent *mnt_new_optent_from_optstr(char **optstr, extern int mnt_optent_assign_map(mnt_optent *op, struct mnt_optmap const **maps, int nmaps); +/* fs.c */ +extern int __mnt_fs_set_source(mnt_fs *fs, char *source); +extern int __mnt_fs_set_fstype(mnt_fs *fs, char *fstype); #endif /* _LIBMOUNT_PRIVATE_H */ -- cgit v1.2.3 From 5714fc0db8fd8f2206ffce27bb14405740e560b7 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 13 Jan 2010 16:52:14 +0100 Subject: libmount: rename mnt_optls_iterate_options() Signed-off-by: Karel Zak --- shlibs/mount/src/mount.h.in | 2 +- shlibs/mount/src/optls.c | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 0c3f80bf..d179620c 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -181,7 +181,7 @@ extern int mnt_optls_remove_option_by_flags(mnt_optls *ls, const struct mnt_optmap *map, const int flags); extern int mnt_optls_remove_option_by_iflags(mnt_optls *ls, const struct mnt_optmap *map, const int flags); -extern int mnt_optls_iterate_options(mnt_iter *itr, mnt_optls *ls, +extern int mnt_optls_next_option(mnt_optls *ls, mnt_iter *itr, const struct mnt_optmap *map, mnt_optent **option); extern mnt_optent *mnt_optls_get_option(mnt_optls *ls, const char *name); extern int mnt_optls_get_ids(mnt_optls *ls, const struct mnt_optmap *map); diff --git a/shlibs/mount/src/optls.c b/shlibs/mount/src/optls.c index 4c1bea6e..f819d12b 100644 --- a/shlibs/mount/src/optls.c +++ b/shlibs/mount/src/optls.c @@ -94,7 +94,7 @@ int mnt_optls_add_map(mnt_optls *ls, const struct mnt_optmap *map) mnt_reset_iter(&itr, MNT_ITER_FORWARD); - while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) { + while(mnt_optls_next_option(ls, &itr, NULL, &op) == 0) { if (!mnt_optent_is_unknown(op)) continue; if (mnt_optent_assign_map(op, &map, 1) == -1) @@ -169,7 +169,7 @@ mnt_optent *mnt_optls_add_option(mnt_optls *ls, * possible to call this function more than once. The new options from @optstr * will be appended to the container. * - * The options are accessible by mnt_optls_iterate_options(). + * The options are accessible by mnt_optls_next_option(). * * If the @optls container is associated with any options map(s), all new * options are verified according to the descriptions from the map(s). @@ -339,8 +339,9 @@ int mnt_optls_remove_option_by_iflags(mnt_optls *ls, } /** - * mnt_optls_iterate_options: + * mnt_optls_next_option: * @ls: pointer to mnt_optls instance + * @itr: iterator * @map: pointer to the map of wanted options or NULL for all options * @option: returns pointer to the option object * @@ -351,12 +352,12 @@ int mnt_optls_remove_option_by_iflags(mnt_optls *ls, * * mnt_optls_parse_optstr(ls, "noexec,nodev"); * - * while(mnt_optls_iterate_options(itr, ls, NULL, &option )) + * while(mnt_optls_next_option(ls, itr, NULL, &option)) * printf("%s\n", mnt_optent_get_name(option))); * * Returns 0 on succes, -1 in case of error or 1 at end of list. */ -int mnt_optls_iterate_options(mnt_iter *itr, mnt_optls *ls, +int mnt_optls_next_option(mnt_optls *ls, mnt_iter *itr, const struct mnt_optmap *map, mnt_optent **option) { assert(itr); @@ -395,7 +396,7 @@ mnt_optent *mnt_optls_get_option(mnt_optls *ls, const char *name) return NULL; mnt_reset_iter(&itr, MNT_ITER_FORWARD); - while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) { + while(mnt_optls_next_option(ls, &itr, NULL, &op) == 0) { const char *n = mnt_optent_get_name(op); if (n && !strcmp(n, name)) @@ -428,7 +429,7 @@ int mnt_optls_get_ids(mnt_optls *ls, const struct mnt_optmap *map) return 0; mnt_reset_iter(&itr, MNT_ITER_FORWARD); - while(mnt_optls_iterate_options(&itr, ls, map, &op) == 0) + while(mnt_optls_next_option(ls, &itr, map, &op) == 0) mnt_optent_get_flag(op, &flags); DBG(DEBUG_OPTIONS, fprintf(stderr, @@ -456,7 +457,7 @@ int mnt_optls_create_mountflags(mnt_optls *ls) return 0; mnt_reset_iter(&itr, MNT_ITER_FORWARD); - while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) { + while(mnt_optls_next_option(ls, &itr, NULL, &op) == 0) { if (!(op->mask & MNT_MFLAG)) continue; mnt_optent_get_flag(op, &flags); @@ -486,7 +487,7 @@ char *mnt_optls_create_mountdata(mnt_optls *ls) return NULL; mnt_reset_iter(&itr, MNT_ITER_FORWARD); - while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) { + while(mnt_optls_next_option(ls, &itr, NULL, &op) == 0) { if (!(op->mask & MNT_MDATA) && !mnt_optent_is_unknown(op)) continue; if (mnt_optstr_append_option(&optstr, @@ -523,7 +524,7 @@ char *mnt_optls_create_mtab_optstr(mnt_optls *ls) mnt_reset_iter(&itr, MNT_ITER_FORWARD); - while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) { + while(mnt_optls_next_option(ls, &itr, NULL, &op) == 0) { if (op->mask & MNT_NOMTAB) continue; if (mnt_optstr_append_option(&optstr, @@ -560,7 +561,7 @@ char *mnt_optls_create_userspace_optstr(mnt_optls *ls) return NULL; mnt_reset_iter(&itr, MNT_ITER_FORWARD); - while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) { + while(mnt_optls_next_option(ls, &itr, NULL, &op) == 0) { if (mnt_optent_is_unknown(op)) continue; if (op->mask & (MNT_MDATA | MNT_MFLAG | MNT_NOMTAB)) @@ -599,7 +600,7 @@ int mnt_optls_print_debug(mnt_optls *ls, FILE *file) mnt_reset_iter(&itr, MNT_ITER_FORWARD); fprintf(file, "--- opts: %p\n", ls); - while(mnt_optls_iterate_options(&itr, ls, NULL, &op) == 0) + while(mnt_optls_next_option(ls, &itr, NULL, &op) == 0) mnt_optent_print_debug(op, file); return 0; -- cgit v1.2.3 From 6bd8b7a79dffb532ae8639e563f75005a10bc41d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 13 Jan 2010 22:08:16 +0100 Subject: libmount: add fstab/mtab/mountinfo parsing routines Signed-off-by: Karel Zak --- shlibs/mount/src/Makefile.am | 9 +- shlibs/mount/src/cache.c | 10 +- shlibs/mount/src/mount.h.in | 36 ++ shlibs/mount/src/mountP.h | 28 ++ shlibs/mount/src/tab.c | 820 +++++++++++++++++++++++++++++++++++++++++++ shlibs/mount/src/tab_parse.c | 593 +++++++++++++++++++++++++++++++ 6 files changed, 1490 insertions(+), 6 deletions(-) create mode 100644 shlibs/mount/src/tab.c create mode 100644 shlibs/mount/src/tab_parse.c diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index de265c9d..5d80779e 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -13,7 +13,7 @@ libmount_la_SOURCES = $(mountinc_HEADERS) nodist_libmount_la_SOURCES = mount.h version.c utils.c test.c init.c cache.c \ optstr.c optmap.c optent.c optls.c iter.c list.h lock.c \ - fs.c \ + fs.c tab.c tab_parse.c \ $(top_srcdir)/lib/canonicalize.c libmount_la_LIBADD = $(ul_libblkid_la) @@ -42,7 +42,8 @@ uninstall-hook: rm -f $(DESTDIR)$(libdir)/libmount.so* # tests -noinst_PROGRAMS = test_version test_cache test_optstr test_optls test_lock +noinst_PROGRAMS = test_version test_cache test_optstr test_optls test_lock \ + test_tab tests_cppflags = $(AM_CPPFLAGS) -DTEST_PROGRAM tests_ldadd = .libs/libmount.a $(ul_libblkid_la) @@ -65,3 +66,7 @@ test_optls_LDADD = $(tests_ldadd) test_lock_SOURCES = lock.c test_lock_CPPFLAGS = $(tests_cppflags) test_lock_LDADD = $(tests_ldadd) + +test_tab_SOURCES = tab_parse.c tab.c +test_tab_CPPFLAGS = $(tests_cppflags) +test_tab_LDADD = $(tests_ldadd) diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c index 7b9040ff..18cf9fad 100644 --- a/shlibs/mount/src/cache.c +++ b/shlibs/mount/src/cache.c @@ -112,9 +112,6 @@ static int mnt_cache_add_entry(mnt_cache *cache, char *native, e->flag = flag; cache->nents++; - DBG(DEBUG_CACHE, - printf("cache: [%zd entry] added %s\n", cache->nents, real)); - return 0; } @@ -146,6 +143,8 @@ static int mnt_cache_add_tag(mnt_cache *cache, const char *token, if (mnt_cache_add_entry(cache, native, real, flag)) goto error; + DBG(DEBUG_CACHE, + printf("cache: added %s: %s=%s\n", real, token, value)); return 0; error: free(native); @@ -237,6 +236,9 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) if (!cache || !devname) return -1; + + DBG(DEBUG_CACHE, printf("cache: tags for %s requested\n", devname)); + /* check is device is already cached */ for (i = 0; i < cache->nents; i++) { struct mnt_cache_entry *e = &cache->ents[i]; @@ -352,7 +354,7 @@ char *mnt_resolve_path(const char *path, mnt_cache *cache) } } - DBG(DEBUG_CACHE, printf("cache: %s --> %s\n", path, p)); + DBG(DEBUG_CACHE, printf("cache: added %s: %s\n", path, p)); return p; error: if (real != native) diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index d179620c..b4c9bc53 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -95,6 +95,13 @@ struct mnt_optmap */ typedef struct _mnt_fs mnt_fs; +/** + * mnt_tab: + * + * List of mnt_fs entries (parsed fstab/mtab/mountinfo) + */ +typedef struct _mnt_tab mnt_tab; + /* version.c */ extern int mnt_parse_version_string(const char *ver_string); @@ -237,6 +244,35 @@ extern int mnt_fprintf_line( extern int mnt_fs_fprintf(mnt_fs *ent, FILE *f, const char *fmt); extern int mnt_fs_print_debug(mnt_fs *ent, FILE *file); +/* tab-parse.c */ +extern mnt_tab *mnt_new_tab_from_file(const char *filename); +extern int mnt_tab_parse_file(mnt_tab *tb); +extern char *mnt_tab_strerror(mnt_tab *tb, char *buf, size_t buflen); +extern int mnt_tab_get_nerrs(mnt_tab *tb); + +/* tab.c */ +extern mnt_tab *mnt_new_tab(const char *filename); +extern void mnt_free_tab(mnt_tab *tb); +extern int mnt_tab_get_nents(mnt_tab *tb); +extern int mnt_tab_set_cache(mnt_tab *tb, mnt_cache *mpc); +extern mnt_cache *mnt_tab_get_cache(mnt_tab *tb); +extern const char *mnt_tab_get_name(mnt_tab *tb); +extern int mnt_tab_add_fs(mnt_tab *tb, mnt_fs *fs); +extern int mnt_tab_remove_fs(mnt_tab *tb, mnt_fs *fs); +extern int mnt_tab_next_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs **fs); +extern int mnt_tab_set_iter(mnt_tab *tb, mnt_iter *itr, mnt_fs *fs); + +extern mnt_fs *mnt_tab_find_target(mnt_tab *tb, const char *path, int direction); +extern mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction); +extern mnt_fs *mnt_tab_find_tag(mnt_tab *tb, const char *tag, + const char *val, int direction); +extern mnt_fs *mnt_tab_find_source(mnt_tab *tb, const char *source, int direction); +extern mnt_fs *mnt_tab_find_pair(mnt_tab *tb, const char *srcpath, + const char *target, int direction); +extern int mnt_tab_fprintf(mnt_tab *tb, FILE *f, const char *fmt); +extern int mnt_tab_update_file(mnt_tab *tb); + + /* * mount(8) userspace options masks (MNT_MAP_USERSPACE map) */ diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index b6eb8cd3..f08f435a 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -35,6 +35,7 @@ #define DEBUG_CACHE (1 << 2) #define DEBUG_OPTIONS (1 << 3) #define DEBUG_LOCKS (1 << 4) +#define DEBUG_TAB (1 << 5) #define DEBUG_ALL 0xFFFF #ifdef CONFIG_LIBMOUNT_DEBUG @@ -162,6 +163,31 @@ struct _mnt_fs { #define MNT_FS_PSEUDO (1 << 2) /* pseudo filesystem */ #define MNT_FS_NET (1 << 3) /* network filesystem */ +/* + * File format + */ +enum { + MNT_FMT_FSTAB = 1, /* /etc/{fs,m}tab */ + MNT_FMT_MOUNTINFO /* /proc/#/mountinfo */ +}; + +/* + * mtab/fstab/mountinfo file + */ +struct _mnt_tab { + char *filename; /* file name or NULL */ + int fmt; /* MNT_FMT_* file format */ + + int nlines; /* number of lines in the file (include commentrys) */ + int nents; /* number of valid entries */ + int nerrs; /* number of broken entries (parse errors) */ + + mnt_cache *cache; /* canonicalized paths/tags cache */ + + struct list_head ents; /* list of entries (mentry) */ +}; + + /* optmap.c */ extern const struct mnt_optmap *mnt_optmap_get_entry(struct mnt_optmap const **maps, int nmaps, const char *name, @@ -189,4 +215,6 @@ extern int mnt_optent_assign_map(mnt_optent *op, extern int __mnt_fs_set_source(mnt_fs *fs, char *source); extern int __mnt_fs_set_fstype(mnt_fs *fs, char *fstype); + + #endif /* _LIBMOUNT_PRIVATE_H */ diff --git a/shlibs/mount/src/tab.c b/shlibs/mount/src/tab.c new file mode 100644 index 00000000..fd929313 --- /dev/null +++ b/shlibs/mount/src/tab.c @@ -0,0 +1,820 @@ +/* + * Copyright (C) 2008 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + * + * Note: + * mnt_tab_find_* functions are mount(8) compatible. It means it tries + * to found an entry in more iterations where the first attempt is always + * based on comparison with unmodified (non-canonicalized or un-evaluated) + * paths or tags. For example fstab with two entries: + * + * LABEL=foo /foo auto rw + * /dev/foo /foo auto rw + * + * where both lines are used for the *same* device, then + * + * mnt_tab_find_source(tb, "/dev/foo", &fs); + * + * will returns the second line, and + * + * mnt_tab_find_source(tb, "LABEL=foo", &fs); + * + * will returns the first entry, and + * + * mnt_tab_find_source(tb, "UUID=", &fs); + * + * will returns the first entry (if UUID matches with the device). + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nls.h" +#include "mountP.h" + +/** + * mnt_new_tab: + * @filename: file name or NULL + * + * The tab is a container for mnt_fs entries that usually represents a fstab, + * mtab or mountinfo file from your system. + * + * Note that this function does not parse the file. See also + * mnt_tab_parse_file(). + * + * Returns newly allocated tab struct. + */ +mnt_tab *mnt_new_tab(const char *filename) +{ + mnt_tab *tb = NULL; + + tb = calloc(1, sizeof(struct _mnt_tab)); + if (!tb) + goto err; + + if (filename) { + tb->filename = strdup(filename); + if (!tb->filename) + goto err; + } + INIT_LIST_HEAD(&tb->ents); + return tb; +err: + free(tb); + return NULL; +} + +/** + * mnt_free_tab: + * @tab: tab pointer + * + * Deallocates tab struct and all entries. + */ +void mnt_free_tab(mnt_tab *tb) +{ + if (!tb) + return; + free(tb->filename); + + while (!list_empty(&tb->ents)) { + mnt_fs *fs = list_entry(tb->ents.next, mnt_fs, ents); + mnt_free_fs(fs); + } + + free(tb); +} + +/** + * mnt_tab_get_nents: + * @tb: pointer to tab + * + * Returns number of valid entries in tab. + */ +int mnt_tab_get_nents(mnt_tab *tb) +{ + assert(tb); + return tb ? tb->nents : 0; +} + +/** + * mnt_tab_set_cache: + * @tb: pointer to tab + * @mpc: pointer to mnt_cache instance + * + * Setups a cache for canonicalized paths and evaluated tags (LABEL/UUID). The + * cache is recommended for mnt_tab_find_*() functions. + * + * The cache could be shared between more tabs. Be careful when you share the + * same cache between more threads -- currently the cache does not provide any + * locking method. + * + * See also mnt_new_cache(). + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_tab_set_cache(mnt_tab *tb, mnt_cache *mpc) +{ + assert(tb); + if (!tb) + return -1; + tb->cache = mpc; + return 0; +} + +/** + * mnt_tab_get_cache: + * @tb: pointer to tab + * + * Returns pointer to mnt_cache instance or NULL. + */ +mnt_cache *mnt_tab_get_cache(mnt_tab *tb) +{ + assert(tb); + return tb ? tb->cache : NULL; +} + +/** + * mnt_tab_get_name: + * @tb: tab pointer + * + * Returns tab filename or NULL. + */ +const char *mnt_tab_get_name(mnt_tab *tb) +{ + assert(tb); + return tb ? tb->filename : NULL; +} + +/** + * mnt_tab_add_fs: + * @tb: tab pointer + * @fs: new entry + * + * Adds a new entry to tab. + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_tab_add_fs(mnt_tab *tb, mnt_fs *fs) +{ + assert(tb); + assert(fs); + + if (!tb || !fs) + return -1; + + list_add_tail(&fs->ents, &tb->ents); + + DBG(DEBUG_TAB, fprintf(stderr, + "libmount: %s: add entry: %s %s\n", + tb->filename, mnt_fs_get_source(fs), + mnt_fs_get_target(fs))); + + if (fs->flags & MNT_FS_ERROR) + tb->nerrs++; + else + tb->nents++; + return 0; +} + +/** + * mnt_tab_remove_fs: + * @tb: tab pointer + * @fs: new entry + * + * Returns 0 on success or -1 in case of error. + */ +int mnt_tab_remove_fs(mnt_tab *tb, mnt_fs *fs) +{ + assert(tb); + assert(fs); + + if (!tb || !fs) + return -1; + + list_del(&fs->ents); + + if (fs->flags & MNT_FS_ERROR) + tb->nerrs--; + else + tb->nents--; + return 0; +} + +/** + * mnt_tab_next_fs: + * @tb: tab pointer + * @itr: iterator + * @fs: returns the next tab entry + * + * Returns 0 on success, -1 in case of error or 1 at end of list. + * + * Example (list all mountpoints from fstab in backward order): + * + * mnt_fs *fs; + * mnt_tab *tb = mnt_new_tab("/etc/fstab"); + * mnt_iter *itr = mnt_new_iter(MNT_ITER_BACKWARD); + * + * mnt_tab_parse_file(tb); + * + * while(mnt_tab_next_fs(tb, itr, &fs) == 0) { + * const char *dir = mnt_fs_get_target(fs); + * printf("mount point: %s\n", dir); + * } + * mnt_free_tab(fi); + */ +int mnt_tab_next_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs **fs) +{ + assert(tb); + assert(itr); + assert(fs); + + if (!tb || !itr || !fs) + return -1; +again: + if (!itr->head) + MNT_ITER_INIT(itr, &tb->ents); + if (itr->p != itr->head) { + MNT_ITER_ITERATE(itr, *fs, struct _mnt_fs, ents); + return 0; + } + + /* ignore broken entries */ + if (*fs && ((*fs)->flags & MNT_FS_ERROR)) + goto again; + + return 1; +} + +/** + * mnt_tab_set_iter: + * @tb: tab pointer + * @itr: iterator + * @fs: tab entry + * + * Sets @iter to the position of @fs in the file @tb. + * + * Returns 0 on success, -1 in case of error. + */ +int mnt_tab_set_iter(mnt_tab *tb, mnt_iter *itr, mnt_fs *fs) +{ + assert(tb); + assert(itr); + assert(fs); + + if (!tb || !itr || !fs) + return -1; + + MNT_ITER_INIT(itr, &tb->ents); + itr->p = &fs->ents; + + return 0; +} + +/** + * mnt_tab_find_target: + * @tb: tab pointer + * @path: mountpoint directory + * @direction: MNT_ITER_{FORWARD,BACKWARD} + * + * Try to lookup an entry in given tab, possible are three iterations, first + * with @path, second with realpath(@path) and third with realpath(@path) + * against realpath(fs->target). The 2nd and 3rd iterations are not performed + * when @tb cache is not set (see mnt_tab_set_cache()). + * + * Returns a tab entry or NULL. + */ +mnt_fs *mnt_tab_find_target(mnt_tab *tb, const char *path, int direction) +{ + mnt_iter itr; + mnt_fs *fs = NULL; + char *cn; + + assert(tb); + assert(path); + + DBG(DEBUG_TAB, fprintf(stderr, + "libmount: %s: lookup target: %s\n", tb->filename, path)); + + /* native @target */ + mnt_reset_iter(&itr, direction); + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) + if (fs->target && strcmp(fs->target, path) == 0) + return fs; + + if (!tb->cache || !(cn = mnt_resolve_path(path, tb->cache))) + return NULL; + + /* canonicalized paths in mnt_tab */ + mnt_reset_iter(&itr, direction); + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + if (fs->target && strcmp(fs->target, cn) == 0) + return fs; + } + + /* non-canonicaled path in mnt_tab */ + mnt_reset_iter(&itr, direction); + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + char *p; + if (!fs->target) + continue; + p = mnt_resolve_path(fs->target, tb->cache); + if (strcmp(cn, p) == 0) + return fs; + } + return NULL; +} + +/** + * mnt_tab_find_srcpath: + * @tb: tab pointer + * @path: source path (devname or dirname) + * @direction: MNT_ITER_{FORWARD,BACKWARD} + * + * Try to lookup an entry in given tab, possible are four iterations, first + * with @path, second with realpath(@path), third with tags (LABEL, UUID, ..) + * from @path and fourth with realpath(@path) against realpath(entry->srcpath). + * + * The 2nd, 3rd and 4th iterations are not performed when @tb cache is not + * set (see mnt_tab_set_cache()). + * + * Returns a tab entry or NULL. + */ +mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction) +{ + mnt_iter itr; + mnt_fs *fs = NULL; + int ntags = 0; + char *cn; + const char *p; + + assert(tb); + assert(path); + + DBG(DEBUG_TAB, fprintf(stderr, + "libmount: %s: lookup srcpath: %s\n", tb->filename, path)); + + /* native paths */ + mnt_reset_iter(&itr, direction); + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + p = mnt_fs_get_srcpath(fs); + if (p && strcmp(p, path) == 0) + return fs; + if (!p) + /* mnt_fs_get_srcpath() returs nothing, it's TAG */ + ntags++; + } + + if (!tb->cache || !(cn = mnt_resolve_path(path, tb->cache))) + return NULL; + + /* canonicalized paths in mnt_tab */ + if (ntags < mnt_tab_get_nents(tb)) { + mnt_reset_iter(&itr, direction); + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + p = mnt_fs_get_srcpath(fs); + if (p && strcmp(p, cn) == 0) + return fs; + } + } + + /* evaluated tag */ + if (ntags && mnt_cache_read_tags(tb->cache, cn) > 0) { + mnt_reset_iter(&itr, direction); + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + const char *t, *v; + + if (mnt_fs_get_tag(fs, &t, &v)) + continue; + + if (mnt_cache_device_has_tag(tb->cache, cn, t, v)) + return fs; + } + } + + /* non-canonicalized paths in mnt_tab */ + if (ntags <= mnt_tab_get_nents(tb)) { + mnt_reset_iter(&itr, direction); + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + p = mnt_fs_get_srcpath(fs); + if (p) + p = mnt_resolve_path(p, tb->cache); + if (p && strcmp(cn, p) == 0) + return fs; + } + } + + return NULL; +} + + +/** + * mnt_tab_find_tag: + * @tb: tab pointer + * @tag: tag name (e.g "LABEL", "UUID", ...) + * @val: tag value + * @direction: MNT_ITER_{FORWARD,BACKWARD} + * + * Try to lookup an entry in given tab, first attempt is lookup by @tag and + * @val, for the second attempt the tag is evaluated (converted to the device + * name) and mnt_tab_find_srcpath() is preformed. The second attempt is not + * performed when @tb cache is not set (see mnt_tab_set_cache()). + + * Returns a tab entry or NULL. + */ +mnt_fs *mnt_tab_find_tag(mnt_tab *tb, const char *tag, + const char *val, int direction) +{ + mnt_iter itr; + mnt_fs *fs = NULL; + + assert(tb); + assert(tag); + assert(val); + + if (!tb || !tag || !val) + return NULL; + + DBG(DEBUG_TAB, fprintf(stderr, + "libmount: %s: lookup by TAG: %s %s\n", tb->filename, tag, val)); + + /* look up by TAG */ + mnt_reset_iter(&itr, direction); + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + if (fs->tagname && fs->tagval && + strcmp(fs->tagname, tag) == 0 && + strcmp(fs->tagval, val) == 0) + return fs; + } + + if (tb->cache) { + /* look up by device name */ + char *cn = mnt_resolve_tag(tag, val, tb->cache); + if (cn) + return mnt_tab_find_srcpath(tb, cn, direction); + } + return NULL; +} + +/** + * mnt_tab_find_source: + * @tb: tab pointer + * @source: TAG or path + * + * This is high-level API for mnt_tab_find_{srcpath,tag}. You needn't to care + * about @source format (device, LABEL, UUID, ...). This function parses @source + * and calls mnt_tab_find_tag() or mnt_tab_find_srcpath(). + * + * Returns a tab entry or NULL. + */ +mnt_fs *mnt_tab_find_source(mnt_tab *tb, const char *source, int direction) +{ + mnt_fs *fs = NULL; + + assert(tb); + assert(source); + + if (!tb || !source) + return NULL; + + DBG(DEBUG_TAB, fprintf(stderr, + "libmount: %s: lookup SOURCE: %s\n", tb->filename, source)); + + if (strchr(source, '=')) { + char *tag, *val; + + if (blkid_parse_tag_string(source, &tag, &val) == 0) { + + fs = mnt_tab_find_tag(tb, tag, val, direction); + + free(tag); + free(val); + } + } else + fs = mnt_tab_find_srcpath(tb, source, direction); + + return fs; +} + +/** + * mnt_tab_find_pair: + * @tb: tab pointer + * @srcpath: canonicalized source path (devname or dirname) + * @target: canonicalized mountpoint + * @direction: MNT_ITER_{FORWARD,BACKWARD} + * + * Returns a tab entry or NULL. + */ +mnt_fs *mnt_tab_find_pair(mnt_tab *tb, const char *srcpath, + const char *target, int direction) +{ + mnt_iter itr; + mnt_fs *fs; + int has_tags = -1; + const char *p; + + assert(tb); + assert(srcpath); + assert(target); + + DBG(DEBUG_TAB, fprintf(stderr, + "libmount: %s: lookup pair: srcpath(%s) target(%s)\n", + tb->filename, srcpath, target)); + + /* native paths */ + mnt_reset_iter(&itr, direction); + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + if (!fs->target || strcmp(fs->target, target)) + continue; + p = mnt_fs_get_srcpath(fs); + if (p && strcmp(p, srcpath) == 0) + return fs; + } + + if (!tb->cache) + return NULL; + + mnt_reset_iter(&itr, direction); + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + const char *src; + + if (!fs->target) + continue; + + /* canonicalized or non-canonicalied target */ + if (strcmp(fs->target, target)) { + p = mnt_resolve_path(fs->target, tb->cache); + if (!p || strcmp(p, target)) + continue; + } + + src = mnt_fs_get_srcpath(fs); + if (src) { + /* canonicalized or non-canonicalied srcpath */ + if (strcmp(src, srcpath)) { + p = mnt_resolve_path(src, tb->cache); + if (!p || strcmp(p, srcpath)) + continue; + } + } else if (has_tags != 0) { + /* entry source is tag */ + const char *t, *v; + + if (mnt_fs_get_tag(fs, &t, &v)) + continue; + if (has_tags == -1 && + mnt_cache_read_tags(tb->cache, srcpath)) { + has_tags = 0; + continue; + } + has_tags = 1; + if (!mnt_cache_device_has_tag(tb->cache, srcpath, t, v)) + continue; + } else + continue; + + return fs; + } + return NULL; +} + +/** + * mnt_tab_fprintf: + * @f: FILE + * @fmt: per line printf-like format string (see MNT_MFILE_PRINTFMT) + * @tb: tab pointer + * + * Returns 0 on success, -1 in case of error. + */ +int mnt_tab_fprintf(mnt_tab *tb, FILE *f, const char *fmt) +{ + mnt_iter itr; + mnt_fs *fs; + + assert(f); + assert(fmt); + assert(tb); + + if (!f || !fmt || !tb) + return -1; + + mnt_reset_iter(&itr, MNT_ITER_FORWARD); + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + if (mnt_fs_fprintf(fs, f, fmt) == -1) + return -1; + } + + return 0; +} + +/** + * mnt_tab_update_file + * @tb: tab pointer + * + * Writes tab to disk. Don't forget to lock the file (see mnt_lock()). + * + * Returns 0 on success, -1 in case of error. + */ +int mnt_tab_update_file(mnt_tab *tb) +{ + FILE *f = NULL; + char tmpname[PATH_MAX]; + const char *filename; + struct stat st; + int fd; + + assert(tb); + if (!tb) + goto error; + + filename = mnt_tab_get_name(tb); + if (!filename) + goto error; + + if (snprintf(tmpname, sizeof(tmpname), "%s.tmp", filename) + >= sizeof(tmpname)) + goto error; + + f = fopen(tmpname, "w"); + if (!f) + goto error; + + if (mnt_tab_fprintf(tb, f, MNT_MFILE_PRINTFMT) != 0) + goto error; + + fd = fileno(f); + + if (fchmod(fd, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) + goto error; + + /* Copy uid/gid from the present file before renaming. */ + if (stat(filename, &st) == 0) { + if (fchown(fd, st.st_uid, st.st_gid) < 0) + goto error; + } + + fclose(f); + f = NULL; + + if (rename(tmpname, filename) < 0) + goto error; + + return 0; +error: + if (f) + fclose(f); + return -1; +} + +#ifdef TEST_PROGRAM +int test_strerr(struct mtest *ts, int argc, char *argv[]) +{ + char buf[BUFSIZ]; + mnt_tab *tb; + int i; + + tb = mnt_new_tab("-test-"); + if (!tb) + goto err; + + for (i = 0; i < 10; i++) { + mnt_fs *fs = mnt_new_fs(); + if (!fs) + goto err; + if (i % 2) + fs->flags |= MNT_FS_ERROR; /* mark entry as broken */ + fs->lineno = i+1; + mnt_tab_add_fs(tb, fs); + } + + printf("\tadded %d valid lines\n", mnt_tab_get_nents(tb)); + printf("\tadded %d broken lines\n", mnt_tab_get_nerrs(tb)); + + if (!mnt_tab_get_nerrs(tb)) /* report broken entries */ + goto err; + mnt_tab_strerror(tb, buf, sizeof(buf)); + printf("\t%s\n", buf); + + mnt_free_tab(tb); + return 0; +err: + return -1; +} + +mnt_tab *create_tab(const char *file) +{ + mnt_tab *tb; + + if (!file) + return NULL; + tb = mnt_new_tab(file); + if (!tb) + goto err; + if (mnt_tab_parse_file(tb) != 0) + goto err; + if (mnt_tab_get_nerrs(tb)) { + char buf[BUFSIZ]; + mnt_tab_strerror(tb, buf, sizeof(buf)); + fprintf(stderr, "%s\n", buf); + goto err; + } + return tb; +err: + mnt_free_tab(tb); + return NULL; +} + +int test_parse(struct mtest *ts, int argc, char *argv[]) +{ + mnt_tab *tb; + + tb = create_tab(argv[1]); + if (!tb) + return -1; + + mnt_tab_fprintf(tb, stdout, MNT_MFILE_PRINTFMT); + mnt_free_tab(tb); + return 0; +} + +int test_find(struct mtest *ts, int argc, char *argv[], int dr) +{ + mnt_tab *tb; + mnt_fs *fs = NULL; + mnt_cache *mpc; + const char *file, *find, *what; + + if (argc != 4) { + fprintf(stderr, "try --help\n"); + goto err; + } + + file = argv[1], find = argv[2], what = argv[3]; + + tb = create_tab(file); + if (!tb) + goto err; + + /* create a cache for canonicalized paths */ + mpc = mnt_new_cache(); + if (!mpc) + goto err; + mnt_tab_set_cache(tb, mpc); + + if (strcasecmp(find, "source") == 0) + fs = mnt_tab_find_source(tb, what, dr); + else if (strcasecmp(find, "target") == 0) + fs = mnt_tab_find_target(tb, what, dr); + + if (!fs) + fprintf(stderr, "%s: not found %s '%s'\n", file, find, what); + else { + const char *s = mnt_fs_get_srcpath(fs); + if (s) + printf("%s", s); + else { + const char *tag, *val; + mnt_fs_get_tag(fs, &tag, &val); + printf("%s=%s", tag, val); + } + printf("|%s|%s\n", mnt_fs_get_target(fs), + mnt_fs_get_optstr(fs)); + } + mnt_free_tab(tb); + mnt_free_cache(mpc); + return 0; +err: + return -1; +} + +int test_find_bw(struct mtest *ts, int argc, char *argv[]) +{ + return test_find(ts, argc, argv, MNT_ITER_BACKWARD); +} + +int test_find_fw(struct mtest *ts, int argc, char *argv[]) +{ + return test_find(ts, argc, argv, MNT_ITER_FORWARD); +} + +int main(int argc, char *argv[]) +{ + struct mtest tss[] = { + { "--strerror", test_strerr, " test tab error reporting" }, + { "--parse", test_parse, " parse and print tab" }, + { "--find-forward", test_find_fw, " " }, + { "--find-backward", test_find_bw, " " }, + { NULL } + }; + + return mnt_run_test(tss, argc, argv); +} + +#endif /* TEST_PROGRAM */ diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c new file mode 100644 index 00000000..feaab74a --- /dev/null +++ b/shlibs/mount/src/tab_parse.c @@ -0,0 +1,593 @@ +/* + * Copyright (C) 2009 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ + +#include +#include +#include +#include + +#include "nls.h" +#include "mountP.h" + +static inline char *skip_spaces(char *s) +{ + assert(s); + + while (*s == ' ' || *s == '\t') + s++; + return s; +} + +static inline char *skip_nonspaces(char *s) +{ + assert(s); + + while (*s && !(*s == ' ' || *s == '\t')) + s++; + return s; +} + +#define isoctal(a) (((a) & ~7) == '0') + +/* returns malloced pointer - no more strdup required */ +static void unmangle(char *s, char *buf, size_t len) +{ + size_t sz = 0; + assert(s); + + while(*s && sz < len - 1) { + if (*s == '\\' && sz + 4 < len - 1 && isoctal(s[1]) && + isoctal(s[2]) && isoctal(s[3])) { + + *buf++ = 64*(s[1] & 7) + 8*(s[2] & 7) + (s[3] & 7); + s += 4; + sz += 4; + } else { + *buf++ = *s++; + sz++; + } + } + *buf = '\0'; +} + +static size_t next_word_size(char *s, char **start, char **end) +{ + char *e; + + assert(s); + + s = skip_spaces(s); + if (!*s) + return 0; + e = skip_nonspaces(s); + + if (start) + *start = s; + if (end) + *end = e; + + return e - s; +} + +static char *next_word(char **s) +{ + size_t sz; + char *res, *end; + + assert(s); + + sz = next_word_size(*s, s, &end) + 1; + if (sz == 1) + return NULL; + + res = malloc(sz); + if (!res) + return NULL; + + unmangle(*s, res, sz); + *s = end + 1; + return res; +} + +static int next_word_skip(char **s) +{ + *s = skip_spaces(*s); + if (!**s) + return 1; + *s = skip_nonspaces(*s); + return 0; +} + +static int next_number(char **s, int *num) +{ + char *end = NULL; + + assert(num); + assert(s); + + *s = skip_spaces(*s); + if (!**s) + return -1; + *num = strtol(*s, &end, 10); + if (end == NULL || *s == end) + return -1; + + *s = end; + + /* valid end of number is space or terminator */ + if (*end == ' ' || *end == '\t' || *end == '\0') + return 0; + return -1; +} + +/* + * Parses one line from {fs,m}tab + */ +static int mnt_tab_parse_file_line(mnt_fs *fs, char *s) +{ + /* SOURCE */ + if (__mnt_fs_set_source(fs, next_word(&s)) != 0) + return 1; + + /* TARGET */ + fs->target = next_word(&s); + if (!fs->target) + return 1; + + /* TYPE */ + if (__mnt_fs_set_fstype(fs, next_word(&s)) != 0) + return 1; + + /* OPTS */ + fs->optstr = next_word(&s); + if (!fs->optstr) + return 1; + /* default */ + fs->passno = fs->freq = 0; + + /* FREQ (optional) */ + if (next_number(&s, &fs->freq) != 0) { + if (*s) + return 1; + + /* PASSNO (optional) */ + } else if (next_number(&s, &fs->passno) != 0 && *s) + return 1; + + return 0; +} + +/* + * Parses one line from mountinfo file + */ +static int mnt_parse_mountinfo_line(mnt_fs *fs, char *s) +{ + /* ID */ + if (next_number(&s, &fs->id) != 0) + return 1; + + /* PARENT */ + if (next_number(&s, &fs->parent) != 0) + return 1; + + /* : (ignore) */ + if (next_word_skip(&s) != 0) + return 1; + + /* MOUNTROOT */ + fs->mntroot = next_word(&s); + if (!fs->mntroot) + return 1; + + /* TARGET (mountpoit) */ + fs->target = next_word(&s); + if (!fs->target) + return 1; + + /* OPTIONS (fs-independent) */ + fs->vfs_optstr = next_word(&s); + if (!fs->vfs_optstr) + return 1; + + /* optional fields (ignore) */ + do { + s = skip_spaces(s); + if (s && *s == '-' && + (*(s + 1) == ' ' || *(s + 1) == '\t')) { + s++; + break; + } + if (s && next_word_skip(&s) != 0) + return 1; + } while (s); + + /* FSTYPE */ + if (__mnt_fs_set_fstype(fs, next_word(&s)) != 0) + return 1; + + /* SOURCE or "none" */ + if (__mnt_fs_set_source(fs, next_word(&s)) != 0) + return 1; + + /* OPTIONS (fs-dependent) */ + fs->fs_optstr = next_word(&s); + if (!fs->fs_optstr) + return 1; + + return 0; +} + +/* + * Returns {m,fs}tab or mountinfo file format (MNT_FMT_*) + * + * The "mountinfo" format is always: " ... " + */ +static int detect_fmt(char *line) +{ + int num; + + /* ID */ + if (next_number(&line, &num) != 0) + return MNT_FMT_FSTAB; + + /* PARENT */ + if (next_number(&line, &num) != 0) + return MNT_FMT_FSTAB; + + return MNT_FMT_MOUNTINFO; +} + + +/* + * Merges @vfs and @fs options strings into a new string + * This function skips the generic part of @fs options. + * For example (see "rw"): + * + * mnt_merge_optstr("rw,noexec", "rw,journal=update") + * + * returns --> "rw,noexec,journal=update" + * + * We need this function for /proc/self/mountinfo parsing. + */ +static char *merge_optstr(const char *vfs, const char *fs) +{ + const char *p1 = vfs, *p2 = fs; + char *res; + size_t sz; + + if (!vfs && !fs) + return NULL; + if (!vfs || !fs) + return strdup(fs ? fs : vfs); + if (!strcmp(vfs, fs)) + return strdup(vfs); /* e.g. "aaa" and "aaa" */ + + /* skip the same FS options */ + while (*p1 && *p2 && *++p1 == *++p2); + + if (*p1 == ',') + p1++; + if (*p2 == ',') + p2++; + if (!*p1 && !*p2) /* e.g. "aaa,bbb" and "aaa,bbb," */ + return strdup(vfs); + if (!*p1 || !*p2) /* e.g. "aaa" and "aaa,bbb" */ + return strdup(*p1 ? vfs : fs); + + p1 = vfs; + sz = strlen(p1) + strlen(p2) + 2; /* 2= separator + '\0' */ + + res = malloc(sz); + if (!res) + return NULL; + + snprintf(res, sz, "%s,%s", p1, p2); + return res; +} + +/* + * Read and parse the next line from {fs,m}tab or mountinfo + */ +static int mnt_tab_parse_next(mnt_tab *tb, FILE *f, mnt_fs *fs) +{ + char buf[BUFSIZ]; + char *s; + + assert(tb); + assert(f); + assert(fs); + + /* read the next non-blank non-comment line */ + do { + if (fgets(buf, sizeof(buf), f) == NULL) + return -1; + tb->nlines++; + s = index (buf, '\n'); + if (!s) { + /* Missing final newline? Otherwise extremely */ + /* long line - assume file was corrupted */ + if (feof(f)) { + DBG(DEBUG_TAB, fprintf(stderr, + "libmount: WARNING: no final newline at the end of %s\n", + tb->filename)); + s = index (buf, '\0'); + } else { + DBG(DEBUG_TAB, fprintf(stderr, + "libmount: %s: %d: missing newline at line\n", + tb->filename, tb->nlines)); + goto err; + } + } + *s = '\0'; + if (--s >= buf && *s == '\r') + *s = '\0'; + s = skip_spaces(buf); + } while (*s == '\0' || *s == '#'); + + DBG(DEBUG_TAB, fprintf(stderr, "libmount: %s:%d: %s\n", + tb->filename, tb->nlines, s)); + + if (!tb->fmt) + tb->fmt = detect_fmt(s); + + if (tb->fmt == MNT_FMT_FSTAB) { + /* parse /etc/{fs,m}tab */ + if (mnt_tab_parse_file_line(fs, s) != 0) + goto err; + } else if (tb->fmt == MNT_FMT_MOUNTINFO) { + /* parse /proc/self/mountinfo */ + if (mnt_parse_mountinfo_line(fs, s) != 0) + goto err; + } + + /* merge fs_optstr and vfs_optstr into optstr (necessary for "mountinfo") */ + if (!fs->optstr && (fs->vfs_optstr || fs->fs_optstr)) { + fs->optstr = merge_optstr(fs->vfs_optstr, fs->fs_optstr); + if (!fs->optstr) + goto err; + } + + fs->lineno = tb->nlines; + + DBG(DEBUG_TAB, fprintf(stderr, + "libmount: %s: %d: SOURCE:%s, MNTPOINT:%s, TYPE:%s, " + "OPTS:%s, FREQ:%d, PASSNO:%d\n", + tb->filename, fs->lineno, + fs->source, fs->target, fs->fstype, + fs->optstr, fs->freq, fs->passno)); + + return 0; +err: + /* we don't report parse errors to caller; caller has to check + * errors by mnt_tab_get_nerrs() or internaly by MNT_ENTRY_ERR flag + */ + fs->lineno = tb->nlines; + fs->flags |= MNT_FS_ERROR; + return 0; +} + +/** + * mnt_tab_parse_file: + * @tb: tab pointer + * + * Parses whole table (e.g. /etc/fstab). + * + * Returns 0 on success and -1 in case of error. The parse errors is possible + * to detect by mnt_tab_get_nerrs() and error message is possible to create by + * mnt_tab_strerror(). + * + * Example: + * + * mnt_tab *tb = mnt_new_tab("/etc/fstab"); + * int rc; + * + * rc = mnt_tab_parse_file(tb); + * if (rc) { + * if (mnt_tab_get_nerrs(tb)) { / * parse error * / + * mnt_tab_strerror(tb, buf, sizeof(buf)); + * fprintf(stderr, "%s: %s\n", progname, buf); + * } else + * perror(mnt_tab_get_name(tb)); / * system error * / + * } else + * mnt_fprintf_tab(tb, stdout, NULL); + * + * mnt_free_tab(tb); + */ +int mnt_tab_parse_file(mnt_tab *tb) +{ + FILE *f; + + assert(tb); + assert(tb->filename); + + if (!tb->filename) + return -1; + + f = fopen(tb->filename, "r"); + if (!f) + return -1; + + while (!feof(f)) { + int rc; + mnt_fs *fs = mnt_new_fs(); + if (!fs) + goto error; + + rc = mnt_tab_parse_next(tb, f, fs); + if (!rc) + rc = mnt_tab_add_fs(tb, fs); + else if (feof(f)) { + mnt_free_fs(fs); + break; + } + if (rc) { + mnt_free_fs(fs); + goto error; + } + } + + fclose(f); + return 0; +error: + fclose(f); + return -1; +} + +/** + * mnt_new_tab_parse: + * @filename: /etc/{m,fs}tab or /proc/self/mountinfo path + * + * Same as mnt_new_tab() + mnt_tab_parse_file(). Note that this function does + * not provide details (by mnt_tab_strerror()) about failed parsing -- so you + * should not to use this function for user-writeable files like /etc/fstab. + * + * Returns newly allocated tab on success and NULL in case of error. + */ +mnt_tab *mnt_new_tab_from_file(const char *filename) +{ + mnt_tab *tb; + + assert(filename); + + if (!filename) + return NULL; + tb = mnt_new_tab(filename); + if (tb && mnt_tab_parse_file(tb) != 0) { + mnt_free_tab(tb); + tb = NULL; + } + return tb; +} + +/** + * mnt_tab_get_nerrs: + * @tb: pointer to table + * + * Returns number of broken (parse error) entries in the table. + */ +int mnt_tab_get_nerrs(mnt_tab *tb) +{ + assert(tb); + return tb->nerrs; +} + +/** + * mnt_tab_strerror: + * @tb: pointer to table + * @buf: buffer to return error message + * @buflen: lenght of the buf + * + * Returns error message for table (file) parse errors. For example: + * + * "/etc/fstab: parse error at line(s): 1, 2 and 3." + */ +char *mnt_tab_strerror(mnt_tab *tb, char *buf, size_t buflen) +{ + struct list_head *p; + int last = -1; + char *b = buf; + char *end = buf + buflen - 1; + + assert(tb); + assert(buf); + assert(buflen); + + if (!tb || !tb->nerrs || !buf || buflen <=0) + return NULL; + + if (tb->filename) { + snprintf(b, end - b, "%s: ", tb->filename); + b += strnlen(b, end - b); + } + + if (tb->nerrs > 1) + strncpy(b, _("parse error at lines: "), end - b); + else + strncpy(b, _("parse error at line: "), end - b); + b += strnlen(b, end - b); + *b = '\0'; + + list_for_each(p, &tb->ents) { + mnt_fs *fs = list_entry(p, mnt_fs, ents); + if (b == end) + goto done; + if (fs->flags & MNT_FS_ERROR) { + if (last != -1) { + snprintf(b, end - b, "%d, ", last); + b += strnlen(b, end - b); + } + last = fs->lineno; + } + } + + if (tb->nerrs == 1) + snprintf(b, end - b, "%d.", last); + else + snprintf(b - 1, end - b, _(" and %d."), last); +done: + return buf; +} + +#ifdef LIBMOUNT_TEST_PROGRAM +int test_parse(struct mtest *ts, int argc, char *argv[]) +{ + mnt_tab *tb; + mnt_fs *fs; + mnt_iter *itr; + + if (argc != 2) + goto err; + + tb = mnt_new_tab(argv[1]); + if (!tb) + goto err; + if (mnt_tab_parse_file(tb) != 0) + goto err; + if (mnt_tab_get_nerrs(tb)) { + char buf[BUFSIZ]; + + mnt_tab_strerror(tb, buf, sizeof(buf)); + printf("\t%s\n", buf); + goto err; + } + + itr = mnt_new_iter(MNT_ITER_FORWARD); + if (!itr) + goto err; + while(mnt_tab_next_fs(tb, itr, &fs) == 0) { + const char *tg, *vl; + + if (mnt_fs_get_tag(fs, &tg, &vl) == 0) + printf("%s=%s", tg, vl); + else + printf("%s", mnt_fs_get_srcpath(fs)); + + printf("|%s|%s|%s|%d|%d|\n", + mnt_fs_get_target(fs), + mnt_fs_get_fstype(fs), + mnt_fs_get_optstr(fs), + mnt_fs_get_freq(fs), + mnt_fs_get_passno(fs)); + } + mnt_free_tab(tb); + mnt_free_iter(itr); + + return 0; +err: + return -1; +} + +int main(int argc, char *argv[]) +{ + struct mtest tss[] = { + { "--parse", test_parse, " parse the {fs,m}tab or mountinfo file" }, + { NULL } + }; + return mnt_run_test(tss, argc, argv); +} + +#endif /* LIBMOUNT_TEST_PROGRAM */ -- cgit v1.2.3 From abc9c0f79059fd017a2220975f105b17be26aab7 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 23 Feb 2010 15:04:52 +0100 Subject: libmount: add mnt_match_{fstype,options} functions Signed-off-by: Karel Zak --- shlibs/mount/src/Makefile.am | 6 +- shlibs/mount/src/mount.h.in | 2 + shlibs/mount/src/utils.c | 162 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 169 insertions(+), 1 deletion(-) diff --git a/shlibs/mount/src/Makefile.am b/shlibs/mount/src/Makefile.am index 5d80779e..4e17cfe1 100644 --- a/shlibs/mount/src/Makefile.am +++ b/shlibs/mount/src/Makefile.am @@ -43,7 +43,7 @@ uninstall-hook: # tests noinst_PROGRAMS = test_version test_cache test_optstr test_optls test_lock \ - test_tab + test_tab test_utils tests_cppflags = $(AM_CPPFLAGS) -DTEST_PROGRAM tests_ldadd = .libs/libmount.a $(ul_libblkid_la) @@ -70,3 +70,7 @@ test_lock_LDADD = $(tests_ldadd) test_tab_SOURCES = tab_parse.c tab.c test_tab_CPPFLAGS = $(tests_cppflags) test_tab_LDADD = $(tests_ldadd) + +test_utils_SOURCES = utils.c +test_utils_CPPFLAGS = $(tests_cppflags) +test_utils_LDADD = $(tests_ldadd) diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index b4c9bc53..6bea2a17 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -111,6 +111,8 @@ extern int mnt_get_library_version(const char **ver_string); extern int mnt_fstype_is_netfs(const char *type); extern int mnt_fstype_is_pseudofs(const char *type); extern int mnt_open_device(const char *devname, int flags); +extern int mnt_match_fstype(const char *type, const char *pattern); +extern int mnt_match_options(const char *optstr, const char *pattern); /* cache.c */ extern mnt_cache *mnt_new_cache(void); diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c index fbdfadb8..fb9ffe8d 100644 --- a/shlibs/mount/src/utils.c +++ b/shlibs/mount/src/utils.c @@ -128,6 +128,135 @@ int mnt_fstype_is_netfs(const char *type) return 0; } +/** + * mnt_match_fstype: + * @type: filesystem type + * @pattern: filesystem name or comma delimitted list of names + * + * The @pattern list of filesystem can be prefixed with a global + * "no" prefix to invert matching of the whole list. The "no" could + * also used for individual items in the @pattern list. + * + * "nofoo,bar" has the same meaning as "nofoo,nobar" + * + * "bar" : "nofoo,bar" -> False (global "no" prefix) + * "bar" : "foo,bar" -> True + * "bar" : "foo,nobar" -> False + * + * Returns: 1 if type is matching, else 0. This function also returns + * 0 if @pattern is NULL and @type is non-NULL. + */ +int mnt_match_fstype(const char *type, const char *pattern) +{ + int no = 0; /* negated types list */ + int len; + const char *p; + + if (!pattern && !type) + return 1; + if (!pattern) + return 0; + + if (!strncmp(pattern, "no", 2)) { + no = 1; + pattern += 2; + } + + /* Does type occur in types, separated by commas? */ + len = strlen(type); + p = pattern; + while(1) { + if (!strncmp(p, "no", 2) && !strncmp(p+2, type, len) && + (p[len+2] == 0 || p[len+2] == ',')) + return 0; + if (strncmp(p, type, len) == 0 && (p[len] == 0 || p[len] == ',')) + return !no; + p = strchr(p,','); + if (!p) + break; + p++; + } + return no; +} + + +/* Returns 1 if needle found or noneedle not found in haystack + * Otherwise returns 0 + */ +static int check_option(const char *haystack, size_t len, + const char *needle, size_t needle_len) +{ + const char *p; + int no = 0; + + if (needle_len >= 2 && !strncmp(needle, "no", 2)) { + no = 1; + needle += 2; + needle_len -= 2; + } + + for (p = haystack; p && p < haystack + len; p++) { + char *sep = strchr(p, ','); + size_t plen = sep ? sep - p : len - (p - haystack); + + if (plen == needle_len) { + if (!strncmp(p, needle, plen)) + return !no; /* foo or nofoo was found */ + } + p += plen; + } + + return no; /* foo or nofoo was not found */ +} + +/** + * mnt_match_options: + * @optstr: options string + * @pattern: comma delimitted list of options + * + * The "no" could used for individual items in the @options list. The "no" + * prefix does not have a global meanning. + * + * Unlike fs type matching, nonetdev,user and nonetdev,nouser have + * DIFFERENT meanings; each option is matched explicitly as specified. + * + * xxx,yyy,zzz : nozzz -> False + * xxx,yyy,zzz : xxx,noeee -> True + * + * Returns: 1 if pattern is matching, else 0. This function also returns 0 + * if @pattern is NULL and @optstr is non-NULL. + */ +int mnt_match_options(const char *optstr, const char *pattern) +{ + const char *p; + size_t len, optstr_len = 0; + + if (!pattern && !optstr) + return 1; + if (!pattern) + return 0; + + len = strlen(pattern); + if (optstr) + optstr_len = strlen(optstr); + + for (p = pattern; p < pattern + len; p++) { + char *sep = strchr(p, ','); + size_t plen = sep ? sep - p : len - (p - pattern); + + if (!plen) + continue; /* if two ',' appear in a row */ + + if (!check_option(optstr, optstr_len, p, plen)) + return 0; /* any match failure means failure */ + + p += plen; + } + + /* no match failures in list means success */ + return 1; +} + /* * Reallocates its first arg @s - typical use: s = mnt_strconcat3(s,t,u); * Returns reallocated @s ion succes or NULL in case of error. @@ -206,3 +335,36 @@ char *mnt_get_username(const uid_t uid) free(buf); return username; } + +#ifdef TEST_PROGRAM +int test_match_fstype(struct mtest *ts, int argc, char *argv[]) +{ + char *type = argv[1]; + char *pattern = argv[2]; + + printf("%s\n", mnt_match_fstype(type, pattern) ? "MATCH" : "NOT-MATCH"); + return 0; +} + +int test_match_options(struct mtest *ts, int argc, char *argv[]) +{ + char *optstr = argv[1]; + char *pattern = argv[2]; + + printf("%s\n", mnt_match_options(optstr, pattern) ? "MATCH" : "NOT-MATCH"); + return 0; +} + + +int main(int argc, char *argv[]) +{ + struct mtest tss[] = { + { "--match-fstype", test_match_fstype, " FS types matching" }, + { "--match-options", test_match_options, " options matching" }, + { NULL } + }; + + return mnt_run_test(tss, argc, argv); +} + +#endif /* TEST_PROGRAM */ -- cgit v1.2.3 From 3fca8422b154e047055ed938e81005ea6129d86a Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 1 Mar 2010 22:29:38 +0100 Subject: libmount: add fstab/mtab/mountinfo lookup routines Signed-off-by: Karel Zak --- shlibs/mount/src/cache.c | 3 +- shlibs/mount/src/fs.c | 149 ++++++++++++++++++++++++++++++++++++++++++ shlibs/mount/src/mount.h.in | 12 +++- shlibs/mount/src/mountP.h | 2 +- shlibs/mount/src/tab.c | 153 ++++++++++++++++++-------------------------- 5 files changed, 226 insertions(+), 93 deletions(-) diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c index 18cf9fad..b9d89f43 100644 --- a/shlibs/mount/src/cache.c +++ b/shlibs/mount/src/cache.c @@ -408,7 +408,8 @@ error: * @spec: path or tag * @cache: paths cache * - * Returns canonicalized path or NULL. + * Returns canonicalized path or NULL. The result has to be + * deallocated by free() if @cache is NULL. */ char *mnt_resolve_spec(const char *spec, mnt_cache *cache) { diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c index 0e12052d..01c2d027 100644 --- a/shlibs/mount/src/fs.c +++ b/shlibs/mount/src/fs.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "nls.h" @@ -415,6 +416,154 @@ int mnt_fs_get_option(mnt_fs *fs, const char *name, } +/** + * mnt_fs_match_target: + * @fs: filesystem + * @target: mountpoint path + * @cache: tags/paths cache or NULL + * + * Possible are three attempts: + * 1) compare @target with @fs->target + * 2) realpath(@target) with @fs->target + * 3) realpath(@target) with realpath(@fs->target). + * + * The 2nd and 3rd attempts are not performed when @cache is NULL. + * + * Returns 1 if @fs target is equal to @target else 0. + */ +int mnt_fs_match_target(mnt_fs *fs, const char *target, mnt_cache *cache) +{ + int rc = 0; + + if (!fs || !target || !fs->target) + return 0; + + /* 1) native paths */ + rc = !strcmp(target, fs->target); + + if (!rc && cache) { + /* 2) - canonicalized and non-canonicalized */ + char *cn = mnt_resolve_path(target, cache); + rc = (cn && strcmp(cn, fs->target) == 0); + + /* 3) - canonicalized and canonicalized */ + if (!rc && cn) { + char *tcn = mnt_resolve_path(fs->target, cache); + rc = (tcn && strcmp(cn, tcn) == 0); + } + } + + return rc; +} + +/** + * mnt_fs_match_source: + * @fs: filesystem + * @source: tag or path (device or so) + * @cache: tags/paths cache or NULL + * + * Possible are four attempts: + * 1) compare @source with @fs->source + * 2) compare realpath(@source) with @fs->source + * 3) compare realpath(@source) with realpath(@fs->source) + * 4) compare realpath(@source) with evaluated tag from @fs->source + * + * The 2nd, 3rd and 4th attempts are not performed when @cache is NULL. The + * 2nd and 3rd attempts are not performed if @fs->source is tag. + * + * Returns 1 if @fs source is equal to @source else 0. + */ +int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache) +{ + int rc = 0; + char *cn; + const char *src, *t, *v; + + if (!fs || !source || !fs->source) + return 0; + + /* 1) native paths/tags */ + rc = !strcmp(source, fs->source); + if (rc || !cache) + return rc; + + if (fs->flags & (MNT_FS_NET | MNT_FS_PSEUDO)) + return 0; + + cn = mnt_resolve_spec(source, cache); + if (!cn) + return 0; + + /* 2) canonicalized and native */ + src = mnt_fs_get_srcpath(fs); + if (src) + rc = !strcmp(cn, src); + + /* 3) canonicalized and canonicalized */ + if (src && !rc) { + src = mnt_resolve_path(src, cache); + rc = !strcmp(cn, src); + } + if (src && !rc) + /* fs->source is path and does not match with @source */ + return 0; + + if (mnt_fs_get_tag(fs, &t, &v)) + return 0; + + /* read @source's tags to the cache */ + if (mnt_cache_read_tags(cache, cn) < 1) { + if (errno == EACCES) { + /* we don't have permissions to read TAGs from + * @source, but can translate @fs tag to devname. + * + * (because libblkid uses udev symlinks and this is + * accessible for non-root uses) + */ + char *x = mnt_resolve_tag(t, v, cache); + if (x && !strcmp(x, cn)) + return 1; + } + return 0; + } + + /* 4) has the @source a tag that matches with tag from @fs ? */ + if (!mnt_cache_device_has_tag(cache, cn, t, v)) + return 0; + + return 1; +} + +/** + * mnt_fs_match_fstype: + * @fs: filesystem + * @types: filesystem name or comma delimited list of filesystems + * + * For more details see mnt_match_fstype(). + * + * Returns 1 if @fs type is matching to @types else 0. The function returns + * 0 when types is NULL. + */ +int mnt_fs_match_fstype(mnt_fs *fs, const char *types) +{ + return mnt_match_fstype(fs->fstype, types); +} + +/** + * mnt_fs_match_options: + * @fs: filesystem + * @options: comma delimited list of options (and nooptions) + * + * For more details see mnt_match_options(). + * + * Returns 1 if @fs type is matching to @options else 0. The function returns + * 0 when types is NULL. + */ +int mnt_fs_match_options(mnt_fs *fs, const char *options) +{ + return mnt_match_options(fs->optstr, options); +} + /* Unfortunately the classical Unix /etc/mtab and /etc/fstab do not handle directory names containing spaces. Here we mangle them, replacing a space by \040. diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 6bea2a17..04bbee96 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -230,6 +230,11 @@ extern int mnt_fs_set_passno(mnt_fs *ent, int passno); extern int mnt_fs_get_option(mnt_fs *ent, const char *name, char **value, size_t *valsz); +extern int mnt_fs_match_target(mnt_fs *fs, const char *target, mnt_cache *cache); +extern int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache); +extern int mnt_fs_match_fstype(mnt_fs *fs, const char *types); +extern int mnt_fs_match_options(mnt_fs *fs, const char *options); + /* mtab/fstab line */ #define MNT_MFILE_PRINTFMT "%s %s %s %s %d %d\n" @@ -269,8 +274,11 @@ extern mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction extern mnt_fs *mnt_tab_find_tag(mnt_tab *tb, const char *tag, const char *val, int direction); extern mnt_fs *mnt_tab_find_source(mnt_tab *tb, const char *source, int direction); -extern mnt_fs *mnt_tab_find_pair(mnt_tab *tb, const char *srcpath, - const char *target, int direction); + +extern int mnt_tab_find_next_fs(mnt_tab *tb, mnt_iter *itr, + int (*match_func)(mnt_fs *, void *), void *userdata, + mnt_fs **fs); + extern int mnt_tab_fprintf(mnt_tab *tb, FILE *f, const char *fmt); extern int mnt_tab_update_file(mnt_tab *tb); diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index f08f435a..3ba3205f 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -152,7 +152,7 @@ struct _mnt_fs { int freq; /* fstab[5]: dump frequency in days */ int passno; /* fstab[6]: pass number on parallel fsck */ - int flags; /* MNT_ENTRY_* flags */ + int flags; /* MNT_FS_* flags */ int lineno; /* line number in the parental file */ }; diff --git a/shlibs/mount/src/tab.c b/shlibs/mount/src/tab.c index fd929313..bfd3a6e1 100644 --- a/shlibs/mount/src/tab.c +++ b/shlibs/mount/src/tab.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -232,6 +233,8 @@ int mnt_tab_remove_fs(mnt_tab *tb, mnt_fs *fs) */ int mnt_tab_next_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs **fs) { + int rc; + assert(tb); assert(itr); assert(fs); @@ -239,17 +242,54 @@ int mnt_tab_next_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs **fs) if (!tb || !itr || !fs) return -1; again: + rc = 1; if (!itr->head) MNT_ITER_INIT(itr, &tb->ents); if (itr->p != itr->head) { MNT_ITER_ITERATE(itr, *fs, struct _mnt_fs, ents); - return 0; + rc = 0; } /* ignore broken entries */ if (*fs && ((*fs)->flags & MNT_FS_ERROR)) goto again; + return rc; +} + +/** + * mnt_tab_find_next_fs: + * @tb: table + * @itr: iterator + * @match_func: function returns 1 or 0 + * @fs: returns pointer to the next matching table entry + * + * This function allows search in @tb. + * + * Returns -1 in case of error, 1 at end of table or 0 o success. + */ +int mnt_tab_find_next_fs(mnt_tab *tb, mnt_iter *itr, + int (*match_func)(mnt_fs *, void *), void *userdata, + mnt_fs **fs) +{ + if (!tb || !itr || !fs || !match_func) + return -1; + + if (!itr->head) + MNT_ITER_INIT(itr, &tb->ents); + + do { + if (itr->p != itr->head) + MNT_ITER_ITERATE(itr, *fs, struct _mnt_fs, ents); + else + break; /* end */ + + if ((*fs)->flags & MNT_FS_ERROR) + continue; + if (match_func(*fs, userdata)) + return 0; + } while(1); + return 1; } @@ -386,16 +426,32 @@ mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction) } /* evaluated tag */ - if (ntags && mnt_cache_read_tags(tb->cache, cn) > 0) { + if (ntags) { mnt_reset_iter(&itr, direction); - while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { - const char *t, *v; - if (mnt_fs_get_tag(fs, &t, &v)) - continue; + if (mnt_cache_read_tags(tb->cache, cn) > 0) { + /* @path's TAGs are in the cache */ + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + const char *t, *v; - if (mnt_cache_device_has_tag(tb->cache, cn, t, v)) - return fs; + if (mnt_fs_get_tag(fs, &t, &v)) + continue; + + if (mnt_cache_device_has_tag(tb->cache, cn, t, v)) + return fs; + } + } else if (errno == EACCES) { + /* @path is unaccessible, try evaluate all TAGs in @tb + * by udev symlinks -- this could be expensive on systems + * with huge fstab/mtab */ + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + const char *t, *v, *x; + if (mnt_fs_get_tag(fs, &t, &v)) + continue; + x = mnt_resolve_tag(t, v, tb->cache); + if (x && !strcmp(x, cn)) + return fs; + } } } @@ -503,87 +559,6 @@ mnt_fs *mnt_tab_find_source(mnt_tab *tb, const char *source, int direction) return fs; } -/** - * mnt_tab_find_pair: - * @tb: tab pointer - * @srcpath: canonicalized source path (devname or dirname) - * @target: canonicalized mountpoint - * @direction: MNT_ITER_{FORWARD,BACKWARD} - * - * Returns a tab entry or NULL. - */ -mnt_fs *mnt_tab_find_pair(mnt_tab *tb, const char *srcpath, - const char *target, int direction) -{ - mnt_iter itr; - mnt_fs *fs; - int has_tags = -1; - const char *p; - - assert(tb); - assert(srcpath); - assert(target); - - DBG(DEBUG_TAB, fprintf(stderr, - "libmount: %s: lookup pair: srcpath(%s) target(%s)\n", - tb->filename, srcpath, target)); - - /* native paths */ - mnt_reset_iter(&itr, direction); - while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { - if (!fs->target || strcmp(fs->target, target)) - continue; - p = mnt_fs_get_srcpath(fs); - if (p && strcmp(p, srcpath) == 0) - return fs; - } - - if (!tb->cache) - return NULL; - - mnt_reset_iter(&itr, direction); - while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { - const char *src; - - if (!fs->target) - continue; - - /* canonicalized or non-canonicalied target */ - if (strcmp(fs->target, target)) { - p = mnt_resolve_path(fs->target, tb->cache); - if (!p || strcmp(p, target)) - continue; - } - - src = mnt_fs_get_srcpath(fs); - if (src) { - /* canonicalized or non-canonicalied srcpath */ - if (strcmp(src, srcpath)) { - p = mnt_resolve_path(src, tb->cache); - if (!p || strcmp(p, srcpath)) - continue; - } - } else if (has_tags != 0) { - /* entry source is tag */ - const char *t, *v; - - if (mnt_fs_get_tag(fs, &t, &v)) - continue; - if (has_tags == -1 && - mnt_cache_read_tags(tb->cache, srcpath)) { - has_tags = 0; - continue; - } - has_tags = 1; - if (!mnt_cache_device_has_tag(tb->cache, srcpath, t, v)) - continue; - } else - continue; - - return fs; - } - return NULL; -} /** * mnt_tab_fprintf: -- cgit v1.2.3 From b6bd3efde170ab25712f462c9863bfdad90afd0c Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 1 Mar 2010 22:31:51 +0100 Subject: libmount: update symbols table Signed-off-by: Karel Zak --- shlibs/mount/src/mount.sym | 114 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 112 insertions(+), 2 deletions(-) diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym index 0f2fc6b7..f37214a6 100644 --- a/shlibs/mount/src/mount.sym +++ b/shlibs/mount/src/mount.sym @@ -1,15 +1,125 @@ /* - * The symbol versioning ensures that a new application requiring symbol foo() - * can't run with old libblkid.so not providing foo() - the global SONAME + * The symbol versioning ensures that a new application requiring symbol foo; + * can't run with old libblkid.so not providing foo; * version info can't enforce this since we never change the SONAME. */ MOUNT_2.18 { global: + mnt_cache_device_has_tag; + mnt_cache_find_path; + mnt_cache_find_tag; + mnt_cache_read_tags; + mnt_fprintf_line; + mnt_free_cache; + mnt_free_fs; + mnt_free_iter; + mnt_free_lock; + mnt_free_optls; + mnt_free_tab; + mnt_fs_fprintf; + mnt_fs_get_freq; + mnt_fs_get_fstype; + mnt_fs_get_optfs; + mnt_fs_get_option; + mnt_fs_get_optstr; + mnt_fs_get_optvfs; + mnt_fs_get_passno; + mnt_fs_get_source; + mnt_fs_get_srcpath; + mnt_fs_get_tag; + mnt_fs_get_target; + mnt_fs_match_fstype; + mnt_fs_match_options; + mnt_fs_match_source; + mnt_fs_match_target; + mnt_fs_print_debug; + mnt_fs_set_freq; + mnt_fs_set_fstype; + mnt_fs_set_optstr; + mnt_fs_set_passno; + mnt_fs_set_source; + mnt_fs_set_target; mnt_fstype_is_netfs; mnt_fstype_is_pseudofs; + mnt_get_builtin_optmap; mnt_get_library_version; + mnt_lock_file; + mnt_lock_get_linkfile; + mnt_lock_get_lockfile; + mnt_match_fstype; + mnt_match_options; + mnt_new_cache; + mnt_new_fs; + mnt_new_iter; + mnt_new_lock; + mnt_new_optls; + mnt_new_tab; + mnt_new_tab_from_file; mnt_open_device; + mnt_optent_dup_value; + mnt_optent_get_flag; + mnt_optent_get_id; + mnt_optent_get_map; + mnt_optent_get_mapent; + mnt_optent_get_mask; + mnt_optent_get_name; + mnt_optent_get_type; + mnt_optent_get_value; + mnt_optent_has_value; + mnt_optent_is_inverted; + mnt_optent_is_unknown; + mnt_optent_print_debug; + mnt_optent_require_value; + mnt_optent_set_value; + mnt_optent_snprintf_value; + mnt_optent_strlen_value; + mnt_optent_strtol_value; + mnt_optent_strtoull_value; + mnt_optent_strtoul_value; + mnt_optls_add_builtin_map; + mnt_optls_add_map; + mnt_optls_add_option; + mnt_optls_create_mountdata; + mnt_optls_create_mountflags; + mnt_optls_create_mtab_optstr; + mnt_optls_create_userspace_optstr; + mnt_optls_get_ids; + mnt_optls_get_option; + mnt_optls_next_option; + mnt_optls_parse_optstr; + mnt_optls_print_debug; + mnt_optls_remove_option; + mnt_optls_remove_option_by_flags; + mnt_optls_remove_option_by_iflags; + mnt_optstr_append_option; + mnt_optstr_get_option; + mnt_optstr_next_option; + mnt_optstr_remove_option; + mnt_optstr_set_option; mnt_parse_version_string; + mnt_reset_iter; + mnt_resolve_path; + mnt_resolve_spec; + mnt_resolve_tag; + mnt_tab_add_fs; + mnt_tab_find_next_fs; + mnt_tab_find_source; + mnt_tab_find_srcpath; + mnt_tab_find_tag; + mnt_tab_find_target; + mnt_tab_fprintf; + mnt_tab_get_cache; + mnt_tab_get_name; + mnt_tab_get_nents; + mnt_tab_get_nerrs; + mnt_tab_next_fs; + mnt_tab_parse_file; + mnt_tab_remove_fs; + mnt_tab_set_cache; + mnt_tab_set_iter; + mnt_tab_strerror; + mnt_tab_update_file; + mnt_unlock_file; local: *; }; -- cgit v1.2.3 From 04fd7a9febad79917fbf98a618ef23dcb5a14fb1 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 1 Mar 2010 22:44:53 +0100 Subject: findmnt: add new command Signed-off-by: Karel Zak --- include/pathnames.h | 1 + misc-utils/.gitignore | 1 + misc-utils/Makefile.am | 4 +- misc-utils/findmnt.c | 431 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 436 insertions(+), 1 deletion(-) create mode 100644 misc-utils/findmnt.c diff --git a/include/pathnames.h b/include/pathnames.h index 7d57c528..c0572954 100644 --- a/include/pathnames.h +++ b/include/pathnames.h @@ -79,6 +79,7 @@ #define _PATH_PROC_MOUNTS "/proc/mounts" #define _PATH_PROC_PARTITIONS "/proc/partitions" #define _PATH_PROC_DEVICES "/proc/devices" +#define _PATH_PROC_MOUNTINFO "/proc/self/mountinfo" #define _PATH_SYS_BLOCK "/sys/block" diff --git a/misc-utils/.gitignore b/misc-utils/.gitignore index 5d34a50d..a39caaf3 100644 --- a/misc-utils/.gitignore +++ b/misc-utils/.gitignore @@ -17,3 +17,4 @@ uuidd findfs blkid wipefs +findmnt diff --git a/misc-utils/Makefile.am b/misc-utils/Makefile.am index c98107d6..218a2103 100644 --- a/misc-utils/Makefile.am +++ b/misc-utils/Makefile.am @@ -34,7 +34,7 @@ endif endif if BUILD_LIBBLKID -sbin_PROGRAMS += blkid findfs wipefs +sbin_PROGRAMS += blkid findfs wipefs findmnt dist_man_MANS += blkid.8 findfs.8 wipefs.8 blkid_SOURCES = blkid.c $(top_srcdir)/lib/ismounted.c \ $(top_srcdir)/lib/strtosize.c @@ -45,6 +45,8 @@ findfs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir) wipefs_SOURCES = wipefs.c $(top_srcdir)/lib/strtosize.c wipefs_LDADD = $(ul_libblkid_la) wipefs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir) +findmnt_LDADD = $(ul_libmount_la) +findmnt_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir) if HAVE_STATIC_BLKID sbin_PROGRAMS += blkid.static blkid_static_SOURCES = $(blkid_SOURCES) diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c new file mode 100644 index 00000000..04aadb77 --- /dev/null +++ b/misc-utils/findmnt.c @@ -0,0 +1,431 @@ +/* + * findmnt(8) + * + * Copyright (C) 2010 Red Hat, Inc. All rights reserved. + * Written by Karel Zak + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it would be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "pathnames.h" +#include "nls.h" + +/* + * Column IDs + */ +enum { + COL_SOURCE, + COL_TARGET, + COL_FSTYPE, + COL_OPTIONS, + COL_ISMOUNTED, + COL_LABEL, + COL_UUID, + + __NCOLUMNS +}; + +/* + * Column names + */ +const char *colnames[] = { + [COL_SOURCE] = "source", + [COL_TARGET] = "target", + [COL_FSTYPE] = "fstype", + [COL_OPTIONS] = "options", + [COL_ISMOUNTED] = "mounted", + [COL_LABEL] = "label", + [COL_UUID] = "uuid" +}; + +enum { + FL_EVALUATE = (1 << 1), + FL_CANONICALIZE = (1 << 2), + FL_FIRSTONLY = (1 << 3), + FL_INVERT = (1 << 4) +}; + +struct match_data { + const char *source; + const char *target; + const char *fstypes; + const char *options; +}; + +int flags; +int columns[ __NCOLUMNS ]; +int ncolumns; +mnt_cache *cache; + +/* + * converts @name to column ID + */ +static int get_column_id(const char *name, size_t namesz) +{ + int i; + + for (i = 0; i < __NCOLUMNS; i++) { + const char *cn = colnames[i]; + + if (!strncmp(name, cn, namesz) && !*(cn + namesz)) + return i; + } + + errx(EXIT_FAILURE, _("unknown column: %*s"), (int) namesz, name); + return -1; +} + +/* + * parses list of columns from @str and set column IDs to columns[] + */ +static int ctl_set_columns(const char *str) +{ + const char *begin = NULL, *end = NULL, *p; + + ncolumns = 0; + + if (!str || !*str) + return -1; + + p = str; + for (; p && *p; p++) { + if (!begin) + begin = p; /* begin of the column name */ + if (*p == ',') + end = p; /* terminate the name */ + if (*(p + 1) == '\0') + end = p + 1; /* end of string */ + if (!begin || !end) + continue; + if (end <= begin) + return -1; + + columns[ ncolumns++ ] = get_column_id(begin, end - begin); + } + return 0; +} + +static int print_column(mnt_fs *fs, int id) +{ + const char *str = NULL; + + if (!fs) + return -1; + + switch(id) { + case COL_SOURCE: + /* dir or dev */ + str = mnt_fs_get_source(fs); + + if (str && ((flags & FL_EVALUATE) || (flags & FL_CANONICALIZE))) + str = mnt_resolve_spec(str, cache); + break; + case COL_TARGET: + str = mnt_fs_get_target(fs); + break; + case COL_FSTYPE: + str = mnt_fs_get_fstype(fs); + break; + case COL_OPTIONS: + str = mnt_fs_get_optstr(fs); + break; + default: + return -1; + } + + if (str) + printf("%s", str); + return 0; +} + +static int print_fs(mnt_fs *fs) +{ + int i; + + for (i = 0; i < ncolumns; i++) { + print_column(fs, i); + printf("\t"); + } + printf("\n"); + return 0; +} + +static mnt_tab *parse_tabfile(const char *path) +{ + mnt_tab *tb = mnt_new_tab(path); + if (!tb) + return NULL; + + if (mnt_tab_parse_file(tb) != 0) + goto err; + + if (mnt_tab_get_nerrs(tb)) { + char buf[BUFSIZ]; + mnt_tab_strerror(tb, buf, sizeof(buf)); + warnx(_("%s: parse error: %s"), path, buf); + } + return tb; +err: + mnt_free_tab(tb); + err(EXIT_FAILURE, _("can't read: %s"), path); + + return NULL; +} + +static int match_func(mnt_fs *fs, void *data) +{ + struct match_data *m = (struct match_data *) data; + int rc = flags & FL_INVERT ? 1 : 0; + + /*fprintf(stderr, "source: %s : %s\n", m->source, mnt_fs_get_source(fs));*/ + + if (m->target && !mnt_fs_match_target(fs, m->target, cache)) + return rc; + if (m->source && !mnt_fs_match_source(fs, m->source, cache)) + return rc; + if (m->fstypes && !mnt_fs_match_fstype(fs, m->fstypes)) + return rc; + if (m->options && !mnt_fs_match_options(fs, m->options)) + return rc; + + return !rc; +} + +static inline int is_list_mode(struct match_data *m) +{ + return (!m->source && !m->target && !m->fstypes && !m->options); +} + +static inline int is_mount_mode(struct match_data *m, int fl) +{ + if (!m->source) + return 0; /* is required */ + if (m->fstypes || m->options) + return 0; /* cannot be restricted by -t or -O */ + if (!(fl & FL_FIRSTONLY)) + return 0; /* we have to return the first entry only */ + + return 1; /* ok */ +} + +static void __attribute__((__noreturn__)) usage(FILE *out) +{ + fprintf(out, _("Usage: %s [options] []\n\nOptions:\n"), + program_invocation_short_name); + + fprintf(out, _( + " -s, --fstab search in static table of filesystems\n" + " -m, --mtab search in table of mounted filesystems (default)\n" + " -k, --kernel search in kernel (mountinfo) file\n\n" + + " -c, --canonicalize canonicalize printed paths\n" + " -d, --direction search direction - 'forward' or 'backward'\n" + " -e, --evaluate print all TAGs (LABEL/UUID) evaluated\n" + " -h, --help print this help\n" + " -i, --invert invert sense of matching\n" + " -l, --first-only print the first found filesystem only\n" + " -o, --output output columns\n" + " -O, --options limit the set of filesystems by mount options\n" + " -t, --types limit the set of filesystem by FS types\n")); + + fprintf(out, _("\nFor more information see findmnt(1).\n")); + + exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); +} + +int main(int argc, char *argv[]) +{ + char *tabfile = NULL; + int direction = MNT_ITER_FORWARD, ct = 0; + mnt_tab *tb; + mnt_iter *itr; + mnt_fs *fs = NULL; + int c; + struct match_data mdata_buf, *mdata = &mdata_buf; + + struct option longopts[] = { + { "fstab", 0, 0, 's' }, + { "mtab", 0, 0, 'm' }, + { "kernel", 0, 0, 'k' }, + { "canonicalize", 0, 0, 'c' }, + { "direction", 1, 0, 'd' }, + { "evaluate", 0, 0, 'e' }, + { "help", 0, 0, 'h' }, + { "invert", 0, 0, 'i' }, + { "first-only", 0, 0, 'l' }, + { "output", 0, 0, 'o' }, + { "options", 1, 0, 'O' }, + { "types", 1, 0, 't' }, + { NULL, 0, 0, 0 } + }; + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + /* default */ + columns[ncolumns++] = COL_SOURCE; + columns[ncolumns++] = COL_TARGET; + columns[ncolumns++] = COL_FSTYPE; + columns[ncolumns++] = COL_OPTIONS; + + memset(mdata, 0, sizeof(*mdata)); + + while ((c = getopt_long(argc, argv, "cd:ehiloO:kmst:", longopts, NULL)) != -1) { + switch(c) { + case 'c': + flags |= FL_CANONICALIZE; + break; + case 'd': + if (!strcmp(optarg, _("forward"))) + direction = MNT_ITER_FORWARD; + else if (!strcmp(optarg, _("backward"))) + direction = MNT_ITER_BACKWARD; + else + errx(EXIT_FAILURE, + _("uknown direction '%s')"), optarg); + break; + case 'e': + flags |= FL_EVALUATE; + break; + case 'h': + usage(stdout); + break; + case 'i': + flags |= FL_INVERT; + break; + case 'l': + flags |= FL_FIRSTONLY; + break; + case 'o': + ctl_set_columns(optarg); + break; + case 'O': + mdata->options = optarg; + break; + case 'm': + if (tabfile) + errx(EXIT_FAILURE, _("--{fstab,mtab,kernel} " + "options are mutually exclusive")); + tabfile = _PATH_MOUNTED; + break; + case 's': + if (tabfile) + errx(EXIT_FAILURE, _("--{fstab,mtab,kernel} " + "options are mutually exclusive")); + tabfile = _PATH_MNTTAB; + break; + case 'k': + if (tabfile) + errx(EXIT_FAILURE, _("--{fstab,mtab,kernel} " + "options are mutually exclusive")); + tabfile = _PATH_PROC_MOUNTINFO; + break; + case 't': + mdata->fstypes = optarg; + break; + default: + usage(stderr); + break; + } + } + + if (!tabfile) + tabfile = _PATH_MOUNTED; + if (optind < argc) + /* dev, tag or mountpoint */ + mdata->source = argv[optind++]; + if (optind < argc) + /* mountpoint */ + mdata->target = argv[optind++]; + + tb = parse_tabfile(tabfile); + if (!tb) + return EXIT_FAILURE; + + itr = mnt_new_iter(direction); + if (!itr) + err(EXIT_FAILURE, _("failed to initialize libmount iterator")); + + cache = mnt_new_cache(); + if (!cache) + err(EXIT_FAILURE, _("failed to initialize libmount cache")); + + mnt_tab_set_cache(tb, cache); + + if (is_list_mode(mdata)) { + /* + * Print whole file + */ + while(mnt_tab_next_fs(tb, itr, &fs) == 0) { + print_fs(fs); + ct++; + if (flags & FL_FIRSTONLY) + break; + } + } else if (is_mount_mode(mdata, flags)) { + + /* + * Look up for FS in the same way how mount(8) searchs in fstab + * + * findmnt -l + */ + fs = mnt_tab_find_source(tb, mdata->source, direction); + if (!fs) + fs = mnt_tab_find_target(tb, mdata->source, direction); + if (fs) { + print_fs(fs); + ct++; + } + } else { + /* + * Look up for all matching entries + * + * findmnt [-l] [-O ] [-t ] + * findmnt [-l] [-O ] [-t ] + */ +again: + while (!mnt_tab_find_next_fs(tb, itr, + match_func, (void *) mdata, &fs)) { + print_fs(fs); + ct++; + if (flags & FL_FIRSTONLY) + break; + } + if (!ct && !mdata->target && mdata->source) { + /* swap 'spec' and target. */ + mdata->target = mdata->source; + mdata->source = NULL; + mnt_reset_iter(itr, direction); + goto again; + } + } + + mnt_free_tab(tb); + mnt_free_cache(cache); + mnt_free_iter(itr); + + return ct ? EXIT_SUCCESS : 2; +} -- cgit v1.2.3 From efe73c3ef120997c14ad95bf1857a044e99872b6 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 2 Mar 2010 22:34:56 +0100 Subject: libmount: read devno, ID and parent ID from /proc/self/mountinfo The patch also removes obsolete test program from tab_parse.c. Signed-off-by: Karel Zak --- shlibs/mount/src/fs.c | 54 ++++++++++++++++++++++++++++++----- shlibs/mount/src/mount.h.in | 3 ++ shlibs/mount/src/mount.sym | 3 ++ shlibs/mount/src/mountP.h | 1 + shlibs/mount/src/tab.c | 10 ++++++- shlibs/mount/src/tab_parse.c | 68 +++++--------------------------------------- 6 files changed, 70 insertions(+), 69 deletions(-) diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c index 01c2d027..fef61b0d 100644 --- a/shlibs/mount/src/fs.c +++ b/shlibs/mount/src/fs.c @@ -328,7 +328,7 @@ const char *mnt_fs_get_fs_optstr(mnt_fs *fs) /** * mnt_fs_get_vfs_optstr: - * @fs: fstab/mtab/mountinfo entry pointer + * @fs: fstab/mtab entry pointer * * This function works for "mountinfo" files only. * @@ -355,7 +355,7 @@ int mnt_fs_get_freq(mnt_fs *fs) /** * mnt_fs_set_freq: - * @fs: fstab/mtab/mountinfo entry pointer + * @fs: fstab/mtab entry pointer * @freq: dump frequency in days * * Returns 0 on success or -1 in case of error. @@ -363,7 +363,6 @@ int mnt_fs_get_freq(mnt_fs *fs) int mnt_fs_set_freq(mnt_fs *fs, int freq) { assert(fs); - if (!fs) return -1; fs->freq = freq; @@ -372,7 +371,7 @@ int mnt_fs_set_freq(mnt_fs *fs, int freq) /** * mnt_fs_get_passno: - * @fs: fstab/mtab/mountinfo entry pointer + * @fs: fstab/mtab entry pointer * * Returns "pass number on parallel fsck". */ @@ -384,7 +383,7 @@ int mnt_fs_get_passno(mnt_fs *fs) /** * mnt_fs_set_passno: - * @fs: fstab/mtab/mountinfo entry pointer + * @fs: fstab/mtab entry pointer * @passno: pass number * * Returns 0 on success or -1 in case of error. @@ -392,13 +391,50 @@ int mnt_fs_get_passno(mnt_fs *fs) int mnt_fs_set_passno(mnt_fs *fs, int passno) { assert(fs); - if (!fs) return -1; fs->passno = passno; return 0; } +/** + * mnt_fs_get_id: + * @fs: /proc/self/mountinfo entry + * + * Returns: mount ID (unique identifier of the mount) or -1 if ID undefined + * (for example if @fs is not mountinfo entry). + */ +int mnt_fs_get_id(mnt_fs *fs) +{ + assert(fs); + return fs ? fs->id : -1; +} + +/** + * mnt_fs_get_parent_id: + * @fs: /proc/self/mountinfo entry + * + * Returns: parent mount ID or -1 if ID undefined (for example if @fs is not + * mountinfo entry). + */ +int mnt_fs_get_parent_id(mnt_fs *fs) +{ + assert(fs); + return fs ? fs->parent : -1; +} + +/** + * mnt_fs_get_devno: + * @fs: /proc/self/mountinfo + * + * Returns: value of st_dev for files on filesystem or 0 in case of error. + */ +dev_t mnt_fs_get_devno(mnt_fs *fs) +{ + assert(fs); + return fs ? fs->devno : 0; +} + /** * mnt_fs_get_option: * @fs: fstab/mtab/mountinfo entry pointer @@ -415,7 +451,6 @@ int mnt_fs_get_option(mnt_fs *fs, const char *name, return optstr ? mnt_optstr_get_option(optstr, name, value, valsz) : 1; } - /** * mnt_fs_match_target: * @fs: filesystem @@ -689,6 +724,11 @@ int mnt_fs_print_debug(mnt_fs *fs, FILE *file) fprintf(file, "optstr: %s\n", mnt_fs_get_optstr(fs)); fprintf(file, "freq: %d\n", mnt_fs_get_freq(fs)); fprintf(file, "pass: %d\n", mnt_fs_get_passno(fs)); + fprintf(file, "id: %d\n", mnt_fs_get_id(fs)); + fprintf(file, "parent: %d\n", mnt_fs_get_parent_id(fs)); + fprintf(file, "devno: %d:%d\n", major(mnt_fs_get_devno(fs)), + minor(mnt_fs_get_devno(fs))); + return 0; } diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 04bbee96..8e71213a 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -227,6 +227,9 @@ extern int mnt_fs_get_freq(mnt_fs *ent); extern int mnt_fs_set_freq(mnt_fs *ent, int freq); extern int mnt_fs_get_passno(mnt_fs *ent); extern int mnt_fs_set_passno(mnt_fs *ent, int passno); +extern int mnt_fs_get_id(mnt_fs *fs); +extern int mnt_fs_get_parent_id(mnt_fs *fs); +extern dev_t mnt_fs_get_devno(mnt_fs *fs); extern int mnt_fs_get_option(mnt_fs *ent, const char *name, char **value, size_t *valsz); diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym index f37214a6..3bc32ecd 100644 --- a/shlibs/mount/src/mount.sym +++ b/shlibs/mount/src/mount.sym @@ -17,12 +17,15 @@ global: mnt_free_optls; mnt_free_tab; mnt_fs_fprintf; + mnt_fs_get_devno; mnt_fs_get_freq; mnt_fs_get_fstype; + mnt_fs_get_id; mnt_fs_get_optfs; mnt_fs_get_option; mnt_fs_get_optstr; mnt_fs_get_optvfs; + mnt_fs_get_parent_id; mnt_fs_get_passno; mnt_fs_get_source; mnt_fs_get_srcpath; diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index 3ba3205f..e92ba701 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -135,6 +135,7 @@ struct _mnt_fs { int id; /* mountinfo[1]: ID */ int parent; /* moutninfo[2]: parent */ + dev_t devno; /* moutninfo[3]: st_dev */ char *source; /* fstab[1]: mountinfo[10]: * source dev, file, dir or TAG */ diff --git a/shlibs/mount/src/tab.c b/shlibs/mount/src/tab.c index bfd3a6e1..2ae694b5 100644 --- a/shlibs/mount/src/tab.c +++ b/shlibs/mount/src/tab.c @@ -709,12 +709,20 @@ err: int test_parse(struct mtest *ts, int argc, char *argv[]) { mnt_tab *tb; + mnt_iter *itr; + mnt_fs *fs; tb = create_tab(argv[1]); if (!tb) return -1; - mnt_tab_fprintf(tb, stdout, MNT_MFILE_PRINTFMT); + itr = mnt_new_iter(MNT_ITER_FORWARD); + if (!itr) + goto err; + while(mnt_tab_next_fs(tb, itr, &fs) == 0) + mnt_fs_print_debug(fs, stdout); +err: + mnt_free_iter(itr); mnt_free_tab(tb); return 0; } diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c index feaab74a..f8d6680f 100644 --- a/shlibs/mount/src/tab_parse.c +++ b/shlibs/mount/src/tab_parse.c @@ -166,6 +166,8 @@ static int mnt_tab_parse_file_line(mnt_fs *fs, char *s) */ static int mnt_parse_mountinfo_line(mnt_fs *fs, char *s) { + unsigned int maj, min; + /* ID */ if (next_number(&s, &fs->id) != 0) return 1; @@ -174,9 +176,12 @@ static int mnt_parse_mountinfo_line(mnt_fs *fs, char *s) if (next_number(&s, &fs->parent) != 0) return 1; - /* : (ignore) */ - if (next_word_skip(&s) != 0) + /* : */ + s = skip_spaces(s); + if (!*s || sscanf(s, "%u:%u", &maj, &min) != 2) return 1; + fs->devno = makedev(maj, min); + next_word_skip(&s); /* MOUNTROOT */ fs->mntroot = next_word(&s); @@ -532,62 +537,3 @@ done: return buf; } -#ifdef LIBMOUNT_TEST_PROGRAM -int test_parse(struct mtest *ts, int argc, char *argv[]) -{ - mnt_tab *tb; - mnt_fs *fs; - mnt_iter *itr; - - if (argc != 2) - goto err; - - tb = mnt_new_tab(argv[1]); - if (!tb) - goto err; - if (mnt_tab_parse_file(tb) != 0) - goto err; - if (mnt_tab_get_nerrs(tb)) { - char buf[BUFSIZ]; - - mnt_tab_strerror(tb, buf, sizeof(buf)); - printf("\t%s\n", buf); - goto err; - } - - itr = mnt_new_iter(MNT_ITER_FORWARD); - if (!itr) - goto err; - while(mnt_tab_next_fs(tb, itr, &fs) == 0) { - const char *tg, *vl; - - if (mnt_fs_get_tag(fs, &tg, &vl) == 0) - printf("%s=%s", tg, vl); - else - printf("%s", mnt_fs_get_srcpath(fs)); - - printf("|%s|%s|%s|%d|%d|\n", - mnt_fs_get_target(fs), - mnt_fs_get_fstype(fs), - mnt_fs_get_optstr(fs), - mnt_fs_get_freq(fs), - mnt_fs_get_passno(fs)); - } - mnt_free_tab(tb); - mnt_free_iter(itr); - - return 0; -err: - return -1; -} - -int main(int argc, char *argv[]) -{ - struct mtest tss[] = { - { "--parse", test_parse, " parse the {fs,m}tab or mountinfo file" }, - { NULL } - }; - return mnt_run_test(tss, argc, argv); -} - -#endif /* LIBMOUNT_TEST_PROGRAM */ -- cgit v1.2.3 From e7462a881930a41ec84bf0661ff19f8fd1dfe7be Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 5 Mar 2010 10:52:59 +0100 Subject: libblkid: add mnt_iter_get_direction() Signed-off-by: Karel Zak --- shlibs/mount/src/iter.c | 17 ++++++++++++++++- shlibs/mount/src/mount.h.in | 1 + shlibs/mount/src/mount.sym | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/shlibs/mount/src/iter.c b/shlibs/mount/src/iter.c index d64f2d40..4baa7ffb 100644 --- a/shlibs/mount/src/iter.c +++ b/shlibs/mount/src/iter.c @@ -39,7 +39,7 @@ void mnt_free_iter(mnt_iter *itr) /** * mnt_reset_iter: * @itr: iterator pointer - * @direction: MNT_INTER_{FOR,BACK}WARD iterator direction + * @direction: MNT_INTER_{FOR,BACK}WARD or -1 to keep the derection unchanged * * Resets iterator. */ @@ -47,8 +47,23 @@ void mnt_reset_iter(mnt_iter *itr, int direction) { assert(itr); + if (direction == -1) + direction = itr->direction; + if (itr) { memset(itr, 0, sizeof(struct _mnt_iter)); itr->direction = direction; } } + +/** + * mnt_iter_get_direction: + * @itr: iterator pointer + * + * Returns: MNT_INTER_{FOR,BACK}WARD or -1 in case of error. + */ +int mnt_iter_get_direction(mnt_iter *itr) +{ + assert(itr); + return itr ? itr->direction : -1; +} diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 8e71213a..585b9fca 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -147,6 +147,7 @@ enum { extern mnt_iter *mnt_new_iter(int direction); extern void mnt_free_iter(mnt_iter *mi); extern void mnt_reset_iter(mnt_iter *mi, int direction); +extern int mnt_iter_get_direction(mnt_iter *itr); /* optmap.c */ enum { diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym index 3bc32ecd..6740bbcd 100644 --- a/shlibs/mount/src/mount.sym +++ b/shlibs/mount/src/mount.sym @@ -46,6 +46,7 @@ global: mnt_fstype_is_pseudofs; mnt_get_builtin_optmap; mnt_get_library_version; + mnt_iter_get_direction; mnt_lock_file; mnt_lock_get_linkfile; mnt_lock_get_lockfile; -- cgit v1.2.3 From 26b4f9e4551ca97334dd06114bf0f97a75c4ce81 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 9 Mar 2010 15:48:11 +0100 Subject: libmount: add support for userdata and work with VFS tree Signed-off-by: Karel Zak --- shlibs/mount/src/fs.c | 27 +++++++++++++ shlibs/mount/src/mount.h.in | 5 +++ shlibs/mount/src/mount.sym | 4 ++ shlibs/mount/src/mountP.h | 2 + shlibs/mount/src/tab.c | 92 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 130 insertions(+) diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c index fef61b0d..ae97b654 100644 --- a/shlibs/mount/src/fs.c +++ b/shlibs/mount/src/fs.c @@ -57,6 +57,33 @@ void mnt_free_fs(mnt_fs *fs) free(fs); } +/** + * mnt_fs_get_userdata: + * @fs: mnt_file instance + * + * Returns private data set by mnt_fs_set_userdata() or NULL. + */ +void *mnt_fs_get_userdata(mnt_fs *fs) +{ + return fs ? fs->userdata : NULL; +} + +/** + * mnt_fs_set_userdata: + * @fs: mnt_file instance + * + * The "userdata" are library independent data. + * + * Returns 0 or -1 in case of error (if @fs is NULL). + */ +int mnt_fs_set_userdata(mnt_fs *fs, void *data) +{ + if (!fs) + return -1; + fs->userdata = data; + return 0; +} + /** * mnt_fs_get_srcpath: * @fs: mnt_file (fstab/mtab/mountinfo) fs diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 585b9fca..4e918b83 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -212,6 +212,8 @@ extern int mnt_lock_file(mnt_lock *ml); /* fs.c */ extern mnt_fs *mnt_new_fs(void); extern void mnt_free_fs(mnt_fs *ent); +extern void *mnt_fs_get_userdata(mnt_fs *fs); +extern int mnt_fs_set_userdata(mnt_fs *fs, void *data); extern const char *mnt_fs_get_source(mnt_fs *ent); extern int mnt_fs_set_source(mnt_fs *ent, const char *source); extern const char *mnt_fs_get_srcpath(mnt_fs *ent); @@ -271,6 +273,9 @@ extern const char *mnt_tab_get_name(mnt_tab *tb); extern int mnt_tab_add_fs(mnt_tab *tb, mnt_fs *fs); extern int mnt_tab_remove_fs(mnt_tab *tb, mnt_fs *fs); extern int mnt_tab_next_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs **fs); +extern int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr, + mnt_fs *parent, mnt_fs **chld); +extern int mnt_tab_get_root_fs(mnt_tab *tb, mnt_fs **root); extern int mnt_tab_set_iter(mnt_tab *tb, mnt_iter *itr, mnt_fs *fs); extern mnt_fs *mnt_tab_find_target(mnt_tab *tb, const char *path, int direction); diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym index 6740bbcd..5df37796 100644 --- a/shlibs/mount/src/mount.sym +++ b/shlibs/mount/src/mount.sym @@ -31,6 +31,7 @@ global: mnt_fs_get_srcpath; mnt_fs_get_tag; mnt_fs_get_target; + mnt_fs_get_userdata; mnt_fs_match_fstype; mnt_fs_match_options; mnt_fs_match_source; @@ -42,6 +43,7 @@ global: mnt_fs_set_passno; mnt_fs_set_source; mnt_fs_set_target; + mnt_fs_set_userdata; mnt_fstype_is_netfs; mnt_fstype_is_pseudofs; mnt_get_builtin_optmap; @@ -116,6 +118,8 @@ global: mnt_tab_get_name; mnt_tab_get_nents; mnt_tab_get_nerrs; + mnt_tab_get_root_fs; + mnt_tab_next_child_fs; mnt_tab_next_fs; mnt_tab_parse_file; mnt_tab_remove_fs; diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index e92ba701..4b4e5b5b 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -155,6 +155,8 @@ struct _mnt_fs { int flags; /* MNT_FS_* flags */ int lineno; /* line number in the parental file */ + + void *userdata; /* library independent data */ }; /* diff --git a/shlibs/mount/src/tab.c b/shlibs/mount/src/tab.c index 2ae694b5..98c56602 100644 --- a/shlibs/mount/src/tab.c +++ b/shlibs/mount/src/tab.c @@ -209,6 +209,97 @@ int mnt_tab_remove_fs(mnt_tab *tb, mnt_fs *fs) return 0; } +/** + * mnt_tab_get_root_fs: + * @tb: mountinfo file (/proc/self/mountinfo) + * @root: returns pointer to the root filesystem (/) + * + * Returns: 0 on success or -1 case of error. + */ +int mnt_tab_get_root_fs(mnt_tab *tb, mnt_fs **root) +{ + mnt_iter itr; + mnt_fs *fs; + int root_id = 0; + + assert(tb); + assert(root); + + if (!tb || !root) + return -1; + + mnt_reset_iter(&itr, MNT_ITER_FORWARD); + while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { + int id = mnt_fs_get_parent_id(fs); + if (!id) + break; /* @tab is not mountinfo file? */ + + if (!*root || id < root_id) { + *root = fs; + root_id = id; + } + } + + return root_id ? 0 : -1; +} + +/** + * mnt_tab_next_child_fs: + * @tb: mountinfo file (/proc/self/mountinfo) + * @parent: parental FS + * @chld: returns the next child filesystem + * + * Note that filesystems are returned in the order how was mounted (according to + * IDs in /proc/self/mountinfo). + * + * Returns 0 on success, -1 in case of error or 1 at end of list. + */ +int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr, + mnt_fs *parent, mnt_fs **chld) +{ + mnt_fs *fs; + int parent_id, lastchld_id = 0, chld_id = 0; + + if (!tb || !itr || !parent) + return -1; + + parent_id = mnt_fs_get_id(parent); + if (!parent_id) + return -1; + + /* get ID of the previously returned child */ + if (itr->head && itr->p != itr->head) { + MNT_ITER_ITERATE(itr, fs, struct _mnt_fs, ents); + lastchld_id = mnt_fs_get_id(fs); + } + + *chld = NULL; + + mnt_reset_iter(itr, MNT_ITER_FORWARD); + while(mnt_tab_next_fs(tb, itr, &fs) == 0) { + int id; + + if (mnt_fs_get_parent_id(fs) != parent_id) + continue; + + id = mnt_fs_get_id(fs); + + if ((!lastchld_id || id > lastchld_id) && + (!*chld || id < chld_id)) { + *chld = fs; + chld_id = id; + } + } + + if (!chld_id) + return 1; /* end of iterator */ + + /* set the iterator to the @chld for the next call */ + mnt_tab_set_iter(tb, itr, *chld); + + return 0; +} + /** * mnt_tab_next_fs: * @tb: tab pointer @@ -290,6 +381,7 @@ int mnt_tab_find_next_fs(mnt_tab *tb, mnt_iter *itr, return 0; } while(1); + *fs = NULL; return 1; } -- cgit v1.2.3 From ba7232a1fe1398e7947d1af39fadc8d02b21bf69 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 12 Mar 2010 23:42:56 +0100 Subject: libmount: add mnt_cache_find_tag_value() Signed-off-by: Karel Zak --- shlibs/mount/src/cache.c | 35 +++++++++++++++++++++++++++++++++-- shlibs/mount/src/fs.c | 2 +- shlibs/mount/src/mount.h.in | 4 ++++ shlibs/mount/src/mount.sym | 1 + shlibs/mount/src/tab.c | 6 ++++-- 5 files changed, 43 insertions(+), 5 deletions(-) diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c index b9d89f43..62d514d8 100644 --- a/shlibs/mount/src/cache.c +++ b/shlibs/mount/src/cache.c @@ -220,7 +220,7 @@ const char *mnt_cache_find_tag(mnt_cache *cache, * * Reads @devname LABEL and UUID to the @cache. * - * Returns: 1 if at least on tag was added, 0 no tag was added or + * Returns: 0 if at least on tag was added, 1 if no tag was added or * -1 in case of error. */ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) @@ -289,7 +289,7 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) ntags++; } - return ntags ? 1 : 0; + return ntags ? 0 : 1; error: blkid_free_probe(pr); close(fd); @@ -317,6 +317,37 @@ int mnt_cache_device_has_tag(mnt_cache *cache, const char *devname, return 0; } +/** + * mnt_cache_find_tag_value: + * @cache: cache for results + * @devname: device name + * @token: tag name ("LABEL" or "UUID") + * + * Returns: LABEL or UUID for the @devname or NULL in case of error. + */ +char *mnt_cache_find_tag_value(mnt_cache *cache, + const char *devname, const char *token) +{ + int i; + + if (!cache || !devname || !token) + return NULL; + + if (mnt_cache_read_tags(cache, devname) != 0) + return NULL; + + for (i = 0; i < cache->nents; i++) { + struct mnt_cache_entry *e = &cache->ents[i]; + if (!(e->flag & MNT_CACHE_ISTAG)) + continue; + if (strcmp(e->real, devname) == 0 && /* dev name */ + strcmp(token, e->native) == 0) /* tag name */ + return e->native + strlen(token) + 1; /* tag value */ + } + + return NULL; +} + /** * mnt_resolve_path: * @path: "native" path diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c index ae97b654..aa38998b 100644 --- a/shlibs/mount/src/fs.c +++ b/shlibs/mount/src/fs.c @@ -574,7 +574,7 @@ int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache) return 0; /* read @source's tags to the cache */ - if (mnt_cache_read_tags(cache, cn) < 1) { + if (mnt_cache_read_tags(cache, cn) < 0) { if (errno == EACCES) { /* we don't have permissions to read TAGs from * @source, but can translate @fs tag to devname. diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 4e918b83..7d13e706 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -123,6 +123,10 @@ extern const char *mnt_cache_find_tag(mnt_cache *cache, extern int mnt_cache_read_tags(mnt_cache *cache, const char *devname); extern int mnt_cache_device_has_tag(mnt_cache *cache, const char *devname, const char *token, const char *value); + +extern char *mnt_cache_find_tag_value(mnt_cache *cache, + const char *devname, const char *token); + extern char *mnt_resolve_path(const char *path, mnt_cache *cache); extern char *mnt_resolve_tag(const char *token, const char *value, mnt_cache *cache); extern char *mnt_resolve_spec(const char *spec, mnt_cache *cache); diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym index 5df37796..358d7b73 100644 --- a/shlibs/mount/src/mount.sym +++ b/shlibs/mount/src/mount.sym @@ -8,6 +8,7 @@ global: mnt_cache_device_has_tag; mnt_cache_find_path; mnt_cache_find_tag; + mnt_cache_find_tag_value; mnt_cache_read_tags; mnt_fprintf_line; mnt_free_cache; diff --git a/shlibs/mount/src/tab.c b/shlibs/mount/src/tab.c index 98c56602..176a7d5a 100644 --- a/shlibs/mount/src/tab.c +++ b/shlibs/mount/src/tab.c @@ -519,9 +519,11 @@ mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction) /* evaluated tag */ if (ntags) { + int rc = mnt_cache_read_tags(tb->cache, cn); + mnt_reset_iter(&itr, direction); - if (mnt_cache_read_tags(tb->cache, cn) > 0) { + if (rc == 0) { /* @path's TAGs are in the cache */ while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { const char *t, *v; @@ -532,7 +534,7 @@ mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction) if (mnt_cache_device_has_tag(tb->cache, cn, t, v)) return fs; } - } else if (errno == EACCES) { + } else if (rc < 0 && errno == EACCES) { /* @path is unaccessible, try evaluate all TAGs in @tb * by udev symlinks -- this could be expensive on systems * with huge fstab/mtab */ -- cgit v1.2.3 From 9d67679b051aa920a75521a0edd06b1cdcc06b5b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 12 Mar 2010 23:45:45 +0100 Subject: findmnt: add tree support Signed-off-by: Karel Zak --- misc-utils/findmnt.c | 953 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 809 insertions(+), 144 deletions(-) diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index 04aadb77..0fdb16c9 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -26,91 +26,259 @@ #include #include #include - +#include +#ifdef HAVE_LANGINFO_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif #include +#include + #include "pathnames.h" #include "nls.h" +#include "widechar.h" +#include "c.h" -/* - * Column IDs - */ +/* flags */ +enum { + FL_EVALUATE = (1 << 1), + FL_CANONICALIZE = (1 << 2), + FL_FIRSTONLY = (1 << 3), + FL_INVERT = (1 << 4), + FL_NOHEADINGS = (1 << 5), + FL_NOSWAPMATCH = (1 << 6), + FL_TREE = (1 << 7), + FL_RAW = (1 << 8) +}; + +/* column IDs */ enum { COL_SOURCE, COL_TARGET, COL_FSTYPE, COL_OPTIONS, - COL_ISMOUNTED, COL_LABEL, COL_UUID, __NCOLUMNS }; -/* - * Column names - */ -const char *colnames[] = { - [COL_SOURCE] = "source", - [COL_TARGET] = "target", - [COL_FSTYPE] = "fstype", - [COL_OPTIONS] = "options", - [COL_ISMOUNTED] = "mounted", - [COL_LABEL] = "label", - [COL_UUID] = "uuid" +struct treenode { + mnt_fs *fs; /* filesystem */ + + struct treenode *parent; + struct treenode *first; /* first child */ + struct treenode *last; /* last child */ + + struct treenode *next; /* next node in the same level */ }; -enum { - FL_EVALUATE = (1 << 1), - FL_CANONICALIZE = (1 << 2), - FL_FIRSTONLY = (1 << 3), - FL_INVERT = (1 << 4) +/* column names */ +struct colinfo { + const char *name; /* header */ + double whint; /* width hint (N < 1 is in percent of termwidth) */ + int wrap; /* boolean (FALSE = truncate the column) */ + + int width; /* real column width */ + const char *match; /* pattern for match_func() */ }; -struct match_data { - const char *source; - const char *target; - const char *fstypes; - const char *options; +/* columns descriptions */ +struct colinfo infos[__NCOLUMNS] = { + [COL_SOURCE] = { "SOURCE", 0.25, TRUE }, + [COL_TARGET] = { "TARGET", 0.30, TRUE }, + [COL_FSTYPE] = { "FSTYPE", 0.10, FALSE }, + [COL_OPTIONS] = { "OPTIONS", 0.10, FALSE }, + [COL_LABEL] = { "LABEL", 0.10, TRUE }, + [COL_UUID] = { "UUID", 36, TRUE }, }; +struct treesym { + const char *branch; + const char *vert; + const char *right; +}; +const struct treesym ascii_tree_symbols = { + .branch = "|-", + .vert = "| ", + .right = "`-", +}; + +#ifdef HAVE_WIDECHAR + +#define mbs_width(_s) mbstowcs(NULL, _s, 0) + +#define UTF_V "\342\224\202" /* U+2502, Vertical line drawing char */ +#define UTF_VR "\342\224\234" /* U+251C, Vertical and right */ +#define UTF_H "\342\224\200" /* U+2500, Horizontal */ +#define UTF_UR "\342\224\224" /* U+2514, Up and right */ + +const struct treesym utf_tree_symbols = { + .branch = UTF_VR UTF_H, + .vert = UTF_V " ", + .right = UTF_UR UTF_H, +}; + +const struct treesym *tree_symbols = &utf_tree_symbols; + +#else /* !HAVE_WIDECHAR */ + +# define mbs_width strlen(_s) +const struct treesym *tree_symbols = &ascii_tree_symbols; + +#endif /* !HAVE_WIDECHAR */ + +/* global flags */ int flags; -int columns[ __NCOLUMNS ]; + +/* array IDs of with enabled columns */ +int columns[__NCOLUMNS]; int ncolumns; + +int termwidth; /* terminal width */ +char *treebuf; /* buffer for target column in tree mode */ + +/* libmount cache */ mnt_cache *cache; + +static inline int is_last_column(int num) +{ + return num + 1 == ncolumns; +} + +static inline int get_column_id(int num) +{ + int id; + assert(num < ncolumns); + + id = columns[num]; + assert(id < __NCOLUMNS); + return id; +} + +static inline struct colinfo *get_column_desc(int num) +{ + return &infos[ get_column_id(num) ]; +} + +static inline const char *column_id_to_name(int id) +{ + assert(id < __NCOLUMNS); + return infos[id].name; +} + +static inline const char *get_column_name(int num) +{ + return get_column_desc(num)->name; +} + +static inline float get_column_whint(int num) +{ + return get_column_desc(num)->whint; +} + +static inline int get_column_width(int num) +{ + return get_column_desc(num)->width; +} + +static inline void set_column_width(int num, int width) +{ + get_column_desc(num)->width = width; +} + +static inline int get_column_wrap(int num) +{ + return get_column_desc(num)->wrap; +} + +static inline const char *get_match(int id) +{ + assert(id < __NCOLUMNS); + return infos[id].match; +} + +static inline void set_match(int id, const char *match) +{ + assert(id < __NCOLUMNS); + infos[id].match = match; +} + +/* + * "findmnt" without any filter + */ +static inline int is_listall_mode(void) +{ + return (!get_match(COL_SOURCE) && + !get_match(COL_TARGET) && + !get_match(COL_FSTYPE) && + !get_match(COL_OPTIONS)); +} + +/* + * findmnt --first-only + * + * ... it works like "mount " + */ +static inline int is_mount_compatible_mode(void) +{ + if (!get_match(COL_SOURCE)) + return 0; /* is required */ + if (get_match(COL_FSTYPE) || get_match(COL_OPTIONS)) + return 0; /* cannot be restricted by -t or -O */ + if (!(flags & FL_FIRSTONLY)) + return 0; /* we have to return the first entry only */ + + return 1; /* ok */ +} + +static void set_all_columns_wrap(int set) +{ + int i; + + for (i = 0; i < __NCOLUMNS; i++) + infos[i].wrap = set; +} + /* * converts @name to column ID */ -static int get_column_id(const char *name, size_t namesz) +static int column_name_to_id(const char *name, size_t namesz) { int i; for (i = 0; i < __NCOLUMNS; i++) { - const char *cn = colnames[i]; + const char *cn = column_id_to_name(i); - if (!strncmp(name, cn, namesz) && !*(cn + namesz)) + if (!strncasecmp(name, cn, namesz) && !*(cn + namesz)) return i; } - errx(EXIT_FAILURE, _("unknown column: %*s"), (int) namesz, name); + errx(EXIT_FAILURE, _("unknown column: %s"), name); return -1; } /* - * parses list of columns from @str and set column IDs to columns[] + * parses list of columns from @str and add IDs to columns[] */ -static int ctl_set_columns(const char *str) +static int set_columns(const char *str) { - const char *begin = NULL, *end = NULL, *p; + const char *begin = NULL, *p; ncolumns = 0; if (!str || !*str) return -1; - p = str; - for (; p && *p; p++) { + ncolumns = 0; + + for (p = str; p && *p; p++) { + const char *end = NULL; + if (!begin) begin = p; /* begin of the column name */ if (*p == ',') @@ -122,28 +290,212 @@ static int ctl_set_columns(const char *str) if (end <= begin) return -1; - columns[ ncolumns++ ] = get_column_id(begin, end - begin); + columns[ ncolumns++ ] = column_name_to_id(begin, end - begin); + begin = NULL; + if (end && !*end) + break; } return 0; } -static int print_column(mnt_fs *fs, int id) +/* TODO: move to lib/terminal.c */ +static int terminal_get_width(void) { - const char *str = NULL; +#ifdef TIOCGSIZE + struct ttysize t_win; +#endif +#ifdef TIOCGWINSZ + struct winsize w_win; +#endif + const char *cp; - if (!fs) - return -1; +#ifdef TIOCGSIZE + if (ioctl (0, TIOCGSIZE, &t_win) == 0) + return t_win.ts_cols; +#endif +#ifdef TIOCGWINSZ + if (ioctl (0, TIOCGWINSZ, &w_win) == 0) + return w_win.ws_col; +#endif + cp = getenv("COLUMNS"); + if (cp) + return strtol(cp, NULL, 10); + return 80; +} - switch(id) { +static void recount_widths(void) +{ + int i, width = 0, ignore_wraps; + + /* set minimal width (= size of column header) */ + for (i = 0; i < ncolumns; i++) { + const char *name = get_column_name(i); + size_t len = mbs_width(name); + float hint = get_column_whint(i); + + if (get_column_width(i) < len) + /* enlarge to small columns */ + set_column_width(i, len); + + else if (hint >= 1) + /* set absolute widths */ + set_column_width(i, (int) hint); + } + + /* count used space */ + for (i = 0; i < ncolumns; i++) + width += get_column_width(i) + (is_last_column(i) ? 0 : 1); + + if (width == termwidth) + return; + + if (width < termwidth) { + /* cool, use the extra space for the last column */ + i = ncolumns - 1; + set_column_width(i, get_column_width(i) + (termwidth - width)); + + return; + } + + /* bad, we have to reduce output width, this is done in two steps: + * 1/ reduce columns with a relative width (see colinfo.whint) and + * without wrap flag (this columns could be truncated) + * 2) reduce columns with a relative width with wrap flag + */ + ignore_wraps = 1; + while(width > termwidth) { + int org = width; + for (i = ncolumns - 1; i >= 0 && width > termwidth; i--) { + float hint = get_column_whint(i); + int w = get_column_width(i); + + if (hint > 1) + /* never truncate columns with absolute sizes */ + continue; + + if (get_column_id(i) == COL_TARGET && (flags & FL_TREE)) + /* never truncate the tree */ + continue; + + if (ignore_wraps && get_column_wrap(i)) + continue; + + if (w > hint * termwidth) { + set_column_width(i, w - 1); + width--; + } + } + + if (org == width) { + if (ignore_wraps) + ignore_wraps = 0; + else + break; + } + } +/* + fprintf(stderr, "terminal: %d, output: %d\n", termwidth, width); + for (i = 0; i < ncolumns; i++) + fprintf(stderr, "width: %s=%d [%d]\n", + get_column_name(i), + get_column_width(i), + (int) (get_column_whint(i) * termwidth)); +*/ +} + +static char *get_treenode_ascii_art(struct treenode *node, + char *buf, size_t *bufsz) +{ + const char *sym; + size_t len; + + if (!node->parent) + return buf; + else { + buf = get_treenode_ascii_art(node->parent, buf, bufsz); + if (!buf) + return NULL; + sym = node->next ? tree_symbols->vert : " "; + } + len = strlen(sym); + + if (*bufsz < len) + return NULL; /* no space, internal error */ + + memcpy(buf, sym, len); + *bufsz -= len; + return buf + len; +} + +/* Returns LABEl or UUID */ +static const char *get_tag(mnt_fs *fs, const char *tagname) +{ + const char *t, *v, *res; + + if (!mnt_fs_get_tag(fs, &t, &v) && !strcmp(t, tagname)) + res = v; + else { + res = mnt_fs_get_source(fs); + if (res) + res = mnt_resolve_spec(res, cache); + if (res) + res = mnt_cache_find_tag_value(cache, res, tagname); + } + + return res; +} + +static const char *get_tree_target(mnt_fs *fs, char *buf, size_t bufsz) +{ + struct treenode *node; + const char *target; + char *p = buf; + + node = (struct treenode *) mnt_fs_get_userdata(fs); + if (!node) + return NULL; + + target = mnt_fs_get_target(fs); + if (!target) + return NULL; + + if (node->parent) { + p = get_treenode_ascii_art(node->parent, buf, &bufsz); + if (!p) + return NULL; + } + + if (node->next) + snprintf(p, bufsz, "%s%s", tree_symbols->branch, target); + else if (node->parent) + snprintf(p, bufsz, "%s%s", tree_symbols->right, target); + else + snprintf(p, bufsz, "%s", target); /* root node */ + + return buf; +} + +static const char *get_column_data(mnt_fs *fs, int num) +{ + const char *str = NULL; + + switch(get_column_id(num)) { case COL_SOURCE: /* dir or dev */ - str = mnt_fs_get_source(fs); + str = mnt_fs_get_srcpath(fs); - if (str && ((flags & FL_EVALUATE) || (flags & FL_CANONICALIZE))) - str = mnt_resolve_spec(str, cache); + if (str && (flags & FL_CANONICALIZE)) + str = mnt_resolve_path(str, cache); + if (!str) { + str = mnt_fs_get_source(fs); + + if (str && (flags & FL_EVALUATE)) + str = mnt_resolve_spec(str, cache); + } break; case COL_TARGET: - str = mnt_fs_get_target(fs); + str = flags & FL_TREE ? get_tree_target(fs, treebuf, termwidth) : + mnt_fs_get_target(fs); break; case COL_FSTYPE: str = mnt_fs_get_fstype(fs); @@ -151,25 +503,165 @@ static int print_column(mnt_fs *fs, int id) case COL_OPTIONS: str = mnt_fs_get_optstr(fs); break; + case COL_UUID: + str = get_tag(fs, "UUID"); + break; + case COL_LABEL: + str = get_tag(fs, "LABEL"); + break; default: - return -1; + break; } - if (str) - printf("%s", str); - return 0; + return str ? str : "-"; } -static int print_fs(mnt_fs *fs) +/* TODO: move to lib/mbalign.c */ +#ifdef HAVE_WIDECHAR +static size_t wc_truncate (wchar_t *wc, size_t width) +{ + size_t cells = 0; + int next_cells = 0; + + while (*wc) + { + next_cells = wcwidth (*wc); + if (next_cells == -1) /* non printable */ + { + *wc = 0xFFFD; /* L'\uFFFD' (replacement char) */ + next_cells = 1; + } + if (cells + next_cells > width) + break; + cells += next_cells; + wc++; + } + *wc = L'\0'; + return cells; +} +#endif + +/* TODO: move to lib/mbalign.c */ +static size_t mbs_truncate(char *str, size_t width) +{ + size_t bytes = strlen(str) + 1; +#ifdef HAVE_WIDECHAR + size_t sz = mbs_width(str); + wchar_t *wcs = NULL; + int rc = -1; + + if (sz <= width) + return sz; /* truncate is unnecessary */ + + if (sz == (size_t) -1) + goto done; + + wcs = malloc(sz * sizeof(wchar_t)); + if (!wcs) + goto done; + + if (!mbstowcs(wcs, str, sz)) + goto done; + rc = wc_truncate(wcs, width); + wcstombs(str, wcs, bytes); +done: + free(wcs); + return rc; +#else + if (width < bytes) { + str[width] = '\0'; + return width; + } + return bytes; /* truncate is unnecessary */ +#endif +} + +static void print_column_data(const char *data0, int num) +{ + size_t len, wrap, i; + int width; + char *data = (char *) data0; + + if (flags & FL_RAW) { + fputs(data, stdout); + if (!is_last_column(num)) + fputc(' ', stdout); + return; + } + + /* note that 'len' and 'width' is number of cells, not bytes */ + len = mbs_width(data); + + if (!len || len == (size_t) -1) { + len = 0; + data = NULL; + } + + width = get_column_width(num); + wrap = get_column_wrap(num); + + if (is_last_column(num) && len < width) + width = len; + + if (len > width && !wrap) { + data = strdup(data); + if (data) + len = mbs_truncate(data, width); + if (!data || len == (size_t) -1) { + len = 0; + data = NULL; + } + } + if (data) + fputs(data, stdout); + for (i = len; i < width; i++) /* padding */ + fputc(' ', stdout); + + if (!is_last_column(num)) { + if (len > width && wrap) { + fputc('\n', stdout); + + for (i = 0; i <= num; i++) + printf("%*s ", + -get_column_width(i), " "); + } else + fputc(' ', stdout); /* columns separator */ + } + if (data != data0) + free(data); +} + +static void print_fs(mnt_fs *fs, int line) { int i; + /* print header */ + if (!(flags & FL_NOHEADINGS) && !line) { + for (i = 0; i < ncolumns; i++) + print_column_data(get_column_name(i), i); + printf("\n"); + } + + /* print data */ for (i = 0; i < ncolumns; i++) { - print_column(fs, i); - printf("\t"); + const char *data = get_column_data(fs, i); + print_column_data(data, i); } printf("\n"); - return 0; +} + +static void set_widths(mnt_fs *fs) +{ + int i; + + for (i = 0; i < ncolumns; i++) { + const char *data = get_column_data(fs, i); + size_t len = data ? mbs_width(data) : 0; + int old = get_column_width(i); + + if (old < len) + set_column_width(i, len); + } } static mnt_tab *parse_tabfile(const char *path) @@ -196,46 +688,168 @@ err: static int match_func(mnt_fs *fs, void *data) { - struct match_data *m = (struct match_data *) data; int rc = flags & FL_INVERT ? 1 : 0; + const char *m; - /*fprintf(stderr, "source: %s : %s\n", m->source, mnt_fs_get_source(fs));*/ - - if (m->target && !mnt_fs_match_target(fs, m->target, cache)) + m = get_match(COL_TARGET); + if (m && !mnt_fs_match_target(fs, m, cache)) return rc; - if (m->source && !mnt_fs_match_source(fs, m->source, cache)) + + m = get_match(COL_SOURCE); + if (m && !mnt_fs_match_source(fs, m, cache)) return rc; - if (m->fstypes && !mnt_fs_match_fstype(fs, m->fstypes)) + + m = get_match(COL_FSTYPE); + if (m && !mnt_fs_match_fstype(fs, m)) return rc; - if (m->options && !mnt_fs_match_options(fs, m->options)) + + m = get_match(COL_OPTIONS); + if (m && !mnt_fs_match_options(fs, m)) return rc; return !rc; } -static inline int is_list_mode(struct match_data *m) +static mnt_fs *get_next_fs(mnt_tab *tb, mnt_iter *itr) { - return (!m->source && !m->target && !m->fstypes && !m->options); + mnt_fs *fs = NULL; + + if (is_listall_mode()) { + /* + * Print whole file + */ + mnt_tab_next_fs(tb, itr, &fs); + + } else if (is_mount_compatible_mode()) { + /* + * Look up for FS in the same way how mount(8) searchs in fstab + * + * findmnt -f + */ + fs = mnt_tab_find_source(tb, get_match(COL_SOURCE), + mnt_iter_get_direction(itr)); + if (!fs) + fs = mnt_tab_find_target(tb, get_match(COL_SOURCE), + mnt_iter_get_direction(itr)); + } else { + /* + * Look up for all matching entries + * + * findmnt [-l] [-O ] [-t ] + * findmnt [-l] [-O ] [-t ] + */ +again: + mnt_tab_find_next_fs(tb, itr, match_func, NULL, &fs); + + if (!fs && + !(flags & FL_NOSWAPMATCH) && + !get_match(COL_TARGET) && get_match(COL_SOURCE)) { + + /* swap 'spec' and target. */ + set_match(COL_TARGET, get_match(COL_SOURCE)); + set_match(COL_SOURCE, NULL); + mnt_reset_iter(itr, -1); + + goto again; + } + } + return fs; } -static inline int is_mount_mode(struct match_data *m, int fl) +static struct treenode *create_treenode(mnt_tab *tb, mnt_fs *fs) { - if (!m->source) - return 0; /* is required */ - if (m->fstypes || m->options) - return 0; /* cannot be restricted by -t or -O */ - if (!(fl & FL_FIRSTONLY)) - return 0; /* we have to return the first entry only */ + mnt_fs *chld = NULL; + mnt_iter *itr = NULL; + struct treenode *node = NULL; - return 1; /* ok */ + if (!fs) { + /* first call - start with root FS and initialize tree buffer */ + if (mnt_tab_get_root_fs(tb, &fs)) + goto err; + + treebuf = malloc(termwidth); + if (!treebuf) + goto err; + } + + itr = mnt_new_iter(MNT_ITER_FORWARD); + if (!itr) + goto err; + + node = calloc(1, sizeof(*node)); + if (!node) + goto err; + + node->fs = fs; + mnt_fs_set_userdata(fs, (void *) node); + + while(mnt_tab_next_child_fs(tb, itr, fs, &chld) == 0) { + struct treenode *chnode; + + chnode = create_treenode(tb, chld); + if (!chnode) + break; + + chnode->parent = node; + + if (node->last) + node->last->next = chnode; + else + node->first = chnode; + + node->last = chnode; + } + + return node; + +err: + if (!fs) + free(treebuf); + free(node); + mnt_free_iter(itr); + return NULL; +} + +static void print_treenode(struct treenode *node, int line) +{ + print_fs(node->fs, line++); + + /* print children */ + node = node->first; + while(node) { + print_treenode(node, line++); + node = node->next; + } +} + +static void free_treenode(struct treenode *node) +{ + struct treenode *chld = node->first; + + if (!node->parent) /* root node */ + free(treebuf); + + while(chld) { + struct treenode *next = chld->next; + free_treenode(chld); + chld = next; + } + + free(node); } -static void __attribute__((__noreturn__)) usage(FILE *out) +static int __attribute__((__noreturn__)) usage(FILE *out) { - fprintf(out, _("Usage: %s [options] []\n\nOptions:\n"), - program_invocation_short_name); + fprintf(out, _( + "\nUsage:\n" + " %1$s [options]\n" + " %1$s [options] | \n" + " %1$s [options] \n" + " %1$s [options] [--source ] [--target ]\n"), + program_invocation_short_name); fprintf(out, _( + "\nOptions:\n" " -s, --fstab search in static table of filesystems\n" " -m, --mtab search in table of mounted filesystems (default)\n" " -k, --kernel search in kernel (mountinfo) file\n\n" @@ -243,58 +857,85 @@ static void __attribute__((__noreturn__)) usage(FILE *out) " -c, --canonicalize canonicalize printed paths\n" " -d, --direction search direction - 'forward' or 'backward'\n" " -e, --evaluate print all TAGs (LABEL/UUID) evaluated\n" + " -f, --first-only print the first found filesystem only\n" " -h, --help print this help\n" " -i, --invert invert sense of matching\n" - " -l, --first-only print the first found filesystem only\n" - " -o, --output output columns\n" + " -l, --list use list format ouput\n" + " -n, --noheadings don't print headings\n" + " -u, --notruncate don't truncate text in columns\n" " -O, --options limit the set of filesystems by mount options\n" - " -t, --types limit the set of filesystem by FS types\n")); + " -o, --output output columns\n" + " -r, --raw use raw format output\n" + " -a, --ascii use ascii chars for tree formatting\n" + " -t, --types limit the set of filesystem by FS types\n" + " -S, --source device, LABEL= or UUID=device\n" + " -T, --target mountpoint\n\n")); fprintf(out, _("\nFor more information see findmnt(1).\n")); exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); } +static int __attribute__((__noreturn__)) +errx_mutually_exclusive(const char *opts) +{ + errx(EXIT_FAILURE, "%s %s", opts, _("options are mutually exclusive")); +} + int main(int argc, char *argv[]) { char *tabfile = NULL; - int direction = MNT_ITER_FORWARD, ct = 0; + int direction = MNT_ITER_FORWARD; mnt_tab *tb; mnt_iter *itr; mnt_fs *fs = NULL; - int c; - struct match_data mdata_buf, *mdata = &mdata_buf; + int c, ct = 0; struct option longopts[] = { - { "fstab", 0, 0, 's' }, - { "mtab", 0, 0, 'm' }, - { "kernel", 0, 0, 'k' }, + { "ascii", 0, 0, 'a' }, { "canonicalize", 0, 0, 'c' }, { "direction", 1, 0, 'd' }, { "evaluate", 0, 0, 'e' }, + { "first-only", 0, 0, 'f' }, + { "fstab", 0, 0, 's' }, { "help", 0, 0, 'h' }, { "invert", 0, 0, 'i' }, - { "first-only", 0, 0, 'l' }, - { "output", 0, 0, 'o' }, + { "kernel", 0, 0, 'k' }, + { "list", 0, 0, 'l' }, + { "mtab", 0, 0, 'm' }, + { "noheadings", 0, 0, 'n' }, + { "notruncate", 0, 0, 'u' }, { "options", 1, 0, 'O' }, + { "output", 1, 0, 'o' }, + { "raw", 0, 0, 'r' }, { "types", 1, 0, 't' }, + { "source", 1, 0, 'S' }, + { "target", 1, 0, 'T' }, + { NULL, 0, 0, 0 } }; + assert(ARRAY_SIZE(columns) == __NCOLUMNS); + setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - /* default */ - columns[ncolumns++] = COL_SOURCE; + /* default enabled columns */ columns[ncolumns++] = COL_TARGET; + columns[ncolumns++] = COL_SOURCE; columns[ncolumns++] = COL_FSTYPE; columns[ncolumns++] = COL_OPTIONS; - memset(mdata, 0, sizeof(*mdata)); + /* default output format */ + flags |= FL_TREE; - while ((c = getopt_long(argc, argv, "cd:ehiloO:kmst:", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, + "cd:ehifo:O:klmnrst:uS:T:", longopts, NULL)) != -1) { switch(c) { + case 'a': + tree_symbols = &ascii_tree_symbols; + break; case 'c': flags |= FL_CANONICALIZE; break; @@ -316,35 +957,61 @@ int main(int argc, char *argv[]) case 'i': flags |= FL_INVERT; break; - case 'l': + case 'f': flags |= FL_FIRSTONLY; break; + case 'u': + set_all_columns_wrap(TRUE); + break; case 'o': - ctl_set_columns(optarg); + set_columns(optarg); break; case 'O': - mdata->options = optarg; + set_match(COL_OPTIONS, optarg); break; case 'm': if (tabfile) - errx(EXIT_FAILURE, _("--{fstab,mtab,kernel} " - "options are mutually exclusive")); + errx_mutually_exclusive("--{fstab,mtab,kernel}"); tabfile = _PATH_MOUNTED; + flags &= ~FL_TREE; /* disable the default */ break; case 's': if (tabfile) - errx(EXIT_FAILURE, _("--{fstab,mtab,kernel} " - "options are mutually exclusive")); + errx_mutually_exclusive("--{fstab,mtab,kernel}"); tabfile = _PATH_MNTTAB; + flags &= ~FL_TREE; /* disable the default */ break; case 'k': if (tabfile) - errx(EXIT_FAILURE, _("--{fstab,mtab,kernel} " - "options are mutually exclusive")); + errx_mutually_exclusive("--{fstab,mtab,kernel}"); tabfile = _PATH_PROC_MOUNTINFO; break; case 't': - mdata->fstypes = optarg; + set_match(COL_FSTYPE, optarg); + break; + case 'r': + if (!(flags & FL_TREE) && !(flags & FL_RAW)) + errx_mutually_exclusive("--{raw,list}"); + + flags &= ~FL_TREE; /* disable the default */ + flags |= FL_RAW; /* enable raw */ + break; + case 'l': + if (flags & FL_RAW) + errx_mutually_exclusive("--{raw,list}"); + + flags &= ~FL_TREE; /* disable the default */ + break; + case 'n': + flags |= FL_NOHEADINGS; + break; + case 'S': + set_match(COL_SOURCE, optarg); + flags |= FL_NOSWAPMATCH; + break; + case 'T': + set_match(COL_TARGET, optarg); + flags |= FL_NOSWAPMATCH; break; default: usage(stderr); @@ -353,13 +1020,24 @@ int main(int argc, char *argv[]) } if (!tabfile) - tabfile = _PATH_MOUNTED; + tabfile = _PATH_PROC_MOUNTINFO; + +#ifdef HAVE_WIDECHAR + /* non-UTF terminal */ + if ((flags & FL_TREE) && tree_symbols != &ascii_tree_symbols && + strcmp(nl_langinfo(CODESET), "UTF-8")) + tree_symbols = &ascii_tree_symbols; +#endif + + if (optind < argc && (get_match(COL_SOURCE) || get_match(COL_TARGET))) + errx(EXIT_FAILURE, _( + "options --target and --source can't be used together " + "with command line element that is not an option")); + if (optind < argc) - /* dev, tag or mountpoint */ - mdata->source = argv[optind++]; + set_match(COL_SOURCE, argv[optind++]); /* dev/tag/mountpoint */ if (optind < argc) - /* mountpoint */ - mdata->target = argv[optind++]; + set_match(COL_TARGET, argv[optind++]); /* mountpoint */ tb = parse_tabfile(tabfile); if (!tb) @@ -375,54 +1053,41 @@ int main(int argc, char *argv[]) mnt_tab_set_cache(tb, cache); - if (is_list_mode(mdata)) { - /* - * Print whole file - */ - while(mnt_tab_next_fs(tb, itr, &fs) == 0) { - print_fs(fs); - ct++; - if (flags & FL_FIRSTONLY) - break; - } - } else if (is_mount_mode(mdata, flags)) { + termwidth = terminal_get_width(); - /* - * Look up for FS in the same way how mount(8) searchs in fstab - * - * findmnt -l - */ - fs = mnt_tab_find_source(tb, mdata->source, direction); - if (!fs) - fs = mnt_tab_find_target(tb, mdata->source, direction); - if (fs) { - print_fs(fs); + if (flags & FL_TREE) { + struct treenode *tree = create_treenode(tb, NULL); + if (!tree) + err(EXIT_FAILURE, _("failed to create tree")); + + while (mnt_tab_next_fs(tb, itr, &fs) == 0) { + set_widths(fs); ct++; } + recount_widths(); + print_treenode(tree, 0); + free_treenode(tree); } else { - /* - * Look up for all matching entries - * - * findmnt [-l] [-O ] [-t ] - * findmnt [-l] [-O ] [-t ] - */ -again: - while (!mnt_tab_find_next_fs(tb, itr, - match_func, (void *) mdata, &fs)) { - print_fs(fs); - ct++; + /* set width */ + + if (!(flags & FL_RAW)) { + while((fs = get_next_fs(tb, itr))) { + set_widths(fs); + if (flags & FL_FIRSTONLY) + break; + } + ct = 0; + mnt_reset_iter(itr, -1); + recount_widths(); + } + + /* Print */ + while((fs = get_next_fs(tb, itr))) { + print_fs(fs, ct++); if (flags & FL_FIRSTONLY) break; } - if (!ct && !mdata->target && mdata->source) { - /* swap 'spec' and target. */ - mdata->target = mdata->source; - mdata->source = NULL; - mnt_reset_iter(itr, direction); - goto again; - } } - mnt_free_tab(tb); mnt_free_cache(cache); mnt_free_iter(itr); -- cgit v1.2.3 From c391642d0f4e554fbc3e256dff90fa771612e517 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 6 Apr 2010 14:50:47 +0200 Subject: include: move shlibs/.../list.h to the include/ directory Signed-off-by: Karel Zak --- include/Makefile.am | 1 + include/list.h | 197 ++++++++++++++++++++++++++++++++++++++++++++++++ shlibs/blkid/src/list.h | 179 ------------------------------------------- shlibs/mount/src/list.h | 179 ------------------------------------------- 4 files changed, 198 insertions(+), 358 deletions(-) create mode 100644 include/list.h delete mode 100644 shlibs/blkid/src/list.h delete mode 100644 shlibs/mount/src/list.h diff --git a/include/Makefile.am b/include/Makefile.am index 067523d7..d4d00727 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -11,6 +11,7 @@ dist_noinst_HEADERS = \ ismounted.h \ linux_reboot.h \ linux_version.h \ + list.h \ md5.h \ mbsalign.h \ nls.h \ diff --git a/include/list.h b/include/list.h new file mode 100644 index 00000000..7648c3c0 --- /dev/null +++ b/include/list.h @@ -0,0 +1,197 @@ +/* + * Copyright (C) 2008 Karel Zak + * Copyright (C) 1999-2008 by Theodore Ts'o + * + * (based on list.h from e2fsprogs) + */ + +#if !defined(_LIBMOUNT_LIST_H) && !defined(LIST_HEAD) +#define _LIBMOUNT_LIST_H + +/* TODO: use AC_C_INLINE */ +#ifdef __GNUC__ +#define _INLINE_ static __inline__ +#else /* For Watcom C */ +#define _INLINE_ static inline +#endif + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +_INLINE_ void __list_add(struct list_head * add, + struct list_head * prev, + struct list_head * next) +{ + next->prev = add; + add->next = next; + add->prev = prev; + prev->next = add; +} + +/** + * list_add - add a new entry + * @add: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +_INLINE_ void list_add(struct list_head *add, struct list_head *head) +{ + __list_add(add, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @add: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +_INLINE_ void list_add_tail(struct list_head *add, struct list_head *head) +{ + __list_add(add, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +_INLINE_ void __list_del(struct list_head * prev, + struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * + * list_empty() on @entry does not return true after this, @entry is + * in an undefined state. + */ +_INLINE_ void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +_INLINE_ void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +_INLINE_ int list_empty(struct list_head *head) +{ + return head->next == head; +} + +/** + * list_last_entry - tests whether is entry last in the list + * @entry: the entry to test. + * @head: the list to test. + */ +_INLINE_ int list_last_entry(struct list_head *entry, struct list_head *head) +{ + return head->prev == entry; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +_INLINE_ void list_splice(struct list_head *list, struct list_head *head) +{ + struct list_head *first = list->next; + + if (first != list) { + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) + +/** + * list_for_each - iterate over elements in a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * list_for_each_backwardly - iterate over elements in a list in reverse + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each_backwardly(pos, head) \ + for (pos = (head)->prev; pos != (head); pos = pos->prev) + +/** + * list_for_each_safe - iterate over elements in a list, but don't dereference + * pos after the body is done (in case it is freed) + * @pos: the &struct list_head to use as a loop counter. + * @pnext: the &struct list_head to use as a pointer to the next item. + * @head: the head for your list (not included in iteration). + */ +#define list_for_each_safe(pos, pnext, head) \ + for (pos = (head)->next, pnext = pos->next; pos != (head); \ + pos = pnext, pnext = pos->next) + +#undef _INLINE_ + +#endif /* __LIBFSPROBE_LIST_H__ */ diff --git a/shlibs/blkid/src/list.h b/shlibs/blkid/src/list.h deleted file mode 100644 index c1cbfec5..00000000 --- a/shlibs/blkid/src/list.h +++ /dev/null @@ -1,179 +0,0 @@ -#if !defined(_BLKID_LIST_H) && !defined(LIST_HEAD) -#define _BLKID_LIST_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __GNUC__ -#define _INLINE_ static __inline__ -#else /* For Watcom C */ -#define _INLINE_ static inline -#endif - -/* - * Simple doubly linked list implementation. - * - * Some of the internal functions ("__xxx") are useful when - * manipulating whole lists rather than single entries, as - * sometimes we already know the next/prev entries and we can - * generate better code by using them directly rather than - * using the generic single-entry routines. - */ - -struct list_head { - struct list_head *next, *prev; -}; - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -#define INIT_LIST_HEAD(ptr) do { \ - (ptr)->next = (ptr); (ptr)->prev = (ptr); \ -} while (0) - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -_INLINE_ void __list_add(struct list_head * add, - struct list_head * prev, - struct list_head * next) -{ - next->prev = add; - add->next = next; - add->prev = prev; - prev->next = add; -} - -/** - * list_add - add a new entry - * @add: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -_INLINE_ void list_add(struct list_head *add, struct list_head *head) -{ - __list_add(add, head, head->next); -} - -/** - * list_add_tail - add a new entry - * @add: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -_INLINE_ void list_add_tail(struct list_head *add, struct list_head *head) -{ - __list_add(add, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries - * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -_INLINE_ void __list_del(struct list_head * prev, - struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * - * list_empty() on @entry does not return true after this, @entry is - * in an undefined state. - */ -_INLINE_ void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); -} - -/** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -_INLINE_ void list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -_INLINE_ int list_empty(struct list_head *head) -{ - return head->next == head; -} - -/** - * list_splice - join two lists - * @list: the new list to add. - * @head: the place to add it in the first list. - */ -_INLINE_ void list_splice(struct list_head *list, struct list_head *head) -{ - struct list_head *first = list->next; - - if (first != list) { - struct list_head *last = list->prev; - struct list_head *at = head->next; - - first->prev = head; - head->next = first; - - last->next = at; - at->prev = last; - } -} - -/** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - */ -#define list_entry(ptr, type, member) \ - ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) - -/** - * list_for_each - iterate over elements in a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * list_for_each_safe - iterate over elements in a list, but don't dereference - * pos after the body is done (in case it is freed) - * @pos: the &struct list_head to use as a loop counter. - * @pnext: the &struct list_head to use as a pointer to the next item. - * @head: the head for your list (not included in iteration). - */ -#define list_for_each_safe(pos, pnext, head) \ - for (pos = (head)->next, pnext = pos->next; pos != (head); \ - pos = pnext, pnext = pos->next) - -#undef _INLINE_ - -#ifdef __cplusplus -} -#endif - -#endif /* _BLKID_LIST_H */ diff --git a/shlibs/mount/src/list.h b/shlibs/mount/src/list.h deleted file mode 100644 index 9f8b88a2..00000000 --- a/shlibs/mount/src/list.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (C) 2008 Karel Zak - * Copyright (C) 1999-2008 by Theodore Ts'o - * - * (based on list.h from e2fsprogs) - */ - -#if !defined(_LIBMOUNT_LIST_H) && !defined(LIST_HEAD) -#define _LIBMOUNT_LIST_H - -/* TODO: use AC_C_INLINE */ -#ifdef __GNUC__ -#define _INLINE_ static __inline__ -#else /* For Watcom C */ -#define _INLINE_ static inline -#endif - -/* - * Simple doubly linked list implementation. - * - * Some of the internal functions ("__xxx") are useful when - * manipulating whole lists rather than single entries, as - * sometimes we already know the next/prev entries and we can - * generate better code by using them directly rather than - * using the generic single-entry routines. - */ - -struct list_head { - struct list_head *next, *prev; -}; - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -#define INIT_LIST_HEAD(ptr) do { \ - (ptr)->next = (ptr); (ptr)->prev = (ptr); \ -} while (0) - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -_INLINE_ void __list_add(struct list_head * add, - struct list_head * prev, - struct list_head * next) -{ - next->prev = add; - add->next = next; - add->prev = prev; - prev->next = add; -} - -/** - * list_add - add a new entry - * @add: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -_INLINE_ void list_add(struct list_head *add, struct list_head *head) -{ - __list_add(add, head, head->next); -} - -/** - * list_add_tail - add a new entry - * @add: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -_INLINE_ void list_add_tail(struct list_head *add, struct list_head *head) -{ - __list_add(add, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries - * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -_INLINE_ void __list_del(struct list_head * prev, - struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * - * list_empty() on @entry does not return true after this, @entry is - * in an undefined state. - */ -_INLINE_ void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); -} - -/** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -_INLINE_ void list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -_INLINE_ int list_empty(struct list_head *head) -{ - return head->next == head; -} - -/** - * list_splice - join two lists - * @list: the new list to add. - * @head: the place to add it in the first list. - */ -_INLINE_ void list_splice(struct list_head *list, struct list_head *head) -{ - struct list_head *first = list->next; - - if (first != list) { - struct list_head *last = list->prev; - struct list_head *at = head->next; - - first->prev = head; - head->next = first; - - last->next = at; - at->prev = last; - } -} - -/** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - */ -#define list_entry(ptr, type, member) \ - ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) - -/** - * list_for_each - iterate over elements in a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * list_for_each_safe - iterate over elements in a list, but don't dereference - * pos after the body is done (in case it is freed) - * @pos: the &struct list_head to use as a loop counter. - * @pnext: the &struct list_head to use as a pointer to the next item. - * @head: the head for your list (not included in iteration). - */ -#define list_for_each_safe(pos, pnext, head) \ - for (pos = (head)->next, pnext = pos->next; pos != (head); \ - pos = pnext, pnext = pos->next) - -#undef _INLINE_ - -#endif /* __LIBFSPROBE_LIST_H__ */ -- cgit v1.2.3 From c15b21e4e33853fcfdbc9553597243d4dd8eb310 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 6 Apr 2010 16:15:15 +0200 Subject: lib: add tt.c (Tree and Table output) Signed-off-by: Karel Zak --- include/Makefile.am | 1 + include/tt.h | 70 +++++ lib/Makefile.am | 3 +- lib/tt.c | 722 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 795 insertions(+), 1 deletion(-) create mode 100644 include/tt.h create mode 100644 lib/tt.c diff --git a/include/Makefile.am b/include/Makefile.am index d4d00727..c726b9d2 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -18,6 +18,7 @@ dist_noinst_HEADERS = \ pathnames.h \ setproctitle.h \ swapheader.h \ + tt.h \ usleep.h \ wholedisk.h \ widechar.h \ diff --git a/include/tt.h b/include/tt.h new file mode 100644 index 00000000..8e2994f3 --- /dev/null +++ b/include/tt.h @@ -0,0 +1,70 @@ +/* + * Prints table or tree. See lib/table.c for more details and example. + * + * Copyright (C) 2010 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ +#ifndef UTIL_LINUX_TT_H +#define UTIL_LINUX_TT_H + +#include "list.h" + +enum { + TT_FL_TRUNCATE = (1 << 1), + TT_FL_TREE = (1 << 2), + TT_FL_RAW = (1 << 3), + TT_FL_ASCII = (1 << 4), + TT_FL_NOHEADINGS = (1 << 5) +}; + +struct tt { + int ncols; /* number of columns */ + int termwidth; /* terminal width */ + int flags; + + struct list_head tb_columns; + struct list_head tb_lines; + + const struct tt_symbols *symbols; +}; + +struct tt_column { + const char *name; /* header */ + int seqnum; + + int width; /* real column width */ + double width_hint; /* hint (N < 1 is in percent of termwidth) */ + + int flags; + + struct list_head cl_columns; +}; + +struct tt_line { + struct tt *table; + char const **data; + + struct list_head ln_lines; /* table lines */ + + struct list_head ln_branch; /* begin of branch (head of ln_children) */ + struct list_head ln_children; + + struct tt_line *parent; +}; + +extern struct tt *tt_new_table(int flags); +extern void tt_free_table(struct tt *tb); +extern int tt_print_table(struct tt *tb); + +extern struct tt_column *tt_define_column(struct tt *tb, const char *name, + double whint, int flags); + +extern struct tt_column *tt_get_column(struct tt *tb, int colnum); + +extern struct tt_line *tt_add_line(struct tt *tb, struct tt_line *parent); + +extern int tt_line_set_data(struct tt_line *ln, int colnum, const char *data); + +#endif /* UTIL_LINUX_TT_H */ diff --git a/lib/Makefile.am b/lib/Makefile.am index c66deef0..f34bb928 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -3,7 +3,7 @@ include $(top_srcdir)/config/include-Makefile.am AM_CPPFLAGS += -DTEST_PROGRAM noinst_PROGRAMS = test_blkdev test_ismounted test_wholedisk test_mangle \ - test_strtosize + test_strtosize test_tt if HAVE_CPU_SET_T noinst_PROGRAMS += test_cpuset endif @@ -14,6 +14,7 @@ test_wholedisk_SOURCES = wholedisk.c test_mangle_SOURCES = mangle.c test_strtosize_SOURCES = strtosize.c test_cpuset_SOURCES = cpuset.c +test_tt_SOURCES = tt.c if LINUX test_blkdev_SOURCES += linux_version.c diff --git a/lib/tt.c b/lib/tt.c new file mode 100644 index 00000000..e33d6321 --- /dev/null +++ b/lib/tt.c @@ -0,0 +1,722 @@ +/* + * TT - Table or Tree, features: + * - column width could be defined as absolute or relative to the terminal width + * - allows to truncate or wrap data in columns + * - prints tree if parent->child relation is defined + * - draws the tree by ASCII or UTF8 lines (depends on terminal setting) + * + * Copyright (C) 2010 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ +#include +#include +#include +#include +#include +#ifdef HAVE_LANGINFO_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#include "nls.h" +#include "widechar.h" +#include "c.h" +#include "tt.h" + +struct tt_symbols { + const char *branch; + const char *vert; + const char *right; +}; + +static const struct tt_symbols ascii_tt_symbols = { + .branch = "|-", + .vert = "| ", + .right = "`-", +}; + +#ifdef HAVE_WIDECHAR +#define mbs_width(_s) mbstowcs(NULL, _s, 0) + +#define UTF_V "\342\224\202" /* U+2502, Vertical line drawing char */ +#define UTF_VR "\342\224\234" /* U+251C, Vertical and right */ +#define UTF_H "\342\224\200" /* U+2500, Horizontal */ +#define UTF_UR "\342\224\224" /* U+2514, Up and right */ + +static const struct tt_symbols utf8_tt_symbols = { + .branch = UTF_VR UTF_H, + .vert = UTF_V " ", + .right = UTF_UR UTF_H, +}; + +#else /* !HAVE_WIDECHAR */ +# define mbs_width strlen(_s) +#endif /* !HAVE_WIDECHAR */ + +#define is_last_column(_tb, _cl) \ + list_last_entry(&(_cl)->cl_columns, &(_tb)->tb_columns) + +/* TODO: move to lib/mbalign.c */ +#ifdef HAVE_WIDECHAR +static size_t wc_truncate (wchar_t *wc, size_t width) +{ + size_t cells = 0; + int next_cells = 0; + + while (*wc) + { + next_cells = wcwidth (*wc); + if (next_cells == -1) /* non printable */ + { + *wc = 0xFFFD; /* L'\uFFFD' (replacement char) */ + next_cells = 1; + } + if (cells + next_cells > width) + break; + cells += next_cells; + wc++; + } + *wc = L'\0'; + return cells; +} +#endif + + +/* TODO: move to lib/mbalign.c */ +static size_t mbs_truncate(char *str, size_t width) +{ + size_t bytes = strlen(str) + 1; +#ifdef HAVE_WIDECHAR + size_t sz = mbs_width(str); + wchar_t *wcs = NULL; + int rc = -1; + + if (sz <= width) + return sz; /* truncate is unnecessary */ + + if (sz == (size_t) -1) + goto done; + + wcs = malloc(sz * sizeof(wchar_t)); + if (!wcs) + goto done; + + if (!mbstowcs(wcs, str, sz)) + goto done; + rc = wc_truncate(wcs, width); + wcstombs(str, wcs, bytes); +done: + free(wcs); + return rc; +#else + if (width < bytes) { + str[width] = '\0'; + return width; + } + return bytes; /* truncate is unnecessary */ +#endif +} + +/* + * @flags: TT_FL_* flags (usually TT_FL_{ASCII,RAW}) + * + * Returns: newly allocated table + */ +struct tt *tt_new_table(int flags) +{ + struct tt *tb; + + tb = calloc(1, sizeof(struct tt)); + if (!tb) + return NULL; + + tb->flags = flags; + INIT_LIST_HEAD(&tb->tb_lines); + INIT_LIST_HEAD(&tb->tb_columns); + +#ifdef HAVE_WIDECHAR + if (!(flags & TT_FL_ASCII) && !strcmp(nl_langinfo(CODESET), "UTF-8")) + tb->symbols = &utf8_tt_symbols; + else +#endif + tb->symbols = &ascii_tt_symbols; + return tb; +} + +void tt_free_table(struct tt *tb) +{ + if (!tb) + return; + while (!list_empty(&tb->tb_lines)) { + struct tt_line *ln = list_entry(tb->tb_lines.next, + struct tt_line, ln_lines); + list_del(&ln->ln_lines); + free(ln->data); + free(ln); + } + while (!list_empty(&tb->tb_columns)) { + struct tt_column *cl = list_entry(tb->tb_columns.next, + struct tt_column, cl_columns); + list_del(&cl->cl_columns); + free(cl); + } + free(tb); +} + +/* + * @tb: table + * @name: column header + * @whint: column width hint (absolute width: N > 1; relative width: N < 1) + * @flags: usually TT_FL_{TREE,TRUNCATE} + * + * The column is necessary to address (for example for tt_line_set_data()) by + * sequential number. The first defined column has the colnum = 0. For example: + * + * tt_define_column(tab, "FOO", 0.5, 0); // colnum = 0 + * tt_define_column(tab, "BAR", 0.5, 0); // colnum = 1 + * . + * . + * tt_line_set_data(line, 0, "foo-data"); // FOO column + * tt_line_set_data(line, 1, "bar-data"); // BAR column + * + * Returns: newly allocated column definition + */ +struct tt_column *tt_define_column(struct tt *tb, const char *name, + double whint, int flags) +{ + struct tt_column *cl; + + if (!tb) + return NULL; + cl = calloc(1, sizeof(*cl)); + if (!cl) + return NULL; + + cl->name = name; + cl->width_hint = whint; + cl->flags = flags; + cl->seqnum = tb->ncols++; + + if (flags & TT_FL_TREE) + tb->flags |= TT_FL_TREE; + + INIT_LIST_HEAD(&cl->cl_columns); + list_add_tail(&cl->cl_columns, &tb->tb_columns); + return cl; +} + +/* + * @tb: table + * @parent: parental line or NULL + * + * Returns: newly allocate line + */ +struct tt_line *tt_add_line(struct tt *tb, struct tt_line *parent) +{ + struct tt_line *ln = NULL; + + if (!tb || !tb->ncols) + goto err; + ln = calloc(1, sizeof(*ln)); + if (!ln) + goto err; + ln->data = calloc(tb->ncols, sizeof(char *)); + if (!ln->data) + goto err; + + ln->table = tb; + ln->parent = parent; + INIT_LIST_HEAD(&ln->ln_lines); + INIT_LIST_HEAD(&ln->ln_children); + INIT_LIST_HEAD(&ln->ln_branch); + + list_add_tail(&ln->ln_lines, &tb->tb_lines); + + if (parent) + list_add_tail(&ln->ln_children, &parent->ln_branch); + return ln; +err: + free(ln); + return NULL; +} + +/* + * @tb: table + * @colnum: number of column (0..N) + * + * Returns: pointer to column or NULL + */ +struct tt_column *tt_get_column(struct tt *tb, int colnum) +{ + struct list_head *p; + + list_for_each(p, &tb->tb_columns) { + struct tt_column *cl = + list_entry(p, struct tt_column, cl_columns); + if (cl->seqnum == colnum) + return cl; + } + return NULL; +} + +/* + * @ln: line + * @colnum: number of column (0..N) + * @data: printable data + * + * Stores data that will be printed to the table cell. + */ +int tt_line_set_data(struct tt_line *ln, int colnum, const char *data) +{ + struct tt_column *cl; + + if (!ln) + return -1; + cl = tt_get_column(ln->table, colnum); + if (!cl) + return -1; + ln->data[cl->seqnum] = data; + return 0; +} + +static int get_terminal_width(void) +{ +#ifdef TIOCGSIZE + struct ttysize t_win; +#endif +#ifdef TIOCGWINSZ + struct winsize w_win; +#endif + const char *cp; + +#ifdef TIOCGSIZE + if (ioctl (0, TIOCGSIZE, &t_win) == 0) + return t_win.ts_cols; +#endif +#ifdef TIOCGWINSZ + if (ioctl (0, TIOCGWINSZ, &w_win) == 0) + return w_win.ws_col; +#endif + cp = getenv("COLUMNS"); + if (cp) + return strtol(cp, NULL, 10); + return 0; +} + +static char *line_get_ascii_art(struct tt_line *ln, char *buf, size_t *bufsz) +{ + const char *art; + size_t len; + + if (!ln->parent) + return buf; + + buf = line_get_ascii_art(ln->parent, buf, bufsz); + if (!buf) + return NULL; + + if (list_last_entry(&ln->ln_children, &ln->parent->ln_branch)) + art = " "; + else + art = ln->table->symbols->vert; + + len = strlen(art); + if (*bufsz < len) + return NULL; /* no space, internal error */ + + memcpy(buf, art, len); + *bufsz -= len; + return buf + len; +} + +static char *line_get_data(struct tt_line *ln, struct tt_column *cl, + char *buf, size_t bufsz) +{ + const char *data = ln->data[cl->seqnum]; + const struct tt_symbols *sym; + char *p = buf; + + memset(buf, 0, bufsz); + + if (!data) + return NULL; + if (!(cl->flags & TT_FL_TREE)) { + strncpy(buf, data, bufsz); + buf[bufsz - 1] = '\0'; + return buf; + } + if (ln->parent) { + p = line_get_ascii_art(ln->parent, buf, &bufsz); + if (!p) + return NULL; + } + + sym = ln->table->symbols; + + if (!ln->parent) + snprintf(p, bufsz, "%s", data); /* root node */ + else if (list_last_entry(&ln->ln_children, &ln->parent->ln_branch)) + snprintf(p, bufsz, "%s%s", sym->right, data); /* last chaild */ + else + snprintf(p, bufsz, "%s%s", sym->branch, data); /* any child */ + + return buf; +} + +static void recount_widths(struct tt *tb, char *buf, size_t bufsz) +{ + struct list_head *p; + int width = 0, trunc_only; + + /* set width according to the size of data + */ + list_for_each(p, &tb->tb_columns) { + struct tt_column *cl = + list_entry(p, struct tt_column, cl_columns); + struct list_head *lp; + + list_for_each(lp, &tb->tb_lines) { + struct tt_line *ln = + list_entry(lp, struct tt_line, ln_lines); + + char *data = line_get_data(ln, cl, buf, bufsz); + size_t len = data ? mbs_width(data) : 0; + + if (cl->width < len) + cl->width = len; + } + } + + /* set minimal width (= size of column header) + */ + list_for_each(p, &tb->tb_columns) { + struct tt_column *cl = + list_entry(p, struct tt_column, cl_columns); + + size_t len = mbs_width(cl->name); + + if (cl->width < len) + cl->width = len; + else if (cl->width_hint >= 1) + cl->width = (int) cl->width_hint; + + width += cl->width + (is_last_column(tb, cl) ? 0 : 1); + } + + if (width == tb->termwidth) + goto leave; + if (width < tb->termwidth) { + /* cool, use the extra space for the last column */ + struct tt_column *cl = list_entry( + tb->tb_columns.prev, struct tt_column, cl_columns); + + cl->width += tb->termwidth - width; + goto leave; + } + + /* bad, we have to reduce output width, this is done in two steps: + * 1/ reduce columns with a relative width and with truncate flag + * 2) reduce columns with a relative width without truncate flag + */ + trunc_only = 1; + while(width > tb->termwidth) { + int org = width; + + list_for_each(p, &tb->tb_columns) { + struct tt_column *cl = + list_entry(p, struct tt_column, cl_columns); + + if (width <= tb->termwidth) + break; + if (cl->width_hint > 1) + continue; /* never truncate columns with absolute sizes */ + if (cl->flags & TT_FL_TREE) + continue; /* never truncate the tree */ + if (trunc_only && !(cl->flags & TT_FL_TRUNCATE)) + continue; + if (cl->width > cl->width_hint * tb->termwidth) { + cl->width--; + width--; + } + } + if (org == width) { + if (trunc_only) + trunc_only = 0; + else + break; + } + } +leave: +/* + fprintf(stderr, "terminal: %d, output: %d\n", tb->termwidth, width); + + list_for_each(p, &tb->tb_columns) { + struct tt_column *cl = + list_entry(p, struct tt_column, cl_columns); + + fprintf(stderr, "width: %s=%d [%d]\n", + cl->name, cl->width, + cl->width_hint > 1 ? (int) cl->width_hint : + (int) (cl->width_hint * tb->termwidth)); + } +*/ + return; +} + +/* note that this function modifies @data + */ +static void print_data(struct tt *tb, struct tt_column *cl, char *data) +{ + size_t len, i; + int width; + + if (!data) + data = ""; + + /* raw mode */ + if (tb->flags & TT_FL_RAW) { + fputs(data, stdout); + if (!is_last_column(tb, cl)) + fputc(' ', stdout); + return; + } + + /* note that 'len' and 'width' are number of cells, not bytes */ + len = mbs_width(data); + + if (!len || len == (size_t) -1) { + len = 0; + data = NULL; + } + width = cl->width; + + if (is_last_column(tb, cl) && len < width) + width = len; + + /* truncate data */ + if (len > width && (cl->flags & TT_FL_TRUNCATE)) { + len = mbs_truncate(data, width); + if (!data || len == (size_t) -1) { + len = 0; + data = NULL; + } + } + if (data) + fputs(data, stdout); + for (i = len; i < width; i++) + fputc(' ', stdout); /* padding */ + + if (!is_last_column(tb, cl)) { + if (len > width && !(cl->flags & TT_FL_TRUNCATE)) { + fputc('\n', stdout); + for (i = 0; i <= cl->seqnum; i++) { + struct tt_column *x = tt_get_column(tb, i); + printf("%*s ", -x->width, " "); + } + } else + fputc(' ', stdout); /* columns separator */ + } +} + +static void print_line(struct tt_line *ln, char *buf, size_t bufsz) +{ + struct list_head *p; + + /* set width according to the size of data + */ + list_for_each(p, &ln->table->tb_columns) { + struct tt_column *cl = + list_entry(p, struct tt_column, cl_columns); + + print_data(ln->table, cl, line_get_data(ln, cl, buf, bufsz)); + } + fputc('\n', stdout); +} + +static void print_header(struct tt *tb, char *buf, size_t bufsz) +{ + struct list_head *p; + + if (tb->flags & TT_FL_NOHEADINGS) + return; + + /* set width according to the size of data + */ + list_for_each(p, &tb->tb_columns) { + struct tt_column *cl = + list_entry(p, struct tt_column, cl_columns); + + strncpy(buf, cl->name, bufsz); + buf[bufsz - 1] = '\0'; + print_data(tb, cl, buf); + } + fputc('\n', stdout); +} + +static void print_table(struct tt *tb, char *buf, size_t bufsz) +{ + struct list_head *p; + + print_header(tb, buf, bufsz); + + list_for_each(p, &tb->tb_lines) { + struct tt_line *ln = list_entry(p, struct tt_line, ln_lines); + + print_line(ln, buf, bufsz); + } +} + +static void print_tree_line(struct tt_line *ln, char *buf, size_t bufsz) +{ + struct list_head *p; + + print_line(ln, buf, bufsz); + + if (list_empty(&ln->ln_branch)) + return; + + /* print all children */ + list_for_each(p, &ln->ln_branch) { + struct tt_line *chld = + list_entry(p, struct tt_line, ln_children); + print_tree_line(chld, buf, bufsz); + } +} + +static void print_tree(struct tt *tb, char *buf, size_t bufsz) +{ + struct list_head *p; + + print_header(tb, buf, bufsz); + + list_for_each(p, &tb->tb_lines) { + struct tt_line *ln = list_entry(p, struct tt_line, ln_lines); + + if (ln->parent) + continue; + + print_tree_line(ln, buf, bufsz); + } +} + +/* + * @tb: table + * + * Prints the table to stdout + */ +int tt_print_table(struct tt *tb) +{ + char *line; + + if (!tb) + return -1; + if (!tb->termwidth) { + tb->termwidth = get_terminal_width(); + if (tb->termwidth <= 0) + tb->termwidth = 80; + } + line = malloc(tb->termwidth); + if (!line) + return -1; + if (!(tb->flags & TT_FL_RAW)) + recount_widths(tb, line, tb->termwidth); + if (tb->flags & TT_FL_TREE) + print_tree(tb, line, tb->termwidth); + else + print_table(tb, line, tb->termwidth); + + free(line); + return 0; +} + +#ifdef TEST_PROGRAM +#include +#include + +enum { MYCOL_NAME, MYCOL_FOO, MYCOL_BAR, MYCOL_PATH }; + +int main(int argc, char *argv[]) +{ + struct tt *tb; + struct tt_line *ln, *pr, *root; + int flags = 0, notree = 0, i; + + if (argc == 2 && !strcmp(argv[1], "--help")) { + printf("%s [--ascii | --raw | --list]\n", + program_invocation_short_name); + return EXIT_SUCCESS; + } else if (argc == 2 && !strcmp(argv[1], "--ascii")) + flags |= TT_FL_ASCII; + else if (argc == 2 && !strcmp(argv[1], "--raw")) { + flags |= TT_FL_RAW; + notree = 1; + } else if (argc == 2 && !strcmp(argv[1], "--list")) + notree = 1; + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + tb = tt_new_table(flags); + if (!tb) + err(EXIT_FAILURE, "table initialization failed"); + + tt_define_column(tb, "NAME", 0.3, notree ? 0 : TT_FL_TREE); + tt_define_column(tb, "FOO", 0.3, TT_FL_TRUNCATE); + tt_define_column(tb, "BAR", 0.3, 0); + tt_define_column(tb, "PATH", 0.3, 0); + + for (i = 0; i < 2; i++) { + root = ln = tt_add_line(tb, NULL); + tt_line_set_data(ln, MYCOL_NAME, "AAA"); + tt_line_set_data(ln, MYCOL_FOO, "a-foo-foo"); + tt_line_set_data(ln, MYCOL_BAR, "barBar-A"); + tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA"); + + pr = ln = tt_add_line(tb, ln); + tt_line_set_data(ln, MYCOL_NAME, "AAA.A"); + tt_line_set_data(ln, MYCOL_FOO, "a.a-foo-foo"); + tt_line_set_data(ln, MYCOL_BAR, "barBar-A.A"); + tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA/A"); + + ln = tt_add_line(tb, pr); + tt_line_set_data(ln, MYCOL_NAME, "AAA.A.AAA"); + tt_line_set_data(ln, MYCOL_FOO, "a.a.a-foo-foo"); + tt_line_set_data(ln, MYCOL_BAR, "barBar-A.A.A"); + tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA/A/AAA"); + + ln = tt_add_line(tb, root); + tt_line_set_data(ln, MYCOL_NAME, "AAA.B"); + tt_line_set_data(ln, MYCOL_FOO, "a.b-foo-foo"); + tt_line_set_data(ln, MYCOL_BAR, "barBar-A.B"); + tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA/B"); + + ln = tt_add_line(tb, pr); + tt_line_set_data(ln, MYCOL_NAME, "AAA.A.BBB"); + tt_line_set_data(ln, MYCOL_FOO, "a.a.b-foo-foo"); + tt_line_set_data(ln, MYCOL_BAR, "barBar-A.A.BBB"); + tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA/A/BBB"); + + ln = tt_add_line(tb, pr); + tt_line_set_data(ln, MYCOL_NAME, "AAA.A.CCC"); + tt_line_set_data(ln, MYCOL_FOO, "a.a.c-foo-foo"); + tt_line_set_data(ln, MYCOL_BAR, "barBar-A.A.CCC"); + tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA/A/CCC"); + + ln = tt_add_line(tb, root); + tt_line_set_data(ln, MYCOL_NAME, "AAA.C"); + tt_line_set_data(ln, MYCOL_FOO, "a.c-foo-foo"); + tt_line_set_data(ln, MYCOL_BAR, "barBar-A.C"); + tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA/C"); + } + + tt_print_table(tb); + tt_free_table(tb); + + return EXIT_SUCCESS; +} +#endif -- cgit v1.2.3 From fdedb45e3105a2d1cb6baf41b792d955ccd7a0bb Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 6 Apr 2010 16:16:27 +0200 Subject: findmnt: rewrite to use lib/tt.c Signed-off-by: Karel Zak --- misc-utils/Makefile.am | 1 + misc-utils/findmnt.c | 713 ++++++++++++------------------------------------- 2 files changed, 167 insertions(+), 547 deletions(-) diff --git a/misc-utils/Makefile.am b/misc-utils/Makefile.am index 218a2103..b5029166 100644 --- a/misc-utils/Makefile.am +++ b/misc-utils/Makefile.am @@ -47,6 +47,7 @@ wipefs_LDADD = $(ul_libblkid_la) wipefs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir) findmnt_LDADD = $(ul_libmount_la) findmnt_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir) +findmnt_SOURCES = findmnt.c $(top_srcdir)/lib/tt.c if HAVE_STATIC_BLKID sbin_PROGRAMS += blkid.static blkid_static_SOURCES = $(blkid_SOURCES) diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index 0fdb16c9..70678235 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -18,7 +18,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include #include #include @@ -33,14 +32,14 @@ #ifdef HAVE_SYS_IOCTL_H #include #endif -#include - #include +#include + #include "pathnames.h" #include "nls.h" -#include "widechar.h" #include "c.h" +#include "tt.h" /* flags */ enum { @@ -48,10 +47,7 @@ enum { FL_CANONICALIZE = (1 << 2), FL_FIRSTONLY = (1 << 3), FL_INVERT = (1 << 4), - FL_NOHEADINGS = (1 << 5), FL_NOSWAPMATCH = (1 << 6), - FL_TREE = (1 << 7), - FL_RAW = (1 << 8) }; /* column IDs */ @@ -66,101 +62,42 @@ enum { __NCOLUMNS }; -struct treenode { - mnt_fs *fs; /* filesystem */ - - struct treenode *parent; - struct treenode *first; /* first child */ - struct treenode *last; /* last child */ - - struct treenode *next; /* next node in the same level */ -}; - /* column names */ struct colinfo { const char *name; /* header */ double whint; /* width hint (N < 1 is in percent of termwidth) */ - int wrap; /* boolean (FALSE = truncate the column) */ - - int width; /* real column width */ + int truncate; /* boolean */ const char *match; /* pattern for match_func() */ }; /* columns descriptions */ struct colinfo infos[__NCOLUMNS] = { - [COL_SOURCE] = { "SOURCE", 0.25, TRUE }, - [COL_TARGET] = { "TARGET", 0.30, TRUE }, - [COL_FSTYPE] = { "FSTYPE", 0.10, FALSE }, - [COL_OPTIONS] = { "OPTIONS", 0.10, FALSE }, - [COL_LABEL] = { "LABEL", 0.10, TRUE }, - [COL_UUID] = { "UUID", 36, TRUE }, + [COL_SOURCE] = { "SOURCE", 0.25, FALSE }, + [COL_TARGET] = { "TARGET", 0.30, FALSE }, + [COL_FSTYPE] = { "FSTYPE", 0.10, TRUE }, + [COL_OPTIONS] = { "OPTIONS", 0.10, TRUE }, + [COL_LABEL] = { "LABEL", 0.10, FALSE }, + [COL_UUID] = { "UUID", 36, FALSE }, }; -struct treesym { - const char *branch; - const char *vert; - const char *right; -}; -const struct treesym ascii_tree_symbols = { - .branch = "|-", - .vert = "| ", - .right = "`-", -}; - -#ifdef HAVE_WIDECHAR - -#define mbs_width(_s) mbstowcs(NULL, _s, 0) - -#define UTF_V "\342\224\202" /* U+2502, Vertical line drawing char */ -#define UTF_VR "\342\224\234" /* U+251C, Vertical and right */ -#define UTF_H "\342\224\200" /* U+2500, Horizontal */ -#define UTF_UR "\342\224\224" /* U+2514, Up and right */ - -const struct treesym utf_tree_symbols = { - .branch = UTF_VR UTF_H, - .vert = UTF_V " ", - .right = UTF_UR UTF_H, -}; - -const struct treesym *tree_symbols = &utf_tree_symbols; - -#else /* !HAVE_WIDECHAR */ - -# define mbs_width strlen(_s) -const struct treesym *tree_symbols = &ascii_tree_symbols; - -#endif /* !HAVE_WIDECHAR */ - /* global flags */ int flags; -/* array IDs of with enabled columns */ +/* array with IDs of enabled columns */ int columns[__NCOLUMNS]; int ncolumns; -int termwidth; /* terminal width */ -char *treebuf; /* buffer for target column in tree mode */ - /* libmount cache */ mnt_cache *cache; - -static inline int is_last_column(int num) -{ - return num + 1 == ncolumns; -} - static inline int get_column_id(int num) { - int id; assert(num < ncolumns); - - id = columns[num]; - assert(id < __NCOLUMNS); - return id; + assert(columns[num] < __NCOLUMNS); + return columns[num]; } -static inline struct colinfo *get_column_desc(int num) +static inline struct colinfo *get_column_info(int num) { return &infos[ get_column_id(num) ]; } @@ -173,27 +110,17 @@ static inline const char *column_id_to_name(int id) static inline const char *get_column_name(int num) { - return get_column_desc(num)->name; + return get_column_info(num)->name; } static inline float get_column_whint(int num) { - return get_column_desc(num)->whint; + return get_column_info(num)->whint; } -static inline int get_column_width(int num) +static inline int get_column_truncate(int num) { - return get_column_desc(num)->width; -} - -static inline void set_column_width(int num, int width) -{ - get_column_desc(num)->width = width; -} - -static inline int get_column_wrap(int num) -{ - return get_column_desc(num)->wrap; + return get_column_info(num)->truncate; } static inline const char *get_match(int id) @@ -236,12 +163,12 @@ static inline int is_mount_compatible_mode(void) return 1; /* ok */ } -static void set_all_columns_wrap(int set) +static void set_all_columns_truncate(int set) { int i; for (i = 0; i < __NCOLUMNS; i++) - infos[i].wrap = set; + infos[i].truncate = set; } /* @@ -257,8 +184,7 @@ static int column_name_to_id(const char *name, size_t namesz) if (!strncasecmp(name, cn, namesz) && !*(cn + namesz)) return i; } - - errx(EXIT_FAILURE, _("unknown column: %s"), name); + warnx(_("unknown column: %s"), name); return -1; } @@ -278,6 +204,7 @@ static int set_columns(const char *str) for (p = str; p && *p; p++) { const char *end = NULL; + int id; if (!begin) begin = p; /* begin of the column name */ @@ -290,7 +217,10 @@ static int set_columns(const char *str) if (end <= begin) return -1; - columns[ ncolumns++ ] = column_name_to_id(begin, end - begin); + id = column_name_to_id(begin, end - begin); + if (id == -1) + return -1; + columns[ ncolumns++ ] = id; begin = NULL; if (end && !*end) break; @@ -298,136 +228,7 @@ static int set_columns(const char *str) return 0; } -/* TODO: move to lib/terminal.c */ -static int terminal_get_width(void) -{ -#ifdef TIOCGSIZE - struct ttysize t_win; -#endif -#ifdef TIOCGWINSZ - struct winsize w_win; -#endif - const char *cp; - -#ifdef TIOCGSIZE - if (ioctl (0, TIOCGSIZE, &t_win) == 0) - return t_win.ts_cols; -#endif -#ifdef TIOCGWINSZ - if (ioctl (0, TIOCGWINSZ, &w_win) == 0) - return w_win.ws_col; -#endif - cp = getenv("COLUMNS"); - if (cp) - return strtol(cp, NULL, 10); - return 80; -} - -static void recount_widths(void) -{ - int i, width = 0, ignore_wraps; - - /* set minimal width (= size of column header) */ - for (i = 0; i < ncolumns; i++) { - const char *name = get_column_name(i); - size_t len = mbs_width(name); - float hint = get_column_whint(i); - - if (get_column_width(i) < len) - /* enlarge to small columns */ - set_column_width(i, len); - - else if (hint >= 1) - /* set absolute widths */ - set_column_width(i, (int) hint); - } - - /* count used space */ - for (i = 0; i < ncolumns; i++) - width += get_column_width(i) + (is_last_column(i) ? 0 : 1); - - if (width == termwidth) - return; - - if (width < termwidth) { - /* cool, use the extra space for the last column */ - i = ncolumns - 1; - set_column_width(i, get_column_width(i) + (termwidth - width)); - - return; - } - - /* bad, we have to reduce output width, this is done in two steps: - * 1/ reduce columns with a relative width (see colinfo.whint) and - * without wrap flag (this columns could be truncated) - * 2) reduce columns with a relative width with wrap flag - */ - ignore_wraps = 1; - while(width > termwidth) { - int org = width; - for (i = ncolumns - 1; i >= 0 && width > termwidth; i--) { - float hint = get_column_whint(i); - int w = get_column_width(i); - - if (hint > 1) - /* never truncate columns with absolute sizes */ - continue; - - if (get_column_id(i) == COL_TARGET && (flags & FL_TREE)) - /* never truncate the tree */ - continue; - - if (ignore_wraps && get_column_wrap(i)) - continue; - - if (w > hint * termwidth) { - set_column_width(i, w - 1); - width--; - } - } - - if (org == width) { - if (ignore_wraps) - ignore_wraps = 0; - else - break; - } - } -/* - fprintf(stderr, "terminal: %d, output: %d\n", termwidth, width); - for (i = 0; i < ncolumns; i++) - fprintf(stderr, "width: %s=%d [%d]\n", - get_column_name(i), - get_column_width(i), - (int) (get_column_whint(i) * termwidth)); -*/ -} - -static char *get_treenode_ascii_art(struct treenode *node, - char *buf, size_t *bufsz) -{ - const char *sym; - size_t len; - - if (!node->parent) - return buf; - else { - buf = get_treenode_ascii_art(node->parent, buf, bufsz); - if (!buf) - return NULL; - sym = node->next ? tree_symbols->vert : " "; - } - len = strlen(sym); - - if (*bufsz < len) - return NULL; /* no space, internal error */ - - memcpy(buf, sym, len); - *bufsz -= len; - return buf + len; -} - -/* Returns LABEl or UUID */ +/* Returns LABEL or UUID */ static const char *get_tag(mnt_fs *fs, const char *tagname) { const char *t, *v, *res; @@ -445,37 +246,8 @@ static const char *get_tag(mnt_fs *fs, const char *tagname) return res; } -static const char *get_tree_target(mnt_fs *fs, char *buf, size_t bufsz) -{ - struct treenode *node; - const char *target; - char *p = buf; - - node = (struct treenode *) mnt_fs_get_userdata(fs); - if (!node) - return NULL; - - target = mnt_fs_get_target(fs); - if (!target) - return NULL; - - if (node->parent) { - p = get_treenode_ascii_art(node->parent, buf, &bufsz); - if (!p) - return NULL; - } - - if (node->next) - snprintf(p, bufsz, "%s%s", tree_symbols->branch, target); - else if (node->parent) - snprintf(p, bufsz, "%s%s", tree_symbols->right, target); - else - snprintf(p, bufsz, "%s", target); /* root node */ - - return buf; -} - -static const char *get_column_data(mnt_fs *fs, int num) +/* reads FS data from libmount */ +static const char *get_data(mnt_fs *fs, int num) { const char *str = NULL; @@ -494,8 +266,7 @@ static const char *get_column_data(mnt_fs *fs, int num) } break; case COL_TARGET: - str = flags & FL_TREE ? get_tree_target(fs, treebuf, termwidth) : - mnt_fs_get_target(fs); + str = mnt_fs_get_target(fs); break; case COL_FSTYPE: str = mnt_fs_get_fstype(fs); @@ -512,180 +283,85 @@ static const char *get_column_data(mnt_fs *fs, int num) default: break; } - - return str ? str : "-"; -} - -/* TODO: move to lib/mbalign.c */ -#ifdef HAVE_WIDECHAR -static size_t wc_truncate (wchar_t *wc, size_t width) -{ - size_t cells = 0; - int next_cells = 0; - - while (*wc) - { - next_cells = wcwidth (*wc); - if (next_cells == -1) /* non printable */ - { - *wc = 0xFFFD; /* L'\uFFFD' (replacement char) */ - next_cells = 1; - } - if (cells + next_cells > width) - break; - cells += next_cells; - wc++; - } - *wc = L'\0'; - return cells; -} -#endif - -/* TODO: move to lib/mbalign.c */ -static size_t mbs_truncate(char *str, size_t width) -{ - size_t bytes = strlen(str) + 1; -#ifdef HAVE_WIDECHAR - size_t sz = mbs_width(str); - wchar_t *wcs = NULL; - int rc = -1; - - if (sz <= width) - return sz; /* truncate is unnecessary */ - - if (sz == (size_t) -1) - goto done; - - wcs = malloc(sz * sizeof(wchar_t)); - if (!wcs) - goto done; - - if (!mbstowcs(wcs, str, sz)) - goto done; - rc = wc_truncate(wcs, width); - wcstombs(str, wcs, bytes); -done: - free(wcs); - return rc; -#else - if (width < bytes) { - str[width] = '\0'; - return width; - } - return bytes; /* truncate is unnecessary */ -#endif + return str; } -static void print_column_data(const char *data0, int num) +/* adds one line to the output @tab */ +static struct tt_line *add_line(struct tt *tt, mnt_fs *fs, + struct tt_line *parent) { - size_t len, wrap, i; - int width; - char *data = (char *) data0; - - if (flags & FL_RAW) { - fputs(data, stdout); - if (!is_last_column(num)) - fputc(' ', stdout); - return; - } - - /* note that 'len' and 'width' is number of cells, not bytes */ - len = mbs_width(data); + int i; + struct tt_line *line = tt_add_line(tt, parent); - if (!len || len == (size_t) -1) { - len = 0; - data = NULL; + if (!line) { + warn(_("failed to add line to output")); + return NULL; } + for (i = 0; i < ncolumns; i++) + tt_line_set_data(line, i, get_data(fs, i)); - width = get_column_width(num); - wrap = get_column_wrap(num); - - if (is_last_column(num) && len < width) - width = len; - - if (len > width && !wrap) { - data = strdup(data); - if (data) - len = mbs_truncate(data, width); - if (!data || len == (size_t) -1) { - len = 0; - data = NULL; - } - } - if (data) - fputs(data, stdout); - for (i = len; i < width; i++) /* padding */ - fputc(' ', stdout); - - if (!is_last_column(num)) { - if (len > width && wrap) { - fputc('\n', stdout); - - for (i = 0; i <= num; i++) - printf("%*s ", - -get_column_width(i), " "); - } else - fputc(' ', stdout); /* columns separator */ - } - if (data != data0) - free(data); + return line; } -static void print_fs(mnt_fs *fs, int line) +/* reads filesystems from @tb (libmount) and fillin @tab (output table) */ +static int create_treenode(struct tt *tt, mnt_tab *tb, + mnt_fs *fs, struct tt_line *parent_line) { - int i; - - /* print header */ - if (!(flags & FL_NOHEADINGS) && !line) { - for (i = 0; i < ncolumns; i++) - print_column_data(get_column_name(i), i); - printf("\n"); - } + mnt_fs *chld = NULL; + mnt_iter *itr = NULL; + struct tt_line *line; + int rc = -1; - /* print data */ - for (i = 0; i < ncolumns; i++) { - const char *data = get_column_data(fs, i); - print_column_data(data, i); + if (!fs) { + /* first call, get root FS */ + if (mnt_tab_get_root_fs(tb, &fs)) + goto leave; + parent_line = NULL; } - printf("\n"); -} -static void set_widths(mnt_fs *fs) -{ - int i; + itr = mnt_new_iter(MNT_ITER_FORWARD); + if (!itr) + goto leave; - for (i = 0; i < ncolumns; i++) { - const char *data = get_column_data(fs, i); - size_t len = data ? mbs_width(data) : 0; - int old = get_column_width(i); + line = add_line(tt, fs, parent_line); + if (!line) + goto leave; - if (old < len) - set_column_width(i, len); + /* + * add all children to the output table + */ + while(mnt_tab_next_child_fs(tb, itr, fs, &chld) == 0) { + if (create_treenode(tt, tb, chld, line)) + goto leave; } + rc = 0; +leave: + mnt_free_iter(itr); + return rc; } +/* calls libmount fstab/mtab/mountinfo parser */ static mnt_tab *parse_tabfile(const char *path) { mnt_tab *tb = mnt_new_tab(path); - if (!tb) + if (!tb) { + warn(_("failed to initialize libmount tab")); return NULL; - - if (mnt_tab_parse_file(tb) != 0) - goto err; - + } + if (mnt_tab_parse_file(tb) != 0) { + mnt_free_tab(tb); + warn(_("can't read: %s"), path); + return NULL; + } if (mnt_tab_get_nerrs(tb)) { char buf[BUFSIZ]; mnt_tab_strerror(tb, buf, sizeof(buf)); warnx(_("%s: parse error: %s"), path, buf); } return tb; -err: - mnt_free_tab(tb); - err(EXIT_FAILURE, _("can't read: %s"), path); - - return NULL; } +/* filter function for libmount (mnt_tab_find_next_fs()) */ static int match_func(mnt_fs *fs, void *data) { int rc = flags & FL_INVERT ? 1 : 0; @@ -710,6 +386,7 @@ static int match_func(mnt_fs *fs, void *data) return !rc; } +/* iterate over filesystems in @tb */ static mnt_fs *get_next_fs(mnt_tab *tb, mnt_iter *itr) { mnt_fs *fs = NULL; @@ -753,89 +430,8 @@ again: goto again; } } - return fs; -} - -static struct treenode *create_treenode(mnt_tab *tb, mnt_fs *fs) -{ - mnt_fs *chld = NULL; - mnt_iter *itr = NULL; - struct treenode *node = NULL; - - if (!fs) { - /* first call - start with root FS and initialize tree buffer */ - if (mnt_tab_get_root_fs(tb, &fs)) - goto err; - - treebuf = malloc(termwidth); - if (!treebuf) - goto err; - } - - itr = mnt_new_iter(MNT_ITER_FORWARD); - if (!itr) - goto err; - - node = calloc(1, sizeof(*node)); - if (!node) - goto err; - - node->fs = fs; - mnt_fs_set_userdata(fs, (void *) node); - - while(mnt_tab_next_child_fs(tb, itr, fs, &chld) == 0) { - struct treenode *chnode; - - chnode = create_treenode(tb, chld); - if (!chnode) - break; - - chnode->parent = node; - - if (node->last) - node->last->next = chnode; - else - node->first = chnode; - - node->last = chnode; - } - - return node; - -err: - if (!fs) - free(treebuf); - free(node); - mnt_free_iter(itr); - return NULL; -} - -static void print_treenode(struct treenode *node, int line) -{ - print_fs(node->fs, line++); - - /* print children */ - node = node->first; - while(node) { - print_treenode(node, line++); - node = node->next; - } -} - -static void free_treenode(struct treenode *node) -{ - struct treenode *chld = node->first; - - if (!node->parent) /* root node */ - free(treebuf); - while(chld) { - struct treenode *next = chld->next; - free_treenode(chld); - chld = next; - } - - free(node); + return fs; } static int __attribute__((__noreturn__)) usage(FILE *out) @@ -884,12 +480,18 @@ errx_mutually_exclusive(const char *opts) int main(int argc, char *argv[]) { + /* libmount */ + mnt_tab *tb = NULL; + mnt_iter *itr = NULL; + mnt_fs *fs = NULL; char *tabfile = NULL; int direction = MNT_ITER_FORWARD; - mnt_tab *tb; - mnt_iter *itr; - mnt_fs *fs = NULL; - int c, ct = 0; + + /* table.h */ + struct tt *tt = NULL; + int tt_flags = 0; + + int i, c, rc = EXIT_FAILURE; struct option longopts[] = { { "ascii", 0, 0, 'a' }, @@ -928,13 +530,13 @@ int main(int argc, char *argv[]) columns[ncolumns++] = COL_OPTIONS; /* default output format */ - flags |= FL_TREE; + tt_flags |= TT_FL_TREE; while ((c = getopt_long(argc, argv, "cd:ehifo:O:klmnrst:uS:T:", longopts, NULL)) != -1) { switch(c) { case 'a': - tree_symbols = &ascii_tree_symbols; + tt_flags |= TT_FL_ASCII; break; case 'c': flags |= FL_CANONICALIZE; @@ -961,27 +563,28 @@ int main(int argc, char *argv[]) flags |= FL_FIRSTONLY; break; case 'u': - set_all_columns_wrap(TRUE); + set_all_columns_truncate(FALSE); break; case 'o': - set_columns(optarg); + if (set_columns(optarg)) + exit(EXIT_FAILURE); break; case 'O': set_match(COL_OPTIONS, optarg); break; - case 'm': + case 'm': /* mtab */ if (tabfile) errx_mutually_exclusive("--{fstab,mtab,kernel}"); tabfile = _PATH_MOUNTED; - flags &= ~FL_TREE; /* disable the default */ + tt_flags &= ~TT_FL_TREE; break; - case 's': + case 's': /* fstab */ if (tabfile) errx_mutually_exclusive("--{fstab,mtab,kernel}"); tabfile = _PATH_MNTTAB; - flags &= ~FL_TREE; /* disable the default */ + flags &= ~TT_FL_TREE; break; - case 'k': + case 'k': /* kernel (mountinfo) */ if (tabfile) errx_mutually_exclusive("--{fstab,mtab,kernel}"); tabfile = _PATH_PROC_MOUNTINFO; @@ -990,20 +593,21 @@ int main(int argc, char *argv[]) set_match(COL_FSTYPE, optarg); break; case 'r': - if (!(flags & FL_TREE) && !(flags & FL_RAW)) + if (!(tt_flags & TT_FL_TREE) && + !(tt_flags & TT_FL_RAW)) errx_mutually_exclusive("--{raw,list}"); - flags &= ~FL_TREE; /* disable the default */ - flags |= FL_RAW; /* enable raw */ + tt_flags &= ~TT_FL_TREE; /* disable the default */ + tt_flags |= TT_FL_RAW; /* enable raw */ break; case 'l': - if (flags & FL_RAW) + if (tt_flags & TT_FL_RAW) errx_mutually_exclusive("--{raw,list}"); - flags &= ~FL_TREE; /* disable the default */ + tt_flags &= ~TT_FL_TREE; /* disable the default */ break; case 'n': - flags |= FL_NOHEADINGS; + tt_flags |= TT_FL_NOHEADINGS; break; case 'S': set_match(COL_SOURCE, optarg); @@ -1019,16 +623,14 @@ int main(int argc, char *argv[]) } } - if (!tabfile) + if (!tabfile) { tabfile = _PATH_PROC_MOUNTINFO; -#ifdef HAVE_WIDECHAR - /* non-UTF terminal */ - if ((flags & FL_TREE) && tree_symbols != &ascii_tree_symbols && - strcmp(nl_langinfo(CODESET), "UTF-8")) - tree_symbols = &ascii_tree_symbols; -#endif - + if (access(tabfile, R_OK)) { /* old kernel? */ + tabfile = _PATH_PROC_MOUNTS; + tt_flags &= ~TT_FL_TREE; + } + } if (optind < argc && (get_match(COL_SOURCE) || get_match(COL_TARGET))) errx(EXIT_FAILURE, _( "options --target and --source can't be used together " @@ -1039,58 +641,75 @@ int main(int argc, char *argv[]) if (optind < argc) set_match(COL_TARGET, argv[optind++]); /* mountpoint */ + if (!is_listall_mode() || (flags & FL_FIRSTONLY)) + tt_flags &= ~TT_FL_TREE; + + /* + * initialize libmount + */ tb = parse_tabfile(tabfile); if (!tb) - return EXIT_FAILURE; + goto leave; itr = mnt_new_iter(direction); - if (!itr) - err(EXIT_FAILURE, _("failed to initialize libmount iterator")); - + if (!itr) { + warn(_("failed to initialize libmount iterator")); + goto leave; + } cache = mnt_new_cache(); - if (!cache) - err(EXIT_FAILURE, _("failed to initialize libmount cache")); - + if (!cache) { + warn(_("failed to initialize libmount cache")); + goto leave; + } mnt_tab_set_cache(tb, cache); - termwidth = terminal_get_width(); + /* + * initialize output formatting (table.h) + */ + tt = tt_new_table(tt_flags); + if (!tt) { + warn(_("failed to initialize output table")); + goto leave; + } + for (i = 0; i < ncolumns; i++) { + int fl = get_column_truncate(i) ? TT_FL_TRUNCATE : 0; - if (flags & FL_TREE) { - struct treenode *tree = create_treenode(tb, NULL); - if (!tree) - err(EXIT_FAILURE, _("failed to create tree")); + if (get_column_id(i) == COL_TARGET && (tt_flags & TT_FL_TREE)) + fl |= TT_FL_TREE; - while (mnt_tab_next_fs(tb, itr, &fs) == 0) { - set_widths(fs); - ct++; - } - recount_widths(); - print_treenode(tree, 0); - free_treenode(tree); - } else { - /* set width */ - - if (!(flags & FL_RAW)) { - while((fs = get_next_fs(tb, itr))) { - set_widths(fs); - if (flags & FL_FIRSTONLY) - break; - } - ct = 0; - mnt_reset_iter(itr, -1); - recount_widths(); + if (!tt_define_column(tt, get_column_name(i), + get_column_whint(i), fl)) { + warn(_("failed to initialize output column")); + goto leave; } + } - /* Print */ + /* + * Fill in data to the output table + */ + if (tt_flags & TT_FL_TREE) { + if (create_treenode(tt, tb, NULL, NULL)) + goto leave; + } else { while((fs = get_next_fs(tb, itr))) { - print_fs(fs, ct++); + if (!add_line(tt, fs, NULL)) + goto leave; if (flags & FL_FIRSTONLY) break; } } + + /* + * Print the output table + */ + tt_print_table(tt); + rc = EXIT_SUCCESS; +leave: + tt_free_table(tt); + mnt_free_tab(tb); mnt_free_cache(cache); mnt_free_iter(itr); - return ct ? EXIT_SUCCESS : 2; + return rc; } -- cgit v1.2.3 From 46e9ff0aebe0a58e62e5f964f9e8a021148175df Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 8 Apr 2010 14:56:49 +0200 Subject: lib: tt.c: don't print header for empty table Signed-off-by: Karel Zak --- lib/tt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tt.c b/lib/tt.c index e33d6321..cd651970 100644 --- a/lib/tt.c +++ b/lib/tt.c @@ -541,7 +541,7 @@ static void print_header(struct tt *tb, char *buf, size_t bufsz) { struct list_head *p; - if (tb->flags & TT_FL_NOHEADINGS) + if ((tb->flags & TT_FL_NOHEADINGS) || list_empty(&tb->tb_lines)) return; /* set width according to the size of data -- cgit v1.2.3 From afa03b9d9ba3e4fa658b01598a0146a0215e7920 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 8 Apr 2010 14:59:03 +0200 Subject: libmount: export mnt_init_debug() Signed-off-by: Karel Zak --- shlibs/mount/src/init.c | 2 -- shlibs/mount/src/mount.h.in | 2 ++ shlibs/mount/src/mount.sym | 1 + shlibs/mount/src/mountP.h | 2 -- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/shlibs/mount/src/init.c b/shlibs/mount/src/init.c index 33da47b5..544361bc 100644 --- a/shlibs/mount/src/init.c +++ b/shlibs/mount/src/init.c @@ -9,7 +9,6 @@ #include "mountP.h" -#ifdef CONFIG_LIBMOUNT_DEBUG int libmount_debug_mask; void mnt_init_debug(int mask) @@ -28,4 +27,3 @@ void mnt_init_debug(int mask) libmount_debug_mask); libmount_debug_mask |= DEBUG_INIT; } -#endif diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 7d13e706..eeddc812 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -102,6 +102,8 @@ typedef struct _mnt_fs mnt_fs; */ typedef struct _mnt_tab mnt_tab; +/* init.c */ +extern void mnt_init_debug(int mask); /* version.c */ extern int mnt_parse_version_string(const char *ver_string); diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym index 358d7b73..32740dce 100644 --- a/shlibs/mount/src/mount.sym +++ b/shlibs/mount/src/mount.sym @@ -129,6 +129,7 @@ global: mnt_tab_strerror; mnt_tab_update_file; mnt_unlock_file; + mnt_init_debug; local: *; }; diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index 4b4e5b5b..c9c96dcc 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -41,11 +41,9 @@ #ifdef CONFIG_LIBMOUNT_DEBUG #include extern int libmount_debug_mask; -extern void mnt_init_debug(int mask); #define DBG(m,x) if ((m) & libmount_debug_mask) x #else #define DBG(m,x) -#define mnt_init_debug(x) #endif #ifdef TEST_PROGRAM -- cgit v1.2.3 From 2e67aee904c288d5270f70fd43438462d7c166e3 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 8 Apr 2010 14:59:57 +0200 Subject: libmount: cleanup cache flags and debug messages Signed-off-by: Karel Zak --- shlibs/mount/src/cache.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c index 62d514d8..524979b6 100644 --- a/shlibs/mount/src/cache.c +++ b/shlibs/mount/src/cache.c @@ -24,7 +24,7 @@ */ #define MNT_CACHE_CHUNKSZ 128 -#define MNT_CACHE_ISTAG (1 << 1) /* entry is TAG */ +#define MNT_CACHE_ISTAG (1 << 1) /* entry is TAG */ #define MNT_CACHE_ISPATH (1 << 2) /* entry is path */ #define MNT_CACHE_TAGREAD (1 << 3) /* tag read by mnt_cache_read_tags() */ @@ -112,6 +112,11 @@ static int mnt_cache_add_entry(mnt_cache *cache, char *native, e->flag = flag; cache->nents++; + DBG(DEBUG_CACHE, + printf("cache: add entry[%2zd] (%s): %s: %s\n", + cache->nents, + (flag & MNT_CACHE_ISPATH) ? "path" : "tag", + real, native)); return 0; } @@ -141,10 +146,8 @@ static int mnt_cache_add_tag(mnt_cache *cache, const char *token, memcpy(native, token, tksz + 1); /* include '\0' */ memcpy(native + tksz + 1, value, vlsz + 1); - if (mnt_cache_add_entry(cache, native, real, flag)) + if (mnt_cache_add_entry(cache, native, real, flag | MNT_CACHE_ISTAG)) goto error; - DBG(DEBUG_CACHE, - printf("cache: added %s: %s=%s\n", real, token, value)); return 0; error: free(native); @@ -236,7 +239,6 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) if (!cache || !devname) return -1; - DBG(DEBUG_CACHE, printf("cache: tags for %s requested\n", devname)); /* check is device is already cached */ @@ -282,7 +284,7 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) if (!dev) goto error; if (mnt_cache_add_tag(cache, tags[i], data, dev, - (MNT_CACHE_ISTAG | MNT_CACHE_TAGREAD))) { + MNT_CACHE_TAGREAD)) { free(dev); goto error; } @@ -385,7 +387,6 @@ char *mnt_resolve_path(const char *path, mnt_cache *cache) } } - DBG(DEBUG_CACHE, printf("cache: added %s: %s\n", path, p)); return p; error: if (real != native) @@ -421,11 +422,10 @@ char *mnt_resolve_tag(const char *token, const char *value, mnt_cache *cache) p = blkid_evaluate_tag(token, value, cache ? &cache->bc : NULL); if (p && cache && - mnt_cache_add_tag(cache, token, value, p, MNT_CACHE_ISTAG)) + mnt_cache_add_tag(cache, token, value, p, 0)) goto error; } - DBG(DEBUG_CACHE, printf("cache: %s=%s --> %s\n", token, value, p)); return p; error: free(p); -- cgit v1.2.3 From 20aae9d352cb15b82625e88b4ad5cdea3f683f72 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 8 Apr 2010 15:01:12 +0200 Subject: libmount: add new debug messages Signed-off-by: Karel Zak --- shlibs/mount/src/tab.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/shlibs/mount/src/tab.c b/shlibs/mount/src/tab.c index 176a7d5a..819b11d3 100644 --- a/shlibs/mount/src/tab.c +++ b/shlibs/mount/src/tab.c @@ -228,6 +228,9 @@ int mnt_tab_get_root_fs(mnt_tab *tb, mnt_fs **root) if (!tb || !root) return -1; + DBG(DEBUG_TAB, fprintf(stderr, + "libmount: %s: lookup root fs\n", tb->filename)); + mnt_reset_iter(&itr, MNT_ITER_FORWARD); while(mnt_tab_next_fs(tb, &itr, &fs) == 0) { int id = mnt_fs_get_parent_id(fs); @@ -263,6 +266,10 @@ int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr, if (!tb || !itr || !parent) return -1; + DBG(DEBUG_TAB, fprintf(stderr, + "libmount: %s: lookup next child of %s\n", + tb->filename, mnt_fs_get_target(parent))); + parent_id = mnt_fs_get_id(parent); if (!parent_id) return -1; @@ -366,6 +373,9 @@ int mnt_tab_find_next_fs(mnt_tab *tb, mnt_iter *itr, if (!tb || !itr || !fs || !match_func) return -1; + DBG(DEBUG_TAB, fprintf(stderr, + "libmount: %s: lookup next fs\n", tb->filename)); + if (!itr->head) MNT_ITER_INIT(itr, &tb->ents); -- cgit v1.2.3 From 3ef87248bf6567651af96bf49a77f177a4a29621 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 8 Apr 2010 15:01:28 +0200 Subject: libmount: fix mnt_fs_match_source() Signed-off-by: Karel Zak --- shlibs/mount/src/fs.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c index aa38998b..d0fadc98 100644 --- a/shlibs/mount/src/fs.c +++ b/shlibs/mount/src/fs.c @@ -537,7 +537,6 @@ int mnt_fs_match_target(mnt_fs *fs, const char *target, mnt_cache *cache) */ int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache) { - int rc = 0; char *cn; const char *src, *t, *v; @@ -545,10 +544,11 @@ int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache) return 0; /* 1) native paths/tags */ - rc = !strcmp(source, fs->source); - if (rc || !cache) - return rc; + if (!strcmp(source, fs->source)) + return 1; + if (!cache) + return 0; if (fs->flags & (MNT_FS_NET | MNT_FS_PSEUDO)) return 0; @@ -558,19 +558,17 @@ int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache) /* 2) canonicalized and native */ src = mnt_fs_get_srcpath(fs); - if (src) - rc = !strcmp(cn, src); + if (src && !strcmp(cn, src)) + return 1; /* 3) canonicalized and canonicalized */ - if (src && !rc) { + if (src) { src = mnt_resolve_path(src, cache); - rc = !strcmp(cn, src); + if (src && !strcmp(cn, src)) + return 1; } - if (src && !rc) - /* fs->source is path and does not match with @source */ - return 0; - - if (mnt_fs_get_tag(fs, &t, &v)) + if (src || mnt_fs_get_tag(fs, &t, &v)) + /* src path does not match and tag is not defined */ return 0; /* read @source's tags to the cache */ @@ -590,10 +588,10 @@ int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache) } /* 4) has the @source a tag that matches with tag from @fs ? */ - if (!mnt_cache_device_has_tag(cache, cn, t, v)) - return 0; + if (mnt_cache_device_has_tag(cache, cn, t, v)) + return 1; - return 1; + return 0; } /** -- cgit v1.2.3 From ac808156cb45a6ae6696563991eb7e8811982f3c Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 8 Apr 2010 15:02:32 +0200 Subject: findmnt: don't swap source and target for tags Signed-off-by: Karel Zak --- misc-utils/findmnt.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index 70678235..6ce1ec8a 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -358,6 +358,7 @@ static mnt_tab *parse_tabfile(const char *path) mnt_tab_strerror(tb, buf, sizeof(buf)); warnx(_("%s: parse error: %s"), path, buf); } + return tb; } @@ -582,7 +583,7 @@ int main(int argc, char *argv[]) if (tabfile) errx_mutually_exclusive("--{fstab,mtab,kernel}"); tabfile = _PATH_MNTTAB; - flags &= ~TT_FL_TREE; + tt_flags &= ~TT_FL_TREE; break; case 'k': /* kernel (mountinfo) */ if (tabfile) @@ -593,10 +594,6 @@ int main(int argc, char *argv[]) set_match(COL_FSTYPE, optarg); break; case 'r': - if (!(tt_flags & TT_FL_TREE) && - !(tt_flags & TT_FL_RAW)) - errx_mutually_exclusive("--{raw,list}"); - tt_flags &= ~TT_FL_TREE; /* disable the default */ tt_flags |= TT_FL_RAW; /* enable raw */ break; @@ -644,9 +641,23 @@ int main(int argc, char *argv[]) if (!is_listall_mode() || (flags & FL_FIRSTONLY)) tt_flags &= ~TT_FL_TREE; + if (!(flags & FL_NOSWAPMATCH) && + !get_match(COL_TARGET) && get_match(COL_SOURCE)) { + /* + * Check if we can swap source and target, it's + * not possible if the source is LABEL=/UUID= + */ + const char *x = get_match(COL_SOURCE); + + if (!strncmp(x, "LABEL=", 6) || !strncmp(x, "UUID=", 5)) + flags |= FL_NOSWAPMATCH; + } + /* * initialize libmount */ + mnt_init_debug(0); + tb = parse_tabfile(tabfile); if (!tb) goto leave; @@ -656,6 +667,7 @@ int main(int argc, char *argv[]) warn(_("failed to initialize libmount iterator")); goto leave; } + cache = mnt_new_cache(); if (!cache) { warn(_("failed to initialize libmount cache")); @@ -671,6 +683,7 @@ int main(int argc, char *argv[]) warn(_("failed to initialize output table")); goto leave; } + for (i = 0; i < ncolumns; i++) { int fl = get_column_truncate(i) ? TT_FL_TRUNCATE : 0; -- cgit v1.2.3 From 62b4550fdeb059052096c97ec3ed7b166aa4ba0d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 8 Apr 2010 15:41:37 +0200 Subject: findmnt: add man page Signed-off-by: Karel Zak --- misc-utils/Makefile.am | 1 + misc-utils/findmnt.8 | 148 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 misc-utils/findmnt.8 diff --git a/misc-utils/Makefile.am b/misc-utils/Makefile.am index b5029166..cb3edcf1 100644 --- a/misc-utils/Makefile.am +++ b/misc-utils/Makefile.am @@ -48,6 +48,7 @@ wipefs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir) findmnt_LDADD = $(ul_libmount_la) findmnt_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir) findmnt_SOURCES = findmnt.c $(top_srcdir)/lib/tt.c +dist_man_MANS += findmnt.8 if HAVE_STATIC_BLKID sbin_PROGRAMS += blkid.static blkid_static_SOURCES = $(blkid_SOURCES) diff --git a/misc-utils/findmnt.8 b/misc-utils/findmnt.8 new file mode 100644 index 00000000..81a6072e --- /dev/null +++ b/misc-utils/findmnt.8 @@ -0,0 +1,148 @@ +.\" -*- nroff -*- +.TH FINDMNT 8 "Apr 2010" "Version 1.0" +.SH NAME +findmnt \- find a filesystem +.SH SYNOPSIS +.B findmnt +.RB [ options ] +.sp +.B findmnt +.RB [ options ] +.IR device | mountpoint +.sp +.B findmnt +.RB [ options ] +.RB [ \--source ] +.IR device +.RB [ \--target ] +.IR mountpoint +.SH DESCRIPTION +.B findmnt +will list all mounted filesytems or search for a filesystem. The +.B findmnt +is able to search in +.IR /etc/fstab , +.IR /etc/mtab +or +.IR /proc/self/mountinfo . +If +.IR device +or +.IR mountpoint +is not given, all filesystems are show. +.PP +The command prints all mounted filesystems in tree-like format by default. +.SH OPTIONS +.IP "\fB\-h, \-\-help\fP" +Print help and exit. +.IP "\fB\-s, \-\-fstab\fP" +Search in +.IR /etc/fstab . +The output is in the list format (see --list). +.IP "\fB\-m, \-\-mtab\fP" +Search in +.IR /etc/mtab . +The output is in the list format (see --list). +.IP "\fB\-k, \-\-kernel\fP" +Search in +.IR /proc/self/mountinfo . +The output is in the tree-like format. This is the default. +.IP "\fB\-c, \-\-canonicalize\fP" +Canonicalize all printed paths. +.IP "\fB\-d, \-\-direction \fIword\fP" +Search direction - +.IR forward +or +.IR backward . +.IP "\fB\-e, \-\-evaluate\fP" +Convert all tags (LABEL or UUID) to the device names. +.IP "\fB\-f, \-\-first-only\fP" +Print the first matching filesystem only. +.IP "\fB\-i, \-\-invert\fP" +Invert sense of matching. +.IP "\fB\-l, \-\-list\fP" +Use list output format. +.IP "\fB\-n, \-\-noheadings\fP" +Do not print header line. +.IP "\fB\-u, \-\-notruncate\fP" +Do not truncate text in columns. The default is not truncate +.BR TARGET , +.BR SOURCE , +.BR UUID +and +.BR LABEL +columns. This option disables text truncation in the all others columns. +.IP "\fB\-O, \-\-options \fIlist\fP" +Used to limit the set of printed filesystems. More than one option +may be specified in a comma separated list. The +.B \-t +and +.B \-O +options are cumulative in effect. It is different from +.B \-t +in that each option is matched exactly; a leading +.I no +at the beginning +of one option does not negate the rest. For more details see +.BR mount (8). +.IP "\fB\-o, \-\-output \fIlist\fP" +Define output columns. Currently are supported +.BR SOURCE , +.BR TARGET , +.BR FSTYPE , +.BR OPTIONS , +.BR LABEL +and +.BR UUID . +The +.BR TARGET +column contains tree formatting if the +.B \-\-list +or +.B \-\-raw +options are not specified. +.IP "\fB\-r, \-\-raw\fP" +Use raw output format. +.IP "\fB\-a, \-\-ascii\fP" +Use ascii chars for tree formatting. +.IP "\fB\-t, \-\-types \fIlist\fP" +Used to limit the set of printed filesystems. More than one type may be +specified in a comma separated list. The list of filesystem types can be +prefixed with +.I no +to specify the filesystem types on which no action should be taken. For +more details see +.BR mount (8). +.IP "\fB\-S, \-\-source \fIspec\fP" +Explicitly define mount source. Supported are device, LABEL= or UUID=. +.IP "\fB\-T, \-\-target \fIdir\fP" +Explicitly define mount target (mountpoint directory). +.SH EXAMPLES +.IP "\fBfindmnt \-\-fstab \-t nfs\fP" +Prints all nfs filesystems defined in +.IR /etc/fstab . +.IP "\fBfindmnt \-\-fstab /mnt/foo\fP" +Prints all +.IR /etc/fstab +filesystems where mountpoint directory is /mnt/foo. It also prints bind mounts where /mnt/foo +is a source. +.IP "\fBfindmnt \-\-fstab --target /mnt/foo\fP" +Prints all +.IR /etc/fstab +filesystems where mountpoint directory is /mnt/foo. +.IP "\fBfindmnt --fstab --evaluate\fP" +Prints all +.IR /etc/fstab +filesystems and converts LABEL= and UUID= tags to the real device names. +.IP "\fBfindmnt -n --raw --evaluate --output=target LABEL=/boot +Prints only mountpoint where is mounted filesystem with a label "/boot". +.SH AUTHORS +.nf +Karel Zak +.fi +.SH SEE ALSO +.BR mount (8), +.BR fstab (5) +.SH AVAILABILITY +The findmnt command is part of the util-linux-ng package and is available from +ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. -- cgit v1.2.3 From 192c6aad9c8e6ae5c4a480f41b9359180a468150 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 14 Apr 2010 14:01:24 +0200 Subject: libmount: cleanup docs Signed-off-by: Karel Zak --- shlibs/mount/src/cache.c | 32 ++++++++----- shlibs/mount/src/fs.c | 107 ++++++++++++++++++++++++++----------------- shlibs/mount/src/init.c | 16 +++++++ shlibs/mount/src/iter.c | 11 ++++- shlibs/mount/src/lock.c | 34 ++++++++++---- shlibs/mount/src/mount.h.in | 2 +- shlibs/mount/src/optent.c | 76 +++++++++++++++--------------- shlibs/mount/src/optls.c | 56 +++++++++++++++------- shlibs/mount/src/optmap.c | 12 +++-- shlibs/mount/src/optstr.c | 12 ++++- shlibs/mount/src/tab.c | 68 ++++++++++++++------------- shlibs/mount/src/tab_parse.c | 20 ++++---- shlibs/mount/src/utils.c | 5 ++ shlibs/mount/src/version.c | 6 +++ 14 files changed, 296 insertions(+), 161 deletions(-) diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c index 524979b6..bd6ea3a0 100644 --- a/shlibs/mount/src/cache.c +++ b/shlibs/mount/src/cache.c @@ -5,6 +5,16 @@ * GNU Lesser General Public License. */ +/** + * SECTION: cache + * @title: Cache + * @short_description: paths and tags (UUID/LABEL) caching + * + * The cache is a very simple API for work with tags (LABEL, UUID, ...) and + * paths. The cache uses libblkid as a backend from TAGs resolution. + * + * All returned paths are always canonicalized. + */ #include #include #include @@ -20,7 +30,7 @@ #include "mountP.h" /* - * Canonicalized (resolved) paths cache + * Canonicalized (resolved) paths & tags cache */ #define MNT_CACHE_CHUNKSZ 128 @@ -55,7 +65,7 @@ struct _mnt_cache { /** * mnt_new_cache: * - * Returns new mnt_cache instance or NULL in case of ENOMEM error. + * Returns: new mnt_cache instance or NULL in case of ENOMEM error. */ mnt_cache *mnt_new_cache(void) { @@ -66,7 +76,7 @@ mnt_cache *mnt_new_cache(void) * mnt_free_cache: * @cache: pointer to mnt_cache instance * - * Deallocates mnt_cache. + * Deallocates the cache. */ void mnt_free_cache(mnt_cache *cache) { @@ -158,9 +168,9 @@ error: /** * mnt_cache_find_path: * @cache: pointer to mnt_cache instance - * @path: requested "native" (non-canonicalized) path + * @path: "native" (non-canonicalized) path * - * Returns cached canonicalized path or NULL. + * Returns: cached canonicalized path or NULL. */ const char *mnt_cache_find_path(mnt_cache *cache, const char *path) { @@ -188,7 +198,7 @@ const char *mnt_cache_find_path(mnt_cache *cache, const char *path) * @token: tag name * @value: tag value * - * Returns cached path or NULL. + * Returns: cached path or NULL. */ const char *mnt_cache_find_tag(mnt_cache *cache, const char *token, const char *value) @@ -223,7 +233,7 @@ const char *mnt_cache_find_tag(mnt_cache *cache, * * Reads @devname LABEL and UUID to the @cache. * - * Returns: 0 if at least on tag was added, 1 if no tag was added or + * Returns: 0 if at least one tag was added, 1 if no tag was added or * -1 in case of error. */ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) @@ -355,7 +365,7 @@ char *mnt_cache_find_tag_value(mnt_cache *cache, * @path: "native" path * @cache: cache for results or NULL * - * Returns absolute path or NULL in case of error. The result has to be + * Returns: absolute path or NULL in case of error. The result has to be * deallocated by free() if @cache is NULL. */ char *mnt_resolve_path(const char *path, mnt_cache *cache) @@ -401,7 +411,7 @@ error: * @value: tag value * @cache: for results or NULL * - * Returns device name or NULL in case of error. The result has to be + * Returns: device name or NULL in case of error. The result has to be * deallocated by free() if @cache is NULL. */ char *mnt_resolve_tag(const char *token, const char *value, mnt_cache *cache) @@ -439,7 +449,7 @@ error: * @spec: path or tag * @cache: paths cache * - * Returns canonicalized path or NULL. The result has to be + * Returns: canonicalized path or NULL. The result has to be * deallocated by free() if @cache is NULL. */ char *mnt_resolve_spec(const char *spec, mnt_cache *cache) @@ -558,7 +568,7 @@ int main(int argc, char *argv[]) struct mtest ts[] = { { "--resolve-path", test_resolve_path, " resolve paths from stdin" }, { "--resolve-spec", test_resolve_spec, " evaluate specs from stdin" }, - { "--read-tags", test_read_tags, " read devname or TAG stdin" }, + { "--read-tags", test_read_tags, " read devname or TAG from stdin" }, { NULL } }; diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c index d0fadc98..885a4a2b 100644 --- a/shlibs/mount/src/fs.c +++ b/shlibs/mount/src/fs.c @@ -3,10 +3,14 @@ * * This file may be redistributed under the terms of the * GNU Lesser General Public License. - * - * The mnt_fs is representation of one line in a fstab / mtab / mountinfo. */ +/** + * SECTION: fs + * @title: Filesystem + * @short_description: mnt_fs is represents one entry in fstab/mtab/mountinfo + * + */ #include #include #include @@ -20,7 +24,7 @@ /** * mnt_new_fs: * - * Returns newly allocated mnt_file fs. + * Returns: newly allocated mnt_file fs. */ mnt_fs *mnt_new_fs(void) { @@ -61,7 +65,7 @@ void mnt_free_fs(mnt_fs *fs) * mnt_fs_get_userdata: * @fs: mnt_file instance * - * Returns private data set by mnt_fs_set_userdata() or NULL. + * Returns: private data set by mnt_fs_set_userdata() or NULL. */ void *mnt_fs_get_userdata(mnt_fs *fs) { @@ -74,7 +78,7 @@ void *mnt_fs_get_userdata(mnt_fs *fs) * * The "userdata" are library independent data. * - * Returns 0 or -1 in case of error (if @fs is NULL). + * Returns: 0 or -1 in case of error (if @fs is NULL). */ int mnt_fs_set_userdata(mnt_fs *fs, void *data) { @@ -89,16 +93,13 @@ int mnt_fs_set_userdata(mnt_fs *fs, void *data) * @fs: mnt_file (fstab/mtab/mountinfo) fs * * The mount "source path" is: - * - a directory for 'bind' mounts (in fstab or mtab only) - * - a device name for standard mounts - * - NULL when path is not set (for example when TAG - * (LABEL/UUID) is defined) + * - a directory for 'bind' mounts (in fstab or mtab only) + * - a device name for standard mounts * * See also mnt_fs_get_tag() and mnt_fs_get_source(). * - * Returns mount "source" path or NULL in case of error or when the path + * Returns: mount source path or NULL in case of error or when the path * is not defined. - * */ const char *mnt_fs_get_srcpath(mnt_fs *fs) { @@ -115,7 +116,7 @@ const char *mnt_fs_get_srcpath(mnt_fs *fs) /** * @fs: mnt_file (fstab/mtab/mountinfo) fs * - * Returns mount "source". Note that the source could be unparsed TAG + * Returns: mount source. Note that the source could be unparsed TAG * (LABEL/UUID). See also mnt_fs_get_srcpath() and mnt_fs_get_tag(). */ const char *mnt_fs_get_source(mnt_fs *fs) @@ -150,7 +151,9 @@ int __mnt_fs_set_source(mnt_fs *fs, char *source) * @fs: fstab/mtab/mountinfo entry * @source: new source * - * Returns 0 on success or -1 in case of error. + * This function creates a private copy (strdup()) of @source. + * + * Returns: 0 on success or -1 in case of error. */ int mnt_fs_set_source(mnt_fs *fs, const char *source) { @@ -179,14 +182,15 @@ int mnt_fs_set_source(mnt_fs *fs, const char *source) * * "TAG" is NAME=VALUE (e.g. LABEL=foo) * - * The TAG is the first column in the fstab file. The TAG - * or "srcpath" has to be always set for all entries. + * The TAG is the first column in the fstab file. The TAG or "srcpath" has to + * be always set for all entries. * * See also mnt_fs_get_source(). * - * Example: + * + * * char *src; - * mnt_fs *fs = mnt_file_find_target(mf, "/home"); + * mnt_fs *fs = mnt_tab_find_target(tb, "/home", MNT_ITER_FORWARD); * * if (!fs) * goto err; @@ -198,8 +202,10 @@ int mnt_fs_set_source(mnt_fs *fs, const char *source) * printf("%s: %s\n", tag, val); // LABEL or UUID * } else * printf("device: %s\n", src); // device or bind path + * + * * - * Returns 0 on success or -1 in case that a TAG is not defined. + * Returns: 0 on success or -1 in case that a TAG is not defined. */ int mnt_fs_get_tag(mnt_fs *fs, const char **name, const char **value) { @@ -216,7 +222,7 @@ int mnt_fs_get_tag(mnt_fs *fs, const char **name, const char **value) * mnt_fs_get_target: * @fs: fstab/mtab/mountinfo entry pointer * - * Returns pointer to mountpoint path or NULL + * Returns: pointer to mountpoint path or NULL */ const char *mnt_fs_get_target(mnt_fs *fs) { @@ -229,7 +235,9 @@ const char *mnt_fs_get_target(mnt_fs *fs) * @fs: fstab/mtab/mountinfo entry * @target: mountpoint * - * Returns 0 on success or -1 in case of error. + * This function creates a private copy (strdup()) of @target. + * + * Returns: 0 on success or -1 in case of error. */ int mnt_fs_set_target(mnt_fs *fs, const char *target) { @@ -253,7 +261,7 @@ int mnt_fs_set_target(mnt_fs *fs, const char *target) * mnt_fs_get_fstype: * @fs: fstab/mtab/mountinfo entry pointer * - * Returns pointer to filesystem type. + * Returns: pointer to filesystem type. */ const char *mnt_fs_get_fstype(mnt_fs *fs) { @@ -287,7 +295,9 @@ int __mnt_fs_set_fstype(mnt_fs *fs, char *fstype) * @fs: fstab/mtab/mountinfo entry * @fstype: filesystem type * - * Returns 0 on success or -1 in case of error. + * This function creates a private copy (strdup()) of @fstype. + * + * Returns: 0 on success or -1 in case of error. */ int mnt_fs_set_fstype(mnt_fs *fs, const char *fstype) { @@ -308,7 +318,7 @@ int mnt_fs_set_fstype(mnt_fs *fs, const char *fstype) * mnt_fs_get_optstr: * @fs: fstab/mtab/mountinfo entry pointer * - * Returns pointer to mount option string with all options (FS and VFS) + * Returns: pointer to mount option string with all options (FS and VFS) */ const char *mnt_fs_get_optstr(mnt_fs *fs) { @@ -321,22 +331,30 @@ const char *mnt_fs_get_optstr(mnt_fs *fs) * @fs: fstab/mtab/mountinfo entry * @optstr: options string * - * Returns 0 on success or -1 in case of error. + * This function creates a private copy (strdup()) of @optstr. + * + * Returns: 0 on success or -1 in case of error. */ int mnt_fs_set_optstr(mnt_fs *fs, const char *optstr) { + char *p; + assert(fs); if (!fs || !optstr) return -1; + p = strdup(optstr); + if (!p) + return -1; + free(fs->optstr); free(fs->fs_optstr); free(fs->vfs_optstr); fs->fs_optstr = fs->vfs_optstr = NULL; - fs->optstr = strdup(optstr); + fs->optstr = p; - return fs->optstr ? 0 : -1; + return 0; } /** @@ -345,7 +363,7 @@ int mnt_fs_set_optstr(mnt_fs *fs, const char *optstr) * * This function works for "mountinfo" files only. * - * Returns pointer to superblock (fs-depend) mount option string or NULL. + * Returns: pointer to superblock (fs-depend) mount option string or NULL. */ const char *mnt_fs_get_fs_optstr(mnt_fs *fs) { @@ -359,7 +377,7 @@ const char *mnt_fs_get_fs_optstr(mnt_fs *fs) * * This function works for "mountinfo" files only. * - * Returns pointer to fs-independent (VFS) mount option string or NULL. + * Returns: pointer to fs-independent (VFS) mount option string or NULL. */ const char *mnt_fs_get_vfs_optstr(mnt_fs *fs) { @@ -372,7 +390,7 @@ const char *mnt_fs_get_vfs_optstr(mnt_fs *fs) * mnt_fs_get_freq: * @fs: fstab/mtab/mountinfo entry pointer * - * Returns "dump frequency in days". + * Returns: "dump frequency in days". */ int mnt_fs_get_freq(mnt_fs *fs) { @@ -385,7 +403,7 @@ int mnt_fs_get_freq(mnt_fs *fs) * @fs: fstab/mtab entry pointer * @freq: dump frequency in days * - * Returns 0 on success or -1 in case of error. + * Returns: 0 on success or -1 in case of error. */ int mnt_fs_set_freq(mnt_fs *fs, int freq) { @@ -400,7 +418,7 @@ int mnt_fs_set_freq(mnt_fs *fs, int freq) * mnt_fs_get_passno: * @fs: fstab/mtab entry pointer * - * Returns "pass number on parallel fsck". + * Returns: "pass number on parallel fsck". */ int mnt_fs_get_passno(mnt_fs *fs) { @@ -413,7 +431,7 @@ int mnt_fs_get_passno(mnt_fs *fs) * @fs: fstab/mtab entry pointer * @passno: pass number * - * Returns 0 on success or -1 in case of error. + * Returns: 0 on success or -1 in case of error. */ int mnt_fs_set_passno(mnt_fs *fs, int passno) { @@ -469,7 +487,7 @@ dev_t mnt_fs_get_devno(mnt_fs *fs) * @value: returns pointer to the begin of the value (e.g. name=VALUE) or NULL * @valsz: returns size of options value or 0 * - * Returns 0 on success, 1 when not found the @name or -1 in case of error. + * Returns: 0 on success, 1 when not found the @name or -1 in case of error. */ int mnt_fs_get_option(mnt_fs *fs, const char *name, char **value, size_t *valsz) @@ -491,7 +509,7 @@ int mnt_fs_get_option(mnt_fs *fs, const char *name, * * The 2nd and 3rd attempts are not performed when @cache is NULL. * - * Returns 1 if @fs target is equal to @target else 0. + * Returns: 1 if @fs target is equal to @target else 0. */ int mnt_fs_match_target(mnt_fs *fs, const char *target, mnt_cache *cache) { @@ -533,7 +551,7 @@ int mnt_fs_match_target(mnt_fs *fs, const char *target, mnt_cache *cache) * The 2nd, 3rd and 4th attempts are not performed when @cache is NULL. The * 2nd and 3rd attempts are not performed if @fs->source is tag. * - * Returns 1 if @fs source is equal to @source else 0. + * Returns: 1 if @fs source is equal to @source else 0. */ int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache) { @@ -601,7 +619,7 @@ int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache) * * For more details see mnt_match_fstype(). * - * Returns 1 if @fs type is matching to @types else 0. The function returns + * Returns: 1 if @fs type is matching to @types else 0. The function returns * 0 when types is NULL. */ int mnt_fs_match_fstype(mnt_fs *fs, const char *types) @@ -616,7 +634,7 @@ int mnt_fs_match_fstype(mnt_fs *fs, const char *types) * * For more details see mnt_match_options(). * - * Returns 1 if @fs type is matching to @options else 0. The function returns + * Returns: 1 if @fs type is matching to @options else 0. The function returns * 0 when types is NULL. */ int mnt_fs_match_options(mnt_fs *fs, const char *options) @@ -662,7 +680,7 @@ static char *mangle(const char *s) /** * mnt_fprintf_line: * @f: FILE - * @fmt: printf-like format string (see MNT_MFILE_PRINTFMT) + * @fmt: printf-like format string (see MNT_TAB_PRINTFMT) * @source: (spec) device name or tag=value * @target: mountpoint * @fstype: filesystem type @@ -670,7 +688,12 @@ static char *mangle(const char *s) * @freq: dump frequency in days * @passno: pass number on parallel fsck * - * Returns return value from fprintf(). + * It's recommended to use this function rather than directly call fprintf() to + * write an entry to mtab/fstab. All data in these files has to be properly + * formatted (for example space within paths/tags has to be escaped, see + * fstab(5) for more details). + * + * Returns: return value from fprintf(). */ int mnt_fprintf_line( FILE *f, const char *fmt, @@ -709,9 +732,9 @@ done: * mnt_fs_fprintf: * @fs: fstab/mtab/mountinfo entry * @f: FILE - * @fmt: printf-like format string (see MNT_MFILE_PRINTFMT) + * @fmt: printf-like format string (see MNT_TAB_PRINTFMT) * - * Returns return value from fprintf(). + * Returns: return value from fprintf(). */ int mnt_fs_fprintf(mnt_fs *fs, FILE *f, const char *fmt) { @@ -736,7 +759,7 @@ int mnt_fs_fprintf(mnt_fs *fs, FILE *f, const char *fmt) * @fs: fstab/mtab/mountinfo entry * @file: output * - * Returns 0 on success or -1 in case of error. + * Returns: 0 on success or -1 in case of error. */ int mnt_fs_print_debug(mnt_fs *fs, FILE *file) { diff --git a/shlibs/mount/src/init.c b/shlibs/mount/src/init.c index 544361bc..68c13f94 100644 --- a/shlibs/mount/src/init.c +++ b/shlibs/mount/src/init.c @@ -5,12 +5,28 @@ * GNU Lesser General Public License. */ +/** + * SECTION: init + * @title: Library initialization + * @short_description: initialize debuging + */ + #include #include "mountP.h" int libmount_debug_mask; +/** + * mnt_init_debug: + * @mask: debug mask (0xffff to enable full debuging) + * + * If the @mask is not specified then this function reads + * LIBMOUNT_DEBUG environment variable to get the mask. + * + * Already initialized debugging stuff cannot be changed. It does not + * have effect to call this function twice. + */ void mnt_init_debug(int mask) { if (libmount_debug_mask & DEBUG_INIT) diff --git a/shlibs/mount/src/iter.c b/shlibs/mount/src/iter.c index 4baa7ffb..5c02c2a7 100644 --- a/shlibs/mount/src/iter.c +++ b/shlibs/mount/src/iter.c @@ -4,6 +4,15 @@ * This file may be redistributed under the terms of the * GNU Lesser General Public License. */ + +/** + * SECTION: iter + * @title: Iterator + * @short_description: unified iterator + * + * The iterator keeps direction and last position for access to the internal + * library tables/lists. + */ #include #include #include @@ -14,7 +23,7 @@ * mnt_new_iter: * @direction: MNT_INTER_{FOR,BACK}WARD direction * - * Returns newly allocated generic libmount iterator. + * Returns: newly allocated generic libmount iterator. */ mnt_iter *mnt_new_iter(int direction) { diff --git a/shlibs/mount/src/lock.c b/shlibs/mount/src/lock.c index 2d2b3c07..e0b0d0b8 100644 --- a/shlibs/mount/src/lock.c +++ b/shlibs/mount/src/lock.c @@ -4,6 +4,16 @@ * This file may be redistributed under the terms of the * GNU Lesser General Public License. */ + +/** + * SECTION: lock + * @title: Mtab locking + * @short_description: locking methods for work with /etc/mtab + * + * The lock is backwardly compatible with the standard linux /etc/mtab locking. + * Note, it's necessary to use the same locking schema in all application that + * access the file. + */ #include #include #include @@ -39,7 +49,7 @@ struct _mnt_lock { * @lockfile: path to lockfile or NULL (default is _PATH_MOUNTED_LOCK) * @id: unique linkfile identifier or 0 (default is getpid()) * - * Returns newly allocated lock handler or NULL on case of error. + * Returns: newly allocated lock handler or NULL on case of error. */ mnt_lock *mnt_new_lock(const char *lockfile, pid_t id) { @@ -79,7 +89,7 @@ void mnt_free_lock(mnt_lock *ml) * mnt_lock_get_lockfile: * @ml: mnt_lock handler * - * Returns path to lockfile. + * Returns: path to lockfile. */ const char *mnt_lock_get_lockfile(mnt_lock *ml) { @@ -94,7 +104,7 @@ const char *mnt_lock_get_lockfile(mnt_lock *ml) * mnt_lock_get_linkfile: * @ml: mnt_lock handler * - * Returns unique (per process) path to linkfile. + * Returns: unique (per process) path to linkfile. */ const char *mnt_lock_get_linkfile(mnt_lock *ml) { @@ -126,7 +136,7 @@ static void mnt_lockalrm_handler(int sig) * Waits for F_SETLKW, unfortunately we have to use SIGALRM here to interrupt * fcntl() to avoid never ending waiting. * - * Returns 0 on success, 1 on timeout, -errno on error. + * Returns: 0 on success, 1 on timeout, -errno on error. */ static int mnt_wait_lock(mnt_lock *ml, struct flock *fl, time_t maxtime) { @@ -189,7 +199,7 @@ static int mnt_wait_lock(mnt_lock *ml, struct flock *fl, time_t maxtime) * There was very small number of attempts and extremely long waiting (1s) * that is useless on machines with large number of mount processes. * - * Now we wait few thousand microseconds between attempts and we have global + * Now we wait few thousand microseconds between attempts and we have a global * time limit (30s) rather than limit for number of attempts. The advantage * is that this method also counts time which we spend in fcntl(F_SETLKW) and * number of attempts is not restricted. @@ -256,11 +266,13 @@ void mnt_unlock_file(mnt_lock *ml) * 1. create linkfile (e.g. /etc/mtab~.) * 2. link linkfile --> lockfile (e.g. /etc/mtab~. --> /etc/mtab~) * - * 3. a) link() successful: setups F_SETLK lock (see fcnlt(2)) - * b) link() failed: wait (max 30s) on F_SETLKW lock, goto 2. + * 3. a) link() success: setups F_SETLK lock (see fcnlt(2)) + * b) link() failed: wait (max 30s) on F_SETLKW lock, goto 2. * * Example: * + * + * * mnt_lock *ml; * * void unlock_fallback(void) @@ -292,8 +304,10 @@ void mnt_unlock_file(mnt_lock *ml) * ml = NULL; * return 0; * } + * + * * - * Returns 0 on success or -1 in case of error. + * Returns: 0 on success or -1 in case of error. */ int mnt_lock_file(mnt_lock *ml) { @@ -497,6 +511,10 @@ int test_lock(struct mtest *ts, int argc, char *argv[]) return 0; } +/* + * Note that this test should be executed from a script that creates many + * parallel processes, otherwise this test does not make sense. + */ int main(int argc, char *argv[]) { struct mtest tss[] = { diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index eeddc812..c3100ee0 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -248,7 +248,7 @@ extern int mnt_fs_match_fstype(mnt_fs *fs, const char *types); extern int mnt_fs_match_options(mnt_fs *fs, const char *options); /* mtab/fstab line */ -#define MNT_MFILE_PRINTFMT "%s %s %s %s %d %d\n" +#define MNT_TAB_PRINTFMT "%s %s %s %s %d %d\n" extern int mnt_fprintf_line( FILE *f, diff --git a/shlibs/mount/src/optent.c b/shlibs/mount/src/optent.c index 4bb7db10..749f447c 100644 --- a/shlibs/mount/src/optent.c +++ b/shlibs/mount/src/optent.c @@ -5,6 +5,11 @@ * GNU Lesser General Public License. */ +/** + * SECTION: optent + * @title: Mount option entry + * @short_description: the entry keeps one parsed mount option + */ #include #include #include @@ -174,7 +179,7 @@ err: * Parses the first mount option from @optstr and move @optstr pointer * to the next option. * - * Returns: new optent (parsed option) or NULL in case of error. + * Returns new optent (parsed option) or NULL in case of error. */ mnt_optent *mnt_new_optent_from_optstr(char **optstr, struct mnt_optmap const **maps, int nmaps) @@ -245,10 +250,7 @@ err: * mnt_optent_get_map: * @op: pointer to mnt_optent instance * - * Note that the @op has to be associated with any option map (see - * mnt_optent_assign_map()) or NULL is returned. - * - * Returns pointer to the head of the map that is associated with the option or + * Returns: pointer to the head of the map that is associated with the option or * NULL (for "extra options"). */ const struct mnt_optmap *mnt_optent_get_map(mnt_optent *op) @@ -261,10 +263,7 @@ const struct mnt_optmap *mnt_optent_get_map(mnt_optent *op) * mnt_optent_get_map_entry: * @op: pointer to mnt_optent instance * - * Note that the @op has to be associated with any option map (see - * mnt_optent_assign_map()) or NULL is returned. - - * Returns pointer to the map entry that describes the option or NULL (for + * Returns: pointer to the map entry that describes the option or NULL (for * "extra options"). */ const struct mnt_optmap *mnt_optent_get_mapent(mnt_optent *op) @@ -277,10 +276,10 @@ const struct mnt_optmap *mnt_optent_get_mapent(mnt_optent *op) * mnt_optent_get_type: * @op: mnt_optent instance * - * Note that the @op has to be associated with any option map (see - * mnt_optent_assign_map()) or the default "%s]" is returned. + * Note that the @op has to be associated with any option map + * or the default "%s]" is returned. * - * Returns pointer to the begin of type format string or NULL. For example: + * Returns: pointer to the begin of type format string or NULL. For example: * * "%s" --> string, required argument (definition in the map is: "foo=%s") * "%s]" --> string, optional argument (definition in the map is: "foo[=%s]") @@ -302,7 +301,7 @@ const char *mnt_optent_get_type(mnt_optent *op) * * The function unset (zeroize) the option value if the @data pointer is NULL. * - * Returns 0 on success or -1 in case of error. + * Returns: 0 on success or -1 in case of error. */ int mnt_optent_set_value(mnt_optent *op, const char *data) { @@ -344,7 +343,7 @@ err: * mnt_optent_has_value: * @option: pointer to mnt_optent instance * - * Returns 1 if the option has actually set an argument value, or 0. + * Returns: 1 if the option has actually set an argument value, or 0. */ int mnt_optent_has_value(mnt_optent *op) { @@ -355,10 +354,10 @@ int mnt_optent_has_value(mnt_optent *op) * mnt_optent_require_value: * @op: pointer to mnt_optent instance * - * Note that the @op has to be associated with any option map (see - * mnt_optent_assign_map()) or 0 is returned. + * Note that the @op has to be associated with any option map + * or 0 is returned. * - * Returns 1 if the option requires an argument (option=). + * Returns: 1 if the option requires an argument (option=). */ int mnt_optent_require_value(mnt_optent *op) { @@ -369,7 +368,7 @@ int mnt_optent_require_value(mnt_optent *op) * mnt_optent_is_inverted: * @op: pointer to mnt_optent instance * - * Returns 1 if the option has MNT_INVERT mask or 0. + * Returns: 1 if the option has MNT_INVERT mask or 0. */ int mnt_optent_is_inverted(mnt_optent *op) { @@ -400,9 +399,9 @@ static int get_number_base(const char *type) * (e.g "123ABC" returns -1). * * This function also converts {enum0,enumN} type to number 0..N. For more - * details see info about options maps. + * details see info about option maps. * - * Returns 0 on success, -1 in case of error. + * Returns: 0 on success, -1 in case of error. */ int mnt_optent_strtoul_value(mnt_optent *op, unsigned long int *number) { @@ -456,7 +455,7 @@ err: * The whole option value has to be possible to convert to the number * (e.g "123ABC" returns -1). * - * Returns 0 on success, -1 in case of error. + * Returns: 0 on success, -1 in case of error. */ int mnt_optent_strtol_value(mnt_optent *op, long int *number) { @@ -500,7 +499,7 @@ err: * The whole option value has to be possible to convert to the number * (e.g "123ABC" returns -1). * - * Returns 0 on success, -1 in case of error. + * Returns: 0 on success, -1 in case of error. */ int mnt_optent_strtoull_value(mnt_optent *op, unsigned long long int *number) { @@ -539,7 +538,7 @@ err: * * See also mnt_optent_has_value(). * - * Returns pointer to value or NULL. + * Returns: pointer to value or NULL. */ const char *mnt_optent_get_value(mnt_optent *op) { @@ -550,7 +549,7 @@ const char *mnt_optent_get_value(mnt_optent *op) * mnt_optent_strlen_value: * @op: pointer to mnt_optent instance * - * Returns length of string that is necessary to print option value or -1 in + * Returns: length of string that is necessary to print option value or -1 in * case of error. */ int mnt_optent_strlen_value(mnt_optent *op) @@ -570,7 +569,7 @@ int mnt_optent_strlen_value(mnt_optent *op) * @str: resulting string * @size: size of string * - * Returns number of printed characters or negative number in case of error. + * Returns: number of printed characters or negative number in case of error. */ int mnt_optent_snprintf_value(mnt_optent *op, char *str, size_t size) { @@ -590,7 +589,7 @@ int mnt_optent_snprintf_value(mnt_optent *op, char *str, size_t size) * mnt_optent_dup_value: * @op: pointer to mnt_optent instance * - * Returns duplicate a option value. + * Returns: duplicate a option value. */ char *mnt_optent_dup_value(mnt_optent *op) { @@ -605,7 +604,7 @@ char *mnt_optent_dup_value(mnt_optent *op) * mnt_optent_get_name: * @op: pointer to mnt_optent instance * - * Returns option name or NULL in case of error. + * Returns: option name or NULL in case of error. */ const char *mnt_optent_get_name(mnt_optent *op) { @@ -620,7 +619,7 @@ const char *mnt_optent_get_name(mnt_optent *op) * The initial value of the option mask is a copy from map->mask. * Note that the mask is NOT a mountflag/ID. * - * Returns option mask or 0. + * Returns: option mask or 0. */ int mnt_optent_get_mask(mnt_optent *op) { @@ -638,7 +637,7 @@ int mnt_optent_get_mask(mnt_optent *op) * "nooption" (e.g. noexec) -- you have to carefully check for MNT_INVERT in * the option mask. See mnt_optent_get_flag(). * - * Returns option ID/mountflag or 0 for extra options (options with undefined + * Returns: option ID/mountflag or 0 for extra options (options with undefined * options map). */ int mnt_optent_get_id(mnt_optent *op) @@ -652,19 +651,22 @@ int mnt_optent_get_id(mnt_optent *op) * @op: pointer to mnt_optent instance * @flags: resulting flags * - * Adds option ID to @flags or removes option ID from @flags when the option - * is inverted option (e.g. "norelatime") + * Adds option ID to @flags or removes the ID from @flags when the option + * is an inverted option (e.g. "norelatime") * - * Example: + * + * * int flags = 0; * - * while(mnt_iterate_options(&itr, opts, map, &op) == 0) + * while(mnt_optls_next_option(&itr, opts, map, &op) == 0) * mnt_optent_get_flag(op, &flags); * * if (flags & MS_RELATIME) * printf("relatime is set\n"); + * + * * - * Returns 0 on success, -1 in case of error. + * Returns: 0 on success, -1 in case of error. */ int mnt_optent_get_flag(mnt_optent *op, int *flags) { @@ -686,9 +688,9 @@ int mnt_optent_get_flag(mnt_optent *op, int *flags) * mnt_optent_is_unknown: * @op: pointer to mnt_optent instance * - * The "extra option" is unknown option (undefined in any option map) + * The "extra options" are unknown options (undefined in any option map) * - * Return 1 or 0. + * Returns: 1 or 0. */ int mnt_optent_is_unknown(mnt_optent *op) { @@ -703,7 +705,7 @@ int mnt_optent_is_unknown(mnt_optent *op) * * Prints details about the option. * - * Returns 0 on success, -1 in case of error. + * Returns: 0 on success, -1 in case of error. */ int mnt_optent_print_debug(mnt_optent *op, FILE *file) { diff --git a/shlibs/mount/src/optls.c b/shlibs/mount/src/optls.c index f819d12b..f8b73470 100644 --- a/shlibs/mount/src/optls.c +++ b/shlibs/mount/src/optls.c @@ -4,6 +4,16 @@ * This file may be redistributed under the terms of the * GNU Lesser General Public License. */ + +/** + * SECTION: optls + * @title: Options container + * @short_description: high-level API for work with parsed mount options + * + * The optls container allows to work with parsed mount options and generate + * arguments for mount(2) syscall, output to mtab or analyze userspace specific + * options. + */ #include #include #include @@ -52,7 +62,8 @@ void mnt_free_optls(mnt_optls *ls) * @map: pointer to the custom map * * Stores pointer to the custom options map (options description). The map has - * to be accessible all time when the libmount works with options. + * to be accessible all time when the libmount works with options. (The map is + * usually a static array.) * * All already stored unknown mount options are reverified against the new map. * Note, it's recommented to add all maps to the @optls container before options @@ -60,6 +71,8 @@ void mnt_free_optls(mnt_optls *ls) * * Example (add new options "foo" and "bar="): * + * + * * #define MY_MS_FOO (1 << 1) * #define MY_MS_BAR (1 << 2) * @@ -71,6 +84,8 @@ void mnt_free_optls(mnt_optls *ls) * }; * * mnt_optls_add_map(ls, myoptions); + * + * * * Returns: 0 on success, 1 on failed verification, or -1 in case of error. */ @@ -108,7 +123,9 @@ int mnt_optls_add_map(mnt_optls *ls, const struct mnt_optmap *map) * @ls: pointer to mnt_optls instance * @map_id: built-in map id (see mnt_get_builtin_map()) * - * Returns 0 on success or -1 in case of error. + * Same as mnt_optls_add_map(), but works with libmount built in maps. + * + * Returns: 0 on success or -1 in case of error. */ int mnt_optls_add_builtin_map(mnt_optls *ls, int id) { @@ -165,10 +182,10 @@ mnt_optent *mnt_optls_add_option(mnt_optls *ls, * @ls: pointer to mnt_optls instance. * @optstr: zero terminated string with mount options (comma separaed list) * - * Parses @optstr and all options from @optstr are added to @optls. It's + * Parses @optstr and all options from @optstr are added to the @optls. It's * possible to call this function more than once. The new options from @optstr * will be appended to the container. -* + * * The options are accessible by mnt_optls_next_option(). * * If the @optls container is associated with any options map(s), all new @@ -183,7 +200,7 @@ mnt_optent *mnt_optls_add_option(mnt_optls *ls, * mnt_optls_add_option(ls, "user", "snake"); * mnt_optls_add_option(ls, "noexec", NULL); * - * Returns 0 on success or -1 in case of error. + * Returns: 0 on success or -1 in case of error. */ int mnt_optls_parse_optstr(mnt_optls *ls, const char *optstr) { @@ -210,7 +227,7 @@ int mnt_optls_parse_optstr(mnt_optls *ls, const char *optstr) * @ls: pointer to mnt_optls instance * @name: option name * - * Returns 0 on success, 1 if @name not found and -1 in case of error. + * Returns: 0 on success, 1 if @name not found and -1 in case of error. */ int mnt_optls_remove_option(mnt_optls *ls, const char *name) { @@ -254,7 +271,7 @@ int mnt_optls_remove_option(mnt_optls *ls, const char *name) * * See also mnt_optent_get_flag() and mnt_optls_remove_option_by_iflags(). * - * Returns number of removed options or -1 in case of error. + * Returns: number of removed options or -1 in case of error. */ int mnt_optls_remove_option_by_flags(mnt_optls *ls, const struct mnt_optmap *map, const int flags) @@ -302,7 +319,7 @@ int mnt_optls_remove_option_by_flags(mnt_optls *ls, * * See also mnt_optent_get_flag() and mnt_optls_remove_option_by_flags(). * - * Returns number of removed options or -1 in case of error. + * Returns: number of removed options or -1 in case of error. */ int mnt_optls_remove_option_by_iflags(mnt_optls *ls, const struct mnt_optmap *map, const int flags) @@ -346,7 +363,8 @@ int mnt_optls_remove_option_by_iflags(mnt_optls *ls, * @option: returns pointer to the option object * * Example (print all options): - * + * + * * * mnt_optent *option; * mnt_optls *ls = mnt_optls_new(); * @@ -354,8 +372,10 @@ int mnt_optls_remove_option_by_iflags(mnt_optls *ls, * * while(mnt_optls_next_option(ls, itr, NULL, &option)) * printf("%s\n", mnt_optent_get_name(option))); + * + * * - * Returns 0 on succes, -1 in case of error or 1 at end of list. + * Returns: 0 on succes, -1 in case of error or 1 at end of list. */ int mnt_optls_next_option(mnt_optls *ls, mnt_iter *itr, const struct mnt_optmap *map, mnt_optent **option) @@ -382,7 +402,7 @@ int mnt_optls_next_option(mnt_optls *ls, mnt_iter *itr, * @ls: pointer to mnt_optls instance * @name: options name * - * Returns the option or NULL. + * Returns: the option or NULL. */ mnt_optent *mnt_optls_get_option(mnt_optls *ls, const char *name) { @@ -416,7 +436,7 @@ mnt_optent *mnt_optls_get_option(mnt_optls *ls, const char *name) * mnt_optls_create_mountflags() that returns MNT_MFLAG options * (mount(2) flags) only. * - * Return IDs from all options. + * Return: IDs from all options. */ int mnt_optls_get_ids(mnt_optls *ls, const struct mnt_optmap *map) { @@ -444,7 +464,7 @@ int mnt_optls_get_ids(mnt_optls *ls, const struct mnt_optmap *map) * The mountflags are IDs from all MNT_MFLAG options. See "struct mnt_optmap". * For more details about mountflags see mount(2) syscall. * - * Returns mount flags or 0. + * Returns: mount flags or 0. */ int mnt_optls_create_mountflags(mnt_optls *ls) { @@ -474,7 +494,7 @@ int mnt_optls_create_mountflags(mnt_optls *ls) * * For more details about mountdata see mount(2) syscall. * - * Returns newly allocated string with mount options or NULL in case of error. + * Returns: newly allocated string with mount options or NULL in case of error. */ char *mnt_optls_create_mountdata(mnt_optls *ls) { @@ -510,7 +530,7 @@ err: * mnt_optls_create_mtab_optstr: * @ls: pointer to mnt_optls instance * - * Returns newly allocated string with mount options for mtab. + * Returns: newly allocated string with mount options for mtab. */ char *mnt_optls_create_mtab_optstr(mnt_optls *ls) { @@ -547,8 +567,8 @@ err: * mnt_optls_create_userspace_optstr: * @ls: pointer to mnt_optls instance * - * Returns newly allocated string with mount options that are - * userspace specific (e.g. uhelper=). + * Returns: newly allocated string with mount options that are + * userspace specific (e.g. uhelper=,loop=). */ char *mnt_optls_create_userspace_optstr(mnt_optls *ls) { @@ -589,6 +609,8 @@ err: * @ls: pointer to mnt_optls instance * * Prints details about options container. + * + * Returns: 0 on success or -1 in case of error. */ int mnt_optls_print_debug(mnt_optls *ls, FILE *file) { diff --git a/shlibs/mount/src/optmap.c b/shlibs/mount/src/optmap.c index 873c545c..ff8cc8c6 100644 --- a/shlibs/mount/src/optmap.c +++ b/shlibs/mount/src/optmap.c @@ -3,9 +3,13 @@ * * This file may be redistributed under the terms of the * GNU Lesser General Public License. + */ + +/** + * SECTION: optmap + * @title: Option maps + * @short_description: description for mount options * - * Option-maps - * ----------- * The mount(2) linux syscall uses two arguments for mount options: * * 1) mountflags (see MS_* macros in linux/fs.h) @@ -45,6 +49,8 @@ * - MNT_LINUX_MAP -- fs-independent kernel mount options (usually MS_* flags) * - MNT_USERSPACE_MAP -- userspace specific mount options (e.g. "user", "loop") * + * For more details about option map struct see "struct mnt_optmap" in + * mount/mount.h. */ #include #include @@ -153,7 +159,7 @@ static const struct mnt_optmap userspace_opts_map[] = * MNT_USERSPACE_MAP - userpace mount(8) specific mount options * (e.g user=, _netdev, ...) * - * Returns internal (static) libmount map. + * Returns: static built-in libmount map. */ const struct mnt_optmap *mnt_get_builtin_optmap(int id) { diff --git a/shlibs/mount/src/optstr.c b/shlibs/mount/src/optstr.c index 3e4eb482..ed40cace 100644 --- a/shlibs/mount/src/optstr.c +++ b/shlibs/mount/src/optstr.c @@ -5,6 +5,16 @@ * GNU Lesser General Public License. */ +/** + * SECTION: optstr + * @title: Mount oprions string + * @short_description: low-level API for work with mount options + * + * This is simple and low-level API to work with mount options that are stored + * in string. This API is independent on the high-level options container and + * option maps. + */ + #include #include #include @@ -129,7 +139,7 @@ static int mnt_optstr_locate_option(char *optstr, const char *name, char **begin * * Parses the first option in @optstr or -1 in case of error. * - * Returns 0 on success, 1 at the end of @optstr or -1 in case of error. + * Returns: 0 on success, 1 at the end of @optstr or -1 in case of error. */ int mnt_optstr_next_option(char **optstr, char **name, size_t *namesz, char **value, size_t *valuesz) diff --git a/shlibs/mount/src/tab.c b/shlibs/mount/src/tab.c index 819b11d3..71aa805b 100644 --- a/shlibs/mount/src/tab.c +++ b/shlibs/mount/src/tab.c @@ -1,31 +1,37 @@ /* - * Copyright (C) 2008 Karel Zak + * Copyright (C) 2008-2010 Karel Zak * * This file may be redistributed under the terms of the * GNU Lesser General Public License. + */ + +/** + * SECTION: tab + * @title: Filesystems container + * @short_description: container for entries from fstab/mtab/mountinfo + * * - * Note: - * mnt_tab_find_* functions are mount(8) compatible. It means it tries - * to found an entry in more iterations where the first attempt is always - * based on comparison with unmodified (non-canonicalized or un-evaluated) - * paths or tags. For example fstab with two entries: + * Note that mnt_tab_find_* functions are mount(8) compatible. These functions + * try to found an entry in more iterations where the first attempt is always + * based on comparison with unmodified (non-canonicalized or un-evaluated) + * paths or tags. For example fstab with two entries: * - * LABEL=foo /foo auto rw - * /dev/foo /foo auto rw + * LABEL=foo /foo auto rw + * /dev/foo /foo auto rw * - * where both lines are used for the *same* device, then + * where both lines are used for the *same* device, then * - * mnt_tab_find_source(tb, "/dev/foo", &fs); + * mnt_tab_find_source(tb, "/dev/foo", &fs); * - * will returns the second line, and + * will returns the second line, and * - * mnt_tab_find_source(tb, "LABEL=foo", &fs); + * mnt_tab_find_source(tb, "LABEL=foo", &fs); * - * will returns the first entry, and + * will returns the first entry, and * * mnt_tab_find_source(tb, "UUID=", &fs); * - * will returns the first entry (if UUID matches with the device). + * will returns the first entry (if UUID matches with the device). */ #include @@ -51,7 +57,7 @@ * Note that this function does not parse the file. See also * mnt_tab_parse_file(). * - * Returns newly allocated tab struct. + * Returns: newly allocated tab struct. */ mnt_tab *mnt_new_tab(const char *filename) { @@ -97,7 +103,7 @@ void mnt_free_tab(mnt_tab *tb) * mnt_tab_get_nents: * @tb: pointer to tab * - * Returns number of valid entries in tab. + * Returns: number of valid entries in tab. */ int mnt_tab_get_nents(mnt_tab *tb) { @@ -119,7 +125,7 @@ int mnt_tab_get_nents(mnt_tab *tb) * * See also mnt_new_cache(). * - * Returns 0 on success or -1 in case of error. + * Returns: 0 on success or -1 in case of error. */ int mnt_tab_set_cache(mnt_tab *tb, mnt_cache *mpc) { @@ -134,7 +140,7 @@ int mnt_tab_set_cache(mnt_tab *tb, mnt_cache *mpc) * mnt_tab_get_cache: * @tb: pointer to tab * - * Returns pointer to mnt_cache instance or NULL. + * Returns: pointer to mnt_cache instance or NULL. */ mnt_cache *mnt_tab_get_cache(mnt_tab *tb) { @@ -146,7 +152,7 @@ mnt_cache *mnt_tab_get_cache(mnt_tab *tb) * mnt_tab_get_name: * @tb: tab pointer * - * Returns tab filename or NULL. + * Returns: tab filename or NULL. */ const char *mnt_tab_get_name(mnt_tab *tb) { @@ -161,7 +167,7 @@ const char *mnt_tab_get_name(mnt_tab *tb) * * Adds a new entry to tab. * - * Returns 0 on success or -1 in case of error. + * Returns: 0 on success or -1 in case of error. */ int mnt_tab_add_fs(mnt_tab *tb, mnt_fs *fs) { @@ -190,7 +196,7 @@ int mnt_tab_add_fs(mnt_tab *tb, mnt_fs *fs) * @tb: tab pointer * @fs: new entry * - * Returns 0 on success or -1 in case of error. + * Returns: 0 on success or -1 in case of error. */ int mnt_tab_remove_fs(mnt_tab *tb, mnt_fs *fs) { @@ -255,7 +261,7 @@ int mnt_tab_get_root_fs(mnt_tab *tb, mnt_fs **root) * Note that filesystems are returned in the order how was mounted (according to * IDs in /proc/self/mountinfo). * - * Returns 0 on success, -1 in case of error or 1 at end of list. + * Returns: 0 on success, -1 in case of error or 1 at end of list. */ int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs *parent, mnt_fs **chld) @@ -313,7 +319,7 @@ int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr, * @itr: iterator * @fs: returns the next tab entry * - * Returns 0 on success, -1 in case of error or 1 at end of list. + * Returns: 0 on success, -1 in case of error or 1 at end of list. * * Example (list all mountpoints from fstab in backward order): * @@ -364,7 +370,7 @@ again: * * This function allows search in @tb. * - * Returns -1 in case of error, 1 at end of table or 0 o success. + * Returns: -1 in case of error, 1 at end of table or 0 o success. */ int mnt_tab_find_next_fs(mnt_tab *tb, mnt_iter *itr, int (*match_func)(mnt_fs *, void *), void *userdata, @@ -403,7 +409,7 @@ int mnt_tab_find_next_fs(mnt_tab *tb, mnt_iter *itr, * * Sets @iter to the position of @fs in the file @tb. * - * Returns 0 on success, -1 in case of error. + * Returns: 0 on success, -1 in case of error. */ int mnt_tab_set_iter(mnt_tab *tb, mnt_iter *itr, mnt_fs *fs) { @@ -431,7 +437,7 @@ int mnt_tab_set_iter(mnt_tab *tb, mnt_iter *itr, mnt_fs *fs) * against realpath(fs->target). The 2nd and 3rd iterations are not performed * when @tb cache is not set (see mnt_tab_set_cache()). * - * Returns a tab entry or NULL. + * Returns: a tab entry or NULL. */ mnt_fs *mnt_tab_find_target(mnt_tab *tb, const char *path, int direction) { @@ -487,7 +493,7 @@ mnt_fs *mnt_tab_find_target(mnt_tab *tb, const char *path, int direction) * The 2nd, 3rd and 4th iterations are not performed when @tb cache is not * set (see mnt_tab_set_cache()). * - * Returns a tab entry or NULL. + * Returns: a tab entry or NULL. */ mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction) { @@ -587,7 +593,7 @@ mnt_fs *mnt_tab_find_srcpath(mnt_tab *tb, const char *path, int direction) * name) and mnt_tab_find_srcpath() is preformed. The second attempt is not * performed when @tb cache is not set (see mnt_tab_set_cache()). - * Returns a tab entry or NULL. + * Returns: a tab entry or NULL. */ mnt_fs *mnt_tab_find_tag(mnt_tab *tb, const char *tag, const char *val, int direction) @@ -632,7 +638,7 @@ mnt_fs *mnt_tab_find_tag(mnt_tab *tb, const char *tag, * about @source format (device, LABEL, UUID, ...). This function parses @source * and calls mnt_tab_find_tag() or mnt_tab_find_srcpath(). * - * Returns a tab entry or NULL. + * Returns: a tab entry or NULL. */ mnt_fs *mnt_tab_find_source(mnt_tab *tb, const char *source, int direction) { @@ -670,7 +676,7 @@ mnt_fs *mnt_tab_find_source(mnt_tab *tb, const char *source, int direction) * @fmt: per line printf-like format string (see MNT_MFILE_PRINTFMT) * @tb: tab pointer * - * Returns 0 on success, -1 in case of error. + * Returns: 0 on success, -1 in case of error. */ int mnt_tab_fprintf(mnt_tab *tb, FILE *f, const char *fmt) { @@ -699,7 +705,7 @@ int mnt_tab_fprintf(mnt_tab *tb, FILE *f, const char *fmt) * * Writes tab to disk. Don't forget to lock the file (see mnt_lock()). * - * Returns 0 on success, -1 in case of error. + * Returns: 0 on success, -1 in case of error. */ int mnt_tab_update_file(mnt_tab *tb) { diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c index f8d6680f..fe2b1103 100644 --- a/shlibs/mount/src/tab_parse.c +++ b/shlibs/mount/src/tab_parse.c @@ -381,12 +381,8 @@ err: * * Parses whole table (e.g. /etc/fstab). * - * Returns 0 on success and -1 in case of error. The parse errors is possible - * to detect by mnt_tab_get_nerrs() and error message is possible to create by - * mnt_tab_strerror(). - * - * Example: - * + * + * * mnt_tab *tb = mnt_new_tab("/etc/fstab"); * int rc; * @@ -401,6 +397,12 @@ err: * mnt_fprintf_tab(tb, stdout, NULL); * * mnt_free_tab(tb); + * + * + * + * Returns: 0 on success and -1 in case of error. The parse errors is possible + * to detect by mnt_tab_get_nerrs() and error message is possible to create by + * mnt_tab_strerror(). */ int mnt_tab_parse_file(mnt_tab *tb) { @@ -450,7 +452,7 @@ error: * not provide details (by mnt_tab_strerror()) about failed parsing -- so you * should not to use this function for user-writeable files like /etc/fstab. * - * Returns newly allocated tab on success and NULL in case of error. + * Returns: newly allocated tab on success and NULL in case of error. */ mnt_tab *mnt_new_tab_from_file(const char *filename) { @@ -472,7 +474,7 @@ mnt_tab *mnt_new_tab_from_file(const char *filename) * mnt_tab_get_nerrs: * @tb: pointer to table * - * Returns number of broken (parse error) entries in the table. + * Returns: number of broken (parse error) entries in the table. */ int mnt_tab_get_nerrs(mnt_tab *tb) { @@ -486,7 +488,7 @@ int mnt_tab_get_nerrs(mnt_tab *tb) * @buf: buffer to return error message * @buflen: lenght of the buf * - * Returns error message for table (file) parse errors. For example: + * Returns: error message for table (file) parse errors. For example: * * "/etc/fstab: parse error at line(s): 1, 2 and 3." */ diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c index fb9ffe8d..1f3337f2 100644 --- a/shlibs/mount/src/utils.c +++ b/shlibs/mount/src/utils.c @@ -5,6 +5,11 @@ * GNU Lesser General Public License. */ +/** + * SECTION: utils + * @title: Utils + * @short_description: misc utils. + */ #include #include #include diff --git a/shlibs/mount/src/version.c b/shlibs/mount/src/version.c index 0380e1c2..d00a1686 100644 --- a/shlibs/mount/src/version.c +++ b/shlibs/mount/src/version.c @@ -7,6 +7,12 @@ * See COPYING.libmount for the License of this software. */ +/** + * SECTION: version + * @title: Version functions + * @short_description: functions to get library version. + */ + #include #include #include -- cgit v1.2.3 From 3d73558960025f6bd18fd8b05986e021e5159df2 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 15 Apr 2010 13:27:47 +0200 Subject: libmount: add docs Signed-off-by: Karel Zak --- configure.ac | 2 + shlibs/mount/Makefile.am | 4 + shlibs/mount/docs/.gitignore | 17 +++ shlibs/mount/docs/Makefile.am | 101 ++++++++++++++++++ shlibs/mount/docs/libmount-docs.xml | 60 +++++++++++ shlibs/mount/docs/libmount-sections.txt | 182 ++++++++++++++++++++++++++++++++ shlibs/mount/docs/libmount.types | 0 shlibs/mount/docs/version.xml.in | 1 + shlibs/mount/src/fs.c | 5 +- shlibs/mount/src/lock.c | 52 ++++----- shlibs/mount/src/mount.h.in | 5 +- shlibs/mount/src/optent.c | 9 +- shlibs/mount/src/optls.c | 6 +- shlibs/mount/src/optmap.c | 43 ++++++-- shlibs/mount/src/optstr.c | 2 +- shlibs/mount/src/tab.c | 43 +++++--- shlibs/mount/src/utils.c | 14 +-- 17 files changed, 474 insertions(+), 72 deletions(-) create mode 100644 shlibs/mount/docs/.gitignore create mode 100644 shlibs/mount/docs/Makefile.am create mode 100644 shlibs/mount/docs/libmount-docs.xml create mode 100644 shlibs/mount/docs/libmount-sections.txt create mode 100644 shlibs/mount/docs/libmount.types create mode 100644 shlibs/mount/docs/version.xml.in diff --git a/configure.ac b/configure.ac index 11756409..71330dae 100644 --- a/configure.ac +++ b/configure.ac @@ -1147,6 +1147,8 @@ shlibs/mount/mount.pc shlibs/mount/Makefile shlibs/mount/src/Makefile shlibs/mount/src/mount.h +shlibs/mount/docs/Makefile +shlibs/mount/docs/version.xml shlibs/uuid/uuid.pc shlibs/uuid/Makefile shlibs/uuid/man/Makefile diff --git a/shlibs/mount/Makefile.am b/shlibs/mount/Makefile.am index f90eacc1..5f7ca4ca 100644 --- a/shlibs/mount/Makefile.am +++ b/shlibs/mount/Makefile.am @@ -2,6 +2,10 @@ include $(top_srcdir)/config/include-Makefile.am SUBDIRS = src +if ENABLE_GTK_DOC +SUBDIRS += docs +endif + # pkg-config stuff pkgconfigdir = $(usrlib_execdir)/pkgconfig pkgconfig_DATA = mount.pc diff --git a/shlibs/mount/docs/.gitignore b/shlibs/mount/docs/.gitignore new file mode 100644 index 00000000..917c8481 --- /dev/null +++ b/shlibs/mount/docs/.gitignore @@ -0,0 +1,17 @@ +*.args +*.bak +*-decl-list.txt +*-decl.txt +*.hierarchy +html/* +*.interfaces +*-overrides.txt +*.prerequisites +*.signals +*.stamp +tmpl/* +*-undeclared.txt +*-undocumented.txt +*-unused.txt +version.xml +xml/* diff --git a/shlibs/mount/docs/Makefile.am b/shlibs/mount/docs/Makefile.am new file mode 100644 index 00000000..a50390b0 --- /dev/null +++ b/shlibs/mount/docs/Makefile.am @@ -0,0 +1,101 @@ +include $(top_srcdir)/config/include-Makefile.am + +## Process this file with automake to produce Makefile.in + +# We require automake 1.10 at least. +AUTOMAKE_OPTIONS = 1.10 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE=libmount + +# Uncomment for versioned docs and specify the version of the module, e.g. '2'. +#DOC_MODULE_VERSION=2 + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR=../src + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS= + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS= + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space mount + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS= + +# Extra options to supply to gtkdoc-mkhtml +MKHTML_OPTIONS= + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS= + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB=$(ul_libmount_incdir)/mount.h +CFILE_GLOB=$(ul_libmount_srcdir)/*.c + +# Extra header to include when scanning, which are not under DOC_SOURCE_DIR +# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h +EXTRA_HFILES= + +# Header files to ignore when scanning. Use base file name, no paths +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +IGNORE_HFILES=mountP.h list.h partitions.h superblocks.h topology.h aix.h dos.h + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES= + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files = $(builddir)/version.xml + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files= + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) +GTKDOC_CFLAGS= +GTKDOC_LIBS= + +# This includes the standard gtk-doc make rules, copied by gtkdocize. +include $(top_srcdir)/config/gtk-doc.make + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +EXTRA_DIST += version.xml.in + +# Files not to distribute +# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types +# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt +#DISTCLEANFILES += + +# Comment this out if you want your docs-status tested during 'make check' +if ENABLE_GTK_DOC +#TESTS_ENVIRONMENT = cd $(srcsrc) +#TESTS = $(GTKDOC_CHECK) +endif diff --git a/shlibs/mount/docs/libmount-docs.xml b/shlibs/mount/docs/libmount-docs.xml new file mode 100644 index 00000000..c1371d61 --- /dev/null +++ b/shlibs/mount/docs/libmount-docs.xml @@ -0,0 +1,60 @@ + + +]> + + + libmount Reference Manual + for libmount version &version; + + 2010 + Karel Zak <kzak@redhat.com> + + + + + libmount Overview + + +The libmount library is used to parse /etc/fstab, /etc/mtab and +/proc/self/mountinfo files, manage the mtab file, evaluate mount options, etc. + + +The library is part of the util-linux-ng package since version 2.18 and is +available from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. + + + + + + Files parsing + + + + + Mount options + + + + + + + Mtab management + + + + Misc + + + + + + + + + API Index + + + diff --git a/shlibs/mount/docs/libmount-sections.txt b/shlibs/mount/docs/libmount-sections.txt new file mode 100644 index 00000000..3c4a9f77 --- /dev/null +++ b/shlibs/mount/docs/libmount-sections.txt @@ -0,0 +1,182 @@ +
+init +mnt_init_debug +
+ +
+version +mnt_parse_version_string +mnt_get_library_version +
+ +
+utils +mnt_fstype_is_netfs +mnt_fstype_is_pseudofs +mnt_open_device +mnt_match_fstype +mnt_match_options +
+ +
+cache +mnt_cache +mnt_new_cache +mnt_free_cache +mnt_cache_find_path +mnt_cache_find_tag +mnt_cache_read_tags +mnt_cache_device_has_tag +mnt_cache_find_tag_value +mnt_resolve_path +mnt_resolve_tag +mnt_resolve_spec +
+ +
+optstr +mnt_optstr_next_option +mnt_optstr_append_option +mnt_optstr_get_option +mnt_optstr_set_option +mnt_optstr_remove_option +
+ +
+iter +mnt_iter +mnt_new_iter +mnt_free_iter +mnt_reset_iter +mnt_iter_get_direction +
+ +
+optmap +mnt_optmap +mnt_get_builtin_optmap +
+ +
+optent +mnt_optent +mnt_optent_get_map +mnt_optent_get_mapent +mnt_optent_get_type +mnt_optent_set_value +mnt_optent_has_value +mnt_optent_require_value +mnt_optent_is_inverted +mnt_optent_strtoul_value +mnt_optent_strtol_value +mnt_optent_strtoull_value +mnt_optent_get_value +mnt_optent_strlen_value +mnt_optent_snprintf_value +mnt_optent_dup_value +mnt_optent_get_name +mnt_optent_get_mask +mnt_optent_get_id +mnt_optent_get_flag +mnt_optent_is_unknown +mnt_optent_print_debug +
+ +
+optls +mnt_optls +mnt_new_optls +mnt_free_optls +mnt_optls_add_map +mnt_optls_add_builtin_map +mnt_optls_add_option +mnt_optls_parse_optstr +mnt_optls_remove_option +mnt_optls_remove_option_by_flags +mnt_optls_remove_option_by_iflags +mnt_optls_next_option +mnt_optls_get_option +mnt_optls_get_ids +mnt_optls_create_mountflags +mnt_optls_create_mountdata +mnt_optls_create_mtab_optstr +mnt_optls_create_userspace_optstr +mnt_optls_print_debug +
+ + +
+lock +mnt_lock +mnt_new_lock +mnt_free_lock +mnt_lock_get_lockfile +mnt_lock_get_linkfile +mnt_unlock_file +mnt_lock_file +
+ + +
+fs +mnt_fs +mnt_new_fs +mnt_free_fs +mnt_fs_get_userdata +mnt_fs_set_userdata +mnt_fs_get_source +mnt_fs_set_source +mnt_fs_get_srcpath +mnt_fs_get_tag +mnt_fs_get_target +mnt_fs_set_target +mnt_fs_get_fstype +mnt_fs_set_fstype +mnt_fs_get_optstr +mnt_fs_set_optstr +mnt_fs_get_optfs +mnt_fs_get_optvfs +mnt_fs_get_freq +mnt_fs_set_freq +mnt_fs_get_passno +mnt_fs_set_passno +mnt_fs_get_id +mnt_fs_get_parent_id +mnt_fs_get_devno +mnt_fs_get_option +mnt_fs_match_target +mnt_fs_match_source +mnt_fs_match_fstype +mnt_fs_match_options +mnt_fprintf_line +mnt_fs_fprintf +mnt_fs_print_debug +
+ +
+tab +mnt_tab +mnt_new_tab_from_file +mnt_tab_parse_file +mnt_tab_strerror +mnt_tab_get_nerrs +mnt_new_tab +mnt_free_tab +mnt_tab_get_nents +mnt_tab_set_cache +mnt_tab_get_cache +mnt_tab_get_name +mnt_tab_add_fs +mnt_tab_remove_fs +mnt_tab_next_fs +mnt_tab_next_child_fs +mnt_tab_get_root_fs +mnt_tab_set_iter +mnt_tab_find_target +mnt_tab_find_srcpath +mnt_tab_find_tag +mnt_tab_find_source +mnt_tab_find_next_fs +mnt_tab_fprintf +mnt_tab_update_file +
diff --git a/shlibs/mount/docs/libmount.types b/shlibs/mount/docs/libmount.types new file mode 100644 index 00000000..e69de29b diff --git a/shlibs/mount/docs/version.xml.in b/shlibs/mount/docs/version.xml.in new file mode 100644 index 00000000..d78bda93 --- /dev/null +++ b/shlibs/mount/docs/version.xml.in @@ -0,0 +1 @@ +@VERSION@ diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c index 885a4a2b..56a3b977 100644 --- a/shlibs/mount/src/fs.c +++ b/shlibs/mount/src/fs.c @@ -8,7 +8,7 @@ /** * SECTION: fs * @title: Filesystem - * @short_description: mnt_fs is represents one entry in fstab/mtab/mountinfo + * @short_description: mnt_fs represents one entry in fstab/mtab/mountinfo * */ #include @@ -114,6 +114,7 @@ const char *mnt_fs_get_srcpath(mnt_fs *fs) } /** + * mnt_fs_get_source: * @fs: mnt_file (fstab/mtab/mountinfo) fs * * Returns: mount source. Note that the source could be unparsed TAG @@ -390,7 +391,7 @@ const char *mnt_fs_get_vfs_optstr(mnt_fs *fs) * mnt_fs_get_freq: * @fs: fstab/mtab/mountinfo entry pointer * - * Returns: "dump frequency in days". + * Returns: dump frequency in days. */ int mnt_fs_get_freq(mnt_fs *fs) { diff --git a/shlibs/mount/src/lock.c b/shlibs/mount/src/lock.c index e0b0d0b8..2d1f30f4 100644 --- a/shlibs/mount/src/lock.c +++ b/shlibs/mount/src/lock.c @@ -263,8 +263,8 @@ void mnt_unlock_file(mnt_lock *ml) * * Locking scheme: * - * 1. create linkfile (e.g. /etc/mtab~.) - * 2. link linkfile --> lockfile (e.g. /etc/mtab~. --> /etc/mtab~) + * 1. create linkfile (e.g. /etc/mtab~.$PID) + * 2. link linkfile --> lockfile (e.g. /etc/mtab~.$PID --> /etc/mtab~) * * 3. a) link() success: setups F_SETLK lock (see fcnlt(2)) * b) link() failed: wait (max 30s) on F_SETLKW lock, goto 2. @@ -273,37 +273,37 @@ void mnt_unlock_file(mnt_lock *ml) * * * - * mnt_lock *ml; + * mnt_lock *ml; * - * void unlock_fallback(void) - * { - * if (!ml) - * return; - * mnt_unlock_file(ml); - * mnt_free_lock(ml); - * } + * void unlock_fallback(void) + * { + * if (!ml) + * return; + * mnt_unlock_file(ml); + * mnt_free_lock(ml); + * } * - * int update_mtab() - * { - * int sig = 0; + * int update_mtab() + * { + * int sig = 0; * - * atexit(unlock_fallback); + * atexit(unlock_fallback); * - * ml = mnt_new_lock(NULL, 0); + * ml = mnt_new_lock(NULL, 0); * - * if (mnt_lock_file(ml) != 0) { - * printf(stderr, "cannot create %s lockfile\n", - * mnt_lock_get_lockfile(ml)); - * return -1; - * } + * if (mnt_lock_file(ml) != 0) { + * printf(stderr, "cannot create %s lockfile\n", + * mnt_lock_get_lockfile(ml)); + * return -1; + * } * - * ... modify mtab ... + * ... modify mtab ... * - * mnt_unlock_file(ml); - * mnt_free_lock(ml); - * ml = NULL; - * return 0; - * } + * mnt_unlock_file(ml); + * mnt_free_lock(ml); + * ml = NULL; + * return 0; + * } * * * diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index c3100ee0..409af06a 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -66,12 +66,9 @@ typedef struct _mnt_optls mnt_optls; typedef struct _mnt_optent mnt_optent; /** - * struct mnt_optmap: + * mnt_optmap: * * Mount options description (map) - * - * The libmount supports mount options with values in %: - * %s, %d, %u, %o, %x */ struct mnt_optmap { diff --git a/shlibs/mount/src/optent.c b/shlibs/mount/src/optent.c index 749f447c..4b35b2d5 100644 --- a/shlibs/mount/src/optent.c +++ b/shlibs/mount/src/optent.c @@ -7,8 +7,8 @@ /** * SECTION: optent - * @title: Mount option entry - * @short_description: the entry keeps one parsed mount option + * @title: Parsed option + * @short_description: the mnt_optent keeps one parsed mount option */ #include #include @@ -357,7 +357,7 @@ int mnt_optent_has_value(mnt_optent *op) * Note that the @op has to be associated with any option map * or 0 is returned. * - * Returns: 1 if the option requires an argument (option=). + * Returns: 1 if the option requires an argument (option=arg). */ int mnt_optent_require_value(mnt_optent *op) { @@ -534,13 +534,12 @@ err: /** * mnt_optent_get_value: * @op: pointer to mnt_optent instance - * @data: resulting string * * See also mnt_optent_has_value(). * * Returns: pointer to value or NULL. */ -const char *mnt_optent_get_value(mnt_optent *op) +const char *mnt_optent_get_value(mnt_optent *op) { return op? op->value : NULL; } diff --git a/shlibs/mount/src/optls.c b/shlibs/mount/src/optls.c index f8b73470..ff2b912b 100644 --- a/shlibs/mount/src/optls.c +++ b/shlibs/mount/src/optls.c @@ -69,7 +69,7 @@ void mnt_free_optls(mnt_optls *ls) * Note, it's recommented to add all maps to the @optls container before options * parsing. * - * Example (add new options "foo" and "bar="): + * Example (add new options "foo" and "bar=data"): * * * @@ -121,7 +121,7 @@ int mnt_optls_add_map(mnt_optls *ls, const struct mnt_optmap *map) /** * mnt_optls_add_builtin_map: * @ls: pointer to mnt_optls instance - * @map_id: built-in map id (see mnt_get_builtin_map()) + * @id: built-in map id (see mnt_get_builtin_map()) * * Same as mnt_optls_add_map(), but works with libmount built in maps. * @@ -436,7 +436,7 @@ mnt_optent *mnt_optls_get_option(mnt_optls *ls, const char *name) * mnt_optls_create_mountflags() that returns MNT_MFLAG options * (mount(2) flags) only. * - * Return: IDs from all options. + * Returns: IDs from all options. */ int mnt_optls_get_ids(mnt_optls *ls, const struct mnt_optmap *map) { diff --git a/shlibs/mount/src/optmap.c b/shlibs/mount/src/optmap.c index ff8cc8c6..6eef332c 100644 --- a/shlibs/mount/src/optmap.c +++ b/shlibs/mount/src/optmap.c @@ -12,8 +12,9 @@ * * The mount(2) linux syscall uses two arguments for mount options: * - * 1) mountflags (see MS_* macros in linux/fs.h) - * 2) mountdata (usully a comma separated string of options) + * @mountflags: (see MS_* macros in linux/fs.h) + * + * @mountdata: (usully a comma separated string of options) * * The libmount uses options-map(s) to describe mount options. The number of * maps is unlimited. The libmount options parser could be easily extended @@ -21,16 +22,19 @@ * * The option description (map entry) includes: * - * - option name and argument type (e.g. "loop[=%s]") - * - option ID (in the map unique identifier or a mountflags, e.g MS_RDONLY) - * - mask (MNT_INVERT, MNT_MDATA, MNT_MFLAG, MNT_NOMTAB) + * @name: and argument type (e.g. "loop[=%s]") + * + * @id: (in the map unique identifier or a mountflags, e.g MS_RDONLY) + * + * @mask: (MNT_INVERT, MNT_MDATA, MNT_MFLAG, MNT_NOMTAB) * * The option argument type is defined by: * - * "=" -- required argument - * "[=]" -- optional argument + * "=type" -- required argument + * + * "[=type]" -- optional argument * - * where the is sscanf() format string or + * where the 'type' is sscanf() format string or * * {item0,item1,...} -- enum (mnt_option_get_number() converts the value * to 0..N number) @@ -39,15 +43,32 @@ * stores the option argument as a string. The conversion to the data type is * on-demant by mnt_option_get_value_*() functions. * - * The library checks options argument according to format for simple + * The library checks options argument according to 'type' format for simple * formats only: * * %s, %d, %ld, %lld, %u, %lu, %llu, %x, %o and {enum} * + * Example: + * + * + * + * #define MY_MS_FOO (1 << 1) + * #define MY_MS_BAR (1 << 2) + * + * mnt_optmap myoptions[] = { + * { "foo", MY_MS_FOO, MNT_MFLAG }, + * { "nofoo", MY_MS_FOO, MNT_MFLAG | MNT_INVERT }, + * { "bar=%s",MY_MS_BAR, MNT_MDATA }, + * { NULL } + * }; + * + * + * * The libmount defines two basic built-in options maps: * - * - MNT_LINUX_MAP -- fs-independent kernel mount options (usually MS_* flags) - * - MNT_USERSPACE_MAP -- userspace specific mount options (e.g. "user", "loop") + * @MNT_LINUX_MAP: fs-independent kernel mount options (usually MS_* flags) + * + * @MNT_USERSPACE_MAP: userspace specific mount options (e.g. "user", "loop") * * For more details about option map struct see "struct mnt_optmap" in * mount/mount.h. diff --git a/shlibs/mount/src/optstr.c b/shlibs/mount/src/optstr.c index ed40cace..19efbf3f 100644 --- a/shlibs/mount/src/optstr.c +++ b/shlibs/mount/src/optstr.c @@ -7,7 +7,7 @@ /** * SECTION: optstr - * @title: Mount oprions string + * @title: Options string * @short_description: low-level API for work with mount options * * This is simple and low-level API to work with mount options that are stored diff --git a/shlibs/mount/src/tab.c b/shlibs/mount/src/tab.c index 71aa805b..12de8501 100644 --- a/shlibs/mount/src/tab.c +++ b/shlibs/mount/src/tab.c @@ -7,7 +7,7 @@ /** * SECTION: tab - * @title: Filesystems container + * @title: FS container * @short_description: container for entries from fstab/mtab/mountinfo * * @@ -15,22 +15,31 @@ * try to found an entry in more iterations where the first attempt is always * based on comparison with unmodified (non-canonicalized or un-evaluated) * paths or tags. For example fstab with two entries: - * + * + * * LABEL=foo /foo auto rw * /dev/foo /foo auto rw + * + * * * where both lines are used for the *same* device, then - * + * + * * mnt_tab_find_source(tb, "/dev/foo", &fs); - * + * + * * will returns the second line, and - * + * + * * mnt_tab_find_source(tb, "LABEL=foo", &fs); - * + * + * * will returns the first entry, and - * - * mnt_tab_find_source(tb, "UUID=", &fs); - * + * + * + * mnt_tab_find_source(tb, "UUID=anyuuid", &fs); + * + * * will returns the first entry (if UUID matches with the device). */ @@ -81,7 +90,7 @@ err: /** * mnt_free_tab: - * @tab: tab pointer + * @tb: tab pointer * * Deallocates tab struct and all entries. */ @@ -255,6 +264,7 @@ int mnt_tab_get_root_fs(mnt_tab *tb, mnt_fs **root) /** * mnt_tab_next_child_fs: * @tb: mountinfo file (/proc/self/mountinfo) + * @itr: iterator * @parent: parental FS * @chld: returns the next child filesystem * @@ -322,7 +332,8 @@ int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr, * Returns: 0 on success, -1 in case of error or 1 at end of list. * * Example (list all mountpoints from fstab in backward order): - * + * + * * mnt_fs *fs; * mnt_tab *tb = mnt_new_tab("/etc/fstab"); * mnt_iter *itr = mnt_new_iter(MNT_ITER_BACKWARD); @@ -334,6 +345,8 @@ int mnt_tab_next_child_fs(mnt_tab *tb, mnt_iter *itr, * printf("mount point: %s\n", dir); * } * mnt_free_tab(fi); + * + * */ int mnt_tab_next_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs **fs) { @@ -366,6 +379,7 @@ again: * @tb: table * @itr: iterator * @match_func: function returns 1 or 0 + * @userdata: extra data for match_func * @fs: returns pointer to the next matching table entry * * This function allows search in @tb. @@ -633,6 +647,7 @@ mnt_fs *mnt_tab_find_tag(mnt_tab *tb, const char *tag, * mnt_tab_find_source: * @tb: tab pointer * @source: TAG or path + * @direction: MNT_ITER_{FORWARD,BACKWARD} * * This is high-level API for mnt_tab_find_{srcpath,tag}. You needn't to care * about @source format (device, LABEL, UUID, ...). This function parses @source @@ -672,9 +687,9 @@ mnt_fs *mnt_tab_find_source(mnt_tab *tb, const char *source, int direction) /** * mnt_tab_fprintf: - * @f: FILE - * @fmt: per line printf-like format string (see MNT_MFILE_PRINTFMT) * @tb: tab pointer + * @f: FILE + * @fmt: per line printf-like format string (see MNT_TAB_PRINTFMT) * * Returns: 0 on success, -1 in case of error. */ @@ -731,7 +746,7 @@ int mnt_tab_update_file(mnt_tab *tb) if (!f) goto error; - if (mnt_tab_fprintf(tb, f, MNT_MFILE_PRINTFMT) != 0) + if (mnt_tab_fprintf(tb, f, MNT_TAB_PRINTFMT) != 0) goto error; fd = fileno(f); diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c index 1f3337f2..ae2945c0 100644 --- a/shlibs/mount/src/utils.c +++ b/shlibs/mount/src/utils.c @@ -140,12 +140,13 @@ int mnt_fstype_is_netfs(const char *type) * * The @pattern list of filesystem can be prefixed with a global * "no" prefix to invert matching of the whole list. The "no" could - * also used for individual items in the @pattern list. + * also used for individual items in the @pattern list. So, + * "nofoo,bar" has the same meaning as "nofoo,nobar". * - * "nofoo,bar" has the same meaning as "nofoo,nobar" + * "bar" : "nofoo,bar" -> False (global "no" prefix) + * + * "bar" : "foo,bar" -> True * - * "bar" : "nofoo,bar" -> False (global "no" prefix) - * "bar" : "foo,bar" -> True * "bar" : "foo,nobar" -> False * * Returns: 1 if type is matching, else 0. This function also returns @@ -225,8 +226,9 @@ static int check_option(const char *haystack, size_t len, * Unlike fs type matching, nonetdev,user and nonetdev,nouser have * DIFFERENT meanings; each option is matched explicitly as specified. * - * xxx,yyy,zzz : nozzz -> False - * xxx,yyy,zzz : xxx,noeee -> True + * "xxx,yyy,zzz" : "nozzz" -> False + * + * "xxx,yyy,zzz" : "xxx,noeee" -> True * * Returns: 1 if pattern is matching, else 0. This function also returns 0 * if @pattern is NULL and @optstr is non-NULL. -- cgit v1.2.3 From 6b5f7bd16386cce8ba59df8991d5e3cbee9acdc0 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 16 Apr 2010 14:05:42 +0200 Subject: libmount: merge vfs and fs options more carefully Signed-off-by: Karel Zak --- shlibs/mount/src/tab_parse.c | 54 +++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c index fe2b1103..e103aad8 100644 --- a/shlibs/mount/src/tab_parse.c +++ b/shlibs/mount/src/tab_parse.c @@ -248,21 +248,26 @@ static int detect_fmt(char *line) /* - * Merges @vfs and @fs options strings into a new string - * This function skips the generic part of @fs options. - * For example (see "rw"): + * Merges @vfs and @fs options strings into a new string. + * This function cares about 'ro/rw' options. The 'ro' is + * always used if @vfs or @fs is read-only. + * For example: * - * mnt_merge_optstr("rw,noexec", "rw,journal=update") + * mnt_merge_optstr("rw,noexec", "ro,journal=update") + * + * returns: "ro,noexec,journal=update" * - * returns --> "rw,noexec,journal=update" + * mnt_merge_optstr("rw,noexec", "rw,journal=update") * + * returns: "rw,noexec,journal=update" + * We need this function for /proc/self/mountinfo parsing. */ static char *merge_optstr(const char *vfs, const char *fs) { - const char *p1 = vfs, *p2 = fs; - char *res; + char *res, *p; size_t sz; + int ro = 0, rw = 0; if (!vfs && !fs) return NULL; @@ -271,26 +276,29 @@ static char *merge_optstr(const char *vfs, const char *fs) if (!strcmp(vfs, fs)) return strdup(vfs); /* e.g. "aaa" and "aaa" */ - /* skip the same FS options */ - while (*p1 && *p2 && *++p1 == *++p2); - - if (*p1 == ',') - p1++; - if (*p2 == ',') - p2++; - if (!*p1 && !*p2) /* e.g. "aaa,bbb" and "aaa,bbb," */ - return strdup(vfs); - if (!*p1 || !*p2) /* e.g. "aaa" and "aaa,bbb" */ - return strdup(*p1 ? vfs : fs); - - p1 = vfs; - sz = strlen(p1) + strlen(p2) + 2; /* 2= separator + '\0' */ - + sz = strlen(vfs) + strlen(fs) + 2; res = malloc(sz); if (!res) return NULL; + p = res + 3; /* make a room for rw/ro flag */ + + snprintf(p, sz - 3, "%s,%s", vfs, fs); + + /* remove 'rw' flags */ + rw += !mnt_optstr_remove_option(&p, "rw"); /* from vfs */ + rw += !mnt_optstr_remove_option(&p, "rw"); /* from fs */ - snprintf(res, sz, "%s,%s", p1, p2); + /* remove 'ro' flags if necessary */ + if (rw != 2) { + ro += !mnt_optstr_remove_option(&p, "ro"); + if (ro + rw < 2) + ro += !mnt_optstr_remove_option(&p, "ro"); + } + + if (!strlen(p)) + memcpy(res, ro ? "ro" : "rw", 3); + else + memcpy(res, ro ? "ro," : "rw,", 3); return res; } -- cgit v1.2.3 From ac3d410c46b12f0c7a166fe322f5bf66f69f3141 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 16 Apr 2010 14:39:16 +0200 Subject: lib: tt.c - fix minimal width of column Signed-off-by: Karel Zak --- include/tt.h | 1 + lib/tt.c | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/include/tt.h b/include/tt.h index 8e2994f3..bf24d550 100644 --- a/include/tt.h +++ b/include/tt.h @@ -35,6 +35,7 @@ struct tt_column { int seqnum; int width; /* real column width */ + int width_min; /* minimal width (width of header) */ double width_hint; /* hint (N < 1 is in percent of termwidth) */ int flags; diff --git a/lib/tt.c b/lib/tt.c index cd651970..beb04311 100644 --- a/lib/tt.c +++ b/lib/tt.c @@ -388,6 +388,9 @@ static void recount_widths(struct tt *tb, char *buf, size_t bufsz) if (cl->width < len) cl->width = len; + +fprintf(stderr, "KZAK: 1: %s = %d\n", cl->name, cl->width); + } } @@ -397,14 +400,18 @@ static void recount_widths(struct tt *tb, char *buf, size_t bufsz) struct tt_column *cl = list_entry(p, struct tt_column, cl_columns); - size_t len = mbs_width(cl->name); + cl->width_min = mbs_width(cl->name); - if (cl->width < len) - cl->width = len; - else if (cl->width_hint >= 1) + if (cl->width < cl->width_min) + cl->width = cl->width_min; + else if (cl->width_hint >= 1 && + cl->width_min < (int) cl->width_hint) cl->width = (int) cl->width_hint; width += cl->width + (is_last_column(tb, cl) ? 0 : 1); + +fprintf(stderr, "KZAK: 2: %s = %d\n", cl->name, cl->width); + } if (width == tb->termwidth) @@ -438,6 +445,8 @@ static void recount_widths(struct tt *tb, char *buf, size_t bufsz) continue; /* never truncate the tree */ if (trunc_only && !(cl->flags & TT_FL_TRUNCATE)) continue; + if (cl->width == cl->width_min) + continue; if (cl->width > cl->width_hint * tb->termwidth) { cl->width--; width--; @@ -451,7 +460,7 @@ static void recount_widths(struct tt *tb, char *buf, size_t bufsz) } } leave: -/* +///* fprintf(stderr, "terminal: %d, output: %d\n", tb->termwidth, width); list_for_each(p, &tb->tb_columns) { @@ -463,7 +472,7 @@ leave: cl->width_hint > 1 ? (int) cl->width_hint : (int) (cl->width_hint * tb->termwidth)); } -*/ +//*/ return; } -- cgit v1.2.3 From 498d79d4a70bacfd3df349f9aa611354dacb9678 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 16 Apr 2010 14:40:22 +0200 Subject: libmount: fix name of mnt_fs_get_*_optstr() Signed-off-by: Karel Zak --- shlibs/mount/src/mount.h.in | 4 ++-- shlibs/mount/src/mount.sym | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 409af06a..e9ef49d6 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -227,8 +227,8 @@ extern const char *mnt_fs_get_fstype(mnt_fs *ent); extern int mnt_fs_set_fstype(mnt_fs *ent, const char *fstype); extern const char *mnt_fs_get_optstr(mnt_fs *ent); extern int mnt_fs_set_optstr(mnt_fs *ent, const char *optstr); -extern const char *mnt_fs_get_optfs(mnt_fs *ent); -extern const char *mnt_fs_get_optvfs(mnt_fs *ent); +extern const char *mnt_fs_get_vfs_optstr(mnt_fs *ent); +extern const char *mnt_fs_get_fs_optstr(mnt_fs *ent); extern int mnt_fs_get_freq(mnt_fs *ent); extern int mnt_fs_set_freq(mnt_fs *ent, int freq); extern int mnt_fs_get_passno(mnt_fs *ent); diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym index 32740dce..a1524eb1 100644 --- a/shlibs/mount/src/mount.sym +++ b/shlibs/mount/src/mount.sym @@ -22,10 +22,10 @@ global: mnt_fs_get_freq; mnt_fs_get_fstype; mnt_fs_get_id; - mnt_fs_get_optfs; + mnt_fs_get_fs_optstr; mnt_fs_get_option; mnt_fs_get_optstr; - mnt_fs_get_optvfs; + mnt_fs_get_vfs_optstr; mnt_fs_get_parent_id; mnt_fs_get_passno; mnt_fs_get_source; -- cgit v1.2.3 From 631280e05be9372de17ec5aa27b54ed1706d0b53 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 16 Apr 2010 14:41:21 +0200 Subject: findmnt: add {fs,vfs}-options columns Signed-off-by: Karel Zak --- misc-utils/findmnt.8 | 2 ++ misc-utils/findmnt.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/misc-utils/findmnt.8 b/misc-utils/findmnt.8 index 81a6072e..17654728 100644 --- a/misc-utils/findmnt.8 +++ b/misc-utils/findmnt.8 @@ -91,6 +91,8 @@ Define output columns. Currently are supported .BR TARGET , .BR FSTYPE , .BR OPTIONS , +.BR VFS-OPTIONS , +.BR FS-OPTIONS , .BR LABEL and .BR UUID . diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index 6ce1ec8a..297b886c 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -56,6 +56,8 @@ enum { COL_TARGET, COL_FSTYPE, COL_OPTIONS, + COL_VFS_OPTIONS, + COL_FS_OPTIONS, COL_LABEL, COL_UUID, @@ -76,6 +78,8 @@ struct colinfo infos[__NCOLUMNS] = { [COL_TARGET] = { "TARGET", 0.30, FALSE }, [COL_FSTYPE] = { "FSTYPE", 0.10, TRUE }, [COL_OPTIONS] = { "OPTIONS", 0.10, TRUE }, + [COL_VFS_OPTIONS] = { "VFS-OPTIONS", 0.20, TRUE }, + [COL_FS_OPTIONS] = { "FS-OPTIONS", 0.10, TRUE }, [COL_LABEL] = { "LABEL", 0.10, FALSE }, [COL_UUID] = { "UUID", 36, FALSE }, }; @@ -274,6 +278,12 @@ static const char *get_data(mnt_fs *fs, int num) case COL_OPTIONS: str = mnt_fs_get_optstr(fs); break; + case COL_VFS_OPTIONS: + str = mnt_fs_get_vfs_optstr(fs); + break; + case COL_FS_OPTIONS: + str = mnt_fs_get_fs_optstr(fs); + break; case COL_UUID: str = get_tag(fs, "UUID"); break; -- cgit v1.2.3 From e7baa9710507aab9440e3a7bc61830897f465dd7 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 16 Apr 2010 14:59:10 +0200 Subject: lib: remove unwanted debug messages Signed-off-by: Karel Zak --- lib/tt.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/tt.c b/lib/tt.c index beb04311..7d87bf54 100644 --- a/lib/tt.c +++ b/lib/tt.c @@ -388,9 +388,6 @@ static void recount_widths(struct tt *tb, char *buf, size_t bufsz) if (cl->width < len) cl->width = len; - -fprintf(stderr, "KZAK: 1: %s = %d\n", cl->name, cl->width); - } } @@ -409,9 +406,6 @@ fprintf(stderr, "KZAK: 1: %s = %d\n", cl->name, cl->width); cl->width = (int) cl->width_hint; width += cl->width + (is_last_column(tb, cl) ? 0 : 1); - -fprintf(stderr, "KZAK: 2: %s = %d\n", cl->name, cl->width); - } if (width == tb->termwidth) @@ -460,7 +454,7 @@ fprintf(stderr, "KZAK: 2: %s = %d\n", cl->name, cl->width); } } leave: -///* +/* fprintf(stderr, "terminal: %d, output: %d\n", tb->termwidth, width); list_for_each(p, &tb->tb_columns) { @@ -472,7 +466,7 @@ leave: cl->width_hint > 1 ? (int) cl->width_hint : (int) (cl->width_hint * tb->termwidth)); } -//*/ +*/ return; } -- cgit v1.2.3 From cbec3cbfd5f0a307697ed1a36fd6eeb27ccbe3bb Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 18 May 2010 16:19:09 +0200 Subject: findmnt: small change in usage() Signed-off-by: Karel Zak --- misc-utils/findmnt.c | 4 ++-- shlibs/mount/src/lock.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index 297b886c..a7551cb6 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -458,8 +458,8 @@ static int __attribute__((__noreturn__)) usage(FILE *out) fprintf(out, _( "\nOptions:\n" " -s, --fstab search in static table of filesystems\n" - " -m, --mtab search in table of mounted filesystems (default)\n" - " -k, --kernel search in kernel (mountinfo) file\n\n" + " -m, --mtab search in table of mounted filesystems\n" + " -k, --kernel search in kernel (mountinfo) file (default)\n\n" " -c, --canonicalize canonicalize printed paths\n" " -d, --direction search direction - 'forward' or 'backward'\n" diff --git a/shlibs/mount/src/lock.c b/shlibs/mount/src/lock.c index 2d1f30f4..0f35aa3b 100644 --- a/shlibs/mount/src/lock.c +++ b/shlibs/mount/src/lock.c @@ -253,7 +253,7 @@ void mnt_unlock_file(mnt_lock *ml) } /** - * mnt_lock: + * mnt_lock_file * @ml: pointer to mnt_lock instance * * Creates lock file (e.g. /etc/mtab~). Note that this function uses -- cgit v1.2.3 From 00b4bcdf0f02dd170376ca97542403f700c2be00 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 1 Jun 2010 15:06:08 +0200 Subject: findmnt: minor coding style fixes Signed-off-by: Karel Zak --- misc-utils/findmnt.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index a7551cb6..597e393c 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -94,46 +94,46 @@ int ncolumns; /* libmount cache */ mnt_cache *cache; -static inline int get_column_id(int num) +static int get_column_id(int num) { assert(num < ncolumns); assert(columns[num] < __NCOLUMNS); return columns[num]; } -static inline struct colinfo *get_column_info(int num) +static struct colinfo *get_column_info(int num) { return &infos[ get_column_id(num) ]; } -static inline const char *column_id_to_name(int id) +static const char *column_id_to_name(int id) { assert(id < __NCOLUMNS); return infos[id].name; } -static inline const char *get_column_name(int num) +static const char *get_column_name(int num) { return get_column_info(num)->name; } -static inline float get_column_whint(int num) +static float get_column_whint(int num) { return get_column_info(num)->whint; } -static inline int get_column_truncate(int num) +static int get_column_truncate(int num) { return get_column_info(num)->truncate; } -static inline const char *get_match(int id) +static const char *get_match(int id) { assert(id < __NCOLUMNS); return infos[id].match; } -static inline void set_match(int id, const char *match) +static void set_match(int id, const char *match) { assert(id < __NCOLUMNS); infos[id].match = match; @@ -142,7 +142,7 @@ static inline void set_match(int id, const char *match) /* * "findmnt" without any filter */ -static inline int is_listall_mode(void) +static int is_listall_mode(void) { return (!get_match(COL_SOURCE) && !get_match(COL_TARGET) && @@ -155,7 +155,7 @@ static inline int is_listall_mode(void) * * ... it works like "mount " */ -static inline int is_mount_compatible_mode(void) +static int is_mount_compatible_mode(void) { if (!get_match(COL_SOURCE)) return 0; /* is required */ @@ -459,7 +459,8 @@ static int __attribute__((__noreturn__)) usage(FILE *out) "\nOptions:\n" " -s, --fstab search in static table of filesystems\n" " -m, --mtab search in table of mounted filesystems\n" - " -k, --kernel search in kernel (mountinfo) file (default)\n\n" + " -k, --kernel search in kernel table of mounted \n" + " filesystems (default)\n\n" " -c, --canonicalize canonicalize printed paths\n" " -d, --direction search direction - 'forward' or 'backward'\n" @@ -686,7 +687,7 @@ int main(int argc, char *argv[]) mnt_tab_set_cache(tb, cache); /* - * initialize output formatting (table.h) + * initialize output formatting (tt.h) */ tt = tt_new_table(tt_flags); if (!tt) { -- cgit v1.2.3 From 4edd03fd93fb2bbe820523d429b12ee7a2e99287 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 3 Jun 2010 16:29:20 +0200 Subject: findmnt: move from /sbin to /bin Signed-off-by: Karel Zak --- misc-utils/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc-utils/Makefile.am b/misc-utils/Makefile.am index cb3edcf1..d6e036dd 100644 --- a/misc-utils/Makefile.am +++ b/misc-utils/Makefile.am @@ -34,8 +34,9 @@ endif endif if BUILD_LIBBLKID -sbin_PROGRAMS += blkid findfs wipefs findmnt -dist_man_MANS += blkid.8 findfs.8 wipefs.8 +sbin_PROGRAMS += blkid findfs wipefs +bin_PROGRAMS += findmnt +dist_man_MANS += blkid.8 findfs.8 wipefs.8 findmnt.8 blkid_SOURCES = blkid.c $(top_srcdir)/lib/ismounted.c \ $(top_srcdir)/lib/strtosize.c blkid_LDADD = $(ul_libblkid_la) @@ -48,7 +49,6 @@ wipefs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir) findmnt_LDADD = $(ul_libmount_la) findmnt_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir) findmnt_SOURCES = findmnt.c $(top_srcdir)/lib/tt.c -dist_man_MANS += findmnt.8 if HAVE_STATIC_BLKID sbin_PROGRAMS += blkid.static blkid_static_SOURCES = $(blkid_SOURCES) -- cgit v1.2.3 From 54423a2569c564b10986e1d4eedfa8161f7cf721 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 3 Jun 2010 16:37:21 +0200 Subject: libmount: remove mnt_open_device() Signed-off-by: Karel Zak --- shlibs/mount/docs/libmount-sections.txt | 1 - shlibs/mount/src/cache.c | 11 ++--------- shlibs/mount/src/mount.h.in | 1 - shlibs/mount/src/mount.sym | 1 - shlibs/mount/src/utils.c | 28 ---------------------------- 5 files changed, 2 insertions(+), 40 deletions(-) diff --git a/shlibs/mount/docs/libmount-sections.txt b/shlibs/mount/docs/libmount-sections.txt index 3c4a9f77..b791c9aa 100644 --- a/shlibs/mount/docs/libmount-sections.txt +++ b/shlibs/mount/docs/libmount-sections.txt @@ -13,7 +13,6 @@ mnt_get_library_version utils mnt_fstype_is_netfs mnt_fstype_is_pseudofs -mnt_open_device mnt_match_fstype mnt_match_options diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c index bd6ea3a0..027fda44 100644 --- a/shlibs/mount/src/cache.c +++ b/shlibs/mount/src/cache.c @@ -239,7 +239,6 @@ const char *mnt_cache_find_tag(mnt_cache *cache, int mnt_cache_read_tags(mnt_cache *cache, const char *devname) { int i, ntags = 0; - int fd; static blkid_probe pr; const char *tags[] = { "LABEL", "UUID" }; @@ -264,14 +263,9 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) DBG(DEBUG_CACHE, printf("cache: reading tags for: %s\n", devname)); - fd = mnt_open_device(devname, O_RDONLY); - if (fd < 0) - return -1; - pr = blkid_new_probe(); + pr = blkid_new_probe_from_filename(devname); if (!pr) - goto error; - if (blkid_probe_set_device(pr, fd, 0, 0)) - goto error; + return -1; blkid_probe_enable_superblocks(pr, 1); @@ -304,7 +298,6 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) return ntags ? 0 : 1; error: blkid_free_probe(pr); - close(fd); return -1; } diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index e9ef49d6..276213b6 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -109,7 +109,6 @@ extern int mnt_get_library_version(const char **ver_string); /* utils.c */ extern int mnt_fstype_is_netfs(const char *type); extern int mnt_fstype_is_pseudofs(const char *type); -extern int mnt_open_device(const char *devname, int flags); extern int mnt_match_fstype(const char *type, const char *pattern); extern int mnt_match_options(const char *optstr, const char *pattern); diff --git a/shlibs/mount/src/mount.sym b/shlibs/mount/src/mount.sym index a1524eb1..819be0f1 100644 --- a/shlibs/mount/src/mount.sym +++ b/shlibs/mount/src/mount.sym @@ -62,7 +62,6 @@ global: mnt_new_optls; mnt_new_tab; mnt_new_tab_from_file; - mnt_open_device; mnt_optent_dup_value; mnt_optent_get_flag; mnt_optent_get_id; diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c index ae2945c0..f487383a 100644 --- a/shlibs/mount/src/utils.c +++ b/shlibs/mount/src/utils.c @@ -291,34 +291,6 @@ char *mnt_strconcat3(char *s, const char *t, const char *u) return s; } -/** - * mnt_open_device: - * @devname: device path - * @flags: open(2) flags - * - * Opens device like open(2), but waits for cdrom medium (if errno=ENOMEDIUM). - * - * Returns: file descriptor or -1 in case of error. - */ -int mnt_open_device(const char *devname, int flags) -{ - int retries = 0; - - do { - int fd = open(devname, flags); - if (fd >= 0) - return fd; - if (errno != ENOMEDIUM) - break; - if (retries >= CONFIG_CDROM_NOMEDIUM_RETRIES) - break; - ++retries; - sleep(3); - } while(1); - - return -1; -} - /* * Returns allocated string with username or NULL. */ -- cgit v1.2.3 From d6fead1e31aa1b76fc8fd701681a29a8bac58f96 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 3 Jun 2010 16:59:20 +0200 Subject: libmount: fix some gtkdoc warnings Signed-off-by: Karel Zak --- shlibs/mount/docs/Makefile.am | 2 +- shlibs/mount/docs/libmount-sections.txt | 4 ++-- shlibs/mount/src/fs.c | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/shlibs/mount/docs/Makefile.am b/shlibs/mount/docs/Makefile.am index a50390b0..13e1c655 100644 --- a/shlibs/mount/docs/Makefile.am +++ b/shlibs/mount/docs/Makefile.am @@ -59,7 +59,7 @@ EXTRA_HFILES= # Header files to ignore when scanning. Use base file name, no paths # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h -IGNORE_HFILES=mountP.h list.h partitions.h superblocks.h topology.h aix.h dos.h +IGNORE_HFILES=mountP.h # Images to copy into HTML directory. # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png diff --git a/shlibs/mount/docs/libmount-sections.txt b/shlibs/mount/docs/libmount-sections.txt index b791c9aa..59cdf47d 100644 --- a/shlibs/mount/docs/libmount-sections.txt +++ b/shlibs/mount/docs/libmount-sections.txt @@ -133,8 +133,8 @@ mnt_fs_get_fstype mnt_fs_set_fstype mnt_fs_get_optstr mnt_fs_set_optstr -mnt_fs_get_optfs -mnt_fs_get_optvfs +mnt_fs_get_fs_optstr +mnt_fs_get_vfs_optstr mnt_fs_get_freq mnt_fs_set_freq mnt_fs_get_passno diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c index 56a3b977..851c5f9b 100644 --- a/shlibs/mount/src/fs.c +++ b/shlibs/mount/src/fs.c @@ -353,6 +353,10 @@ int mnt_fs_set_optstr(mnt_fs *fs, const char *optstr) free(fs->vfs_optstr); fs->fs_optstr = fs->vfs_optstr = NULL; + /* TODO: it would be possible to use built-in maps of options + * and differentiate between VFS and FS options, then we can + * set fs_optstr and vfs_optstr */ + fs->optstr = p; return 0; -- cgit v1.2.3 From cc492b3d0467d5c272730459e1b13a35d27d7843 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 4 Jun 2010 09:43:21 +0200 Subject: libmount: add #warning libmount API is not stable yet! Signed-off-by: Karel Zak --- misc-utils/findmnt.c | 1 + shlibs/mount/src/mount.h.in | 4 ++++ shlibs/mount/src/mountP.h | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index 597e393c..c207432b 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -34,6 +34,7 @@ #endif #include +#define USE_UNSTABLE_LIBMOUNT_API #include #include "pathnames.h" diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 276213b6..cd9159cc 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -25,6 +25,10 @@ extern "C" { #endif +#ifndef USE_UNSTABLE_LIBMOUNT_API +# warning libmount API is not stable yet! +#endif + #include diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index c9c96dcc..ddd86ea2 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -12,11 +12,12 @@ #include +#define USE_UNSTABLE_LIBMOUNT_API + #include "mount.h" #include "list.h" /* features */ -#define CONFIG_CDROM_NOMEDIUM_RETRIES 5 #define CONFIG_LIBMOUNT_ASSERT #define CONFIG_LIBMOUNT_DEBUG -- cgit v1.2.3 From cd95853bbc2e41cb7b15cfff528fbd7065d15e83 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 4 Jun 2010 11:41:23 +0200 Subject: libblkid: optimize UDF label reading Signed-off-by: Karel Zak --- shlibs/blkid/src/superblocks/udf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shlibs/blkid/src/superblocks/udf.c b/shlibs/blkid/src/superblocks/udf.c index 55c96adb..78ddda68 100644 --- a/shlibs/blkid/src/superblocks/udf.c +++ b/shlibs/blkid/src/superblocks/udf.c @@ -136,6 +136,9 @@ anchor: blkid_probe_set_utf8label(pr, vd->type.primary.ident.c, 31, BLKID_ENC_UTF16BE); + + if (clen == 8 || clen == 16) + break; } } -- cgit v1.2.3 From b3f7edcf48126358612f521ddffbdd77506c14ab Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 4 Jun 2010 23:29:26 +0200 Subject: tests: update lscpu test Signed-off-by: Karel Zak --- tests/expected/lscpu/lscpu-ia64-hpmatterhorn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/expected/lscpu/lscpu-ia64-hpmatterhorn b/tests/expected/lscpu/lscpu-ia64-hpmatterhorn index e4446067..f7a38445 100644 --- a/tests/expected/lscpu/lscpu-ia64-hpmatterhorn +++ b/tests/expected/lscpu/lscpu-ia64-hpmatterhorn @@ -13,7 +13,7 @@ L2 cache: 256K L3 cache: 3072K NUMA node0 CPU(s): 4-7 NUMA node1 CPU(s): 0-3 -NUMA node2 CPU(s): +NUMA node2 CPU(s): # The following is the parsable format, which can be fed to other # programs. Each different item in every column has an unique ID -- cgit v1.2.3 From 88827f2623f24bda1e44cdacdee992732a722f90 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 4 Jun 2010 23:31:43 +0200 Subject: tests: mount cramfs read-only Signed-off-by: Karel Zak --- tests/ts/cramfs/mkfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ts/cramfs/mkfs b/tests/ts/cramfs/mkfs index eb85c55c..99b039e2 100755 --- a/tests/ts/cramfs/mkfs +++ b/tests/ts/cramfs/mkfs @@ -71,7 +71,7 @@ ts_device_has "TYPE" "cramfs" $DEVICE [ "$?" == "0" ] || ts_die "Cannot found cramfs on $DEVICE" $DEVICE ts_log "mount the image" -$TS_CMD_MOUNT -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT +$TS_CMD_MOUNT -r -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT # check it ts_is_mounted $DEVICE || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE -- cgit v1.2.3 From 5601d158545fc382be031a0330e512784baeee6d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 4 Jun 2010 23:33:49 +0200 Subject: tests: update blkid test for raid1 ID_PART_ENTRY_TYPE_ENC does not exists anymore. Signed-off-by: Karel Zak --- tests/expected/blkid/md-raid1-part | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/expected/blkid/md-raid1-part b/tests/expected/blkid/md-raid1-part index d770a741..08b49bd4 100644 --- a/tests/expected/blkid/md-raid1-part +++ b/tests/expected/blkid/md-raid1-part @@ -53,7 +53,6 @@ ID_FS_VERSION=0.90.0 ID_PART_ENTRY_NUMBER=1 ID_PART_ENTRY_SCHEME=dos ID_PART_ENTRY_TYPE=0x83 -ID_PART_ENTRY_TYPE_ENC=0x83 Probe second RAID member ID_FS_TYPE=linux_raid_member ID_FS_USAGE=raid @@ -63,4 +62,3 @@ ID_FS_VERSION=0.90.0 ID_PART_ENTRY_NUMBER=2 ID_PART_ENTRY_SCHEME=dos ID_PART_ENTRY_TYPE=0x83 -ID_PART_ENTRY_TYPE_ENC=0x83 -- cgit v1.2.3 From 98214cc9895bdc3881b2ffd72bf1ff4812ba1e6e Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 7 Jun 2010 12:22:25 +0200 Subject: po: update list of files Signed-off-by: Karel Zak --- po/POTFILES.in | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index 4ca65c8a..24644bb5 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -11,6 +11,7 @@ disk-utils/mkfs.cramfs.c disk-utils/mkfs.minix.c disk-utils/mkswap.c disk-utils/raw.c +disk-utils/swaplabel.c fdisk/cfdisk.c fdisk/fdiskaixlabel.c fdisk/fdiskbsdlabel.c @@ -33,13 +34,18 @@ hwclock/kd.c hwclock/rtc.c lib/blkdev.c lib/canonicalize.c +lib/cpuset.c lib/crc32.c lib/env.c lib/fsprobe.c lib/ismounted.c lib/linux_version.c +lib/mangle.c +lib/mbsalign.c lib/md5.c lib/setproctitle.c +lib/strtosize.c +lib/tt.c lib/wholedisk.c login-utils/agetty.c login-utils/checktty.c @@ -62,6 +68,7 @@ misc-utils/blkid.c misc-utils/cal.c misc-utils/ddate.c misc-utils/findfs.c +misc-utils/findmnt.c misc-utils/kill.c misc-utils/logger.c misc-utils/look.c @@ -122,16 +129,20 @@ shlibs/blkid/src/partitions/partitions.c shlibs/blkid/src/partitions/sgi.c shlibs/blkid/src/partitions/solaris_x86.c shlibs/blkid/src/partitions/sun.c +shlibs/blkid/src/partitions/ultrix.c shlibs/blkid/src/partitions/unixware.c shlibs/blkid/src/probe.c shlibs/blkid/src/read.c shlibs/blkid/src/resolve.c shlibs/blkid/src/save.c shlibs/blkid/src/superblocks/adaptec_raid.c +shlibs/blkid/src/superblocks/befs.c shlibs/blkid/src/superblocks/bfs.c shlibs/blkid/src/superblocks/btrfs.c shlibs/blkid/src/superblocks/cramfs.c shlibs/blkid/src/superblocks/ddf_raid.c +shlibs/blkid/src/superblocks/drbd.c +shlibs/blkid/src/superblocks/exfat.c shlibs/blkid/src/superblocks/ext.c shlibs/blkid/src/superblocks/gfs.c shlibs/blkid/src/superblocks/hfs.c @@ -178,6 +189,20 @@ shlibs/blkid/src/topology/topology.c shlibs/blkid/src/tst_types.c shlibs/blkid/src/verify.c shlibs/blkid/src/version.c +shlibs/mount/src/cache.c +shlibs/mount/src/fs.c +shlibs/mount/src/init.c +shlibs/mount/src/iter.c +shlibs/mount/src/lock.c +shlibs/mount/src/optent.c +shlibs/mount/src/optls.c +shlibs/mount/src/optmap.c +shlibs/mount/src/optstr.c +shlibs/mount/src/tab.c +shlibs/mount/src/tab_parse.c +shlibs/mount/src/test.c +shlibs/mount/src/utils.c +shlibs/mount/src/version.c shlibs/uuid/src/clear.c shlibs/uuid/src/compare.c shlibs/uuid/src/copy.c @@ -196,13 +221,13 @@ sys-utils/cytune.c sys-utils/dmesg.c sys-utils/fallocate.c sys-utils/flock.c +sys-utils/fsfreeze.c sys-utils/ipcmk.c sys-utils/ipcrm.c sys-utils/ipcs.c sys-utils/ldattach.c sys-utils/lscpu.c sys-utils/pivot_root.c -sys-utils/rdev.c sys-utils/readprofile.c sys-utils/renice.c sys-utils/rtcwake.c -- cgit v1.2.3 From 0c21600004dcd3f0be20b6ee24d32dab4cc0b218 Mon Sep 17 00:00:00 2001 From: Petr Pisar Date: Mon, 7 Jun 2010 12:27:04 +0200 Subject: po: update cs.po (from translationproject.org) --- po/cs.po | 1773 ++++++++++++++++++++++++++++---------------------------------- 1 file changed, 805 insertions(+), 968 deletions(-) diff --git a/po/cs.po b/po/cs.po index 2ffc8e25..b58373b6 100644 --- a/po/cs.po +++ b/po/cs.po @@ -9,14 +9,14 @@ # Jiří Pavlovský , 1999 - 2001. # Petr Písař , 2006. # Vladimír Michl , 2007 -# Petr Pisar , 2007, 2008, 2009. +# Petr Pisar , 2007, 2008, 2009, 2010. # msgid "" msgstr "" -"Project-Id-Version: util-linux-ng 2.17-rc3\n" +"Project-Id-Version: util-linux-ng 2.17.1-rc1\n" "Report-Msgid-Bugs-To: Karel Zak \n" -"POT-Creation-Date: 2010-01-07 21:55+0100\n" -"PO-Revision-Date: 2009-12-11 10:22+0100\n" +"POT-Creation-Date: 2010-02-16 10:22+0100\n" +"PO-Revision-Date: 2010-02-16 20:38+0100\n" "Last-Translator: Petr Pisar \n" "Language-Team: Czech \n" "MIME-Version: 1.0\n" @@ -478,8 +478,7 @@ msgstr "volání mknod selhalo: %s" #: disk-utils/fsck.cramfs.c:682 #, c-format msgid "directory data start (%ld) < sizeof(struct cramfs_super) + start (%ld)" -msgstr "" -"počátek dat adresáře (%ld) < sizeof(struct cramfs_super) + počátek (%ld)" +msgstr "počátek dat adresáře (%ld) < sizeof(struct cramfs_super) + počátek (%ld)" #: disk-utils/fsck.cramfs.c:685 #, c-format @@ -967,7 +966,7 @@ msgstr "příliš mnoho i-uzlů – maximum je 512" msgid "not enough space, need at least %llu blocks" msgstr "nedostatek místa, je třeba alespoň %llu bloků" -#: disk-utils/mkfs.bfs.c:223 fdisk/fdisk.c:2580 +#: disk-utils/mkfs.bfs.c:223 fdisk/fdisk.c:2629 #, c-format msgid "Device: %s\n" msgstr "Zařízení: %s\n" @@ -1055,8 +1054,7 @@ msgstr "mkfs (%s)\n" #: disk-utils/mkfs.cramfs.c:126 #, c-format msgid "" -"usage: %s [-h] [-v] [-b blksize] [-e edition] [-N endian] [-i file] [-n " -"name] dirname outfile\n" +"usage: %s [-h] [-v] [-b blksize] [-e edition] [-N endian] [-i file] [-n name] dirname outfile\n" " -h print this help\n" " -v be verbose\n" " -E make all warnings errors (non-zero exit status)\n" @@ -1082,8 +1080,7 @@ msgstr "" " -N ENDIANITA\n" " vybere endianitu cramfs („big“ [velká] | „little“ [malá] |\n" " „host“ [jako tento stroj]), implicitně host\n" -" -i SOUBOR vloží obraz ze SOUBORU do souborového systému (vyžaduje >= " -"2.4.0)\n" +" -i SOUBOR vloží obraz ze SOUBORU do souborového systému (vyžaduje >= 2.4.0)\n" " -n NÁZEV nastaví název souborového systému cramfs\n" " -p odsadí o %d bytů kvůli bootovacímu kódu\n" " -s seřadí položky v adresářích (stará volba, ignorováno)\n" @@ -1119,12 +1116,8 @@ msgstr "%6.2f%% (%+ld bytů)\t%s\n" #: disk-utils/mkfs.cramfs.c:853 #, c-format -msgid "" -"warning: guestimate of required size (upper bound) is %lldMB, but maximum " -"image size is %uMB. We might die prematurely.\n" -msgstr "" -"varování: požadovaná velikost (horní hranice) je odhadována na %lld MB, " -"jenže největší velikost obrazu je %u MB. Můžeme zemřít předčasně.\n" +msgid "warning: guestimate of required size (upper bound) is %lldMB, but maximum image size is %uMB. We might die prematurely.\n" +msgstr "varování: požadovaná velikost (horní hranice) je odhadována na %lld MB, jenže největší velikost obrazu je %u MB. Můžeme zemřít předčasně.\n" #: disk-utils/mkfs.cramfs.c:880 msgid "ROM image map" @@ -1158,8 +1151,7 @@ msgstr "CRC: %x\n" #: disk-utils/mkfs.cramfs.c:925 #, c-format msgid "not enough space allocated for ROM image (%lld allocated, %zu used)\n" -msgstr "" -"Pro obraz ROM nepřidělen dostatek prostoru (%lld přiděleno, %zu použito)\n" +msgstr "Pro obraz ROM nepřidělen dostatek prostoru (%lld přiděleno, %zu použito)\n" #: disk-utils/mkfs.cramfs.c:933 msgid "ROM image" @@ -1187,14 +1179,12 @@ msgstr "varování: velikosti souboru zkráceny na %'lu MB (mínus 1 bajt).\n" #: disk-utils/mkfs.cramfs.c:957 #, c-format -msgid "" -"warning: uids truncated to %u bits. (This may be a security concern.)\n" +msgid "warning: uids truncated to %u bits. (This may be a security concern.)\n" msgstr "varování: UID zkrácena na %u bitů. (Může mít dopad na bezpečnost.)\n" #: disk-utils/mkfs.cramfs.c:962 #, c-format -msgid "" -"warning: gids truncated to %u bits. (This may be a security concern.)\n" +msgid "warning: gids truncated to %u bits. (This may be a security concern.)\n" msgstr "varování: GID zkrácena na %u bitů. (Může mít dopad na bezpečnost.)\n" #: disk-utils/mkfs.cramfs.c:967 @@ -1203,8 +1193,7 @@ msgid "" "WARNING: device numbers truncated to %u bits. This almost certainly means\n" "that some device files will be wrong.\n" msgstr "" -"VAROVÁNÍ: čísla zařízení zkrácena na %u bitů. Toto jistě znamená, že " -"některé\n" +"VAROVÁNÍ: čísla zařízení zkrácena na %u bitů. Toto jistě znamená, že některé\n" "soubory zařízení budou špatné.\n" #: disk-utils/mkfs.minix.c:154 @@ -1383,9 +1372,7 @@ msgstr "žádné UUID\n" #: disk-utils/mkswap.c:283 #, c-format msgid "Usage: %s [-c] [-pPAGESZ] [-L label] [-U UUID] /dev/name [blocks]\n" -msgstr "" -"Použití: %s [-c] [-pVELIKOST_STRÁNKY] [-L JMENOVKA] [-U UUID] ZAŘÍZENÍ " -"[BLOKY]\n" +msgstr "Použití: %s [-c] [-pVELIKOST_STRÁNKY] [-L JMENOVKA] [-U UUID] ZAŘÍZENÍ [BLOKY]\n" #: disk-utils/mkswap.c:297 msgid "too many bad pages" @@ -1542,11 +1529,8 @@ msgstr "" #: disk-utils/raw.c:125 #, c-format -msgid "" -"Device '%s' is control raw dev (use raw where is greater than zero)\n" -msgstr "" -"Zařízení „%s“ je řídicí syrové zařízení (použijte raw, kde je větší " -"než nula)\n" +msgid "Device '%s' is control raw dev (use raw where is greater than zero)\n" +msgstr "Zařízení „%s“ je řídicí syrové zařízení (použijte raw, kde je větší než nula)\n" #: disk-utils/raw.c:145 #, c-format @@ -1719,17 +1703,12 @@ msgid "enlarged logical partitions overlap" msgstr "zvětšené logické diskové oddíly se vzájemně překrývají" #: fdisk/cfdisk.c:1003 -msgid "" -"!!!! Internal error creating logical drive with no extended partition !!!!" -msgstr "" -"!!!! Vnitřní chyba při vytváření logického disku bez rozšířených diskových " -"oddílů !!!!" +msgid "!!!! Internal error creating logical drive with no extended partition !!!!" +msgstr "!!!! Vnitřní chyba při vytváření logického disku bez rozšířených diskových oddílů !!!!" #: fdisk/cfdisk.c:1014 fdisk/cfdisk.c:1026 -msgid "" -"Cannot create logical drive here -- would create two extended partitions" -msgstr "" -"Zde nelze vytvořit logický disk -- vznikly by dva rozšířené diskové oddíly" +msgid "Cannot create logical drive here -- would create two extended partitions" +msgstr "Zde nelze vytvořit logický disk -- vznikly by dva rozšířené diskové oddíly" #: fdisk/cfdisk.c:1168 msgid "Menu item too long. Menu may look odd." @@ -1834,11 +1813,8 @@ msgid "Opened disk read-only - you have no permission to write" msgstr "Disk byl otevřen pouze pro čtení - nemáte práva pro zápis" #: fdisk/cfdisk.c:1687 -msgid "" -"Warning!! Unsupported GPT (GUID Partition Table) detected. Use GNU Parted." -msgstr "" -"Varování!! Detekována nepodporovaná GPT (GUID tabulka rozdělení disku). " -"Použijte GNU Parted." +msgid "Warning!! Unsupported GPT (GUID Partition Table) detected. Use GNU Parted." +msgstr "Varování!! Detekována nepodporovaná GPT (GUID tabulka rozdělení disku). Použijte GNU Parted." #: fdisk/cfdisk.c:1706 msgid "Cannot get disk size" @@ -1857,10 +1833,8 @@ msgid "Warning!! This may destroy data on your disk!" msgstr "Varování!! Toto může vést ke zničení dat na Vašem disku!" #: fdisk/cfdisk.c:1881 -msgid "" -"Are you sure you want to write the partition table to disk? (yes or no): " -msgstr "" -"Jste si jist, že chcete uložit tabulku rozdělení disku na disk? (ano či ne): " +msgid "Are you sure you want to write the partition table to disk? (yes or no): " +msgstr "Jste si jist, že chcete uložit tabulku rozdělení disku na disk? (ano či ne): " #: fdisk/cfdisk.c:1887 msgid "no" @@ -1887,9 +1861,7 @@ msgid "Wrote partition table to disk" msgstr "Tabulka rozdělení disku byla uložena na disk" #: fdisk/cfdisk.c:1926 -msgid "" -"Wrote partition table, but re-read table failed. Run partprobe(8), kpartx" -"(8) or reboot to update table." +msgid "Wrote partition table, but re-read table failed. Run partprobe(8), kpartx(8) or reboot to update table." msgstr "" "Tabulka rozdělení disku byla uložena, ale nepodařilo se ji znovu načíst.\n" "Aby se tabulka aktualizovala, spusťte partprobe(8), kpartx(8) nebo\n" @@ -1897,14 +1869,11 @@ msgstr "" #: fdisk/cfdisk.c:1936 msgid "No primary partitions are marked bootable. DOS MBR cannot boot this." -msgstr "" -"Žádný primární diskový oddíl není startovací. DOS MBR takto nenastartuje." +msgstr "Žádný primární diskový oddíl není startovací. DOS MBR takto nenastartuje." #: fdisk/cfdisk.c:1938 -msgid "" -"More than one primary partition is marked bootable. DOS MBR cannot boot this." -msgstr "" -"Více než 1 primární diskový oddíl je startovací. DOS MBR takto nenastartuje." +msgid "More than one primary partition is marked bootable. DOS MBR cannot boot this." +msgstr "Více než 1 primární diskový oddíl je startovací. DOS MBR takto nenastartuje." #: fdisk/cfdisk.c:1996 fdisk/cfdisk.c:2115 fdisk/cfdisk.c:2199 msgid "Enter filename or press RETURN to display on screen: " @@ -1945,12 +1914,12 @@ msgstr " Primární" msgid " Logical" msgstr " Logický" -#: fdisk/cfdisk.c:2089 fdisk/fdisk.c:1716 fdisk/fdisk.c:2050 -#: fdisk/fdisksgilabel.c:227 fdisk/fdisksunlabel.c:621 fdisk/sfdisk.c:638 +#: fdisk/cfdisk.c:2089 fdisk/fdisk.c:1761 fdisk/fdisk.c:2100 +#: fdisk/fdisksgilabel.c:227 fdisk/fdisksunlabel.c:616 fdisk/sfdisk.c:638 msgid "Unknown" msgstr "Neznámý" -#: fdisk/cfdisk.c:2095 fdisk/cfdisk.c:2563 fdisk/fdisksunlabel.c:44 +#: fdisk/cfdisk.c:2095 fdisk/cfdisk.c:2563 fdisk/fdisksunlabel.c:39 msgid "Boot" msgstr "Zaveditelný" @@ -1973,20 +1942,12 @@ msgid " First Last\n" msgstr " První Poslední\n" #: fdisk/cfdisk.c:2137 -msgid "" -" # Type Sector Sector Offset Length Filesystem Type (ID) " -"Flag\n" -msgstr "" -" # Typ sektor sektor Posun Délka ID systému souborů " -"Příz\n" +msgid " # Type Sector Sector Offset Length Filesystem Type (ID) Flag\n" +msgstr " # Typ sektor sektor Posun Délka ID systému souborů Příz\n" #: fdisk/cfdisk.c:2138 -msgid "" -"-- ------- ----------- ----------- ------ ----------- -------------------- " -"----\n" -msgstr "" -"-- ------- ----------- ----------- ------ ----------- -------------------- " -"----\n" +msgid "-- ------- ----------- ----------- ------ ----------- -------------------- ----\n" +msgstr "-- ------- ----------- ----------- ------ ----------- -------------------- ----\n" #: fdisk/cfdisk.c:2221 msgid " ---Starting---- ----Ending----- Start Number of\n" @@ -1998,8 +1959,7 @@ msgstr " # Příz. Hlav Sekt Cyl. ID Hlav Sekt Cyl. Sektor Sektorů\n" #: fdisk/cfdisk.c:2223 msgid "-- ----- ---- ---- ----- ---- ---- ---- ----- ----------- -----------\n" -msgstr "" -"-- ----- ---- ---- ----- ---- ---- ---- ----- ----------- -----------\n" +msgstr "-- ----- ---- ---- ----- ---- ---- ---- ----- ----------- -----------\n" #: fdisk/cfdisk.c:2256 msgid "Raw" @@ -2177,7 +2137,7 @@ msgstr "Poznámka: Všechny příkazy mohou být zadány malými i velkými pís msgid "case letters (except for Writes)." msgstr "(s výjimkou zápisu - W)." -#: fdisk/cfdisk.c:2358 fdisk/fdisksunlabel.c:237 +#: fdisk/cfdisk.c:2358 fdisk/fdisksunlabel.c:232 msgid "Cylinders" msgstr "Cylindry" @@ -2185,7 +2145,7 @@ msgstr "Cylindry" msgid "Change cylinder geometry" msgstr "Změní geometrii cylindrů" -#: fdisk/cfdisk.c:2359 fdisk/fdisksunlabel.c:235 +#: fdisk/cfdisk.c:2359 fdisk/fdisksunlabel.c:230 msgid "Heads" msgstr "Hlavy" @@ -2209,7 +2169,7 @@ msgstr "Geometrie změněna" msgid "Enter the number of cylinders: " msgstr "Zadejte počet cylindrů: " -#: fdisk/cfdisk.c:2385 fdisk/cfdisk.c:2956 +#: fdisk/cfdisk.c:2385 fdisk/cfdisk.c:2958 msgid "Illegal cylinders value" msgstr "Chybný počet cylindrů" @@ -2217,7 +2177,7 @@ msgstr "Chybný počet cylindrů" msgid "Enter the number of heads: " msgstr "Zadejte počet hlav: " -#: fdisk/cfdisk.c:2398 fdisk/cfdisk.c:2966 +#: fdisk/cfdisk.c:2398 fdisk/cfdisk.c:2968 msgid "Illegal heads value" msgstr "Chybný počet hlav" @@ -2225,7 +2185,7 @@ msgstr "Chybný počet hlav" msgid "Enter the number of sectors per track: " msgstr "Zadejte počet sektorů na stopu: " -#: fdisk/cfdisk.c:2411 fdisk/cfdisk.c:2973 +#: fdisk/cfdisk.c:2411 fdisk/cfdisk.c:2975 msgid "Illegal sectors value" msgstr "Chybný počet sektorů" @@ -2319,133 +2279,132 @@ msgstr "Velik. (MB)" msgid " Size (GB)" msgstr "Velik. (GB)" -#: fdisk/cfdisk.c:2747 +#: fdisk/cfdisk.c:2748 msgid "Bootable" msgstr "Zavedit." -#: fdisk/cfdisk.c:2747 +#: fdisk/cfdisk.c:2748 msgid "Toggle bootable flag of the current partition" msgstr "Přepne příznak zaveditelnosti aktuálnímu diskovému oddílu" -#: fdisk/cfdisk.c:2748 +#: fdisk/cfdisk.c:2749 msgid "Delete" msgstr "Smazat" -#: fdisk/cfdisk.c:2748 +#: fdisk/cfdisk.c:2749 msgid "Delete the current partition" msgstr "Smaže aktuální diskový oddíl" -#: fdisk/cfdisk.c:2749 +#: fdisk/cfdisk.c:2750 msgid "Geometry" msgstr "Geometrie" -#: fdisk/cfdisk.c:2749 +#: fdisk/cfdisk.c:2750 msgid "Change disk geometry (experts only)" msgstr "Změní geometrii disku (pouze pro odborníky)" -#: fdisk/cfdisk.c:2750 +#: fdisk/cfdisk.c:2751 msgid "Help" msgstr "Nápověda" -#: fdisk/cfdisk.c:2750 +#: fdisk/cfdisk.c:2751 msgid "Print help screen" msgstr "Vypíše nápovědu" -#: fdisk/cfdisk.c:2751 +#: fdisk/cfdisk.c:2752 msgid "Maximize" msgstr "Zvětšit" -#: fdisk/cfdisk.c:2751 +#: fdisk/cfdisk.c:2752 msgid "Maximize disk usage of the current partition (experts only)" -msgstr "" -"Zvětší velikost aktuálního diskového oddílu na maximum (pouze pro odborníky)" +msgstr "Zvětší velikost aktuálního diskového oddílu na maximum (pouze pro odborníky)" -#: fdisk/cfdisk.c:2752 +#: fdisk/cfdisk.c:2753 msgid "New" msgstr "Nový" -#: fdisk/cfdisk.c:2752 +#: fdisk/cfdisk.c:2753 msgid "Create new partition from free space" msgstr "Vytvoří nový diskový oddíl ve volném prostoru" -#: fdisk/cfdisk.c:2753 +#: fdisk/cfdisk.c:2754 msgid "Print" msgstr "Tisk" -#: fdisk/cfdisk.c:2753 +#: fdisk/cfdisk.c:2754 msgid "Print partition table to the screen or to a file" msgstr "Vypíše tabulku rozdělení disku (na obrazovku či do souboru)" -#: fdisk/cfdisk.c:2754 +#: fdisk/cfdisk.c:2755 msgid "Quit" msgstr "Konec" -#: fdisk/cfdisk.c:2754 +#: fdisk/cfdisk.c:2755 msgid "Quit program without writing partition table" msgstr "Ukončí program bez uložení tabulky rozdělení disku" -#: fdisk/cfdisk.c:2755 +#: fdisk/cfdisk.c:2756 msgid "Type" msgstr "Druh" -#: fdisk/cfdisk.c:2755 +#: fdisk/cfdisk.c:2756 msgid "Change the filesystem type (DOS, Linux, OS/2 and so on)" msgstr "Změní typ systému souborů (DOS, Linux, OS/2 atd.)" -#: fdisk/cfdisk.c:2756 +#: fdisk/cfdisk.c:2757 msgid "Units" msgstr "Jednotky" -#: fdisk/cfdisk.c:2756 +#: fdisk/cfdisk.c:2757 msgid "Change units of the partition size display (MB, sect, cyl)" msgstr "Změní jednotky, ve kterých je udávána velikost diskového oddílu" -#: fdisk/cfdisk.c:2757 +#: fdisk/cfdisk.c:2758 msgid "Write" msgstr "Uložit" -#: fdisk/cfdisk.c:2757 +#: fdisk/cfdisk.c:2758 msgid "Write partition table to disk (this might destroy data)" msgstr "Uloží tabulku rozdělení disku na disk (může zničit data)" -#: fdisk/cfdisk.c:2803 +#: fdisk/cfdisk.c:2805 msgid "Cannot make this partition bootable" msgstr "Tento oddíl nelze nastavit jako zaveditelný." -#: fdisk/cfdisk.c:2813 +#: fdisk/cfdisk.c:2815 msgid "Cannot delete an empty partition" msgstr "Prázdný diskový oddíl nelze smazat." -#: fdisk/cfdisk.c:2833 fdisk/cfdisk.c:2835 +#: fdisk/cfdisk.c:2835 fdisk/cfdisk.c:2837 msgid "Cannot maximize this partition" msgstr "Tento diskový oddíl nelze zvětšit." -#: fdisk/cfdisk.c:2843 +#: fdisk/cfdisk.c:2845 msgid "This partition is unusable" msgstr "Tento diskový oddíl je nepoužitelný." -#: fdisk/cfdisk.c:2845 +#: fdisk/cfdisk.c:2847 msgid "This partition is already in use" msgstr "Tento diskový oddíl je již používán." -#: fdisk/cfdisk.c:2862 +#: fdisk/cfdisk.c:2864 msgid "Cannot change the type of an empty partition" msgstr "Typ prázdného diskového oddílu nelze změnit." -#: fdisk/cfdisk.c:2889 fdisk/cfdisk.c:2895 +#: fdisk/cfdisk.c:2891 fdisk/cfdisk.c:2897 msgid "No more partitions" msgstr "Žádné další diskové oddíly" -#: fdisk/cfdisk.c:2902 +#: fdisk/cfdisk.c:2904 msgid "Illegal command" msgstr "Chybný příkaz" -#: fdisk/cfdisk.c:2912 +#: fdisk/cfdisk.c:2914 #, c-format msgid "Copyright (C) 1994-2002 Kevin E. Martin & aeb\n" msgstr "Copyright © 1994–2002 Kevin E. Martin & aeb\n" -#: fdisk/cfdisk.c:2919 +#: fdisk/cfdisk.c:2921 #, c-format msgid "" "\n" @@ -2476,8 +2435,7 @@ msgstr "" "Přepínače:\n" "-a: Namísto zvýrazňování použije šipku;\n" "-z: Začne s nulovou tabulkou rozdělení disku místo, aby ji četl z disku;\n" -"-c C -h H -s S: Zadání geometrie disku (má přednost před údaji, které " -"udržuje\n" +"-c C -h H -s S: Zadání geometrie disku (má přednost před údaji, které udržuje\n" " jádro.\n" "\n" @@ -2517,9 +2475,9 @@ msgstr "" "\n" "BSD tabulka rozdělení disku pro zařízení: %s\n" -#: fdisk/fdiskbsdlabel.c:128 fdisk/fdisk.c:390 fdisk/fdisk.c:409 -#: fdisk/fdisk.c:427 fdisk/fdisk.c:434 fdisk/fdisk.c:457 fdisk/fdisk.c:475 -#: fdisk/fdisk.c:491 fdisk/fdisk.c:507 +#: fdisk/fdiskbsdlabel.c:128 fdisk/fdisk.c:394 fdisk/fdisk.c:413 +#: fdisk/fdisk.c:431 fdisk/fdisk.c:438 fdisk/fdisk.c:461 fdisk/fdisk.c:479 +#: fdisk/fdisk.c:495 fdisk/fdisk.c:511 msgid "Command action" msgstr "Příkazy" @@ -2539,9 +2497,9 @@ msgstr " i instalovat zavaděč" msgid " l list known filesystem types" msgstr " l vypsat známé typy systémů souborů" -#: fdisk/fdiskbsdlabel.c:133 fdisk/fdisk.c:396 fdisk/fdisk.c:415 -#: fdisk/fdisk.c:428 fdisk/fdisk.c:440 fdisk/fdisk.c:465 fdisk/fdisk.c:482 -#: fdisk/fdisk.c:498 fdisk/fdisk.c:516 +#: fdisk/fdiskbsdlabel.c:133 fdisk/fdisk.c:400 fdisk/fdisk.c:419 +#: fdisk/fdisk.c:432 fdisk/fdisk.c:444 fdisk/fdisk.c:469 fdisk/fdisk.c:486 +#: fdisk/fdisk.c:502 fdisk/fdisk.c:520 msgid " m print this menu" msgstr " m vypíše tuto nabídku" @@ -2553,14 +2511,14 @@ msgstr " n vytvořit nový BSD diskový oddíl" msgid " p print BSD partition table" msgstr " p vytisknout BSD tabulku rozdělení disku" -#: fdisk/fdiskbsdlabel.c:136 fdisk/fdisk.c:400 fdisk/fdisk.c:419 -#: fdisk/fdisk.c:430 fdisk/fdisk.c:444 fdisk/fdisk.c:467 fdisk/fdisk.c:484 -#: fdisk/fdisk.c:500 fdisk/fdisk.c:518 +#: fdisk/fdiskbsdlabel.c:136 fdisk/fdisk.c:404 fdisk/fdisk.c:423 +#: fdisk/fdisk.c:434 fdisk/fdisk.c:448 fdisk/fdisk.c:471 fdisk/fdisk.c:488 +#: fdisk/fdisk.c:504 fdisk/fdisk.c:522 msgid " q quit without saving changes" msgstr " q ukončí program bez uložení změn" -#: fdisk/fdiskbsdlabel.c:137 fdisk/fdisk.c:468 fdisk/fdisk.c:485 -#: fdisk/fdisk.c:501 fdisk/fdisk.c:519 +#: fdisk/fdiskbsdlabel.c:137 fdisk/fdisk.c:472 fdisk/fdisk.c:489 +#: fdisk/fdisk.c:505 fdisk/fdisk.c:523 msgid " r return to main menu" msgstr " r návrat do hlavní nabídky" @@ -2603,13 +2561,13 @@ msgstr "Na %s se nenachází žádný *BSD diskový oddíl.\n" msgid "BSD disklabel command (m for help): " msgstr "Příkaz pro BSD popis disku (m pro nápovědu): " -#: fdisk/fdiskbsdlabel.c:283 fdisk/fdisk.c:2272 fdisk/fdisksgilabel.c:638 -#: fdisk/fdisksunlabel.c:431 +#: fdisk/fdiskbsdlabel.c:283 fdisk/fdisk.c:2322 fdisk/fdisksgilabel.c:638 +#: fdisk/fdisksunlabel.c:426 #, c-format msgid "First %s" msgstr "První %s" -#: fdisk/fdiskbsdlabel.c:290 fdisk/fdisksunlabel.c:488 +#: fdisk/fdiskbsdlabel.c:290 fdisk/fdisksunlabel.c:483 #, c-format msgid "Last %s or +size or +sizeM or +sizeK" msgstr "Poslední %s či +velikost či +velikostM či +velikostK" @@ -2757,7 +2715,7 @@ msgstr "sektorů/stopu" msgid "tracks/cylinder" msgstr "stop/cylindr" -#: fdisk/fdiskbsdlabel.c:469 fdisk/fdisk.c:725 fdisk/fdisk.c:1541 +#: fdisk/fdiskbsdlabel.c:469 fdisk/fdisk.c:740 fdisk/fdisk.c:1586 #: fdisk/sfdisk.c:930 msgid "cylinders" msgstr "cylindry" @@ -2815,7 +2773,7 @@ msgstr "Zavaděč instalován na %s.\n" msgid "Partition (a-%c): " msgstr "Diskový oddíl (a-%c): " -#: fdisk/fdiskbsdlabel.c:617 fdisk/fdisk.c:2436 +#: fdisk/fdiskbsdlabel.c:617 fdisk/fdisk.c:2485 #, c-format msgid "The maximum number of partitions has been created\n" msgstr "Již bylo vytvořeno maximální množství diskových oddílů.\n" @@ -2839,224 +2797,222 @@ msgstr "" "\n" "Synchronizují se disky.\n" -#: fdisk/fdisk.c:248 -msgid "" -"Usage: fdisk [-b SSZ] [-u] DISK Change partition table\n" -" fdisk -l [-b SSZ] [-u] DISK List partition table(s)\n" -" fdisk -s PARTITION Give partition size(s) in blocks\n" -" fdisk -v Give fdisk version\n" -"Here DISK is something like /dev/hdb or /dev/sda\n" -"and PARTITION is something like /dev/hda7\n" -"-u: give Start and End in sector (instead of cylinder) units\n" -"-b 2048: (for certain MO disks) use 2048-byte sectors\n" -msgstr "" -"Použití: fdisk [-b SSZ] [-u] DISK Změní tabulku rozdělení disku\n" -" fdisk -l [-b SSZ] [-u] DISK Vypíše tabulku rozdělení disku\n" -" fdisk -s ODDÍL Vypíše velikost diskového oddílu\n" -" v blocích\n" -" fdisk -v Vypíše informace o verzi\n" -"DISK je něco jako /dev/hdb či /dev/sda a ODDÍL je něco jako /dev/hda7\n" -"-u: vrací Začátek a Konec v sektorech (místo cylindrech)\n" -"-b 2048: (pro některé MO jednotky) použije 2048bajtové sektory\n" - -#: fdisk/fdisk.c:260 -msgid "" -"Usage: fdisk [-l] [-b SSZ] [-u] device\n" -"E.g.: fdisk /dev/hda (for the first IDE disk)\n" -" or: fdisk /dev/sdc (for the third SCSI disk)\n" -" or: fdisk /dev/eda (for the first PS/2 ESDI drive)\n" -" or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)\n" -" ...\n" -msgstr "" -"Použití: fdisk [-l] [-b SSZ] [-u] zařízení\n" -"Např: fdisk /dev/hda (pro první IDE disk)\n" -" či: fdisk /dev/sdc (pro třetí SCSI disk)\n" -" či: fdisk /dev/eda (pro první PS/2 ESDI disk)\n" -" či: fdisk /dev/rd/c0d0 či: fdisk /dev/ida/c0d0 (pro RAID zařízení)\n" -" …\n" - -#: fdisk/fdisk.c:269 +#: fdisk/fdisk.c:256 +msgid "" +"Usage:\n" +" fdisk [options] change partition table\n" +" fdisk [options] -l list partition table(s)\n" +" fdisk -s give partition size(s) in blocks\n" +"\n" +"Options:\n" +" -b sector size (512, 1024, 2048 or 4096)\n" +" -c switch off DOS-compatible mode\n" +" -h print help\n" +" -u give sizes in sectors instead of cylinders\n" +" -v print version\n" +" -C specify the number of cylinders\n" +" -H specify the number of heads\n" +" -S specify the number of sectors per track\n" +"\n" +msgstr "" +"Použití:\n" +" fdisk [PŘEPÍNAČE] změní tabulku rozdělení disku\n" +" fdisk [PŘEPÍNAČE] -l vypíše tabulku(y) rozdělení disku\n" +" fdisk -s vypíše velikost(i) diskového oddílu v blocích\n" +"\n" +"Přepínače:\n" +" -b velikost sektoru (512, 1024, 2048 nebo 4096)\n" +" -c vypne režim kompatibility s DOSem\n" +" -h vypíše nápovědu\n" +" -u vrací velikosti v sektorech namísto v cylindrech\n" +" -v vypíše verzi\n" +" -C určuje počet cylindrů\n" +" -H určuje počet hlav\n" +" -S určuje počet sektorů na stopu\n" +"\n" + +#: fdisk/fdisk.c:273 #, c-format msgid "Unable to open %s\n" msgstr "%s nelze otevřít\n" -#: fdisk/fdisk.c:273 +#: fdisk/fdisk.c:277 #, c-format msgid "Unable to read %s\n" msgstr "%s nelze číst\n" -#: fdisk/fdisk.c:277 +#: fdisk/fdisk.c:281 #, c-format msgid "Unable to seek on %s\n" msgstr "Ukazovátko nelze posunout na %s.\n" -#: fdisk/fdisk.c:281 +#: fdisk/fdisk.c:285 #, c-format msgid "Unable to write %s\n" msgstr "%s nelze uložit\n" -#: fdisk/fdisk.c:285 +#: fdisk/fdisk.c:289 #, c-format msgid "BLKGETSIZE ioctl failed on %s\n" msgstr "volání BLKGETSIZE ioctl pro %s selhalo\n" -#: fdisk/fdisk.c:289 +#: fdisk/fdisk.c:293 msgid "Unable to allocate any more memory\n" msgstr "Nelze alokovat více paměti\n" -#: fdisk/fdisk.c:292 +#: fdisk/fdisk.c:296 msgid "Fatal error\n" msgstr "Fatální chyba\n" -#: fdisk/fdisk.c:391 +#: fdisk/fdisk.c:395 msgid " a toggle a read only flag" msgstr " a přepne příznak \"pouze pro čtení\"" -#: fdisk/fdisk.c:392 fdisk/fdisk.c:436 +#: fdisk/fdisk.c:396 fdisk/fdisk.c:440 msgid " b edit bsd disklabel" msgstr " b úprava bsd popisu disku" -#: fdisk/fdisk.c:393 +#: fdisk/fdisk.c:397 msgid " c toggle the mountable flag" msgstr " c přepne příznak \"připojitelný\"" -#: fdisk/fdisk.c:394 fdisk/fdisk.c:413 fdisk/fdisk.c:438 +#: fdisk/fdisk.c:398 fdisk/fdisk.c:417 fdisk/fdisk.c:442 msgid " d delete a partition" msgstr " d smaže diskový oddíl" -#: fdisk/fdisk.c:395 fdisk/fdisk.c:414 fdisk/fdisk.c:439 +#: fdisk/fdisk.c:399 fdisk/fdisk.c:418 fdisk/fdisk.c:443 msgid " l list known partition types" msgstr " l vypíše známé typy diskových oddílů" -#: fdisk/fdisk.c:397 fdisk/fdisk.c:416 fdisk/fdisk.c:441 +#: fdisk/fdisk.c:401 fdisk/fdisk.c:420 fdisk/fdisk.c:445 msgid " n add a new partition" msgstr " n vytvoří nový diskový oddíl" -#: fdisk/fdisk.c:398 fdisk/fdisk.c:417 fdisk/fdisk.c:429 fdisk/fdisk.c:442 +#: fdisk/fdisk.c:402 fdisk/fdisk.c:421 fdisk/fdisk.c:433 fdisk/fdisk.c:446 msgid " o create a new empty DOS partition table" msgstr " o vytvoří prázdnou tabulku rozdělení disků typu IBM (DOS)" -#: fdisk/fdisk.c:399 fdisk/fdisk.c:418 fdisk/fdisk.c:443 fdisk/fdisk.c:466 -#: fdisk/fdisk.c:483 fdisk/fdisk.c:499 fdisk/fdisk.c:517 +#: fdisk/fdisk.c:403 fdisk/fdisk.c:422 fdisk/fdisk.c:447 fdisk/fdisk.c:470 +#: fdisk/fdisk.c:487 fdisk/fdisk.c:503 fdisk/fdisk.c:521 msgid " p print the partition table" msgstr " p vypíše tabulku rozdělení disku" -#: fdisk/fdisk.c:401 fdisk/fdisk.c:420 fdisk/fdisk.c:431 fdisk/fdisk.c:445 +#: fdisk/fdisk.c:405 fdisk/fdisk.c:424 fdisk/fdisk.c:435 fdisk/fdisk.c:449 msgid " s create a new empty Sun disklabel" msgstr " s vytvoří prázdný Sun popis disku" -#: fdisk/fdisk.c:402 fdisk/fdisk.c:421 fdisk/fdisk.c:446 +#: fdisk/fdisk.c:406 fdisk/fdisk.c:425 fdisk/fdisk.c:450 msgid " t change a partition's system id" msgstr " t změní ID systému diskového oddílu" -#: fdisk/fdisk.c:403 fdisk/fdisk.c:422 fdisk/fdisk.c:447 +#: fdisk/fdisk.c:407 fdisk/fdisk.c:426 fdisk/fdisk.c:451 msgid " u change display/entry units" msgstr " u změní jednotky v nichž jsou vypisovány informace" -#: fdisk/fdisk.c:404 fdisk/fdisk.c:423 fdisk/fdisk.c:448 fdisk/fdisk.c:470 -#: fdisk/fdisk.c:487 fdisk/fdisk.c:503 fdisk/fdisk.c:521 +#: fdisk/fdisk.c:408 fdisk/fdisk.c:427 fdisk/fdisk.c:452 fdisk/fdisk.c:474 +#: fdisk/fdisk.c:491 fdisk/fdisk.c:507 fdisk/fdisk.c:525 msgid " v verify the partition table" msgstr " v ověří tabulku rozdělení disku" -#: fdisk/fdisk.c:405 fdisk/fdisk.c:424 fdisk/fdisk.c:449 fdisk/fdisk.c:471 -#: fdisk/fdisk.c:488 fdisk/fdisk.c:504 fdisk/fdisk.c:522 +#: fdisk/fdisk.c:409 fdisk/fdisk.c:428 fdisk/fdisk.c:453 fdisk/fdisk.c:475 +#: fdisk/fdisk.c:492 fdisk/fdisk.c:508 fdisk/fdisk.c:526 msgid " w write table to disk and exit" msgstr " w uloží tabulku rozdělení disku a ukončí program" -#: fdisk/fdisk.c:406 fdisk/fdisk.c:450 +#: fdisk/fdisk.c:410 fdisk/fdisk.c:454 msgid " x extra functionality (experts only)" msgstr " x rozšiřující funkce (pouze pro odborníky)" -#: fdisk/fdisk.c:410 +#: fdisk/fdisk.c:414 msgid " a select bootable partition" msgstr " a nastaví startovací diskový oddíl" -#: fdisk/fdisk.c:411 +#: fdisk/fdisk.c:415 msgid " b edit bootfile entry" msgstr " b úprava položky startovacího souboru" -#: fdisk/fdisk.c:412 +#: fdisk/fdisk.c:416 msgid " c select sgi swap partition" msgstr " c nastaví SGI odkládací diskový oddíl" -#: fdisk/fdisk.c:435 +#: fdisk/fdisk.c:439 msgid " a toggle a bootable flag" msgstr " a přepne příznak \"startovací\"" -#: fdisk/fdisk.c:437 +#: fdisk/fdisk.c:441 msgid " c toggle the dos compatibility flag" msgstr " c přepne příznak \"DOS kompatibilní\"" -#: fdisk/fdisk.c:458 +#: fdisk/fdisk.c:462 msgid " a change number of alternate cylinders" msgstr " a změní množství alternativních cylindrů" -#: fdisk/fdisk.c:459 fdisk/fdisk.c:477 fdisk/fdisk.c:493 fdisk/fdisk.c:509 +#: fdisk/fdisk.c:463 fdisk/fdisk.c:481 fdisk/fdisk.c:497 fdisk/fdisk.c:513 msgid " c change number of cylinders" msgstr " c změní množství cylindrů" -#: fdisk/fdisk.c:460 fdisk/fdisk.c:478 fdisk/fdisk.c:494 fdisk/fdisk.c:510 +#: fdisk/fdisk.c:464 fdisk/fdisk.c:482 fdisk/fdisk.c:498 fdisk/fdisk.c:514 msgid " d print the raw data in the partition table" msgstr " d vypíše tabulku rozdělení disku (tak jak je uložena na disku)" -#: fdisk/fdisk.c:461 +#: fdisk/fdisk.c:465 msgid " e change number of extra sectors per cylinder" msgstr " e změní množství extra sektorů na stopu" -#: fdisk/fdisk.c:462 fdisk/fdisk.c:481 fdisk/fdisk.c:497 fdisk/fdisk.c:514 +#: fdisk/fdisk.c:466 fdisk/fdisk.c:485 fdisk/fdisk.c:501 fdisk/fdisk.c:518 msgid " h change number of heads" msgstr " h změní množství hlav" -#: fdisk/fdisk.c:463 +#: fdisk/fdisk.c:467 msgid " i change interleave factor" msgstr " i změní prokládací faktor" -#: fdisk/fdisk.c:464 +#: fdisk/fdisk.c:468 msgid " o change rotation speed (rpm)" msgstr " o změní rychlost otáčení" -#: fdisk/fdisk.c:469 fdisk/fdisk.c:486 fdisk/fdisk.c:502 fdisk/fdisk.c:520 +#: fdisk/fdisk.c:473 fdisk/fdisk.c:490 fdisk/fdisk.c:506 fdisk/fdisk.c:524 msgid " s change number of sectors/track" msgstr " s změní počet sektorů/stopu" -#: fdisk/fdisk.c:472 +#: fdisk/fdisk.c:476 msgid " y change number of physical cylinders" msgstr " y změní počet fyzických cylindrů" -#: fdisk/fdisk.c:476 fdisk/fdisk.c:492 fdisk/fdisk.c:508 +#: fdisk/fdisk.c:480 fdisk/fdisk.c:496 fdisk/fdisk.c:512 msgid " b move beginning of data in a partition" msgstr " b posune počátek dat v diskovém oddílu" -#: fdisk/fdisk.c:479 fdisk/fdisk.c:495 fdisk/fdisk.c:511 +#: fdisk/fdisk.c:483 fdisk/fdisk.c:499 fdisk/fdisk.c:515 msgid " e list extended partitions" msgstr " e vypíše rozšířené diskové oddíly" -#: fdisk/fdisk.c:480 fdisk/fdisk.c:496 fdisk/fdisk.c:513 +#: fdisk/fdisk.c:484 fdisk/fdisk.c:500 fdisk/fdisk.c:517 msgid " g create an IRIX (SGI) partition table" msgstr " g vytvoří tabulku rozdělení disku typu IRIX (SGI)" -#: fdisk/fdisk.c:512 +#: fdisk/fdisk.c:516 msgid " f fix partition order" msgstr " f opraví řazení diskových oddílů" -#: fdisk/fdisk.c:515 +#: fdisk/fdisk.c:519 msgid " i change the disk identifier" msgstr " i změní identifikátor disku" -#: fdisk/fdisk.c:631 +#: fdisk/fdisk.c:635 #, c-format msgid "You must set" msgstr "Musíte nastavit" -#: fdisk/fdisk.c:721 +#: fdisk/fdisk.c:736 msgid "heads" msgstr "hlavy" -#: fdisk/fdisk.c:723 fdisk/fdisk.c:1541 fdisk/sfdisk.c:930 +#: fdisk/fdisk.c:738 fdisk/fdisk.c:1586 fdisk/sfdisk.c:930 msgid "sectors" msgstr "sektory" -#: fdisk/fdisk.c:729 +#: fdisk/fdisk.c:744 #, c-format msgid "" "%s%s.\n" @@ -3065,30 +3021,11 @@ msgstr "" "%s%s.\n" "Můžete tak učinit z nabídky rozšiřujících funkcí.\n" -#: fdisk/fdisk.c:730 +#: fdisk/fdisk.c:745 msgid " and " msgstr " a " -#: fdisk/fdisk.c:747 -#, c-format -msgid "" -"\n" -"The number of cylinders for this disk is set to %d.\n" -"There is nothing wrong with that, but this is larger than 1024,\n" -"and could in certain setups cause problems with:\n" -"1) software that runs at boot time (e.g., old versions of LILO)\n" -"2) booting and partitioning software from other OSs\n" -" (e.g., DOS FDISK, OS/2 FDISK)\n" -msgstr "" -"\n" -"Počet cylindrů tohoto disku je nastaven na %d.\n" -"Na tom není nic špatného, ale jelikož je to více než 1024,\n" -"může za určitých okolností dojít k problémům:\n" -"1) s programy spouštěnými při startu (např. staré verze LILA)\n" -"2) s programy pro správu diskových oddílů z jiných OS\n" -" (např. DOS FDISK, OS/2 FDISK)\n" - -#: fdisk/fdisk.c:763 +#: fdisk/fdisk.c:765 #, c-format msgid "" "\n" @@ -3105,48 +3042,57 @@ msgstr "" "Použijte parted(1) a tabulku rozdělení disku typu GUID (GPT).\n" "\n" -#: fdisk/fdisk.c:780 +#: fdisk/fdisk.c:783 #, c-format msgid "" "\n" "The device presents a logical sector size that is smaller than\n" -"the physical sector size. Aligning to a physical sector boundary\n" -"is recommended, or performance may be impacted.\n" -"\n" +"the physical sector size. Aligning to a physical sector (or optimal\n" +"I/O) size boundary is recommended, or performance may be impacted.\n" msgstr "" "\n" -"Zařízení uvádí, že velikost logického sektoru je menší než velikost\n" -"sektoru fyzického. Doporučuje se dodržet zarovnání na hranice fyzických\n" -"sektorů. V opačném případě může utrpět výkon.\n" -"\n" +"Zařízení uvádí, že velikost logického sektoru je menší než velikost sektoru\n" +"fyzického. Doporučuje se dodržet zarovnání na hranice fyzických sektorů\n" +"(nebo bloků optimálních pro I/O). V opačném případě může utrpět výkon.\n" -#: fdisk/fdisk.c:792 +#: fdisk/fdisk.c:789 #, c-format msgid "" -"WARNING: The device does not provide compensation (alignment_offset)\n" -"for DOS-compatible partitioning, but DOS-compatible mode is enabled.\n" -"Use command 'c' to switch-off DOS mode.\n" "\n" +"WARNING: DOS-compatible mode is deprecated. It's strongly recommended to\n" +" switch off the mode (command 'c')" +msgstr "" +"\n" +"POZOR: Režim kompatibility s DOSem je zastaralý. Důrazně se doporučuje tento\n" +" režim vypnout (příkaz „c“)" + +# Dodržet zarovnání se zprávou „POZOR: Režim kompatibility…“ +#: fdisk/fdisk.c:794 +#, c-format +msgid "" +" and change display units to\n" +" sectors (command 'u').\n" msgstr "" -"POZOR: Zařízení neposkytuje vyrovnání (alignment_offset) při dělení disku\n" -"podle DOSu, avšak režim kompatibility s DOSem je zapnut.\n" -"Použijte příkaz „c“ na vypnutí režimu DOSu.\n" +" a změnit jednotky výpisů na sektory\n" +" (příkaz „u“).\n" -#: fdisk/fdisk.c:798 +#: fdisk/fdisk.c:800 #, c-format msgid "" -"It's recommended to change display units to sectors (command 'u').\n" "\n" +"WARNING: cylinders as display units are deprecated. Use command 'u' to\n" +" change units to sectors.\n" msgstr "" -"Doporučuje se změnit jednotky výpisů na sektory (příkaz „u“).\n" "\n" +"POZOR: cylindry jakožto jednotky výpisů jsou zastaralé. Jednotky lze změnit\n" +" na sektory pomocí příkazu „u“.\n" -#: fdisk/fdisk.c:815 +#: fdisk/fdisk.c:819 #, c-format msgid "Bad offset in primary extended partition\n" msgstr "Chybný posun v primárním diskovém oddílu\n" -#: fdisk/fdisk.c:829 +#: fdisk/fdisk.c:833 #, c-format msgid "" "Warning: omitting partitions after #%d.\n" @@ -3155,32 +3101,32 @@ msgstr "" "Varování: vynechávám oddíly po čísle %d.\n" "Pokud tuto tabulku rozdělení disku uložíte, budou ztraceny.\n" -#: fdisk/fdisk.c:848 +#: fdisk/fdisk.c:852 #, c-format msgid "Warning: extra link pointer in partition table %d\n" msgstr "Varování: nadbytečný ukazatel na link v tabulce rozdělení disku %d.\n" -#: fdisk/fdisk.c:856 +#: fdisk/fdisk.c:860 #, c-format msgid "Warning: ignoring extra data in partition table %d\n" msgstr "Varování: nadbytečná data v tabulce rozdělení disku %d ignorována.\n" -#: fdisk/fdisk.c:889 +#: fdisk/fdisk.c:893 #, c-format msgid "omitting empty partition (%d)\n" msgstr "vynechávám prázdný oddíl (%d)\n" -#: fdisk/fdisk.c:908 +#: fdisk/fdisk.c:912 #, c-format msgid "Disk identifier: 0x%08x\n" msgstr "Identifikátor disku: 0x%08x\n" -#: fdisk/fdisk.c:917 +#: fdisk/fdisk.c:921 #, c-format msgid "New disk identifier (current 0x%08x): " msgstr "Nový identifikátor disku (současný 0x%08x): " -#: fdisk/fdisk.c:936 +#: fdisk/fdisk.c:940 #, c-format msgid "" "Building a new DOS disklabel with disk identifier 0x%08x.\n" @@ -3189,34 +3135,20 @@ msgid "" "\n" msgstr "" "Vytvářím novou DOSOVOU tabulku rozdělení disku s identifikátorem 0x%08x.\n" -"Změny budou uloženy pouze v paměti, dokud se nerozhodnete je uložit na " -"disk.\n" +"Změny budou uloženy pouze v paměti, dokud se nerozhodnete je uložit na disk.\n" "Poté již nebudou stará data pochopitelně dostupná.\n" -#: fdisk/fdisk.c:987 +#: fdisk/fdisk.c:1010 #, c-format msgid "Note: sector size is %d (not %d)\n" msgstr "Pozor: velikost sektoru je %d (nikoliv %d)\n" -#: fdisk/fdisk.c:1051 -#, c-format -msgid "" -"\n" -"WARNING: the device provides alignment_offset, but the offset does not\n" -"match with device geometry.\n" -"\n" -msgstr "" -"\n" -"POZOR: Zařízení poskytuje alignment_offset (zarovnávací posun), ale posun\n" -"neodpovídá geometrii zařízení.\n" -"\n" - -#: fdisk/fdisk.c:1162 +#: fdisk/fdisk.c:1208 #, c-format msgid "You will not be able to write the partition table.\n" msgstr "Nebudete moci uložit tabulku rozdělení disku.\n" -#: fdisk/fdisk.c:1194 +#: fdisk/fdisk.c:1240 #, c-format msgid "" "This disk has both DOS and BSD magic.\n" @@ -3225,36 +3157,29 @@ msgstr "" "Tento disk má magické signatury DOSU i BSD.\n" "Pro vstup do BSD režimu použijte příkaz „b“.\n" -#: fdisk/fdisk.c:1204 +#: fdisk/fdisk.c:1250 #, c-format -msgid "" -"Device contains neither a valid DOS partition table, nor Sun, SGI or OSF " -"disklabel\n" +msgid "Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel\n" msgstr "" -"Zařízení neobsahuje ani DOSOVOU tabulku rozdělení disku, ani SUN či SGI " -"popis\n" +"Zařízení neobsahuje ani DOSOVOU tabulku rozdělení disku, ani SUN či SGI popis\n" "disku\n" -#: fdisk/fdisk.c:1221 +#: fdisk/fdisk.c:1267 #, c-format msgid "Internal error\n" msgstr "Vnitřní chyba\n" -#: fdisk/fdisk.c:1231 +#: fdisk/fdisk.c:1277 #, c-format msgid "Ignoring extra extended partition %d\n" msgstr "Nadbytečný rozšířený diskový oddíl %d ignorován.\n" -#: fdisk/fdisk.c:1243 +#: fdisk/fdisk.c:1289 #, c-format -msgid "" -"Warning: invalid flag 0x%04x of partition table %d will be corrected by w" -"(rite)\n" -msgstr "" -"Varování: chybný příznak 0x%04x tabulky rozdělení disku %d bude opraven " -"zápisem(w)\n" +msgid "Warning: invalid flag 0x%04x of partition table %d will be corrected by w(rite)\n" +msgstr "Varování: chybný příznak 0x%04x tabulky rozdělení disku %d bude opraven zápisem(w)\n" -#: fdisk/fdisk.c:1270 +#: fdisk/fdisk.c:1315 #, c-format msgid "" "\n" @@ -3263,21 +3188,21 @@ msgstr "" "\n" "třikrát jsem nalezl EOF - končím..\n" -#: fdisk/fdisk.c:1309 +#: fdisk/fdisk.c:1354 msgid "Hex code (type L to list codes): " msgstr "Šestnáctkově (L vypíše kódy):" -#: fdisk/fdisk.c:1342 +#: fdisk/fdisk.c:1387 #, c-format msgid "%s (%u-%u, default %u): " msgstr "%s (%u-%u, implicitně %u): " -#: fdisk/fdisk.c:1409 +#: fdisk/fdisk.c:1454 #, c-format msgid "Unsupported suffix: '%s'.\n" msgstr "Nepodporovaná přípona: „%s“.\n" -#: fdisk/fdisk.c:1410 +#: fdisk/fdisk.c:1455 #, c-format msgid "" "Supported: 10^N: KB (KiloByte), MB (MegaByte), GB (GigaByte)\n" @@ -3286,74 +3211,74 @@ msgstr "" "Podporované: 10^N: KB (kilobajt), MB (megabajt), GB (gigabajt)\n" " 2^N: K (kibibajt), M (mebibajt), G (gibibajt)\n" -#: fdisk/fdisk.c:1438 +#: fdisk/fdisk.c:1483 #, c-format msgid "Using default value %u\n" msgstr "Používám implicitní hodnotu %u\n" -#: fdisk/fdisk.c:1442 +#: fdisk/fdisk.c:1487 #, c-format msgid "Value out of range.\n" msgstr "Hodnota je mimo meze.\n" -#: fdisk/fdisk.c:1467 +#: fdisk/fdisk.c:1512 msgid "Partition number" msgstr "Číslo diskového oddílu" -#: fdisk/fdisk.c:1478 +#: fdisk/fdisk.c:1523 #, c-format msgid "Warning: partition %d has empty type\n" msgstr "Varování: diskový oddíl %d nemá určen typ\n" -#: fdisk/fdisk.c:1500 fdisk/fdisk.c:1526 +#: fdisk/fdisk.c:1545 fdisk/fdisk.c:1571 #, c-format msgid "Selected partition %d\n" msgstr "Vybrán oddíl %d\n" -#: fdisk/fdisk.c:1503 +#: fdisk/fdisk.c:1548 #, c-format msgid "No partition is defined yet!\n" msgstr "Ještě nejsou definovány žádné diskové oddíly!\n" -#: fdisk/fdisk.c:1529 +#: fdisk/fdisk.c:1574 #, c-format msgid "All primary partitions have been defined already!\n" msgstr "Již byly definovány všechny primární diskové oddíly!\n" -#: fdisk/fdisk.c:1539 +#: fdisk/fdisk.c:1584 msgid "cylinder" msgstr "cylindr" -#: fdisk/fdisk.c:1539 +#: fdisk/fdisk.c:1584 msgid "sector" msgstr "sektor" -#: fdisk/fdisk.c:1548 +#: fdisk/fdisk.c:1593 #, c-format msgid "Changing display/entry units to %s\n" msgstr "Měním jednotky v nichž jsou vypisovány informace na %s\n" -#: fdisk/fdisk.c:1559 +#: fdisk/fdisk.c:1604 #, c-format msgid "WARNING: Partition %d is an extended partition\n" msgstr "VAROVÁNÍ: diskový oddíl %d je rozšířeným diskovým oddílem\n" -#: fdisk/fdisk.c:1569 +#: fdisk/fdisk.c:1614 #, c-format msgid "DOS Compatibility flag is set\n" msgstr "Příznak DOSOVÉ kompatibility je nastaven.\n" -#: fdisk/fdisk.c:1571 +#: fdisk/fdisk.c:1616 #, c-format msgid "DOS Compatibility flag is not set\n" msgstr "Příznak DOSOVÉ kompatibility není nastaven.\n" -#: fdisk/fdisk.c:1672 +#: fdisk/fdisk.c:1717 #, c-format msgid "Partition %d does not exist yet!\n" msgstr "Diskový oddíl %d zatím neexistuje!\n" -#: fdisk/fdisk.c:1677 +#: fdisk/fdisk.c:1722 #, c-format msgid "" "Type 0 means free space to many systems\n" @@ -3365,16 +3290,14 @@ msgstr "" "volný prostor. Vytvářet diskové oddíly typu 0 není moudré.\n" "Diskový oddíl můžete smazat pomocí příkazu „d“.\n" -#: fdisk/fdisk.c:1686 +#: fdisk/fdisk.c:1731 #, c-format msgid "" "You cannot change a partition into an extended one or vice versa\n" "Delete it first.\n" -msgstr "" -"Nemůžete měnit běžné diskové oddíly na rozšířené a zpět. Nejdříve jej " -"smažte.\n" +msgstr "Nemůžete měnit běžné diskové oddíly na rozšířené a zpět. Nejdříve jej smažte.\n" -#: fdisk/fdisk.c:1695 +#: fdisk/fdisk.c:1740 #, c-format msgid "" "Consider leaving partition 3 as Whole disk (5),\n" @@ -3385,7 +3308,7 @@ msgstr "" "neboť SunOS/Solaris to očekává a i Linux tomu dává přednost.\n" "\n" -#: fdisk/fdisk.c:1701 +#: fdisk/fdisk.c:1746 #, c-format msgid "" "Consider leaving partition 9 as volume header (0),\n" @@ -3396,63 +3319,62 @@ msgstr "" "oddíl 11 jako celý svazek (6), neboť IRIX to očekává.\n" "\n" -#: fdisk/fdisk.c:1718 +#: fdisk/fdisk.c:1763 #, c-format msgid "Changed system type of partition %d to %x (%s)\n" msgstr "Typ diskového oddílu %d byl změněn na %x (%s)\n" -#: fdisk/fdisk.c:1721 +#: fdisk/fdisk.c:1766 #, c-format msgid "System type of partition %d is unchanged: %x (%s)\n" msgstr "Typ diskového oddílu %d je nezměněn: %x (%s)\n" -#: fdisk/fdisk.c:1773 +#: fdisk/fdisk.c:1821 #, c-format msgid "Partition %d has different physical/logical beginnings (non-Linux?):\n" -msgstr "" -"Diskový oddíl %d má rozdílný fyzický a logický začátek (nelinuxový?):\n" +msgstr "Diskový oddíl %d má rozdílný fyzický a logický začátek (nelinuxový?):\n" -#: fdisk/fdisk.c:1775 fdisk/fdisk.c:1783 fdisk/fdisk.c:1792 fdisk/fdisk.c:1802 +#: fdisk/fdisk.c:1823 fdisk/fdisk.c:1831 fdisk/fdisk.c:1840 fdisk/fdisk.c:1850 #, c-format msgid " phys=(%d, %d, %d) " msgstr " fyz=(%d, %d, %d) " -#: fdisk/fdisk.c:1776 fdisk/fdisk.c:1784 +#: fdisk/fdisk.c:1824 fdisk/fdisk.c:1832 #, c-format msgid "logical=(%d, %d, %d)\n" msgstr "logický=(%d, %d, %d)\n" -#: fdisk/fdisk.c:1781 +#: fdisk/fdisk.c:1829 #, c-format msgid "Partition %d has different physical/logical endings:\n" msgstr "Diskový oddíl %d má rozdílný fyzický a logický konec:\n" -#: fdisk/fdisk.c:1790 +#: fdisk/fdisk.c:1838 #, c-format msgid "Partition %i does not start on cylinder boundary:\n" msgstr "Diskový oddíl %i nezačíná na hranici cylindru:\n" -#: fdisk/fdisk.c:1793 +#: fdisk/fdisk.c:1841 #, c-format msgid "should be (%d, %d, 1)\n" msgstr "mělo by být (%d, %d, 1)\n" -#: fdisk/fdisk.c:1799 +#: fdisk/fdisk.c:1847 #, c-format msgid "Partition %i does not end on cylinder boundary.\n" msgstr "Diskový oddíl %i nekončí na hranici cylindru.\n" -#: fdisk/fdisk.c:1803 +#: fdisk/fdisk.c:1851 #, c-format msgid "should be (%d, %d, %d)\n" msgstr "mělo by být (%d, %d, %d)\n" -#: fdisk/fdisk.c:1813 +#: fdisk/fdisk.c:1861 #, c-format -msgid "Partition %i does not start on physical block boundary.\n" -msgstr "Oddíl %i nezačíná na hranici fyzického bloku.\n" +msgid "Partition %i does not start on physical sector boundary.\n" +msgstr "Oddíl %i nezačíná na hranici fyzického sektoru.\n" -#: fdisk/fdisk.c:1823 +#: fdisk/fdisk.c:1871 #, c-format msgid "" "\n" @@ -3461,7 +3383,7 @@ msgstr "" "\n" "Disk %s: %'ld MB, %'lld bajtů\n" -#: fdisk/fdisk.c:1827 +#: fdisk/fdisk.c:1875 #, c-format msgid "" "\n" @@ -3470,32 +3392,37 @@ msgstr "" "\n" "Disk %s: %'ld,%ld GB, %'lld bajtů\n" -#: fdisk/fdisk.c:1830 +#: fdisk/fdisk.c:1878 #, c-format msgid "%d heads, %llu sectors/track, %d cylinders" msgstr "hlav: %'d, sektorů na stopu: %'llu, cylindrů: %'d" -#: fdisk/fdisk.c:1833 +#: fdisk/fdisk.c:1881 #, c-format msgid ", total %llu sectors" msgstr ", celkem %'llu sektorů" -#: fdisk/fdisk.c:1836 +#: fdisk/fdisk.c:1884 #, c-format msgid "Units = %s of %d * %d = %d bytes\n" msgstr "Jednotky = %s po %d * %d = %'d bajtech\n" -#: fdisk/fdisk.c:1840 +#: fdisk/fdisk.c:1888 #, c-format msgid "Sector size (logical/physical): %u bytes / %lu bytes\n" msgstr "Velikost sektoru (logického/fyzického): %u bajtů / %lu bajtů\n" -#: fdisk/fdisk.c:1843 +#: fdisk/fdisk.c:1890 +#, c-format +msgid "I/O size (minimum/optimal): %lu bytes / %lu bytes\n" +msgstr "Velikost I/O (minimální/optimální): %lu bajtů / %lu bajtů\n" + +#: fdisk/fdisk.c:1893 #, c-format msgid "Alignment offset: %lu bytes\n" msgstr "Zarovnávací posun: %lu bajtů\n" -#: fdisk/fdisk.c:1952 +#: fdisk/fdisk.c:2002 #, c-format msgid "" "Nothing to do. Ordering is correct already.\n" @@ -3504,12 +3431,12 @@ msgstr "" "Diskové oddíly jsou již seřazeny.\n" "\n" -#: fdisk/fdisk.c:1980 +#: fdisk/fdisk.c:2030 #, c-format msgid "Done.\n" msgstr "Hotovo.\n" -#: fdisk/fdisk.c:2008 +#: fdisk/fdisk.c:2058 #, c-format msgid "" "This doesn't look like a partition table\n" @@ -3519,16 +3446,16 @@ msgstr "" "Toto nevypadá jako tabulka rozdělení disku.\n" "Pravděpodobně jste zvolili špatné zařízení.\n" -#: fdisk/fdisk.c:2021 +#: fdisk/fdisk.c:2071 #, c-format msgid "%*s Boot Start End Blocks Id System\n" msgstr "%*s Zavádět Začátek Konec Bloky Id Systém\n" -#: fdisk/fdisk.c:2022 fdisk/fdisksgilabel.c:210 fdisk/fdisksunlabel.c:603 +#: fdisk/fdisk.c:2072 fdisk/fdisksgilabel.c:210 fdisk/fdisksunlabel.c:598 msgid "Device" msgstr "Zařízení" -#: fdisk/fdisk.c:2060 +#: fdisk/fdisk.c:2110 #, c-format msgid "" "\n" @@ -3537,7 +3464,7 @@ msgstr "" "\n" "Diskové oddíly jsou chybně seřazeny\n" -#: fdisk/fdisk.c:2070 +#: fdisk/fdisk.c:2120 #, c-format msgid "" "\n" @@ -3548,89 +3475,89 @@ msgstr "" "Disk %s: hlav: %'d, sektorů: %'llu, cylindrů: %'d\n" "\n" -#: fdisk/fdisk.c:2072 +#: fdisk/fdisk.c:2122 #, c-format msgid "Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n" msgstr "Č. AF Hd Sek Cyl Hd Sek Cyl Začátek Vel. Id\n" -#: fdisk/fdisk.c:2120 +#: fdisk/fdisk.c:2170 #, c-format msgid "Warning: partition %d contains sector 0\n" msgstr "Varování: diskový oddíl %d obsahuje sektor 0\n" -#: fdisk/fdisk.c:2123 +#: fdisk/fdisk.c:2173 #, c-format msgid "Partition %d: head %d greater than maximum %d\n" msgstr "Diskový oddíl %d: hlava %d má větší číslo než je maximum %d\n" -#: fdisk/fdisk.c:2126 +#: fdisk/fdisk.c:2176 #, c-format msgid "Partition %d: sector %d greater than maximum %llu\n" msgstr "Diskový oddíl %d: sektor %d má větší číslo než je maximum %llu\n" -#: fdisk/fdisk.c:2129 +#: fdisk/fdisk.c:2179 #, c-format msgid "Partitions %d: cylinder %d greater than maximum %d\n" msgstr "Diskový oddíl %d: cylindr %d má větší číslo než je maximum %d\n" -#: fdisk/fdisk.c:2133 +#: fdisk/fdisk.c:2183 #, c-format msgid "Partition %d: previous sectors %d disagrees with total %d\n" msgstr "Diskový oddíl %d: předchozí sektory %d nesouhlasí s úhrnem %d\n" -#: fdisk/fdisk.c:2167 +#: fdisk/fdisk.c:2217 #, c-format msgid "Warning: bad start-of-data in partition %d\n" msgstr "Varování: chybný počátek dat v diskovém oddílu %d\n" -#: fdisk/fdisk.c:2175 +#: fdisk/fdisk.c:2225 #, c-format msgid "Warning: partition %d overlaps partition %d.\n" msgstr "Varování: diskový oddíl %d přesahuje do diskového oddílu %d.\n" -#: fdisk/fdisk.c:2195 +#: fdisk/fdisk.c:2245 #, c-format msgid "Warning: partition %d is empty\n" msgstr "Varování: diskový oddíl %d je prázdný.\n" -#: fdisk/fdisk.c:2200 +#: fdisk/fdisk.c:2250 #, c-format msgid "Logical partition %d not entirely in partition %d\n" msgstr "Logický diskový oddíl %d přesahuje mimo diskový oddíl %d.\n" -#: fdisk/fdisk.c:2206 +#: fdisk/fdisk.c:2256 #, c-format msgid "Total allocated sectors %llu greater than the maximum %llu\n" msgstr "Celkový počet alokovaných sektorů %'llu je větší než maximum %'llu.\n" -#: fdisk/fdisk.c:2209 +#: fdisk/fdisk.c:2259 #, c-format msgid "Remaining %lld unallocated %d-byte sectors\n" msgstr "Zbývá %'lld nealokovaných %dbajtových sektorů\n" -#: fdisk/fdisk.c:2245 fdisk/fdisksgilabel.c:620 fdisk/fdisksunlabel.c:416 +#: fdisk/fdisk.c:2295 fdisk/fdisksgilabel.c:620 fdisk/fdisksunlabel.c:411 #, c-format msgid "Partition %d is already defined. Delete it before re-adding it.\n" msgstr "" "Diskový oddíl %d je již definován. Před opětovným vytvořením jej musíte\n" "nejprve smazat.\n" -#: fdisk/fdisk.c:2291 +#: fdisk/fdisk.c:2340 #, c-format msgid "Sector %llu is already allocated\n" msgstr "Sektor %llu je již alokován\n" -#: fdisk/fdisk.c:2327 +#: fdisk/fdisk.c:2376 #, c-format msgid "No free sectors available\n" msgstr "Nejsou žádné volné sektory.\n" -#: fdisk/fdisk.c:2338 +#: fdisk/fdisk.c:2387 #, c-format msgid "Last %1$s, +%2$s or +size{K,M,G}" msgstr "Poslední %1$s, +%2$s nebo +velikost{K,M,G}" -#: fdisk/fdisk.c:2415 +#: fdisk/fdisk.c:2464 #, c-format msgid "" "\tSorry - this fdisk cannot handle AIX disk labels.\n" @@ -3643,7 +3570,7 @@ msgstr "" "\t novu prázdnou DOSOVOU tabulku rozdělení disku (příkaz „o“).\n" "\tVAROVÁNÍ: Tímto přijdete o současný obsah disku.\n" -#: fdisk/fdisk.c:2424 +#: fdisk/fdisk.c:2473 #, c-format msgid "" "\tSorry - this fdisk cannot handle Mac disk labels.\n" @@ -3656,22 +3583,22 @@ msgstr "" "\t novu prázdnou DOSOVOU tabulku rozdělení disku (příkaz „o“).\n" "\tVAROVÁNÍ: Tímto přijdete o současný obsah disku.\n" -#: fdisk/fdisk.c:2444 +#: fdisk/fdisk.c:2493 #, c-format msgid "You must delete some partition and add an extended partition first\n" msgstr "Musíte nejprve některé smazat a přidat rozšířený diskový oddíl.\n" -#: fdisk/fdisk.c:2447 +#: fdisk/fdisk.c:2496 #, c-format msgid "All logical partitions are in use\n" msgstr "Všechny logické oddíly jsou obsazeny\n" -#: fdisk/fdisk.c:2448 +#: fdisk/fdisk.c:2497 #, c-format msgid "Adding a primary partition\n" msgstr "Přidávám primární diskový oddíl\n" -#: fdisk/fdisk.c:2453 +#: fdisk/fdisk.c:2502 #, c-format msgid "" "Command action\n" @@ -3682,32 +3609,32 @@ msgstr "" " %s\n" " p primární diskový oddíl (1-4)\n" -#: fdisk/fdisk.c:2455 +#: fdisk/fdisk.c:2504 msgid "l logical (5 or over)" msgstr "l logický diskový oddíl (5 nebo více)" -#: fdisk/fdisk.c:2455 +#: fdisk/fdisk.c:2504 msgid "e extended" msgstr "e rozšířený diskový oddíl" -#: fdisk/fdisk.c:2474 +#: fdisk/fdisk.c:2523 #, c-format msgid "Invalid partition number for type `%c'\n" msgstr "Chybné číslo diskového oddílu pro typ „%c“.\n" -#: fdisk/fdisk.c:2510 +#: fdisk/fdisk.c:2559 #, c-format msgid "" "The partition table has been altered!\n" "\n" msgstr "Tabulka rozdělení disku byla změněna!\n" -#: fdisk/fdisk.c:2523 +#: fdisk/fdisk.c:2572 #, c-format msgid "Calling ioctl() to re-read partition table.\n" msgstr "Volám ioctl() pro znovunačtení tabulky rozdělení disku.\n" -#: fdisk/fdisk.c:2532 +#: fdisk/fdisk.c:2581 #, c-format msgid "" "\n" @@ -3720,7 +3647,7 @@ msgstr "" "Jádro stále používá starou tabulku. Nová tabulka se použije až po příštím\n" "restartu nebo po té, co spustíte partprobe(8) nebo kpartx(8).\n" -#: fdisk/fdisk.c:2540 +#: fdisk/fdisk.c:2589 #, c-format msgid "" "\n" @@ -3733,7 +3660,7 @@ msgstr "" "DOS 6.x diskové oddíly, přečtěte si prosím manuálovou\n" "stránku programu fdisk, abyste získal dodatečné informace.\n" -#: fdisk/fdisk.c:2546 +#: fdisk/fdisk.c:2595 #, c-format msgid "" "\n" @@ -3742,100 +3669,94 @@ msgstr "" "\n" "Chyba při zavírání souboru\n" -#: fdisk/fdisk.c:2550 +#: fdisk/fdisk.c:2599 #, c-format msgid "Syncing disks.\n" msgstr "Synchronizují se disky.\n" -#: fdisk/fdisk.c:2596 +#: fdisk/fdisk.c:2645 #, c-format msgid "Partition %d has no data area\n" msgstr "Diskový oddíl %d neobsahuje datovou oblast.\n" -#: fdisk/fdisk.c:2601 +#: fdisk/fdisk.c:2650 msgid "New beginning of data" msgstr "Nový začátek dat" -#: fdisk/fdisk.c:2617 +#: fdisk/fdisk.c:2666 msgid "Expert command (m for help): " msgstr "Příkaz pro odborníky (m pro nápovědu): " -#: fdisk/fdisk.c:2630 +#: fdisk/fdisk.c:2679 msgid "Number of cylinders" msgstr "Počet cylindrů" -#: fdisk/fdisk.c:2657 +#: fdisk/fdisk.c:2704 msgid "Number of heads" msgstr "Počet hlav" -#: fdisk/fdisk.c:2684 +#: fdisk/fdisk.c:2731 msgid "Number of sectors" msgstr "Počet sektorů" -#: fdisk/fdisk.c:2686 +#: fdisk/fdisk.c:2733 #, c-format msgid "Warning: setting sector offset for DOS compatiblity\n" msgstr "Varování: nastaven posun sektoru kvůli kompatibilitě s DOSEM\n" -#: fdisk/fdisk.c:2745 +#: fdisk/fdisk.c:2792 #, c-format msgid "" "\n" -"WARNING: GPT (GUID Partition Table) detected on '%s'! The util fdisk doesn't " -"support GPT. Use GNU Parted.\n" +"WARNING: GPT (GUID Partition Table) detected on '%s'! The util fdisk doesn't support GPT. Use GNU Parted.\n" "\n" msgstr "" "\n" -"VAROVÁNÍ: Na „%s“ nalezena GPT (GUID tabulka rozdělení disku)! Nástroj fdisk " -"nepodporuje GPT. Použijte GNU Parted.\n" +"VAROVÁNÍ: Na „%s“ nalezena GPT (GUID tabulka rozdělení disku)! Nástroj fdisk nepodporuje GPT. Použijte GNU Parted.\n" "\n" -#: fdisk/fdisk.c:2767 +#: fdisk/fdisk.c:2814 #, c-format msgid "Disk %s doesn't contain a valid partition table\n" msgstr "Na disku %s není korektní tabulka rozdělení disku.\n" -#: fdisk/fdisk.c:2778 +#: fdisk/fdisk.c:2825 #, c-format msgid "Cannot open %s\n" msgstr "%s nelze otevřít.\n" -#: fdisk/fdisk.c:2797 fdisk/sfdisk.c:2603 +#: fdisk/fdisk.c:2844 fdisk/sfdisk.c:2603 #, c-format msgid "cannot open %s\n" msgstr "%s nelze otevřít.\n" -#: fdisk/fdisk.c:2817 +#: fdisk/fdisk.c:2864 #, c-format msgid "%c: unknown command\n" msgstr "příkaz %c není znám\n" -#: fdisk/fdisk.c:2887 +#: fdisk/fdisk.c:2930 #, c-format msgid "This kernel finds the sector size itself - -b option ignored\n" -msgstr "" -"Toto jádro detekuje velikost sektoru automaticky - přepínač -b ignorován\n" +msgstr "Toto jádro detekuje velikost sektoru automaticky - přepínač -b ignorován\n" -#: fdisk/fdisk.c:2891 +#: fdisk/fdisk.c:2934 #, c-format -msgid "" -"Warning: the -b (set sector size) option should be used with one specified " -"device\n" +msgid "Warning: the -b (set sector size) option should be used with one specified device\n" msgstr "" -"Varování: přepínač -b (nastavení velikosti sektoru) by měl být použit s " -"jedním\n" +"Varování: přepínač -b (nastavení velikosti sektoru) by měl být použit s jedním\n" " zadaným zařízením.\n" -#: fdisk/fdisk.c:2953 +#: fdisk/fdisk.c:2994 #, c-format msgid "Detected an OSF/1 disklabel on %s, entering disklabel mode.\n" msgstr "Na %s nalezen OSF/1 popis disku. Spouštím režim popisu disku.\n" -#: fdisk/fdisk.c:2963 +#: fdisk/fdisk.c:3004 msgid "Command (m for help): " msgstr "Příkaz (m pro nápovědu): " -#: fdisk/fdisk.c:2979 +#: fdisk/fdisk.c:3020 #, c-format msgid "" "\n" @@ -3844,16 +3765,16 @@ msgstr "" "\n" "Aktuální startovací soubor: %s\n" -#: fdisk/fdisk.c:2981 +#: fdisk/fdisk.c:3022 msgid "Please enter the name of the new boot file: " msgstr "Zadejte název nového startovacího souboru: " -#: fdisk/fdisk.c:2983 +#: fdisk/fdisk.c:3024 #, c-format msgid "Boot file unchanged\n" msgstr "Startovací soubor nebyl změněn.\n" -#: fdisk/fdisk.c:3056 +#: fdisk/fdisk.c:3097 #, c-format msgid "" "\n" @@ -3943,15 +3864,15 @@ msgstr "SGI xlv" msgid "SGI xvm" msgstr "SGI xvm" -#: fdisk/fdisksgilabel.c:95 fdisk/fdisksunlabel.c:55 +#: fdisk/fdisksgilabel.c:95 fdisk/fdisksunlabel.c:50 msgid "Linux swap" msgstr "Linux swap" -#: fdisk/fdisksgilabel.c:96 fdisk/fdisksunlabel.c:56 +#: fdisk/fdisksgilabel.c:96 fdisk/fdisksunlabel.c:51 msgid "Linux native" msgstr "Linux nativní" -#: fdisk/fdisksgilabel.c:97 fdisk/fdisksunlabel.c:57 fdisk/i386_sys_types.c:63 +#: fdisk/fdisksgilabel.c:97 fdisk/fdisksunlabel.c:52 fdisk/i386_sys_types.c:63 msgid "Linux LVM" msgstr "Linux LVM" @@ -3961,11 +3882,8 @@ msgstr "Linux RAID" #: fdisk/fdisksgilabel.c:151 #, c-format -msgid "" -"According to MIPS Computer Systems, Inc the Label must not contain more than " -"512 bytes\n" -msgstr "" -"Popis nesmí podle MIPS Computer Systems, Inc obsahovat více než 512 bajtů\n" +msgid "According to MIPS Computer Systems, Inc the Label must not contain more than 512 bytes\n" +msgstr "Popis nesmí podle MIPS Computer Systems, Inc obsahovat více než 512 bajtů\n" #: fdisk/fdisksgilabel.c:170 #, c-format @@ -4086,7 +4004,7 @@ msgstr "" msgid "More than one entire disk entry present.\n" msgstr "Existuje více než jedna položka celého disku.\n" -#: fdisk/fdisksgilabel.c:433 fdisk/fdisksunlabel.c:388 +#: fdisk/fdisksgilabel.c:433 fdisk/fdisksunlabel.c:383 #, c-format msgid "No partitions defined\n" msgstr "Nejsou definovány žádné diskové oddíly\n" @@ -4187,10 +4105,9 @@ msgstr "" "Doporučuje se, aby diskový oddíl začínající na pozici 0 byl typu\n" "„SGI volhdr“. IRIX jej používá k přístupu k nástrojům jako je sash\n" "a fx. Výjimkou je pouze „SGI svazek“ zaujímající celý disk.\n" -"Zadejte ANO, pokud jste si jist, že chcete označit tento diskový oddíl " -"jinak.\n" +"Zadejte ANO, pokud jste si jist, že chcete označit tento diskový oddíl jinak.\n" -#: fdisk/fdisksgilabel.c:543 fdisk/fdisksunlabel.c:554 +#: fdisk/fdisksgilabel.c:543 fdisk/fdisksunlabel.c:549 msgid "YES\n" msgstr "ANO\n" @@ -4226,8 +4143,7 @@ msgstr "" #: fdisk/fdisksgilabel.c:660 #, c-format msgid "You will get a partition overlap on the disk. Fix it first!\n" -msgstr "" -"Takto se diskové oddíly budou navzájem překrývat. Nejprve to opravte!\n" +msgstr "Takto se diskové oddíly budou navzájem překrývat. Nejprve to opravte!\n" #: fdisk/fdisksgilabel.c:665 #, c-format @@ -4247,11 +4163,10 @@ msgstr "" "pochopitelně dostupná.\n" "\n" -#: fdisk/fdisksgilabel.c:718 fdisk/fdisksunlabel.c:227 +#: fdisk/fdisksgilabel.c:718 fdisk/fdisksunlabel.c:222 #, c-format msgid "" -"Warning: BLKGETSIZE ioctl failed on %s. Using geometry cylinder value of %" -"d.\n" +"Warning: BLKGETSIZE ioctl failed on %s. Using geometry cylinder value of %d.\n" "This value may be truncated for devices > 33.8 GB.\n" msgstr "" "Varování: ioctl BLKGETSIZE selhalo na %s. Pro geometrii používám počet\n" @@ -4268,55 +4183,55 @@ msgstr "Pokouším se zachovat parametry diskového oddílu %d.\n" msgid "ID=%02x\tSTART=%d\tLENGTH=%d\n" msgstr "ID=%02x\tZAČÁTEK=%d\tDÉLKA=%d\n" -#: fdisk/fdisksunlabel.c:43 +#: fdisk/fdisksunlabel.c:38 msgid "Unassigned" msgstr "Nepřiřazeno" -#: fdisk/fdisksunlabel.c:45 +#: fdisk/fdisksunlabel.c:40 msgid "SunOS root" msgstr "SunOS root" -#: fdisk/fdisksunlabel.c:46 +#: fdisk/fdisksunlabel.c:41 msgid "SunOS swap" msgstr "SunOS swap" -#: fdisk/fdisksunlabel.c:47 +#: fdisk/fdisksunlabel.c:42 msgid "SunOS usr" msgstr "SunOS usr" -#: fdisk/fdisksunlabel.c:48 +#: fdisk/fdisksunlabel.c:43 msgid "Whole disk" msgstr "Celý disk" -#: fdisk/fdisksunlabel.c:49 +#: fdisk/fdisksunlabel.c:44 msgid "SunOS stand" msgstr "SunOS stand" -#: fdisk/fdisksunlabel.c:50 +#: fdisk/fdisksunlabel.c:45 msgid "SunOS var" msgstr "SunOS var" -#: fdisk/fdisksunlabel.c:51 +#: fdisk/fdisksunlabel.c:46 msgid "SunOS home" msgstr "SunOS home" -#: fdisk/fdisksunlabel.c:52 +#: fdisk/fdisksunlabel.c:47 msgid "SunOS alt sectors" msgstr "Náhr. sektory SunOS" -#: fdisk/fdisksunlabel.c:53 +#: fdisk/fdisksunlabel.c:48 msgid "SunOS cachefs" msgstr "SunOS cachefs" -#: fdisk/fdisksunlabel.c:54 +#: fdisk/fdisksunlabel.c:49 msgid "SunOS reserved" msgstr "Vyhrazeno pro SunOS" -#: fdisk/fdisksunlabel.c:58 fdisk/i386_sys_types.c:103 +#: fdisk/fdisksunlabel.c:53 fdisk/i386_sys_types.c:103 msgid "Linux raid autodetect" msgstr "Linux RAID samorozpoznatelný" -#: fdisk/fdisksunlabel.c:141 +#: fdisk/fdisksunlabel.c:136 #, c-format msgid "" "Detected sun disklabel with wrong checksum.\n" @@ -4329,30 +4244,27 @@ msgstr "" "cylindry a diskové oddíly, nebo vytvořit novou tabulku (příkaz s v hlavní\n" "nabídce)\n" -#: fdisk/fdisksunlabel.c:153 +#: fdisk/fdisksunlabel.c:148 #, c-format msgid "Detected sun disklabel with wrong version [0x%08x].\n" msgstr "Nalezl jsem sunovský popis disku s chybnou verzí [0x%08x].\n" -#: fdisk/fdisksunlabel.c:158 +#: fdisk/fdisksunlabel.c:153 #, c-format msgid "Detected sun disklabel with wrong sanity [0x%08x].\n" msgstr "Nalezl jsem sunovský popis disku s chybným „sanity“ [0x%08x].\n" -#: fdisk/fdisksunlabel.c:163 +#: fdisk/fdisksunlabel.c:158 #, c-format msgid "Detected sun disklabel with wrong num_partitions [%u].\n" msgstr "Nalezl jsem sunovský popis disku s chybným počtem_oddílů [%u].\n" -#: fdisk/fdisksunlabel.c:168 +#: fdisk/fdisksunlabel.c:163 #, c-format -msgid "" -"Warning: Wrong values need to be fixed up and will be corrected by w(rite)\n" -msgstr "" -"Varování: Chybné hodnoty musí být opraveny a bude tak učiněno při zápisu " -"(w)\n" +msgid "Warning: Wrong values need to be fixed up and will be corrected by w(rite)\n" +msgstr "Varování: Chybné hodnoty musí být opraveny a bude tak učiněno při zápisu (w)\n" -#: fdisk/fdisksunlabel.c:198 +#: fdisk/fdisksunlabel.c:193 #, c-format msgid "" "Building a new sun disklabel. Changes will remain in memory only,\n" @@ -4364,31 +4276,31 @@ msgstr "" "do paměti, dokud se nerozhodnete je uložit na disk. Poté již nebudou stará\n" "data pochopitelně dostupná.\n" -#: fdisk/fdisksunlabel.c:236 +#: fdisk/fdisksunlabel.c:231 msgid "Sectors/track" msgstr "Sektorů/stopu" -#: fdisk/fdisksunlabel.c:351 +#: fdisk/fdisksunlabel.c:346 #, c-format msgid "Partition %d doesn't end on cylinder boundary\n" msgstr "Diskový oddíl %d nekončí na hranici cylindru.\n" -#: fdisk/fdisksunlabel.c:371 +#: fdisk/fdisksunlabel.c:366 #, c-format msgid "Partition %d overlaps with others in sectors %d-%d\n" msgstr "Diskový oddíl %d přesahuje do jiných v sektorech %d-%d\n" -#: fdisk/fdisksunlabel.c:393 +#: fdisk/fdisksunlabel.c:388 #, c-format msgid "Unused gap - sectors 0-%d\n" msgstr "Nevyužívaný prostor - sektory 0-%d\n" -#: fdisk/fdisksunlabel.c:395 fdisk/fdisksunlabel.c:401 +#: fdisk/fdisksunlabel.c:390 fdisk/fdisksunlabel.c:396 #, c-format msgid "Unused gap - sectors %d-%d\n" msgstr "Nevyužívaný prostor - sektory %d-%d\n" -#: fdisk/fdisksunlabel.c:426 +#: fdisk/fdisksunlabel.c:421 #, c-format msgid "" "Other partitions already cover the whole disk.\n" @@ -4397,7 +4309,7 @@ msgstr "" "Jiné diskové oddíly již zaujímá celý disk.\n" "Smažte/zmenšete nějaké a zkuste to znovu.\n" -#: fdisk/fdisksunlabel.c:449 +#: fdisk/fdisksunlabel.c:444 #, c-format msgid "" "It is highly recommended that the third partition covers the whole disk\n" @@ -4406,12 +4318,12 @@ msgstr "" "Velmi se doporučuje, aby třetí oddíl zaujímal celý prostor disku\n" "a byl typu „Celý disk“\n" -#: fdisk/fdisksunlabel.c:477 +#: fdisk/fdisksunlabel.c:472 #, c-format msgid "Sector %d is already allocated\n" msgstr "Sektor %d je již alokován\n" -#: fdisk/fdisksunlabel.c:507 +#: fdisk/fdisksunlabel.c:502 #, c-format msgid "" "You haven't covered the whole disk with the 3rd partition, but your value\n" @@ -4421,7 +4333,7 @@ msgstr "" "Třetí diskový oddíl nezabírá celý disk, ale vaše hodnota %d %s\n" "zaujímá jiné diskové oddíly. Vaše položka byla změněna na %d %s.\n" -#: fdisk/fdisksunlabel.c:534 +#: fdisk/fdisksunlabel.c:529 #, c-format msgid "" "If you want to maintain SunOS/Solaris compatibility, consider leaving this\n" @@ -4431,7 +4343,7 @@ msgstr "" "tohoto diskového oddílu jako Celého disku (5), začínajícího na 0 o délce\n" "v sektorech %u\n" -#: fdisk/fdisksunlabel.c:549 +#: fdisk/fdisksunlabel.c:544 msgid "" "It is highly recommended that the partition at offset 0\n" "is UFS, EXT2FS filesystem or SunOS swap. Putting Linux swap\n" @@ -4445,7 +4357,7 @@ msgstr "" "Zadejte YES, pokud jste si jist, že chcete tento diskový oddíl označit 82\n" "(odkládací prostor pro Linux): " -#: fdisk/fdisksunlabel.c:581 +#: fdisk/fdisksunlabel.c:576 #, c-format msgid "" "\n" @@ -4466,7 +4378,7 @@ msgstr "" "Jednotky = %s po %d * 512 bajtech\n" "\n" -#: fdisk/fdisksunlabel.c:597 +#: fdisk/fdisksunlabel.c:592 #, c-format msgid "" "\n" @@ -4480,28 +4392,28 @@ msgstr "" "Jednotky = %s po %d * 512 bajtech\n" "\n" -#: fdisk/fdisksunlabel.c:602 +#: fdisk/fdisksunlabel.c:597 #, c-format msgid "%*s Flag Start End Blocks Id System\n" msgstr "%*s Příznak Začátek Konec Bloky Id Systém\n" -#: fdisk/fdisksunlabel.c:630 +#: fdisk/fdisksunlabel.c:625 msgid "Number of alternate cylinders" msgstr "Počet alternativních cylindrů" -#: fdisk/fdisksunlabel.c:642 +#: fdisk/fdisksunlabel.c:637 msgid "Extra sectors per cylinder" msgstr "Extra sektory na cylindr" -#: fdisk/fdisksunlabel.c:649 +#: fdisk/fdisksunlabel.c:644 msgid "Interleave factor" msgstr "Interleave faktor" -#: fdisk/fdisksunlabel.c:656 +#: fdisk/fdisksunlabel.c:651 msgid "Rotation speed (rpm)" msgstr "Rychlost otáčení (otm)" -#: fdisk/fdisksunlabel.c:663 +#: fdisk/fdisksunlabel.c:658 msgid "Number of physical cylinders" msgstr "Počet fyzických cylindrů" @@ -4874,8 +4786,7 @@ msgstr "chyba posunu ukazovátka na %s - ukazovátko nelze posunout na %lu\n" #: fdisk/sfdisk.c:169 #, c-format msgid "seek error: wanted 0x%08x%08x, got 0x%08x%08x\n" -msgstr "" -"chyba při posunu ukazovátka: požadavek 0x%08x%08x, výsledek 0x%08x%08x\n" +msgstr "chyba při posunu ukazovátka: požadavek 0x%08x%08x, výsledek 0x%08x%08x\n" #: fdisk/sfdisk.c:215 msgid "out of memory - giving up\n" @@ -4995,25 +4906,18 @@ msgstr "" #: fdisk/sfdisk.c:595 #, c-format -msgid "" -"%s of partition %s has impossible value for head: %lu (should be in 0-%lu)\n" +msgid "%s of partition %s has impossible value for head: %lu (should be in 0-%lu)\n" msgstr "%s diskového oddílu %s má chybný počet hlav: %lu (mělo by být 0-%lu)\n" #: fdisk/sfdisk.c:600 #, c-format -msgid "" -"%s of partition %s has impossible value for sector: %lu (should be in 1-%" -"lu)\n" -msgstr "" -"%s diskového oddílu %s má chybný počet sektorů: %lu (mělo by být 1-%lu)\n" +msgid "%s of partition %s has impossible value for sector: %lu (should be in 1-%lu)\n" +msgstr "%s diskového oddílu %s má chybný počet sektorů: %lu (mělo by být 1-%lu)\n" #: fdisk/sfdisk.c:605 #, c-format -msgid "" -"%s of partition %s has impossible value for cylinders: %lu (should be in 0-%" -"lu)\n" -msgstr "" -"%s diskového oddílu %s má chybný počet cylindrů: %lu (mělo by být 0-%lu)\n" +msgid "%s of partition %s has impossible value for cylinders: %lu (should be in 0-%lu)\n" +msgstr "%s diskového oddílu %s má chybný počet cylindrů: %lu (mělo by být 0-%lu)\n" #: fdisk/sfdisk.c:645 #, c-format @@ -5104,8 +5008,7 @@ msgid "" "Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from %d\n" "\n" msgstr "" -"Jednotky = mebibajty po 1048576 bajtech, bloky po 1024 bajtech, počítáno od %" -"d\n" +"Jednotky = mebibajty po 1048576 bajtech, bloky po 1024 bajtech, počítáno od %d\n" "\n" #: fdisk/sfdisk.c:953 @@ -5155,8 +5058,7 @@ msgstr "Zvláštní - počet definovaných diskových oddílů je pouze %d.\n" #: fdisk/sfdisk.c:1197 #, c-format msgid "Warning: partition %s has size 0 but is not marked Empty\n" -msgstr "" -"Varování: diskový oddíl %s má velikost 0 a není označen jako prázdný.\n" +msgstr "Varování: diskový oddíl %s má velikost 0 a není označen jako prázdný.\n" #: fdisk/sfdisk.c:1200 #, c-format @@ -5194,8 +5096,7 @@ msgid "" "Warning: partition %s contains part of the partition table (sector %lu),\n" "and will destroy it when filled\n" msgstr "" -"Varování: diskový oddíl %s obsahuje část tabulky rozdělení disku (sektor %" -"lu)\n" +"Varování: diskový oddíl %s obsahuje část tabulky rozdělení disku (sektor %lu)\n" "a v případě zaplnění ji zničí\n" #: fdisk/sfdisk.c:1250 @@ -5256,8 +5157,7 @@ msgstr "začátek" #: fdisk/sfdisk.c:1341 #, c-format -msgid "" -"partition %s: start: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n" +msgid "partition %s: start: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n" msgstr "" "diskový oddíl %s: začátek: (c,h,s) předpoklad (%ld,%ld,%ld), nalezeno\n" "(%ld,%ld,%ld)\n" @@ -5388,9 +5288,7 @@ msgstr "Chybný typ\n" #: fdisk/sfdisk.c:2102 #, c-format msgid "Warning: given size (%lu) exceeds max allowable size (%lu)\n" -msgstr "" -"Varování: zadaná velikost(%lu) překračuje maximální povolenou velikost (%" -"lu)\n" +msgstr "Varování: zadaná velikost(%lu) překračuje maximální povolenou velikost (%lu)\n" #: fdisk/sfdisk.c:2108 msgid "Warning: empty partition\n" @@ -5427,8 +5325,7 @@ msgid "" " \n" "Usually you only need to specify and (and perhaps ).\n" msgstr "" -"Vstup v následujícím formátu; chybějící položky budou nahrazeny " -"implicitními\n" +"Vstup v následujícím formátu; chybějící položky budou nahrazeny implicitními\n" "hodnotami.\n" " \n" "Obvykle je třeba zadat pouze a (a možná ).\n" @@ -5460,19 +5357,15 @@ msgstr " -l [či --list]: ke každému zařízení vypíše diskové odd #: fdisk/sfdisk.c:2295 msgid " -d [or --dump]: idem, but in a format suitable for later input" -msgstr "" -" -d [či --dump]: taktéž, ale ve formátu vhodném k dalšímu zpracování" +msgstr " -d [či --dump]: taktéž, ale ve formátu vhodném k dalšímu zpracování" #: fdisk/sfdisk.c:2296 msgid " -i [or --increment]: number cylinders etc. from 1 instead of from 0" msgstr " -i [či --increment]: čísluje cylindry etc. od 1 místo od 0" #: fdisk/sfdisk.c:2297 -msgid "" -" -uS, -uB, -uC, -uM: accept/report in units of sectors/blocks/cylinders/" -"MB" -msgstr "" -" -uS, -uB, -uC, -uM: jako jednotky použije Sektory/Bloky/Cylindry či MB" +msgid " -uS, -uB, -uC, -uM: accept/report in units of sectors/blocks/cylinders/MB" +msgstr " -uS, -uB, -uC, -uM: jako jednotky použije Sektory/Bloky/Cylindry či MB" #: fdisk/sfdisk.c:2298 msgid " -T [or --list-types]:list the known partition types" @@ -5484,8 +5377,7 @@ msgstr " -D [či --DOS]: pro kompatibilitu s DOSEM: ubírá trochu mís #: fdisk/sfdisk.c:2300 msgid " -R [or --re-read]: make kernel reread partition table" -msgstr "" -" -R [či --re-read]: donutí jádro znovu načíst tabulku rozdělení disku" +msgstr " -R [či --re-read]: donutí jádro znovu načíst tabulku rozdělení disku" #: fdisk/sfdisk.c:2301 msgid " -N# : change only the partition with number #" @@ -5496,8 +5388,7 @@ msgid " -n : do not actually write to disk" msgstr " -n : žádné změny nebudou uloženy na disk" #: fdisk/sfdisk.c:2303 -msgid "" -" -O file : save the sectors that will be overwritten to file" +msgid " -O file : save the sectors that will be overwritten to file" msgstr " -O SOUBOR : uloží změněné sektory do SOUBORU" #: fdisk/sfdisk.c:2304 @@ -5523,9 +5414,7 @@ msgstr "" " vypíše informace o geometrii, které udržuje jádro" #: fdisk/sfdisk.c:2309 -msgid "" -" -G [or --show-pt-geometry]: print geometry guessed from the partition " -"table" +msgid " -G [or --show-pt-geometry]: print geometry guessed from the partition table" msgstr "" " -G [či --show-pt-geometry]:\n" " vypíše informace o geometrii, která byla odhadnuta\n" @@ -5541,10 +5430,8 @@ msgstr "" " oddílech a na vstupu bude očekávat jejich popis" #: fdisk/sfdisk.c:2312 -msgid "" -" -L [or --Linux]: do not complain about things irrelevant for Linux" -msgstr "" -" -L [či --Linux]: problémy nepodstatné pro Linux budou ignorovány" +msgid " -L [or --Linux]: do not complain about things irrelevant for Linux" +msgstr " -L [či --Linux]: problémy nepodstatné pro Linux budou ignorovány" #: fdisk/sfdisk.c:2313 msgid " -q [or --quiet]: suppress warning messages" @@ -5586,8 +5473,7 @@ msgstr "%s zařízení\t\t vypíše aktivní diskové oddíly na daném zaříze #: fdisk/sfdisk.c:2327 #, c-format msgid "%s device n1 n2 ... activate partitions n1 ..., inactivate the rest\n" -msgstr "" -"%s zařízení n1 n2 ... aktivuje diskové oddíly n1 ..., deaktivuje ostatní\n" +msgstr "%s zařízení n1 n2 ... aktivuje diskové oddíly n1 ..., deaktivuje ostatní\n" #: fdisk/sfdisk.c:2328 #, c-format @@ -5598,13 +5484,11 @@ msgstr "%s -An zařízení\t aktivuje diskový oddíl n, deaktivuje ostatní\n" #, c-format msgid "" "\n" -"WARNING: GPT (GUID Partition Table) detected on '%s'! The util sfdisk " -"doesn't support GPT. Use GNU Parted.\n" +"WARNING: GPT (GUID Partition Table) detected on '%s'! The util sfdisk doesn't support GPT. Use GNU Parted.\n" "\n" msgstr "" "\n" -"VAROVÁNÍ: Na „%s“ nalezena GPT (GUID tabulka rozdělení disku)! Nástroj " -"sfdisk nepodporuje GPT. Použijte GNU Parted.\n" +"VAROVÁNÍ: Na „%s“ nalezena GPT (GUID tabulka rozdělení disku)! Nástroj sfdisk nepodporuje GPT. Použijte GNU Parted.\n" "\n" #: fdisk/sfdisk.c:2451 @@ -5681,8 +5565,7 @@ msgid "" "You have %d active primary partitions. This does not matter for LILO,\n" "but the DOS MBR will only boot a disk with 1 active partition.\n" msgstr "" -"Počet aktivních diskových oddílů je %d. LILU to nečiní problémy, ale DOS " -"MBR\n" +"Počet aktivních diskových oddílů je %d. LILU to nečiní problémy, ale DOS MBR\n" "nastartuje pouze z disku s jedním aktivním diskovým oddílem.\n" #: fdisk/sfdisk.c:2923 @@ -5804,23 +5687,21 @@ msgid "" "to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1\n" "(See fdisk(8).)\n" msgstr "" -"Pokud jste vytvořil či změnil nějaké DOSOVÉ diskové oddíly - např. /dev/" -"bla7,\n" -"použijte dd(1) k vynulování prvních 512 bajtů: 'dd if=/dev/zero of=/dev/" -"bla7\n" +"Pokud jste vytvořil či změnil nějaké DOSOVÉ diskové oddíly - např. /dev/bla7,\n" +"použijte dd(1) k vynulování prvních 512 bajtů: 'dd if=/dev/zero of=/dev/bla7\n" "bs=512 count=1' (viz fdisk(8)).\n" -#: fsck/fsck.c:327 +#: fsck/fsck.c:326 #, c-format msgid "WARNING: couldn't open %s: %s\n" msgstr "VAROVÁNÍ: %s se nepodařilo otevřít: %s\n" -#: fsck/fsck.c:337 +#: fsck/fsck.c:336 #, c-format msgid "WARNING: bad format on line %d of %s\n" msgstr "VAROVÁNÍ: chybný formát na řádku %d souboru %s\n" -#: fsck/fsck.c:353 +#: fsck/fsck.c:352 msgid "" "WARNING: Your /etc/fstab does not contain the fsck passno\n" "\tfield. I will kludge around things for you, but you\n" @@ -5832,37 +5713,37 @@ msgstr "" "\tco nejdříve.\n" "\n" -#: fsck/fsck.c:461 +#: fsck/fsck.c:460 #, c-format msgid "fsck: %s: not found\n" msgstr "fsck: %s: nenalezeno\n" -#: fsck/fsck.c:577 +#: fsck/fsck.c:576 #, c-format msgid "%s: wait: No more child process?!?\n" msgstr "%s: wait: Žádní další potomci?!\n" -#: fsck/fsck.c:599 +#: fsck/fsck.c:598 #, c-format msgid "Warning... %s for device %s exited with signal %d.\n" msgstr "Varování… %s nad zařízením %s skončil signálem %d.\n" -#: fsck/fsck.c:605 +#: fsck/fsck.c:604 #, c-format msgid "%s %s: status is %x, should never happen.\n" msgstr "%s %s: status je %x, to by nikdy nemělo přihodit.\n" -#: fsck/fsck.c:644 +#: fsck/fsck.c:643 #, c-format msgid "Finished with %s (exit status %d)\n" msgstr "%s dokončeno (návratový kód %d)\n" -#: fsck/fsck.c:704 +#: fsck/fsck.c:703 #, c-format msgid "%s: Error %d while executing fsck.%s for %s\n" msgstr "%s: Chyba %d při provádění fsck.%s nad %s\n" -#: fsck/fsck.c:725 +#: fsck/fsck.c:724 msgid "" "Either all or none of the filesystem types passed to -t must be prefixed\n" "with 'no' or '!'.\n" @@ -5870,80 +5751,76 @@ msgstr "" "Buďto všechny, nebo žádný z typů souborových systémů předaných v -t musí\n" "být uvedeny s počátečním „no“ nebo „!“.\n" -#: fsck/fsck.c:744 +#: fsck/fsck.c:743 msgid "Couldn't allocate memory for filesystem types\n" msgstr "Pro typy souborových systémů nebylo možné alokovat paměť\n" -#: fsck/fsck.c:883 +#: fsck/fsck.c:882 #, c-format -msgid "" -"%s: skipping bad line in /etc/fstab: bind mount with nonzero fsck pass " -"number\n" +msgid "%s: skipping bad line in /etc/fstab: bind mount with nonzero fsck pass number\n" msgstr "" "%s: přeskakuji chybný řádek v /etc/fstab: přípojný bod typu bind\n" "s nenulovým pořadím kontroly\n" -#: fsck/fsck.c:893 +#: fsck/fsck.c:892 #, c-format msgid "%s: skipping nonexistent device\n" msgstr "%s: přeskakuje se neexistující zařízení\n" -#: fsck/fsck.c:919 +#: fsck/fsck.c:918 #, c-format msgid "fsck: cannot check %s: fsck.%s not found\n" msgstr "fsck: %s nelze zkontrolovat: fsck.%s nenalezen\n" -#: fsck/fsck.c:975 +#: fsck/fsck.c:974 msgid "Checking all file systems.\n" msgstr "Kontroluji všechny systému souborů.\n" -#: fsck/fsck.c:1066 +#: fsck/fsck.c:1065 #, c-format msgid "--waiting-- (pass %d)\n" msgstr "– čeká se – (průchod %d)\n" -#: fsck/fsck.c:1086 -msgid "" -"Usage: fsck [-AMNPRTV] [ -C [ fd ] ] [-t fstype] [fs-options] [filesys ...]\n" -msgstr "" -"Použití: fsck [-AMNPRTV] [-C [fd]][-t typ_ss] [volby_ss] [systém_souborů…]\n" +#: fsck/fsck.c:1085 +msgid "Usage: fsck [-AMNPRTV] [ -C [ fd ] ] [-t fstype] [fs-options] [filesys ...]\n" +msgstr "Použití: fsck [-AMNPRTV] [-C [fd]][-t typ_ss] [volby_ss] [systém_souborů…]\n" -#: fsck/fsck.c:1124 +#: fsck/fsck.c:1123 #, c-format msgid "%s: too many devices\n" msgstr "%s: příliš mnoho zařízení\n" -#: fsck/fsck.c:1135 +#: fsck/fsck.c:1134 #, c-format msgid "Couldn't open %s: %s\n" msgstr "%s nebylo možné otevřít: %s\n" -#: fsck/fsck.c:1137 +#: fsck/fsck.c:1136 #, c-format msgid "Is /proc mounted?\n" msgstr "Je /proc připojeno?\n" -#: fsck/fsck.c:1146 +#: fsck/fsck.c:1145 #, c-format msgid "Must be root to scan for matching filesystems: %s\n" msgstr "Jen root může hledat odpovídající souborové systémy: %s\n" -#: fsck/fsck.c:1149 +#: fsck/fsck.c:1148 #, c-format msgid "Couldn't find matching filesystem: %s\n" msgstr "Nebylo možné nalézt odpovídající systém souborů: %s\n" -#: fsck/fsck.c:1157 fsck/fsck.c:1243 +#: fsck/fsck.c:1156 fsck/fsck.c:1242 #, c-format msgid "%s: too many arguments\n" msgstr "%s: příliš mnoho argumentů\n" -#: fsck/fsck.c:1277 +#: fsck/fsck.c:1276 #, c-format msgid "fsck from %s\n" msgstr "fsck z %s\n" -#: fsck/fsck.c:1289 +#: fsck/fsck.c:1288 #, c-format msgid "%s: Unable to allocate memory for fsck_path\n" msgstr "%s: Paměť pro fsck_path nelze alokovat\n" @@ -5977,10 +5854,8 @@ msgid " parameters\n" msgstr " argumenty\n" #: getopt/getopt.c:324 -msgid "" -" -a, --alternative Allow long options starting with single -\n" -msgstr "" -" -a, --alternative Akceptuje dlouhé volby začínající jedním -\n" +msgid " -a, --alternative Allow long options starting with single -\n" +msgstr " -a, --alternative Akceptuje dlouhé volby začínající jedním -\n" #: getopt/getopt.c:325 msgid " -h, --help This small usage guide\n" @@ -5991,10 +5866,8 @@ msgid " -l, --longoptions=longopts Long options to be recognized\n" msgstr " -l, --longoptions=dlouhvol Rozpoznávané dlouhé volby\n" #: getopt/getopt.c:327 -msgid "" -" -n, --name=progname The name under which errors are reported\n" -msgstr "" -" -n, --name=názevprog Název, pod kterým jsou oznamovány chyby\n" +msgid " -n, --name=progname The name under which errors are reported\n" +msgstr " -n, --name=názevprog Název, pod kterým jsou oznamovány chyby\n" #: getopt/getopt.c:328 msgid " -o, --options=optstring Short options to be recognized\n" @@ -6002,8 +5875,7 @@ msgstr " -o, --options=krátvol Rozpoznávané krátké volby\n" #: getopt/getopt.c:329 msgid " -q, --quiet Disable error reporting by getopt(3)\n" -msgstr "" -" -q, --quiet Vypne oznamování chyb pomocí getopt(3)\n" +msgstr " -q, --quiet Vypne oznamování chyb pomocí getopt(3)\n" #: getopt/getopt.c:330 msgid " -Q, --quiet-output No normal output\n" @@ -6163,15 +6035,12 @@ msgstr "…hodiny tikly\n" #: hwclock/hwclock.c:412 #, c-format msgid "Invalid values in hardware clock: %4d/%.2d/%.2d %.2d:%.2d:%.2d\n" -msgstr "" -"Hodiny reálného času obsahují chybné hodnoty: %4d/%.2d/%.2d %.2d:%.2d:%.2d\n" +msgstr "Hodiny reálného času obsahují chybné hodnoty: %4d/%.2d/%.2d %.2d:%.2d:%.2d\n" #: hwclock/hwclock.c:420 #, c-format msgid "Hw clock time : %4d/%.2d/%.2d %.2d:%.2d:%.2d = %ld seconds since 1969\n" -msgstr "" -"Hodiny reálného času: %4d/%.2d/%.2d %.2d:%.2d:%.2d = %ld sekund od roku " -"1969\n" +msgstr "Hodiny reálného času: %4d/%.2d/%.2d %.2d:%.2d:%.2d = %ld sekund od roku 1969\n" #: hwclock/hwclock.c:450 #, c-format @@ -6181,8 +6050,7 @@ msgstr "Hodiny reálného času ukazují %4d/%.2d/%.2d %02d:%02d:%02d\n" #: hwclock/hwclock.c:479 #, c-format msgid "Setting Hardware Clock to %.2d:%.2d:%.2d = %ld seconds since 1969\n" -msgstr "" -"Nastavuji hodiny reálného času na %.2d:%.2d:%.2d = %ld sekund od roku 1969\n" +msgstr "Nastavuji hodiny reálného času na %.2d:%.2d:%.2d = %ld sekund od roku 1969\n" #: hwclock/hwclock.c:485 #, c-format @@ -6200,9 +6068,7 @@ msgstr "" #: hwclock/hwclock.c:571 #, c-format -msgid "" -"The Hardware Clock registers contain values that are either invalid (e.g. " -"50th day of month) or beyond the range we can handle (e.g. Year 2095).\n" +msgid "The Hardware Clock registers contain values that are either invalid (e.g. 50th day of month) or beyond the range we can handle (e.g. Year 2095).\n" msgstr "" "Registry hodin reálného času obsahují hodnoty, které jsou buď chybné (např.\n" "50tý den v měsíci), či mimo přípustný rozsah (např. rok 2095).\n" @@ -6227,8 +6093,7 @@ msgstr "argument --date je příliš dlouhý\n" msgid "" "The value of the --date option is not a valid date.\n" "In particular, it contains quotation marks.\n" -msgstr "" -"Argument přepínače --date není platným datem. Konkrétně obsahuje uvozovky.\n" +msgstr "Argument přepínače --date není platným datem. Konkrétně obsahuje uvozovky.\n" #: hwclock/hwclock.c:636 #, c-format @@ -6262,8 +6127,7 @@ msgstr "" #: hwclock/hwclock.c:662 #, c-format msgid "" -"The date command issued by %s returned something other than an integer where " -"the converted time value was expected.\n" +"The date command issued by %s returned something other than an integer where the converted time value was expected.\n" "The command was:\n" " %s\n" "The response was:\n" @@ -6283,9 +6147,7 @@ msgstr "Datum %s odpovídá %ld sekundám od roku 1969.\n" #: hwclock/hwclock.c:705 #, c-format -msgid "" -"The Hardware Clock does not contain a valid time, so we cannot set the " -"System Time from it.\n" +msgid "The Hardware Clock does not contain a valid time, so we cannot set the System Time from it.\n" msgstr "" "Systémový čas nelze podle hodin reálného času nastavit, protože neukazují\n" "platný čas.\n" @@ -6331,9 +6193,7 @@ msgstr "\tUTC: %s\n" #: hwclock/hwclock.c:852 #, c-format -msgid "" -"Not adjusting drift factor because the Hardware Clock previously contained " -"garbage.\n" +msgid "Not adjusting drift factor because the Hardware Clock previously contained garbage.\n" msgstr "" "Neopravuji míru posunu, protože hodiny reálného času posledně obsahovaly\n" "neplatné hodnoty.\n" @@ -6349,22 +6209,16 @@ msgstr "" #: hwclock/hwclock.c:863 #, c-format -msgid "" -"Not adjusting drift factor because it has been less than a day since the " -"last calibration.\n" -msgstr "" -"Neopravuji míru posunu, protože poslední kalibrace ještě neuplynul celý " -"den.\n" +msgid "Not adjusting drift factor because it has been less than a day since the last calibration.\n" +msgstr "Neopravuji míru posunu, protože poslední kalibrace ještě neuplynul celý den.\n" #: hwclock/hwclock.c:911 #, c-format msgid "" -"Clock drifted %.1f seconds in the past %d seconds in spite of a drift factor " -"of %f seconds/day.\n" +"Clock drifted %.1f seconds in the past %d seconds in spite of a drift factor of %f seconds/day.\n" "Adjusting drift factor by %f seconds/day\n" msgstr "" -"Hodiny se za posledních %2$d sekund rozešly o %1$.1f sekund, přestože míra " -"posunu\n" +"Hodiny se za posledních %2$d sekund rozešly o %1$.1f sekund, přestože míra posunu\n" "je nastavena na %3$f sekund/den.\n" "Opravuji míru posunu o %4$f sekund.\n" @@ -6394,9 +6248,7 @@ msgstr "" #: hwclock/hwclock.c:1001 #, c-format -msgid "" -"Could not open file with the clock adjustment parameters in it (%s) for " -"writing" +msgid "Could not open file with the clock adjustment parameters in it (%s) for writing" msgstr "Soubor s parametry posunu hodin (%s) se nepodařilo otevřít pro zápis" #: hwclock/hwclock.c:1006 hwclock/hwclock.c:1011 @@ -6411,17 +6263,13 @@ msgstr "Parametry opravy posunu nezměněny.\n" #: hwclock/hwclock.c:1058 #, c-format -msgid "" -"The Hardware Clock does not contain a valid time, so we cannot adjust it.\n" +msgid "The Hardware Clock does not contain a valid time, so we cannot adjust it.\n" msgstr "Hodiny reálného času obsahují neplatný čas, tudíž jej nelze opravit.\n" #: hwclock/hwclock.c:1066 #, c-format -msgid "" -"Not setting clock because last adjustment time is zero, so history is bad." -msgstr "" -"Nenastavuji hodiny, protože čas posledního posunu je nula, takže historie je " -"nepoužitelná." +msgid "Not setting clock because last adjustment time is zero, so history is bad." +msgstr "Nenastavuji hodiny, protože čas posledního posunu je nula, takže historie je nepoužitelná." #: hwclock/hwclock.c:1089 #, c-format @@ -6446,13 +6294,11 @@ msgstr "Systémový čas nelze nastavit.\n" #: hwclock/hwclock.c:1257 #, c-format msgid "" -"The kernel keeps an epoch value for the Hardware Clock only on an Alpha " -"machine.\n" +"The kernel keeps an epoch value for the Hardware Clock only on an Alpha machine.\n" "This copy of hwclock was built for a machine other than Alpha\n" "(and thus is presumably not running on an Alpha now). No action taken.\n" msgstr "" -"Jádro obsahuje hodnotu počátku epochy pro hodiny reálného času pouze na " -"Alpha\n" +"Jádro obsahuje hodnotu počátku epochy pro hodiny reálného času pouze na Alpha\n" "systémech.\n" "Tento program nebyl přeložen pro Alpha systém ( a tudíž pravděpodobně nyní\n" "neběží na Alphě). Ignorováno.\n" @@ -6469,9 +6315,7 @@ msgstr "Jádro pokládá za počátek epochy %lu.\n" #: hwclock/hwclock.c:1271 #, c-format -msgid "" -"To set the epoch value, you must use the 'epoch' option to tell to what " -"value to set it.\n" +msgid "To set the epoch value, you must use the 'epoch' option to tell to what value to set it.\n" msgstr "Počátek epochy nastavíte pomocí přepínačů epoch a setepoch.\n" #: hwclock/hwclock.c:1274 @@ -6484,7 +6328,7 @@ msgstr "Testovací režim - počátek epochy na %d neměním.\n" msgid "Unable to set the epoch value in the kernel.\n" msgstr "Hodnotu počátku epochy v jádře nelze nastavit.\n" -#: hwclock/hwclock.c:1290 misc-utils/cal.c:343 misc-utils/kill.c:189 +#: hwclock/hwclock.c:1290 misc-utils/cal.c:347 misc-utils/kill.c:189 #, c-format msgid "%s from %s\n" msgstr "%s na %s\n" @@ -6539,8 +6383,7 @@ msgstr "" " -s | --hctosys nastaví systémový čas podle hodin reálného času\n" " -w | --systohc nastaví RTC podle aktuálního systémového času\n" " --systz nastaví systémový čas na základě současné časové zóny\n" -" --adjust opraví RTC o systematický posun, který nastal od " -"poslední\n" +" --adjust opraví RTC o systematický posun, který nastal od poslední\n" " opravy či nastavení RTC\n" " --getepoch vypíše počátek epochy hodin reálného času podle jádra\n" " --setepoch nastaví jádru počátek epochy hodin reálného času na\n" @@ -6583,8 +6426,7 @@ msgstr "%s: Nelze se připojit ke kontrolnímu systému\n" #: hwclock/hwclock.c:1551 #, c-format msgid "%s takes no non-option arguments. You supplied %d.\n" -msgstr "" -"%s akceptuje pouze přepínače. Zadáno argumentů, které nejsou přepínači: %d\n" +msgstr "%s akceptuje pouze přepínače. Zadáno argumentů, které nejsou přepínači: %d\n" #: hwclock/hwclock.c:1558 #, c-format @@ -6597,28 +6439,18 @@ msgstr "" #: hwclock/hwclock.c:1565 #, c-format -msgid "" -"%s: The --utc and --localtime options are mutually exclusive. You specified " -"both.\n" +msgid "%s: The --utc and --localtime options are mutually exclusive. You specified both.\n" msgstr "%s: Přepínače --utc a --localtime nelze použít zároveň.\n" #: hwclock/hwclock.c:1572 #, c-format -msgid "" -"%s: The --adjust and --noadjfile options are mutually exclusive. You " -"specified both.\n" -msgstr "" -"%s: Volby --adjust a --noadjfile se vzájemně vylučují. Vy jste však použil " -"obě.\n" +msgid "%s: The --adjust and --noadjfile options are mutually exclusive. You specified both.\n" +msgstr "%s: Volby --adjust a --noadjfile se vzájemně vylučují. Vy jste však použil obě.\n" #: hwclock/hwclock.c:1579 #, c-format -msgid "" -"%s: The --adjfile and --noadjfile options are mutually exclusive. You " -"specified both.\n" -msgstr "" -"%s: Volby --adjfile a --noadjfile se vzájemně vylučují. Vy jste však použil" -"(a) obě.\n" +msgid "%s: The --adjfile and --noadjfile options are mutually exclusive. You specified both.\n" +msgstr "%s: Volby --adjfile a --noadjfile se vzájemně vylučují. Vy jste však použil(a) obě.\n" #: hwclock/hwclock.c:1588 #, c-format @@ -6642,22 +6474,17 @@ msgstr "Hodiny reálného času může nastavit pouze superuživatel.\n" #: hwclock/hwclock.c:1629 #, c-format -msgid "" -"Sorry, only the superuser can change the Hardware Clock epoch in the " -"kernel.\n" +msgid "Sorry, only the superuser can change the Hardware Clock epoch in the kernel.\n" msgstr "Hodnotu počátku epochy v jádře může nastavit pouze superuživatel.\n" #: hwclock/hwclock.c:1650 #, c-format msgid "Cannot access the Hardware Clock via any known method.\n" -msgstr "" -"Žádným ze známých způsobů nelze získat přístup k hodinám reálného času.\n" +msgstr "Žádným ze známých způsobů nelze získat přístup k hodinám reálného času.\n" #: hwclock/hwclock.c:1654 #, c-format -msgid "" -"Use the --debug option to see the details of our search for an access " -"method.\n" +msgid "Use the --debug option to see the details of our search for an access method.\n" msgstr "Pro zjištění podrobností použijte přepínač --debug.\n" #: hwclock/kd.c:54 @@ -6757,13 +6584,9 @@ msgstr "%s nelze otevřít." #: hwclock/rtc.c:410 hwclock/rtc.c:454 #, c-format -msgid "" -"To manipulate the epoch value in the kernel, we must access the Linux 'rtc' " -"device driver via the device special file %s. This file does not exist on " -"this system.\n" +msgid "To manipulate the epoch value in the kernel, we must access the Linux 'rtc' device driver via the device special file %s. This file does not exist on this system.\n" msgstr "" -"Pro změnu hodnoty počátku epochy v jádře je nutné použít 'rtc' ovladač " -"pomocí\n" +"Pro změnu hodnoty počátku epochy v jádře je nutné použít 'rtc' ovladač pomocí\n" "zvláštního souboru %s. Tento soubor na tomto systému souborů neexistuje.\n" #: hwclock/rtc.c:415 hwclock/rtc.c:459 @@ -6779,8 +6602,7 @@ msgstr "volání(RTC_EPOCH_READ) pro %s selhalo" #: hwclock/rtc.c:427 #, c-format msgid "we have read epoch %ld from %s with RTC_EPOCH_READ ioctl.\n" -msgstr "" -"Z %2$s byl pomocí RTC_EPOCH_READ ioctl zjištěn počátek epochy (%1$ld).\n" +msgstr "Z %2$s byl pomocí RTC_EPOCH_READ ioctl zjištěn počátek epochy (%1$ld).\n" #: hwclock/rtc.c:446 #, c-format @@ -6790,13 +6612,11 @@ msgstr "Hodnota počátku epochy nesmí být menší než 1900 (požadováno %ld #: hwclock/rtc.c:464 #, c-format msgid "setting epoch to %ld with RTC_EPOCH_SET ioctl to %s.\n" -msgstr "" -"Nastavuji pomocí RTC_EPOCH_SET ioctl pro %2$s počátek epochy na %1$ld.\n" +msgstr "Nastavuji pomocí RTC_EPOCH_SET ioctl pro %2$s počátek epochy na %1$ld.\n" #: hwclock/rtc.c:469 #, c-format -msgid "" -"The kernel device driver for %s does not have the RTC_EPOCH_SET ioctl.\n" +msgid "The kernel device driver for %s does not have the RTC_EPOCH_SET ioctl.\n" msgstr "Ovladač jádra pro %s nepodporuje RTC_EPOCH_SET ioctl.\n" #: hwclock/rtc.c:472 @@ -6875,15 +6695,11 @@ msgstr "%s: přetečení vstupu" #: login-utils/agetty.c:1206 #, c-format msgid "" -"Usage: %s [-8hiLmUw] [-l login_program] [-t timeout] [-I initstring] [-H " -"login_host] baud_rate,... line [termtype]\n" -"or\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] " -"line baud_rate,... [termtype]\n" +"Usage: %s [-8hiLmUw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] baud_rate,... line [termtype]\n" +"or\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] line baud_rate,... [termtype]\n" msgstr "" -"Použití: %s [-8hiLmUw] [-l LOGIN_PROGRAM] [-t ČASOVÝ_LIMIT] [-I " -"INICIALIZAČNÍ_ŘETĚZEC] [-H POČÍTAČ] BAUD_RATE,… LINKA [TYP_TERMINÁLU]\n" -"či\t[-hiLmw] [-l LOGIN_PROGRAM] [-t ČASOVÝ_LIMIT] [-I INICIALIZAČNÍ_ŘETĚZEC] " -"[-H POČÍTAČ] LINKA BAUD_RATE,… [TYP_TERMINÁLU]\n" +"Použití: %s [-8hiLmUw] [-l LOGIN_PROGRAM] [-t ČASOVÝ_LIMIT] [-I INICIALIZAČNÍ_ŘETĚZEC] [-H POČÍTAČ] BAUD_RATE,… LINKA [TYP_TERMINÁLU]\n" +"či\t[-hiLmw] [-l LOGIN_PROGRAM] [-t ČASOVÝ_LIMIT] [-I INICIALIZAČNÍ_ŘETĚZEC] [-H POČÍTAČ] LINKA BAUD_RATE,… [TYP_TERMINÁLU]\n" #: login-utils/checktty.c:91 login-utils/checktty.c:112 #, c-format @@ -6942,12 +6758,12 @@ msgstr "%s: Nemohu nastavit výchozí kontext pro /etc/passwd" msgid "Changing finger information for %s.\n" msgstr "Měním finger informace o uživateli %s.\n" -#: login-utils/chfn.c:189 login-utils/chsh.c:188 login-utils/login.c:572 +#: login-utils/chfn.c:189 login-utils/chsh.c:188 login-utils/login.c:576 #, c-format msgid "%s: PAM failure, aborting: %s\n" msgstr "%s: chyba PAM, končím: %s\n" -#: login-utils/chfn.c:212 login-utils/chsh.c:211 login-utils/login.c:823 +#: login-utils/chfn.c:212 login-utils/chsh.c:211 login-utils/login.c:827 #: login-utils/newgrp.c:79 login-utils/simpleinit.c:340 mount/lomount.c:742 #: mount/lomount.c:745 msgid "Password: " @@ -7034,9 +6850,7 @@ msgstr "%s: %s není oprávněn měnit shell uživatele %s\n" #: login-utils/chsh.c:164 #, c-format -msgid "" -"%s: Running UID doesn't match UID of user we're altering, shell change " -"denied\n" +msgid "%s: Running UID doesn't match UID of user we're altering, shell change denied\n" msgstr "" "%s: Aktuální UID se neshoduje s UID uživatele, kterého chceme změnit,\n" "změna shellu odmítnuta\n" @@ -7175,35 +6989,40 @@ msgstr "" msgid "FATAL: can't reopen tty: %s" msgstr "FATÁLNÍ: nelze znovu otevřít tty: %s" -#: login-utils/login.c:229 +#: login-utils/login.c:205 +#, c-format +msgid "FATAL: %s is not a terminal" +msgstr "FATÁLNÍ: %s není terminálem" + +#: login-utils/login.c:238 msgid "FATAL: bad tty" msgstr "FATÁLNÍ: špatné tty" -#: login-utils/login.c:436 +#: login-utils/login.c:445 #, c-format msgid "login: -h for super-user only.\n" msgstr "login: přepínač -h může použít pouze superuživatel\n" -#: login-utils/login.c:479 +#: login-utils/login.c:488 #, c-format msgid "usage: login [-fp] [username]\n" msgstr "Použití: login [fp] [uživatelské jméno]\n" -#: login-utils/login.c:574 +#: login-utils/login.c:578 #, c-format msgid "Couldn't initialize PAM: %s" msgstr "PAM nelze inicializovat: %s" -#: login-utils/login.c:591 +#: login-utils/login.c:595 msgid "login: " msgstr "Přihlašovací jméno:" -#: login-utils/login.c:635 +#: login-utils/login.c:639 #, c-format msgid "FAILED LOGIN %d FROM %s FOR %s, %s" msgstr "%1$d. CHYBNÉ PŘIHLÁŠENÍ UŽIVATELE %3$s Z %2$s, %4$s" -#: login-utils/login.c:640 +#: login-utils/login.c:644 #, c-format msgid "" "Login incorrect\n" @@ -7212,17 +7031,17 @@ msgstr "" "Chybné přihlášení\n" "\n" -#: login-utils/login.c:649 +#: login-utils/login.c:653 #, c-format msgid "TOO MANY LOGIN TRIES (%d) FROM %s FOR %s, %s" msgstr "PŘÍLIŠ MNOHO (%1$d) POKUSŮ UŽIVATELE %3$s O PŘIHLÁŠENÍ Z %2$s, %4$s" -#: login-utils/login.c:653 +#: login-utils/login.c:657 #, c-format msgid "FAILED LOGIN SESSION FROM %s FOR %s, %s" msgstr "NEÚSPĚŠNÉ PŘIHLÁŠENÍ UŽIVATELE %2$s Z %1$s, %3$s" -#: login-utils/login.c:658 +#: login-utils/login.c:662 #, c-format msgid "" "\n" @@ -7231,7 +7050,7 @@ msgstr "" "\n" "Chybné přihlášení\n" -#: login-utils/login.c:686 login-utils/login.c:693 login-utils/login.c:727 +#: login-utils/login.c:690 login-utils/login.c:697 login-utils/login.c:731 #, c-format msgid "" "\n" @@ -7240,120 +7059,120 @@ msgstr "" "\n" "Problém během nastavování relace. Přerušuji činnost.\n" -#: login-utils/login.c:687 +#: login-utils/login.c:691 #, c-format msgid "NULL user name in %s:%d. Abort." msgstr "NULLOVÉ jméno uživatele v %s:%d. Přerušuji činnost." -#: login-utils/login.c:694 +#: login-utils/login.c:698 #, c-format msgid "Invalid user name \"%s\" in %s:%d. Abort." msgstr "Neplatné jméno uživatele „%s“ v %s:%d. Přerušuji činnost." -#: login-utils/login.c:713 +#: login-utils/login.c:717 #, c-format msgid "login: Out of memory\n" msgstr "login: Nedostatek paměti\n" -#: login-utils/login.c:757 +#: login-utils/login.c:761 msgid "Illegal username" msgstr "Chybné uživatelské jméno" -#: login-utils/login.c:800 +#: login-utils/login.c:804 #, c-format msgid "%s login refused on this terminal.\n" msgstr "přihlášení uživatele %s na tomto terminálu odmítnuto\n" -#: login-utils/login.c:805 +#: login-utils/login.c:809 #, c-format msgid "LOGIN %s REFUSED FROM %s ON TTY %s" msgstr "PŘIHLÁŠENÍ UŽIVATELE %s Z %s NA TTY %s ODMÍTNUTO" -#: login-utils/login.c:809 +#: login-utils/login.c:813 #, c-format msgid "LOGIN %s REFUSED ON TTY %s" msgstr "PŘIHLÁŠENÍ UŽIVATELE %s NA TTY %s ODMÍTNUTO" -#: login-utils/login.c:863 +#: login-utils/login.c:867 #, c-format msgid "Login incorrect\n" msgstr "Chybné přihlášení\n" -#: login-utils/login.c:1088 +#: login-utils/login.c:1092 #, c-format msgid "DIALUP AT %s BY %s" msgstr "PŘÍSTUP UŽIVATELE %2$s VYTÁČENOU LINKOU NA TTY %1$s" -#: login-utils/login.c:1095 +#: login-utils/login.c:1099 #, c-format msgid "ROOT LOGIN ON %s FROM %s" msgstr "PŘIHLÁŠENÍ UŽIVATELE ROOT Z %2$s NA TTY %1$s" -#: login-utils/login.c:1098 +#: login-utils/login.c:1102 #, c-format msgid "ROOT LOGIN ON %s" msgstr "PŘIHLÁŠENÍ UŽIVATELE ROOT NA TTY %s" -#: login-utils/login.c:1101 +#: login-utils/login.c:1105 #, c-format msgid "LOGIN ON %s BY %s FROM %s" msgstr "PŘIHLÁŠENÍ UŽIVATELE %2$s Z %3$s NA TTY %1$s" -#: login-utils/login.c:1104 +#: login-utils/login.c:1108 #, c-format msgid "LOGIN ON %s BY %s" msgstr "PŘIHLÁŠENÍ UŽIVATELE %2$s NA TTY %1$s" -#: login-utils/login.c:1125 +#: login-utils/login.c:1129 #, c-format msgid "You have new mail.\n" msgstr "Máte novou poštu.\n" -#: login-utils/login.c:1127 +#: login-utils/login.c:1131 #, c-format msgid "You have mail.\n" msgstr "Máte starou poštu.\n" -#: login-utils/login.c:1171 +#: login-utils/login.c:1175 #, c-format msgid "login: failure forking: %s" msgstr "login: volání fork selhalo: %s" -#: login-utils/login.c:1218 +#: login-utils/login.c:1222 #, c-format msgid "TIOCSCTTY failed: %m" msgstr "Selhalo TIOCSCTTY: %m" -#: login-utils/login.c:1224 +#: login-utils/login.c:1228 msgid "setuid() failed" msgstr "volání setuid() selhalo" -#: login-utils/login.c:1230 +#: login-utils/login.c:1234 #, c-format msgid "No directory %s!\n" msgstr "Adresář %s neexistuje!\n" -#: login-utils/login.c:1234 +#: login-utils/login.c:1238 #, c-format msgid "Logging in with home = \"/\".\n" msgstr "Přihlašuji s domácím adresářem nastaveným na \"/\".\n" -#: login-utils/login.c:1242 +#: login-utils/login.c:1246 #, c-format msgid "login: no memory for shell script.\n" msgstr "login: nedostatek paměti pro skript shellu.\n" -#: login-utils/login.c:1269 +#: login-utils/login.c:1273 #, c-format msgid "login: couldn't exec shell script: %s.\n" msgstr "login: skript shellu %s nelze spustit.\n" -#: login-utils/login.c:1272 +#: login-utils/login.c:1276 #, c-format msgid "login: no shell: %s.\n" msgstr "login: žádný shell: %s.\n" -#: login-utils/login.c:1287 +#: login-utils/login.c:1291 #, c-format msgid "" "\n" @@ -7362,65 +7181,65 @@ msgstr "" "\n" "Přihlašovací jméno na %s: " -#: login-utils/login.c:1298 +#: login-utils/login.c:1302 #, c-format msgid "login name much too long.\n" msgstr "přihlašovací jméno je příliš dlouhé.\n" -#: login-utils/login.c:1299 +#: login-utils/login.c:1303 msgid "NAME too long" msgstr "JMÉNO je příliš dlouhé" -#: login-utils/login.c:1306 +#: login-utils/login.c:1310 #, c-format msgid "login names may not start with '-'.\n" msgstr "přihlašovací jméno nesmí začínat '-'.\n" -#: login-utils/login.c:1316 +#: login-utils/login.c:1320 #, c-format msgid "too many bare linefeeds.\n" msgstr "příliš mnoho znaků LF\n" -#: login-utils/login.c:1317 +#: login-utils/login.c:1321 msgid "EXCESSIVE linefeeds" msgstr "PŘÍLIŠ mnoho znaků LF" -#: login-utils/login.c:1349 +#: login-utils/login.c:1353 #, c-format msgid "Login timed out after %d seconds\n" msgstr "Vypršel časový limit (%d sekund) pro přihlášení.\n" -#: login-utils/login.c:1437 +#: login-utils/login.c:1441 #, c-format msgid "Last login: %.*s " msgstr "Poslední přihlášení: %.*s " -#: login-utils/login.c:1441 +#: login-utils/login.c:1445 #, c-format msgid "from %.*s\n" msgstr "z %.*s\n" -#: login-utils/login.c:1444 +#: login-utils/login.c:1448 #, c-format msgid "on %.*s\n" msgstr "%.*s\n" -#: login-utils/login.c:1470 +#: login-utils/login.c:1474 #, c-format msgid "LOGIN FAILURE FROM %s, %s" msgstr "CHYBNÉ PŘIHLÁŠENÍ UŽIVATELE %2$s Z %1$s" -#: login-utils/login.c:1473 +#: login-utils/login.c:1477 #, c-format msgid "LOGIN FAILURE ON %s, %s" msgstr "CHYBNÉ PŘIHLÁŠENÍ UŽIVATELE %2$s NA TTY %1$s" -#: login-utils/login.c:1477 +#: login-utils/login.c:1481 #, c-format msgid "%d LOGIN FAILURES FROM %s, %s" msgstr "POČET CHYBNÝCH PŘIHLÁŠENÍ UŽIVATELE %3$s Z %2$s: %1$d" -#: login-utils/login.c:1480 +#: login-utils/login.c:1484 #, c-format msgid "%d LOGIN FAILURES ON %s, %s" msgstr "POČET CHYBNÝCH PŘIHLÁŠENÍ UŽIVATELE %3$s NA TTY %2$s: %1$d" @@ -7595,8 +7414,7 @@ msgstr "%s nelze spustit - volání exec selhalo, zkouším umount.\n" #: login-utils/shutdown.c:610 msgid "Cannot exec umount, giving up on umount." -msgstr "" -"Umount nelze spustit - volání exec selhalo, vzdávám snahu o spuštění umount." +msgstr "Umount nelze spustit - volání exec selhalo, vzdávám snahu o spuštění umount." #: login-utils/shutdown.c:615 msgid "Unmounting any remaining filesystems..." @@ -7613,13 +7431,11 @@ msgstr "Startuji do režimu pro jednoho uživatele.\n" #: login-utils/simpleinit.c:136 msgid "exec of single user shell failed\n" -msgstr "" -"Spuštění shellu pro jednoho uživatele se nezdařilo - volání exec selhalo.\n" +msgstr "Spuštění shellu pro jednoho uživatele se nezdařilo - volání exec selhalo.\n" #: login-utils/simpleinit.c:140 msgid "fork of single user shell failed\n" -msgstr "" -"Spuštění shellu pro jednoho uživatele se nezdařilo - volání fork selhalo.\n" +msgstr "Spuštění shellu pro jednoho uživatele se nezdařilo - volání fork selhalo.\n" #: login-utils/simpleinit.c:208 msgid "error opening fifo\n" @@ -7817,25 +7633,25 @@ msgstr "%s: volání stat pro dočasný soubor selhalo.\n" msgid "%s: can't read temporary file.\n" msgstr "%s: dočasný soubor nelze číst.\n" -#: misc-utils/cal.c:360 misc-utils/cal.c:372 +#: misc-utils/cal.c:364 misc-utils/cal.c:376 #, c-format msgid "illegal day value: use 1-%d" msgstr "chybná hodnota pro den: použijte 1–%d" -#: misc-utils/cal.c:364 +#: misc-utils/cal.c:368 msgid "illegal month value: use 1-12" msgstr "chybná hodnota pro měsíc: použijte 1–12" -#: misc-utils/cal.c:368 +#: misc-utils/cal.c:372 msgid "illegal year value: use 1-9999" msgstr "chybná hodnota pro rok: použijte 1–9999" -#: misc-utils/cal.c:462 +#: misc-utils/cal.c:466 #, c-format msgid "%s %d" msgstr "%s %d" -#: misc-utils/cal.c:854 +#: misc-utils/cal.c:858 #, c-format msgid "usage: cal [-13smjyV] [[[day] month] year]\n" msgstr "Použití: cal [-13smjyV] [[[DEN] MĚSÍC] ROK]\n" @@ -7917,10 +7733,8 @@ msgstr "logger: neznámý název priority: %s\n" #: misc-utils/logger.c:285 #, c-format -msgid "" -"usage: logger [-is] [-f file] [-p pri] [-t tag] [-u socket] [ message ... ]\n" -msgstr "" -"Použití: logger [-is] [-f soubor] [-p pri] [-t značka] [-u soket] [zpráva…]\n" +msgid "usage: logger [-is] [-f file] [-p pri] [-t tag] [-u socket] [ message ... ]\n" +msgstr "Použití: logger [-is] [-f soubor] [-p pri] [-t značka] [-u soket] [zpráva…]\n" #: misc-utils/look.c:351 #, c-format @@ -8533,49 +8347,55 @@ msgstr "funkce calloc selhala" msgid "strdup failed" msgstr "funkce strdup selhala" -#: misc-utils/wipefs.c:199 -msgid "probing initialization failed" -msgstr "inicializace testování se nezdařila" +#: misc-utils/wipefs.c:200 +#, c-format +msgid "error: %s: probing initialization failed" +msgstr "chyba: %s: inicializace testování se nezdařila" -#: misc-utils/wipefs.c:243 +#: misc-utils/wipefs.c:211 +#, c-format +msgid "error: %s: appears to contain '%s' partition table" +msgstr "chyba: %s: zdá se, že obsahuje tabulku rozdělení disku „%s“" + +#: misc-utils/wipefs.c:257 #, c-format msgid "can't found a magic string at offset 0x%jx - ignore." msgstr "na pozici 0x%jx nebyl nalezen magický řetězec – ignoruje se." -#: misc-utils/wipefs.c:250 +#: misc-utils/wipefs.c:264 #, c-format msgid "%s: failed to seek to offset 0x%jx" msgstr "%s: přesun na pozici 0x%jx selhal" -#: misc-utils/wipefs.c:257 +#: misc-utils/wipefs.c:271 #, c-format msgid "%s: write failed" msgstr "%s: zápis se nezdařil" # TODO: plurals -#: misc-utils/wipefs.c:259 +#: misc-utils/wipefs.c:273 #, c-format msgid "%zd bytes [" msgstr "%zd bajtů [" -#: misc-utils/wipefs.c:267 +#: misc-utils/wipefs.c:281 #, c-format msgid "] erased at offset 0x%jx (%s)\n" msgstr "] vymazáno na pozici 0x%jx (%s)\n" -#: misc-utils/wipefs.c:278 mount/swapon.c:184 mount/swapon.c:252 +#: misc-utils/wipefs.c:292 mount/swapon.c:184 mount/swapon.c:252 #: mount/swapon.c:397 mount/swapon.c:556 mount/swapon.c:758 #: sys-utils/fallocate.c:159 #, c-format msgid "%s: open failed" msgstr "%s: otevření se nezdařilo" -#: misc-utils/wipefs.c:301 misc-utils/wipefs.c:304 +#: misc-utils/wipefs.c:315 misc-utils/wipefs.c:318 #, c-format msgid "invalid offset '%s' value specified" msgstr "zadána neplatná hodnota pozice „%s“" -#: misc-utils/wipefs.c:312 sys-utils/fallocate.c:47 +#: misc-utils/wipefs.c:326 sys-utils/fallocate.c:47 #, c-format msgid "" "Usage: %s [options] \n" @@ -8586,7 +8406,7 @@ msgstr "" "\n" "Přepínače:\n" -#: misc-utils/wipefs.c:316 +#: misc-utils/wipefs.c:330 #, c-format msgid "" " -a, --all wipe all magic strings (BE CAREFUL!)\n" @@ -8602,7 +8422,7 @@ msgstr "" " -p, --parsable vypisuje v strojově zpracovatelném formátu namísto\n" " v přehledné podobě\n" -#: misc-utils/wipefs.c:322 +#: misc-utils/wipefs.c:336 #, c-format msgid "" "\n" @@ -8611,7 +8431,7 @@ msgstr "" "\n" "Více informací naleznete ve wipefs(8).\n" -#: misc-utils/wipefs.c:373 +#: misc-utils/wipefs.c:387 msgid "--offset and --all are mutually exclusive" msgstr "--offset a --all se vzájemně vylučují" @@ -8869,8 +8689,7 @@ msgid "" " %1$s -d | --detach [ ...] delete\n" " %1$s -f | --find find unused\n" " %1$s -c | --set-capacity resize\n" -" %1$s -j | --associated [-o ] list all associated with " -"\n" +" %1$s -j | --associated [-o ] list all associated with \n" " %1$s [ options ] {-f|--find|loopdev} setup\n" msgstr "" "\n" @@ -8880,8 +8699,7 @@ msgstr "" " %1$s -d | --detach LOOP_ZAŘÍZENÍ [LOOP_ZAŘÍZENÍ…] smaže zařízení\n" " %1$s -f | --find najde nepoužitá\n" " %1$s -c | --set-capacity LOOP_ZAŘÍZENÍ změní velikost\n" -" %1$s -j | --associated SOUBOR [-o ČÍSLO] vypíše spojená se " -"SOUBOREM\n" +" %1$s -j | --associated SOUBOR [-o ČÍSLO] vypíše spojená se SOUBOREM\n" " %1$s [PŘEPÍNAČE] {-f|--find|LOOP_ZAŘÍZENÍ} SOUBOR sestrojí zařízení\n" #: mount/lomount.c:896 @@ -8931,228 +8749,243 @@ msgstr "%s: %s: zařízení se právě používá" msgid "No loop support was available at compile time. Please recompile.\n" msgstr "Podpora pro loop nebyla při překladu zadána. Přeložte program znovu.\n" -#: mount/mount.c:329 +#: mount/mount.c:288 +#, c-format +msgid "" +"\n" +"mount: warning: /etc/mtab is not writable (e.g. read-only filesystem).\n" +" It's possible that information reported by mount(8) is not\n" +" up to date. For actual information about system mount points\n" +" check the /proc/mounts file.\n" +"\n" +msgstr "" +"\n" +"mount: pozor: Do /etc/mtab nelze zapsat (například systém souborů je pouze\n" +" pro čtení). Je možné, že údaje hlášené nástrojem mount(8) nebudou\n" +" aktuální. Aktuální informace o přípojných bodech lze zjistit\n" +" v souboru /proc/mounts.\n" + +#: mount/mount.c:338 #, c-format msgid "mount: improperly quoted option string '%s'" msgstr "mount: řetězec přepínačů „%s“ je nesprávně uzavřen do uvozovek" -#: mount/mount.c:362 +#: mount/mount.c:371 #, c-format msgid "mount: translated %s '%s' to '%s'\n" msgstr "mount: %s přeloženo z „%s“ na „%s“\n" -#: mount/mount.c:526 +#: mount/mount.c:535 #, c-format msgid "mount: according to mtab, %s is already mounted on %s" msgstr "mount: podle mtab je %s již připojeno na %s" -#: mount/mount.c:531 +#: mount/mount.c:540 #, c-format msgid "mount: according to mtab, %s is mounted on %s" msgstr "mount: podle mtab je %s připojeno na %s" -#: mount/mount.c:555 +#: mount/mount.c:564 #, c-format msgid "mount: can't open %s for writing: %s" msgstr "mount: %s nelze otevřít pro zápis: %s" -#: mount/mount.c:572 mount/mount.c:1190 +#: mount/mount.c:581 mount/mount.c:1199 #, c-format msgid "mount: error writing %s: %s" msgstr "mount: chyba při zápisu %s: %s" -#: mount/mount.c:580 +#: mount/mount.c:589 #, c-format msgid "mount: error changing mode of %s: %s" msgstr "mount: chyba při změně módu %s: %s" -#: mount/mount.c:663 +#: mount/mount.c:672 #, c-format msgid "mount: cannot set group id: %s" msgstr "mount: číslo skupiny (GID) nelze nastavit: %s" -#: mount/mount.c:666 +#: mount/mount.c:675 #, c-format msgid "mount: cannot set user id: %s" msgstr "mount: číslo uživatele (UID) nelze nastavit: %s" -#: mount/mount.c:705 mount/mount.c:1855 +#: mount/mount.c:714 mount/mount.c:1864 #, c-format msgid "mount: cannot fork: %s" msgstr "mount: volání fork selhalo: %s" -#: mount/mount.c:842 +#: mount/mount.c:851 #, c-format msgid "Trying %s\n" msgstr "Používám %s.\n" -#: mount/mount.c:870 +#: mount/mount.c:879 #, c-format msgid "mount: you didn't specify a filesystem type for %s\n" msgstr "mount: nezadal jste typ systému souborů pro %s\n" -#: mount/mount.c:873 +#: mount/mount.c:882 #, c-format msgid " I will try all types mentioned in %s or %s\n" msgstr " Vyzkouším všechny typy v %s či %s\n" -#: mount/mount.c:876 +#: mount/mount.c:885 #, c-format msgid " and it looks like this is swapspace\n" msgstr " a vypadá to, že se jedná o odkládací prostor\n" -#: mount/mount.c:878 +#: mount/mount.c:887 #, c-format msgid " I will try type %s\n" msgstr " Vyzkouším typ %s\n" -#: mount/mount.c:902 +#: mount/mount.c:911 #, c-format msgid "%s looks like swapspace - not mounted" msgstr "%s vypadá jako odkládací prostor - nepřipojeno" -#: mount/mount.c:993 +#: mount/mount.c:1002 msgid "mount failed" msgstr "připojení se nezdařilo" -#: mount/mount.c:995 +#: mount/mount.c:1004 #, c-format msgid "mount: only root can mount %s on %s" msgstr "mount: pouze superuživatel může připojit %s na %s" -#: mount/mount.c:1065 +#: mount/mount.c:1074 msgid "mount: loop device specified twice" msgstr "mount: zařízení loop bylo zadáno dvakrát" -#: mount/mount.c:1070 +#: mount/mount.c:1079 msgid "mount: type specified twice" msgstr "mount: typ byl zadán dvakrát" -#: mount/mount.c:1082 +#: mount/mount.c:1091 #, c-format msgid "mount: skipping the setup of a loop device\n" msgstr "mount: přeskakuji nastavení loop zařízení\n" -#: mount/mount.c:1094 +#: mount/mount.c:1103 #, c-format msgid "mount: according to mtab %s is already mounted on %s as loop" msgstr "mount: podle mtab je %s již připojeno na %s jako loop" -#: mount/mount.c:1104 +#: mount/mount.c:1113 #, c-format msgid "mount: going to use the loop device %s\n" msgstr "mount: chystám se použít zařízení loop %s\n" -#: mount/mount.c:1113 +#: mount/mount.c:1122 #, c-format msgid "mount: stolen loop=%s ...trying again\n" msgstr "mount: ukradený loop=%s … zkouším znovu\n" -#: mount/mount.c:1118 +#: mount/mount.c:1127 #, c-format msgid "mount: stolen loop=%s" msgstr "umount: ukradený loop=%s" -#: mount/mount.c:1123 +#: mount/mount.c:1132 #, c-format msgid "mount: failed setting up loop device\n" msgstr "mount: nepodařilo se nastavit zařízení loop\n" -#: mount/mount.c:1134 +#: mount/mount.c:1143 #, c-format msgid "mount: setup loop device successfully\n" msgstr "mount: zařízení loop bylo korektně nastaveno\n" -#: mount/mount.c:1168 +#: mount/mount.c:1177 #, c-format msgid "mount: no %s found - creating it..\n" msgstr "mount: %s nebylo nalezeno - vytvářím jej..\n" -#: mount/mount.c:1185 +#: mount/mount.c:1194 #, c-format msgid "mount: can't open %s: %s" msgstr "mount: %s nelze otevřít: %s" -#: mount/mount.c:1206 +#: mount/mount.c:1215 msgid "mount: argument to -p or --pass-fd must be a number" msgstr "mount: argument přepínačů -p a --pass-fd musí být číslo" -#: mount/mount.c:1219 +#: mount/mount.c:1228 #, c-format msgid "mount: cannot open %s for setting speed" msgstr "mount: %s nelze otevřít za účelem nastavení rychlosti" -#: mount/mount.c:1222 +#: mount/mount.c:1231 #, c-format msgid "mount: cannot set speed: %s" msgstr "mount: rychlost nelze nastavit: %s" -#: mount/mount.c:1314 +#: mount/mount.c:1323 #, c-format msgid "mount: according to mtab, %s is already mounted on %s\n" msgstr "mount: podle mtab je %s již připojeno do %s\n" -#: mount/mount.c:1371 +#: mount/mount.c:1380 #, c-format msgid "mount: warning: %s seems to be mounted read-write.\n" msgstr "mount: pozor: %s se zdá být připojen pro čtení i zápis.\n" -#: mount/mount.c:1404 -msgid "" -"mount: I could not determine the filesystem type, and none was specified" +#: mount/mount.c:1413 +msgid "mount: I could not determine the filesystem type, and none was specified" msgstr "mount: typ systému souborů nebyl zadán a ani jej nelze zjistit" -#: mount/mount.c:1407 +#: mount/mount.c:1416 msgid "mount: you must specify the filesystem type" msgstr "mount: musíte zadat typ systému souborů" -#: mount/mount.c:1410 +#: mount/mount.c:1419 msgid "mount: mount failed" msgstr "mount: připojení se nezdařilo" -#: mount/mount.c:1416 mount/mount.c:1453 +#: mount/mount.c:1425 mount/mount.c:1462 #, c-format msgid "mount: mount point %s is not a directory" msgstr "mount: přípojný bod %s není adresářem" -#: mount/mount.c:1418 +#: mount/mount.c:1427 msgid "mount: permission denied" msgstr "mount: přístup odmítnut" -#: mount/mount.c:1420 +#: mount/mount.c:1429 msgid "mount: must be superuser to use mount" msgstr "mount: mount může používat pouze superuživatel" -#: mount/mount.c:1424 mount/mount.c:1428 +#: mount/mount.c:1433 mount/mount.c:1437 #, c-format msgid "mount: %s is busy" msgstr "mount: %s se používá" -#: mount/mount.c:1430 +#: mount/mount.c:1439 msgid "mount: proc already mounted" msgstr "mount: proc je již připojeno" -#: mount/mount.c:1432 +#: mount/mount.c:1441 #, c-format msgid "mount: %s already mounted or %s busy" msgstr "mount: %s je již připojeno, či je %s již používáno" -#: mount/mount.c:1438 +#: mount/mount.c:1447 #, c-format msgid "mount: mount point %s does not exist" msgstr "mount: přípojný bod %s neexistuje" -#: mount/mount.c:1440 +#: mount/mount.c:1449 #, c-format msgid "mount: mount point %s is a symbolic link to nowhere" msgstr "mount: přípojný bod %s je symbolickým odkazem, jenž nikam neukazuje" -#: mount/mount.c:1445 +#: mount/mount.c:1454 #, c-format msgid "mount: special device %s does not exist" msgstr "mount: speciální zařízení %s neexistuje" -#: mount/mount.c:1457 +#: mount/mount.c:1466 #, c-format msgid "" "mount: special device %s does not exist\n" @@ -9161,12 +8994,12 @@ msgstr "" "mount: speciální zařízení %s neexistuje\n" " (název cesty nezačíná adresářem)\n" -#: mount/mount.c:1469 +#: mount/mount.c:1478 #, c-format msgid "mount: %s not mounted already, or bad option" msgstr "mount: %s ještě není připojeno či chybný přepínač" -#: mount/mount.c:1471 +#: mount/mount.c:1480 #, c-format msgid "" "mount: wrong fs type, bad option, bad superblock on %s,\n" @@ -9175,7 +9008,7 @@ msgstr "" "mount: chybný typ SS, chybný přepínač, chybný superblok na %s,\n" " chybí kódová stránka nebo pomocný program nebo jiná chyba" -#: mount/mount.c:1478 +#: mount/mount.c:1487 msgid "" " (for several filesystems (e.g. nfs, cifs) you might\n" " need a /sbin/mount. helper program)" @@ -9183,7 +9016,7 @@ msgstr "" " (pro většinou souborových systému (např. nfs, cifs) budete\n" " potřebovat pomocný program /sbin/mount.)" -#: mount/mount.c:1487 +#: mount/mount.c:1496 msgid "" " (could this be the IDE device where you in fact use\n" " ide-scsi so that sr0 or sda or so is needed?)" @@ -9191,13 +9024,13 @@ msgstr "" " (mohlo by se jednat o IDE zařízení, kde ve skutečnosti používáte\n" " ide-scsi, takže je potřeba sr0 nebo sda nebo něco na ten způsob?)" -#: mount/mount.c:1492 +#: mount/mount.c:1501 msgid "" " (aren't you trying to mount an extended partition,\n" " instead of some logical partition inside?)" msgstr " (nepokoušíte se připojit rozšířený oddíl namísto logického?)" -#: mount/mount.c:1499 +#: mount/mount.c:1508 msgid "" " In some cases useful info is found in syslog - try\n" " dmesg | tail or so\n" @@ -9205,108 +9038,107 @@ msgstr "" " V jistých případech lze najít potřebné informace v systémovém\n" " protokolu – zkuste například „dmesg | tail“ \n" -#: mount/mount.c:1505 +#: mount/mount.c:1514 msgid "mount table full" msgstr "tabulka připojení je plná" -#: mount/mount.c:1507 +#: mount/mount.c:1516 #, c-format msgid "mount: %s: can't read superblock" msgstr "mount: %s: superblok nelze přečíst" -#: mount/mount.c:1513 +#: mount/mount.c:1522 #, c-format msgid "mount: %s: unknown device" msgstr "umount: blokové zařízení %s je neznámé" -#: mount/mount.c:1518 +#: mount/mount.c:1527 #, c-format msgid "mount: unknown filesystem type '%s'" msgstr "mount: neznámý systém souborů „%s“" -#: mount/mount.c:1530 +#: mount/mount.c:1539 #, c-format msgid "mount: probably you meant %s" msgstr "mount: pravděpodobně jste myslel %s" -#: mount/mount.c:1533 +#: mount/mount.c:1542 msgid "mount: maybe you meant 'iso9660'?" msgstr "mount: možná jste myslel „iso9660“?" -#: mount/mount.c:1536 +#: mount/mount.c:1545 msgid "mount: maybe you meant 'vfat'?" msgstr "mount: možná jste myslel „vfat“?" -#: mount/mount.c:1539 +#: mount/mount.c:1548 #, c-format msgid "mount: %s has wrong device number or fs type %s not supported" msgstr "mount: %s má chybné číslo zařízení, či ss typ %s není podporován" -#: mount/mount.c:1547 +#: mount/mount.c:1556 #, c-format msgid "mount: %s is not a block device, and stat fails?" msgstr "mount: %s není blokovým zařízením a volání stat selhalo?" -#: mount/mount.c:1549 +#: mount/mount.c:1558 #, c-format msgid "" "mount: the kernel does not recognize %s as a block device\n" -" (maybe `insmod driver'?)" +" (maybe `modprobe driver'?)" msgstr "" -"mount: jádro nerozpoznalo %s jako blokové zařízení (možná „insmod ovladač“?)" +"mount: jádro nerozpoznalo %s jako blokové zařízení\n" +" (možná „modprobe ovladač“?)" -#: mount/mount.c:1552 +#: mount/mount.c:1561 #, c-format msgid "mount: %s is not a block device (maybe try `-o loop'?)" msgstr "mount: %s není blokovým zařízením (možná pomůže „-o loop“?)" -#: mount/mount.c:1555 +#: mount/mount.c:1564 #, c-format msgid "mount: %s is not a block device" msgstr "mount: %s není blokovým zařízením" -#: mount/mount.c:1560 +#: mount/mount.c:1569 #, c-format msgid "mount: %s is not a valid block device" msgstr "mount: %s není platným blokovým zařízením" -#: mount/mount.c:1563 +#: mount/mount.c:1572 msgid "block device " msgstr "blokové zařízení" -#: mount/mount.c:1565 +#: mount/mount.c:1574 #, c-format msgid "mount: cannot mount %s%s read-only" msgstr "umount: %s%s nelze připojit v režimu pouze pro čtení" -#: mount/mount.c:1569 +#: mount/mount.c:1578 #, c-format msgid "mount: %s%s is write-protected but explicit `-w' flag given" msgstr "mount: %s%s je chráněno proti zápisu, připojuji pouze pro čtení" -#: mount/mount.c:1573 +#: mount/mount.c:1582 #, c-format msgid "mount: cannot remount %s%s read-write, is write-protected" -msgstr "" -"umount: %s%s nelze znovu připojit pro čtení i zápis, protože je chráněn " -"proti zápisu" +msgstr "umount: %s%s nelze znovu připojit pro čtení i zápis, protože je chráněn proti zápisu" -#: mount/mount.c:1588 +#: mount/mount.c:1597 #, c-format msgid "mount: %s%s is write-protected, mounting read-only" msgstr "mount: %s%s je chráněno proti zápisu, připojuji pouze pro čtení" -#: mount/mount.c:1598 +#: mount/mount.c:1607 #, c-format msgid "mount: no medium found on %s ...trying again\n" msgstr "mount: v %s nenalezeno žádné médium… zkouším znovu\n" -#: mount/mount.c:1604 +#: mount/mount.c:1613 #, c-format msgid "mount: no medium found on %s" msgstr "mount: v %s nenalezeno žádné médium" -#: mount/mount.c:1622 +#: mount/mount.c:1631 #, c-format msgid "" "mount: %s does not contain SELinux labels.\n" @@ -9317,28 +9149,27 @@ msgid "" msgstr "" "mount: %s neobsahuje značky SELinuxu.\n" " Právě jste připojili souborový systém, který značky podporuje, ale\n" -" neobsahuje ani jednu, do stroje s podporou SELinuxu. Je " -"pravděpodobné,\n" +" neobsahuje ani jednu, do stroje s podporou SELinuxu. Je pravděpodobné,\n" " že omezené aplikace budou generovat zprávy AVC a nebude jim dovoleno\n" " přistoupit na tento systém souborů. Další rady lze nalézt\n" " v restorecon(8) a mount(8).\n" -#: mount/mount.c:1701 +#: mount/mount.c:1710 #, c-format msgid "mount: no type was given - I'll assume nfs because of the colon\n" msgstr "mount: nebyl zadán typ - budu používat nfs kvůli dvojtečce\n" -#: mount/mount.c:1707 +#: mount/mount.c:1716 #, c-format msgid "mount: no type was given - I'll assume cifs because of the // prefix\n" msgstr "mount: nebyl zadán typ - budu předpokládat cifs kvůli předponě //\n" -#: mount/mount.c:1802 +#: mount/mount.c:1811 #, c-format msgid "mount: %s already mounted on %s\n" msgstr "mount: %s je již připojeno na %s\n" -#: mount/mount.c:1937 +#: mount/mount.c:1946 #, c-format msgid "" "Usage: mount -V : print version\n" @@ -9376,11 +9207,9 @@ msgid "" msgstr "" "Použití: mount -V : vypíše informace o verzi\n" " mount -h : vypíše tuto nápovědu\n" -" mount : zobrazí seznam připojených systémů " -"souborů\n" +" mount : zobrazí seznam připojených systémů souborů\n" " mount -l : totéž plus jmenovky svazků\n" -"Toto byly přepínače sloužící k získání informací. Nyní k přepínačům " -"sloužícím\n" +"Toto byly přepínače sloužící k získání informací. Nyní k přepínačům sloužícím\n" "k připojování systémů souborů.\n" "Syntaxe je „mount [-t SSTYP] NĚCO NĚKAM“.\n" "Údaje obsažené v /etc/fstab mohou být vynechány.\n" @@ -9388,8 +9217,7 @@ msgstr "" " mount ZAŘÍZENÍ : připojí ZAŘÍZENÍ na známé místo\n" " mount ADRESÁŘ : připojí známé zařízení k ADRESÁŘI\n" " mount -t TYP ZAŘ ADR : běžná podoba příkazu pro připojení\n" -"Uvědomte si, že tím, co se připojuje, ve skutečnosti není zařízení, ale " -"systém\n" +"Uvědomte si, že tím, co se připojuje, ve skutečnosti není zařízení, ale systém\n" "souborů (daného typu), který se na tomto zařízení nachází.\n" "Můžete také připojit již přístupný adresářový strom na jiné místo:\n" " mount --bind STARÝ_ADRESÁŘ NOVÝ_ADRESÁŘ\n" @@ -9411,24 +9239,24 @@ msgstr "" "Další přepínače: [-nfFrsvw] [-o VOLBY] [-p DESKRIPTOR_S_HESLEM].\n" "Mnoho dalších informací získáte příkazem „man 8 mount“.\n" -#: mount/mount.c:2265 +#: mount/mount.c:2274 #, c-format msgid "mount: only root can do that (effective UID is %d)" msgstr "mount: toto může provést pouze superuživatel (efektivní UID je %d)" -#: mount/mount.c:2268 +#: mount/mount.c:2277 msgid "mount: only root can do that" msgstr "mount: toto může provést pouze superuživatel" -#: mount/mount.c:2279 +#: mount/mount.c:2288 msgid "nothing was mounted" msgstr "nebyl připojen žádný diskový oddíl" -#: mount/mount.c:2297 mount/mount.c:2323 +#: mount/mount.c:2306 mount/mount.c:2332 msgid "mount: no such partition found" msgstr "mount: žádný odpovídající diskový oddíl nebyl nalezen" -#: mount/mount.c:2300 +#: mount/mount.c:2309 #, c-format msgid "mount: can't find %s in %s or %s" msgstr "mount: %s nelze nalézt v %s ani %s" @@ -9550,9 +9378,7 @@ msgstr "%s: zápis podpisu selhal" #: mount/swapon.c:350 #, c-format msgid "%s: found swap signature: version %d, page-size %d, %s byte order" -msgstr "" -"%s: nalezen podpis odkládacího prostoru: verze %d, velikost stránky %d, %s " -"řazení bajtů" +msgstr "%s: nalezen podpis odkládacího prostoru: verze %d, velikost stránky %d, %s řazení bajtů" # Last argument of "page-size %d, %s byte order" #: mount/swapon.c:355 @@ -9592,8 +9418,7 @@ msgstr "%s: nepodařilo se načíst hlavičku odkládací oblasti" #: mount/swapon.c:421 #, c-format msgid "%s: last_page 0x%08llx is larger than actual size of swapspace" -msgstr "" -"%s: last_page 0x%08llx je větší než současní velikost odkládacího prostoru" +msgstr "%s: last_page 0x%08llx je větší než současní velikost odkládacího prostoru" #: mount/swapon.c:426 #, c-format @@ -9602,17 +9427,13 @@ msgstr "%s: formát odkládacího prostoru se neshoduje ve velikosti stránky." #: mount/swapon.c:431 #, c-format -msgid "" -"%s: swap format pagesize does not match. (Use --fixpgsz to reinitialize it.)" -msgstr "" -"%s: formát odkládacího prostoru se neshoduje ve velikosti stránky. (Lze ji " -"reinicializovat pomocí --fixpgsz.)" +msgid "%s: swap format pagesize does not match. (Use --fixpgsz to reinitialize it.)" +msgstr "%s: formát odkládacího prostoru se neshoduje ve velikosti stránky. (Lze ji reinicializovat pomocí --fixpgsz.)" #: mount/swapon.c:440 #, c-format msgid "%s: software suspend data detected. Rewriting the swap signature." -msgstr "" -"%s: nalezena data ze softwarového uspání. Přepisuji podpis odkládací oblasti." +msgstr "%s: nalezena data ze softwarového uspání. Přepisuji podpis odkládací oblasti." #: mount/swapon.c:464 mount/swapon.c:514 #, c-format @@ -9641,8 +9462,7 @@ msgstr "%s: swapoff selhal" #: mount/swapon.c:797 #, c-format msgid "'%s' is unsupported program name (must be 'swapon' or 'swapoff')." -msgstr "" -"„%s“ není název podporovaného programu (musí být „swapon“ nebo „swapoff“)." +msgstr "„%s“ není název podporovaného programu (musí být „swapon“ nebo „swapoff“)." #: mount/umount.c:41 #, c-format @@ -9718,8 +9538,7 @@ msgstr "nenalezl jsem umount2, zkouším umount…\n" #: mount/umount.c:252 #, c-format msgid "umount: %s busy - remounted read-only\n" -msgstr "" -"umount: %s je právě používáno - znovu připojeno v režimu pro pouze čtení\n" +msgstr "umount: %s je právě používáno - znovu připojeno v režimu pro pouze čtení\n" #: mount/umount.c:263 #, c-format @@ -9837,8 +9656,7 @@ msgid "" "\n" msgstr "" "\n" -"chrt – zachází s vlastnostmi procesu týkajícími se plánování v reálném " -"čase.\n" +"chrt – zachází s vlastnostmi procesu týkajícími se plánování v reálném čase.\n" "\n" "Nastaví politiku:\n" " chrt [PŘEPÍNAČE] { | […]}\n" @@ -10015,12 +9833,10 @@ msgstr "" #: sys-utils/cytune.c:125 #, c-format msgid "" -"File %s, For threshold value %lu and timrout value %lu, Maximum characters " -"in fifo were %d,\n" +"File %s, For threshold value %lu and timrout value %lu, Maximum characters in fifo were %d,\n" "and the maximum transfer rate in characters/second was %f\n" msgstr "" -"Soubor %s, pro prahovou hodnotu %lu a časový limit %lu, maximální počet " -"znaků\n" +"Soubor %s, pro prahovou hodnotu %lu a časový limit %lu, maximální počet znaků\n" "ve fifo byl %d a maximální přenosová rychlost ve znacích za sekundu byla %f\n" #: sys-utils/cytune.c:189 @@ -10050,12 +9866,8 @@ msgstr "Chybný implicitní časový údaj: %s\n" #: sys-utils/cytune.c:238 #, c-format -msgid "" -"Usage: %s [-q [-i interval]] ([-s value]|[-S value]) ([-t value]|[-T value]) " -"[-g|-G] file [file...]\n" -msgstr "" -"Použití: %s [-q [-i interval]] ([-s hodnota]|[-S hodnota]) ([-t hodnota]|[-T " -"hodnota]) [-g|-G] soubor [soubor…]\n" +msgid "Usage: %s [-q [-i interval]] ([-s value]|[-S value]) ([-t value]|[-T value]) [-g|-G] file [file...]\n" +msgstr "Použití: %s [-q [-i interval]] ([-s hodnota]|[-S hodnota]) ([-t hodnota]|[-T hodnota]) [-g|-G] soubor [soubor…]\n" #: sys-utils/cytune.c:250 sys-utils/cytune.c:269 sys-utils/cytune.c:289 #: sys-utils/cytune.c:339 @@ -10108,11 +9920,8 @@ msgstr "CYGETMON nelze na %s provést: %s\n" #: sys-utils/cytune.c:418 #, c-format -msgid "" -"%s: %lu ints, %lu/%lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n" -msgstr "" -"%s: %lu přerušení, %lu/%lu znaků; fifo: %lu práh, %lu časový limit, %lu max, " -"%lu nyní\n" +msgid "%s: %lu ints, %lu/%lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n" +msgstr "%s: %lu přerušení, %lu/%lu znaků; fifo: %lu práh, %lu časový limit, %lu max, %lu nyní\n" #: sys-utils/cytune.c:424 #, c-format @@ -10121,11 +9930,8 @@ msgstr " %f přer./s; %f příj., %f odesl. (znak/s)\n" #: sys-utils/cytune.c:429 #, c-format -msgid "" -"%s: %lu ints, %lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n" -msgstr "" -"%s: %lu přerušení, %lu znaků; fifo: %lu práh, %lu časový limit, %lu max, %lu " -"nyní\n" +msgid "%s: %lu ints, %lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n" +msgstr "%s: %lu přerušení, %lu znaků; fifo: %lu práh, %lu časový limit, %lu max, %lu nyní\n" #: sys-utils/cytune.c:435 #, c-format @@ -10161,7 +9967,7 @@ msgstr "" #: sys-utils/fallocate.c:147 msgid "no length argument specified" -msgstr "nezadán artument s délkou" +msgstr "nezadán argument s délkou" #: sys-utils/fallocate.c:149 msgid "invalid length value specified" @@ -10331,8 +10137,7 @@ msgid "" " [-Q msgkey] [-M shmkey] [-S semkey] ... ]\n" msgstr "" "Použití: %s [ [-q ID_ZPRÁVY] [-m ID_SDÍLENÉ_PAMĚTI] [-s ID_SEMAFORU]\n" -" [-Q KLÍČ_ZPRÁVY] [-M KLÍČ_SDÍLENÉ_PAMĚTI] [-S KLÍČ_SEMAFORU] " -"… ]\n" +" [-Q KLÍČ_ZPRÁVY] [-M KLÍČ_SDÍLENÉ_PAMĚTI] [-S KLÍČ_SEMAFORU] … ]\n" #: sys-utils/ipcrm.c:179 #, c-format @@ -10403,8 +10208,7 @@ msgstr "\t%s -h pro nápovědu.\n" #: sys-utils/ipcs.c:124 #, c-format -msgid "" -"%s provides information on ipc facilities for which you have read access.\n" +msgid "%s provides information on ipc facilities for which you have read access.\n" msgstr "%s poskytuje informace o IPC prostředcích, které můžete číst.\n" #: sys-utils/ipcs.c:126 @@ -11050,9 +10854,8 @@ msgstr "" "# CPU,Jádro,Patice,Uzel" #: sys-utils/lscpu.c:619 -#, fuzzy msgid "CPU op-mode(s):" -msgstr "Patic CPU:" +msgstr "Operační režim(y) CPU:" #: sys-utils/lscpu.c:625 msgid "Thread(s) per core:" @@ -11072,7 +10875,7 @@ msgstr "Uzly NUMA:" #: sys-utils/lscpu.c:633 msgid "Vendor ID:" -msgstr "ID výrobce:" +msgstr "ID výrobce:" #: sys-utils/lscpu.c:635 msgid "CPU family:" @@ -11125,8 +10928,7 @@ msgstr "" "Nástroj pro popis architektury CPU\n" "\n" " -h, --help návod na použití\n" -" -p, --parse vypíše ve strojově zpracovatelné podobě namísto lidsky " -"čitelné\n" +" -p, --parse vypíše ve strojově zpracovatelné podobě namísto lidsky čitelné\n" " -s, --sysroot použije adresář jako kořen nového systému\n" #: sys-utils/lscpu.c:718 @@ -11139,8 +10941,7 @@ msgid "usage: rdev [ -rv ] [ -o OFFSET ] [ IMAGE [ VALUE [ OFFSET ] ] ]" msgstr "Použití: rdev [ -rv ] [ -o POSUN ] [ OBRAZ [ HODNOTA [ POSUN ] ] ]" #: sys-utils/rdev.c:78 -msgid "" -" rdev /dev/fd0 (or rdev /linux, etc.) displays the current ROOT device" +msgid " rdev /dev/fd0 (or rdev /linux, etc.) displays the current ROOT device" msgstr " rdev /dev/fd0 (či rdev /linux, etc.) vypíše aktuální ROOT zařízení" #: sys-utils/rdev.c:79 @@ -11149,8 +10950,7 @@ msgstr " rdev /dev/fd0 /dev/hda2 nastaví ROOT na /dev/hda2" #: sys-utils/rdev.c:80 msgid " rdev -R /dev/fd0 1 set the ROOTFLAGS (readonly status)" -msgstr "" -" rdev -R /dev/fd0 1 nastaví PŘÍZNAKY ROOT (pouze pro čtení)" +msgstr " rdev -R /dev/fd0 1 nastaví PŘÍZNAKY ROOT (pouze pro čtení)" #: sys-utils/rdev.c:81 msgid " rdev -r /dev/fd0 627 set the RAMDISK size" @@ -11177,10 +10977,8 @@ msgid " vidmode ... same as rdev -v" msgstr " vidmód ... stejné jako rdev -v" #: sys-utils/rdev.c:87 -msgid "" -"Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,..." -msgstr "" -"Poznámka: video módy: -3=Ask, -2=Extended, -1=NormalVga, 1=kláv1, 2=kláv2,..." +msgid "Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,..." +msgstr "Poznámka: video módy: -3=Ask, -2=Extended, -1=NormalVga, 1=kláv1, 2=kláv2,..." #: sys-utils/rdev.c:88 msgid " use -R 1 to mount root readonly, -R 0 for read/write." @@ -11234,8 +11032,7 @@ msgstr "readprofile: chyba při zápisu %s: %s\n" #: sys-utils/readprofile.c:268 #, c-format msgid "Assuming reversed byte order. Use -n to force native byte order.\n" -msgstr "" -"Předpokládám opačné pořadí bajtů. Systémové pořadí lze vynutit pomocí -n.\n" +msgstr "Předpokládám opačné pořadí bajtů. Systémové pořadí lze vynutit pomocí -n.\n" #: sys-utils/readprofile.c:284 #, c-format @@ -11455,8 +11252,7 @@ msgstr "" msgid "" " -h, --help displays this help text\n" " -v, --verbose says what options are being switched on\n" -" -R, --addr-no-randomize disables randomization of the virtual address " -"space\n" +" -R, --addr-no-randomize disables randomization of the virtual address space\n" " -F, --fdpic-funcptrs makes function pointers point to descriptors\n" " -Z, --mmap-page-zero turns on MMAP_PAGE_ZERO\n" " -L, --addr-compat-layout changes the way virtual memory is allocated\n" @@ -11465,8 +11261,7 @@ msgid "" " -I, --short-inode turns on SHORT_INODE\n" " -S, --whole-seconds turns on WHOLE_SECONDS\n" " -T, --sticky-timeouts turns on STICKY_TIMEOUTS\n" -" -3, --3gb limits the used address space to a maximum of 3 " -"GB\n" +" -3, --3gb limits the used address space to a maximum of 3 GB\n" " --4gb ignored (for backward compatibility only)\n" msgstr "" " -h, --help vypíše text této nápovědy\n" @@ -11474,8 +11269,7 @@ msgstr "" " -R, --addr-no-randomize vypne znáhodnění prostoru virtuálních adres\n" " -F, --fdpic-funcptrs učiní ukazatele funkcí ukazující na deskriptory\n" " -Z, --mmap-page-zero zapne MMAP_PAGE_ZERO\n" -" -L, --addr-compat-layout změní způsob, jakým je virtuální paměť " -"přidělována\n" +" -L, --addr-compat-layout změní způsob, jakým je virtuální paměť přidělována\n" " -X, --read-implies-exec zapne READ_IMPLIES_EXEC\n" " -B, --32bit zapne ADDR_LIMIT_32BIT\n" " -I, --short-inode zapne SHORT_INODE\n" @@ -11686,11 +11480,8 @@ msgstr "hexdump: chybná vzdálenost\n" #: text-utils/hexsyntax.c:131 #, c-format -msgid "" -"hexdump: [-bcCdovx] [-e fmt] [-f fmt_file] [-n length] [-s skip] [file ...]\n" -msgstr "" -"hexdump: [-bcCdovx] [-e FMT] [-f FMT_SOUBOR] [-n DÉLKA] [-s VZDÁLENOST] " -"[SOUBOR…]\n" +msgid "hexdump: [-bcCdovx] [-e fmt] [-f fmt_file] [-n length] [-s skip] [file ...]\n" +msgstr "hexdump: [-bcCdovx] [-e FMT] [-f FMT_SOUBOR] [-n DÉLKA] [-s VZDÁLENOST] [SOUBOR…]\n" #: text-utils/more.c:258 #, c-format @@ -11779,13 +11570,11 @@ msgstr "" #: text-utils/more.c:1328 msgid "" "\n" -"Most commands optionally preceded by integer argument k. Defaults in " -"brackets.\n" +"Most commands optionally preceded by integer argument k. Defaults in brackets.\n" "Star (*) indicates argument becomes new default.\n" msgstr "" "\n" -"Většině příkazů může jako argument předcházet celé číslo k. Implicitní " -"hodnoty\n" +"Většině příkazů může jako argument předcházet celé číslo k. Implicitní hodnoty\n" "jsou v hranatých závorkách. Hvězdička (*) znamená, že hodnota argumentu se\n" "stane implicitní.\n" @@ -11816,15 +11605,13 @@ msgstr "" "z Zobrazí dalších k řádků textu. [aktuální velikost\n" " obrazovky]*\n" " Zobrazí dalších k řádků textu. [1]*\n" -"d či ctrl-D Posun o k řádků [aktuální velikost posunu, po " -"spuštění\n" +"d či ctrl-D Posun o k řádků [aktuální velikost posunu, po spuštění\n" " 11]*\n" "q či Q či Ukončení programu\n" "s Posun vpřed o k řádků [1]\n" "f Posun vpřed o k stran [1]\n" "b či ctrl-B Posun vzad o k stran [1]\n" -"' Přeskočí na místo, kde bylo zahájeno předchozí " -"hledání\n" +"' Přeskočí na místo, kde bylo zahájeno předchozí hledání\n" "= Zobrazí číslo aktuálního řádku\n" "/ Hledá k. výskyt regulárního výrazu [1]\n" "n Hledá k. výrazu posledního regulárního výrazu [1]\n" @@ -11833,8 +11620,7 @@ msgstr "" "ctrl-L Překreslí obrazovku\n" ":n Přeskočí na k. následující soubor [1]\n" ":p Přeskočí na k. předcházející soubor [1]\n" -":f Vypíše jméno aktuálního souboru a číslo aktuálního " -"řádku\n" +":f Vypíše jméno aktuálního souboru a číslo aktuálního řádku\n" ". Zopakuje předcházející příkaz\n" #: text-utils/more.c:1404 text-utils/more.c:1409 @@ -11974,8 +11760,7 @@ msgid "" " n go to next file\n" "\n" "Many commands accept preceding numbers, for example:\n" -"+1 (next page); -1 (previous page); 1 (first " -"page).\n" +"+1 (next page); -1 (previous page); 1 (first page).\n" "\n" "See pg(1) for more information.\n" "-------------------------------------------------------\n" @@ -11992,17 +11777,14 @@ msgstr "" " /regex/ hledat regulárním výrazem směrem dopředu\n" " ?regex? or ^regex^ hledat regulárním výrazem směrem dozadu\n" " . or ^L překreslit obrazovku\n" -" w or z nastavit velikost stránky a přejít na další " -"stránku\n" +" w or z nastavit velikost stránky a přejít na další stránku\n" " s filename uložit současný soubor pod jménem\n" " !command utéct do shellu\n" " p přejít na předchozí soubor\n" " n přejít na další soubor\n" "\n" -"Mnoho příkazů přijímá předcházející čísla, na příklad: +1 " -"(další\n" -"stránka); -1 (předchozí stránka); 1 (první " -"stránka).\n" +"Mnoho příkazů přijímá předcházející čísla, na příklad: +1 (další\n" +"stránka); -1 (předchozí stránka); 1 (první stránka).\n" "\n" "Podrobnosti se lze dozvědět z pg(1).\n" "-------------------------------------------------------\n" @@ -12013,11 +11795,8 @@ msgstr "Nedostatek paměti\n" #: text-utils/pg.c:236 #, c-format -msgid "" -"%s: Usage: %s [-number] [-p string] [-cefnrs] [+line] [+/pattern/] [files]\n" -msgstr "" -"%s: Použití: %s [-ČÍSLO] [-p ŘETĚZEC] [-cefnrs] [+ŘÁDEK] [+/VZOREK/] " -"[SOUBOR…]\n" +msgid "%s: Usage: %s [-number] [-p string] [-cefnrs] [+line] [+/pattern/] [files]\n" +msgstr "%s: Použití: %s [-ČÍSLO] [-p ŘETĚZEC] [-cefnrs] [+ŘÁDEK] [+/VZOREK/] [SOUBOR…]\n" #: text-utils/pg.c:245 #, c-format @@ -12124,8 +11903,7 @@ msgstr "neúplný zápis do „%s“ (zapsáno %zd, očekáváno %zd)\n" #: text-utils/tailf.c:147 #, c-format msgid "%s: cannot add inotify watch (limit of inotify watches was reached)." -msgstr "" -"%s: nelze přidat sledování pomocí inotify (počet sledování inotify vyčerpán)." +msgstr "%s: nelze přidat sledování pomocí inotify (počet sledování inotify vyčerpán)." #: text-utils/tailf.c:151 #, c-format @@ -12175,11 +11953,81 @@ msgstr "Vstupní řádka je příliš dlouhá.\n" msgid "Out of memory when growing buffer.\n" msgstr "Nedostatek paměti pro rostoucí buffer.\n" +#~ msgid "" +#~ "Usage: fdisk [-b SSZ] [-u] DISK Change partition table\n" +#~ " fdisk -l [-b SSZ] [-u] DISK List partition table(s)\n" +#~ " fdisk -s PARTITION Give partition size(s) in blocks\n" +#~ " fdisk -v Give fdisk version\n" +#~ "Here DISK is something like /dev/hdb or /dev/sda\n" +#~ "and PARTITION is something like /dev/hda7\n" +#~ "-u: give Start and End in sector (instead of cylinder) units\n" +#~ "-b 2048: (for certain MO disks) use 2048-byte sectors\n" +#~ msgstr "" +#~ "Použití: fdisk [-b SSZ] [-u] DISK Změní tabulku rozdělení disku\n" +#~ " fdisk -l [-b SSZ] [-u] DISK Vypíše tabulku rozdělení disku\n" +#~ " fdisk -s ODDÍL Vypíše velikost diskového oddílu\n" +#~ " v blocích\n" +#~ " fdisk -v Vypíše informace o verzi\n" +#~ "DISK je něco jako /dev/hdb či /dev/sda a ODDÍL je něco jako /dev/hda7\n" +#~ "-u: vrací Začátek a Konec v sektorech (místo cylindrech)\n" +#~ "-b 2048: (pro některé MO jednotky) použije 2048bajtové sektory\n" + +#~ msgid "" +#~ "Usage: fdisk [-l] [-b SSZ] [-u] device\n" +#~ "E.g.: fdisk /dev/hda (for the first IDE disk)\n" +#~ " or: fdisk /dev/sdc (for the third SCSI disk)\n" +#~ " or: fdisk /dev/eda (for the first PS/2 ESDI drive)\n" +#~ " or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)\n" +#~ " ...\n" +#~ msgstr "" +#~ "Použití: fdisk [-l] [-b SSZ] [-u] zařízení\n" +#~ "Např: fdisk /dev/hda (pro první IDE disk)\n" +#~ " či: fdisk /dev/sdc (pro třetí SCSI disk)\n" +#~ " či: fdisk /dev/eda (pro první PS/2 ESDI disk)\n" +#~ " či: fdisk /dev/rd/c0d0 či: fdisk /dev/ida/c0d0 (pro RAID zařízení)\n" +#~ " …\n" + +#~ msgid "" +#~ "\n" +#~ "The number of cylinders for this disk is set to %d.\n" +#~ "There is nothing wrong with that, but this is larger than 1024,\n" +#~ "and could in certain setups cause problems with:\n" +#~ "1) software that runs at boot time (e.g., old versions of LILO)\n" +#~ "2) booting and partitioning software from other OSs\n" +#~ " (e.g., DOS FDISK, OS/2 FDISK)\n" +#~ msgstr "" +#~ "\n" +#~ "Počet cylindrů tohoto disku je nastaven na %d.\n" +#~ "Na tom není nic špatného, ale jelikož je to více než 1024,\n" +#~ "může za určitých okolností dojít k problémům:\n" +#~ "1) s programy spouštěnými při startu (např. staré verze LILA)\n" +#~ "2) s programy pro správu diskových oddílů z jiných OS\n" +#~ " (např. DOS FDISK, OS/2 FDISK)\n" + +#~ msgid "" +#~ "WARNING: The device does not provide compensation (alignment_offset)\n" +#~ "for DOS-compatible partitioning, but DOS-compatible mode is enabled.\n" +#~ "Use command 'c' to switch-off DOS mode.\n" +#~ "\n" +#~ msgstr "" +#~ "POZOR: Zařízení neposkytuje vyrovnání (alignment_offset) při dělení disku\n" +#~ "podle DOSu, avšak režim kompatibility s DOSem je zapnut.\n" +#~ "Použijte příkaz „c“ na vypnutí režimu DOSu.\n" + +#~ msgid "" +#~ "\n" +#~ "WARNING: the device provides alignment_offset, but the offset does not\n" +#~ "match with device geometry.\n" +#~ "\n" +#~ msgstr "" +#~ "\n" +#~ "POZOR: Zařízení poskytuje alignment_offset (zarovnávací posun), ale posun\n" +#~ "neodpovídá geometrii zařízení.\n" +#~ "\n" + # TODO: i18n second argument #~ msgid "%s: found %sswap v%d signature string for %d KiB PAGE_SIZE\n" -#~ msgstr "" -#~ "%s: nalezen podpis odkládacího prostoru %s v%d pro %dKiB " -#~ "VELIKOST_STRÁNKY\n" +#~ msgstr "%s: nalezen podpis odkládacího prostoru %s v%d pro %dKiB VELIKOST_STRÁNKY\n" # FIXME: Bad msgid: if is typo #~ msgid "out if memory" @@ -12216,13 +12064,11 @@ msgstr "Nedostatek paměti pro rostoucí buffer.\n" #~ msgid "" #~ "%s: Device '%s' contains a valid Sun disklabel.\n" #~ "This probably means creating v0 swap would destroy your partition table.\n" -#~ "No swap was created. If you really want to create v0 swap on that " -#~ "device,\n" +#~ "No swap was created. If you really want to create v0 swap on that device,\n" #~ "use the -f option to force it.\n" #~ msgstr "" #~ "%s: Zařízení „%s“ obsahuje korektní Sun popis disku.\n" -#~ "To znamená, že vytvoření odkládacího prostoru v0 by pravděpodobně " -#~ "zničilo\n" +#~ "To znamená, že vytvoření odkládacího prostoru v0 by pravděpodobně zničilo\n" #~ "tabulku rozdělení disku. Odkládací prostor nebyl vytvořen. Pokud opravdu\n" #~ "chcete na tomto zařízení vytvořit odkládací prostor v0, vynuťte si to\n" #~ "přepínačem -f.\n" @@ -12258,8 +12104,7 @@ msgstr "Nedostatek paměti pro rostoucí buffer.\n" #~ msgstr "mount: chystám se připojit %s podle %s\n" #~ msgid "mount: no LABEL=, no UUID=, going to mount %s by path\n" -#~ msgstr "" -#~ "mount: žádný LABEL=, žádný UUID=, chystám se připojit %s podle cesty\n" +#~ msgstr "mount: žádný LABEL=, žádný UUID=, chystám se připojit %s podle cesty\n" #~ msgid "%s: cannot fork: %s\n" #~ msgstr "%s: služba fork selhala: %s\n" @@ -12389,11 +12234,8 @@ msgstr "Nedostatek paměti pro rostoucí buffer.\n" #~ msgid "%s: cannot canonicalize %s: %s\n" #~ msgstr "%s: %s nelze převést na kanonický tvar: %s\n" -#~ msgid "" -#~ "usage: renice priority [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] users ]\n" -#~ msgstr "" -#~ "Použití: renice priorita [ [ -p ] pid ] [[ -g ] pgrp ] [ [ -u ] " -#~ "uživatel ]\n" +#~ msgid "usage: renice priority [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] users ]\n" +#~ msgstr "Použití: renice priorita [ [ -p ] pid ] [[ -g ] pgrp ] [ [ -u ] uživatel ]\n" #~ msgid "\t-%c\tEnable %s\n" #~ msgstr "\t-%c\tPovolí %s\n" @@ -12410,12 +12252,9 @@ msgstr "Nedostatek paměti pro rostoucí buffer.\n" #~ msgid "Password error." #~ msgstr "Chybné heslo." -#~ msgid "" -#~ "Exceeded MAXENTRIES. Raise this value in mkcramfs.c and recompile. " -#~ "Exiting.\n" +#~ msgid "Exceeded MAXENTRIES. Raise this value in mkcramfs.c and recompile. Exiting.\n" #~ msgstr "" -#~ "Překročeno MAXENTRIES. Zvětšete tuto hodnotu v mkcramfs.c a znovu " -#~ "přeložte.\n" +#~ "Překročeno MAXENTRIES. Zvětšete tuto hodnotu v mkcramfs.c a znovu přeložte.\n" #~ "Končím.\n" #~ msgid "Assuming pages of size %d (not %d)\n" @@ -12463,10 +12302,8 @@ msgstr "Nedostatek paměti pro rostoucí buffer.\n" #~ msgid "%s: error: the label %s occurs on both %s and %s\n" #~ msgstr "%s: chyba: jmenovka %s se nachází jak na %s tak i na %s\n" -#~ msgid "" -#~ "%s: could not open %s, so UUID and LABEL conversion cannot be done.\n" -#~ msgstr "" -#~ "%s: nelze otevřít %s, takže konverze UUID a JMENOVEK nebude provedena.\n" +#~ msgid "%s: could not open %s, so UUID and LABEL conversion cannot be done.\n" +#~ msgstr "%s: nelze otevřít %s, takže konverze UUID a JMENOVEK nebude provedena.\n" #~ msgid "%s: bad UUID" #~ msgstr "%s: chybné UUID" -- cgit v1.2.3 From 50ab03a8393785ee34047d8187fba67adfc8946c Mon Sep 17 00:00:00 2001 From: Santiago Vila Doncel Date: Mon, 7 Jun 2010 12:27:04 +0200 Subject: po: update es.po (from translationproject.org) --- po/es.po | 2341 ++++++++++++++++++++++++++------------------------------------ 1 file changed, 977 insertions(+), 1364 deletions(-) diff --git a/po/es.po b/po/es.po index 17182ca7..2efc6570 100644 --- a/po/es.po +++ b/po/es.po @@ -1,8 +1,11 @@ # Mensajes en espaol para util-linux. # Copyright (C) 2000 Beth Powell . # Copyright (C) 2001, 2002, 2003 Santiago Vila Doncel . +# +# This file is distributed under the same license as the util-linux-ng package. +# # Beth Powell , 2000. -# Santiago Vila Doncel , 2001, 2002, 2003, 2004. +# Santiago Vila Doncel , 2001, 2002, 2003, 2004, 2010. # # Permission is granted to freely copy and distribute # this file and modified versions, provided that this @@ -11,10 +14,10 @@ # msgid "" msgstr "" -"Project-Id-Version: util-linux 2.12m\n" +"Project-Id-Version: util-linux-ng 2.17.1-rc1\n" "Report-Msgid-Bugs-To: Karel Zak \n" -"POT-Creation-Date: 2010-01-07 21:55+0100\n" -"PO-Revision-Date: 2004-12-22 01:31+0100\n" +"POT-Creation-Date: 2010-02-16 10:22+0100\n" +"PO-Revision-Date: 2010-04-04 03:31+0200\n" "Last-Translator: Santiago Vila Doncel \n" "Language-Team: Spanish \n" "MIME-Version: 1.0\n" @@ -34,27 +37,24 @@ msgid "get read-only" msgstr "obtiene slo lectura" #: disk-utils/blockdev.c:82 -#, fuzzy msgid "get logical block (sector) size" -msgstr "obtiene el tamao del sector" +msgstr "obtiene el tamao del bloque lgico (sector)" #: disk-utils/blockdev.c:88 -#, fuzzy msgid "get physical block (sector) size" -msgstr "obtiene el tamao del sector" +msgstr "obtiene el tamao del bloque fsico (sector)" #: disk-utils/blockdev.c:94 msgid "get minimum I/O size" -msgstr "" +msgstr "obtiene el tamao mnimo de E/S" #: disk-utils/blockdev.c:100 msgid "get optimal I/O size" -msgstr "" +msgstr "obtiene el tamao ptimo de E/S" #: disk-utils/blockdev.c:106 -#, fuzzy msgid "get alignment offset" -msgstr "tamao de nodo-i incorrecto" +msgstr "" #: disk-utils/blockdev.c:112 #, fuzzy @@ -86,14 +86,12 @@ msgid "get readahead" msgstr "obtiene `readahead'" #: disk-utils/blockdev.c:157 -#, fuzzy msgid "set filesystem readahead" -msgstr "establece `readahead'" +msgstr "establece el `readahead' del sistema de ficheros" #: disk-utils/blockdev.c:163 -#, fuzzy msgid "get filesystem readahead" -msgstr "obtiene `readahead'" +msgstr "obtiene el `readahead' del sistema de ficheros" #: disk-utils/blockdev.c:167 msgid "flush buffers" @@ -124,9 +122,8 @@ msgid "Available commands:\n" msgstr "rdenes disponibles:\n" #: disk-utils/blockdev.c:187 -#, fuzzy msgid "get size in 512-byte sectors" -msgstr "obtiene el tamao en bytes" +msgstr "obtiene el tamao en sectores de 512 bytes" #: disk-utils/blockdev.c:321 #, c-format @@ -161,7 +158,7 @@ msgstr "%s: error de ioctl en %s\n" #: disk-utils/blockdev.c:481 #, fuzzy, c-format msgid "RO RA SSZ BSZ StartSec Size Device\n" -msgstr "RO RA SSZ BSZ StartSec Size Device\n" +msgstr "RO RA SSZ BSZ StartSec Size Device\n" #: disk-utils/elvtune.c:48 #, c-format @@ -290,13 +287,12 @@ msgstr "openpty ha fallado\n" #: disk-utils/fsck.cramfs.c:172 #, fuzzy, c-format msgid "ioctl failed: unable to determine device size: %s" -msgstr "" -"%s: atencin, no se puede determinar el tamao del sistema de ficheros\n" +msgstr "%s: atencin, no se puede determinar el tamao del sistema de ficheros\n" #: disk-utils/fsck.cramfs.c:180 -#, fuzzy, c-format +#, c-format msgid "not a block device or file: %s" -msgstr "%s no es un dispositivo de bloques o un fichero\n" +msgstr "no es un dispositivo de bloques o un fichero: %s" #: disk-utils/fsck.cramfs.c:184 disk-utils/fsck.cramfs.c:226 #, fuzzy @@ -311,7 +307,7 @@ msgstr "(Siguiente fichero: %s)" #: disk-utils/fsck.cramfs.c:207 msgid "superblock magic not found" -msgstr "" +msgstr "no se ha encontrado el nmero mgico del superbloque" #: disk-utils/fsck.cramfs.c:216 #, fuzzy @@ -319,9 +315,9 @@ msgid "unsupported filesystem features" msgstr "Escriba el tipo de sistema de ficheros: " #: disk-utils/fsck.cramfs.c:219 -#, fuzzy, c-format +#, c-format msgid "superblock size (%d) too small" -msgstr "Nmero de sectores" +msgstr "el tamao del superbloque (%d) es demasiado pequeo" #: disk-utils/fsck.cramfs.c:223 #, fuzzy @@ -340,7 +336,7 @@ msgstr "%s: atenci #: disk-utils/fsck.cramfs.c:246 msgid "unable to test CRC: old cramfs format" -msgstr "" +msgstr "no se puede comprobar CRC: formato cramfs antiguo" #: disk-utils/fsck.cramfs.c:272 disk-utils/fsck.cramfs.c:339 #: disk-utils/fsck.cramfs.c:477 login-utils/chfn.c:529 login-utils/chsh.c:439 @@ -349,9 +345,8 @@ msgid "malloc failed" msgstr "La asignacin de memoria (malloc) ha fallado" #: disk-utils/fsck.cramfs.c:297 -#, fuzzy msgid "crc error" -msgstr ", error" +msgstr "error de crc" #: disk-utils/fsck.cramfs.c:364 #, fuzzy @@ -370,7 +365,7 @@ msgstr "" #: disk-utils/fsck.cramfs.c:391 #, c-format msgid "decompression error %p(%d): %s" -msgstr "" +msgstr "error de descompresin %p(%d): %s" #: disk-utils/fsck.cramfs.c:415 #, fuzzy, c-format @@ -419,17 +414,17 @@ msgid "directory inode has zero offset and non-zero size: %s" msgstr "" #: disk-utils/fsck.cramfs.c:494 -#, fuzzy, c-format +#, c-format msgid "mkdir failed: %s" -msgstr "/dev: chdir() ha fallado: %m" +msgstr "mkdir fall: %s" #: disk-utils/fsck.cramfs.c:511 msgid "filename length is zero" -msgstr "" +msgstr "la longitud del nombre del fichero es cero" #: disk-utils/fsck.cramfs.c:514 msgid "bad filename length" -msgstr "" +msgstr "longitud errnea del nombre del fichero" #: disk-utils/fsck.cramfs.c:521 #, fuzzy @@ -450,7 +445,7 @@ msgstr "" #: disk-utils/fsck.cramfs.c:574 msgid "symbolic link has zero size" -msgstr "" +msgstr "el enlace simblico tiene tamao cero" #: disk-utils/fsck.cramfs.c:586 #, fuzzy, c-format @@ -483,9 +478,9 @@ msgid "bogus mode: %s (%o)" msgstr "%s: modo falso en `%s' (%o)\n" #: disk-utils/fsck.cramfs.c:646 -#, fuzzy, c-format +#, c-format msgid "mknod failed: %s" -msgstr "montaje errneo" +msgstr "mknod fall: %s" #: disk-utils/fsck.cramfs.c:682 #, c-format @@ -502,8 +497,7 @@ msgstr "" #: disk-utils/fsck.cramfs.c:690 #, fuzzy msgid "invalid file data offset" -msgstr "" -"%s: cramfs invlido, desplazamiento invlido de los datos de ficheros\n" +msgstr "%s: cramfs invlido, desplazamiento invlido de los datos de ficheros\n" #: disk-utils/fsck.cramfs.c:714 #, fuzzy @@ -861,8 +855,7 @@ msgstr "Forzando comprobaci #: disk-utils/fsck.minix.c:1342 #, c-format msgid "Filesystem on %s is dirty, needs checking.\n" -msgstr "" -"El sistema de ficheros en %s contiene elementos extraos; debe comprobarse.\n" +msgstr "El sistema de ficheros en %s contiene elementos extraos; debe comprobarse.\n" #: disk-utils/fsck.minix.c:1375 #, c-format @@ -993,7 +986,7 @@ msgstr "demasiados nodos-i; el m msgid "not enough space, need at least %llu blocks" msgstr "no hay suficiente espacio, se necesitan al menos %lu bloques" -#: disk-utils/mkfs.bfs.c:223 fdisk/fdisk.c:2580 +#: disk-utils/mkfs.bfs.c:223 fdisk/fdisk.c:2629 #, c-format msgid "Device: %s\n" msgstr "Dispositivo: %s\n" @@ -1082,8 +1075,7 @@ msgstr "mkfs versi #: disk-utils/mkfs.cramfs.c:126 #, fuzzy, c-format msgid "" -"usage: %s [-h] [-v] [-b blksize] [-e edition] [-N endian] [-i file] [-n " -"name] dirname outfile\n" +"usage: %s [-h] [-v] [-b blksize] [-e edition] [-N endian] [-i file] [-n name] dirname outfile\n" " -h print this help\n" " -v be verbose\n" " -E make all warnings errors (non-zero exit status)\n" @@ -1098,12 +1090,10 @@ msgid "" " dirname root of the filesystem to be compressed\n" " outfile output file\n" msgstr "" -"uso: %s [-h] [-v] [-b tambloq] [-e edicin] [-i fich] [-n nombre] nombredir " -"fsalida\n" +"uso: %s [-h] [-v] [-b tambloq] [-e edicin] [-i fich] [-n nombre] nombredir fsalida\n" " -h muestra esta ayuda\n" " -v s explicativo\n" -" -E convierte en errores todos los avisos (estado de salida no " -"cero)\n" +" -E convierte en errores todos los avisos (estado de salida no cero)\n" " -b tambloq utiliza este tamao de bloque, debe ser el tamao de pgina\n" " -e edicin establece el nmero de edicin (parte de fsid)\n" " -i fich inserta la imagen de un fichero dentro del sistema de ficheros\n" @@ -1122,8 +1112,7 @@ msgid "" " Please increase MAX_INPUT_NAMELEN in mkcramfs.c and recompile. Exiting.\n" msgstr "" "Se encontr un nombre de fichero `%2$s' demasiado largo (%1$u bytes).\n" -" Por favor incremente MAX_INPUT_NAMELEN en mkcramfs.c y recompile. " -"Saliendo.\n" +" Por favor incremente MAX_INPUT_NAMELEN en mkcramfs.c y recompile. Saliendo.\n" #: disk-utils/mkfs.cramfs.c:471 #, c-format @@ -1142,9 +1131,7 @@ msgstr "%6.2f%% (%+d bytes)\t%s\n" #: disk-utils/mkfs.cramfs.c:853 #, fuzzy, c-format -msgid "" -"warning: guestimate of required size (upper bound) is %lldMB, but maximum " -"image size is %uMB. We might die prematurely.\n" +msgid "warning: guestimate of required size (upper bound) is %lldMB, but maximum image size is %uMB. We might die prematurely.\n" msgstr "" "atencin: la estimacin del tamao requerido (cota superior) es %LdMB, pero\n" "el tamao mximo de la imagen es %uMB. Podra abortarse prematuramente.\n" @@ -1181,8 +1168,7 @@ msgstr "CRC: %x\n" #: disk-utils/mkfs.cramfs.c:925 #, fuzzy, c-format msgid "not enough space allocated for ROM image (%lld allocated, %zu used)\n" -msgstr "" -"no hay suficiente espacio para la imagen ROM (asignado %Ld, usado %d)\n" +msgstr "no hay suficiente espacio para la imagen ROM (asignado %Ld, usado %d)\n" #: disk-utils/mkfs.cramfs.c:933 msgid "ROM image" @@ -1206,21 +1192,18 @@ msgstr "atenci #: disk-utils/mkfs.cramfs.c:952 #, c-format msgid "warning: file sizes truncated to %luMB (minus 1 byte).\n" -msgstr "" -"atencin: los tamaos de los ficheros se truncan a %luMB (menos 1 byte).\n" +msgstr "atencin: los tamaos de los ficheros se truncan a %luMB (menos 1 byte).\n" #: disk-utils/mkfs.cramfs.c:957 #, c-format -msgid "" -"warning: uids truncated to %u bits. (This may be a security concern.)\n" +msgid "warning: uids truncated to %u bits. (This may be a security concern.)\n" msgstr "" "atencin: los uids se truncan a %u bites. (Esto podra ser un problema\n" "de seguridad.)\n" #: disk-utils/mkfs.cramfs.c:962 #, c-format -msgid "" -"warning: gids truncated to %u bits. (This may be a security concern.)\n" +msgid "warning: gids truncated to %u bits. (This may be a security concern.)\n" msgstr "" "atencin: los gids se truncan a %u bits. (Esto podra ser un problema\n" "de seguridad).\n" @@ -1232,8 +1215,7 @@ msgid "" "that some device files will be wrong.\n" msgstr "" "ATENCIN: los nmeros de dispositivo se truncan a %u bits. Esto\n" -"significa casi con certeza que algunos ficheros de dispositivos sern " -"errneos.\n" +"significa casi con certeza que algunos ficheros de dispositivos sern errneos.\n" #: disk-utils/mkfs.minix.c:154 #, c-format @@ -1412,7 +1394,7 @@ msgstr "etiqueta" #: disk-utils/mkswap.c:218 #, c-format msgid "no uuid\n" -msgstr "" +msgstr "no hay uuid\n" #: disk-utils/mkswap.c:283 #, fuzzy, c-format @@ -1472,9 +1454,9 @@ msgid " on whole disk. " msgstr " s Muestra la etiqueta del disco completa" #: disk-utils/mkswap.c:454 -#, fuzzy, c-format +#, c-format msgid " (compiled without libblkid). " -msgstr " s Muestra la etiqueta del disco completa" +msgstr "" #: disk-utils/mkswap.c:524 #, c-format @@ -1496,8 +1478,7 @@ msgstr "" #: disk-utils/mkswap.c:559 #, c-format msgid "%s: error: Nowhere to set up swap on?\n" -msgstr "" -"%s: error: no se ha especificado dnde configurar el espacio de intercambio\n" +msgstr "%s: error: no se ha especificado dnde configurar el espacio de intercambio\n" #: disk-utils/mkswap.c:577 #, fuzzy, c-format @@ -1575,8 +1556,7 @@ msgstr "Uso:\n" #: disk-utils/raw.c:125 #, c-format -msgid "" -"Device '%s' is control raw dev (use raw where is greater than zero)\n" +msgid "Device '%s' is control raw dev (use raw where is greater than zero)\n" msgstr "" #: disk-utils/raw.c:145 @@ -1607,7 +1587,7 @@ msgstr "/dev/%s: no es un dispositivo de caracteres" #: disk-utils/raw.c:216 #, fuzzy, c-format msgid "Device '%s' is not a raw dev\n" -msgstr "%s no es un dispositivo de bloques" +msgstr "Atencin: %s no es un dispositivo de bloques\n" #: disk-utils/raw.c:231 #, c-format @@ -1677,8 +1657,7 @@ msgstr "Se ha modificado el disco.\n" #, c-format msgid "Reboot the system to ensure the partition table is correctly updated.\n" msgstr "" -"Reinicie el sistema para asegurarse de que la tabla de particiones est " -"bien\n" +"Reinicie el sistema para asegurarse de que la tabla de particiones est bien\n" "actualizada.\n" #: fdisk/cfdisk.c:421 @@ -1751,21 +1730,16 @@ msgid "enlarged logical partitions overlap" msgstr "Solapamiento de particiones lgicas ampliadas" #: fdisk/cfdisk.c:1003 -msgid "" -"!!!! Internal error creating logical drive with no extended partition !!!!" +msgid "!!!! Internal error creating logical drive with no extended partition !!!!" msgstr " Error interno al crear unidad lgica sin particin extendida !!!!" #: fdisk/cfdisk.c:1014 fdisk/cfdisk.c:1026 -msgid "" -"Cannot create logical drive here -- would create two extended partitions" -msgstr "" -"No se puede crear una unidad lgica aqu; se crearan dos particiones " -"extendidas" +msgid "Cannot create logical drive here -- would create two extended partitions" +msgstr "No se puede crear una unidad lgica aqu; se crearan dos particiones extendidas" #: fdisk/cfdisk.c:1168 msgid "Menu item too long. Menu may look odd." -msgstr "" -"Elemento de men demasiado largo; la apariencia del men puede ser extraa." +msgstr "Elemento de men demasiado largo; la apariencia del men puede ser extraa." #: fdisk/cfdisk.c:1224 #, fuzzy @@ -1864,12 +1838,10 @@ msgstr "No se puede abrir la unidad de disco" #: fdisk/cfdisk.c:1676 fdisk/cfdisk.c:1865 msgid "Opened disk read-only - you have no permission to write" -msgstr "" -"El disco abierto es de slo lectura; no tiene permiso para escribir en l" +msgstr "El disco abierto es de slo lectura; no tiene permiso para escribir en l" #: fdisk/cfdisk.c:1687 -msgid "" -"Warning!! Unsupported GPT (GUID Partition Table) detected. Use GNU Parted." +msgid "Warning!! Unsupported GPT (GUID Partition Table) detected. Use GNU Parted." msgstr "" #: fdisk/cfdisk.c:1706 @@ -1889,12 +1861,10 @@ msgid "Warning!! This may destroy data on your disk!" msgstr "Atencin!: esta operacin puede destruir datos del disco" #: fdisk/cfdisk.c:1881 -#, fuzzy -msgid "" -"Are you sure you want to write the partition table to disk? (yes or no): " +msgid "Are you sure you want to write the partition table to disk? (yes or no): " msgstr "" "Est seguro de que desea escribir la tabla de particiones en el disco?\n" -" (s o no): " +" (si o no): " #: fdisk/cfdisk.c:1887 msgid "no" @@ -1906,11 +1876,11 @@ msgstr "No se ha escrito la tabla de particiones en el disco" #: fdisk/cfdisk.c:1891 msgid "yes" -msgstr "s" +msgstr "si" #: fdisk/cfdisk.c:1895 msgid "Please enter `yes' or `no'" -msgstr "Por favor escriba `s' (con acento) o `no'" +msgstr "Por favor escriba `si' (sin acento) o `no'" #: fdisk/cfdisk.c:1899 msgid "Writing partition table to disk..." @@ -1922,9 +1892,7 @@ msgstr "Se ha escrito la tabla de particiones en el disco" #: fdisk/cfdisk.c:1926 #, fuzzy -msgid "" -"Wrote partition table, but re-read table failed. Run partprobe(8), kpartx" -"(8) or reboot to update table." +msgid "Wrote partition table, but re-read table failed. Run partprobe(8), kpartx(8) or reboot to update table." msgstr "" "Se ha escrito la tabla de particiones, pero la nueva lectura de la tabla\n" "ha fallado. Reinicie para actualizar la tabla." @@ -1936,16 +1904,14 @@ msgstr "" "El MBR de DOS no podr iniciar esto." #: fdisk/cfdisk.c:1938 -msgid "" -"More than one primary partition is marked bootable. DOS MBR cannot boot this." +msgid "More than one primary partition is marked bootable. DOS MBR cannot boot this." msgstr "" "Hay marcada como iniciable ms de una particin primaria.\n" "El MBR de DOS no puede iniciar esto." #: fdisk/cfdisk.c:1996 fdisk/cfdisk.c:2115 fdisk/cfdisk.c:2199 msgid "Enter filename or press RETURN to display on screen: " -msgstr "" -"Escriba el nombre de fichero o pulse Intro para visualizar en pantalla: " +msgstr "Escriba el nombre de fichero o pulse Intro para visualizar en pantalla: " #: fdisk/cfdisk.c:2005 fdisk/cfdisk.c:2123 fdisk/cfdisk.c:2207 #, c-format @@ -1983,12 +1949,12 @@ msgstr " Primaria" msgid " Logical" msgstr " Lgica" -#: fdisk/cfdisk.c:2089 fdisk/fdisk.c:1716 fdisk/fdisk.c:2050 -#: fdisk/fdisksgilabel.c:227 fdisk/fdisksunlabel.c:621 fdisk/sfdisk.c:638 +#: fdisk/cfdisk.c:2089 fdisk/fdisk.c:1761 fdisk/fdisk.c:2100 +#: fdisk/fdisksgilabel.c:227 fdisk/fdisksunlabel.c:616 fdisk/sfdisk.c:638 msgid "Unknown" msgstr "Desconocido" -#: fdisk/cfdisk.c:2095 fdisk/cfdisk.c:2563 fdisk/fdisksunlabel.c:44 +#: fdisk/cfdisk.c:2095 fdisk/cfdisk.c:2563 fdisk/fdisksunlabel.c:39 msgid "Boot" msgstr "Inicio" @@ -2012,20 +1978,12 @@ msgid " First Last\n" msgstr " Primer ltimo\n" #: fdisk/cfdisk.c:2137 -msgid "" -" # Type Sector Sector Offset Length Filesystem Type (ID) " -"Flag\n" -msgstr "" -"N Tipo Sector Sector Despl. Longitud Tipo sist. fich. (ID) " -"Indicad.\n" +msgid " # Type Sector Sector Offset Length Filesystem Type (ID) Flag\n" +msgstr "N Tipo Sector Sector Despl. Longitud Tipo sist. fich. (ID) Indicad.\n" #: fdisk/cfdisk.c:2138 -msgid "" -"-- ------- ----------- ----------- ------ ----------- -------------------- " -"----\n" -msgstr "" -"-- ------- ----------- ----------- ------ ----------- -------------------- " -"----\n" +msgid "-- ------- ----------- ----------- ------ ----------- -------------------- ----\n" +msgstr "-- ------- ----------- ----------- ------ ----------- -------------------- ----\n" #: fdisk/cfdisk.c:2221 #, fuzzy @@ -2108,8 +2066,7 @@ msgstr " d Suprime la partici #: fdisk/cfdisk.c:2299 msgid " g Change cylinders, heads, sectors-per-track parameters" -msgstr "" -" g Cambia los parmetros de cilindros, cabezas y sectores por pista" +msgstr " g Cambia los parmetros de cilindros, cabezas y sectores por pista" #: fdisk/cfdisk.c:2300 msgid " WARNING: This option should only be used by people who" @@ -2141,8 +2098,7 @@ msgstr " n Crea una nueva partici #: fdisk/cfdisk.c:2307 msgid " p Print partition table to the screen or to a file" -msgstr "" -" p Imprime la tabla de particiones en la pantalla o en un fichero" +msgstr " p Imprime la tabla de particiones en la pantalla o en un fichero" #: fdisk/cfdisk.c:2308 msgid " There are several different formats for the partition" @@ -2154,9 +2110,7 @@ msgstr " entre los que puede elegir:" #: fdisk/cfdisk.c:2310 msgid " r - Raw data (exactly what would be written to disk)" -msgstr "" -" r - Datos en bruto (exactamente lo que escribira en el " -"disco)" +msgstr " r - Datos en bruto (exactamente lo que escribira en el disco)" #: fdisk/cfdisk.c:2311 msgid " s - Table ordered by sectors" @@ -2176,8 +2130,7 @@ msgstr " t Cambia el tipo de sistema de ficheros" #: fdisk/cfdisk.c:2315 msgid " u Change units of the partition size display" -msgstr "" -" u Cambia las unidades de visualizacin del tamao de la particin" +msgstr " u Cambia las unidades de visualizacin del tamao de la particin" #: fdisk/cfdisk.c:2316 msgid " Rotates through MB, sectors and cylinders" @@ -2185,8 +2138,7 @@ msgstr " Alterna entre MB, sectores y cilindros" #: fdisk/cfdisk.c:2317 msgid " W Write partition table to disk (must enter upper case W)" -msgstr "" -" W Escribe la tabla de particiones en el disco (W en maysculas)" +msgstr " W Escribe la tabla de particiones en el disco (W en maysculas)" #: fdisk/cfdisk.c:2318 msgid " Since this might destroy data on the disk, you must" @@ -2194,8 +2146,7 @@ msgstr " Esta operaci #: fdisk/cfdisk.c:2319 msgid " either confirm or deny the write by entering `yes' or" -msgstr "" -" de datos del disco, por lo que debe confirmarla o rechazarla" +msgstr " de datos del disco, por lo que debe confirmarla o rechazarla" #: fdisk/cfdisk.c:2320 msgid " `no'" @@ -2225,7 +2176,7 @@ msgstr "Nota: todas las msgid "case letters (except for Writes)." msgstr "(salvo W para operaciones de escritura)." -#: fdisk/cfdisk.c:2358 fdisk/fdisksunlabel.c:237 +#: fdisk/cfdisk.c:2358 fdisk/fdisksunlabel.c:232 msgid "Cylinders" msgstr "Cilindros" @@ -2233,7 +2184,7 @@ msgstr "Cilindros" msgid "Change cylinder geometry" msgstr "Cambia la geometra de cilindros" -#: fdisk/cfdisk.c:2359 fdisk/fdisksunlabel.c:235 +#: fdisk/cfdisk.c:2359 fdisk/fdisksunlabel.c:230 msgid "Heads" msgstr "Cabezas" @@ -2257,7 +2208,7 @@ msgstr "Ha finalizado la operaci msgid "Enter the number of cylinders: " msgstr "Escriba el nmero de cilindros: " -#: fdisk/cfdisk.c:2385 fdisk/cfdisk.c:2956 +#: fdisk/cfdisk.c:2385 fdisk/cfdisk.c:2958 msgid "Illegal cylinders value" msgstr "Valor de cilindros no permitido" @@ -2265,7 +2216,7 @@ msgstr "Valor de cilindros no permitido" msgid "Enter the number of heads: " msgstr "Escriba el nmero de cabezas: " -#: fdisk/cfdisk.c:2398 fdisk/cfdisk.c:2966 +#: fdisk/cfdisk.c:2398 fdisk/cfdisk.c:2968 msgid "Illegal heads value" msgstr "Valor de cabezas no permitido" @@ -2273,7 +2224,7 @@ msgstr "Valor de cabezas no permitido" msgid "Enter the number of sectors per track: " msgstr "Escriba el nmero de sectores por pista: " -#: fdisk/cfdisk.c:2411 fdisk/cfdisk.c:2973 +#: fdisk/cfdisk.c:2411 fdisk/cfdisk.c:2975 msgid "Illegal sectors value" msgstr "Valor de sectores no permitido" @@ -2368,134 +2319,132 @@ msgstr " Tama msgid " Size (GB)" msgstr "Tamao (GB)" -#: fdisk/cfdisk.c:2747 +#: fdisk/cfdisk.c:2748 msgid "Bootable" msgstr "Iniciable" -#: fdisk/cfdisk.c:2747 +#: fdisk/cfdisk.c:2748 msgid "Toggle bootable flag of the current partition" msgstr "Conmuta el indicador de iniciable de la particin actual" -#: fdisk/cfdisk.c:2748 +#: fdisk/cfdisk.c:2749 msgid "Delete" msgstr "Suprimir" -#: fdisk/cfdisk.c:2748 +#: fdisk/cfdisk.c:2749 msgid "Delete the current partition" msgstr "Suprime la particin actual" -#: fdisk/cfdisk.c:2749 +#: fdisk/cfdisk.c:2750 msgid "Geometry" msgstr "Geometra" -#: fdisk/cfdisk.c:2749 +#: fdisk/cfdisk.c:2750 msgid "Change disk geometry (experts only)" msgstr "Cambia la geometra del disco (slo para usuarios avanzados)" -#: fdisk/cfdisk.c:2750 +#: fdisk/cfdisk.c:2751 msgid "Help" msgstr "Ayuda" -#: fdisk/cfdisk.c:2750 +#: fdisk/cfdisk.c:2751 msgid "Print help screen" msgstr "Imprime esta pantalla" -#: fdisk/cfdisk.c:2751 +#: fdisk/cfdisk.c:2752 msgid "Maximize" msgstr "Maximizar" -#: fdisk/cfdisk.c:2751 +#: fdisk/cfdisk.c:2752 msgid "Maximize disk usage of the current partition (experts only)" -msgstr "" -"Maximiza el uso de disco de la particin actual (slo usuarios avanzados)" +msgstr "Maximiza el uso de disco de la particin actual (slo usuarios avanzados)" -#: fdisk/cfdisk.c:2752 +#: fdisk/cfdisk.c:2753 msgid "New" msgstr "Nueva" -#: fdisk/cfdisk.c:2752 +#: fdisk/cfdisk.c:2753 msgid "Create new partition from free space" msgstr "Crea una nueva particin a partir del espacio libre" -#: fdisk/cfdisk.c:2753 +#: fdisk/cfdisk.c:2754 msgid "Print" msgstr "Imprimir" -#: fdisk/cfdisk.c:2753 +#: fdisk/cfdisk.c:2754 msgid "Print partition table to the screen or to a file" msgstr "Imprime la tabla de particiones en la pantalla o en un fichero" -#: fdisk/cfdisk.c:2754 +#: fdisk/cfdisk.c:2755 msgid "Quit" msgstr "Salir" -#: fdisk/cfdisk.c:2754 +#: fdisk/cfdisk.c:2755 msgid "Quit program without writing partition table" msgstr "Sale del programa sin escribir la tabla de particiones" -#: fdisk/cfdisk.c:2755 +#: fdisk/cfdisk.c:2756 msgid "Type" msgstr "Tipo" -#: fdisk/cfdisk.c:2755 +#: fdisk/cfdisk.c:2756 msgid "Change the filesystem type (DOS, Linux, OS/2 and so on)" msgstr "Cambia el tipo de sistema de ficheros (DOS, Linux, OS/2, etc.)" -#: fdisk/cfdisk.c:2756 +#: fdisk/cfdisk.c:2757 msgid "Units" msgstr "Unidades" -#: fdisk/cfdisk.c:2756 +#: fdisk/cfdisk.c:2757 msgid "Change units of the partition size display (MB, sect, cyl)" msgstr "Cambia las unidades para el tamao de la particin (MB, sect., cil.)" -#: fdisk/cfdisk.c:2757 +#: fdisk/cfdisk.c:2758 msgid "Write" msgstr "Escribir" -#: fdisk/cfdisk.c:2757 +#: fdisk/cfdisk.c:2758 msgid "Write partition table to disk (this might destroy data)" -msgstr "" -"Escribe la tabla de particiones en el disco (puede destruirse informacin)" +msgstr "Escribe la tabla de particiones en el disco (puede destruirse informacin)" -#: fdisk/cfdisk.c:2803 +#: fdisk/cfdisk.c:2805 msgid "Cannot make this partition bootable" msgstr "No se puede convertir esta particin en una particin iniciable" -#: fdisk/cfdisk.c:2813 +#: fdisk/cfdisk.c:2815 msgid "Cannot delete an empty partition" msgstr "No se puede suprimir una particin vaca" -#: fdisk/cfdisk.c:2833 fdisk/cfdisk.c:2835 +#: fdisk/cfdisk.c:2835 fdisk/cfdisk.c:2837 msgid "Cannot maximize this partition" msgstr "No se puede maximizar esta particin" -#: fdisk/cfdisk.c:2843 +#: fdisk/cfdisk.c:2845 msgid "This partition is unusable" msgstr "Esta particin se encuentra en estado inutilizable" -#: fdisk/cfdisk.c:2845 +#: fdisk/cfdisk.c:2847 msgid "This partition is already in use" msgstr "Esta particin ya est en uso" -#: fdisk/cfdisk.c:2862 +#: fdisk/cfdisk.c:2864 msgid "Cannot change the type of an empty partition" msgstr "No se puede cambiar el tipo de una particin vaca" -#: fdisk/cfdisk.c:2889 fdisk/cfdisk.c:2895 +#: fdisk/cfdisk.c:2891 fdisk/cfdisk.c:2897 msgid "No more partitions" msgstr "No hay ms particiones" -#: fdisk/cfdisk.c:2902 +#: fdisk/cfdisk.c:2904 msgid "Illegal command" msgstr "Orden ilegal" -#: fdisk/cfdisk.c:2912 +#: fdisk/cfdisk.c:2914 #, c-format msgid "Copyright (C) 1994-2002 Kevin E. Martin & aeb\n" msgstr "Copyright (C) 1994-2002 Kevin E. Martin & aeb\n" -#: fdisk/cfdisk.c:2919 +#: fdisk/cfdisk.c:2921 #, c-format msgid "" "\n" @@ -2567,9 +2516,9 @@ msgstr "" "\n" "Etiqueta BSD para el dispositivo: %s\n" -#: fdisk/fdiskbsdlabel.c:128 fdisk/fdisk.c:390 fdisk/fdisk.c:409 -#: fdisk/fdisk.c:427 fdisk/fdisk.c:434 fdisk/fdisk.c:457 fdisk/fdisk.c:475 -#: fdisk/fdisk.c:491 fdisk/fdisk.c:507 +#: fdisk/fdiskbsdlabel.c:128 fdisk/fdisk.c:394 fdisk/fdisk.c:413 +#: fdisk/fdisk.c:431 fdisk/fdisk.c:438 fdisk/fdisk.c:461 fdisk/fdisk.c:479 +#: fdisk/fdisk.c:495 fdisk/fdisk.c:511 msgid "Command action" msgstr "Orden Accin" @@ -2589,9 +2538,9 @@ msgstr " i Instala secuencia de inicio" msgid " l list known filesystem types" msgstr " l Lista los tipos de sistemas de ficheros conocidos" -#: fdisk/fdiskbsdlabel.c:133 fdisk/fdisk.c:396 fdisk/fdisk.c:415 -#: fdisk/fdisk.c:428 fdisk/fdisk.c:440 fdisk/fdisk.c:465 fdisk/fdisk.c:482 -#: fdisk/fdisk.c:498 fdisk/fdisk.c:516 +#: fdisk/fdiskbsdlabel.c:133 fdisk/fdisk.c:400 fdisk/fdisk.c:419 +#: fdisk/fdisk.c:432 fdisk/fdisk.c:444 fdisk/fdisk.c:469 fdisk/fdisk.c:486 +#: fdisk/fdisk.c:502 fdisk/fdisk.c:520 msgid " m print this menu" msgstr " m Imprime este men" @@ -2603,14 +2552,14 @@ msgstr " n A msgid " p print BSD partition table" msgstr " p Imprime la tabla de particiones BSD" -#: fdisk/fdiskbsdlabel.c:136 fdisk/fdisk.c:400 fdisk/fdisk.c:419 -#: fdisk/fdisk.c:430 fdisk/fdisk.c:444 fdisk/fdisk.c:467 fdisk/fdisk.c:484 -#: fdisk/fdisk.c:500 fdisk/fdisk.c:518 +#: fdisk/fdiskbsdlabel.c:136 fdisk/fdisk.c:404 fdisk/fdisk.c:423 +#: fdisk/fdisk.c:434 fdisk/fdisk.c:448 fdisk/fdisk.c:471 fdisk/fdisk.c:488 +#: fdisk/fdisk.c:504 fdisk/fdisk.c:522 msgid " q quit without saving changes" msgstr " q Sale sin guardar los cambios" -#: fdisk/fdiskbsdlabel.c:137 fdisk/fdisk.c:468 fdisk/fdisk.c:485 -#: fdisk/fdisk.c:501 fdisk/fdisk.c:519 +#: fdisk/fdiskbsdlabel.c:137 fdisk/fdisk.c:472 fdisk/fdisk.c:489 +#: fdisk/fdisk.c:505 fdisk/fdisk.c:523 msgid " r return to main menu" msgstr " r Vuelve al men principal" @@ -2620,8 +2569,7 @@ msgstr " s Muestra la etiqueta del disco completa" #: fdisk/fdiskbsdlabel.c:139 msgid " t change a partition's filesystem id" -msgstr "" -" t Cambia el identificador del sistema de ficheros de una particin" +msgstr " t Cambia el identificador del sistema de ficheros de una particin" #: fdisk/fdiskbsdlabel.c:140 msgid " u change units (cylinders/sectors)" @@ -2654,13 +2602,13 @@ msgstr "No hay ninguna partici msgid "BSD disklabel command (m for help): " msgstr "Orden de etiqueta de disco BSD (m para obtener ayuda): " -#: fdisk/fdiskbsdlabel.c:283 fdisk/fdisk.c:2272 fdisk/fdisksgilabel.c:638 -#: fdisk/fdisksunlabel.c:431 +#: fdisk/fdiskbsdlabel.c:283 fdisk/fdisk.c:2322 fdisk/fdisksgilabel.c:638 +#: fdisk/fdisksunlabel.c:426 #, c-format msgid "First %s" msgstr "Primer %s" -#: fdisk/fdiskbsdlabel.c:290 fdisk/fdisksunlabel.c:488 +#: fdisk/fdiskbsdlabel.c:290 fdisk/fdisksunlabel.c:483 #, c-format msgid "Last %s or +size or +sizeM or +sizeK" msgstr "ltimo %s o +tamao o +tamaoM o +tamaoK" @@ -2805,7 +2753,7 @@ msgstr "sectores/pista" msgid "tracks/cylinder" msgstr "pistas/cilindro" -#: fdisk/fdiskbsdlabel.c:469 fdisk/fdisk.c:725 fdisk/fdisk.c:1541 +#: fdisk/fdiskbsdlabel.c:469 fdisk/fdisk.c:740 fdisk/fdisk.c:1586 #: fdisk/sfdisk.c:930 msgid "cylinders" msgstr "cilindros" @@ -2863,7 +2811,7 @@ msgstr "Secuencia de inicio instalada en %s.\n" msgid "Partition (a-%c): " msgstr "Particin (a-%c): " -#: fdisk/fdiskbsdlabel.c:617 fdisk/fdisk.c:2436 +#: fdisk/fdiskbsdlabel.c:617 fdisk/fdisk.c:2485 #, c-format msgid "The maximum number of partitions has been created\n" msgstr "Se ha creado el nmero mximo de particiones\n" @@ -2887,226 +2835,208 @@ msgstr "" "\n" "Se estn sincronizando los discos.\n" -#: fdisk/fdisk.c:248 -msgid "" -"Usage: fdisk [-b SSZ] [-u] DISK Change partition table\n" -" fdisk -l [-b SSZ] [-u] DISK List partition table(s)\n" -" fdisk -s PARTITION Give partition size(s) in blocks\n" -" fdisk -v Give fdisk version\n" -"Here DISK is something like /dev/hdb or /dev/sda\n" -"and PARTITION is something like /dev/hda7\n" -"-u: give Start and End in sector (instead of cylinder) units\n" -"-b 2048: (for certain MO disks) use 2048-byte sectors\n" -msgstr "" -"Uso: fdisk [-b SSZ] [-u] DISCO Cambia tabla de particiones\n" -" fdisk -l [-b SSZ] [-u] DISCO Lista tabla(s) de particiones\n" -" fdisk -s PARTICIN Obtiene tamao de particiones en " -"bloques\n" -" fdisk -v Obtiene versin de fdisk\n" -"El valor de DISCO tiene el formato /dev/hdb o /dev/sda\n" -"y el valor de PARTICIN tiene el formato /dev/hda7\n" -"-u: Obtener Principio y Final en sectores (en lugar de cilindros)\n" -"-b 2048: (Para algunas unidades MO) Utilizar sectores de 2048 bytes\n" - -#: fdisk/fdisk.c:260 -msgid "" -"Usage: fdisk [-l] [-b SSZ] [-u] device\n" -"E.g.: fdisk /dev/hda (for the first IDE disk)\n" -" or: fdisk /dev/sdc (for the third SCSI disk)\n" -" or: fdisk /dev/eda (for the first PS/2 ESDI drive)\n" -" or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)\n" -" ...\n" -msgstr "" -"Uso: fdisk [-l] [-b SSZ] [-u] dispositivo\n" -"Ej.: fdisk /dev/hda (para el primer disco IDE)\n" -" o: fdisk /dev/sdc (para el tercer disco SCSI)\n" -" o: fdisk /dev/eda (para la primera unidad PS/2 ESDI)\n" -" o: fdisk /dev/rd/c0d0 o fdisk /dev/ida/c0d0 (para dispositivos RAID)\n" -" ...\n" - -#: fdisk/fdisk.c:269 +#: fdisk/fdisk.c:256 +msgid "" +"Usage:\n" +" fdisk [options] change partition table\n" +" fdisk [options] -l list partition table(s)\n" +" fdisk -s give partition size(s) in blocks\n" +"\n" +"Options:\n" +" -b sector size (512, 1024, 2048 or 4096)\n" +" -c switch off DOS-compatible mode\n" +" -h print help\n" +" -u give sizes in sectors instead of cylinders\n" +" -v print version\n" +" -C specify the number of cylinders\n" +" -H specify the number of heads\n" +" -S specify the number of sectors per track\n" +"\n" +msgstr "" + +#: fdisk/fdisk.c:273 #, c-format msgid "Unable to open %s\n" msgstr "No se puede abrir %s\n" -#: fdisk/fdisk.c:273 +#: fdisk/fdisk.c:277 #, c-format msgid "Unable to read %s\n" msgstr "No se puede leer %s\n" -#: fdisk/fdisk.c:277 +#: fdisk/fdisk.c:281 #, c-format msgid "Unable to seek on %s\n" msgstr "No se puede buscar en %s\n" -#: fdisk/fdisk.c:281 +#: fdisk/fdisk.c:285 #, c-format msgid "Unable to write %s\n" msgstr "No se puede escribir %s\n" -#: fdisk/fdisk.c:285 +#: fdisk/fdisk.c:289 #, c-format msgid "BLKGETSIZE ioctl failed on %s\n" msgstr "ioctl BLKGETSIZE ha fallado en %s\n" -#: fdisk/fdisk.c:289 +#: fdisk/fdisk.c:293 msgid "Unable to allocate any more memory\n" msgstr "No se puede asignar ms memoria\n" -#: fdisk/fdisk.c:292 +#: fdisk/fdisk.c:296 msgid "Fatal error\n" msgstr "Error muy grave\n" -#: fdisk/fdisk.c:391 +#: fdisk/fdisk.c:395 msgid " a toggle a read only flag" msgstr " a Conmuta el indicador de slo lectura" -#: fdisk/fdisk.c:392 fdisk/fdisk.c:436 +#: fdisk/fdisk.c:396 fdisk/fdisk.c:440 msgid " b edit bsd disklabel" msgstr " b Modifica la etiqueta de disco bsd" -#: fdisk/fdisk.c:393 +#: fdisk/fdisk.c:397 msgid " c toggle the mountable flag" msgstr " c Conmuta indicador de montable" -#: fdisk/fdisk.c:394 fdisk/fdisk.c:413 fdisk/fdisk.c:438 +#: fdisk/fdisk.c:398 fdisk/fdisk.c:417 fdisk/fdisk.c:442 msgid " d delete a partition" msgstr " d Suprime una particin" -#: fdisk/fdisk.c:395 fdisk/fdisk.c:414 fdisk/fdisk.c:439 +#: fdisk/fdisk.c:399 fdisk/fdisk.c:418 fdisk/fdisk.c:443 msgid " l list known partition types" msgstr " l Lista los tipos de particiones conocidos" -#: fdisk/fdisk.c:397 fdisk/fdisk.c:416 fdisk/fdisk.c:441 +#: fdisk/fdisk.c:401 fdisk/fdisk.c:420 fdisk/fdisk.c:445 msgid " n add a new partition" msgstr " n Aade una nueva particin" -#: fdisk/fdisk.c:398 fdisk/fdisk.c:417 fdisk/fdisk.c:429 fdisk/fdisk.c:442 +#: fdisk/fdisk.c:402 fdisk/fdisk.c:421 fdisk/fdisk.c:433 fdisk/fdisk.c:446 msgid " o create a new empty DOS partition table" msgstr " o Crea una nueva tabla de particiones DOS vaca" -#: fdisk/fdisk.c:399 fdisk/fdisk.c:418 fdisk/fdisk.c:443 fdisk/fdisk.c:466 -#: fdisk/fdisk.c:483 fdisk/fdisk.c:499 fdisk/fdisk.c:517 +#: fdisk/fdisk.c:403 fdisk/fdisk.c:422 fdisk/fdisk.c:447 fdisk/fdisk.c:470 +#: fdisk/fdisk.c:487 fdisk/fdisk.c:503 fdisk/fdisk.c:521 msgid " p print the partition table" msgstr " p Imprime la tabla de particiones" -#: fdisk/fdisk.c:401 fdisk/fdisk.c:420 fdisk/fdisk.c:431 fdisk/fdisk.c:445 +#: fdisk/fdisk.c:405 fdisk/fdisk.c:424 fdisk/fdisk.c:435 fdisk/fdisk.c:449 msgid " s create a new empty Sun disklabel" msgstr " s Crea una nueva etiqueta de disco Sun" -#: fdisk/fdisk.c:402 fdisk/fdisk.c:421 fdisk/fdisk.c:446 +#: fdisk/fdisk.c:406 fdisk/fdisk.c:425 fdisk/fdisk.c:450 msgid " t change a partition's system id" msgstr " t Cambia el identificador de sistema de una particin" -#: fdisk/fdisk.c:403 fdisk/fdisk.c:422 fdisk/fdisk.c:447 +#: fdisk/fdisk.c:407 fdisk/fdisk.c:426 fdisk/fdisk.c:451 msgid " u change display/entry units" msgstr " u Cambia las unidades de visualizacin/entrada" -#: fdisk/fdisk.c:404 fdisk/fdisk.c:423 fdisk/fdisk.c:448 fdisk/fdisk.c:470 -#: fdisk/fdisk.c:487 fdisk/fdisk.c:503 fdisk/fdisk.c:521 +#: fdisk/fdisk.c:408 fdisk/fdisk.c:427 fdisk/fdisk.c:452 fdisk/fdisk.c:474 +#: fdisk/fdisk.c:491 fdisk/fdisk.c:507 fdisk/fdisk.c:525 msgid " v verify the partition table" msgstr " v Verifica la tabla de particiones" -#: fdisk/fdisk.c:405 fdisk/fdisk.c:424 fdisk/fdisk.c:449 fdisk/fdisk.c:471 -#: fdisk/fdisk.c:488 fdisk/fdisk.c:504 fdisk/fdisk.c:522 +#: fdisk/fdisk.c:409 fdisk/fdisk.c:428 fdisk/fdisk.c:453 fdisk/fdisk.c:475 +#: fdisk/fdisk.c:492 fdisk/fdisk.c:508 fdisk/fdisk.c:526 msgid " w write table to disk and exit" msgstr " w Escribe la tabla en el disco y sale" -#: fdisk/fdisk.c:406 fdisk/fdisk.c:450 +#: fdisk/fdisk.c:410 fdisk/fdisk.c:454 msgid " x extra functionality (experts only)" msgstr " x Funciones adicionales (slo para usuarios avanzados)" -#: fdisk/fdisk.c:410 +#: fdisk/fdisk.c:414 msgid " a select bootable partition" msgstr " a Selecciona particin iniciable" -#: fdisk/fdisk.c:411 +#: fdisk/fdisk.c:415 msgid " b edit bootfile entry" msgstr " b Modifica entrada de fichero de inicio" -#: fdisk/fdisk.c:412 +#: fdisk/fdisk.c:416 msgid " c select sgi swap partition" msgstr " c Selecciona particin de intercambio sgi" -#: fdisk/fdisk.c:435 +#: fdisk/fdisk.c:439 msgid " a toggle a bootable flag" msgstr " a Conmuta el indicador de iniciable" -#: fdisk/fdisk.c:437 +#: fdisk/fdisk.c:441 msgid " c toggle the dos compatibility flag" msgstr " c Conmuta el indicador de compatibilidad con DOS" -#: fdisk/fdisk.c:458 +#: fdisk/fdisk.c:462 msgid " a change number of alternate cylinders" msgstr " a Cambia el nmero de cilindros alternativos" -#: fdisk/fdisk.c:459 fdisk/fdisk.c:477 fdisk/fdisk.c:493 fdisk/fdisk.c:509 +#: fdisk/fdisk.c:463 fdisk/fdisk.c:481 fdisk/fdisk.c:497 fdisk/fdisk.c:513 msgid " c change number of cylinders" msgstr " c Cambia el nmero de cilindros" -#: fdisk/fdisk.c:460 fdisk/fdisk.c:478 fdisk/fdisk.c:494 fdisk/fdisk.c:510 +#: fdisk/fdisk.c:464 fdisk/fdisk.c:482 fdisk/fdisk.c:498 fdisk/fdisk.c:514 msgid " d print the raw data in the partition table" msgstr " d Imprime los datos en bruto de la tabla de particiones" -#: fdisk/fdisk.c:461 +#: fdisk/fdisk.c:465 msgid " e change number of extra sectors per cylinder" msgstr " e Cambia el nmero de sectores adicionales por cilindro" -#: fdisk/fdisk.c:462 fdisk/fdisk.c:481 fdisk/fdisk.c:497 fdisk/fdisk.c:514 +#: fdisk/fdisk.c:466 fdisk/fdisk.c:485 fdisk/fdisk.c:501 fdisk/fdisk.c:518 msgid " h change number of heads" msgstr " h Cambia el nmero de cabezas" -#: fdisk/fdisk.c:463 +#: fdisk/fdisk.c:467 msgid " i change interleave factor" msgstr " i Cambia el factor de interleave" -#: fdisk/fdisk.c:464 +#: fdisk/fdisk.c:468 msgid " o change rotation speed (rpm)" msgstr " o Cambia la velocidad de rotacin (r.p.m.)" -#: fdisk/fdisk.c:469 fdisk/fdisk.c:486 fdisk/fdisk.c:502 fdisk/fdisk.c:520 +#: fdisk/fdisk.c:473 fdisk/fdisk.c:490 fdisk/fdisk.c:506 fdisk/fdisk.c:524 msgid " s change number of sectors/track" msgstr " s Cambia el nmero de sectores por pista" -#: fdisk/fdisk.c:472 +#: fdisk/fdisk.c:476 msgid " y change number of physical cylinders" msgstr " y Cambia el nmero de cilindros fsicos" -#: fdisk/fdisk.c:476 fdisk/fdisk.c:492 fdisk/fdisk.c:508 +#: fdisk/fdisk.c:480 fdisk/fdisk.c:496 fdisk/fdisk.c:512 msgid " b move beginning of data in a partition" msgstr " b Mueve el principio de los datos de una particin" -#: fdisk/fdisk.c:479 fdisk/fdisk.c:495 fdisk/fdisk.c:511 +#: fdisk/fdisk.c:483 fdisk/fdisk.c:499 fdisk/fdisk.c:515 msgid " e list extended partitions" msgstr " e Lista las particiones extendidas" -#: fdisk/fdisk.c:480 fdisk/fdisk.c:496 fdisk/fdisk.c:513 +#: fdisk/fdisk.c:484 fdisk/fdisk.c:500 fdisk/fdisk.c:517 msgid " g create an IRIX (SGI) partition table" msgstr " g Crea una tabla de particiones IRIX (SGI)" -#: fdisk/fdisk.c:512 +#: fdisk/fdisk.c:516 msgid " f fix partition order" msgstr " f Corrige el orden de las particiones" -#: fdisk/fdisk.c:515 +#: fdisk/fdisk.c:519 #, fuzzy msgid " i change the disk identifier" msgstr " u Cambia las unidades de visualizacin/entrada" -#: fdisk/fdisk.c:631 +#: fdisk/fdisk.c:635 #, c-format msgid "You must set" msgstr "Debe establecer" -#: fdisk/fdisk.c:721 +#: fdisk/fdisk.c:736 msgid "heads" msgstr "cabezas" -#: fdisk/fdisk.c:723 fdisk/fdisk.c:1541 fdisk/sfdisk.c:930 +#: fdisk/fdisk.c:738 fdisk/fdisk.c:1586 fdisk/sfdisk.c:930 msgid "sectors" msgstr "sectores" -#: fdisk/fdisk.c:729 +#: fdisk/fdisk.c:744 #, c-format msgid "" "%s%s.\n" @@ -3115,30 +3045,11 @@ msgstr "" "%s%s.\n" "Puede efectuar esta operacin desde el men de funciones adicionales.\n" -#: fdisk/fdisk.c:730 +#: fdisk/fdisk.c:745 msgid " and " msgstr " y " -#: fdisk/fdisk.c:747 -#, c-format -msgid "" -"\n" -"The number of cylinders for this disk is set to %d.\n" -"There is nothing wrong with that, but this is larger than 1024,\n" -"and could in certain setups cause problems with:\n" -"1) software that runs at boot time (e.g., old versions of LILO)\n" -"2) booting and partitioning software from other OSs\n" -" (e.g., DOS FDISK, OS/2 FDISK)\n" -msgstr "" -"\n" -"El nmero de cilindros para este disco est establecido en %d.\n" -"No hay nada malo en ello, pero es mayor que 1024, y en algunos casos\n" -"podra causar problemas con:\n" -"1) software que funciona en el inicio (p.ej. versiones antiguas de LILO)\n" -"2) software de arranque o particionamiento de otros sistemas operativos\n" -" (p.ej. FDISK de DOS, FDISK de OS/2)\n" - -#: fdisk/fdisk.c:763 +#: fdisk/fdisk.c:765 #, c-format msgid "" "\n" @@ -3149,38 +3060,44 @@ msgid "" "\n" msgstr "" -#: fdisk/fdisk.c:780 +#: fdisk/fdisk.c:783 #, c-format msgid "" "\n" "The device presents a logical sector size that is smaller than\n" -"the physical sector size. Aligning to a physical sector boundary\n" -"is recommended, or performance may be impacted.\n" -"\n" +"the physical sector size. Aligning to a physical sector (or optimal\n" +"I/O) size boundary is recommended, or performance may be impacted.\n" msgstr "" -#: fdisk/fdisk.c:792 +#: fdisk/fdisk.c:789 #, c-format msgid "" -"WARNING: The device does not provide compensation (alignment_offset)\n" -"for DOS-compatible partitioning, but DOS-compatible mode is enabled.\n" -"Use command 'c' to switch-off DOS mode.\n" "\n" +"WARNING: DOS-compatible mode is deprecated. It's strongly recommended to\n" +" switch off the mode (command 'c')" +msgstr "" + +#: fdisk/fdisk.c:794 +#, c-format +msgid "" +" and change display units to\n" +" sectors (command 'u').\n" msgstr "" -#: fdisk/fdisk.c:798 +#: fdisk/fdisk.c:800 #, c-format msgid "" -"It's recommended to change display units to sectors (command 'u').\n" "\n" +"WARNING: cylinders as display units are deprecated. Use command 'u' to\n" +" change units to sectors.\n" msgstr "" -#: fdisk/fdisk.c:815 +#: fdisk/fdisk.c:819 #, c-format msgid "Bad offset in primary extended partition\n" msgstr "Desplazamiento incorrecto en particiones extendidas primarias\n" -#: fdisk/fdisk.c:829 +#: fdisk/fdisk.c:833 #, c-format msgid "" "Warning: omitting partitions after #%d.\n" @@ -3189,34 +3106,32 @@ msgstr "" "Atencin: se omiten las particiones despus de la nmero %d.\n" "Se borrarn si guarda esta tabla de particiones.\n" -#: fdisk/fdisk.c:848 +#: fdisk/fdisk.c:852 #, c-format msgid "Warning: extra link pointer in partition table %d\n" msgstr "Atencin: puntero de enlace adicional en tabla de particiones %d\n" -#: fdisk/fdisk.c:856 +#: fdisk/fdisk.c:860 #, c-format msgid "Warning: ignoring extra data in partition table %d\n" -msgstr "" -"Atencin: no se tienen en cuenta los datos adicionales de la tabla de " -"particiones %d\n" +msgstr "Atencin: no se tienen en cuenta los datos adicionales de la tabla de particiones %d\n" -#: fdisk/fdisk.c:889 +#: fdisk/fdisk.c:893 #, fuzzy, c-format msgid "omitting empty partition (%d)\n" msgstr "Atencin: particin vaca\n" -#: fdisk/fdisk.c:908 +#: fdisk/fdisk.c:912 #, c-format msgid "Disk identifier: 0x%08x\n" -msgstr "" +msgstr "Identificador del disco: 0x%08x\n" -#: fdisk/fdisk.c:917 +#: fdisk/fdisk.c:921 #, c-format msgid "New disk identifier (current 0x%08x): " -msgstr "" +msgstr "Nuevo identificador del disco: (actual 0x%08x): " -#: fdisk/fdisk.c:936 +#: fdisk/fdisk.c:940 #, fuzzy, c-format msgid "" "Building a new DOS disklabel with disk identifier 0x%08x.\n" @@ -3229,26 +3144,17 @@ msgstr "" "operacin, el contenido anterior no se podr recuperar.\n" "\n" -#: fdisk/fdisk.c:987 +#: fdisk/fdisk.c:1010 #, c-format msgid "Note: sector size is %d (not %d)\n" msgstr "Nota: el tamao del sector es %d (no %d)\n" -#: fdisk/fdisk.c:1051 -#, c-format -msgid "" -"\n" -"WARNING: the device provides alignment_offset, but the offset does not\n" -"match with device geometry.\n" -"\n" -msgstr "" - -#: fdisk/fdisk.c:1162 +#: fdisk/fdisk.c:1208 #, c-format msgid "You will not be able to write the partition table.\n" msgstr "No podr escribir la tabla de particiones.\n" -#: fdisk/fdisk.c:1194 +#: fdisk/fdisk.c:1240 #, c-format msgid "" "This disk has both DOS and BSD magic.\n" @@ -3257,35 +3163,27 @@ msgstr "" "Este disco tiene tanto magia DOS como BSD.\n" "Utilice la orden 'b' para ir al modo BSD.\n" -#: fdisk/fdisk.c:1204 +#: fdisk/fdisk.c:1250 #, c-format -msgid "" -"Device contains neither a valid DOS partition table, nor Sun, SGI or OSF " -"disklabel\n" -msgstr "" -"El dispositivo no contiene una tabla de particiones DOS vlida ni una " -"etiqueta de disco Sun o SGI o OSF\n" +msgid "Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel\n" +msgstr "El dispositivo no contiene una tabla de particiones DOS vlida ni una etiqueta de disco Sun o SGI o OSF\n" -#: fdisk/fdisk.c:1221 +#: fdisk/fdisk.c:1267 #, c-format msgid "Internal error\n" msgstr "Error interno\n" -#: fdisk/fdisk.c:1231 +#: fdisk/fdisk.c:1277 #, c-format msgid "Ignoring extra extended partition %d\n" msgstr "No se tiene en cuenta la particin extendida adicional %d\n" -#: fdisk/fdisk.c:1243 +#: fdisk/fdisk.c:1289 #, c-format -msgid "" -"Warning: invalid flag 0x%04x of partition table %d will be corrected by w" -"(rite)\n" -msgstr "" -"Atencin: el indicador 0x%04x invlido de la tabla de particiones %d se " -"corregir mediante w(rite)\n" +msgid "Warning: invalid flag 0x%04x of partition table %d will be corrected by w(rite)\n" +msgstr "Atencin: el indicador 0x%04x invlido de la tabla de particiones %d se corregir mediante w(rite)\n" -#: fdisk/fdisk.c:1270 +#: fdisk/fdisk.c:1315 #, c-format msgid "" "\n" @@ -3294,95 +3192,95 @@ msgstr "" "\n" "se ha detectado EOF tres veces - saliendo...\n" -#: fdisk/fdisk.c:1309 +#: fdisk/fdisk.c:1354 msgid "Hex code (type L to list codes): " msgstr "Cdigo hexadecimal (escriba L para ver los cdigos): " -#: fdisk/fdisk.c:1342 +#: fdisk/fdisk.c:1387 #, c-format msgid "%s (%u-%u, default %u): " msgstr "%s (%u-%u, valor predeterminado %u): " -#: fdisk/fdisk.c:1409 +#: fdisk/fdisk.c:1454 #, c-format msgid "Unsupported suffix: '%s'.\n" -msgstr "" +msgstr "Sufijo no soportado: '%s'.\n" -#: fdisk/fdisk.c:1410 +#: fdisk/fdisk.c:1455 #, c-format msgid "" "Supported: 10^N: KB (KiloByte), MB (MegaByte), GB (GigaByte)\n" " 2^N: K (KibiByte), M (MebiByte), G (GibiByte)\n" msgstr "" -#: fdisk/fdisk.c:1438 +#: fdisk/fdisk.c:1483 #, c-format msgid "Using default value %u\n" msgstr "Se est utilizando el valor predeterminado %u\n" -#: fdisk/fdisk.c:1442 +#: fdisk/fdisk.c:1487 #, c-format msgid "Value out of range.\n" msgstr "El valor est fuera del rango.\n" -#: fdisk/fdisk.c:1467 +#: fdisk/fdisk.c:1512 msgid "Partition number" msgstr "Nmero de particin" -#: fdisk/fdisk.c:1478 +#: fdisk/fdisk.c:1523 #, c-format msgid "Warning: partition %d has empty type\n" msgstr "Atencin: la particin %d es de tipo vaco\n" -#: fdisk/fdisk.c:1500 fdisk/fdisk.c:1526 +#: fdisk/fdisk.c:1545 fdisk/fdisk.c:1571 #, c-format msgid "Selected partition %d\n" msgstr "Se ha seleccionado la particin %d\n" -#: fdisk/fdisk.c:1503 +#: fdisk/fdisk.c:1548 #, c-format msgid "No partition is defined yet!\n" msgstr "No hay ninguna particin definida!\n" -#: fdisk/fdisk.c:1529 +#: fdisk/fdisk.c:1574 #, c-format msgid "All primary partitions have been defined already!\n" msgstr "Ya se han definido todas las particiones primarias!\n" -#: fdisk/fdisk.c:1539 +#: fdisk/fdisk.c:1584 msgid "cylinder" msgstr "cilindro" -#: fdisk/fdisk.c:1539 +#: fdisk/fdisk.c:1584 msgid "sector" msgstr "sector" -#: fdisk/fdisk.c:1548 +#: fdisk/fdisk.c:1593 #, c-format msgid "Changing display/entry units to %s\n" msgstr "Se cambian las unidades de visualizacin/entrada a %s\n" -#: fdisk/fdisk.c:1559 +#: fdisk/fdisk.c:1604 #, c-format msgid "WARNING: Partition %d is an extended partition\n" msgstr "ATENCIN: la particin %d es una particin extendida\n" -#: fdisk/fdisk.c:1569 +#: fdisk/fdisk.c:1614 #, c-format msgid "DOS Compatibility flag is set\n" msgstr "El indicador de compatibilidad con DOS est establecido\n" -#: fdisk/fdisk.c:1571 +#: fdisk/fdisk.c:1616 #, c-format msgid "DOS Compatibility flag is not set\n" msgstr "El indicador de compatibilidad con DOS no est establecido\n" -#: fdisk/fdisk.c:1672 +#: fdisk/fdisk.c:1717 #, c-format msgid "Partition %d does not exist yet!\n" msgstr "La particin %d todava no existe\n" -#: fdisk/fdisk.c:1677 +#: fdisk/fdisk.c:1722 #, c-format msgid "" "Type 0 means free space to many systems\n" @@ -3395,7 +3293,7 @@ msgstr "" "tener particiones de tipo 0. Puede suprimir una\n" "particin con la orden `d'.\n" -#: fdisk/fdisk.c:1686 +#: fdisk/fdisk.c:1731 #, c-format msgid "" "You cannot change a partition into an extended one or vice versa\n" @@ -3404,7 +3302,7 @@ msgstr "" "No puede convertir una particin en extendida ni viceversa.\n" "Primero debe suprimirla.\n" -#: fdisk/fdisk.c:1695 +#: fdisk/fdisk.c:1740 #, c-format msgid "" "Consider leaving partition 3 as Whole disk (5),\n" @@ -3415,7 +3313,7 @@ msgstr "" "ya que as lo prev SunOS/Solaris e incluso es adecuado para Linux.\n" "\n" -#: fdisk/fdisk.c:1701 +#: fdisk/fdisk.c:1746 #, fuzzy, c-format msgid "" "Consider leaving partition 9 as volume header (0),\n" @@ -3426,63 +3324,62 @@ msgstr "" "y la particin 11 como volumen completo (6) ya que IRIX as lo espera.\n" "\n" -#: fdisk/fdisk.c:1718 +#: fdisk/fdisk.c:1763 #, c-format msgid "Changed system type of partition %d to %x (%s)\n" msgstr "Se ha cambiado el tipo de sistema de la particin %d por %x (%s)\n" -#: fdisk/fdisk.c:1721 +#: fdisk/fdisk.c:1766 #, fuzzy, c-format msgid "System type of partition %d is unchanged: %x (%s)\n" msgstr "Se ha cambiado el tipo de sistema de la particin %d por %x (%s)\n" -#: fdisk/fdisk.c:1773 +#: fdisk/fdisk.c:1821 #, c-format msgid "Partition %d has different physical/logical beginnings (non-Linux?):\n" -msgstr "" -"La particin %d tiene distintos principios fsicos/lgicos (no Linux?):\n" +msgstr "La particin %d tiene distintos principios fsicos/lgicos (no Linux?):\n" -#: fdisk/fdisk.c:1775 fdisk/fdisk.c:1783 fdisk/fdisk.c:1792 fdisk/fdisk.c:1802 +#: fdisk/fdisk.c:1823 fdisk/fdisk.c:1831 fdisk/fdisk.c:1840 fdisk/fdisk.c:1850 #, c-format msgid " phys=(%d, %d, %d) " msgstr " fsicos=(%d, %d, %d) " -#: fdisk/fdisk.c:1776 fdisk/fdisk.c:1784 +#: fdisk/fdisk.c:1824 fdisk/fdisk.c:1832 #, c-format msgid "logical=(%d, %d, %d)\n" msgstr "lgicos=(%d, %d, %d)\n" -#: fdisk/fdisk.c:1781 +#: fdisk/fdisk.c:1829 #, c-format msgid "Partition %d has different physical/logical endings:\n" msgstr "La particin %d tiene distintos finales fsicos/lgicos:\n" -#: fdisk/fdisk.c:1790 +#: fdisk/fdisk.c:1838 #, c-format msgid "Partition %i does not start on cylinder boundary:\n" msgstr "La particin %i no empieza en el lmite del cilindro:\n" -#: fdisk/fdisk.c:1793 +#: fdisk/fdisk.c:1841 #, c-format msgid "should be (%d, %d, 1)\n" msgstr "debe ser (%d, %d, 1)\n" -#: fdisk/fdisk.c:1799 +#: fdisk/fdisk.c:1847 #, c-format msgid "Partition %i does not end on cylinder boundary.\n" msgstr "La particin %i no termina en un lmite de cilindro.\n" -#: fdisk/fdisk.c:1803 +#: fdisk/fdisk.c:1851 #, c-format msgid "should be (%d, %d, %d)\n" msgstr "debe ser (%d, %d, %d)\n" -#: fdisk/fdisk.c:1813 +#: fdisk/fdisk.c:1861 #, fuzzy, c-format -msgid "Partition %i does not start on physical block boundary.\n" +msgid "Partition %i does not start on physical sector boundary.\n" msgstr "La particin %i no empieza en el lmite del cilindro:\n" -#: fdisk/fdisk.c:1823 +#: fdisk/fdisk.c:1871 #, c-format msgid "" "\n" @@ -3491,7 +3388,7 @@ msgstr "" "\n" "Disco %s: %ld MB, %lld bytes\n" -#: fdisk/fdisk.c:1827 +#: fdisk/fdisk.c:1875 #, c-format msgid "" "\n" @@ -3500,34 +3397,39 @@ msgstr "" "\n" "Disco %s: %ld.%ld GB, %lld bytes\n" -#: fdisk/fdisk.c:1830 +#: fdisk/fdisk.c:1878 #, fuzzy, c-format msgid "%d heads, %llu sectors/track, %d cylinders" msgstr "%d cabezas, %d sectores/pista, %d cilindros" -#: fdisk/fdisk.c:1833 +#: fdisk/fdisk.c:1881 #, c-format msgid ", total %llu sectors" msgstr ", %llu sectores en total" -#: fdisk/fdisk.c:1836 +#: fdisk/fdisk.c:1884 #, fuzzy, c-format msgid "Units = %s of %d * %d = %d bytes\n" msgstr "" "Unidades = %s de %d * %d = %d bytes\n" "\n" -#: fdisk/fdisk.c:1840 +#: fdisk/fdisk.c:1888 #, c-format msgid "Sector size (logical/physical): %u bytes / %lu bytes\n" msgstr "" -#: fdisk/fdisk.c:1843 -#, fuzzy, c-format +#: fdisk/fdisk.c:1890 +#, c-format +msgid "I/O size (minimum/optimal): %lu bytes / %lu bytes\n" +msgstr "" + +#: fdisk/fdisk.c:1893 +#, c-format msgid "Alignment offset: %lu bytes\n" -msgstr "tamao de nodo-i incorrecto" +msgstr "" -#: fdisk/fdisk.c:1952 +#: fdisk/fdisk.c:2002 #, c-format msgid "" "Nothing to do. Ordering is correct already.\n" @@ -3536,14 +3438,14 @@ msgstr "" "No hay nada que hacer. El orden ya es correcto.\n" "\n" -#: fdisk/fdisk.c:1980 +#: fdisk/fdisk.c:2030 #, fuzzy, c-format msgid "Done.\n" msgstr "" "Fin\n" "\n" -#: fdisk/fdisk.c:2008 +#: fdisk/fdisk.c:2058 #, c-format msgid "" "This doesn't look like a partition table\n" @@ -3553,17 +3455,17 @@ msgstr "" "Esto no parece una tabla de particiones\n" "Probablemente ha seleccionado el dispositivo que no era.\n" -#: fdisk/fdisk.c:2021 +#: fdisk/fdisk.c:2071 #, c-format msgid "%*s Boot Start End Blocks Id System\n" msgstr "%*s Inicio Comienzo Fin Bloques Id Sistema\n" # Nota: si se pone Dispositivo no queda bien el resto de la lnea. -#: fdisk/fdisk.c:2022 fdisk/fdisksgilabel.c:210 fdisk/fdisksunlabel.c:603 +#: fdisk/fdisk.c:2072 fdisk/fdisksgilabel.c:210 fdisk/fdisksunlabel.c:598 msgid "Device" msgstr "Disposit." -#: fdisk/fdisk.c:2060 +#: fdisk/fdisk.c:2110 #, c-format msgid "" "\n" @@ -3572,7 +3474,7 @@ msgstr "" "\n" "Las entradas de la tabla de particiones no estn en el orden del disco\n" -#: fdisk/fdisk.c:2070 +#: fdisk/fdisk.c:2120 #, fuzzy, c-format msgid "" "\n" @@ -3583,88 +3485,87 @@ msgstr "" "Disco %s: %d cabezas, %d sectores, %d cilindros\n" "\n" -#: fdisk/fdisk.c:2072 +#: fdisk/fdisk.c:2122 #, c-format msgid "Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n" msgstr "N IA Cab Sect Cil Cab Sect Cil Inicio Tamao ID\n" -#: fdisk/fdisk.c:2120 +#: fdisk/fdisk.c:2170 #, c-format msgid "Warning: partition %d contains sector 0\n" msgstr "Atencin: la particin %d contiene el sector 0\n" -#: fdisk/fdisk.c:2123 +#: fdisk/fdisk.c:2173 #, c-format msgid "Partition %d: head %d greater than maximum %d\n" msgstr "Particin %d: el cabeza %d supera el mximo %d\n" -#: fdisk/fdisk.c:2126 +#: fdisk/fdisk.c:2176 #, fuzzy, c-format msgid "Partition %d: sector %d greater than maximum %llu\n" msgstr "Particin %d: el sector %d supera el mximo %d\n" -#: fdisk/fdisk.c:2129 +#: fdisk/fdisk.c:2179 #, c-format msgid "Partitions %d: cylinder %d greater than maximum %d\n" msgstr "Particin %d: el cilindro %d supera el mximo %d\n" -#: fdisk/fdisk.c:2133 +#: fdisk/fdisk.c:2183 #, c-format msgid "Partition %d: previous sectors %d disagrees with total %d\n" msgstr "Particin %d: sectores anteriores %d no concuerdan con total %d\n" -#: fdisk/fdisk.c:2167 +#: fdisk/fdisk.c:2217 #, c-format msgid "Warning: bad start-of-data in partition %d\n" msgstr "Atencin: inicio de datos incorrecto en particin %d\n" -#: fdisk/fdisk.c:2175 +#: fdisk/fdisk.c:2225 #, c-format msgid "Warning: partition %d overlaps partition %d.\n" msgstr "Atencin: la particin %d se solapa con la particin %d.\n" -#: fdisk/fdisk.c:2195 +#: fdisk/fdisk.c:2245 #, c-format msgid "Warning: partition %d is empty\n" msgstr "Atencin: la particin %d est vaca\n" -#: fdisk/fdisk.c:2200 +#: fdisk/fdisk.c:2250 #, c-format msgid "Logical partition %d not entirely in partition %d\n" msgstr "La particin lgica %d no est por completo en la particin %d\n" -#: fdisk/fdisk.c:2206 +#: fdisk/fdisk.c:2256 #, fuzzy, c-format msgid "Total allocated sectors %llu greater than the maximum %llu\n" msgstr "El total de sectores asignados %d supera el mximo %lld\n" -#: fdisk/fdisk.c:2209 +#: fdisk/fdisk.c:2259 #, fuzzy, c-format msgid "Remaining %lld unallocated %d-byte sectors\n" msgstr "%lld sectores no asignados\n" -#: fdisk/fdisk.c:2245 fdisk/fdisksgilabel.c:620 fdisk/fdisksunlabel.c:416 +#: fdisk/fdisk.c:2295 fdisk/fdisksgilabel.c:620 fdisk/fdisksunlabel.c:411 #, c-format msgid "Partition %d is already defined. Delete it before re-adding it.\n" -msgstr "" -"La particin %d ya est definida. Suprmala antes de volver a aadirla.\n" +msgstr "La particin %d ya est definida. Suprmala antes de volver a aadirla.\n" -#: fdisk/fdisk.c:2291 +#: fdisk/fdisk.c:2340 #, fuzzy, c-format msgid "Sector %llu is already allocated\n" msgstr "El sector %d ya est asignado\n" -#: fdisk/fdisk.c:2327 +#: fdisk/fdisk.c:2376 #, c-format msgid "No free sectors available\n" msgstr "No hay disponible ningn sector libre\n" -#: fdisk/fdisk.c:2338 +#: fdisk/fdisk.c:2387 #, c-format msgid "Last %1$s, +%2$s or +size{K,M,G}" msgstr "" -#: fdisk/fdisk.c:2415 +#: fdisk/fdisk.c:2464 #, c-format msgid "" "\tSorry - this fdisk cannot handle AIX disk labels.\n" @@ -3677,7 +3578,7 @@ msgstr "" " tabla de particiones DOS vaca primero. (Use o.)\n" " ATENCIN: Esto destruir el contenido de este disco.\n" -#: fdisk/fdisk.c:2424 +#: fdisk/fdisk.c:2473 #, fuzzy, c-format msgid "" "\tSorry - this fdisk cannot handle Mac disk labels.\n" @@ -3690,23 +3591,22 @@ msgstr "" " tabla de particiones DOS vaca primero. (Use o.)\n" " ATENCIN: Esto destruir el contenido de este disco.\n" -#: fdisk/fdisk.c:2444 +#: fdisk/fdisk.c:2493 #, c-format msgid "You must delete some partition and add an extended partition first\n" -msgstr "" -"Primero debe suprimir alguna particin y aadir una particin extendida\n" +msgstr "Primero debe suprimir alguna particin y aadir una particin extendida\n" -#: fdisk/fdisk.c:2447 +#: fdisk/fdisk.c:2496 #, c-format msgid "All logical partitions are in use\n" msgstr "Se estn usando todas las particiones lgicas\n" -#: fdisk/fdisk.c:2448 +#: fdisk/fdisk.c:2497 #, c-format msgid "Adding a primary partition\n" msgstr "Se aade una particin primaria\n" -#: fdisk/fdisk.c:2453 +#: fdisk/fdisk.c:2502 #, c-format msgid "" "Command action\n" @@ -3717,20 +3617,20 @@ msgstr "" "%s\n" " p Particin primaria (1-4)\n" -#: fdisk/fdisk.c:2455 +#: fdisk/fdisk.c:2504 msgid "l logical (5 or over)" msgstr "l Particin lgica (5 o superior)" -#: fdisk/fdisk.c:2455 +#: fdisk/fdisk.c:2504 msgid "e extended" msgstr "e Particin extendida" -#: fdisk/fdisk.c:2474 +#: fdisk/fdisk.c:2523 #, c-format msgid "Invalid partition number for type `%c'\n" msgstr "Nmero de particin invlido para el tipo `%c'\n" -#: fdisk/fdisk.c:2510 +#: fdisk/fdisk.c:2559 #, c-format msgid "" "The partition table has been altered!\n" @@ -3739,12 +3639,12 @@ msgstr "" "Se ha modificado la tabla de particiones!\n" "\n" -#: fdisk/fdisk.c:2523 +#: fdisk/fdisk.c:2572 #, c-format msgid "Calling ioctl() to re-read partition table.\n" msgstr "Llamando a ioctl() para volver a leer la tabla de particiones.\n" -#: fdisk/fdisk.c:2532 +#: fdisk/fdisk.c:2581 #, fuzzy, c-format msgid "" "\n" @@ -3758,7 +3658,7 @@ msgstr "" "El ncleo todava usa la tabla antigua.\n" "La nueva tabla se usar en el prximo reinicio.\n" -#: fdisk/fdisk.c:2540 +#: fdisk/fdisk.c:2589 #, c-format msgid "" "\n" @@ -3771,7 +3671,7 @@ msgstr "" "particiones DOS 6.x, consulte la pgina man de fdisk\n" "para ver informacin adicional.\n" -#: fdisk/fdisk.c:2546 +#: fdisk/fdisk.c:2595 #, c-format msgid "" "\n" @@ -3780,100 +3680,91 @@ msgstr "" "\n" "Error al cerrar el fichero\n" -#: fdisk/fdisk.c:2550 +#: fdisk/fdisk.c:2599 #, c-format msgid "Syncing disks.\n" msgstr "Se estn sincronizando los discos.\n" -#: fdisk/fdisk.c:2596 +#: fdisk/fdisk.c:2645 #, c-format msgid "Partition %d has no data area\n" msgstr "La particin %d no tiene ninguna rea de datos\n" -#: fdisk/fdisk.c:2601 +#: fdisk/fdisk.c:2650 msgid "New beginning of data" msgstr "Nuevo principio de datos" -#: fdisk/fdisk.c:2617 +#: fdisk/fdisk.c:2666 msgid "Expert command (m for help): " msgstr "Orden avanzada (m para obtener ayuda): " -#: fdisk/fdisk.c:2630 +#: fdisk/fdisk.c:2679 msgid "Number of cylinders" msgstr "Nmero de cilindros" -#: fdisk/fdisk.c:2657 +#: fdisk/fdisk.c:2704 msgid "Number of heads" msgstr "Nmero de cabezas" -#: fdisk/fdisk.c:2684 +#: fdisk/fdisk.c:2731 msgid "Number of sectors" msgstr "Nmero de sectores" -#: fdisk/fdisk.c:2686 +#: fdisk/fdisk.c:2733 #, c-format msgid "Warning: setting sector offset for DOS compatiblity\n" -msgstr "" -"Atencin: estableciendo desplazamiento de sector para compatibilidad con " -"DOS\n" +msgstr "Atencin: estableciendo desplazamiento de sector para compatibilidad con DOS\n" -#: fdisk/fdisk.c:2745 +#: fdisk/fdisk.c:2792 #, c-format msgid "" "\n" -"WARNING: GPT (GUID Partition Table) detected on '%s'! The util fdisk doesn't " -"support GPT. Use GNU Parted.\n" +"WARNING: GPT (GUID Partition Table) detected on '%s'! The util fdisk doesn't support GPT. Use GNU Parted.\n" "\n" msgstr "" -#: fdisk/fdisk.c:2767 +#: fdisk/fdisk.c:2814 #, c-format msgid "Disk %s doesn't contain a valid partition table\n" msgstr "El disco %s no contiene una tabla de particiones vlida\n" -#: fdisk/fdisk.c:2778 +#: fdisk/fdisk.c:2825 #, c-format msgid "Cannot open %s\n" msgstr "No se puede abrir %s\n" -#: fdisk/fdisk.c:2797 fdisk/sfdisk.c:2603 +#: fdisk/fdisk.c:2844 fdisk/sfdisk.c:2603 #, c-format msgid "cannot open %s\n" msgstr "No se puede abrir %s\n" -#: fdisk/fdisk.c:2817 +#: fdisk/fdisk.c:2864 #, c-format msgid "%c: unknown command\n" msgstr "%c: orden desconocida\n" -#: fdisk/fdisk.c:2887 +#: fdisk/fdisk.c:2930 #, c-format msgid "This kernel finds the sector size itself - -b option ignored\n" -msgstr "" -"Este ncleo encuentra el tamao del sector por s mismo; no se tiene en " -"cuenta la opcin -b\n" +msgstr "Este ncleo encuentra el tamao del sector por s mismo; no se tiene en cuenta la opcin -b\n" -#: fdisk/fdisk.c:2891 +#: fdisk/fdisk.c:2934 #, c-format -msgid "" -"Warning: the -b (set sector size) option should be used with one specified " -"device\n" -msgstr "" -"Atencin: la opcin -b (establecer tamao de sector) debe utilizarse con un " -"dispositivo especificado\n" +msgid "Warning: the -b (set sector size) option should be used with one specified device\n" +msgstr "Atencin: la opcin -b (establecer tamao de sector) debe utilizarse con un dispositivo especificado\n" -#: fdisk/fdisk.c:2953 +#: fdisk/fdisk.c:2994 #, c-format msgid "Detected an OSF/1 disklabel on %s, entering disklabel mode.\n" msgstr "" "Se ha detectado una etiqueta de disco OSF/1 en %s, entrando en el modo de\n" "etiqueta de disco.\n" -#: fdisk/fdisk.c:2963 +#: fdisk/fdisk.c:3004 msgid "Command (m for help): " msgstr "Orden (m para obtener ayuda): " -#: fdisk/fdisk.c:2979 +#: fdisk/fdisk.c:3020 #, c-format msgid "" "\n" @@ -3882,16 +3773,16 @@ msgstr "" "\n" "El fichero de inicio actual es: %s\n" -#: fdisk/fdisk.c:2981 +#: fdisk/fdisk.c:3022 msgid "Please enter the name of the new boot file: " msgstr "Escriba el nombre del nuevo fichero de inicio: " -#: fdisk/fdisk.c:2983 +#: fdisk/fdisk.c:3024 #, c-format msgid "Boot file unchanged\n" msgstr "No se ha modificado el fichero de inicio\n" -#: fdisk/fdisk.c:3056 +#: fdisk/fdisk.c:3097 #, c-format msgid "" "\n" @@ -3984,15 +3875,15 @@ msgstr "SGI xlv" msgid "SGI xvm" msgstr "SGI xvm" -#: fdisk/fdisksgilabel.c:95 fdisk/fdisksunlabel.c:55 +#: fdisk/fdisksgilabel.c:95 fdisk/fdisksunlabel.c:50 msgid "Linux swap" msgstr "Linux swap" -#: fdisk/fdisksgilabel.c:96 fdisk/fdisksunlabel.c:56 +#: fdisk/fdisksgilabel.c:96 fdisk/fdisksunlabel.c:51 msgid "Linux native" msgstr "Linux native" -#: fdisk/fdisksgilabel.c:97 fdisk/fdisksunlabel.c:57 fdisk/i386_sys_types.c:63 +#: fdisk/fdisksgilabel.c:97 fdisk/fdisksunlabel.c:52 fdisk/i386_sys_types.c:63 msgid "Linux LVM" msgstr "Linux LVM" @@ -4002,19 +3893,13 @@ msgstr "Linux RAID" #: fdisk/fdisksgilabel.c:151 #, c-format -msgid "" -"According to MIPS Computer Systems, Inc the Label must not contain more than " -"512 bytes\n" -msgstr "" -"Segn MIPS Computer Systems, Inc. la etiqueta puede contener como mximo 512 " -"bytes\n" +msgid "According to MIPS Computer Systems, Inc the Label must not contain more than 512 bytes\n" +msgstr "Segn MIPS Computer Systems, Inc. la etiqueta puede contener como mximo 512 bytes\n" #: fdisk/fdisksgilabel.c:170 #, c-format msgid "Detected sgi disklabel with wrong checksum.\n" -msgstr "" -"Se ha detectado una etiqueta de disco sgi con suma de comprobacin " -"incorrecta.\n" +msgstr "Se ha detectado una etiqueta de disco sgi con suma de comprobacin incorrecta.\n" #: fdisk/fdisksgilabel.c:188 #, fuzzy, c-format @@ -4113,8 +3998,7 @@ msgid "" msgstr "" "\n" "\tTenga en cuenta que no se comprueba la existencia del fichero de inicio.\n" -"\tEl valor predeterminado de SGI es \"/unix\" y para la copia de seguridad " -"\"/unix.save\".\n" +"\tEl valor predeterminado de SGI es \"/unix\" y para la copia de seguridad \"/unix.save\".\n" #: fdisk/fdisksgilabel.c:336 #, c-format @@ -4130,7 +4014,7 @@ msgstr "" msgid "More than one entire disk entry present.\n" msgstr "Existe ms de una entrada de disco completo.\n" -#: fdisk/fdisksgilabel.c:433 fdisk/fdisksunlabel.c:388 +#: fdisk/fdisksgilabel.c:433 fdisk/fdisksunlabel.c:383 #, c-format msgid "No partitions defined\n" msgstr "No hay ninguna particin definida\n" @@ -4138,8 +4022,7 @@ msgstr "No hay ninguna partici #: fdisk/fdisksgilabel.c:439 #, c-format msgid "IRIX likes when Partition 11 covers the entire disk.\n" -msgstr "" -"Para IRIX se recomienda que la particin 11 abarque el disco completo.\n" +msgstr "Para IRIX se recomienda que la particin 11 abarque el disco completo.\n" #: fdisk/fdisksgilabel.c:441 #, c-format @@ -4232,12 +4115,10 @@ msgstr "" "Se recomienda que la particin en el desplazamiento 0\n" "sea del tipo \"SGI volhdr\"; el sistema IRIX la utilizar para\n" "recuperar de su directorio herramientas autnomas como sash y fx.\n" -"Slo la seccin de disco completo \"SGI volume\" puede infringir esta " -"regla.\n" -"Escriba S si est seguro de querer dar una etiqueta distinta a esta " -"particin.\n" +"Slo la seccin de disco completo \"SGI volume\" puede infringir esta regla.\n" +"Escriba S si est seguro de querer dar una etiqueta distinta a esta particin.\n" -#: fdisk/fdisksgilabel.c:543 fdisk/fdisksunlabel.c:554 +#: fdisk/fdisksgilabel.c:543 fdisk/fdisksunlabel.c:549 msgid "YES\n" msgstr "S\n" @@ -4249,8 +4130,7 @@ msgstr "Se ha producido un solapamiento de partici #: fdisk/fdisksgilabel.c:626 #, c-format msgid "Attempting to generate entire disk entry automatically.\n" -msgstr "" -"Se est intentando generar una entrada de disco completo automticamente.\n" +msgstr "Se est intentando generar una entrada de disco completo automticamente.\n" #: fdisk/fdisksgilabel.c:631 #, c-format @@ -4260,9 +4140,7 @@ msgstr "Ya existen particiones que abarcan el disco completo.\n" #: fdisk/fdisksgilabel.c:635 #, c-format msgid "You got a partition overlap on the disk. Fix it first!\n" -msgstr "" -"Se ha producido un solapamiento de particiones en el disco. Corrjalo antes " -"de continuar.\n" +msgstr "Se ha producido un solapamiento de particiones en el disco. Corrjalo antes de continuar.\n" #: fdisk/fdisksgilabel.c:644 fdisk/fdisksgilabel.c:673 #, c-format @@ -4276,9 +4154,7 @@ msgstr "" #: fdisk/fdisksgilabel.c:660 #, c-format msgid "You will get a partition overlap on the disk. Fix it first!\n" -msgstr "" -"Se producir un solapamiento de particiones en el disco. Corrjalo antes de " -"continuar.\n" +msgstr "Se producir un solapamiento de particiones en el disco. Corrjalo antes de continuar.\n" #: fdisk/fdisksgilabel.c:665 #, c-format @@ -4298,11 +4174,10 @@ msgstr "" "operacin, el contenido anterior se habr perdido de forma irrecuperable.\n" "\n" -#: fdisk/fdisksgilabel.c:718 fdisk/fdisksunlabel.c:227 +#: fdisk/fdisksgilabel.c:718 fdisk/fdisksunlabel.c:222 #, c-format msgid "" -"Warning: BLKGETSIZE ioctl failed on %s. Using geometry cylinder value of %" -"d.\n" +"Warning: BLKGETSIZE ioctl failed on %s. Using geometry cylinder value of %d.\n" "This value may be truncated for devices > 33.8 GB.\n" msgstr "" "Atencin: El ioctl de BLKGETSIZE fall en %s. Se usar un valor para\n" @@ -4319,58 +4194,58 @@ msgstr "Intentando conservar los par msgid "ID=%02x\tSTART=%d\tLENGTH=%d\n" msgstr "ID=%02x\tPRINCIPIO=%d\tLONGITUD=%d\n" -#: fdisk/fdisksunlabel.c:43 +#: fdisk/fdisksunlabel.c:38 msgid "Unassigned" msgstr "" -#: fdisk/fdisksunlabel.c:45 +#: fdisk/fdisksunlabel.c:40 msgid "SunOS root" msgstr "SunOS root" -#: fdisk/fdisksunlabel.c:46 +#: fdisk/fdisksunlabel.c:41 msgid "SunOS swap" msgstr "SunOS swap" -#: fdisk/fdisksunlabel.c:47 +#: fdisk/fdisksunlabel.c:42 msgid "SunOS usr" msgstr "SunOS usr" -#: fdisk/fdisksunlabel.c:48 +#: fdisk/fdisksunlabel.c:43 msgid "Whole disk" msgstr "Disco completo" -#: fdisk/fdisksunlabel.c:49 +#: fdisk/fdisksunlabel.c:44 msgid "SunOS stand" msgstr "SunOS stand" -#: fdisk/fdisksunlabel.c:50 +#: fdisk/fdisksunlabel.c:45 msgid "SunOS var" msgstr "SunOS var" -#: fdisk/fdisksunlabel.c:51 +#: fdisk/fdisksunlabel.c:46 msgid "SunOS home" msgstr "SunOS home" -#: fdisk/fdisksunlabel.c:52 +#: fdisk/fdisksunlabel.c:47 #, fuzzy msgid "SunOS alt sectors" msgstr "%lld sectores no asignados\n" -#: fdisk/fdisksunlabel.c:53 +#: fdisk/fdisksunlabel.c:48 #, fuzzy msgid "SunOS cachefs" msgstr "SunOS home" -#: fdisk/fdisksunlabel.c:54 +#: fdisk/fdisksunlabel.c:49 #, fuzzy msgid "SunOS reserved" msgstr "SunOS usr" -#: fdisk/fdisksunlabel.c:58 fdisk/i386_sys_types.c:103 +#: fdisk/fdisksunlabel.c:53 fdisk/i386_sys_types.c:103 msgid "Linux raid autodetect" msgstr "Linux raid autodetect" -#: fdisk/fdisksunlabel.c:141 +#: fdisk/fdisksunlabel.c:136 #, c-format msgid "" "Detected sun disklabel with wrong checksum.\n" @@ -4378,42 +4253,32 @@ msgid "" "e.g. heads, sectors, cylinders and partitions\n" "or force a fresh label (s command in main menu)\n" msgstr "" -"Se ha detectado una etiqueta de disco sun con suma de comprobacin " -"incorrecta.\n" +"Se ha detectado una etiqueta de disco sun con suma de comprobacin incorrecta.\n" "Probablemente tendr que establecer todos los valores,\n" "como cabezas, sectores, cilindros y particiones\n" "o forzar una nueva etiqueta (orden s en men principal)\n" -#: fdisk/fdisksunlabel.c:153 +#: fdisk/fdisksunlabel.c:148 #, fuzzy, c-format msgid "Detected sun disklabel with wrong version [0x%08x].\n" -msgstr "" -"Se ha detectado una etiqueta de disco sgi con suma de comprobacin " -"incorrecta.\n" +msgstr "Se ha detectado una etiqueta de disco sgi con suma de comprobacin incorrecta.\n" -#: fdisk/fdisksunlabel.c:158 +#: fdisk/fdisksunlabel.c:153 #, fuzzy, c-format msgid "Detected sun disklabel with wrong sanity [0x%08x].\n" -msgstr "" -"Se ha detectado una etiqueta de disco sgi con suma de comprobacin " -"incorrecta.\n" +msgstr "Se ha detectado una etiqueta de disco sgi con suma de comprobacin incorrecta.\n" -#: fdisk/fdisksunlabel.c:163 +#: fdisk/fdisksunlabel.c:158 #, fuzzy, c-format msgid "Detected sun disklabel with wrong num_partitions [%u].\n" -msgstr "" -"Se ha detectado una etiqueta de disco sgi con suma de comprobacin " -"incorrecta.\n" +msgstr "Se ha detectado una etiqueta de disco sgi con suma de comprobacin incorrecta.\n" -#: fdisk/fdisksunlabel.c:168 +#: fdisk/fdisksunlabel.c:163 #, fuzzy, c-format -msgid "" -"Warning: Wrong values need to be fixed up and will be corrected by w(rite)\n" -msgstr "" -"Atencin: el indicador 0x%04x invlido de la tabla de particiones %d se " -"corregir mediante w(rite)\n" +msgid "Warning: Wrong values need to be fixed up and will be corrected by w(rite)\n" +msgstr "Atencin: el indicador 0x%04x invlido de la tabla de particiones %d se corregir mediante w(rite)\n" -#: fdisk/fdisksunlabel.c:198 +#: fdisk/fdisksunlabel.c:193 #, c-format msgid "" "Building a new sun disklabel. Changes will remain in memory only,\n" @@ -4426,31 +4291,31 @@ msgstr "" "operacin, el contenido anterior no se podr recuperar.\n" "\n" -#: fdisk/fdisksunlabel.c:236 +#: fdisk/fdisksunlabel.c:231 msgid "Sectors/track" msgstr "Sectores/pista" -#: fdisk/fdisksunlabel.c:351 +#: fdisk/fdisksunlabel.c:346 #, c-format msgid "Partition %d doesn't end on cylinder boundary\n" msgstr "La particin %d no termina en un lmite de cilindro\n" -#: fdisk/fdisksunlabel.c:371 +#: fdisk/fdisksunlabel.c:366 #, c-format msgid "Partition %d overlaps with others in sectors %d-%d\n" msgstr "La particin %d se solapa con otras en los sectores %d-%d\n" -#: fdisk/fdisksunlabel.c:393 +#: fdisk/fdisksunlabel.c:388 #, c-format msgid "Unused gap - sectors 0-%d\n" msgstr "Espacio no utilizado - sectores 0-%d\n" -#: fdisk/fdisksunlabel.c:395 fdisk/fdisksunlabel.c:401 +#: fdisk/fdisksunlabel.c:390 fdisk/fdisksunlabel.c:396 #, c-format msgid "Unused gap - sectors %d-%d\n" msgstr "Espacio no utilizado - sectores %d-%d\n" -#: fdisk/fdisksunlabel.c:426 +#: fdisk/fdisksunlabel.c:421 #, c-format msgid "" "Other partitions already cover the whole disk.\n" @@ -4459,7 +4324,7 @@ msgstr "" "Ya hay otras particiones que abarcan el disco completo.\n" "Suprima algunas o reduzca su tamao antes de volver a intentarlo.\n" -#: fdisk/fdisksunlabel.c:449 +#: fdisk/fdisksunlabel.c:444 #, fuzzy, c-format msgid "" "It is highly recommended that the third partition covers the whole disk\n" @@ -4468,12 +4333,12 @@ msgstr "" "Se recomienda que la particin 11\n" "abarque el disco completo y sea del tipo `SGI volume'\n" -#: fdisk/fdisksunlabel.c:477 +#: fdisk/fdisksunlabel.c:472 #, c-format msgid "Sector %d is already allocated\n" msgstr "El sector %d ya est asignado\n" -#: fdisk/fdisksunlabel.c:507 +#: fdisk/fdisksunlabel.c:502 #, c-format msgid "" "You haven't covered the whole disk with the 3rd partition, but your value\n" @@ -4484,7 +4349,7 @@ msgstr "" "el valor %d %s que ha especificado se solapa con otra particin.\n" "La entrada que ha realizado se ha cambiado por %d %s\n" -#: fdisk/fdisksunlabel.c:534 +#: fdisk/fdisksunlabel.c:529 #, c-format msgid "" "If you want to maintain SunOS/Solaris compatibility, consider leaving this\n" @@ -4493,7 +4358,7 @@ msgstr "" "Si desea mantener la compatibilidad con SunOS/Solaris, se recomienda dejar\n" "esta particin como disco completo (5), con principio en 0, con %u sectores\n" -#: fdisk/fdisksunlabel.c:549 +#: fdisk/fdisksunlabel.c:544 msgid "" "It is highly recommended that the partition at offset 0\n" "is UFS, EXT2FS filesystem or SunOS swap. Putting Linux swap\n" @@ -4507,7 +4372,7 @@ msgstr "" "Escriba S si est seguro de que desea que la particin\n" "est marcada con 82 (Linux swap): " -#: fdisk/fdisksunlabel.c:581 +#: fdisk/fdisksunlabel.c:576 #, fuzzy, c-format msgid "" "\n" @@ -4527,7 +4392,7 @@ msgstr "" "Unidades = %s de %d * 512 bytes\n" "\n" -#: fdisk/fdisksunlabel.c:597 +#: fdisk/fdisksunlabel.c:592 #, fuzzy, c-format msgid "" "\n" @@ -4540,28 +4405,28 @@ msgstr "" "Unidades = %s de %d * 512 bytes\n" "\n" -#: fdisk/fdisksunlabel.c:602 +#: fdisk/fdisksunlabel.c:597 #, c-format msgid "%*s Flag Start End Blocks Id System\n" msgstr "%*s Indic. Principio Fin Bloques Id Sistema\n" -#: fdisk/fdisksunlabel.c:630 +#: fdisk/fdisksunlabel.c:625 msgid "Number of alternate cylinders" msgstr "Nmero de cilindros alternativos" -#: fdisk/fdisksunlabel.c:642 +#: fdisk/fdisksunlabel.c:637 msgid "Extra sectors per cylinder" msgstr "Sectores adicionales por cilindro" -#: fdisk/fdisksunlabel.c:649 +#: fdisk/fdisksunlabel.c:644 msgid "Interleave factor" msgstr "Factor de interleave" -#: fdisk/fdisksunlabel.c:656 +#: fdisk/fdisksunlabel.c:651 msgid "Rotation speed (rpm)" msgstr "Velocidad de rotacin (r.p.m.)" -#: fdisk/fdisksunlabel.c:663 +#: fdisk/fdisksunlabel.c:658 msgid "Number of physical cylinders" msgstr "Nmero de cilindros fsicos" @@ -4914,11 +4779,11 @@ msgstr "DOS secondary" #: fdisk/i386_sys_types.c:101 msgid "VMware VMFS" -msgstr "" +msgstr "VMFS de VMware" #: fdisk/i386_sys_types.c:102 msgid "VMware VMKCORE" -msgstr "" +msgstr "VMKCORE de VMware" #: fdisk/i386_sys_types.c:106 msgid "LANstep" @@ -4974,9 +4839,7 @@ msgstr "No se puede ejecutar stat para fichero de restaurar partici #: fdisk/sfdisk.c:340 msgid "partition restore file has wrong size - not restoring\n" -msgstr "" -"Tamao incorrecto de fichero de restaurar particin; no se efecta " -"restauracin\n" +msgstr "Tamao incorrecto de fichero de restaurar particin; no se efecta restauracin\n" #: fdisk/sfdisk.c:344 msgid "out of memory?\n" @@ -5058,26 +4921,21 @@ msgstr "" #: fdisk/sfdisk.c:595 #, c-format -msgid "" -"%s of partition %s has impossible value for head: %lu (should be in 0-%lu)\n" +msgid "%s of partition %s has impossible value for head: %lu (should be in 0-%lu)\n" msgstr "" "%s de particin %s tiene un valor imposible para cabeza: %lu\n" "(debe estar entre 0 y %lu)\n" #: fdisk/sfdisk.c:600 #, c-format -msgid "" -"%s of partition %s has impossible value for sector: %lu (should be in 1-%" -"lu)\n" +msgid "%s of partition %s has impossible value for sector: %lu (should be in 1-%lu)\n" msgstr "" "%s de particin %s tiene un valor imposible para sector: %lu\n" "(debe estar entre 1 y %lu)\n" #: fdisk/sfdisk.c:605 #, c-format -msgid "" -"%s of partition %s has impossible value for cylinders: %lu (should be in 0-%" -"lu)\n" +msgid "%s of partition %s has impossible value for cylinders: %lu (should be in 0-%lu)\n" msgstr "" "%s de particin %s tiene un valor imposible para cilindros: %lu\n" "(debe estar entre 0 y %lu)\n" @@ -5174,8 +5032,7 @@ msgid "" "Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from %d\n" "\n" msgstr "" -"Unidades = megabytes de 1048576 bytes, bloques de 1024 bytes, contando desde " -"%d\n" +"Unidades = megabytes de 1048576 bytes, bloques de 1024 bytes, contando desde %d\n" "\n" #: fdisk/sfdisk.c:953 @@ -5186,21 +5043,17 @@ msgstr " Disp. Inic Princ. Fin MiB N #: fdisk/sfdisk.c:1113 #, c-format msgid "\t\tstart: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n" -msgstr "" -"\t\tprincipio: (cil.,cab.,sect.) esperado (%ld,%ld,%ld) detectado (%ld,%ld,%" -"ld)\n" +msgstr "\t\tprincipio: (cil.,cab.,sect.) esperado (%ld,%ld,%ld) detectado (%ld,%ld,%ld)\n" #: fdisk/sfdisk.c:1120 #, c-format msgid "\t\tend: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n" -msgstr "" -"\t\tfin: (cil.,cab.,sect.) esperado (%ld,%ld,%ld) detectado (%ld,%ld,%ld)\n" +msgstr "\t\tfin: (cil.,cab.,sect.) esperado (%ld,%ld,%ld) detectado (%ld,%ld,%ld)\n" #: fdisk/sfdisk.c:1123 #, c-format msgid "partition ends on cylinder %ld, beyond the end of the disk\n" -msgstr "" -"La particin termina en el cilindro %ld, ms all del final del disco\n" +msgstr "La particin termina en el cilindro %ld, ms all del final del disco\n" #: fdisk/sfdisk.c:1133 msgid "No partitions found\n" @@ -5229,8 +5082,7 @@ msgstr "Extra #: fdisk/sfdisk.c:1197 #, c-format msgid "Warning: partition %s has size 0 but is not marked Empty\n" -msgstr "" -"Atencin: la particin %s tiene tamao 0 pero no est marcada como vaca\n" +msgstr "Atencin: la particin %s tiene tamao 0 pero no est marcada como vaca\n" #: fdisk/sfdisk.c:1200 #, c-format @@ -5240,8 +5092,7 @@ msgstr "Atenci #: fdisk/sfdisk.c:1203 #, c-format msgid "Warning: partition %s has size 0 and nonzero start\n" -msgstr "" -"Atencin: la particin %s tiene tamao 0 y principio distinto de cero\n" +msgstr "Atencin: la particin %s tiene tamao 0 y principio distinto de cero\n" #: fdisk/sfdisk.c:1214 #, c-format @@ -5306,8 +5157,7 @@ msgid "" "This does not matter for LILO, but the DOS MBR will not boot this disk.\n" msgstr "" "Atencin: hay ms de una particin primaria marcada como iniciable (activa)\n" -"Esto no es poblema para LILO, pero el MBR de DOS no se iniciar con este " -"disco.\n" +"Esto no es poblema para LILO, pero el MBR de DOS no se iniciar con este disco.\n" #: fdisk/sfdisk.c:1318 msgid "" @@ -5322,10 +5172,8 @@ msgid "" "Warning: no primary partition is marked bootable (active)\n" "This does not matter for LILO, but the DOS MBR will not boot this disk.\n" msgstr "" -"Atencin: no hay ninguna particin primaria marcada como iniciable " -"(activa).\n" -"Esto no es problema para LILO, pero el MBR de DOS no iniciar con este " -"disco.\n" +"Atencin: no hay ninguna particin primaria marcada como iniciable (activa).\n" +"Esto no es problema para LILO, pero el MBR de DOS no iniciar con este disco.\n" #: fdisk/sfdisk.c:1338 msgid "start" @@ -5333,11 +5181,8 @@ msgstr "comienzo" #: fdisk/sfdisk.c:1341 #, c-format -msgid "" -"partition %s: start: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n" -msgstr "" -"Particin %s: principio: (cil.,cab.,sect.) esperado (%ld,%ld,%ld) detectado " -"(%ld,%ld,%ld)\n" +msgid "partition %s: start: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n" +msgstr "Particin %s: principio: (cil.,cab.,sect.) esperado (%ld,%ld,%ld) detectado (%ld,%ld,%ld)\n" #: fdisk/sfdisk.c:1347 msgid "end" @@ -5346,15 +5191,12 @@ msgstr "final" #: fdisk/sfdisk.c:1350 #, c-format msgid "partition %s: end: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n" -msgstr "" -"Particin %s: fin: (cil.,cab.,sect.) esperado (%ld,%ld,%ld) detectado (%ld,%" -"ld,%ld)\n" +msgstr "Particin %s: fin: (cil.,cab.,sect.) esperado (%ld,%ld,%ld) detectado (%ld,%ld,%ld)\n" #: fdisk/sfdisk.c:1353 #, c-format msgid "partition %s ends on cylinder %ld, beyond the end of the disk\n" -msgstr "" -"La particin %s termina en el cilindro %ld, ms all del final del disco\n" +msgstr "La particin %s termina en el cilindro %ld, ms all del final del disco\n" #: fdisk/sfdisk.c:1378 #, c-format @@ -5467,8 +5309,7 @@ msgstr "Tipo no permitido\n" #: fdisk/sfdisk.c:2102 #, c-format msgid "Warning: given size (%lu) exceeds max allowable size (%lu)\n" -msgstr "" -"Atencin: el tamao dado (%lu) supera el tamao mximo permitido (%lu)\n" +msgstr "Atencin: el tamao dado (%lu) supera el tamao mximo permitido (%lu)\n" #: fdisk/sfdisk.c:2108 msgid "Warning: empty partition\n" @@ -5505,10 +5346,8 @@ msgid "" " \n" "Usually you only need to specify and (and perhaps ).\n" msgstr "" -"Entrada con el formato siguiente; los campos ausentes utilizan el valor " -"predeterminado.\n" -" " -"\n" +"Entrada con el formato siguiente; los campos ausentes utilizan el valor predeterminado.\n" +" \n" "Normalmente slo debe especificar y (y quizs ).\n" #: fdisk/sfdisk.c:2289 @@ -5530,8 +5369,7 @@ msgstr " -s [o --show-size]: Muestra el tama #: fdisk/sfdisk.c:2293 msgid " -c [or --id]: print or change partition Id" -msgstr "" -" -c [o --id]: Imprime o cambia el identificador de particin" +msgstr " -c [o --id]: Imprime o cambia el identificador de particin" #: fdisk/sfdisk.c:2294 msgid " -l [or --list]: list partitions of each device" @@ -5545,13 +5383,10 @@ msgstr "" #: fdisk/sfdisk.c:2296 msgid " -i [or --increment]: number cylinders etc. from 1 instead of from 0" -msgstr "" -" -i [o --increment]: Nmero de cilindros, etc. desde 1 y no desde 0" +msgstr " -i [o --increment]: Nmero de cilindros, etc. desde 1 y no desde 0" #: fdisk/sfdisk.c:2297 -msgid "" -" -uS, -uB, -uC, -uM: accept/report in units of sectors/blocks/cylinders/" -"MB" +msgid " -uS, -uB, -uC, -uM: accept/report in units of sectors/blocks/cylinders/MB" msgstr "" " -uS, -uB, -uC, -uM: Acepta/muestra en unidades de\n" " sectores/bloques/cilindros/MB" @@ -5562,9 +5397,7 @@ msgstr " -T [o --list-types]: Muestra los tipos de particiones conocidos" #: fdisk/sfdisk.c:2299 msgid " -D [or --DOS]: for DOS-compatibility: waste a little space" -msgstr "" -" -D [o --DOS]: Para compatibilidad con DOS: se pierde algo de " -"espacio" +msgstr " -D [o --DOS]: Para compatibilidad con DOS: se pierde algo de espacio" #: fdisk/sfdisk.c:2300 msgid " -R [or --re-read]: make kernel reread partition table" @@ -5574,16 +5407,14 @@ msgstr "" #: fdisk/sfdisk.c:2301 msgid " -N# : change only the partition with number #" -msgstr "" -" -N# : Cambia nicamente la particin con el nmero #" +msgstr " -N# : Cambia nicamente la particin con el nmero #" #: fdisk/sfdisk.c:2302 msgid " -n : do not actually write to disk" msgstr " -n : No escribe realmente en el disco" #: fdisk/sfdisk.c:2303 -msgid "" -" -O file : save the sectors that will be overwritten to file" +msgid " -O file : save the sectors that will be overwritten to file" msgstr "" " -O fichero : Guarda los sectores que se van a sobreescribir\n" " en `fichero'" @@ -5606,16 +5437,12 @@ msgstr "opciones peligrosas:" #: fdisk/sfdisk.c:2308 msgid " -g [or --show-geometry]: print the kernel's idea of the geometry" -msgstr "" -" -g [o --show-geometry]: Imprime la idea del ncleo sobre la geometra" +msgstr " -g [o --show-geometry]: Imprime la idea del ncleo sobre la geometra" #: fdisk/sfdisk.c:2309 #, fuzzy -msgid "" -" -G [or --show-pt-geometry]: print geometry guessed from the partition " -"table" -msgstr "" -" -g [o --show-geometry]: Imprime la idea del ncleo sobre la geometra" +msgid " -G [or --show-pt-geometry]: print geometry guessed from the partition table" +msgstr " -g [o --show-geometry]: Imprime la idea del ncleo sobre la geometra" #: fdisk/sfdisk.c:2310 msgid "" @@ -5626,11 +5453,9 @@ msgstr "" " salida o espera sus descriptores en entrada" #: fdisk/sfdisk.c:2312 -msgid "" -" -L [or --Linux]: do not complain about things irrelevant for Linux" +msgid " -L [or --Linux]: do not complain about things irrelevant for Linux" msgstr "" -" -L [o --Linux]: No muestra avisos sobre aspectos irrelevantes " -"para\n" +" -L [o --Linux]: No muestra avisos sobre aspectos irrelevantes para\n" " Linux" #: fdisk/sfdisk.c:2313 @@ -5643,18 +5468,15 @@ msgstr " Puede modificar la geometr #: fdisk/sfdisk.c:2315 msgid " -C# [or --cylinders #]:set the number of cylinders to use" -msgstr "" -" -C# [o --cylinders #]: Establece el nmero de cilindros que se utilizarn" +msgstr " -C# [o --cylinders #]: Establece el nmero de cilindros que se utilizarn" #: fdisk/sfdisk.c:2316 msgid " -H# [or --heads #]: set the number of heads to use" -msgstr "" -" -H# [o --heads #]: Establece el nmero de cabezas que se utilizarn" +msgstr " -H# [o --heads #]: Establece el nmero de cabezas que se utilizarn" #: fdisk/sfdisk.c:2317 msgid " -S# [or --sectors #]: set the number of sectors to use" -msgstr "" -" -S# [o --sectors #]: Establece el nmero de sectores que se utilizarn" +msgstr " -S# [o --sectors #]: Establece el nmero de sectores que se utilizarn" #: fdisk/sfdisk.c:2318 msgid "You can disable all consistency checking with:" @@ -5662,8 +5484,7 @@ msgstr "Puede desactivar toda comprobaci #: fdisk/sfdisk.c:2319 msgid " -f [or --force]: do what I say, even if it is stupid" -msgstr "" -" -f [o --force]: Hace lo que ordene el usuario, aunque sea ilgico" +msgstr " -f [o --force]: Hace lo que ordene el usuario, aunque sea ilgico" #: fdisk/sfdisk.c:2325 msgid "Usage:" @@ -5677,8 +5498,7 @@ msgstr "%s dispositivo\t\t Enumera las particiones activas del dispositivo\n" #: fdisk/sfdisk.c:2327 #, c-format msgid "%s device n1 n2 ... activate partitions n1 ..., inactivate the rest\n" -msgstr "" -"%s dispositivo n1 n2 ... activar particiones n1 ..., desactivar el resto\n" +msgstr "%s dispositivo n1 n2 ... activar particiones n1 ..., desactivar el resto\n" #: fdisk/sfdisk.c:2328 #, c-format @@ -5689,8 +5509,7 @@ msgstr "%s -An dispositivo\t activa la partici #, c-format msgid "" "\n" -"WARNING: GPT (GUID Partition Table) detected on '%s'! The util sfdisk " -"doesn't support GPT. Use GNU Parted.\n" +"WARNING: GPT (GUID Partition Table) detected on '%s'! The util sfdisk doesn't support GPT. Use GNU Parted.\n" "\n" msgstr "" @@ -5807,11 +5626,9 @@ msgid "" "Use the --no-reread flag to suppress this check.\n" msgstr "" "\n" -"Este disco est actualmente en uso; no se aconseja volver a crear " -"particiones.\n" +"Este disco est actualmente en uso; no se aconseja volver a crear particiones.\n" "Desmonte todos los sistemas de ficheros y deshaga todas las particiones de\n" -"intercambio de este disco. Utilice el indicador --no-reread para eliminar " -"esta\n" +"intercambio de este disco. Utilice el indicador --no-reread para eliminar esta\n" "comprobacin.\n" #: fdisk/sfdisk.c:3033 @@ -5842,15 +5659,12 @@ msgid "" "I don't like these partitions - nothing changed.\n" "(If you really want this, use the --force option.)\n" msgstr "" -"El sistema no encuentra adecuadas estas particiones; no se ha cambiado " -"nada.\n" +"El sistema no encuentra adecuadas estas particiones; no se ha cambiado nada.\n" "(Si realmente desea realizar esta operacin, use la opcin --force.)\n" #: fdisk/sfdisk.c:3066 msgid "I don't like this - probably you should answer No\n" -msgstr "" -"El sistema no encuentra adecuada esta operacin; probablemente deba " -"responder No\n" +msgstr "El sistema no encuentra adecuada esta operacin; probablemente deba responder No\n" #: fdisk/sfdisk.c:3071 #, c-format @@ -5896,21 +5710,20 @@ msgid "" "(See fdisk(8).)\n" msgstr "" "Si ha creado o modificado una particin DOS, como /dev/foo7, utilice dd(1)\n" -"para poner a cero los 512 primeros bytes: dd if=/dev/zero of=/dev/foo7 " -"bs=512 count=1\n" +"para poner a cero los 512 primeros bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1\n" "(Vase fdisk(8).)\n" -#: fsck/fsck.c:327 +#: fsck/fsck.c:326 #, fuzzy, c-format msgid "WARNING: couldn't open %s: %s\n" msgstr "%s: no se puede abrir %s: %s\n" -#: fsck/fsck.c:337 +#: fsck/fsck.c:336 #, c-format msgid "WARNING: bad format on line %d of %s\n" msgstr "" -#: fsck/fsck.c:353 +#: fsck/fsck.c:352 msgid "" "WARNING: Your /etc/fstab does not contain the fsck passno\n" "\tfield. I will kludge around things for you, but you\n" @@ -5918,116 +5731,113 @@ msgid "" "\n" msgstr "" -#: fsck/fsck.c:461 +#: fsck/fsck.c:460 #, fuzzy, c-format msgid "fsck: %s: not found\n" msgstr "umount: %s: no se ha encontrado" -#: fsck/fsck.c:577 +#: fsck/fsck.c:576 #, c-format msgid "%s: wait: No more child process?!?\n" msgstr "" -#: fsck/fsck.c:599 +#: fsck/fsck.c:598 #, c-format msgid "Warning... %s for device %s exited with signal %d.\n" msgstr "" -#: fsck/fsck.c:605 +#: fsck/fsck.c:604 #, c-format msgid "%s %s: status is %x, should never happen.\n" msgstr "" -#: fsck/fsck.c:644 +#: fsck/fsck.c:643 #, c-format msgid "Finished with %s (exit status %d)\n" msgstr "" -#: fsck/fsck.c:704 +#: fsck/fsck.c:703 #, fuzzy, c-format msgid "%s: Error %d while executing fsck.%s for %s\n" msgstr "%s: error %d al descomprimir! %p(%d)\n" -#: fsck/fsck.c:725 +#: fsck/fsck.c:724 msgid "" "Either all or none of the filesystem types passed to -t must be prefixed\n" "with 'no' or '!'.\n" msgstr "" -#: fsck/fsck.c:744 +#: fsck/fsck.c:743 #, fuzzy msgid "Couldn't allocate memory for filesystem types\n" msgstr "mount: debe especificar el tipo de sistema de ficheros" -#: fsck/fsck.c:883 +#: fsck/fsck.c:882 #, c-format -msgid "" -"%s: skipping bad line in /etc/fstab: bind mount with nonzero fsck pass " -"number\n" +msgid "%s: skipping bad line in /etc/fstab: bind mount with nonzero fsck pass number\n" msgstr "" -#: fsck/fsck.c:893 +#: fsck/fsck.c:892 #, fuzzy, c-format msgid "%s: skipping nonexistent device\n" msgstr "%s: %s no es un dispositivo lp.\n" -#: fsck/fsck.c:919 +#: fsck/fsck.c:918 #, c-format msgid "fsck: cannot check %s: fsck.%s not found\n" msgstr "" -#: fsck/fsck.c:975 +#: fsck/fsck.c:974 #, fuzzy msgid "Checking all file systems.\n" msgstr "Forzando comprobacin del sistema de ficheros en %s.\n" -#: fsck/fsck.c:1066 +#: fsck/fsck.c:1065 #, c-format msgid "--waiting-- (pass %d)\n" msgstr "" -#: fsck/fsck.c:1086 +#: fsck/fsck.c:1085 #, fuzzy -msgid "" -"Usage: fsck [-AMNPRTV] [ -C [ fd ] ] [-t fstype] [fs-options] [filesys ...]\n" +msgid "Usage: fsck [-AMNPRTV] [ -C [ fd ] ] [-t fstype] [fs-options] [filesys ...]\n" msgstr "Uso: mkfs [-V] [-t tipo_sf] [opciones_sf] dispositivo [tamao]\n" -#: fsck/fsck.c:1124 +#: fsck/fsck.c:1123 #, fuzzy, c-format msgid "%s: too many devices\n" msgstr "%s: %s no es un dispositivo lp.\n" -#: fsck/fsck.c:1135 +#: fsck/fsck.c:1134 #, fuzzy, c-format msgid "Couldn't open %s: %s\n" msgstr "No se puede abrir %s: %s\n" -#: fsck/fsck.c:1137 +#: fsck/fsck.c:1136 #, fuzzy, c-format msgid "Is /proc mounted?\n" msgstr "Se ha ejecutado umount en %s\n" -#: fsck/fsck.c:1146 +#: fsck/fsck.c:1145 #, c-format msgid "Must be root to scan for matching filesystems: %s\n" msgstr "" -#: fsck/fsck.c:1149 +#: fsck/fsck.c:1148 #, fuzzy, c-format msgid "Couldn't find matching filesystem: %s\n" msgstr "Desmontando los sistemas de ficheros restantes..." -#: fsck/fsck.c:1157 fsck/fsck.c:1243 +#: fsck/fsck.c:1156 fsck/fsck.c:1242 #, fuzzy, c-format msgid "%s: too many arguments\n" msgstr "%s: argumento desconocido: %s\n" -#: fsck/fsck.c:1277 +#: fsck/fsck.c:1276 #, fuzzy, c-format msgid "fsck from %s\n" msgstr "%s de %s\n" -#: fsck/fsck.c:1289 +#: fsck/fsck.c:1288 #, fuzzy, c-format msgid "%s: Unable to allocate memory for fsck_path\n" msgstr "No se puede asignar bfer para los nodos-i" @@ -6061,11 +5871,8 @@ msgid " parameters\n" msgstr " parmetros\n" #: getopt/getopt.c:324 -msgid "" -" -a, --alternative Allow long options starting with single -\n" -msgstr "" -" -a, --alternative Permite opciones largas con un solo - " -"inicial\n" +msgid " -a, --alternative Allow long options starting with single -\n" +msgstr " -a, --alternative Permite opciones largas con un solo - inicial\n" #: getopt/getopt.c:325 msgid " -h, --help This small usage guide\n" @@ -6076,11 +5883,8 @@ msgid " -l, --longoptions=longopts Long options to be recognized\n" msgstr " -l, --longoptions=opclargas Opciones largas para reconocer\n" #: getopt/getopt.c:327 -msgid "" -" -n, --name=progname The name under which errors are reported\n" -msgstr "" -" -n, --name=nombreprograma El nombre con el que se informa de los " -"errores\n" +msgid " -n, --name=progname The name under which errors are reported\n" +msgstr " -n, --name=nombreprograma El nombre con el que se informa de los errores\n" #: getopt/getopt.c:328 msgid " -o, --options=optstring Short options to be recognized\n" @@ -6098,9 +5902,7 @@ msgstr " -Q, --quiet-output No hay salida normal\n" #: getopt/getopt.c:331 msgid " -s, --shell=shell Set shell quoting conventions\n" -msgstr "" -" -s, --shell=intrpr.rdenes Define las convenciones de cita del " -"intrprete\n" +msgstr " -s, --shell=intrpr.rdenes Define las convenciones de cita del intrprete\n" #: getopt/getopt.c:332 msgid " -T, --test Test for getopt(1) version\n" @@ -6186,8 +5988,7 @@ msgstr "No se ha podido obtener permiso porque no se ha intentado.\n" #: hwclock/cmos.c:584 #, c-format msgid "%s is unable to get I/O port access: the iopl(3) call failed.\n" -msgstr "" -"%s no puede obtener acceso al puerto de E/S: la llamada iopl(3) ha fallado.\n" +msgstr "%s no puede obtener acceso al puerto de E/S: la llamada iopl(3) ha fallado.\n" #: hwclock/cmos.c:587 #, c-format @@ -6259,9 +6060,7 @@ msgstr "Valores inv #: hwclock/hwclock.c:420 #, c-format msgid "Hw clock time : %4d/%.2d/%.2d %.2d:%.2d:%.2d = %ld seconds since 1969\n" -msgstr "" -"Hora del reloj de hardware: %4d/%.2d/%.2d %.2d:%.2d:%.2d = %ld segundos " -"desde 1969\n" +msgstr "Hora del reloj de hardware: %4d/%.2d/%.2d %.2d:%.2d:%.2d = %ld segundos desde 1969\n" #: hwclock/hwclock.c:450 #, c-format @@ -6271,8 +6070,7 @@ msgstr "Hora le #: hwclock/hwclock.c:479 #, c-format msgid "Setting Hardware Clock to %.2d:%.2d:%.2d = %ld seconds since 1969\n" -msgstr "" -"Estableciendo reloj de hardware en %.2d:%.2d:%.2d = %ld segundos desde 1969\n" +msgstr "Estableciendo reloj de hardware en %.2d:%.2d:%.2d = %ld segundos desde 1969\n" #: hwclock/hwclock.c:485 #, c-format @@ -6290,9 +6088,7 @@ msgstr "" #: hwclock/hwclock.c:571 #, c-format -msgid "" -"The Hardware Clock registers contain values that are either invalid (e.g. " -"50th day of month) or beyond the range we can handle (e.g. Year 2095).\n" +msgid "The Hardware Clock registers contain values that are either invalid (e.g. 50th day of month) or beyond the range we can handle (e.g. Year 2095).\n" msgstr "" "Los registros del reloj de hardware contienen valores que no son vlidos\n" "(por ejemplo, da 50 del mes) o exceden el rango que puede utilizarse\n" @@ -6329,9 +6125,7 @@ msgstr "Ejecutando orden date: %s\n" #: hwclock/hwclock.c:640 msgid "Unable to run 'date' program in /bin/sh shell. popen() failed" -msgstr "" -"No se puede ejecutar el programa 'date' en intrprete de rdenes /bin/sh. " -"popen() ha fallado" +msgstr "No se puede ejecutar el programa 'date' en intrprete de rdenes /bin/sh. popen() ha fallado" #: hwclock/hwclock.c:648 #, c-format @@ -6356,15 +6150,13 @@ msgstr "" #: hwclock/hwclock.c:662 #, c-format msgid "" -"The date command issued by %s returned something other than an integer where " -"the converted time value was expected.\n" +"The date command issued by %s returned something other than an integer where the converted time value was expected.\n" "The command was:\n" " %s\n" "The response was:\n" " %s\n" msgstr "" -"La orden date emitido por %s ha devuelto un valor no entero cuando se " -"esperaba el valor de hora convertida.\n" +"La orden date emitido por %s ha devuelto un valor no entero cuando se esperaba el valor de hora convertida.\n" "La orden fue:\n" " %s\n" "La respuesta fue:\n" @@ -6377,12 +6169,8 @@ msgstr "La cadena de fecha %s equivale a %ld segundos desde 1969.\n" #: hwclock/hwclock.c:705 #, c-format -msgid "" -"The Hardware Clock does not contain a valid time, so we cannot set the " -"System Time from it.\n" -msgstr "" -"El reloj de hardware no contiene una hora vlida, por lo que no se puede " -"establecer la hora del sistema a partir de ese valor.\n" +msgid "The Hardware Clock does not contain a valid time, so we cannot set the System Time from it.\n" +msgstr "El reloj de hardware no contiene una hora vlida, por lo que no se puede establecer la hora del sistema a partir de ese valor.\n" #: hwclock/hwclock.c:727 hwclock/hwclock.c:804 #, c-format @@ -6402,9 +6190,7 @@ msgstr "\ttz.tz_minuteswest = %d\n" #: hwclock/hwclock.c:733 hwclock/hwclock.c:811 #, c-format msgid "Not setting system clock because running in test mode.\n" -msgstr "" -"No se establece el reloj del sistema ya que la ejecucin es en modo de " -"prueba.\n" +msgstr "No se establece el reloj del sistema ya que la ejecucin es en modo de prueba.\n" #: hwclock/hwclock.c:742 hwclock/hwclock.c:820 #, c-format @@ -6427,9 +6213,7 @@ msgstr "" #: hwclock/hwclock.c:852 #, c-format -msgid "" -"Not adjusting drift factor because the Hardware Clock previously contained " -"garbage.\n" +msgid "Not adjusting drift factor because the Hardware Clock previously contained garbage.\n" msgstr "" "No se ajusta el factor de desfase debido a que el reloj de hardware\n" "contena anteriormente datos extraos.\n" @@ -6446,9 +6230,7 @@ msgstr "" #: hwclock/hwclock.c:863 #, c-format -msgid "" -"Not adjusting drift factor because it has been less than a day since the " -"last calibration.\n" +msgid "Not adjusting drift factor because it has been less than a day since the last calibration.\n" msgstr "" "No se ajusta el factor de desfase debido a que hace menos de un da que se\n" "realiz la ltima calibracin.\n" @@ -6456,14 +6238,11 @@ msgstr "" #: hwclock/hwclock.c:911 #, c-format msgid "" -"Clock drifted %.1f seconds in the past %d seconds in spite of a drift factor " -"of %f seconds/day.\n" +"Clock drifted %.1f seconds in the past %d seconds in spite of a drift factor of %f seconds/day.\n" "Adjusting drift factor by %f seconds/day\n" msgstr "" -"El reloj se ha desfasado %.1f segundos en los ltimos %d segundos a pesar " -"de\n" -"utilizar un factor de desfase de %f segundos por da. Se ajusta el factor " -"de\n" +"El reloj se ha desfasado %.1f segundos en los ltimos %d segundos a pesar de\n" +"utilizar un factor de desfase de %f segundos por da. Se ajusta el factor de\n" "desfase en %f segundos por da\n" #: hwclock/hwclock.c:961 @@ -6474,9 +6253,7 @@ msgstr "El tiempo transcurrido desde el #: hwclock/hwclock.c:963 #, c-format msgid "Need to insert %d seconds and refer time back %.6f seconds ago\n" -msgstr "" -"Es preciso insertar %d segundos y establecer como referencia la hora %.6f " -"segundos hacia atrs\n" +msgstr "Es preciso insertar %d segundos y establecer como referencia la hora %.6f segundos hacia atrs\n" #: hwclock/hwclock.c:992 #, c-format @@ -6494,9 +6271,7 @@ msgstr "" #: hwclock/hwclock.c:1001 #, c-format -msgid "" -"Could not open file with the clock adjustment parameters in it (%s) for " -"writing" +msgid "Could not open file with the clock adjustment parameters in it (%s) for writing" msgstr "" #: hwclock/hwclock.c:1006 hwclock/hwclock.c:1011 @@ -6511,16 +6286,12 @@ msgstr "Par #: hwclock/hwclock.c:1058 #, c-format -msgid "" -"The Hardware Clock does not contain a valid time, so we cannot adjust it.\n" -msgstr "" -"El reloj de hardware no contiene una hora vlida, por lo que no se puede " -"ajustar.\n" +msgid "The Hardware Clock does not contain a valid time, so we cannot adjust it.\n" +msgstr "El reloj de hardware no contiene una hora vlida, por lo que no se puede ajustar.\n" #: hwclock/hwclock.c:1066 #, fuzzy, c-format -msgid "" -"Not setting clock because last adjustment time is zero, so history is bad." +msgid "Not setting clock because last adjustment time is zero, so history is bad." msgstr "" "No se ajusta el factor de desfase debido a que la fecha de ltima\n" "calibracin es cero, as que el historial es errneo y es necesaria una\n" @@ -6529,9 +6300,7 @@ msgstr "" #: hwclock/hwclock.c:1089 #, c-format msgid "Needed adjustment is less than one second, so not setting clock.\n" -msgstr "" -"El ajuste necesario es inferior a un segundo, por lo que no se establece el " -"reloj.\n" +msgstr "El ajuste necesario es inferior a un segundo, por lo que no se establece el reloj.\n" #: hwclock/hwclock.c:1115 #, c-format @@ -6551,8 +6320,7 @@ msgstr "No se puede establecer el reloj del sistema.\n" #: hwclock/hwclock.c:1257 #, c-format msgid "" -"The kernel keeps an epoch value for the Hardware Clock only on an Alpha " -"machine.\n" +"The kernel keeps an epoch value for the Hardware Clock only on an Alpha machine.\n" "This copy of hwclock was built for a machine other than Alpha\n" "(and thus is presumably not running on an Alpha now). No action taken.\n" msgstr "" @@ -6573,25 +6341,20 @@ msgstr "El n #: hwclock/hwclock.c:1271 #, c-format -msgid "" -"To set the epoch value, you must use the 'epoch' option to tell to what " -"value to set it.\n" -msgstr "" -"Para establecer el valor de poca, debe utilizar la opcin 'epoch' para " -"indicar en qu valor debe definirse.\n" +msgid "To set the epoch value, you must use the 'epoch' option to tell to what value to set it.\n" +msgstr "Para establecer el valor de poca, debe utilizar la opcin 'epoch' para indicar en qu valor debe definirse.\n" #: hwclock/hwclock.c:1274 #, c-format msgid "Not setting the epoch to %d - testing only.\n" -msgstr "" -"No se est estableciendo el valor de poca en %d; slo se est probando.\n" +msgstr "No se est estableciendo el valor de poca en %d; slo se est probando.\n" #: hwclock/hwclock.c:1277 #, c-format msgid "Unable to set the epoch value in the kernel.\n" msgstr "No se puede establecer el valor de poca en el ncleo.\n" -#: hwclock/hwclock.c:1290 misc-utils/cal.c:343 misc-utils/kill.c:189 +#: hwclock/hwclock.c:1290 misc-utils/cal.c:347 misc-utils/kill.c:189 #, c-format msgid "%s from %s\n" msgstr "%s de %s\n" @@ -6643,26 +6406,21 @@ msgstr "" " --help Muestra esta ayuda\n" " --show Lee el reloj de hardware e imprime el resultado\n" " --set Establece el RTC en la hora proporcionada con --date\n" -" --hctosys Establece la hora del sistema a partir del reloj de " -"hardware\n" -" --systohc Establece el reloj de hardware en la hora actual del " -"sistema\n" +" --hctosys Establece la hora del sistema a partir del reloj de hardware\n" +" --systohc Establece el reloj de hardware en la hora actual del sistema\n" " --adjust Ajusta el RTC para compensar el desfase sistemtico desde \n" " la ltima vez que se estableci o ajust el reloj\n" " --getepoch Imprime el valor de poca del reloj de hardware del ncleo\n" -" --setepoch Establece el valor de poca del reloj de hardware del " -"ncleo \n" +" --setepoch Establece el valor de poca del reloj de hardware del ncleo \n" " en el valor proporcionado en --epoch\n" " --version Imprime la versin de hwclock en la salida estndar\n" "\n" "Opciones: \n" -" --utc El reloj de hardware est en Tiempo Universal Coordinado " -"(UTC)\n" +" --utc El reloj de hardware est en Tiempo Universal Coordinado (UTC)\n" " --localtime El reloj de hardware tiene la hora local\n" " --directisa Accede al bus ISA directamente en lugar de a %s\n" " --badyear Hace caso omiso del ao del RTC ya que el BIOS no funciona\n" -" --date Especifica la fecha/hora en que se desea establecer el " -"reloj\n" +" --date Especifica la fecha/hora en que se desea establecer el reloj\n" " de hardware\n" " --epoch=ao Especifica el ao que corresponde al principio del valor de\n" " poca del reloj de hardware\n" @@ -6677,8 +6435,7 @@ msgid "" "\n" msgstr "" " --jensen, --arc, --srm, --funky-toy\n" -" Indica al reloj de hardware el tipo de Alpha (ver hwclock" -"(8))\n" +" Indica al reloj de hardware el tipo de Alpha (ver hwclock(8))\n" #: hwclock/hwclock.c:1433 #, fuzzy, c-format @@ -6701,36 +6458,23 @@ msgstr "" #: hwclock/hwclock.c:1565 #, c-format -msgid "" -"%s: The --utc and --localtime options are mutually exclusive. You specified " -"both.\n" -msgstr "" -"%s: las opciones --utc y --localtime se excluyen mutuamente. Ha especificado " -"ambas.\n" +msgid "%s: The --utc and --localtime options are mutually exclusive. You specified both.\n" +msgstr "%s: las opciones --utc y --localtime se excluyen mutuamente. Ha especificado ambas.\n" #: hwclock/hwclock.c:1572 #, c-format -msgid "" -"%s: The --adjust and --noadjfile options are mutually exclusive. You " -"specified both.\n" -msgstr "" -"%s: las opciones --adjust y --noadjfile se excluyen mutuamente. Ha " -"especificado ambas.\n" +msgid "%s: The --adjust and --noadjfile options are mutually exclusive. You specified both.\n" +msgstr "%s: las opciones --adjust y --noadjfile se excluyen mutuamente. Ha especificado ambas.\n" #: hwclock/hwclock.c:1579 #, fuzzy, c-format -msgid "" -"%s: The --adjfile and --noadjfile options are mutually exclusive. You " -"specified both.\n" -msgstr "" -"%s: las opciones --adjust y --noadjfile se excluyen mutuamente. Ha " -"especificado ambas.\n" +msgid "%s: The --adjfile and --noadjfile options are mutually exclusive. You specified both.\n" +msgstr "%s: las opciones --adjust y --noadjfile se excluyen mutuamente. Ha especificado ambas.\n" #: hwclock/hwclock.c:1588 #, c-format msgid "%s: With --noadjfile, you must specify either --utc or --localtime\n" -msgstr "" -"%s: Con --noadjfile, debe especificarse o bien --utc o bien --localtime\n" +msgstr "%s: Con --noadjfile, debe especificarse o bien --utc o bien --localtime\n" #: hwclock/hwclock.c:1602 #, c-format @@ -6749,12 +6493,8 @@ msgstr " #: hwclock/hwclock.c:1629 #, c-format -msgid "" -"Sorry, only the superuser can change the Hardware Clock epoch in the " -"kernel.\n" -msgstr "" -"Slo el superusuario puede cambiar el valor de poca del reloj de hardware " -"del ncleo.\n" +msgid "Sorry, only the superuser can change the Hardware Clock epoch in the kernel.\n" +msgstr "Slo el superusuario puede cambiar el valor de poca del reloj de hardware del ncleo.\n" #: hwclock/hwclock.c:1650 #, c-format @@ -6763,12 +6503,8 @@ msgstr "No se puede acceder al reloj de hardware por ning #: hwclock/hwclock.c:1654 #, c-format -msgid "" -"Use the --debug option to see the details of our search for an access " -"method.\n" -msgstr "" -"Utilice la opcin --debug para ver los detalles de la bsqueda para un " -"mtodo de acceso.\n" +msgid "Use the --debug option to see the details of our search for an access method.\n" +msgstr "Utilice la opcin --debug para ver los detalles de la bsqueda para un mtodo de acceso.\n" #: hwclock/kd.c:54 #, c-format @@ -6848,8 +6584,7 @@ msgstr "Error de ioctl() con %s al desactivar interrupciones de actualizaci #: hwclock/rtc.c:303 #, c-format msgid "ioctl() to %s to turn on update interrupts failed unexpectedly" -msgstr "" -"Error inesperado de ioctl() con %s al activar interrupciones de actualizacin" +msgstr "Error inesperado de ioctl() con %s al activar interrupciones de actualizacin" #: hwclock/rtc.c:360 #, c-format @@ -6868,13 +6603,9 @@ msgstr "Error al abrir %s" #: hwclock/rtc.c:410 hwclock/rtc.c:454 #, c-format -msgid "" -"To manipulate the epoch value in the kernel, we must access the Linux 'rtc' " -"device driver via the device special file %s. This file does not exist on " -"this system.\n" +msgid "To manipulate the epoch value in the kernel, we must access the Linux 'rtc' device driver via the device special file %s. This file does not exist on this system.\n" msgstr "" -"Para modificar el valor de poca del ncleo, se debe acceder al controlador " -"de\n" +"Para modificar el valor de poca del ncleo, se debe acceder al controlador de\n" "dispositivo 'rtc' de Linux mediante el fichero especial de dispositivo %s.\n" "Este fichero no existe en este sistema.\n" @@ -6905,11 +6636,8 @@ msgstr "Estableciendo #: hwclock/rtc.c:469 #, c-format -msgid "" -"The kernel device driver for %s does not have the RTC_EPOCH_SET ioctl.\n" -msgstr "" -"El controlador de dispositivo del ncleo para %s no tiene la ioctl " -"RTC_EPOCH_SET.\n" +msgid "The kernel device driver for %s does not have the RTC_EPOCH_SET ioctl.\n" +msgstr "El controlador de dispositivo del ncleo para %s no tiene la ioctl RTC_EPOCH_SET.\n" #: hwclock/rtc.c:472 #, c-format @@ -6987,17 +6715,11 @@ msgstr "%s: desbordamiento de entrada" #: login-utils/agetty.c:1206 #, fuzzy, c-format msgid "" -"Usage: %s [-8hiLmUw] [-l login_program] [-t timeout] [-I initstring] [-H " -"login_host] baud_rate,... line [termtype]\n" -"or\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] " -"line baud_rate,... [termtype]\n" +"Usage: %s [-8hiLmUw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] baud_rate,... line [termtype]\n" +"or\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] line baud_rate,... [termtype]\n" msgstr "" -"Uso: %s [-hiLmw] [-l programa_inicio_sesin] [-t tiempo_espera] [-I " -"cadenainicializacin] [-H host_inicio_sesin] velocidad_baudios,... lnea " -"[tipo_terminal]\n" -"o bien\t[-hiLmw] [-l programa_inicio_sesin] [-t tiempo_espera] [-I " -"cadena_inicializacin] [-H host_inicio_sesin]lnea velocidad_baudios,... " -"[tipo_terminal]\n" +"Uso: %s [-hiLmw] [-l programa_inicio_sesin] [-t tiempo_espera] [-I cadenainicializacin] [-H host_inicio_sesin] velocidad_baudios,... lnea [tipo_terminal]\n" +"o bien\t[-hiLmw] [-l programa_inicio_sesin] [-t tiempo_espera] [-I cadena_inicializacin] [-H host_inicio_sesin]lnea velocidad_baudios,... [tipo_terminal]\n" #: login-utils/checktty.c:91 login-utils/checktty.c:112 #, c-format @@ -7035,8 +6757,7 @@ msgstr "%s: el usuario \"%s\" no existe.\n" #: login-utils/chfn.c:145 login-utils/chsh.c:131 #, c-format msgid "%s: can only change local entries; use yp%s instead.\n" -msgstr "" -"%s: slo se pueden modificar entradas locales; utilice yp%s en su lugar.\n" +msgstr "%s: slo se pueden modificar entradas locales; utilice yp%s en su lugar.\n" #: login-utils/chfn.c:156 login-utils/chsh.c:142 msgid "Unknown user context" @@ -7057,12 +6778,12 @@ msgstr "%s: No se puede establecer el contexto predeterminado para /etc/passwd" msgid "Changing finger information for %s.\n" msgstr "Cambiando informacin de finger para %s.\n" -#: login-utils/chfn.c:189 login-utils/chsh.c:188 login-utils/login.c:572 +#: login-utils/chfn.c:189 login-utils/chsh.c:188 login-utils/login.c:576 #, fuzzy, c-format msgid "%s: PAM failure, aborting: %s\n" msgstr "login: error de PAM; anulando: %s\n" -#: login-utils/chfn.c:212 login-utils/chsh.c:211 login-utils/login.c:823 +#: login-utils/chfn.c:212 login-utils/chsh.c:211 login-utils/login.c:827 #: login-utils/newgrp.c:79 login-utils/simpleinit.c:340 mount/lomount.c:742 #: mount/lomount.c:745 msgid "Password: " @@ -7135,9 +6856,7 @@ msgstr "Los caracteres de control no est #: login-utils/chfn.c:512 #, c-format msgid "Finger information *NOT* changed. Try again later.\n" -msgstr "" -"*NO* se ha cambiado la informacin de finger. Intntelo de nuevo ms " -"adelante.\n" +msgstr "*NO* se ha cambiado la informacin de finger. Intntelo de nuevo ms adelante.\n" #: login-utils/chfn.c:515 #, c-format @@ -7151,9 +6870,7 @@ msgstr "%s: %s no est #: login-utils/chsh.c:164 #, c-format -msgid "" -"%s: Running UID doesn't match UID of user we're altering, shell change " -"denied\n" +msgid "%s: Running UID doesn't match UID of user we're altering, shell change denied\n" msgstr "" "%s: El UID en ejecucin no coincide con el UID del usuario que se est\n" "alterando, cambio de shell denegado\n" @@ -7161,9 +6878,7 @@ msgstr "" #: login-utils/chsh.c:170 #, c-format msgid "%s: Your shell is not in /etc/shells, shell change denied\n" -msgstr "" -"%s: el intrprete de rdenes no est en /etc/shells; cambio de intrprete de " -"rdenes denegado\n" +msgstr "%s: el intrprete de rdenes no est en /etc/shells; cambio de intrprete de rdenes denegado\n" #: login-utils/chsh.c:177 #, c-format @@ -7182,9 +6897,7 @@ msgstr "No se ha cambiado el int #: login-utils/chsh.c:235 #, c-format msgid "Shell *NOT* changed. Try again later.\n" -msgstr "" -"*NO* se ha cambiado el intrprete de rdenes. Intntelo de nuevo ms " -"adelante.\n" +msgstr "*NO* se ha cambiado el intrprete de rdenes. Intntelo de nuevo ms adelante.\n" #: login-utils/chsh.c:238 #, c-format @@ -7294,35 +7007,40 @@ msgstr "" msgid "FATAL: can't reopen tty: %s" msgstr "Error fatal: no se puede reabrir la terminal: %s" -#: login-utils/login.c:229 +#: login-utils/login.c:205 +#, c-format +msgid "FATAL: %s is not a terminal" +msgstr "ERROR FATAL: %s no es una terminal" + +#: login-utils/login.c:238 msgid "FATAL: bad tty" msgstr "ERROR FATAL: Terminal errnea" -#: login-utils/login.c:436 +#: login-utils/login.c:445 #, c-format msgid "login: -h for super-user only.\n" msgstr "login: -h slo para superusuario.\n" -#: login-utils/login.c:479 +#: login-utils/login.c:488 #, c-format msgid "usage: login [-fp] [username]\n" msgstr "uso: login [-fp] [nombreusuario]\n" -#: login-utils/login.c:574 +#: login-utils/login.c:578 #, c-format msgid "Couldn't initialize PAM: %s" msgstr "No se ha podido inicializar PAM: %s" -#: login-utils/login.c:591 +#: login-utils/login.c:595 msgid "login: " msgstr "Inicio de sesin: " -#: login-utils/login.c:635 +#: login-utils/login.c:639 #, c-format msgid "FAILED LOGIN %d FROM %s FOR %s, %s" msgstr "Error de inicio de sesin %d desde %s para %s, %s" -#: login-utils/login.c:640 +#: login-utils/login.c:644 #, c-format msgid "" "Login incorrect\n" @@ -7331,17 +7049,17 @@ msgstr "" "Inicio de sesin incorrecto\n" "\n" -#: login-utils/login.c:649 +#: login-utils/login.c:653 #, c-format msgid "TOO MANY LOGIN TRIES (%d) FROM %s FOR %s, %s" msgstr "Demasiados intentos de inicio de sesin (%d) desde %s para %s, %s" -#: login-utils/login.c:653 +#: login-utils/login.c:657 #, c-format msgid "FAILED LOGIN SESSION FROM %s FOR %s, %s" msgstr "Error de sesin de inicio de sesin desde %s para %s, %s" -#: login-utils/login.c:658 +#: login-utils/login.c:662 #, c-format msgid "" "\n" @@ -7350,7 +7068,7 @@ msgstr "" "\n" "Inicio de sesin incorrecto\n" -#: login-utils/login.c:686 login-utils/login.c:693 login-utils/login.c:727 +#: login-utils/login.c:690 login-utils/login.c:697 login-utils/login.c:731 #, c-format msgid "" "\n" @@ -7359,121 +7077,120 @@ msgstr "" "\n" "Problema al iniciar la sesin, abortado.\n" -#: login-utils/login.c:687 +#: login-utils/login.c:691 #, c-format msgid "NULL user name in %s:%d. Abort." msgstr "nombre de usuario NULO en %s:%d. Abortado." -#: login-utils/login.c:694 +#: login-utils/login.c:698 #, c-format msgid "Invalid user name \"%s\" in %s:%d. Abort." msgstr "Nombre de usuario invlido \"%s\" en %s:%d. Abortado." -#: login-utils/login.c:713 +#: login-utils/login.c:717 #, c-format msgid "login: Out of memory\n" msgstr "login: No queda memoria\n" -#: login-utils/login.c:757 +#: login-utils/login.c:761 msgid "Illegal username" msgstr "Nombre de usuario no permitido" -#: login-utils/login.c:800 +#: login-utils/login.c:804 #, c-format msgid "%s login refused on this terminal.\n" msgstr "Inicio de sesin %s rechazado en este terminal.\n" -#: login-utils/login.c:805 +#: login-utils/login.c:809 #, c-format msgid "LOGIN %s REFUSED FROM %s ON TTY %s" msgstr "Inicio de sesin %s rechazado desde %s en tty %s" -#: login-utils/login.c:809 +#: login-utils/login.c:813 #, c-format msgid "LOGIN %s REFUSED ON TTY %s" msgstr "Inicio de sesin %s rechazado en tty %s" -#: login-utils/login.c:863 +#: login-utils/login.c:867 #, c-format msgid "Login incorrect\n" msgstr "Inicio de sesin incorrecto\n" -#: login-utils/login.c:1088 +#: login-utils/login.c:1092 #, c-format msgid "DIALUP AT %s BY %s" msgstr "Conexin telefnica en %s por %s" -#: login-utils/login.c:1095 +#: login-utils/login.c:1099 #, c-format msgid "ROOT LOGIN ON %s FROM %s" msgstr "Inicio de sesin con root en %s desde %s" -#: login-utils/login.c:1098 +#: login-utils/login.c:1102 #, c-format msgid "ROOT LOGIN ON %s" msgstr "Inicio de sesin con root en %s" -#: login-utils/login.c:1101 +#: login-utils/login.c:1105 #, c-format msgid "LOGIN ON %s BY %s FROM %s" msgstr "Inicio de sesin en %s por %s desde %s" -#: login-utils/login.c:1104 +#: login-utils/login.c:1108 #, c-format msgid "LOGIN ON %s BY %s" msgstr "Inicio de sesin en %s por %s" -#: login-utils/login.c:1125 +#: login-utils/login.c:1129 #, c-format msgid "You have new mail.\n" msgstr "Tiene correo nuevo.\n" -#: login-utils/login.c:1127 +#: login-utils/login.c:1131 #, c-format msgid "You have mail.\n" msgstr "Tiene correo.\n" -#: login-utils/login.c:1171 +#: login-utils/login.c:1175 #, c-format msgid "login: failure forking: %s" msgstr "login: error en fork: %s" -#: login-utils/login.c:1218 +#: login-utils/login.c:1222 #, c-format msgid "TIOCSCTTY failed: %m" msgstr "Fallo en TIOCSCTTY: %m" -#: login-utils/login.c:1224 +#: login-utils/login.c:1228 msgid "setuid() failed" msgstr "setuid() ha fallado" -#: login-utils/login.c:1230 +#: login-utils/login.c:1234 #, c-format msgid "No directory %s!\n" msgstr "No hay ningn directorio %s\n" -#: login-utils/login.c:1234 +#: login-utils/login.c:1238 #, c-format msgid "Logging in with home = \"/\".\n" msgstr "Iniciando la sesin con directorio de inicio = \"/\".\n" -#: login-utils/login.c:1242 +#: login-utils/login.c:1246 #, c-format msgid "login: no memory for shell script.\n" msgstr "login: no queda memoria para script de intrprete de rdenes.\n" -#: login-utils/login.c:1269 +#: login-utils/login.c:1273 #, c-format msgid "login: couldn't exec shell script: %s.\n" -msgstr "" -"login: no se ha podido ejecutar el script de intrprete de rdenes: %s.\n" +msgstr "login: no se ha podido ejecutar el script de intrprete de rdenes: %s.\n" -#: login-utils/login.c:1272 +#: login-utils/login.c:1276 #, c-format msgid "login: no shell: %s.\n" msgstr "login: no hay intrprete de rdenes: %s.\n" -#: login-utils/login.c:1287 +#: login-utils/login.c:1291 #, c-format msgid "" "\n" @@ -7482,65 +7199,65 @@ msgstr "" "\n" "Inicio de sesin de %s: " -#: login-utils/login.c:1298 +#: login-utils/login.c:1302 #, c-format msgid "login name much too long.\n" msgstr "Nombre de inicio de sesin demasiado largo.\n" -#: login-utils/login.c:1299 +#: login-utils/login.c:1303 msgid "NAME too long" msgstr "Nombre demasiado largo" -#: login-utils/login.c:1306 +#: login-utils/login.c:1310 #, c-format msgid "login names may not start with '-'.\n" msgstr "Los nombres de inicio de sesin no pueden empezar por '-'.\n" -#: login-utils/login.c:1316 +#: login-utils/login.c:1320 #, c-format msgid "too many bare linefeeds.\n" msgstr "Demasiados avances de lnea solos.\n" -#: login-utils/login.c:1317 +#: login-utils/login.c:1321 msgid "EXCESSIVE linefeeds" msgstr "Excesivos avances de lnea" -#: login-utils/login.c:1349 +#: login-utils/login.c:1353 #, c-format msgid "Login timed out after %d seconds\n" msgstr "El inicio de sesin ha superado el tiempo de espera tras %d segundos\n" -#: login-utils/login.c:1437 +#: login-utils/login.c:1441 #, c-format msgid "Last login: %.*s " msgstr "ltimo inicio de sesin: %.*s " -#: login-utils/login.c:1441 +#: login-utils/login.c:1445 #, c-format msgid "from %.*s\n" msgstr "desde %.*s\n" -#: login-utils/login.c:1444 +#: login-utils/login.c:1448 #, c-format msgid "on %.*s\n" msgstr "en %.*s\n" -#: login-utils/login.c:1470 +#: login-utils/login.c:1474 #, c-format msgid "LOGIN FAILURE FROM %s, %s" msgstr "Error de inicio de sesin desde %s, %s" -#: login-utils/login.c:1473 +#: login-utils/login.c:1477 #, c-format msgid "LOGIN FAILURE ON %s, %s" msgstr "Error de inicio de sesin en %s, %s" -#: login-utils/login.c:1477 +#: login-utils/login.c:1481 #, c-format msgid "%d LOGIN FAILURES FROM %s, %s" msgstr "%d errores de inicio de sesin desde %s, %s" -#: login-utils/login.c:1480 +#: login-utils/login.c:1484 #, c-format msgid "%d LOGIN FAILURES ON %s, %s" msgstr "%d errores de inicio de sesin en %s, %s" @@ -7706,9 +7423,7 @@ msgstr "No se puede ejecutar swapoff; se intenta con umount." #: login-utils/shutdown.c:597 msgid "Cannot fork for umount, trying manually." -msgstr "" -"No se puede realizar una operacin fork para ejecutar umount; se intenta " -"manualmente." +msgstr "No se puede realizar una operacin fork para ejecutar umount; se intenta manualmente." #: login-utils/shutdown.c:606 #, c-format @@ -7734,14 +7449,11 @@ msgstr "Iniciando en modo de un solo usuario.\n" #: login-utils/simpleinit.c:136 msgid "exec of single user shell failed\n" -msgstr "" -"La ejecucin (exec) de intrprete de rdenes de un solo usuario ha fallado\n" +msgstr "La ejecucin (exec) de intrprete de rdenes de un solo usuario ha fallado\n" #: login-utils/simpleinit.c:140 msgid "fork of single user shell failed\n" -msgstr "" -"La bifurcacin (fork) de intrprete de rdenes de un solo usuario ha " -"fallado\n" +msgstr "La bifurcacin (fork) de intrprete de rdenes de un solo usuario ha fallado\n" #: login-utils/simpleinit.c:208 msgid "error opening fifo\n" @@ -7941,25 +7653,25 @@ msgstr "%s: no se puede ejecutar stat para fichero temporal.\n" msgid "%s: can't read temporary file.\n" msgstr "%s: no se puede leer el fichero temporal.\n" -#: misc-utils/cal.c:360 misc-utils/cal.c:372 +#: misc-utils/cal.c:364 misc-utils/cal.c:376 #, fuzzy, c-format msgid "illegal day value: use 1-%d" msgstr "Valor de ao no permitido: utilice 1-9999" -#: misc-utils/cal.c:364 +#: misc-utils/cal.c:368 msgid "illegal month value: use 1-12" msgstr "Valor de mes no permitido: utilice 1-12" -#: misc-utils/cal.c:368 +#: misc-utils/cal.c:372 msgid "illegal year value: use 1-9999" msgstr "Valor de ao no permitido: utilice 1-9999" -#: misc-utils/cal.c:462 +#: misc-utils/cal.c:466 #, c-format msgid "%s %d" msgstr "%s de %d" -#: misc-utils/cal.c:854 +#: misc-utils/cal.c:858 #, fuzzy, c-format msgid "usage: cal [-13smjyV] [[[day] month] year]\n" msgstr "uso: cal [-13smjyV] [[mes] ao]\n" @@ -7981,7 +7693,7 @@ msgstr "" #: misc-utils/findfs.c:55 #, fuzzy, c-format msgid "unable to resolve '%s'" -msgstr "No se puede abrir %s" +msgstr "No se puede abrir '%s'" #: misc-utils/kill.c:207 #, c-format @@ -8040,11 +7752,8 @@ msgstr "logger: nombre de prioridad desconocida: %s.\n" #: misc-utils/logger.c:285 #, c-format -msgid "" -"usage: logger [-is] [-f file] [-p pri] [-t tag] [-u socket] [ message ... ]\n" -msgstr "" -"uso: logger [-is] [-f fichero] [-p pri] [-t etiqueta] [-u socket] " -"[ mensaje ... ]\n" +msgid "usage: logger [-is] [-f file] [-p pri] [-t tag] [-u socket] [ message ... ]\n" +msgstr "uso: logger [-is] [-f fichero] [-p pri] [-t etiqueta] [-u socket] [ mensaje ... ]\n" #: misc-utils/look.c:351 #, c-format @@ -8070,12 +7779,12 @@ msgstr " #: misc-utils/namei.c:188 #, fuzzy, c-format msgid "failed to read symlink: %s" -msgstr "ioctl() no ha podido leer la hora de %s" +msgstr "%s: fallo al abrir %s\n" #: misc-utils/namei.c:231 misc-utils/namei.c:254 #, fuzzy, c-format msgid "could not stat '%s'" -msgstr "No se puede efectuar `stat' sobre el dispositivo %s" +msgstr "No se puede ejecutar `stat' sobre %s" #: misc-utils/namei.c:449 #, fuzzy, c-format @@ -8211,7 +7920,7 @@ msgstr "" #: misc-utils/scriptreplay.c:53 #, c-format msgid "expected a number, but got '%s'" -msgstr "" +msgstr "se esperaba un nmero, pero se obtuvo '%s'" #: misc-utils/scriptreplay.c:56 misc-utils/scriptreplay.c:60 #, c-format @@ -8219,9 +7928,8 @@ msgid "divisor '%s'" msgstr "" #: misc-utils/scriptreplay.c:104 -#, fuzzy msgid "write to stdout failed" -msgstr "Error al abrir %s" +msgstr "fall la escritura a stdout" #: misc-utils/scriptreplay.c:110 #, c-format @@ -8249,9 +7957,9 @@ msgid "failed to read timing file %s" msgstr "ioctl() no ha podido leer la hora de %s" #: misc-utils/scriptreplay.c:166 -#, fuzzy, c-format +#, c-format msgid "timings file %s: %lu: unexpected format" -msgstr "%s: EOF inesperado en el fichero %s\n" +msgstr "" #: misc-utils/setterm.c:759 #, c-format @@ -8556,12 +8264,12 @@ msgstr "" #: misc-utils/uuidd.c:305 #, fuzzy, c-format msgid "Couldn't bind unix socket %s: %s\n" -msgstr "No se puede abrir %s: %s\n" +msgstr "shutdown: No se puede ejecutar umount %s: %s\n" #: misc-utils/uuidd.c:313 #, fuzzy, c-format msgid "Couldn't listen on unix socket %s: %s\n" -msgstr "No se puede abrir %s: %s\n" +msgstr "No se puede bloquear el fichero de bloqueo %s: %s\n" #: misc-utils/uuidd.c:351 #, fuzzy, c-format @@ -8596,7 +8304,7 @@ msgstr "" #: misc-utils/uuidd.c:427 #, fuzzy, c-format msgid "Invalid operation %d\n" -msgstr "identificador invlido" +msgstr "Nmero invlido: %s\n" #: misc-utils/uuidd.c:468 misc-utils/uuidd.c:489 #, fuzzy, c-format @@ -8636,7 +8344,7 @@ msgstr "" #: misc-utils/uuidgen.c:32 #, fuzzy, c-format msgid "Usage: %s [-r] [-t]\n" -msgstr "Uso: %s [opciones] dispositivo ...\n" +msgstr "Uso: %s [ -s intrprete_rdenes ] " #: misc-utils/whereis.c:159 #, c-format @@ -8651,50 +8359,56 @@ msgstr "La asignaci #: misc-utils/wipefs.c:150 #, fuzzy msgid "strdup failed" -msgstr "Error al abrir %s" +msgstr "setuid() ha fallado" -#: misc-utils/wipefs.c:199 -msgid "probing initialization failed" +#: misc-utils/wipefs.c:200 +#, c-format +msgid "error: %s: probing initialization failed" msgstr "" -#: misc-utils/wipefs.c:243 +#: misc-utils/wipefs.c:211 +#, fuzzy, c-format +msgid "error: %s: appears to contain '%s' partition table" +msgstr "El disco %s no contiene una tabla de particiones vlida\n" + +#: misc-utils/wipefs.c:257 #, c-format msgid "can't found a magic string at offset 0x%jx - ignore." msgstr "" -#: misc-utils/wipefs.c:250 +#: misc-utils/wipefs.c:264 #, fuzzy, c-format msgid "%s: failed to seek to offset 0x%jx" msgstr "%s: fallo al abrir %s\n" -#: misc-utils/wipefs.c:257 +#: misc-utils/wipefs.c:271 #, fuzzy, c-format msgid "%s: write failed" -msgstr "openpty ha fallado\n" +msgstr "Error de bsqueda" -#: misc-utils/wipefs.c:259 +#: misc-utils/wipefs.c:273 #, fuzzy, c-format msgid "%zd bytes [" msgstr "bytes" -#: misc-utils/wipefs.c:267 +#: misc-utils/wipefs.c:281 #, c-format msgid "] erased at offset 0x%jx (%s)\n" msgstr "" -#: misc-utils/wipefs.c:278 mount/swapon.c:184 mount/swapon.c:252 +#: misc-utils/wipefs.c:292 mount/swapon.c:184 mount/swapon.c:252 #: mount/swapon.c:397 mount/swapon.c:556 mount/swapon.c:758 #: sys-utils/fallocate.c:159 #, fuzzy, c-format msgid "%s: open failed" msgstr "openpty ha fallado\n" -#: misc-utils/wipefs.c:301 misc-utils/wipefs.c:304 +#: misc-utils/wipefs.c:315 misc-utils/wipefs.c:318 #, fuzzy, c-format msgid "invalid offset '%s' value specified" msgstr "Valor establecido invlido: %s\n" -#: misc-utils/wipefs.c:312 sys-utils/fallocate.c:47 +#: misc-utils/wipefs.c:326 sys-utils/fallocate.c:47 #, fuzzy, c-format msgid "" "Usage: %s [options] \n" @@ -8702,7 +8416,7 @@ msgid "" "Options:\n" msgstr "Uso: %s [opciones] dispositivo ...\n" -#: misc-utils/wipefs.c:316 +#: misc-utils/wipefs.c:330 #, c-format msgid "" " -a, --all wipe all magic strings (BE CAREFUL!)\n" @@ -8712,14 +8426,14 @@ msgid "" " -p, --parsable print out in parsable instead of printable format\n" msgstr "" -#: misc-utils/wipefs.c:322 -#, fuzzy, c-format +#: misc-utils/wipefs.c:336 +#, c-format msgid "" "\n" "For more information see wipefs(8).\n" -msgstr "Se ha cambiado la informacin de finger.\n" +msgstr "" -#: misc-utils/wipefs.c:373 +#: misc-utils/wipefs.c:387 msgid "--offset and --all are mutually exclusive" msgstr "" @@ -8761,8 +8475,7 @@ msgstr "write: %s tiene los mensajes desactivados\n" #: misc-utils/write.c:249 #, c-format msgid "write: %s is logged in more than once; writing to %s\n" -msgstr "" -"write: %s tiene iniciada una sesin ms de una vez; escribiendo en %s\n" +msgstr "write: %s tiene iniciada una sesin ms de una vez; escribiendo en %s\n" #: misc-utils/write.c:317 #, c-format @@ -8792,23 +8505,17 @@ msgstr "mount: no se ha podido abrir %s; en su lugar se utiliza %s\n" #: mount/fstab.c:590 #, c-format msgid "can't create lock file %s: %s (use -n flag to override)" -msgstr "" -"No se puede crear el fichero de bloqueo %s: %s (utilice -n para modificar " -"este valor)" +msgstr "No se puede crear el fichero de bloqueo %s: %s (utilice -n para modificar este valor)" #: mount/fstab.c:616 #, c-format msgid "can't link lock file %s: %s (use -n flag to override)" -msgstr "" -"No se puede enlazar el fichero de bloqueo %s: %s (utilice -n para modificar " -"este valor)" +msgstr "No se puede enlazar el fichero de bloqueo %s: %s (utilice -n para modificar este valor)" #: mount/fstab.c:632 #, c-format msgid "can't open lock file %s: %s (use -n flag to override)" -msgstr "" -"No se puede abrir el fichero de bloqueo %s: %s (utilice -n para modificar " -"este valor)" +msgstr "No se puede abrir el fichero de bloqueo %s: %s (utilice -n para modificar este valor)" #: mount/fstab.c:647 #, c-format @@ -8921,8 +8628,7 @@ msgid "" " about the loop device? (If so, recompile or `modprobe loop'.)" msgstr "" "%s: No se puede encontrar ningn dispositivo de bucle. Puede que este\n" -" ncleo no sepa acerca del dispositivo de bucle? (En tal caso, vuelva " -"a\n" +" ncleo no sepa acerca del dispositivo de bucle? (En tal caso, vuelva a\n" " realizar la compilacin o `modprobe loop'.)" #: mount/lomount.c:636 @@ -8938,8 +8644,7 @@ msgstr "El sector %d ya est #: mount/lomount.c:695 #, fuzzy, c-format msgid "warning: %s: is write-protected, using read-only.\n" -msgstr "" -"mount: %s%s est protegido contra escritura; se monta como slo lectura" +msgstr "mount: %s%s est protegido contra escritura; se monta como slo lectura" #: mount/lomount.c:731 #, c-format @@ -8969,9 +8674,7 @@ msgstr "loop: no se puede suprimir el dispositivo %s: %s\n" #: mount/lomount.c:851 #, c-format msgid "This mount was compiled without loop support. Please recompile.\n" -msgstr "" -"Este montaje se ha compilado sin soporte de bucle. Vuelva a realizar la " -"compilacin.\n" +msgstr "Este montaje se ha compilado sin soporte de bucle. Vuelva a realizar la compilacin.\n" #: mount/lomount.c:886 #, fuzzy, c-format @@ -8983,15 +8686,13 @@ msgid "" " %1$s -d | --detach [ ...] delete\n" " %1$s -f | --find find unused\n" " %1$s -c | --set-capacity resize\n" -" %1$s -j | --associated [-o ] list all associated with " -"\n" +" %1$s -j | --associated [-o ] list all associated with \n" " %1$s [ options ] {-f|--find|loopdev} setup\n" msgstr "" "uso:\n" " %s dispositivo_bucle # dar informacin\n" " %s -d dispositivo_bucle # eliminar\n" -" %s -f # encuentra no " -"usados\n" +" %s -f # encuentra no usados\n" " %s [ -e cifrado ] [ -o despl ] {-f|disp_bucle} fichero # configurar\n" #: mount/lomount.c:896 @@ -9028,234 +8729,242 @@ msgstr "umount: %s: dispositivo ocupado" #: mount/lomount.c:1088 #, c-format msgid "No loop support was available at compile time. Please recompile.\n" +msgstr "Al compilar no haba soporte de bucle disponible. Vuelva a realizar la compilacin.\n" + +#: mount/mount.c:288 +#, c-format +msgid "" +"\n" +"mount: warning: /etc/mtab is not writable (e.g. read-only filesystem).\n" +" It's possible that information reported by mount(8) is not\n" +" up to date. For actual information about system mount points\n" +" check the /proc/mounts file.\n" +"\n" msgstr "" -"Al compilar no haba soporte de bucle disponible. Vuelva a realizar la " -"compilacin.\n" -#: mount/mount.c:329 +#: mount/mount.c:338 #, c-format msgid "mount: improperly quoted option string '%s'" msgstr "" -#: mount/mount.c:362 +#: mount/mount.c:371 #, fuzzy, c-format msgid "mount: translated %s '%s' to '%s'\n" msgstr "mount: no se puede encontrar %s en %s o %s" -#: mount/mount.c:526 +#: mount/mount.c:535 #, c-format msgid "mount: according to mtab, %s is already mounted on %s" msgstr "mount: segn mtab, %s ya est montado en %s" -#: mount/mount.c:531 +#: mount/mount.c:540 #, c-format msgid "mount: according to mtab, %s is mounted on %s" msgstr "mount: segn mtab, %s est montado en %s" -#: mount/mount.c:555 +#: mount/mount.c:564 #, c-format msgid "mount: can't open %s for writing: %s" msgstr "mount: no se puede abrir %s para escritura: %s" -#: mount/mount.c:572 mount/mount.c:1190 +#: mount/mount.c:581 mount/mount.c:1199 #, c-format msgid "mount: error writing %s: %s" msgstr "mount: error al escribir %s: %s" -#: mount/mount.c:580 +#: mount/mount.c:589 #, c-format msgid "mount: error changing mode of %s: %s" msgstr "mount: error al cambiar el modo de %s: %s" -#: mount/mount.c:663 +#: mount/mount.c:672 #, fuzzy, c-format msgid "mount: cannot set group id: %s" msgstr "mount: no se puede establecer la velocidad: %s" -#: mount/mount.c:666 +#: mount/mount.c:675 #, fuzzy, c-format msgid "mount: cannot set user id: %s" msgstr "mount: no se puede establecer la velocidad: %s" -#: mount/mount.c:705 mount/mount.c:1855 +#: mount/mount.c:714 mount/mount.c:1864 #, c-format msgid "mount: cannot fork: %s" msgstr "mount: no se puede bifurcar (fork): %s" -#: mount/mount.c:842 +#: mount/mount.c:851 #, c-format msgid "Trying %s\n" msgstr "Probando con %s\n" -#: mount/mount.c:870 +#: mount/mount.c:879 #, c-format msgid "mount: you didn't specify a filesystem type for %s\n" msgstr "mount: no ha especificado ningn tipo de sistema de ficheros para %s\n" -#: mount/mount.c:873 +#: mount/mount.c:882 #, c-format msgid " I will try all types mentioned in %s or %s\n" msgstr " Se probar con todos los tipos indicados en %s o %s\n" -#: mount/mount.c:876 +#: mount/mount.c:885 #, c-format msgid " and it looks like this is swapspace\n" msgstr " y parece que sea un espacio de intercambio\n" -#: mount/mount.c:878 +#: mount/mount.c:887 #, c-format msgid " I will try type %s\n" msgstr " Se probar con el tipo %s\n" -#: mount/mount.c:902 +#: mount/mount.c:911 #, c-format msgid "%s looks like swapspace - not mounted" msgstr "%s parece espacio de intercambio - no montado" -#: mount/mount.c:993 +#: mount/mount.c:1002 msgid "mount failed" msgstr "montaje errneo" -#: mount/mount.c:995 +#: mount/mount.c:1004 #, c-format msgid "mount: only root can mount %s on %s" msgstr "mount: slo el usuario root puede montar %s en %s" -#: mount/mount.c:1065 +#: mount/mount.c:1074 msgid "mount: loop device specified twice" msgstr "mount: dispositivo de bucle especificado dos veces" -#: mount/mount.c:1070 +#: mount/mount.c:1079 msgid "mount: type specified twice" msgstr "mount: tipo especificado dos veces" -#: mount/mount.c:1082 +#: mount/mount.c:1091 #, c-format msgid "mount: skipping the setup of a loop device\n" msgstr "mount: omitiendo la configuracin de un dispositivo de bucle\n" -#: mount/mount.c:1094 +#: mount/mount.c:1103 #, fuzzy, c-format msgid "mount: according to mtab %s is already mounted on %s as loop" msgstr "mount: segn mtab, %s ya est montado en %s" -#: mount/mount.c:1104 +#: mount/mount.c:1113 #, c-format msgid "mount: going to use the loop device %s\n" msgstr "mount: se va a utilizar el dispositivo de bucle %s\n" -#: mount/mount.c:1113 +#: mount/mount.c:1122 #, c-format msgid "mount: stolen loop=%s ...trying again\n" msgstr "" -#: mount/mount.c:1118 +#: mount/mount.c:1127 #, fuzzy, c-format msgid "mount: stolen loop=%s" msgstr "umount: %s: %s" -#: mount/mount.c:1123 +#: mount/mount.c:1132 #, c-format msgid "mount: failed setting up loop device\n" msgstr "mount: error al configurar dispositivo de bucle\n" -#: mount/mount.c:1134 +#: mount/mount.c:1143 #, c-format msgid "mount: setup loop device successfully\n" msgstr "mount: configuracin correcta de dispositivo de bucle\n" -#: mount/mount.c:1168 +#: mount/mount.c:1177 #, c-format msgid "mount: no %s found - creating it..\n" msgstr "mount: no se ha encontrado %s; se est creando...\n" -#: mount/mount.c:1185 +#: mount/mount.c:1194 #, c-format msgid "mount: can't open %s: %s" msgstr "mount: no se puede abrir %s: %s" -#: mount/mount.c:1206 +#: mount/mount.c:1215 msgid "mount: argument to -p or --pass-fd must be a number" msgstr "mount: el argumento para -p o --pass-fd debe ser un nmero" -#: mount/mount.c:1219 +#: mount/mount.c:1228 #, c-format msgid "mount: cannot open %s for setting speed" msgstr "mount: no se puede abrir %s para establecer la velocidad" -#: mount/mount.c:1222 +#: mount/mount.c:1231 #, c-format msgid "mount: cannot set speed: %s" msgstr "mount: no se puede establecer la velocidad: %s" -#: mount/mount.c:1314 +#: mount/mount.c:1323 #, fuzzy, c-format msgid "mount: according to mtab, %s is already mounted on %s\n" msgstr "mount: segn mtab, %s ya est montado en %s" -#: mount/mount.c:1371 +#: mount/mount.c:1380 #, fuzzy, c-format msgid "mount: warning: %s seems to be mounted read-write.\n" msgstr "umount: %s ocupado; se ha vuelto a montar como de slo lectura\n" -#: mount/mount.c:1404 -msgid "" -"mount: I could not determine the filesystem type, and none was specified" +#: mount/mount.c:1413 +msgid "mount: I could not determine the filesystem type, and none was specified" msgstr "" "mount: no se ha podido determinar el tipo de sistema de ficheros y no se ha\n" "especificado ninguno" -#: mount/mount.c:1407 +#: mount/mount.c:1416 msgid "mount: you must specify the filesystem type" msgstr "mount: debe especificar el tipo de sistema de ficheros" -#: mount/mount.c:1410 +#: mount/mount.c:1419 msgid "mount: mount failed" msgstr "mount: montaje errneo" -#: mount/mount.c:1416 mount/mount.c:1453 +#: mount/mount.c:1425 mount/mount.c:1462 #, c-format msgid "mount: mount point %s is not a directory" msgstr "mount: el punto de montaje %s no es un directorio" -#: mount/mount.c:1418 +#: mount/mount.c:1427 msgid "mount: permission denied" msgstr "mount: permiso denegado" -#: mount/mount.c:1420 +#: mount/mount.c:1429 msgid "mount: must be superuser to use mount" msgstr "mount: debe ser superusuario para utilizar mount" -#: mount/mount.c:1424 mount/mount.c:1428 +#: mount/mount.c:1433 mount/mount.c:1437 #, c-format msgid "mount: %s is busy" msgstr "mount: %s est ocupado" -#: mount/mount.c:1430 +#: mount/mount.c:1439 msgid "mount: proc already mounted" msgstr "mount: proc ya est montado" -#: mount/mount.c:1432 +#: mount/mount.c:1441 #, c-format msgid "mount: %s already mounted or %s busy" msgstr "mount: %s ya est montado o %s est ocupado" -#: mount/mount.c:1438 +#: mount/mount.c:1447 #, c-format msgid "mount: mount point %s does not exist" msgstr "mount: el punto de montaje %s no existe" -#: mount/mount.c:1440 +#: mount/mount.c:1449 #, c-format msgid "mount: mount point %s is a symbolic link to nowhere" msgstr "mount: el punto de montaje %s es un enlace simblico sin destino" -#: mount/mount.c:1445 +#: mount/mount.c:1454 #, c-format msgid "mount: special device %s does not exist" msgstr "mount: el dispositivo especial %s no existe" -#: mount/mount.c:1457 +#: mount/mount.c:1466 #, c-format msgid "" "mount: special device %s does not exist\n" @@ -9264,12 +8973,12 @@ msgstr "" "mount: el dispositivo especial %s no existe\n" " (un prefijo de ruta no es un directorio)\n" -#: mount/mount.c:1469 +#: mount/mount.c:1478 #, c-format msgid "mount: %s not mounted already, or bad option" msgstr "mount: %s no est montado todava o una opcin es incorrecta" -#: mount/mount.c:1471 +#: mount/mount.c:1480 #, fuzzy, c-format msgid "" "mount: wrong fs type, bad option, bad superblock on %s,\n" @@ -9279,13 +8988,13 @@ msgstr "" " superbloque incorrecto en %s, falta la pgina de cdigos,\n" " o algn otro error" -#: mount/mount.c:1478 +#: mount/mount.c:1487 msgid "" " (for several filesystems (e.g. nfs, cifs) you might\n" " need a /sbin/mount. helper program)" msgstr "" -#: mount/mount.c:1487 +#: mount/mount.c:1496 msgid "" " (could this be the IDE device where you in fact use\n" " ide-scsi so that sr0 or sda or so is needed?)" @@ -9293,7 +9002,7 @@ msgstr "" " (puede que este sea el dispositivo IDE donde est\n" " usando ide-scsi de forma que se necesite sr0 o sda?" -#: mount/mount.c:1492 +#: mount/mount.c:1501 msgid "" " (aren't you trying to mount an extended partition,\n" " instead of some logical partition inside?)" @@ -9301,7 +9010,7 @@ msgstr "" " (no estar intentando montar una particin extendida,\n" " en lugar de alguna particin lgica que haya dentro?" -#: mount/mount.c:1499 +#: mount/mount.c:1508 msgid "" " In some cases useful info is found in syslog - try\n" " dmesg | tail or so\n" @@ -9309,111 +9018,107 @@ msgstr "" " En algunos casos se encuentra informacin en syslog, pruebe\n" " dmesg | tail o algo parecido\n" -#: mount/mount.c:1505 +#: mount/mount.c:1514 msgid "mount table full" msgstr "tabla de dispositivos montados completa" -#: mount/mount.c:1507 +#: mount/mount.c:1516 #, c-format msgid "mount: %s: can't read superblock" msgstr "mount: %s: no se puede leer el superbloque" -#: mount/mount.c:1513 +#: mount/mount.c:1522 #, c-format msgid "mount: %s: unknown device" msgstr "umount: %s: dispositivo desconocido" -#: mount/mount.c:1518 +#: mount/mount.c:1527 #, c-format msgid "mount: unknown filesystem type '%s'" msgstr "mount: tipo de sistema de ficheros '%s' desconocido" -#: mount/mount.c:1530 +#: mount/mount.c:1539 #, c-format msgid "mount: probably you meant %s" msgstr "mount: probablemente quera referirse a %s" -#: mount/mount.c:1533 +#: mount/mount.c:1542 msgid "mount: maybe you meant 'iso9660'?" msgstr "mount: quiere decir 'iso9660?'" -#: mount/mount.c:1536 +#: mount/mount.c:1545 msgid "mount: maybe you meant 'vfat'?" msgstr "mount: quiere decir 'vfat'?" -#: mount/mount.c:1539 +#: mount/mount.c:1548 #, c-format msgid "mount: %s has wrong device number or fs type %s not supported" -msgstr "" -"mount: %s con nmero de dispositivo incorrecto o tipo de sistema de ficheros " -"%s no soportado" +msgstr "mount: %s con nmero de dispositivo incorrecto o tipo de sistema de ficheros %s no soportado" -#: mount/mount.c:1547 +#: mount/mount.c:1556 #, c-format msgid "mount: %s is not a block device, and stat fails?" msgstr "mount: %s no es un dispositivo de bloques y stat falla?" -#: mount/mount.c:1549 -#, c-format +#: mount/mount.c:1558 +#, fuzzy, c-format msgid "" "mount: the kernel does not recognize %s as a block device\n" -" (maybe `insmod driver'?)" +" (maybe `modprobe driver'?)" msgstr "" "mount: el ncleo no reconoce %s como dispositivo de bloques\n" " (tal vez `insmod driver'?)" -#: mount/mount.c:1552 +#: mount/mount.c:1561 #, c-format msgid "mount: %s is not a block device (maybe try `-o loop'?)" msgstr "mount: %s no es un dispositivo de bloques (pruebe `-o loop')" -#: mount/mount.c:1555 +#: mount/mount.c:1564 #, c-format msgid "mount: %s is not a block device" msgstr "mount: %s no es un dispositivo de bloques" -#: mount/mount.c:1560 +#: mount/mount.c:1569 #, c-format msgid "mount: %s is not a valid block device" msgstr "mount: %s no es un dispositivo de bloques vlido" -#: mount/mount.c:1563 +#: mount/mount.c:1572 msgid "block device " msgstr "dispositivo de bloques " -#: mount/mount.c:1565 +#: mount/mount.c:1574 #, c-format msgid "mount: cannot mount %s%s read-only" msgstr "umount: no se puede montar %s%s de slo lectura" -#: mount/mount.c:1569 +#: mount/mount.c:1578 #, c-format msgid "mount: %s%s is write-protected but explicit `-w' flag given" -msgstr "" -"mount: %s%s est protegido contra escritura pero se ha dado la opcin `-w'" +msgstr "mount: %s%s est protegido contra escritura pero se ha dado la opcin `-w'" -#: mount/mount.c:1573 +#: mount/mount.c:1582 #, fuzzy, c-format msgid "mount: cannot remount %s%s read-write, is write-protected" msgstr "umount: no se puede montar %s%s de slo lectura" -#: mount/mount.c:1588 +#: mount/mount.c:1597 #, c-format msgid "mount: %s%s is write-protected, mounting read-only" -msgstr "" -"mount: %s%s est protegido contra escritura; se monta como slo lectura" +msgstr "mount: %s%s est protegido contra escritura; se monta como slo lectura" -#: mount/mount.c:1598 +#: mount/mount.c:1607 #, fuzzy, c-format msgid "mount: no medium found on %s ...trying again\n" msgstr "mount: no se ha encontrado %s; se est creando...\n" -#: mount/mount.c:1604 +#: mount/mount.c:1613 #, fuzzy, c-format msgid "mount: no medium found on %s" msgstr "mount: %s ya est montado en %s\n" -#: mount/mount.c:1622 +#: mount/mount.c:1631 #, c-format msgid "" "mount: %s does not contain SELinux labels.\n" @@ -9423,26 +9128,22 @@ msgid "" " this file system. For more details see restorecon(8) and mount(8).\n" msgstr "" -#: mount/mount.c:1701 +#: mount/mount.c:1710 #, c-format msgid "mount: no type was given - I'll assume nfs because of the colon\n" -msgstr "" -"mount: no se ha especificado ningn tipo; se presupone nfs por los dos " -"puntos\n" +msgstr "mount: no se ha especificado ningn tipo; se presupone nfs por los dos puntos\n" -#: mount/mount.c:1707 +#: mount/mount.c:1716 #, fuzzy, c-format msgid "mount: no type was given - I'll assume cifs because of the // prefix\n" -msgstr "" -"mount: no se ha especificado ningn tipo; se presupone smbfs por el " -"prefijo //\n" +msgstr "mount: no se ha especificado ningn tipo; se presupone smbfs por el prefijo //\n" -#: mount/mount.c:1802 +#: mount/mount.c:1811 #, c-format msgid "mount: %s already mounted on %s\n" msgstr "mount: %s ya est montado en %s\n" -#: mount/mount.c:1937 +#: mount/mount.c:1946 #, fuzzy, c-format msgid "" "Usage: mount -V : print version\n" @@ -9495,31 +9196,29 @@ msgstr "" " mount --bind dirantiguo dirnuevo\n" "o mover un subrbol:\n" " mount --move dirantiguo dirnuevo\n" -"Se puede dar un dispositivo mediante el nombre, digamos /dev/hda1 o /dev/" -"cdrom,\n" -"o mediante la etiqueta, utilizando -L etiqueta, o mediante uuid, mediante -U " -"uuid.\n" +"Se puede dar un dispositivo mediante el nombre, digamos /dev/hda1 o /dev/cdrom,\n" +"o mediante la etiqueta, utilizando -L etiqueta, o mediante uuid, mediante -U uuid.\n" "Otras opciones: [-nfFrsvw] [-o opciones] [-p passwdfd].\n" "Escriba man 8 mount para saber mucho ms.\n" -#: mount/mount.c:2265 +#: mount/mount.c:2274 #, fuzzy, c-format msgid "mount: only root can do that (effective UID is %d)" msgstr "mount: slo el usuario root puede efectuar esta accin" -#: mount/mount.c:2268 +#: mount/mount.c:2277 msgid "mount: only root can do that" msgstr "mount: slo el usuario root puede efectuar esta accin" -#: mount/mount.c:2279 +#: mount/mount.c:2288 msgid "nothing was mounted" msgstr "no se ha montado nada" -#: mount/mount.c:2297 mount/mount.c:2323 +#: mount/mount.c:2306 mount/mount.c:2332 msgid "mount: no such partition found" msgstr "mount: no se ha encontrado esta particin" -#: mount/mount.c:2300 +#: mount/mount.c:2309 #, c-format msgid "mount: can't find %s in %s or %s" msgstr "mount: no se puede encontrar %s en %s o %s" @@ -9616,7 +9315,7 @@ msgstr "Error de b #: mount/swapon.c:263 #, fuzzy, c-format msgid "%s: write signature failed" -msgstr "Error al abrir %s" +msgstr "No se puede escribir la pgina de firma" #: mount/swapon.c:350 #, c-format @@ -9635,14 +9334,12 @@ msgstr "Nombre" #: mount/swapon.c:370 #, fuzzy, c-format msgid "%s: stat failed" -msgstr "Error de bsqueda" +msgstr "El estado de %s es %d" #: mount/swapon.c:380 #, fuzzy, c-format msgid "%s: insecure permissions %04o, %04o suggested." -msgstr "" -"swapon: atencin: %s tiene permisos %04o que no son seguros, se sugiere %" -"04o\n" +msgstr "swapon: atencin: %s tiene permisos %04o que no son seguros, se sugiere %04o\n" #: mount/swapon.c:388 #, fuzzy, c-format @@ -9671,8 +9368,7 @@ msgstr "" #: mount/swapon.c:431 #, c-format -msgid "" -"%s: swap format pagesize does not match. (Use --fixpgsz to reinitialize it.)" +msgid "%s: swap format pagesize does not match. (Use --fixpgsz to reinitialize it.)" msgstr "" #: mount/swapon.c:440 @@ -9688,7 +9384,7 @@ msgstr "%s en %s\n" #: mount/swapon.c:486 #, fuzzy, c-format msgid "%s: swapon failed" -msgstr "Error de bsqueda" +msgstr "fsync ha fallado" #: mount/swapon.c:493 #, fuzzy, c-format @@ -9701,9 +9397,9 @@ msgid "Not superuser." msgstr "No es el superusuario.\n" #: mount/swapon.c:529 -#, fuzzy, c-format +#, c-format msgid "%s: swapoff failed" -msgstr "Error de bsqueda" +msgstr "" #: mount/swapon.c:797 #, c-format @@ -9766,8 +9462,7 @@ msgstr "umount: %s: debe ser superusuario para utilizar umount" #: mount/umount.c:177 #, c-format msgid "umount: %s: block devices not permitted on fs" -msgstr "" -"umount: %s: dispositivos de bloques no permitidos en sistema de ficheros" +msgstr "umount: %s: dispositivos de bloques no permitidos en sistema de ficheros" #: mount/umount.c:179 #, c-format @@ -9796,8 +9491,7 @@ msgstr "Se ha ejecutado umount en %s\n" #: mount/umount.c:367 msgid "umount: cannot find list of filesystems to unmount" -msgstr "" -"umount: no se puede encontrar lista de sistemas de ficheros para desmontar" +msgstr "umount: no se puede encontrar lista de sistemas de ficheros para desmontar" #: mount/umount.c:399 #, fuzzy, c-format @@ -9811,14 +9505,14 @@ msgstr "" " umount [-f] [-r] [-n] [-v] special | node...\n" #: mount/umount.c:468 -#, fuzzy, c-format +#, c-format msgid "device %s is associated with %s\n" -msgstr "El sector %d ya est asignado\n" +msgstr "" #: mount/umount.c:474 #, fuzzy, c-format msgid "device %s is not associated with %s\n" -msgstr "El sector %d ya est asignado\n" +msgstr "write: %s no tiene una sesin iniciada en %s.\n" #: mount/umount.c:487 msgid "Cannot umount \"\"\n" @@ -9963,7 +9657,7 @@ msgstr "nuevo " #: schedutils/chrt.c:248 #, fuzzy, c-format msgid "failed to execute %s" -msgstr "ioctl() no ha podido leer la hora de %s" +msgstr "%s: fallo al abrir %s\n" #: schedutils/ionice.c:57 #, fuzzy @@ -10020,8 +9714,7 @@ msgstr "La ejecuci #: sys-utils/ctrlaltdel.c:27 #, c-format msgid "You must be root to set the Ctrl-Alt-Del behaviour.\n" -msgstr "" -"Debe ser el usuario root para definir el comportamiento de Ctrl-Alt-Supr.\n" +msgstr "Debe ser el usuario root para definir el comportamiento de Ctrl-Alt-Supr.\n" #: sys-utils/ctrlaltdel.c:42 #, c-format @@ -10040,12 +9733,10 @@ msgstr "" #: sys-utils/cytune.c:125 #, c-format msgid "" -"File %s, For threshold value %lu and timrout value %lu, Maximum characters " -"in fifo were %d,\n" +"File %s, For threshold value %lu and timrout value %lu, Maximum characters in fifo were %d,\n" "and the maximum transfer rate in characters/second was %f\n" msgstr "" -"Fichero %s, para valor de umbral %lu y valor de tiempo de espera %lu, mximo " -"de caracteres en fifo fue %d\n" +"Fichero %s, para valor de umbral %lu y valor de tiempo de espera %lu, mximo de caracteres en fifo fue %d\n" "y velocidad de transferencia mxima en caracteres por segundo fue %f\n" #: sys-utils/cytune.c:189 @@ -10075,12 +9766,8 @@ msgstr "Valor de hora predeterminado inv #: sys-utils/cytune.c:238 #, c-format -msgid "" -"Usage: %s [-q [-i interval]] ([-s value]|[-S value]) ([-t value]|[-T value]) " -"[-g|-G] file [file...]\n" -msgstr "" -"Uso: %s [-q [-i intervalo]] ([-s valor]|[-S valor]) ([-t valor]|[-T valor]) " -"[-g|-G] fichero [fichero...]\n" +msgid "Usage: %s [-q [-i interval]] ([-s value]|[-S value]) ([-t value]|[-T value]) [-g|-G] file [file...]\n" +msgstr "Uso: %s [-q [-i intervalo]] ([-s valor]|[-S valor]) ([-t valor]|[-T valor]) [-g|-G] fichero [fichero...]\n" #: sys-utils/cytune.c:250 sys-utils/cytune.c:269 sys-utils/cytune.c:289 #: sys-utils/cytune.c:339 @@ -10133,11 +9820,8 @@ msgstr "No se puede emitir CYGETMON en %s: %s\n" #: sys-utils/cytune.c:418 #, c-format -msgid "" -"%s: %lu ints, %lu/%lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n" -msgstr "" -"%s: %lu enteros, %lu/%lu caracteres; fifo: %lu umbral, %lu tiempo_espera, %" -"lu mximo, %lu ahora\n" +msgid "%s: %lu ints, %lu/%lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n" +msgstr "%s: %lu enteros, %lu/%lu caracteres; fifo: %lu umbral, %lu tiempo_espera, %lu mximo, %lu ahora\n" #: sys-utils/cytune.c:424 #, c-format @@ -10146,11 +9830,8 @@ msgstr " %f enteros/seg.; %f recepci #: sys-utils/cytune.c:429 #, c-format -msgid "" -"%s: %lu ints, %lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n" -msgstr "" -"%s: %lu enteros, %lu caracteres; fifo: %lu umbral, %lu tiempo_espera, %lu " -"mximo, %lu ahora\n" +msgid "%s: %lu ints, %lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n" +msgstr "%s: %lu enteros, %lu caracteres; fifo: %lu umbral, %lu tiempo_espera, %lu mximo, %lu ahora\n" #: sys-utils/cytune.c:435 #, c-format @@ -10205,7 +9886,7 @@ msgstr "" #: sys-utils/fallocate.c:174 #, fuzzy, c-format msgid "%s: fallocate failed" -msgstr "openpty ha fallado\n" +msgstr "La asignacin de memoria (malloc) ha fallado" #: sys-utils/flock.c:65 #, c-format @@ -10414,8 +10095,7 @@ msgstr "\t%s -h para obtener ayuda.\n" #: sys-utils/ipcs.c:124 #, c-format -msgid "" -"%s provides information on ipc facilities for which you have read access.\n" +msgid "%s provides information on ipc facilities for which you have read access.\n" msgstr "" "%s facilita informacin sobre los recursos ipc para los cuales tiene\n" "acceso de lectura.\n" @@ -10465,9 +10145,7 @@ msgstr "" #: sys-utils/ipcs.c:130 #, c-format msgid "-i id [-s -q -m] : details on resource identified by id\n" -msgstr "" -"-i id [-s -q -m] : informacin detallada sobre los recursos identificados " -"por id\n" +msgstr "-i id [-s -q -m] : informacin detallada sobre los recursos identificados por id\n" #: sys-utils/ipcs.c:254 #, c-format @@ -10998,9 +10676,9 @@ msgid "speed %d unsupported" msgstr "" #: sys-utils/ldattach.c:244 -#, fuzzy, c-format +#, c-format msgid "cannot set terminal attributes for %s" -msgstr "no se puede obtener el tamao de %s" +msgstr "" #: sys-utils/ldattach.c:251 #, fuzzy @@ -11010,7 +10688,7 @@ msgstr "No se puede buscar en la unidad de disco" #: sys-utils/ldattach.c:257 #, fuzzy msgid "cannot daemonize" -msgstr "no se puede obtener el tamao de %s" +msgstr "no se puede abrir %s" # Masculino, porque se refiere a "Indicadores" #: sys-utils/lscpu.c:64 @@ -11038,16 +10716,13 @@ msgid "error parse: %s" msgstr "Error al leer %s\n" #: sys-utils/lscpu.c:184 -#, fuzzy msgid "error: strdup failed" -msgstr "Error al abrir %s" +msgstr "" #: sys-utils/lscpu.c:267 #, fuzzy msgid "error: uname failed" -msgstr "" -"\n" -"Error al cerrar el fichero\n" +msgstr "montaje errneo" #: sys-utils/lscpu.c:506 #, fuzzy @@ -11146,15 +10821,11 @@ msgstr "Error al cambiar el modo de %s: %s\n" #: sys-utils/rdev.c:77 msgid "usage: rdev [ -rv ] [ -o OFFSET ] [ IMAGE [ VALUE [ OFFSET ] ] ]" -msgstr "" -"uso: rdev [ -rv ] [ -o DESPLAZAMIENTO ] [ IMAGEN [ VALOR " -"[ DESPLAZAMIENTO ] ] ]" +msgstr "uso: rdev [ -rv ] [ -o DESPLAZAMIENTO ] [ IMAGEN [ VALOR [ DESPLAZAMIENTO ] ] ]" #: sys-utils/rdev.c:78 -msgid "" -" rdev /dev/fd0 (or rdev /linux, etc.) displays the current ROOT device" -msgstr "" -" rdev /dev/fd0 (o rdev /linux, etc.) muestra el dispositivo ROOT actual" +msgid " rdev /dev/fd0 (or rdev /linux, etc.) displays the current ROOT device" +msgstr " rdev /dev/fd0 (o rdev /linux, etc.) muestra el dispositivo ROOT actual" #: sys-utils/rdev.c:79 msgid " rdev /dev/fd0 /dev/hda2 sets ROOT to /dev/hda2" @@ -11162,9 +10833,7 @@ msgstr " rdev /dev/fd0 /dev/hda2 Establece ROOT en /dev/hda2" #: sys-utils/rdev.c:80 msgid " rdev -R /dev/fd0 1 set the ROOTFLAGS (readonly status)" -msgstr "" -" rdev -R /dev/fd0 1 Establece ROOTFLAGS (estado de slo " -"lectura)" +msgstr " rdev -R /dev/fd0 1 Establece ROOTFLAGS (estado de slo lectura)" #: sys-utils/rdev.c:81 msgid " rdev -r /dev/fd0 627 set the RAMDISK size" @@ -11191,8 +10860,7 @@ msgid " vidmode ... same as rdev -v" msgstr " vidmode ... Igual que rdev -v" #: sys-utils/rdev.c:87 -msgid "" -"Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,..." +msgid "Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,..." msgstr "" "Nota: los modos de vdeo son: -3=Ask, -2=Extended, -1=NormalVga,\n" " 1=key1, 2=key2,..." @@ -11236,14 +10904,11 @@ msgstr "" " -M Establece el multiplicador de perfil en \n" " -i Muestra slo informacin sobre paso de muestreo\n" " -v Muestra datos detallados\n" -" -a Muestra todos los smbolos, incluso si nmero total " -"es 0\n" +" -a Muestra todos los smbolos, incluso si nmero total es 0\n" " -b Muestra histogramas individuales de los contadores\n" -" -s Muestra contadores individuales dentro de cada " -"funcin\n" +" -s Muestra contadores individuales dentro de cada funcin\n" " -r Restablece todos los contadores (slo root)\n" -" -n Desactiva la deteccin automtica del orden de los " -"bytes\n" +" -n Desactiva la deteccin automtica del orden de los bytes\n" " -V Muestra la versin y sale\n" #: sys-utils/readprofile.c:227 @@ -11457,8 +11122,7 @@ msgstr "" msgid "" " -h, --help displays this help text\n" " -v, --verbose says what options are being switched on\n" -" -R, --addr-no-randomize disables randomization of the virtual address " -"space\n" +" -R, --addr-no-randomize disables randomization of the virtual address space\n" " -F, --fdpic-funcptrs makes function pointers point to descriptors\n" " -Z, --mmap-page-zero turns on MMAP_PAGE_ZERO\n" " -L, --addr-compat-layout changes the way virtual memory is allocated\n" @@ -11467,8 +11131,7 @@ msgid "" " -I, --short-inode turns on SHORT_INODE\n" " -S, --whole-seconds turns on WHOLE_SECONDS\n" " -T, --sticky-timeouts turns on STICKY_TIMEOUTS\n" -" -3, --3gb limits the used address space to a maximum of 3 " -"GB\n" +" -3, --3gb limits the used address space to a maximum of 3 GB\n" " --4gb ignored (for backward compatibility only)\n" msgstr "" @@ -11662,11 +11325,8 @@ msgstr "hexdump: valor de salto incorrecto.\n" #: text-utils/hexsyntax.c:131 #, c-format -msgid "" -"hexdump: [-bcCdovx] [-e fmt] [-f fmt_file] [-n length] [-s skip] [file ...]\n" -msgstr "" -"hexdump: [-bcCdovx] [-e fmt] [-f fichero_fmt] [-n longitud] [-s omitir] " -"[fichero ...]\n" +msgid "hexdump: [-bcCdovx] [-e fmt] [-f fmt_file] [-n length] [-s skip] [file ...]\n" +msgstr "hexdump: [-bcCdovx] [-e fmt] [-f fichero_fmt] [-n longitud] [-s omitir] [fichero ...]\n" #: text-utils/more.c:258 #, c-format @@ -11756,16 +11416,13 @@ msgstr "" #: text-utils/more.c:1328 msgid "" "\n" -"Most commands optionally preceded by integer argument k. Defaults in " -"brackets.\n" +"Most commands optionally preceded by integer argument k. Defaults in brackets.\n" "Star (*) indicates argument becomes new default.\n" msgstr "" "\n" -"La mayora de las rdenes pueden estar precedidas por un argumento entero " -"k.\n" +"La mayora de las rdenes pueden estar precedidas por un argumento entero k.\n" "Los valores predeterminados estn entre corchetes.\n" -"Un asterisco (*) indica que el argumento ser el nuevo valor " -"predeterminado.\n" +"Un asterisco (*) indica que el argumento ser el nuevo valor predeterminado.\n" #: text-utils/more.c:1335 msgid "" @@ -11802,8 +11459,7 @@ msgstr "" "b o ctrl-B Salta hacia atrs k pantallas de texto [1]\n" "' Va al sitio donde comenz la bsqueda anterior\n" "= Muestra el nmero de la lnea actual\n" -"/ Busca la k-sima aparicin de la expresin regular " -"[1]\n" +"/ Busca la k-sima aparicin de la expresin regular [1]\n" "n Busca la k-sima aparicin de la ltima e.r. [1]\n" "! o :! Ejecuta en un subshell\n" "v Inicia /usr/bin/vi en la lnea actual\n" @@ -11912,14 +11568,12 @@ msgstr "hexdump: n #: text-utils/parse.c:483 #, c-format msgid "hexdump: bad byte count for conversion character %s.\n" -msgstr "" -"hexdump: nmero total de bytes incorrecto para carcter de conversin %s.\n" +msgstr "hexdump: nmero total de bytes incorrecto para carcter de conversin %s.\n" #: text-utils/parse.c:490 #, c-format msgid "hexdump: %%s requires a precision or a byte count.\n" -msgstr "" -"hexdump: %%s requiere un valor de precisin o un nmero total de bytes.\n" +msgstr "hexdump: %%s requiere un valor de precisin o un nmero total de bytes.\n" #: text-utils/parse.c:496 #, c-format @@ -11952,8 +11606,7 @@ msgid "" " n go to next file\n" "\n" "Many commands accept preceding numbers, for example:\n" -"+1 (next page); -1 (previous page); 1 (first " -"page).\n" +"+1 (next page); -1 (previous page); 1 (first page).\n" "\n" "See pg(1) for more information.\n" "-------------------------------------------------------\n" @@ -11966,10 +11619,8 @@ msgstr "No queda memoria" #: text-utils/pg.c:236 #, c-format -msgid "" -"%s: Usage: %s [-number] [-p string] [-cefnrs] [+line] [+/pattern/] [files]\n" -msgstr "" -"%s: Uso: %s [-nmero] [-p cadena] [-cefrns] [+lnea] [+/patrn/] [ficheros]\n" +msgid "%s: Usage: %s [-number] [-p string] [-cefnrs] [+line] [+/pattern/] [files]\n" +msgstr "%s: Uso: %s [-nmero] [-p cadena] [-cefrns] [+lnea] [+/patrn/] [ficheros]\n" #: text-utils/pg.c:245 #, c-format @@ -12130,155 +11781,84 @@ msgstr "L msgid "Out of memory when growing buffer.\n" msgstr "No queda memoria al aumentar el tamao del bfer.\n" -#, fuzzy -#~ msgid "out if memory" -#~ msgstr "no queda memoria" - -#~ msgid "# partition table of %s\n" -#~ msgstr "# tabla de particiones de %s\n" - -#, fuzzy -#~ msgid "" -#~ "unit: sectors\n" -#~ "\n" -#~ msgstr "%lld sectores no asignados\n" - -#, fuzzy -#~ msgid " start=%9lu" -#~ msgstr "comienzo" - -#, fuzzy -#~ msgid ", size=%9lu" -#~ msgstr "Tamao mximo=%ld\n" - -#, fuzzy -#~ msgid ", bootable" -#~ msgstr "AIX bootable" +#~ msgid "`%s': bad directory: '.' isn't first\n" +#~ msgstr "`%s': directorio incorrecto: '.' no es el primero\n" -#, fuzzy -#~ msgid "Clock in UTC, not changed.\n" -#~ msgstr "No se ha cambiado el intrprete de rdenes.\n" +#~ msgid "`%s': bad directory: '..' isn't second\n" +#~ msgstr "`%s': directorio incorrecto: '..' no es el segundo\n" #, fuzzy #~ msgid "%s: error: label only with v1 swap area\n" -#~ msgstr "" -#~ "%s: error: no se ha especificado dnde configurar el espacio de " -#~ "intercambio\n" +#~ msgstr "%s: error: no se ha especificado dnde configurar el espacio de intercambio\n" #~ msgid "fatal: first page unreadable" #~ msgstr "muy grave: no se puede leer la primera pgina" -#, fuzzy #~ msgid "" #~ "%s: Device '%s' contains a valid Sun disklabel.\n" -#~ "This probably means creating v0 swap would destroy your partition table.\n" -#~ "No swap was created. If you really want to create v0 swap on that " -#~ "device,\n" -#~ "use the -f option to force it.\n" +#~ "This probably means creating v0 swap would destroy your partition table\n" +#~ "No swap created. If you really want to create swap v0 on that device, use\n" +#~ "the -f option to force it.\n" #~ msgstr "" #~ "%s: el dispositivo '%s' contiene una etiqueta de disco Sun vlida.\n" -#~ "Esto probablemente significa que crear un espacio de intercambio v0 " -#~ "destruir\n" +#~ "Esto probablemente significa que crear un espacio de intercambio v0 destruir\n" #~ "la tabla de particiones. No se ha creado el espacio de intercambio.\n" #~ "Si realmente desea crear el espacio de intercambio swap v0 en dicho\n" #~ "dispositivo, utilice la opcin -f para forzar la operacin.\n" -#~ msgid "namei: unable to get current directory - %s\n" -#~ msgstr "namei: no se puede obtener el directorio actual - %s\n" - -#~ msgid "namei: unable to chdir to %s - %s (%d)\n" -#~ msgstr "namei: no se puede ejecutar chdir para %s - %s (%d)\n" - -#~ msgid "namei: could not chdir to root!\n" -#~ msgstr "namei: no se puede ejecutar chdir para directorio raz\n" - -#~ msgid "namei: could not stat root!\n" -#~ msgstr "namei: no se puede ejecutar stat para el directorio raz\n" - -#~ msgid "namei: buf overflow\n" -#~ msgstr "namei: desbordamiento de bfer\n" - -#~ msgid " ? could not chdir into %s - %s (%d)\n" -#~ msgstr " ? no se puede ejecutar chdir para %s - %s (%d)\n" - -#~ msgid " ? problems reading symlink %s - %s (%d)\n" -#~ msgstr " ? problemas al leer el enlace simblico %s - %s (%d)\n" - -#~ msgid " *** EXCEEDED UNIX LIMIT OF SYMLINKS ***\n" -#~ msgstr " *** Se ha superado lmite de enlaces simblicos de Unix ***\n" - -#~ msgid "namei: unknown file type 0%06o on file %s\n" -#~ msgstr "namei: tipo de fichero desconocido 0%06o en el fichero %s\n" - -#, fuzzy -#~ msgid "mount: going to mount %s by %s\n" -#~ msgstr "mount: se montar %s mediante %s\n" - -#, fuzzy -#~ msgid "mount: no LABEL=, no UUID=, going to mount %s by path\n" -#~ msgstr "mount: se montar %s mediante %s\n" - -#, fuzzy -#~ msgid "%s: cannot fork: %s\n" -#~ msgstr "%s: no se puede bifurcar (fork)\n" - -#, fuzzy -#~ msgid "%s: waitpid: %s\n" -#~ msgstr "%s: fallo al abrir %s\n" - -#, fuzzy -#~ msgid "%s: cannot stat %s: %s\n" -#~ msgstr "swapon: no se puede ejecutar stat para %s: %s\n" - -#~ msgid "could not umount %s - trying %s instead\n" +#~ msgid "" +#~ "Usage: fdisk [-b SSZ] [-u] DISK Change partition table\n" +#~ " fdisk -l [-b SSZ] [-u] DISK List partition table(s)\n" +#~ " fdisk -s PARTITION Give partition size(s) in blocks\n" +#~ " fdisk -v Give fdisk version\n" +#~ "Here DISK is something like /dev/hdb or /dev/sda\n" +#~ "and PARTITION is something like /dev/hda7\n" +#~ "-u: give Start and End in sector (instead of cylinder) units\n" +#~ "-b 2048: (for certain MO disks) use 2048-byte sectors\n" #~ msgstr "" -#~ "no se ha podido ejecutar umount en %s; en su lugar se prueba con %s\n" - -#~ msgid "%-10s %-10s %-10s %-10s %-10s %-10s\n" -#~ msgstr "%-10s %-10s %-10s %-10s %-10s %-10s\n" - -#~ msgid "%-10s %-10s %-20s %-20s %-20s\n" -#~ msgstr "%-10s %-10s %-20s %-20s %-20s\n" - -#~ msgid "%-10s %-10s %-10s %-10s\n" -#~ msgstr "%-10s %-10s %-10s %-10s\n" - -#~ msgid "%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n" -#~ msgstr "%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n" - -#~ msgid "%-8s %-10s %-26.24s %-26.24s\n" -#~ msgstr "%-8s %-10s %-26.24s %-26.24s\n" - -#~ msgid "%-10s %-10s %-10s %-10s %-10s\n" -#~ msgstr "%-10s %-10s %-10s %-10s %-10s\n" - -#~ msgid "%-8s %-10s %-20s %-20s %-20s\n" -#~ msgstr "%-8s %-10s %-20s %-20s %-20s\n" - -#~ msgid "%-10s %-10s %-10s %-10s %-12s %-12s\n" -#~ msgstr "%-10s %-10s %-10s %-10s %-12s %-12s\n" - -#, fuzzy -#~ msgid "chfn: PAM Failure, aborting: %s\n" -#~ msgstr "login: error de PAM; anulando: %s\n" +#~ "Uso: fdisk [-b SSZ] [-u] DISCO Cambia tabla de particiones\n" +#~ " fdisk -l [-b SSZ] [-u] DISCO Lista tabla(s) de particiones\n" +#~ " fdisk -s PARTICIN Obtiene tamao de particiones en bloques\n" +#~ " fdisk -v Obtiene versin de fdisk\n" +#~ "El valor de DISCO tiene el formato /dev/hdb o /dev/sda\n" +#~ "y el valor de PARTICIN tiene el formato /dev/hda7\n" +#~ "-u: Obtener Principio y Final en sectores (en lugar de cilindros)\n" +#~ "-b 2048: (Para algunas unidades MO) Utilizar sectores de 2048 bytes\n" -#~ msgid "Can't read %s, exiting." -#~ msgstr "No se puede leer %s; saliendo." - -#~ msgid "login: PAM Failure, aborting: %s\n" -#~ msgstr "login: error de PAM; anulando: %s\n" - -#~ msgid "mount: backgrounding \"%s\"\n" -#~ msgstr "mount: ejecutando en segundo plano \"%s\"\n" - -#~ msgid "mount: giving up \"%s\"\n" -#~ msgstr "mount: se abandona \"%s\"\n" +#~ msgid "" +#~ "Usage: fdisk [-l] [-b SSZ] [-u] device\n" +#~ "E.g.: fdisk /dev/hda (for the first IDE disk)\n" +#~ " or: fdisk /dev/sdc (for the third SCSI disk)\n" +#~ " or: fdisk /dev/eda (for the first PS/2 ESDI drive)\n" +#~ " or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)\n" +#~ " ...\n" +#~ msgstr "" +#~ "Uso: fdisk [-l] [-b SSZ] [-u] dispositivo\n" +#~ "Ej.: fdisk /dev/hda (para el primer disco IDE)\n" +#~ " o: fdisk /dev/sdc (para el tercer disco SCSI)\n" +#~ " o: fdisk /dev/eda (para la primera unidad PS/2 ESDI)\n" +#~ " o: fdisk /dev/rd/c0d0 o fdisk /dev/ida/c0d0 (para dispositivos RAID)\n" +#~ " ...\n" -#~ msgid "`%s': bad directory: '.' isn't first\n" -#~ msgstr "`%s': directorio incorrecto: '.' no es el primero\n" +#~ msgid "" +#~ "\n" +#~ "The number of cylinders for this disk is set to %d.\n" +#~ "There is nothing wrong with that, but this is larger than 1024,\n" +#~ "and could in certain setups cause problems with:\n" +#~ "1) software that runs at boot time (e.g., old versions of LILO)\n" +#~ "2) booting and partitioning software from other OSs\n" +#~ " (e.g., DOS FDISK, OS/2 FDISK)\n" +#~ msgstr "" +#~ "\n" +#~ "El nmero de cilindros para este disco est establecido en %d.\n" +#~ "No hay nada malo en ello, pero es mayor que 1024, y en algunos casos\n" +#~ "podra causar problemas con:\n" +#~ "1) software que funciona en el inicio (p.ej. versiones antiguas de LILO)\n" +#~ "2) software de arranque o particionamiento de otros sistemas operativos\n" +#~ " (p.ej. FDISK de DOS, FDISK de OS/2)\n" -#~ msgid "`%s': bad directory: '..' isn't second\n" -#~ msgstr "`%s': directorio incorrecto: '..' no es el segundo\n" +#~ msgid "# partition table of %s\n" +#~ msgstr "# tabla de particiones de %s\n" #~ msgid "calling open_tty\n" #~ msgstr "calling open_tty\n" @@ -12325,18 +11905,62 @@ msgstr "No queda memoria al aumentar el tama #~ msgid "Warning: \"%s\" is not listed in /etc/shells\n" #~ msgstr "Atencin: \"%s\" no figura en /etc/shells\n" +#~ msgid "Can't read %s, exiting." +#~ msgstr "No se puede leer %s; saliendo." + #~ msgid "timeout = %d, quiet = %d, reboot = %d\n" #~ msgstr "timeout = %d, quiet = %d, reboot = %d\n" +#~ msgid "namei: unable to get current directory - %s\n" +#~ msgstr "namei: no se puede obtener el directorio actual - %s\n" + +#~ msgid "namei: unable to chdir to %s - %s (%d)\n" +#~ msgstr "namei: no se puede ejecutar chdir para %s - %s (%d)\n" + +#~ msgid "namei: could not chdir to root!\n" +#~ msgstr "namei: no se puede ejecutar chdir para directorio raz\n" + +#~ msgid "namei: could not stat root!\n" +#~ msgstr "namei: no se puede ejecutar stat para el directorio raz\n" + +#~ msgid "namei: buf overflow\n" +#~ msgstr "namei: desbordamiento de bfer\n" + +#~ msgid " ? could not chdir into %s - %s (%d)\n" +#~ msgstr " ? no se puede ejecutar chdir para %s - %s (%d)\n" + +#~ msgid " ? problems reading symlink %s - %s (%d)\n" +#~ msgstr " ? problemas al leer el enlace simblico %s - %s (%d)\n" + +#~ msgid " *** EXCEEDED UNIX LIMIT OF SYMLINKS ***\n" +#~ msgstr " *** Se ha superado lmite de enlaces simblicos de Unix ***\n" + +#~ msgid "namei: unknown file type 0%06o on file %s\n" +#~ msgstr "namei: tipo de fichero desconocido 0%06o en el fichero %s\n" + #~ msgid "couldn't read %s, and cannot ioctl dump\n" #~ msgstr "No se ha podido leer %s y no se puede efectuar vuelco de ioctl\n" +#, fuzzy +#~ msgid "mount: going to mount %s by %s\n" +#~ msgstr "mount: se montar %s mediante %s\n" + +#, fuzzy +#~ msgid "mount: no LABEL=, no UUID=, going to mount %s by path\n" +#~ msgstr "mount: se montar %s mediante %s\n" + #~ msgid ", offset %lld" #~ msgstr ", desplazamiento %lld" #~ msgid "%s: could not find any device /dev/loop#" #~ msgstr "%s: no se puede encontrar ningn dispositivo /dev/loop#" +#~ msgid "mount: backgrounding \"%s\"\n" +#~ msgstr "mount: ejecutando en segundo plano \"%s\"\n" + +#~ msgid "mount: giving up \"%s\"\n" +#~ msgstr "mount: se abandona \"%s\"\n" + #, fuzzy #~ msgid "" #~ "usage: %s [-hV]\n" @@ -12362,19 +11986,45 @@ msgstr "No queda memoria al aumentar el tama #~ msgid "%s: cannot canonicalize %s: %s\n" #~ msgstr "%s: no se puede abrir %s: %s\n" -#~ msgid "" -#~ "usage: renice priority [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] users ]\n" -#~ msgstr "" -#~ "uso: renice prioridad [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] " -#~ "usuarios ]\n" +#, fuzzy +#~ msgid "%s: cannot stat %s: %s\n" +#~ msgstr "swapon: no se puede ejecutar stat para %s: %s\n" + +#~ msgid "could not umount %s - trying %s instead\n" +#~ msgstr "no se ha podido ejecutar umount en %s; en su lugar se prueba con %s\n" + +#~ msgid "%-10s %-10s %-10s %-10s %-10s %-10s\n" +#~ msgstr "%-10s %-10s %-10s %-10s %-10s %-10s\n" + +#~ msgid "%-10s %-10s %-20s %-20s %-20s\n" +#~ msgstr "%-10s %-10s %-20s %-20s %-20s\n" + +#~ msgid "%-10s %-10s %-10s %-10s\n" +#~ msgstr "%-10s %-10s %-10s %-10s\n" + +#~ msgid "%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n" +#~ msgstr "%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n" + +#~ msgid "%-8s %-10s %-26.24s %-26.24s\n" +#~ msgstr "%-8s %-10s %-26.24s %-26.24s\n" + +#~ msgid "%-10s %-10s %-10s %-10s %-10s\n" +#~ msgstr "%-10s %-10s %-10s %-10s %-10s\n" + +#~ msgid "%-8s %-10s %-20s %-20s %-20s\n" +#~ msgstr "%-8s %-10s %-20s %-20s %-20s\n" + +#~ msgid "%-10s %-10s %-10s %-10s %-12s %-12s\n" +#~ msgstr "%-10s %-10s %-10s %-10s %-12s %-12s\n" + +#~ msgid "usage: renice priority [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] users ]\n" +#~ msgstr "uso: renice prioridad [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] usuarios ]\n" #, fuzzy #~ msgid "Unknown option `%c' ignored" #~ msgstr "%s: opcin desconocida \"-%c\"\n" -#~ msgid "" -#~ "Exceeded MAXENTRIES. Raise this value in mkcramfs.c and recompile. " -#~ "Exiting.\n" +#~ msgid "Exceeded MAXENTRIES. Raise this value in mkcramfs.c and recompile. Exiting.\n" #~ msgstr "" #~ "Se excedi MAXENTRIES. Incremente este valor en mkcramfs.c y recompile.\n" #~ "Saliendo.\n" @@ -12428,11 +12078,9 @@ msgstr "No queda memoria al aumentar el tama #~ msgstr "mount: la etiqueta %s aparece tanto en %s como en %s\n" #, fuzzy -#~ msgid "" -#~ "%s: could not open %s, so UUID and LABEL conversion cannot be done.\n" +#~ msgid "%s: could not open %s, so UUID and LABEL conversion cannot be done.\n" #~ msgstr "" -#~ "mount: no se ha podido abrir %s; as que no se puede efectuar la " -#~ "conversin\n" +#~ "mount: no se ha podido abrir %s; as que no se puede efectuar la conversin\n" #~ "de UUID y ETIQUETA\n" #, fuzzy @@ -12459,8 +12107,7 @@ msgstr "No queda memoria al aumentar el tama #~ msgstr "mount: atencin: varios nombres de host no soportados\n" #~ msgid "mount: directory to mount not in host:dir format\n" -#~ msgstr "" -#~ "mount: el directorio que se debe montar no tiene el formato host:dir\n" +#~ msgstr "mount: el directorio que se debe montar no tiene el formato host:dir\n" #~ msgid "mount: can't get address for %s\n" #~ msgstr "mount: no se puede obtener la direccin para %s\n" @@ -12496,8 +12143,7 @@ msgstr "No queda memoria al aumentar el tama #~ msgstr "el servidor nfs informa de que el servicio no est disponible" #~ msgid "used portmapper to find NFS port\n" -#~ msgstr "" -#~ "Se ha utilizado el asignador de puertos para encontrar el puerto NFS\n" +#~ msgstr "Se ha utilizado el asignador de puertos para encontrar el puerto NFS\n" #~ msgid "using port %d for nfs deamon\n" #~ msgstr "Utilizando puerto %d para daemon de nfs\n" @@ -12521,8 +12167,7 @@ msgstr "No queda memoria al aumentar el tama #~ msgstr "%s: cramfs invlido, magia errnea\n" #~ msgid "%s: warning--file length too long, padded image?\n" -#~ msgstr "" -#~ "%s: atencin, longitud de fichero demasiado grande, imagen desplazada?\n" +#~ msgstr "%s: atencin, longitud de fichero demasiado grande, imagen desplazada?\n" #~ msgid "%s: invalid cramfs--crc error\n" #~ msgstr "%s: error de crc, cramfs invlido\n" @@ -12539,11 +12184,8 @@ msgstr "No queda memoria al aumentar el tama #~ msgid " %s [ -p ] dev name\n" #~ msgstr " %s [ -p ] dispositivo nombre\n" -#~ msgid "" -#~ " %s [ -p ] dev size sect heads tracks stretch gap rate spec1 fmt_gap\n" -#~ msgstr "" -#~ " %s [ -p ] disp. tamao sect. cabez. pistas stretch gap rate spec1 " -#~ "fmt_gap\n" +#~ msgid " %s [ -p ] dev size sect heads tracks stretch gap rate spec1 fmt_gap\n" +#~ msgstr " %s [ -p ] disp. tamao sect. cabez. pistas stretch gap rate spec1 fmt_gap\n" #~ msgid " %s [ -c | -y | -n | -d ] dev\n" #~ msgstr " %s [ -c | -y | -n | -d ] dispositivo\n" @@ -12580,8 +12222,7 @@ msgstr "No queda memoria al aumentar el tama #~ msgstr "Tiene demasiados procesos en ejecucin.\n" #~ msgid "The password must have at least 6 characters, try again.\n" -#~ msgstr "" -#~ "La contrasea debe tener como mnimo 6 caracteres; intntelo de nuevo.\n" +#~ msgstr "La contrasea debe tener como mnimo 6 caracteres; intntelo de nuevo.\n" #~ msgid "" #~ "The password must contain characters out of two of the following\n" @@ -12589,29 +12230,23 @@ msgstr "No queda memoria al aumentar el tama #~ "characters. See passwd(1) for more information.\n" #~ msgstr "" #~ "La contrasea debe contener caracteres de al menos dos de las siguientes\n" -#~ "clases: letras maysculas y minsculas, dgitos, y caracteres no " -#~ "alfanumricos.\n" +#~ "clases: letras maysculas y minsculas, dgitos, y caracteres no alfanumricos.\n" #~ "Consulte passwd(1) para ms informacin.\n" #~ msgid "You cannot reuse the old password.\n" #~ msgstr "No puede volver a utilizar la antigua contrasea.\n" #~ msgid "Please don't use something like your username as password!\n" -#~ msgstr "" -#~ "No utilice un valor como por ejemplo el nombre de usuario como " -#~ "contrasea.\n" +#~ msgstr "No utilice un valor como por ejemplo el nombre de usuario como contrasea.\n" #~ msgid "Please don't use something like your realname as password!\n" -#~ msgstr "" -#~ "No utilice un valor como por ejemplo su nombre real como contrasea.\n" +#~ msgstr "No utilice un valor como por ejemplo su nombre real como contrasea.\n" #~ msgid "Usage: passwd [username [password]]\n" #~ msgstr "Uso: passwd [nombreusuario [contrasea]]\n" #~ msgid "Only root may use the one and two argument forms.\n" -#~ msgstr "" -#~ "Slo el usuario root puede utilizar los formatos de uno y dos " -#~ "argumentos.\n" +#~ msgstr "Slo el usuario root puede utilizar los formatos de uno y dos argumentos.\n" #~ msgid "Usage: passwd [-foqsvV] [user [password]]\n" #~ msgstr "Uso: passwd [-foqsvV] [usuario [contrasea]]\n" @@ -12623,17 +12258,13 @@ msgstr "No queda memoria al aumentar el tama #~ msgstr "No se puede encontrar el nombre de inicio de sesin" #~ msgid "Only root can change the password for others.\n" -#~ msgstr "" -#~ "Slo el usuario root puede cambiar la contrasea de otros usuarios.\n" +#~ msgstr "Slo el usuario root puede cambiar la contrasea de otros usuarios.\n" #~ msgid "Can't find username anywhere. Is `%s' really a user?" -#~ msgstr "" -#~ "No se puede encontrar el nombre de usuario. `%s' es realmente un usuario?" +#~ msgstr "No se puede encontrar el nombre de usuario. `%s' es realmente un usuario?" #~ msgid "Sorry, I can only change local passwords. Use yppasswd instead." -#~ msgstr "" -#~ "Este comando slo puede cambiar las contraseas locales. Utilice yppasswd " -#~ "en su lugar." +#~ msgstr "Este comando slo puede cambiar las contraseas locales. Utilice yppasswd en su lugar." #~ msgid "UID and username does not match, imposter!" #~ msgstr "El UID y el nombre de usuario no coinciden." @@ -12672,8 +12303,7 @@ msgstr "No queda memoria al aumentar el tama #~ msgstr "Llamando a setpwnam para establecer contrasea.\n" #~ msgid "Password *NOT* changed. Try again later.\n" -#~ msgstr "" -#~ "*NO* se ha cambiado la contrasea. Intntelo de nuevo ms adelante.\n" +#~ msgstr "*NO* se ha cambiado la contrasea. Intntelo de nuevo ms adelante.\n" #~ msgid "Password changed.\n" #~ msgstr "Se ha cambiado la contrasea.\n" @@ -12688,8 +12318,7 @@ msgstr "No queda memoria al aumentar el tama #~ msgstr "Error de ioctl BLKGETSIZE para %s\n" #~ msgid "mount: fs type %s not supported by kernel" -#~ msgstr "" -#~ "mount: el tipo de sistema de ficheros %s no est soportado por el ncleo" +#~ msgstr "mount: el tipo de sistema de ficheros %s no est soportado por el ncleo" #~ msgid "mount: %s duplicate - not mounted" #~ msgstr "mount: %s duplicado - no se monta" @@ -12698,8 +12327,7 @@ msgstr "No queda memoria al aumentar el tama #~ msgstr "UUID" #~ msgid "mount: the label %s occurs on both %s and %s - not mounted\n" -#~ msgstr "" -#~ "mount: la etiqueta %s aparece tanto en %s como en %s - no se monta\n" +#~ msgstr "mount: la etiqueta %s aparece tanto en %s como en %s - no se monta\n" #~ msgid "umount: only root can unmount %s from %s" #~ msgstr "umount: slo el usuario root puede desmontar %s desde %s" @@ -12719,10 +12347,8 @@ msgstr "No queda memoria al aumentar el tama #~ " about the loop device (then recompile or `insmod loop.o'), or\n" #~ " maybe /dev/loop# has the wrong major number?" #~ msgstr "" -#~ "mount: No se ha encontrado ningn dispositivo de bucle. Tal vez este " -#~ "ncleo no\n" -#~ " conozca el dispositivo de bucle (vuelva a compilar o `insmod loop." -#~ "o')\n" +#~ "mount: No se ha encontrado ningn dispositivo de bucle. Tal vez este ncleo no\n" +#~ " conozca el dispositivo de bucle (vuelva a compilar o `insmod loop.o')\n" #~ " o tal vez /dev/loop# tenga el nmero principal incorrecto." #~ msgid "Init (up to 16 hex digits): " @@ -12759,11 +12385,9 @@ msgstr "No queda memoria al aumentar el tama #~ msgstr "para lectura" #~ msgid "The password must contain characters out of two of the following\n" -#~ msgstr "" -#~ "La contrasea debe contener caracteres de dos de los tipos siguientes\n" +#~ msgstr "La contrasea debe contener caracteres de dos de los tipos siguientes\n" -#~ msgid "" -#~ "classes: upper and lower case letters, digits and non alphanumeric\n" +#~ msgid "classes: upper and lower case letters, digits and non alphanumeric\n" #~ msgstr "clases: letras maysculas y minsculas, dgitos y caracteres\n" #~ msgid "characters. See passwd(1) for more information.\n" @@ -12815,10 +12439,8 @@ msgstr "No queda memoria al aumentar el tama #~ "Re-read table failed with error %d: %s.\n" #~ "Reboot your system to ensure the partition table is updated.\n" #~ msgstr "" -#~ "La nueva lectura de la tabla de particiones ha fallado con el error %d: %" -#~ "s.\n" -#~ "Reinicie el sistema para asegurarse de que la tabla de particiones se " -#~ "actualice.\n" +#~ "La nueva lectura de la tabla de particiones ha fallado con el error %d: %s.\n" +#~ "Reinicie el sistema para asegurarse de que la tabla de particiones se actualice.\n" #~ msgid "Warning: partition %s contains part of " #~ msgstr "Atencin: la particin %s contiene parte de " @@ -12844,9 +12466,6 @@ msgstr "No queda memoria al aumentar el tama #~ msgid "sleepexit %d\n" #~ msgstr "sleepexit %d\n" -#~ msgid "Usage: %s [ -s shell ] " -#~ msgstr "Uso: %s [ -s intrprete_rdenes ] " - #~ msgid " [ username ]\n" #~ msgstr " [ nombre_usuario ]\n" @@ -12866,14 +12485,10 @@ msgstr "No queda memoria al aumentar el tama #~ msgstr "Atencin: la cuenta caduca en %d %s del ao %d.\n" #~ msgid "mount: warning: cannot change mounted device with a remount\n" -#~ msgstr "" -#~ "mount: atencin: no se puede cambiar el dispositivo montado con un nuevo " -#~ "montaje\n" +#~ msgstr "mount: atencin: no se puede cambiar el dispositivo montado con un nuevo montaje\n" #~ msgid "mount: warning: cannot change filesystem type with a remount\n" -#~ msgstr "" -#~ "mount: atencin: no se puede cambiar el sistema de ficheros con un nuevo " -#~ "montaje\n" +#~ msgstr "mount: atencin: no se puede cambiar el sistema de ficheros con un nuevo montaje\n" #~ msgid "not mounted anything" #~ msgstr "No se ha montado nada" @@ -12927,8 +12542,7 @@ msgstr "No queda memoria al aumentar el tama #~ msgstr "mount: %s tiene un nmero principal o secundario incorrecto" #~ msgid "mount: block device %s is not permitted on its filesystem" -#~ msgstr "" -#~ "mount: dispositivo de bloques %s no permitido en este sistema de ficheros" +#~ msgstr "mount: dispositivo de bloques %s no permitido en este sistema de ficheros" #~ msgid "" #~ "Usage: mount [-hV]\n" @@ -12941,8 +12555,7 @@ msgstr "No queda memoria al aumentar el tama #~ " mount -a [-nfFrsvw] [-t vfstypes]\n" #~ " mount [-nfrsvw] [-o opciones] special | node\n" #~ " mount [-nfrsvw] [-t vfstype] [-o opciones] special node\n" -#~ " Un dispositivo especial puede indicarse mediante -L etiqueta o -U " -#~ "uuid\n" +#~ " Un dispositivo especial puede indicarse mediante -L etiqueta o -U uuid\n" #~ msgid "mount: %s:%s failed, reason given by server: %s\n" #~ msgstr "mount: %s:%s ha fallado; motivo indicado por servidor: %s\n" -- cgit v1.2.3 From 234bef3f5ece0ba77b2e8bcf32616061947f8cab Mon Sep 17 00:00:00 2001 From: Mikel Olasagasti Uranga Date: Mon, 7 Jun 2010 12:27:04 +0200 Subject: po: update eu.po (from translationproject.org) --- po/eu.po | 1534 +++++++++++++++++++++++++++++--------------------------------- 1 file changed, 705 insertions(+), 829 deletions(-) diff --git a/po/eu.po b/po/eu.po index a703be97..10dc7b4c 100644 --- a/po/eu.po +++ b/po/eu.po @@ -1,17 +1,17 @@ # Basque translation of util-linux-ng. -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2010 Free Software Foundation, Inc. # This file is distributed under the same license as the util-linux-ng package. -# Mikel Olasagasti Uranga , 2005, 2009. +# Mikel Olasagasti Uranga , 2005, 2009, 2010. # , fuzzy # # msgid "" msgstr "" -"Project-Id-Version: util-linux-ng 2.17-rc3\n" +"Project-Id-Version: util-linux-ng 2.17.1-rc1\n" "Report-Msgid-Bugs-To: Karel Zak \n" -"POT-Creation-Date: 2010-01-07 21:55+0100\n" -"PO-Revision-Date: 2009-12-11 20:02+0100\n" -"Last-Translator: Mikel Olasagasti \n" +"POT-Creation-Date: 2010-02-16 10:22+0100\n" +"PO-Revision-Date: 2010-02-16 19:58+0100\n" +"Last-Translator: Mikel Olasagasti Uranga \n" "Language-Team: Basque \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" @@ -163,7 +163,7 @@ msgstr "erabilera:\n" #: disk-utils/elvtune.c:53 #, c-format msgid "\tNOTE: elvtune only works with 2.4 kernels\n" -msgstr "" +msgstr "\tOHARRA: elvtune-k 2.4 kernel-ekin bakarrik funtzionatzen du\n" #: disk-utils/elvtune.c:104 #, fuzzy, c-format @@ -173,7 +173,7 @@ msgstr "crc errorea" #: disk-utils/elvtune.c:110 #, c-format msgid "missing blockdevice, use -h for help\n" -msgstr "" +msgstr "bloke-gailua falta da, erabili -h laguntzarako\n" #: disk-utils/elvtune.c:131 #, c-format @@ -491,7 +491,7 @@ msgstr " (libblkid gabe konpilatua). " #: disk-utils/fsck.minix.c:207 #, c-format msgid "Usage: %s [-larvsmf] /dev/name\n" -msgstr "" +msgstr "Erabilera: %s [-larvsmf] /dev/izena\n" #: disk-utils/fsck.minix.c:323 #, c-format @@ -895,7 +895,7 @@ msgstr "errorea: malloc-ek huts egin du" #: disk-utils/isosize.c:208 #, c-format msgid "Usage: %s [-x] [-d ] iso9660-image\n" -msgstr "" +msgstr "Erabilera: %s [-x] [-d ] iso9660-irudia\n" #: disk-utils/mkfs.bfs.c:83 #, c-format @@ -903,6 +903,8 @@ msgid "" "Usage: %s [-v] [-N nr-of-inodes] [-V volume-name]\n" " [-F fsname] device [block-count]\n" msgstr "" +"Erabilera: %s [-v] [-N inodo-kopurua] [-V bolumen-izena]\n" +" [-F fs-izena] gailua [bloke-kopurua]\n" #: disk-utils/mkfs.bfs.c:130 #, fuzzy @@ -922,7 +924,7 @@ msgstr "Ezin da '%s' (%s) raw moetako gailua aurkitu\n" #: disk-utils/mkfs.bfs.c:166 #, c-format msgid "%s is not a block special device" -msgstr "" +msgstr "%s ez da bloke gailu berezia" #: disk-utils/mkfs.bfs.c:171 sys-utils/ldattach.c:202 #, c-format @@ -937,36 +939,36 @@ msgstr "Ezin da diskoaren tamainua lortu" #: disk-utils/mkfs.bfs.c:187 #, c-format msgid "blocks argument too large, max is %llu" -msgstr "" +msgstr "bloke argumentu luzeegia, gehienezkoa %llu da" #: disk-utils/mkfs.bfs.c:202 msgid "too many inodes - max is 512" -msgstr "" +msgstr "inodo gehiegi - gehienezkoa 512 da" #: disk-utils/mkfs.bfs.c:211 #, c-format msgid "not enough space, need at least %llu blocks" -msgstr "" +msgstr "ez dago nahikoa leku, %llu bloke behar dira gutxienez" -#: disk-utils/mkfs.bfs.c:223 fdisk/fdisk.c:2580 +#: disk-utils/mkfs.bfs.c:223 fdisk/fdisk.c:2629 #, c-format msgid "Device: %s\n" msgstr "Gailua: %s\n" #: disk-utils/mkfs.bfs.c:224 -#, fuzzy, c-format +#, c-format msgid "Volume: <%-6s>\n" -msgstr "SGI volume" +msgstr "Bolumena: <%-6s>\n" #: disk-utils/mkfs.bfs.c:225 #, c-format msgid "FSname: <%-6s>\n" -msgstr "" +msgstr "FSizena: <%-6s>\n" #: disk-utils/mkfs.bfs.c:226 -#, fuzzy, c-format +#, c-format msgid "BlockSize: %d\n" -msgstr "lortu bloke-tamainua" +msgstr "Bloke tamaina: %d\n" #: disk-utils/mkfs.bfs.c:228 #, fuzzy, c-format @@ -976,12 +978,12 @@ msgstr "Markatu erabilia dagoela" #: disk-utils/mkfs.bfs.c:231 #, c-format msgid "Inodes: %d (in %lld blocks)\n" -msgstr "" +msgstr "Inodoak: %d (%lld blokeetan)\n" #: disk-utils/mkfs.bfs.c:233 -#, fuzzy, c-format +#, c-format msgid "Blocks: %lld\n" -msgstr "%ld bloke\n" +msgstr "Blokeak: %lld\n" #: disk-utils/mkfs.bfs.c:234 #, fuzzy, c-format @@ -989,14 +991,12 @@ msgid "Inode end: %d, Data end: %d\n" msgstr " e diskoaren data editatu" #: disk-utils/mkfs.bfs.c:239 -#, fuzzy msgid "error writing superblock" -msgstr "Disko etiketa idazten %s-(e)ri.\n" +msgstr "errorea superblokea idazten" #: disk-utils/mkfs.bfs.c:259 -#, fuzzy msgid "error writing root inode" -msgstr "erro inodoa ez da direktorioa" +msgstr "errorea erro inodoa idazten" #: disk-utils/mkfs.bfs.c:264 #, fuzzy @@ -1026,9 +1026,7 @@ msgstr "errorea %s itxitzerakoan" #: disk-utils/mkfs.c:73 #, c-format msgid "Usage: mkfs [-V] [-t fstype] [fs-options] device [size]\n" -msgstr "" -"Erabilera: mkfs [-V] [-t fitxategi sistema moeta] [fitxategi sistemaren " -"aukerak] gailua [tamainua]\n" +msgstr "Erabilera: mkfs [-V] [-t fitxategi sistema moeta] [fitxategi sistemaren aukerak] gailua [tamainua]\n" #: disk-utils/mkfs.c:88 disk-utils/mkfs.c:96 fdisk/cfdisk.c:353 #: getopt/getopt.c:86 getopt/getopt.c:96 login-utils/wall.c:246 @@ -1044,8 +1042,7 @@ msgstr "mkfs (%s)\n" #: disk-utils/mkfs.cramfs.c:126 #, c-format msgid "" -"usage: %s [-h] [-v] [-b blksize] [-e edition] [-N endian] [-i file] [-n " -"name] dirname outfile\n" +"usage: %s [-h] [-v] [-b blksize] [-e edition] [-N endian] [-i file] [-n name] dirname outfile\n" " -h print this help\n" " -v be verbose\n" " -E make all warnings errors (non-zero exit status)\n" @@ -1085,9 +1082,7 @@ msgstr "%6.2f%% (%+ld bytes)\t%s\n" #: disk-utils/mkfs.cramfs.c:853 #, c-format -msgid "" -"warning: guestimate of required size (upper bound) is %lldMB, but maximum " -"image size is %uMB. We might die prematurely.\n" +msgid "warning: guestimate of required size (upper bound) is %lldMB, but maximum image size is %uMB. We might die prematurely.\n" msgstr "" #: disk-utils/mkfs.cramfs.c:880 @@ -1131,7 +1126,7 @@ msgstr "ROM irudia" #: disk-utils/mkfs.cramfs.c:937 #, c-format msgid "ROM image write failed (%zd %zd)\n" -msgstr "" +msgstr "ROM irudia idazteak huts egin du (%zd %zd)\n" #: disk-utils/mkfs.cramfs.c:946 #, c-format @@ -1150,14 +1145,12 @@ msgstr "" #: disk-utils/mkfs.cramfs.c:957 #, c-format -msgid "" -"warning: uids truncated to %u bits. (This may be a security concern.)\n" +msgid "warning: uids truncated to %u bits. (This may be a security concern.)\n" msgstr "" #: disk-utils/mkfs.cramfs.c:962 #, c-format -msgid "" -"warning: gids truncated to %u bits. (This may be a security concern.)\n" +msgid "warning: gids truncated to %u bits. (This may be a security concern.)\n" msgstr "" #: disk-utils/mkfs.cramfs.c:967 @@ -1170,7 +1163,7 @@ msgstr "" #: disk-utils/mkfs.minix.c:154 #, c-format msgid "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n" -msgstr "" +msgstr "Erabilera: %s [-c | -l fitxategi-izena] [-nXX] [-iXX] /dev/izena [blokeak]\n" #: disk-utils/mkfs.minix.c:178 #, c-format @@ -1281,9 +1274,9 @@ msgid "unable to stat %s" msgstr "ezin dira bootbit sektoreak ezabatu" #: disk-utils/mkfs.minix.c:645 -#, fuzzy, c-format +#, c-format msgid "unable to open %s" -msgstr "ezin dira bootbit sektoreak ezabatu" +msgstr "ezin da %s ireki" #: disk-utils/mkfs.minix.c:650 #, c-format @@ -1344,9 +1337,7 @@ msgstr "uuid-rik ez\n" #: disk-utils/mkswap.c:283 #, c-format msgid "Usage: %s [-c] [-pPAGESZ] [-L label] [-U UUID] /dev/name [blocks]\n" -msgstr "" -"Erabilera: %s [-c] [-pORRITAMAINUA] [-L etiketa] [-U UUID] /dev/izena " -"[blokeak]\n" +msgstr "Erabilera: %s [-c] [-pORRITAMAINUA] [-L etiketa] [-U UUID] /dev/izena [blokeak]\n" #: disk-utils/mkswap.c:297 msgid "too many bad pages" @@ -1499,8 +1490,7 @@ msgstr "" #: disk-utils/raw.c:125 #, c-format -msgid "" -"Device '%s' is control raw dev (use raw where is greater than zero)\n" +msgid "Device '%s' is control raw dev (use raw where is greater than zero)\n" msgstr "" #: disk-utils/raw.c:145 @@ -1673,13 +1663,11 @@ msgid "enlarged logical partitions overlap" msgstr "partizio logikoak ez daude disko ordenean" #: fdisk/cfdisk.c:1003 -msgid "" -"!!!! Internal error creating logical drive with no extended partition !!!!" +msgid "!!!! Internal error creating logical drive with no extended partition !!!!" msgstr "" #: fdisk/cfdisk.c:1014 fdisk/cfdisk.c:1026 -msgid "" -"Cannot create logical drive here -- would create two extended partitions" +msgid "Cannot create logical drive here -- would create two extended partitions" msgstr "" #: fdisk/cfdisk.c:1168 @@ -1786,8 +1774,7 @@ msgid "Opened disk read-only - you have no permission to write" msgstr "" #: fdisk/cfdisk.c:1687 -msgid "" -"Warning!! Unsupported GPT (GUID Partition Table) detected. Use GNU Parted." +msgid "Warning!! Unsupported GPT (GUID Partition Table) detected. Use GNU Parted." msgstr "" #: fdisk/cfdisk.c:1706 @@ -1807,8 +1794,7 @@ msgid "Warning!! This may destroy data on your disk!" msgstr "" #: fdisk/cfdisk.c:1881 -msgid "" -"Are you sure you want to write the partition table to disk? (yes or no): " +msgid "Are you sure you want to write the partition table to disk? (yes or no): " msgstr "" #: fdisk/cfdisk.c:1887 @@ -1837,20 +1823,15 @@ msgid "Wrote partition table to disk" msgstr "Partizio taula diskoan idatzi da" #: fdisk/cfdisk.c:1926 -msgid "" -"Wrote partition table, but re-read table failed. Run partprobe(8), kpartx" -"(8) or reboot to update table." -msgstr "" -"Partizio taula idatzi da, baina taularen berirakurketak huts egin du. Saiatu " -"partprobe(8) edo kpartx(8)-rekin edo berrabiarazi sistema taula berritzeko." +msgid "Wrote partition table, but re-read table failed. Run partprobe(8), kpartx(8) or reboot to update table." +msgstr "Partizio taula idatzi da, baina taularen berirakurketak huts egin du. Saiatu partprobe(8) edo kpartx(8)-rekin edo berrabiarazi sistema taula berritzeko." #: fdisk/cfdisk.c:1936 msgid "No primary partitions are marked bootable. DOS MBR cannot boot this." msgstr "" #: fdisk/cfdisk.c:1938 -msgid "" -"More than one primary partition is marked bootable. DOS MBR cannot boot this." +msgid "More than one primary partition is marked bootable. DOS MBR cannot boot this." msgstr "" #: fdisk/cfdisk.c:1996 fdisk/cfdisk.c:2115 fdisk/cfdisk.c:2199 @@ -1892,12 +1873,12 @@ msgstr " Primarioa" msgid " Logical" msgstr " Logikoa" -#: fdisk/cfdisk.c:2089 fdisk/fdisk.c:1716 fdisk/fdisk.c:2050 -#: fdisk/fdisksgilabel.c:227 fdisk/fdisksunlabel.c:621 fdisk/sfdisk.c:638 +#: fdisk/cfdisk.c:2089 fdisk/fdisk.c:1761 fdisk/fdisk.c:2100 +#: fdisk/fdisksgilabel.c:227 fdisk/fdisksunlabel.c:616 fdisk/sfdisk.c:638 msgid "Unknown" msgstr "Ezezaguna" -#: fdisk/cfdisk.c:2095 fdisk/cfdisk.c:2563 fdisk/fdisksunlabel.c:44 +#: fdisk/cfdisk.c:2095 fdisk/cfdisk.c:2563 fdisk/fdisksunlabel.c:39 msgid "Boot" msgstr "Abio" @@ -1920,20 +1901,12 @@ msgid " First Last\n" msgstr " Lehena Azkena\n" #: fdisk/cfdisk.c:2137 -msgid "" -" # Type Sector Sector Offset Length Filesystem Type (ID) " -"Flag\n" -msgstr "" -" # Moeta Sekto. Sekto. Offset-a Luzeera Fitx. Sist. Moeta(ID) " -"Adierazlea\n" +msgid " # Type Sector Sector Offset Length Filesystem Type (ID) Flag\n" +msgstr " # Moeta Sekto. Sekto. Offset-a Luzeera Fitx. Sist. Moeta(ID) Adierazlea\n" #: fdisk/cfdisk.c:2138 -msgid "" -"-- ------- ----------- ----------- ------ ----------- -------------------- " -"----\n" -msgstr "" -"-- ------- ----------- ----------- ------ ----------- -------------------- " -"----\n" +msgid "-- ------- ----------- ----------- ------ ----------- -------------------- ----\n" +msgstr "-- ------- ----------- ----------- ------ ----------- -------------------- ----\n" #: fdisk/cfdisk.c:2221 msgid " ---Starting---- ----Ending----- Start Number of\n" @@ -1945,8 +1918,7 @@ msgstr " # Flags Head Sect Cyl ID Head Sect Cyl Sektorea Sektoreak\n" #: fdisk/cfdisk.c:2223 msgid "-- ----- ---- ---- ----- ---- ---- ---- ----- ----------- -----------\n" -msgstr "" -"-- ----- ---- ---- ----- ---- ---- ---- ----- ----------- -----------\n" +msgstr "-- ----- ---- ---- ----- ---- ---- ---- ----- ----------- -----------\n" #: fdisk/cfdisk.c:2256 msgid "Raw" @@ -1982,14 +1954,11 @@ msgstr "cfdisk-entzat laguntza pantaila" #: fdisk/cfdisk.c:2289 msgid "This is cfdisk, a curses based disk partitioning program, which" -msgstr "" -"Hau cfdisk da, curses-en oinarritutako disko partizionatze programa, non " -"honek" +msgstr "Hau cfdisk da, curses-en oinarritutako disko partizionatze programa, non honek" #: fdisk/cfdisk.c:2290 msgid "allows you to create, delete and modify partitions on your hard" -msgstr "" -"zure diskoetan partizioak sortu, ezabatu eta modifikatzeko aukera ematen dizu" +msgstr "zure diskoetan partizioak sortu, ezabatu eta modifikatzeko aukera ematen dizu" #: fdisk/cfdisk.c:2291 msgid "disk drive." @@ -2037,8 +2006,7 @@ msgstr " m Uneko partizioaren disko erabilera maximora handitu" #: fdisk/cfdisk.c:2304 msgid " Note: This may make the partition incompatible with" -msgstr "" -" Oharra: Honek DOS, OS/2 eta beste partizio moeta batzuekin" +msgstr " Oharra: Honek DOS, OS/2 eta beste partizio moeta batzuekin" #: fdisk/cfdisk.c:2305 msgid " DOS, OS/2, ..." @@ -2050,8 +2018,7 @@ msgstr " n Sortu partizio berria libre dagoen espaziotik" #: fdisk/cfdisk.c:2307 msgid " p Print partition table to the screen or to a file" -msgstr "" -" p Erakutsi partizio taula pantailan edo idatzi fitxategiren batean" +msgstr " p Erakutsi partizio taula pantailan edo idatzi fitxategiren batean" #: fdisk/cfdisk.c:2308 msgid " There are several different formats for the partition" @@ -2101,9 +2068,7 @@ msgstr " Honek diskoaren datu guztiak suntsitu ditzazkeenez" #: fdisk/cfdisk.c:2319 msgid " either confirm or deny the write by entering `yes' or" -msgstr "" -" konfirmazio bat eskatuko da hauetako aukera bat erabiliaz: " -"`yes' edo" +msgstr " konfirmazio bat eskatuko da hauetako aukera bat erabiliaz: `yes' edo" #: fdisk/cfdisk.c:2320 msgid " `no'" @@ -2133,7 +2098,7 @@ msgstr "Oharra: komando guztiak letra handiz edo txikiz sartu daitezke" msgid "case letters (except for Writes)." msgstr "letra xeheak (idazketetarako ezik)." -#: fdisk/cfdisk.c:2358 fdisk/fdisksunlabel.c:237 +#: fdisk/cfdisk.c:2358 fdisk/fdisksunlabel.c:232 msgid "Cylinders" msgstr "Zilindroak" @@ -2141,7 +2106,7 @@ msgstr "Zilindroak" msgid "Change cylinder geometry" msgstr "Aldatu zilindro geometria" -#: fdisk/cfdisk.c:2359 fdisk/fdisksunlabel.c:235 +#: fdisk/cfdisk.c:2359 fdisk/fdisksunlabel.c:230 msgid "Heads" msgstr "Buruak" @@ -2165,7 +2130,7 @@ msgstr "Geometria aldaketa egina" msgid "Enter the number of cylinders: " msgstr "Sartu zilindro kopurua:" -#: fdisk/cfdisk.c:2385 fdisk/cfdisk.c:2956 +#: fdisk/cfdisk.c:2385 fdisk/cfdisk.c:2958 msgid "Illegal cylinders value" msgstr "Baliogabeko zilindro baloreak" @@ -2173,7 +2138,7 @@ msgstr "Baliogabeko zilindro baloreak" msgid "Enter the number of heads: " msgstr "Sartu buru kopurua:" -#: fdisk/cfdisk.c:2398 fdisk/cfdisk.c:2966 +#: fdisk/cfdisk.c:2398 fdisk/cfdisk.c:2968 msgid "Illegal heads value" msgstr "Baliogabeok buru baloreak" @@ -2181,7 +2146,7 @@ msgstr "Baliogabeok buru baloreak" msgid "Enter the number of sectors per track: " msgstr "Sartu pistako zenbat sektore kopurua:" -#: fdisk/cfdisk.c:2411 fdisk/cfdisk.c:2973 +#: fdisk/cfdisk.c:2411 fdisk/cfdisk.c:2975 msgid "Illegal sectors value" msgstr "Baliogabeko sektore baloreak" @@ -2275,134 +2240,132 @@ msgstr " Tamainua (MB)" msgid " Size (GB)" msgstr " Tamainua (GB)" -#: fdisk/cfdisk.c:2747 +#: fdisk/cfdisk.c:2748 msgid "Bootable" msgstr "Abiogarria" -#: fdisk/cfdisk.c:2747 +#: fdisk/cfdisk.c:2748 msgid "Toggle bootable flag of the current partition" msgstr "Uneko partizioaren abiarazgarri adierazlea aldatu" -#: fdisk/cfdisk.c:2748 +#: fdisk/cfdisk.c:2749 msgid "Delete" msgstr "Ezabatu" -#: fdisk/cfdisk.c:2748 +#: fdisk/cfdisk.c:2749 msgid "Delete the current partition" msgstr "Ezabatu uneko partizioa" -#: fdisk/cfdisk.c:2749 +#: fdisk/cfdisk.c:2750 msgid "Geometry" msgstr "Geometria" -#: fdisk/cfdisk.c:2749 +#: fdisk/cfdisk.c:2750 msgid "Change disk geometry (experts only)" msgstr "Aldatu diskoaren geometria (erabiltzaile aurreratuak soilik)" -#: fdisk/cfdisk.c:2750 +#: fdisk/cfdisk.c:2751 msgid "Help" msgstr "Laguntza" -#: fdisk/cfdisk.c:2750 +#: fdisk/cfdisk.c:2751 msgid "Print help screen" msgstr "Inprimatu laguntza pantaila" -#: fdisk/cfdisk.c:2751 +#: fdisk/cfdisk.c:2752 msgid "Maximize" msgstr "Maximizatu" -#: fdisk/cfdisk.c:2751 +#: fdisk/cfdisk.c:2752 msgid "Maximize disk usage of the current partition (experts only)" -msgstr "" -"Uneko partizioaren disko erabilera maximora handitu (erabiltzaile " -"aurreratuak soilik)" +msgstr "Uneko partizioaren disko erabilera maximora handitu (erabiltzaile aurreratuak soilik)" -#: fdisk/cfdisk.c:2752 +#: fdisk/cfdisk.c:2753 msgid "New" msgstr "Berria" -#: fdisk/cfdisk.c:2752 +#: fdisk/cfdisk.c:2753 msgid "Create new partition from free space" msgstr "Sortu partizio berria libre dagoen espaziotik" -#: fdisk/cfdisk.c:2753 +#: fdisk/cfdisk.c:2754 msgid "Print" msgstr "Inprimatu" -#: fdisk/cfdisk.c:2753 +#: fdisk/cfdisk.c:2754 msgid "Print partition table to the screen or to a file" msgstr "Erakutsi partizio taula pantailan edo idatzi fitxategiren batean" -#: fdisk/cfdisk.c:2754 +#: fdisk/cfdisk.c:2755 msgid "Quit" msgstr "Irten" -#: fdisk/cfdisk.c:2754 +#: fdisk/cfdisk.c:2755 msgid "Quit program without writing partition table" msgstr "Irten programatik partizio taula idatzi gabe" -#: fdisk/cfdisk.c:2755 +#: fdisk/cfdisk.c:2756 msgid "Type" msgstr "Moeta" -#: fdisk/cfdisk.c:2755 +#: fdisk/cfdisk.c:2756 msgid "Change the filesystem type (DOS, Linux, OS/2 and so on)" msgstr "Aldatu fitxategi-sistema moeta (DOS, Linux, OS/2 eta abar)" -#: fdisk/cfdisk.c:2756 +#: fdisk/cfdisk.c:2757 msgid "Units" msgstr "Unitateak" -#: fdisk/cfdisk.c:2756 +#: fdisk/cfdisk.c:2757 msgid "Change units of the partition size display (MB, sect, cyl)" msgstr "Aldatu partizioaren tamainu unitateak (MB, sektoreak, zilindroak)" -#: fdisk/cfdisk.c:2757 +#: fdisk/cfdisk.c:2758 msgid "Write" msgstr "Idatzi" -#: fdisk/cfdisk.c:2757 +#: fdisk/cfdisk.c:2758 msgid "Write partition table to disk (this might destroy data)" msgstr "Idatzi partizio taula diskora (datu guztiak suntsitu ditzazke)" -#: fdisk/cfdisk.c:2803 +#: fdisk/cfdisk.c:2805 msgid "Cannot make this partition bootable" msgstr "Ezin da partizio hau abiagarria egin" -#: fdisk/cfdisk.c:2813 +#: fdisk/cfdisk.c:2815 msgid "Cannot delete an empty partition" msgstr "Ezin da partizu huts bat ezabatu" -#: fdisk/cfdisk.c:2833 fdisk/cfdisk.c:2835 +#: fdisk/cfdisk.c:2835 fdisk/cfdisk.c:2837 msgid "Cannot maximize this partition" msgstr "Ezin da partizio hau maximizatu" -#: fdisk/cfdisk.c:2843 +#: fdisk/cfdisk.c:2845 msgid "This partition is unusable" msgstr "Partizio hau ezin da erabili" -#: fdisk/cfdisk.c:2845 +#: fdisk/cfdisk.c:2847 msgid "This partition is already in use" msgstr "Partizio hau dagoeneko erabilita dago" -#: fdisk/cfdisk.c:2862 +#: fdisk/cfdisk.c:2864 msgid "Cannot change the type of an empty partition" msgstr "Ezin da hutsik dagoen partizio baten moeta aldatu" -#: fdisk/cfdisk.c:2889 fdisk/cfdisk.c:2895 +#: fdisk/cfdisk.c:2891 fdisk/cfdisk.c:2897 msgid "No more partitions" msgstr "Ez dago partizio gehiago" -#: fdisk/cfdisk.c:2902 +#: fdisk/cfdisk.c:2904 msgid "Illegal command" msgstr "Komando baliogabea" -#: fdisk/cfdisk.c:2912 +#: fdisk/cfdisk.c:2914 #, c-format msgid "Copyright (C) 1994-2002 Kevin E. Martin & aeb\n" msgstr "Copyright (C) 1994-2002 Kevin E. Martin & aeb\n" -#: fdisk/cfdisk.c:2919 +#: fdisk/cfdisk.c:2921 #, c-format msgid "" "\n" @@ -2462,9 +2425,9 @@ msgstr "" "\n" "BSD etiketa gailuarentzat: %s\n" -#: fdisk/fdiskbsdlabel.c:128 fdisk/fdisk.c:390 fdisk/fdisk.c:409 -#: fdisk/fdisk.c:427 fdisk/fdisk.c:434 fdisk/fdisk.c:457 fdisk/fdisk.c:475 -#: fdisk/fdisk.c:491 fdisk/fdisk.c:507 +#: fdisk/fdiskbsdlabel.c:128 fdisk/fdisk.c:394 fdisk/fdisk.c:413 +#: fdisk/fdisk.c:431 fdisk/fdisk.c:438 fdisk/fdisk.c:461 fdisk/fdisk.c:479 +#: fdisk/fdisk.c:495 fdisk/fdisk.c:511 msgid "Command action" msgstr "Komandoaren ekintza" @@ -2484,9 +2447,9 @@ msgstr " i instalatu hasierako sekuentzia" msgid " l list known filesystem types" msgstr " l zerrendatu ezagutzen diren fitxategi sistema moetak" -#: fdisk/fdiskbsdlabel.c:133 fdisk/fdisk.c:396 fdisk/fdisk.c:415 -#: fdisk/fdisk.c:428 fdisk/fdisk.c:440 fdisk/fdisk.c:465 fdisk/fdisk.c:482 -#: fdisk/fdisk.c:498 fdisk/fdisk.c:516 +#: fdisk/fdiskbsdlabel.c:133 fdisk/fdisk.c:400 fdisk/fdisk.c:419 +#: fdisk/fdisk.c:432 fdisk/fdisk.c:444 fdisk/fdisk.c:469 fdisk/fdisk.c:486 +#: fdisk/fdisk.c:502 fdisk/fdisk.c:520 msgid " m print this menu" msgstr " m menu hau erakutsi" @@ -2498,14 +2461,14 @@ msgstr " n BSD partizio berri bat gehitu" msgid " p print BSD partition table" msgstr " p BSD partizio taula erakutsi" -#: fdisk/fdiskbsdlabel.c:136 fdisk/fdisk.c:400 fdisk/fdisk.c:419 -#: fdisk/fdisk.c:430 fdisk/fdisk.c:444 fdisk/fdisk.c:467 fdisk/fdisk.c:484 -#: fdisk/fdisk.c:500 fdisk/fdisk.c:518 +#: fdisk/fdiskbsdlabel.c:136 fdisk/fdisk.c:404 fdisk/fdisk.c:423 +#: fdisk/fdisk.c:434 fdisk/fdisk.c:448 fdisk/fdisk.c:471 fdisk/fdisk.c:488 +#: fdisk/fdisk.c:504 fdisk/fdisk.c:522 msgid " q quit without saving changes" msgstr " q irten aldaketak gorde gabe" -#: fdisk/fdiskbsdlabel.c:137 fdisk/fdisk.c:468 fdisk/fdisk.c:485 -#: fdisk/fdisk.c:501 fdisk/fdisk.c:519 +#: fdisk/fdiskbsdlabel.c:137 fdisk/fdisk.c:472 fdisk/fdisk.c:489 +#: fdisk/fdisk.c:505 fdisk/fdisk.c:523 msgid " r return to main menu" msgstr " r menu nagusira itzuli" @@ -2548,13 +2511,13 @@ msgstr "Ez dago *BSD partiziorik %s-(e)n.\n" msgid "BSD disklabel command (m for help): " msgstr "BSD disko etiketa komandoa (m laguntza erakusteko):" -#: fdisk/fdiskbsdlabel.c:283 fdisk/fdisk.c:2272 fdisk/fdisksgilabel.c:638 -#: fdisk/fdisksunlabel.c:431 +#: fdisk/fdiskbsdlabel.c:283 fdisk/fdisk.c:2322 fdisk/fdisksgilabel.c:638 +#: fdisk/fdisksunlabel.c:426 #, c-format msgid "First %s" msgstr "Lehenengo %s" -#: fdisk/fdiskbsdlabel.c:290 fdisk/fdisksunlabel.c:488 +#: fdisk/fdiskbsdlabel.c:290 fdisk/fdisksunlabel.c:483 #, c-format msgid "Last %s or +size or +sizeM or +sizeK" msgstr "Azken %s-(e)a edo +tamainua edo +tamainuaM edo +tamainuaK" @@ -2699,7 +2662,7 @@ msgstr "sektoreak pistako" msgid "tracks/cylinder" msgstr "pistak zilindroko" -#: fdisk/fdiskbsdlabel.c:469 fdisk/fdisk.c:725 fdisk/fdisk.c:1541 +#: fdisk/fdiskbsdlabel.c:469 fdisk/fdisk.c:740 fdisk/fdisk.c:1586 #: fdisk/sfdisk.c:930 msgid "cylinders" msgstr "zilindroak" @@ -2762,10 +2725,10 @@ msgstr " disko guztian. " msgid "Partition (a-%c): " msgstr "berirakurri partizio taula" -#: fdisk/fdiskbsdlabel.c:617 fdisk/fdisk.c:2436 +#: fdisk/fdiskbsdlabel.c:617 fdisk/fdisk.c:2485 #, c-format msgid "The maximum number of partitions has been created\n" -msgstr "" +msgstr "Gehienezko partizio kopurua sortu da\n" #: fdisk/fdiskbsdlabel.c:629 #, fuzzy, c-format @@ -2775,7 +2738,7 @@ msgstr "Partizio hau dagoeneko erabilita dago" #: fdisk/fdiskbsdlabel.c:756 #, c-format msgid "Warning: too many partitions (%d, maximum is %d).\n" -msgstr "" +msgstr "Abisua: partizio gehiegi (%d, gehienezkoa %d da).\n" #: fdisk/fdiskbsdlabel.c:804 #, c-format @@ -2783,262 +2746,249 @@ msgid "" "\n" "Syncing disks.\n" msgstr "" +"\n" +"Diskak sinkronizatzen.\n" -#: fdisk/fdisk.c:248 -msgid "" -"Usage: fdisk [-b SSZ] [-u] DISK Change partition table\n" -" fdisk -l [-b SSZ] [-u] DISK List partition table(s)\n" -" fdisk -s PARTITION Give partition size(s) in blocks\n" -" fdisk -v Give fdisk version\n" -"Here DISK is something like /dev/hdb or /dev/sda\n" -"and PARTITION is something like /dev/hda7\n" -"-u: give Start and End in sector (instead of cylinder) units\n" -"-b 2048: (for certain MO disks) use 2048-byte sectors\n" -msgstr "" - -#: fdisk/fdisk.c:260 +#: fdisk/fdisk.c:256 msgid "" -"Usage: fdisk [-l] [-b SSZ] [-u] device\n" -"E.g.: fdisk /dev/hda (for the first IDE disk)\n" -" or: fdisk /dev/sdc (for the third SCSI disk)\n" -" or: fdisk /dev/eda (for the first PS/2 ESDI drive)\n" -" or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)\n" -" ...\n" +"Usage:\n" +" fdisk [options] change partition table\n" +" fdisk [options] -l list partition table(s)\n" +" fdisk -s give partition size(s) in blocks\n" +"\n" +"Options:\n" +" -b sector size (512, 1024, 2048 or 4096)\n" +" -c switch off DOS-compatible mode\n" +" -h print help\n" +" -u give sizes in sectors instead of cylinders\n" +" -v print version\n" +" -C specify the number of cylinders\n" +" -H specify the number of heads\n" +" -S specify the number of sectors per track\n" +"\n" msgstr "" -#: fdisk/fdisk.c:269 +#: fdisk/fdisk.c:273 #, fuzzy, c-format msgid "Unable to open %s\n" msgstr "ezin dira bootbit sektoreak ezabatu" -#: fdisk/fdisk.c:273 +#: fdisk/fdisk.c:277 #, fuzzy, c-format msgid "Unable to read %s\n" msgstr "ezin dira bootbit sektoreak ezabatu" -#: fdisk/fdisk.c:277 +#: fdisk/fdisk.c:281 #, fuzzy, c-format msgid "Unable to seek on %s\n" msgstr "Ezin da bilatu disko unitatean" -#: fdisk/fdisk.c:281 +#: fdisk/fdisk.c:285 #, fuzzy, c-format msgid "Unable to write %s\n" msgstr " w idatzi diskoaren etiketa diskoan" -#: fdisk/fdisk.c:285 +#: fdisk/fdisk.c:289 #, c-format msgid "BLKGETSIZE ioctl failed on %s\n" msgstr "" -#: fdisk/fdisk.c:289 +#: fdisk/fdisk.c:293 msgid "Unable to allocate any more memory\n" msgstr "" -#: fdisk/fdisk.c:292 +#: fdisk/fdisk.c:296 msgid "Fatal error\n" msgstr "Errore larria\n" -#: fdisk/fdisk.c:391 +#: fdisk/fdisk.c:395 #, fuzzy msgid " a toggle a read only flag" msgstr " b Uneko partizioari abiarazgarri adierazlea jarri edo kendu" -#: fdisk/fdisk.c:392 fdisk/fdisk.c:436 +#: fdisk/fdisk.c:396 fdisk/fdisk.c:440 #, fuzzy msgid " b edit bsd disklabel" msgstr "BSD disko etiketa komandoa (m laguntza erakusteko):" -#: fdisk/fdisk.c:393 +#: fdisk/fdisk.c:397 #, fuzzy msgid " c toggle the mountable flag" msgstr " b Uneko partizioari abiarazgarri adierazlea jarri edo kendu" -#: fdisk/fdisk.c:394 fdisk/fdisk.c:413 fdisk/fdisk.c:438 +#: fdisk/fdisk.c:398 fdisk/fdisk.c:417 fdisk/fdisk.c:442 #, fuzzy msgid " d delete a partition" msgstr " d Uneko partizioa ezabatu" -#: fdisk/fdisk.c:395 fdisk/fdisk.c:414 fdisk/fdisk.c:439 +#: fdisk/fdisk.c:399 fdisk/fdisk.c:418 fdisk/fdisk.c:443 #, fuzzy msgid " l list known partition types" msgstr " l zerrendatu ezagutzen diren fitxategi sistema moetak" -#: fdisk/fdisk.c:397 fdisk/fdisk.c:416 fdisk/fdisk.c:441 +#: fdisk/fdisk.c:401 fdisk/fdisk.c:420 fdisk/fdisk.c:445 #, fuzzy msgid " n add a new partition" msgstr " n BSD partizio berri bat gehitu" -#: fdisk/fdisk.c:398 fdisk/fdisk.c:417 fdisk/fdisk.c:429 fdisk/fdisk.c:442 +#: fdisk/fdisk.c:402 fdisk/fdisk.c:421 fdisk/fdisk.c:433 fdisk/fdisk.c:446 msgid " o create a new empty DOS partition table" msgstr "" -#: fdisk/fdisk.c:399 fdisk/fdisk.c:418 fdisk/fdisk.c:443 fdisk/fdisk.c:466 -#: fdisk/fdisk.c:483 fdisk/fdisk.c:499 fdisk/fdisk.c:517 +#: fdisk/fdisk.c:403 fdisk/fdisk.c:422 fdisk/fdisk.c:447 fdisk/fdisk.c:470 +#: fdisk/fdisk.c:487 fdisk/fdisk.c:503 fdisk/fdisk.c:521 #, fuzzy msgid " p print the partition table" msgstr "Soilik partizio taula inprimatu" -#: fdisk/fdisk.c:401 fdisk/fdisk.c:420 fdisk/fdisk.c:431 fdisk/fdisk.c:445 +#: fdisk/fdisk.c:405 fdisk/fdisk.c:424 fdisk/fdisk.c:435 fdisk/fdisk.c:449 msgid " s create a new empty Sun disklabel" msgstr "" -#: fdisk/fdisk.c:402 fdisk/fdisk.c:421 fdisk/fdisk.c:446 +#: fdisk/fdisk.c:406 fdisk/fdisk.c:425 fdisk/fdisk.c:450 #, fuzzy msgid " t change a partition's system id" msgstr " t aldatu paritzioaren fitxategi sistema IDa" -#: fdisk/fdisk.c:403 fdisk/fdisk.c:422 fdisk/fdisk.c:447 +#: fdisk/fdisk.c:407 fdisk/fdisk.c:426 fdisk/fdisk.c:451 #, fuzzy msgid " u change display/entry units" msgstr " u Aldatu erakusten den partizioaren tamainu unitatea" -#: fdisk/fdisk.c:404 fdisk/fdisk.c:423 fdisk/fdisk.c:448 fdisk/fdisk.c:470 -#: fdisk/fdisk.c:487 fdisk/fdisk.c:503 fdisk/fdisk.c:521 +#: fdisk/fdisk.c:408 fdisk/fdisk.c:427 fdisk/fdisk.c:452 fdisk/fdisk.c:474 +#: fdisk/fdisk.c:491 fdisk/fdisk.c:507 fdisk/fdisk.c:525 #, fuzzy msgid " v verify the partition table" msgstr "berirakurri partizio taula" -#: fdisk/fdisk.c:405 fdisk/fdisk.c:424 fdisk/fdisk.c:449 fdisk/fdisk.c:471 -#: fdisk/fdisk.c:488 fdisk/fdisk.c:504 fdisk/fdisk.c:522 +#: fdisk/fdisk.c:409 fdisk/fdisk.c:428 fdisk/fdisk.c:453 fdisk/fdisk.c:475 +#: fdisk/fdisk.c:492 fdisk/fdisk.c:508 fdisk/fdisk.c:526 msgid " w write table to disk and exit" msgstr "" -#: fdisk/fdisk.c:406 fdisk/fdisk.c:450 +#: fdisk/fdisk.c:410 fdisk/fdisk.c:454 #, fuzzy msgid " x extra functionality (experts only)" msgstr "Aldatu diskoaren geometria (erabiltzaile aurreratuak soilik)" -#: fdisk/fdisk.c:410 +#: fdisk/fdisk.c:414 #, fuzzy msgid " a select bootable partition" msgstr " b Uneko partizioari abiarazgarri adierazlea jarri edo kendu" -#: fdisk/fdisk.c:411 +#: fdisk/fdisk.c:415 #, fuzzy msgid " b edit bootfile entry" msgstr " e diskoaren data editatu" -#: fdisk/fdisk.c:412 +#: fdisk/fdisk.c:416 #, fuzzy msgid " c select sgi swap partition" msgstr "" "\n" "Ez da swap partiziorik existitzen.\n" -#: fdisk/fdisk.c:435 +#: fdisk/fdisk.c:439 #, fuzzy msgid " a toggle a bootable flag" msgstr " b Uneko partizioari abiarazgarri adierazlea jarri edo kendu" -#: fdisk/fdisk.c:437 +#: fdisk/fdisk.c:441 #, fuzzy msgid " c toggle the dos compatibility flag" msgstr " b Uneko partizioari abiarazgarri adierazlea jarri edo kendu" -#: fdisk/fdisk.c:458 +#: fdisk/fdisk.c:462 #, fuzzy msgid " a change number of alternate cylinders" msgstr " u aldatu unitateak (zilindroak/sektoreak)" -#: fdisk/fdisk.c:459 fdisk/fdisk.c:477 fdisk/fdisk.c:493 fdisk/fdisk.c:509 +#: fdisk/fdisk.c:463 fdisk/fdisk.c:481 fdisk/fdisk.c:497 fdisk/fdisk.c:513 #, fuzzy msgid " c change number of cylinders" msgstr "Sartu zilindro kopurua:" -#: fdisk/fdisk.c:460 fdisk/fdisk.c:478 fdisk/fdisk.c:494 fdisk/fdisk.c:510 +#: fdisk/fdisk.c:464 fdisk/fdisk.c:482 fdisk/fdisk.c:498 fdisk/fdisk.c:514 #, fuzzy msgid " d print the raw data in the partition table" msgstr "Inprimatu taula raw datu formatua erabiliz" -#: fdisk/fdisk.c:461 +#: fdisk/fdisk.c:465 msgid " e change number of extra sectors per cylinder" msgstr "" -#: fdisk/fdisk.c:462 fdisk/fdisk.c:481 fdisk/fdisk.c:497 fdisk/fdisk.c:514 +#: fdisk/fdisk.c:466 fdisk/fdisk.c:485 fdisk/fdisk.c:501 fdisk/fdisk.c:518 #, fuzzy msgid " h change number of heads" msgstr "Sartu buru kopurua:" -#: fdisk/fdisk.c:463 +#: fdisk/fdisk.c:467 #, fuzzy msgid " i change interleave factor" msgstr " t Aldatu fitxategi sistema moeta" -#: fdisk/fdisk.c:464 +#: fdisk/fdisk.c:468 msgid " o change rotation speed (rpm)" msgstr "" -#: fdisk/fdisk.c:469 fdisk/fdisk.c:486 fdisk/fdisk.c:502 fdisk/fdisk.c:520 +#: fdisk/fdisk.c:473 fdisk/fdisk.c:490 fdisk/fdisk.c:506 fdisk/fdisk.c:524 #, fuzzy msgid " s change number of sectors/track" msgstr "Sartu pistako zenbat sektore kopurua:" -#: fdisk/fdisk.c:472 +#: fdisk/fdisk.c:476 #, fuzzy msgid " y change number of physical cylinders" msgstr " u aldatu unitateak (zilindroak/sektoreak)" -#: fdisk/fdisk.c:476 fdisk/fdisk.c:492 fdisk/fdisk.c:508 +#: fdisk/fdisk.c:480 fdisk/fdisk.c:496 fdisk/fdisk.c:512 msgid " b move beginning of data in a partition" msgstr "" -#: fdisk/fdisk.c:479 fdisk/fdisk.c:495 fdisk/fdisk.c:511 +#: fdisk/fdisk.c:483 fdisk/fdisk.c:499 fdisk/fdisk.c:515 #, fuzzy msgid " e list extended partitions" msgstr "Partizio gehiegi" -#: fdisk/fdisk.c:480 fdisk/fdisk.c:496 fdisk/fdisk.c:513 +#: fdisk/fdisk.c:484 fdisk/fdisk.c:500 fdisk/fdisk.c:517 msgid " g create an IRIX (SGI) partition table" msgstr "" -#: fdisk/fdisk.c:512 +#: fdisk/fdisk.c:516 #, fuzzy msgid " f fix partition order" msgstr "berirakurri partizio taula" -#: fdisk/fdisk.c:515 +#: fdisk/fdisk.c:519 #, fuzzy msgid " i change the disk identifier" msgstr "Aldatu diskoaren geometria (erabiltzaile aurreratuak soilik)" -#: fdisk/fdisk.c:631 +#: fdisk/fdisk.c:635 #, c-format msgid "You must set" msgstr "Ezarri egin behar duzu" -#: fdisk/fdisk.c:721 +#: fdisk/fdisk.c:736 msgid "heads" msgstr "buruak" -#: fdisk/fdisk.c:723 fdisk/fdisk.c:1541 fdisk/sfdisk.c:930 +#: fdisk/fdisk.c:738 fdisk/fdisk.c:1586 fdisk/sfdisk.c:930 msgid "sectors" msgstr "sektoreak" -#: fdisk/fdisk.c:729 +#: fdisk/fdisk.c:744 #, c-format msgid "" "%s%s.\n" "You can do this from the extra functions menu.\n" msgstr "" -#: fdisk/fdisk.c:730 +#: fdisk/fdisk.c:745 msgid " and " msgstr " eta " -#: fdisk/fdisk.c:747 -#, c-format -msgid "" -"\n" -"The number of cylinders for this disk is set to %d.\n" -"There is nothing wrong with that, but this is larger than 1024,\n" -"and could in certain setups cause problems with:\n" -"1) software that runs at boot time (e.g., old versions of LILO)\n" -"2) booting and partitioning software from other OSs\n" -" (e.g., DOS FDISK, OS/2 FDISK)\n" -msgstr "" - -#: fdisk/fdisk.c:763 +#: fdisk/fdisk.c:765 #, c-format msgid "" "\n" @@ -3049,70 +2999,76 @@ msgid "" "\n" msgstr "" -#: fdisk/fdisk.c:780 +#: fdisk/fdisk.c:783 #, c-format msgid "" "\n" "The device presents a logical sector size that is smaller than\n" -"the physical sector size. Aligning to a physical sector boundary\n" -"is recommended, or performance may be impacted.\n" -"\n" +"the physical sector size. Aligning to a physical sector (or optimal\n" +"I/O) size boundary is recommended, or performance may be impacted.\n" msgstr "" -#: fdisk/fdisk.c:792 +#: fdisk/fdisk.c:789 #, c-format msgid "" -"WARNING: The device does not provide compensation (alignment_offset)\n" -"for DOS-compatible partitioning, but DOS-compatible mode is enabled.\n" -"Use command 'c' to switch-off DOS mode.\n" "\n" +"WARNING: DOS-compatible mode is deprecated. It's strongly recommended to\n" +" switch off the mode (command 'c')" msgstr "" -#: fdisk/fdisk.c:798 +#: fdisk/fdisk.c:794 +#, c-format +msgid "" +" and change display units to\n" +" sectors (command 'u').\n" +msgstr "" + +#: fdisk/fdisk.c:800 #, c-format msgid "" -"It's recommended to change display units to sectors (command 'u').\n" "\n" +"WARNING: cylinders as display units are deprecated. Use command 'u' to\n" +" change units to sectors.\n" msgstr "" -#: fdisk/fdisk.c:815 +#: fdisk/fdisk.c:819 #, c-format msgid "Bad offset in primary extended partition\n" msgstr "" -#: fdisk/fdisk.c:829 +#: fdisk/fdisk.c:833 #, c-format msgid "" "Warning: omitting partitions after #%d.\n" "They will be deleted if you save this partition table.\n" msgstr "" -#: fdisk/fdisk.c:848 +#: fdisk/fdisk.c:852 #, c-format msgid "Warning: extra link pointer in partition table %d\n" msgstr "" -#: fdisk/fdisk.c:856 +#: fdisk/fdisk.c:860 #, c-format msgid "Warning: ignoring extra data in partition table %d\n" msgstr "" -#: fdisk/fdisk.c:889 +#: fdisk/fdisk.c:893 #, fuzzy, c-format msgid "omitting empty partition (%d)\n" msgstr "Ezin da partizu huts bat ezabatu" -#: fdisk/fdisk.c:908 +#: fdisk/fdisk.c:912 #, c-format msgid "Disk identifier: 0x%08x\n" -msgstr "" +msgstr "Disko identifikatzailea: 0x%08x\n" -#: fdisk/fdisk.c:917 +#: fdisk/fdisk.c:921 #, c-format msgid "New disk identifier (current 0x%08x): " msgstr "" -#: fdisk/fdisk.c:936 +#: fdisk/fdisk.c:940 #, c-format msgid "" "Building a new DOS disklabel with disk identifier 0x%08x.\n" @@ -3121,154 +3077,141 @@ msgid "" "\n" msgstr "" -#: fdisk/fdisk.c:987 +#: fdisk/fdisk.c:1010 #, c-format msgid "Note: sector size is %d (not %d)\n" msgstr "" -#: fdisk/fdisk.c:1051 -#, c-format -msgid "" -"\n" -"WARNING: the device provides alignment_offset, but the offset does not\n" -"match with device geometry.\n" -"\n" -msgstr "" - -#: fdisk/fdisk.c:1162 +#: fdisk/fdisk.c:1208 #, c-format msgid "You will not be able to write the partition table.\n" msgstr "" -#: fdisk/fdisk.c:1194 +#: fdisk/fdisk.c:1240 #, c-format msgid "" "This disk has both DOS and BSD magic.\n" "Give the 'b' command to go to BSD mode.\n" msgstr "" -#: fdisk/fdisk.c:1204 +#: fdisk/fdisk.c:1250 #, c-format -msgid "" -"Device contains neither a valid DOS partition table, nor Sun, SGI or OSF " -"disklabel\n" +msgid "Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel\n" msgstr "" -#: fdisk/fdisk.c:1221 +#: fdisk/fdisk.c:1267 #, c-format msgid "Internal error\n" msgstr "Barne errorea\n" -#: fdisk/fdisk.c:1231 +#: fdisk/fdisk.c:1277 #, c-format msgid "Ignoring extra extended partition %d\n" msgstr "" -#: fdisk/fdisk.c:1243 +#: fdisk/fdisk.c:1289 #, c-format -msgid "" -"Warning: invalid flag 0x%04x of partition table %d will be corrected by w" -"(rite)\n" +msgid "Warning: invalid flag 0x%04x of partition table %d will be corrected by w(rite)\n" msgstr "" -#: fdisk/fdisk.c:1270 +#: fdisk/fdisk.c:1315 #, c-format msgid "" "\n" "got EOF thrice - exiting..\n" msgstr "" -#: fdisk/fdisk.c:1309 +#: fdisk/fdisk.c:1354 msgid "Hex code (type L to list codes): " -msgstr "" +msgstr "Kode hexadezimala (sakatu L kodeak zerrendatzeko): " -#: fdisk/fdisk.c:1342 +#: fdisk/fdisk.c:1387 #, c-format msgid "%s (%u-%u, default %u): " msgstr "" -#: fdisk/fdisk.c:1409 +#: fdisk/fdisk.c:1454 #, fuzzy, c-format msgid "Unsupported suffix: '%s'.\n" msgstr "fitxategi sistemaren euskarririk gabeko ezaugarriak" -#: fdisk/fdisk.c:1410 +#: fdisk/fdisk.c:1455 #, c-format msgid "" "Supported: 10^N: KB (KiloByte), MB (MegaByte), GB (GigaByte)\n" " 2^N: K (KibiByte), M (MebiByte), G (GibiByte)\n" msgstr "" -#: fdisk/fdisk.c:1438 +#: fdisk/fdisk.c:1483 #, fuzzy, c-format msgid "Using default value %u\n" msgstr "Baliogabeko zilindro baloreak" -#: fdisk/fdisk.c:1442 +#: fdisk/fdisk.c:1487 #, fuzzy, c-format msgid "Value out of range.\n" msgstr "memoriatik kanpo" -#: fdisk/fdisk.c:1467 +#: fdisk/fdisk.c:1512 msgid "Partition number" msgstr "Partizio zenbakia" -#: fdisk/fdisk.c:1478 +#: fdisk/fdisk.c:1523 #, fuzzy, c-format msgid "Warning: partition %d has empty type\n" msgstr "Ezin da hutsik dagoen partizio baten moeta aldatu" -#: fdisk/fdisk.c:1500 fdisk/fdisk.c:1526 +#: fdisk/fdisk.c:1545 fdisk/fdisk.c:1571 #, fuzzy, c-format msgid "Selected partition %d\n" msgstr "berirakurri partizio taula" -#: fdisk/fdisk.c:1503 +#: fdisk/fdisk.c:1548 #, fuzzy, c-format msgid "No partition is defined yet!\n" msgstr "Ez dago *BSD partiziorik %s-(e)n.\n" -#: fdisk/fdisk.c:1529 +#: fdisk/fdisk.c:1574 #, c-format msgid "All primary partitions have been defined already!\n" msgstr "" -#: fdisk/fdisk.c:1539 +#: fdisk/fdisk.c:1584 msgid "cylinder" msgstr "zilindroa" -#: fdisk/fdisk.c:1539 +#: fdisk/fdisk.c:1584 msgid "sector" msgstr "sektorea" -#: fdisk/fdisk.c:1548 +#: fdisk/fdisk.c:1593 #, c-format msgid "Changing display/entry units to %s\n" msgstr "" -#: fdisk/fdisk.c:1559 +#: fdisk/fdisk.c:1604 #, fuzzy, c-format msgid "WARNING: Partition %d is an extended partition\n" msgstr "Partizio hau ezin da erabili" -#: fdisk/fdisk.c:1569 +#: fdisk/fdisk.c:1614 #, c-format msgid "DOS Compatibility flag is set\n" -msgstr "" +msgstr "DOS bateragarritasun marka ezarrita dago\n" -#: fdisk/fdisk.c:1571 +#: fdisk/fdisk.c:1616 #, c-format msgid "DOS Compatibility flag is not set\n" -msgstr "" +msgstr "DOS bateragarritasun marka ez dago ezarrita\n" -#: fdisk/fdisk.c:1672 +#: fdisk/fdisk.c:1717 #, fuzzy, c-format msgid "Partition %d does not exist yet!\n" msgstr "" "\n" "Ez da swap partiziorik existitzen.\n" -#: fdisk/fdisk.c:1677 +#: fdisk/fdisk.c:1722 #, c-format msgid "" "Type 0 means free space to many systems\n" @@ -3277,14 +3220,14 @@ msgid "" "a partition using the `d' command.\n" msgstr "" -#: fdisk/fdisk.c:1686 +#: fdisk/fdisk.c:1731 #, c-format msgid "" "You cannot change a partition into an extended one or vice versa\n" "Delete it first.\n" msgstr "" -#: fdisk/fdisk.c:1695 +#: fdisk/fdisk.c:1740 #, c-format msgid "" "Consider leaving partition 3 as Whole disk (5),\n" @@ -3292,7 +3235,7 @@ msgid "" "\n" msgstr "" -#: fdisk/fdisk.c:1701 +#: fdisk/fdisk.c:1746 #, c-format msgid "" "Consider leaving partition 9 as volume header (0),\n" @@ -3300,113 +3243,118 @@ msgid "" "\n" msgstr "" -#: fdisk/fdisk.c:1718 +#: fdisk/fdisk.c:1763 #, c-format msgid "Changed system type of partition %d to %x (%s)\n" msgstr "" -#: fdisk/fdisk.c:1721 +#: fdisk/fdisk.c:1766 #, c-format msgid "System type of partition %d is unchanged: %x (%s)\n" msgstr "" -#: fdisk/fdisk.c:1773 +#: fdisk/fdisk.c:1821 #, c-format msgid "Partition %d has different physical/logical beginnings (non-Linux?):\n" msgstr "" -#: fdisk/fdisk.c:1775 fdisk/fdisk.c:1783 fdisk/fdisk.c:1792 fdisk/fdisk.c:1802 +#: fdisk/fdisk.c:1823 fdisk/fdisk.c:1831 fdisk/fdisk.c:1840 fdisk/fdisk.c:1850 #, c-format msgid " phys=(%d, %d, %d) " -msgstr "" +msgstr " phys=(%d, %d, %d) " -#: fdisk/fdisk.c:1776 fdisk/fdisk.c:1784 +#: fdisk/fdisk.c:1824 fdisk/fdisk.c:1832 #, c-format msgid "logical=(%d, %d, %d)\n" msgstr "logikoa=(%d, %d, %d)\n" -#: fdisk/fdisk.c:1781 +#: fdisk/fdisk.c:1829 #, c-format msgid "Partition %d has different physical/logical endings:\n" msgstr "" -#: fdisk/fdisk.c:1790 +#: fdisk/fdisk.c:1838 #, c-format msgid "Partition %i does not start on cylinder boundary:\n" msgstr "" -#: fdisk/fdisk.c:1793 +#: fdisk/fdisk.c:1841 #, c-format msgid "should be (%d, %d, 1)\n" msgstr "" -#: fdisk/fdisk.c:1799 +#: fdisk/fdisk.c:1847 #, c-format msgid "Partition %i does not end on cylinder boundary.\n" msgstr "" -#: fdisk/fdisk.c:1803 +#: fdisk/fdisk.c:1851 #, c-format msgid "should be (%d, %d, %d)\n" msgstr "" -#: fdisk/fdisk.c:1813 -#, c-format -msgid "Partition %i does not start on physical block boundary.\n" -msgstr "" +#: fdisk/fdisk.c:1861 +#, fuzzy, c-format +msgid "Partition %i does not start on physical sector boundary.\n" +msgstr "%s partizioak hasierako 0 sektore baliogabea dauka.\n" -#: fdisk/fdisk.c:1823 +#: fdisk/fdisk.c:1871 #, c-format msgid "" "\n" "Disk %s: %ld MB, %lld bytes\n" msgstr "" -#: fdisk/fdisk.c:1827 +#: fdisk/fdisk.c:1875 #, c-format msgid "" "\n" "Disk %s: %ld.%ld GB, %lld bytes\n" msgstr "" -#: fdisk/fdisk.c:1830 +#: fdisk/fdisk.c:1878 #, c-format msgid "%d heads, %llu sectors/track, %d cylinders" msgstr "%d buru, %llu sektore pistako, %d zilindro" -#: fdisk/fdisk.c:1833 +#: fdisk/fdisk.c:1881 #, c-format msgid ", total %llu sectors" msgstr ", guztira %llu sektore" -#: fdisk/fdisk.c:1836 +#: fdisk/fdisk.c:1884 #, c-format msgid "Units = %s of %d * %d = %d bytes\n" msgstr "Unitateak: %s %d-(e)tik * %d = %d byte\n" -#: fdisk/fdisk.c:1840 +#: fdisk/fdisk.c:1888 #, c-format msgid "Sector size (logical/physical): %u bytes / %lu bytes\n" msgstr "" -#: fdisk/fdisk.c:1843 +#: fdisk/fdisk.c:1890 +#, c-format +msgid "I/O size (minimum/optimal): %lu bytes / %lu bytes\n" +msgstr "" + +#: fdisk/fdisk.c:1893 #, c-format msgid "Alignment offset: %lu bytes\n" msgstr "" -#: fdisk/fdisk.c:1952 +#: fdisk/fdisk.c:2002 #, c-format msgid "" "Nothing to do. Ordering is correct already.\n" "\n" msgstr "" -#: fdisk/fdisk.c:1980 +#: fdisk/fdisk.c:2030 #, c-format msgid "Done.\n" msgstr "Eginda.\n" -#: fdisk/fdisk.c:2008 +#: fdisk/fdisk.c:2058 #, c-format msgid "" "This doesn't look like a partition table\n" @@ -3414,23 +3362,23 @@ msgid "" "\n" msgstr "" -#: fdisk/fdisk.c:2021 +#: fdisk/fdisk.c:2071 #, c-format msgid "%*s Boot Start End Blocks Id System\n" msgstr "" -#: fdisk/fdisk.c:2022 fdisk/fdisksgilabel.c:210 fdisk/fdisksunlabel.c:603 +#: fdisk/fdisk.c:2072 fdisk/fdisksgilabel.c:210 fdisk/fdisksunlabel.c:598 msgid "Device" msgstr "Gailua" -#: fdisk/fdisk.c:2060 +#: fdisk/fdisk.c:2110 #, c-format msgid "" "\n" "Partition table entries are not in disk order\n" msgstr "" -#: fdisk/fdisk.c:2070 +#: fdisk/fdisk.c:2120 #, c-format msgid "" "\n" @@ -3441,87 +3389,87 @@ msgstr "" "%s diskoa: %d buru, %llu sektore, %d zilindro\n" "\n" -#: fdisk/fdisk.c:2072 +#: fdisk/fdisk.c:2122 #, c-format msgid "Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n" msgstr "" -#: fdisk/fdisk.c:2120 +#: fdisk/fdisk.c:2170 #, fuzzy, c-format msgid "Warning: partition %d contains sector 0\n" msgstr "Partizioa 0 sektorea baina lehenago hasten da" -#: fdisk/fdisk.c:2123 +#: fdisk/fdisk.c:2173 #, c-format msgid "Partition %d: head %d greater than maximum %d\n" msgstr "" -#: fdisk/fdisk.c:2126 +#: fdisk/fdisk.c:2176 #, c-format msgid "Partition %d: sector %d greater than maximum %llu\n" msgstr "" -#: fdisk/fdisk.c:2129 +#: fdisk/fdisk.c:2179 #, c-format msgid "Partitions %d: cylinder %d greater than maximum %d\n" msgstr "" -#: fdisk/fdisk.c:2133 +#: fdisk/fdisk.c:2183 #, c-format msgid "Partition %d: previous sectors %d disagrees with total %d\n" msgstr "" -#: fdisk/fdisk.c:2167 +#: fdisk/fdisk.c:2217 #, c-format msgid "Warning: bad start-of-data in partition %d\n" msgstr "" -#: fdisk/fdisk.c:2175 +#: fdisk/fdisk.c:2225 #, fuzzy, c-format msgid "Warning: partition %d overlaps partition %d.\n" msgstr "berirakurri partizio taula" -#: fdisk/fdisk.c:2195 +#: fdisk/fdisk.c:2245 #, fuzzy, c-format msgid "Warning: partition %d is empty\n" msgstr "Ezin da partizu huts bat ezabatu" -#: fdisk/fdisk.c:2200 +#: fdisk/fdisk.c:2250 #, fuzzy, c-format msgid "Logical partition %d not entirely in partition %d\n" msgstr "partizio logikoak ez daude disko ordenean" -#: fdisk/fdisk.c:2206 +#: fdisk/fdisk.c:2256 #, c-format msgid "Total allocated sectors %llu greater than the maximum %llu\n" msgstr "" -#: fdisk/fdisk.c:2209 +#: fdisk/fdisk.c:2259 #, c-format msgid "Remaining %lld unallocated %d-byte sectors\n" msgstr "" -#: fdisk/fdisk.c:2245 fdisk/fdisksgilabel.c:620 fdisk/fdisksunlabel.c:416 +#: fdisk/fdisk.c:2295 fdisk/fdisksgilabel.c:620 fdisk/fdisksunlabel.c:411 #, c-format msgid "Partition %d is already defined. Delete it before re-adding it.\n" msgstr "" -#: fdisk/fdisk.c:2291 +#: fdisk/fdisk.c:2340 #, c-format msgid "Sector %llu is already allocated\n" msgstr "" -#: fdisk/fdisk.c:2327 +#: fdisk/fdisk.c:2376 #, c-format msgid "No free sectors available\n" msgstr "" -#: fdisk/fdisk.c:2338 +#: fdisk/fdisk.c:2387 #, fuzzy, c-format msgid "Last %1$s, +%2$s or +size{K,M,G}" msgstr "Azken %s-(e)a edo +tamainua edo +tamainuaM edo +tamainuaK" -#: fdisk/fdisk.c:2415 +#: fdisk/fdisk.c:2464 #, c-format msgid "" "\tSorry - this fdisk cannot handle AIX disk labels.\n" @@ -3530,7 +3478,7 @@ msgid "" "\tWARNING: This will destroy the present disk contents.\n" msgstr "" -#: fdisk/fdisk.c:2424 +#: fdisk/fdisk.c:2473 #, c-format msgid "" "\tSorry - this fdisk cannot handle Mac disk labels.\n" @@ -3539,22 +3487,22 @@ msgid "" "\tWARNING: This will destroy the present disk contents.\n" msgstr "" -#: fdisk/fdisk.c:2444 +#: fdisk/fdisk.c:2493 #, c-format msgid "You must delete some partition and add an extended partition first\n" msgstr "" -#: fdisk/fdisk.c:2447 +#: fdisk/fdisk.c:2496 #, c-format msgid "All logical partitions are in use\n" msgstr "" -#: fdisk/fdisk.c:2448 +#: fdisk/fdisk.c:2497 #, fuzzy, c-format msgid "Adding a primary partition\n" msgstr "Partizio primario txarra" -#: fdisk/fdisk.c:2453 +#: fdisk/fdisk.c:2502 #, fuzzy, c-format msgid "" "Command action\n" @@ -3562,34 +3510,34 @@ msgid "" " p primary partition (1-4)\n" msgstr "Sortu partizio primario berri bat" -#: fdisk/fdisk.c:2455 +#: fdisk/fdisk.c:2504 #, fuzzy msgid "l logical (5 or over)" msgstr "partizio logikoen teilakapena" -#: fdisk/fdisk.c:2455 +#: fdisk/fdisk.c:2504 #, fuzzy msgid "e extended" msgstr "Linux extended" -#: fdisk/fdisk.c:2474 +#: fdisk/fdisk.c:2523 #, c-format msgid "Invalid partition number for type `%c'\n" msgstr "" -#: fdisk/fdisk.c:2510 +#: fdisk/fdisk.c:2559 #, c-format msgid "" "The partition table has been altered!\n" "\n" msgstr "" -#: fdisk/fdisk.c:2523 +#: fdisk/fdisk.c:2572 #, c-format msgid "Calling ioctl() to re-read partition table.\n" msgstr "" -#: fdisk/fdisk.c:2532 +#: fdisk/fdisk.c:2581 #, c-format msgid "" "\n" @@ -3598,7 +3546,7 @@ msgid "" "the next reboot or after you run partprobe(8) or kpartx(8)\n" msgstr "" -#: fdisk/fdisk.c:2540 +#: fdisk/fdisk.c:2589 #, c-format msgid "" "\n" @@ -3607,119 +3555,118 @@ msgid "" "information.\n" msgstr "" -#: fdisk/fdisk.c:2546 +#: fdisk/fdisk.c:2595 #, fuzzy, c-format msgid "" "\n" "Error closing file\n" msgstr "Ezin da '%s' fitxategia ireki" -#: fdisk/fdisk.c:2550 +#: fdisk/fdisk.c:2599 #, c-format msgid "Syncing disks.\n" -msgstr "" +msgstr "Diskak sinkronizatzen.\n" -#: fdisk/fdisk.c:2596 +#: fdisk/fdisk.c:2645 #, fuzzy, c-format msgid "Partition %d has no data area\n" msgstr "" "\n" "Swap partizioak ez da swap moetakoa.\n" -#: fdisk/fdisk.c:2601 +#: fdisk/fdisk.c:2650 #, fuzzy msgid "New beginning of data" msgstr " e diskoaren data editatu" -#: fdisk/fdisk.c:2617 +#: fdisk/fdisk.c:2666 #, fuzzy msgid "Expert command (m for help): " msgstr "BSD disko etiketa komandoa (m laguntza erakusteko):" -#: fdisk/fdisk.c:2630 +#: fdisk/fdisk.c:2679 msgid "Number of cylinders" msgstr "Zilindro kopurua" -#: fdisk/fdisk.c:2657 +#: fdisk/fdisk.c:2704 msgid "Number of heads" msgstr "Buru kopurua" -#: fdisk/fdisk.c:2684 +#: fdisk/fdisk.c:2731 msgid "Number of sectors" msgstr "Sektore kopurua pistako" -#: fdisk/fdisk.c:2686 +#: fdisk/fdisk.c:2733 #, c-format msgid "Warning: setting sector offset for DOS compatiblity\n" msgstr "" -#: fdisk/fdisk.c:2745 +#: fdisk/fdisk.c:2792 #, c-format msgid "" "\n" -"WARNING: GPT (GUID Partition Table) detected on '%s'! The util fdisk doesn't " -"support GPT. Use GNU Parted.\n" +"WARNING: GPT (GUID Partition Table) detected on '%s'! The util fdisk doesn't support GPT. Use GNU Parted.\n" "\n" msgstr "" -#: fdisk/fdisk.c:2767 +#: fdisk/fdisk.c:2814 #, c-format msgid "Disk %s doesn't contain a valid partition table\n" -msgstr "" +msgstr "%s diskak ez dauka partizio taula zuzena\n" -#: fdisk/fdisk.c:2778 +#: fdisk/fdisk.c:2825 #, c-format msgid "Cannot open %s\n" msgstr "Ezin da %s ireki\n" -#: fdisk/fdisk.c:2797 fdisk/sfdisk.c:2603 +#: fdisk/fdisk.c:2844 fdisk/sfdisk.c:2603 #, c-format msgid "cannot open %s\n" msgstr "ezin da %s ireki\n" -#: fdisk/fdisk.c:2817 +#: fdisk/fdisk.c:2864 #, fuzzy, c-format msgid "%c: unknown command\n" msgstr "%s: Komando ezezaguna: %s\n" -#: fdisk/fdisk.c:2887 +#: fdisk/fdisk.c:2930 #, c-format msgid "This kernel finds the sector size itself - -b option ignored\n" msgstr "" -#: fdisk/fdisk.c:2891 +#: fdisk/fdisk.c:2934 #, c-format -msgid "" -"Warning: the -b (set sector size) option should be used with one specified " -"device\n" +msgid "Warning: the -b (set sector size) option should be used with one specified device\n" msgstr "" -#: fdisk/fdisk.c:2953 +#: fdisk/fdisk.c:2994 #, c-format msgid "Detected an OSF/1 disklabel on %s, entering disklabel mode.\n" msgstr "" -#: fdisk/fdisk.c:2963 +#: fdisk/fdisk.c:3004 msgid "Command (m for help): " msgstr "Komandoa (m laguntza erakusteko)" -#: fdisk/fdisk.c:2979 +#: fdisk/fdisk.c:3020 #, c-format msgid "" "\n" "The current boot file is: %s\n" msgstr "" +"\n" +"Uneko abio fitxategia: %s\n" -#: fdisk/fdisk.c:2981 +#: fdisk/fdisk.c:3022 msgid "Please enter the name of the new boot file: " -msgstr "" +msgstr "Mesedez sartu abio fitxategi berriaren izena:" -#: fdisk/fdisk.c:2983 +#: fdisk/fdisk.c:3024 #, fuzzy, c-format msgid "Boot file unchanged\n" msgstr "Ezin da '%s' fitxategia ireki" -#: fdisk/fdisk.c:3056 +#: fdisk/fdisk.c:3097 #, c-format msgid "" "\n" @@ -3796,16 +3743,16 @@ msgstr "SGI xlv" msgid "SGI xvm" msgstr "SGI xvm" -#: fdisk/fdisksgilabel.c:95 fdisk/fdisksunlabel.c:55 +#: fdisk/fdisksgilabel.c:95 fdisk/fdisksunlabel.c:50 msgid "Linux swap" msgstr "Linux swap" -#: fdisk/fdisksgilabel.c:96 fdisk/fdisksunlabel.c:56 +#: fdisk/fdisksgilabel.c:96 fdisk/fdisksunlabel.c:51 #, fuzzy msgid "Linux native" msgstr "Linux ext2" -#: fdisk/fdisksgilabel.c:97 fdisk/fdisksunlabel.c:57 fdisk/i386_sys_types.c:63 +#: fdisk/fdisksgilabel.c:97 fdisk/fdisksunlabel.c:52 fdisk/i386_sys_types.c:63 msgid "Linux LVM" msgstr "Linux LVM" @@ -3815,9 +3762,7 @@ msgstr "Linux RAID" #: fdisk/fdisksgilabel.c:151 #, c-format -msgid "" -"According to MIPS Computer Systems, Inc the Label must not contain more than " -"512 bytes\n" +msgid "According to MIPS Computer Systems, Inc the Label must not contain more than 512 bytes\n" msgstr "" #: fdisk/fdisksgilabel.c:170 @@ -3911,7 +3856,7 @@ msgstr "" msgid "More than one entire disk entry present.\n" msgstr "" -#: fdisk/fdisksgilabel.c:433 fdisk/fdisksunlabel.c:388 +#: fdisk/fdisksgilabel.c:433 fdisk/fdisksunlabel.c:383 #, c-format msgid "No partitions defined\n" msgstr "Ez da partiziorik definitu\n" @@ -4006,7 +3951,7 @@ msgid "" "Type YES if you are sure about tagging this partition differently.\n" msgstr "" -#: fdisk/fdisksgilabel.c:543 fdisk/fdisksunlabel.c:554 +#: fdisk/fdisksgilabel.c:543 fdisk/fdisksunlabel.c:549 msgid "YES\n" msgstr "BAI\n" @@ -4056,11 +4001,10 @@ msgid "" "\n" msgstr "" -#: fdisk/fdisksgilabel.c:718 fdisk/fdisksunlabel.c:227 +#: fdisk/fdisksgilabel.c:718 fdisk/fdisksunlabel.c:222 #, c-format msgid "" -"Warning: BLKGETSIZE ioctl failed on %s. Using geometry cylinder value of %" -"d.\n" +"Warning: BLKGETSIZE ioctl failed on %s. Using geometry cylinder value of %d.\n" "This value may be truncated for devices > 33.8 GB.\n" msgstr "" @@ -4074,55 +4018,55 @@ msgstr "" msgid "ID=%02x\tSTART=%d\tLENGTH=%d\n" msgstr "" -#: fdisk/fdisksunlabel.c:43 +#: fdisk/fdisksunlabel.c:38 msgid "Unassigned" -msgstr "" +msgstr "Ezarri gabea" -#: fdisk/fdisksunlabel.c:45 +#: fdisk/fdisksunlabel.c:40 msgid "SunOS root" msgstr "SunOS root" -#: fdisk/fdisksunlabel.c:46 +#: fdisk/fdisksunlabel.c:41 msgid "SunOS swap" msgstr "SunOS swap" -#: fdisk/fdisksunlabel.c:47 +#: fdisk/fdisksunlabel.c:42 msgid "SunOS usr" msgstr "SunOS usr" -#: fdisk/fdisksunlabel.c:48 +#: fdisk/fdisksunlabel.c:43 msgid "Whole disk" msgstr "Disko osoa" -#: fdisk/fdisksunlabel.c:49 +#: fdisk/fdisksunlabel.c:44 msgid "SunOS stand" msgstr "SunOS stand" -#: fdisk/fdisksunlabel.c:50 +#: fdisk/fdisksunlabel.c:45 msgid "SunOS var" msgstr "SunOS var" -#: fdisk/fdisksunlabel.c:51 +#: fdisk/fdisksunlabel.c:46 msgid "SunOS home" msgstr "SunOS home" -#: fdisk/fdisksunlabel.c:52 +#: fdisk/fdisksunlabel.c:47 msgid "SunOS alt sectors" msgstr "SunOS alt sectors" -#: fdisk/fdisksunlabel.c:53 +#: fdisk/fdisksunlabel.c:48 msgid "SunOS cachefs" msgstr "SunOS cachefs" -#: fdisk/fdisksunlabel.c:54 +#: fdisk/fdisksunlabel.c:49 msgid "SunOS reserved" msgstr "SunOS reserved" -#: fdisk/fdisksunlabel.c:58 fdisk/i386_sys_types.c:103 +#: fdisk/fdisksunlabel.c:53 fdisk/i386_sys_types.c:103 msgid "Linux raid autodetect" msgstr "Automatikoki atzeman Linux raid-ak" -#: fdisk/fdisksunlabel.c:141 +#: fdisk/fdisksunlabel.c:136 #, c-format msgid "" "Detected sun disklabel with wrong checksum.\n" @@ -4131,28 +4075,27 @@ msgid "" "or force a fresh label (s command in main menu)\n" msgstr "" -#: fdisk/fdisksunlabel.c:153 +#: fdisk/fdisksunlabel.c:148 #, c-format msgid "Detected sun disklabel with wrong version [0x%08x].\n" msgstr "" -#: fdisk/fdisksunlabel.c:158 +#: fdisk/fdisksunlabel.c:153 #, c-format msgid "Detected sun disklabel with wrong sanity [0x%08x].\n" msgstr "" -#: fdisk/fdisksunlabel.c:163 +#: fdisk/fdisksunlabel.c:158 #, c-format msgid "Detected sun disklabel with wrong num_partitions [%u].\n" msgstr "" -#: fdisk/fdisksunlabel.c:168 +#: fdisk/fdisksunlabel.c:163 #, c-format -msgid "" -"Warning: Wrong values need to be fixed up and will be corrected by w(rite)\n" +msgid "Warning: Wrong values need to be fixed up and will be corrected by w(rite)\n" msgstr "" -#: fdisk/fdisksunlabel.c:198 +#: fdisk/fdisksunlabel.c:193 #, c-format msgid "" "Building a new sun disklabel. Changes will remain in memory only,\n" @@ -4161,50 +4104,50 @@ msgid "" "\n" msgstr "" -#: fdisk/fdisksunlabel.c:236 +#: fdisk/fdisksunlabel.c:231 msgid "Sectors/track" msgstr "Sektoreak pistako" -#: fdisk/fdisksunlabel.c:351 +#: fdisk/fdisksunlabel.c:346 #, c-format msgid "Partition %d doesn't end on cylinder boundary\n" msgstr "" -#: fdisk/fdisksunlabel.c:371 +#: fdisk/fdisksunlabel.c:366 #, c-format msgid "Partition %d overlaps with others in sectors %d-%d\n" msgstr "" -#: fdisk/fdisksunlabel.c:393 +#: fdisk/fdisksunlabel.c:388 #, fuzzy, c-format msgid "Unused gap - sectors 0-%d\n" msgstr "Baliogabeko sektore baloreak" -#: fdisk/fdisksunlabel.c:395 fdisk/fdisksunlabel.c:401 +#: fdisk/fdisksunlabel.c:390 fdisk/fdisksunlabel.c:396 #, fuzzy, c-format msgid "Unused gap - sectors %d-%d\n" msgstr "Baliogabeko sektore baloreak" -#: fdisk/fdisksunlabel.c:426 +#: fdisk/fdisksunlabel.c:421 #, c-format msgid "" "Other partitions already cover the whole disk.\n" "Delete some/shrink them before retry.\n" msgstr "" -#: fdisk/fdisksunlabel.c:449 +#: fdisk/fdisksunlabel.c:444 #, c-format msgid "" "It is highly recommended that the third partition covers the whole disk\n" "and is of type `Whole disk'\n" msgstr "" -#: fdisk/fdisksunlabel.c:477 +#: fdisk/fdisksunlabel.c:472 #, fuzzy, c-format msgid "Sector %d is already allocated\n" msgstr "Partizio hau dagoeneko erabilita dago" -#: fdisk/fdisksunlabel.c:507 +#: fdisk/fdisksunlabel.c:502 #, c-format msgid "" "You haven't covered the whole disk with the 3rd partition, but your value\n" @@ -4212,14 +4155,14 @@ msgid "" "to %d %s\n" msgstr "" -#: fdisk/fdisksunlabel.c:534 +#: fdisk/fdisksunlabel.c:529 #, c-format msgid "" "If you want to maintain SunOS/Solaris compatibility, consider leaving this\n" "partition as Whole disk (5), starting at 0, with %u sectors\n" msgstr "" -#: fdisk/fdisksunlabel.c:549 +#: fdisk/fdisksunlabel.c:544 msgid "" "It is highly recommended that the partition at offset 0\n" "is UFS, EXT2FS filesystem or SunOS swap. Putting Linux swap\n" @@ -4228,7 +4171,7 @@ msgid "" "tagged with 82 (Linux swap): " msgstr "" -#: fdisk/fdisksunlabel.c:581 +#: fdisk/fdisksunlabel.c:576 #, c-format msgid "" "\n" @@ -4241,7 +4184,7 @@ msgid "" "\n" msgstr "" -#: fdisk/fdisksunlabel.c:597 +#: fdisk/fdisksunlabel.c:592 #, c-format msgid "" "\n" @@ -4250,30 +4193,30 @@ msgid "" "\n" msgstr "" -#: fdisk/fdisksunlabel.c:602 +#: fdisk/fdisksunlabel.c:597 #, c-format msgid "%*s Flag Start End Blocks Id System\n" msgstr "" -#: fdisk/fdisksunlabel.c:630 +#: fdisk/fdisksunlabel.c:625 #, fuzzy msgid "Number of alternate cylinders" msgstr "Sartu zilindro kopurua:" -#: fdisk/fdisksunlabel.c:642 +#: fdisk/fdisksunlabel.c:637 #, fuzzy msgid "Extra sectors per cylinder" msgstr "Sartu pistako zenbat sektore kopurua:" -#: fdisk/fdisksunlabel.c:649 +#: fdisk/fdisksunlabel.c:644 msgid "Interleave factor" msgstr "" -#: fdisk/fdisksunlabel.c:656 +#: fdisk/fdisksunlabel.c:651 msgid "Rotation speed (rpm)" msgstr "Bira minutuko (rpm)" -#: fdisk/fdisksunlabel.c:663 +#: fdisk/fdisksunlabel.c:658 #, fuzzy msgid "Number of physical cylinders" msgstr "Sartu zilindro kopurua:" @@ -4299,9 +4242,8 @@ msgid "FAT16 <32M" msgstr "FAT16 <32M" #: fdisk/i386_sys_types.c:11 -#, fuzzy msgid "Extended" -msgstr "Linux extended" +msgstr "Extended" #: fdisk/i386_sys_types.c:12 msgid "FAT16" @@ -4761,35 +4703,32 @@ msgstr "Buruak: %d Sektoreak pistako: %d Zilindroak: %lld" #: fdisk/sfdisk.c:595 #, c-format -msgid "" -"%s of partition %s has impossible value for head: %lu (should be in 0-%lu)\n" +msgid "%s of partition %s has impossible value for head: %lu (should be in 0-%lu)\n" msgstr "" #: fdisk/sfdisk.c:600 #, c-format -msgid "" -"%s of partition %s has impossible value for sector: %lu (should be in 1-%" -"lu)\n" +msgid "%s of partition %s has impossible value for sector: %lu (should be in 1-%lu)\n" msgstr "" #: fdisk/sfdisk.c:605 #, c-format -msgid "" -"%s of partition %s has impossible value for cylinders: %lu (should be in 0-%" -"lu)\n" +msgid "%s of partition %s has impossible value for cylinders: %lu (should be in 0-%lu)\n" msgstr "" #: fdisk/sfdisk.c:645 -#, fuzzy, c-format +#, c-format msgid "" "Id Name\n" "\n" -msgstr "baliogabeko id-a: %s\n" +msgstr "" +"Id Izena\n" +"\n" #: fdisk/sfdisk.c:806 -#, fuzzy, c-format +#, c-format msgid "Re-reading the partition table ...\n" -msgstr "Partizio taula moeta ezezaguna" +msgstr "Partizio taula berriz irakurtzen ...\n" #: fdisk/sfdisk.c:811 msgid "" @@ -4804,9 +4743,9 @@ msgid "Error closing %s\n" msgstr "Errorea %s itxitzerakoan\n" #: fdisk/sfdisk.c:855 -#, fuzzy, c-format +#, c-format msgid "%s: no such partition\n" -msgstr "Ez dago partizio taularik.\n" +msgstr "%s: ez dago horrelako partiziorik\n" #: fdisk/sfdisk.c:878 #, fuzzy @@ -4996,8 +4935,7 @@ msgstr "hasiera" #: fdisk/sfdisk.c:1341 #, c-format -msgid "" -"partition %s: start: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n" +msgid "partition %s: start: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n" msgstr "" #: fdisk/sfdisk.c:1347 @@ -5118,9 +5056,8 @@ msgid "No room for more\n" msgstr "" #: fdisk/sfdisk.c:2070 -#, fuzzy msgid "Illegal type\n" -msgstr "Partizio moeta" +msgstr "Baliogabeko moeta\n" #: fdisk/sfdisk.c:2102 #, c-format @@ -5184,8 +5121,7 @@ msgstr "" #: fdisk/sfdisk.c:2293 #, fuzzy msgid " -c [or --id]: print or change partition Id" -msgstr "" -" p Erakutsi partizio taula pantailan edo idatzi fitxategiren batean" +msgstr " p Erakutsi partizio taula pantailan edo idatzi fitxategiren batean" #: fdisk/sfdisk.c:2294 msgid " -l [or --list]: list partitions of each device" @@ -5200,9 +5136,7 @@ msgid " -i [or --increment]: number cylinders etc. from 1 instead of from 0" msgstr "" #: fdisk/sfdisk.c:2297 -msgid "" -" -uS, -uB, -uC, -uM: accept/report in units of sectors/blocks/cylinders/" -"MB" +msgid " -uS, -uB, -uC, -uM: accept/report in units of sectors/blocks/cylinders/MB" msgstr "" #: fdisk/sfdisk.c:2298 @@ -5226,8 +5160,7 @@ msgid " -n : do not actually write to disk" msgstr "" #: fdisk/sfdisk.c:2303 -msgid "" -" -O file : save the sectors that will be overwritten to file" +msgid " -O file : save the sectors that will be overwritten to file" msgstr "" #: fdisk/sfdisk.c:2304 @@ -5253,9 +5186,7 @@ msgid " -g [or --show-geometry]: print the kernel's idea of the geometry" msgstr "" #: fdisk/sfdisk.c:2309 -msgid "" -" -G [or --show-pt-geometry]: print geometry guessed from the partition " -"table" +msgid " -G [or --show-pt-geometry]: print geometry guessed from the partition table" msgstr "" #: fdisk/sfdisk.c:2310 @@ -5265,8 +5196,7 @@ msgid "" msgstr "" #: fdisk/sfdisk.c:2312 -msgid "" -" -L [or --Linux]: do not complain about things irrelevant for Linux" +msgid " -L [or --Linux]: do not complain about things irrelevant for Linux" msgstr "" #: fdisk/sfdisk.c:2313 @@ -5320,8 +5250,7 @@ msgstr "" #, c-format msgid "" "\n" -"WARNING: GPT (GUID Partition Table) detected on '%s'! The util sfdisk " -"doesn't support GPT. Use GNU Parted.\n" +"WARNING: GPT (GUID Partition Table) detected on '%s'! The util sfdisk doesn't support GPT. Use GNU Parted.\n" "\n" msgstr "" @@ -5511,17 +5440,17 @@ msgid "" "(See fdisk(8).)\n" msgstr "" -#: fsck/fsck.c:327 +#: fsck/fsck.c:326 #, fuzzy, c-format msgid "WARNING: couldn't open %s: %s\n" msgstr "Ezin da '%s' fitxategia ireki" -#: fsck/fsck.c:337 +#: fsck/fsck.c:336 #, c-format msgid "WARNING: bad format on line %d of %s\n" msgstr "" -#: fsck/fsck.c:353 +#: fsck/fsck.c:352 msgid "" "WARNING: Your /etc/fstab does not contain the fsck passno\n" "\tfield. I will kludge around things for you, but you\n" @@ -5529,113 +5458,110 @@ msgid "" "\n" msgstr "" -#: fsck/fsck.c:461 +#: fsck/fsck.c:460 #, c-format msgid "fsck: %s: not found\n" msgstr "fsck: %s: ez da aurkitu\n" -#: fsck/fsck.c:577 +#: fsck/fsck.c:576 #, c-format msgid "%s: wait: No more child process?!?\n" msgstr "" -#: fsck/fsck.c:599 +#: fsck/fsck.c:598 #, c-format msgid "Warning... %s for device %s exited with signal %d.\n" msgstr "" -#: fsck/fsck.c:605 +#: fsck/fsck.c:604 #, c-format msgid "%s %s: status is %x, should never happen.\n" msgstr "" -#: fsck/fsck.c:644 +#: fsck/fsck.c:643 #, c-format msgid "Finished with %s (exit status %d)\n" msgstr "" -#: fsck/fsck.c:704 +#: fsck/fsck.c:703 #, c-format msgid "%s: Error %d while executing fsck.%s for %s\n" msgstr "" -#: fsck/fsck.c:725 +#: fsck/fsck.c:724 msgid "" "Either all or none of the filesystem types passed to -t must be prefixed\n" "with 'no' or '!'.\n" msgstr "" -#: fsck/fsck.c:744 +#: fsck/fsck.c:743 msgid "Couldn't allocate memory for filesystem types\n" msgstr "" -#: fsck/fsck.c:883 +#: fsck/fsck.c:882 #, c-format -msgid "" -"%s: skipping bad line in /etc/fstab: bind mount with nonzero fsck pass " -"number\n" +msgid "%s: skipping bad line in /etc/fstab: bind mount with nonzero fsck pass number\n" msgstr "" -#: fsck/fsck.c:893 +#: fsck/fsck.c:892 #, fuzzy, c-format msgid "%s: skipping nonexistent device\n" msgstr "Erabilera: %s [aukerak] gailua ...\n" -#: fsck/fsck.c:919 +#: fsck/fsck.c:918 #, c-format msgid "fsck: cannot check %s: fsck.%s not found\n" msgstr "" -#: fsck/fsck.c:975 +#: fsck/fsck.c:974 msgid "Checking all file systems.\n" msgstr "" -#: fsck/fsck.c:1066 +#: fsck/fsck.c:1065 #, fuzzy, c-format msgid "--waiting-- (pass %d)\n" msgstr "Ordulariaren tick-ari itxaroten\n" -#: fsck/fsck.c:1086 -msgid "" -"Usage: fsck [-AMNPRTV] [ -C [ fd ] ] [-t fstype] [fs-options] [filesys ...]\n" +#: fsck/fsck.c:1085 +msgid "Usage: fsck [-AMNPRTV] [ -C [ fd ] ] [-t fstype] [fs-options] [filesys ...]\n" msgstr "" -#: fsck/fsck.c:1124 +#: fsck/fsck.c:1123 #, c-format msgid "%s: too many devices\n" msgstr "%s: gailu gehiegi\n" -#: fsck/fsck.c:1135 -#, fuzzy, c-format +#: fsck/fsck.c:1134 +#, c-format msgid "Couldn't open %s: %s\n" -msgstr "open-ek huts egin du: %s" +msgstr "Ezin da %s ireki: %s\n" -#: fsck/fsck.c:1137 +#: fsck/fsck.c:1136 #, c-format msgid "Is /proc mounted?\n" msgstr "/proc montatua dago?\n" -#: fsck/fsck.c:1146 +#: fsck/fsck.c:1145 #, c-format msgid "Must be root to scan for matching filesystems: %s\n" msgstr "" -#: fsck/fsck.c:1149 +#: fsck/fsck.c:1148 #, c-format msgid "Couldn't find matching filesystem: %s\n" msgstr "" -#: fsck/fsck.c:1157 fsck/fsck.c:1243 +#: fsck/fsck.c:1156 fsck/fsck.c:1242 #, c-format msgid "%s: too many arguments\n" msgstr "%s: argumentu gehiegi\n" -#: fsck/fsck.c:1277 +#: fsck/fsck.c:1276 #, fuzzy, c-format msgid "fsck from %s\n" msgstr "%s-(e)tik renice-ea\n" -#: fsck/fsck.c:1289 +#: fsck/fsck.c:1288 #, c-format msgid "%s: Unable to allocate memory for fsck_path\n" msgstr "" @@ -5670,8 +5596,7 @@ msgid " parameters\n" msgstr "" #: getopt/getopt.c:324 -msgid "" -" -a, --alternative Allow long options starting with single -\n" +msgid " -a, --alternative Allow long options starting with single -\n" msgstr "" #: getopt/getopt.c:325 @@ -5683,8 +5608,7 @@ msgid " -l, --longoptions=longopts Long options to be recognized\n" msgstr "" #: getopt/getopt.c:327 -msgid "" -" -n, --name=progname The name under which errors are reported\n" +msgid " -n, --name=progname The name under which errors are reported\n" msgstr "" #: getopt/getopt.c:328 @@ -5775,9 +5699,9 @@ msgid "cmos_write(): write to data address %X failed: %s\n" msgstr "" #: hwclock/cmos.c:574 -#, fuzzy, c-format +#, c-format msgid "Cannot open /dev/port: %s" -msgstr "Ezin da disko unitatea ireki" +msgstr "Ezin da /dev/port ireki: %s" #: hwclock/cmos.c:581 #, c-format @@ -5842,9 +5766,9 @@ msgid "Waiting for clock tick...\n" msgstr "Ordulariaren tick-ari itxaroten\n" #: hwclock/hwclock.c:356 -#, fuzzy, c-format +#, c-format msgid "...synchronization failed\n" -msgstr "stat-ek huts egin du: %s" +msgstr "...sinkronizazioak huts egin du\n" #: hwclock/hwclock.c:358 #, fuzzy, c-format @@ -5885,9 +5809,7 @@ msgstr "" #: hwclock/hwclock.c:571 #, c-format -msgid "" -"The Hardware Clock registers contain values that are either invalid (e.g. " -"50th day of month) or beyond the range we can handle (e.g. Year 2095).\n" +msgid "The Hardware Clock registers contain values that are either invalid (e.g. 50th day of month) or beyond the range we can handle (e.g. Year 2095).\n" msgstr "" #: hwclock/hwclock.c:581 @@ -5939,8 +5861,7 @@ msgstr "" #: hwclock/hwclock.c:662 #, c-format msgid "" -"The date command issued by %s returned something other than an integer where " -"the converted time value was expected.\n" +"The date command issued by %s returned something other than an integer where the converted time value was expected.\n" "The command was:\n" " %s\n" "The response was:\n" @@ -5954,9 +5875,7 @@ msgstr "" #: hwclock/hwclock.c:705 #, c-format -msgid "" -"The Hardware Clock does not contain a valid time, so we cannot set the " -"System Time from it.\n" +msgid "The Hardware Clock does not contain a valid time, so we cannot set the System Time from it.\n" msgstr "" #: hwclock/hwclock.c:727 hwclock/hwclock.c:804 @@ -6000,9 +5919,7 @@ msgstr "" #: hwclock/hwclock.c:852 #, c-format -msgid "" -"Not adjusting drift factor because the Hardware Clock previously contained " -"garbage.\n" +msgid "Not adjusting drift factor because the Hardware Clock previously contained garbage.\n" msgstr "" #: hwclock/hwclock.c:857 @@ -6014,16 +5931,13 @@ msgstr "" #: hwclock/hwclock.c:863 #, c-format -msgid "" -"Not adjusting drift factor because it has been less than a day since the " -"last calibration.\n" +msgid "Not adjusting drift factor because it has been less than a day since the last calibration.\n" msgstr "" #: hwclock/hwclock.c:911 #, c-format msgid "" -"Clock drifted %.1f seconds in the past %d seconds in spite of a drift factor " -"of %f seconds/day.\n" +"Clock drifted %.1f seconds in the past %d seconds in spite of a drift factor of %f seconds/day.\n" "Adjusting drift factor by %f seconds/day\n" msgstr "" @@ -6051,9 +5965,7 @@ msgstr "" #: hwclock/hwclock.c:1001 #, c-format -msgid "" -"Could not open file with the clock adjustment parameters in it (%s) for " -"writing" +msgid "Could not open file with the clock adjustment parameters in it (%s) for writing" msgstr "" #: hwclock/hwclock.c:1006 hwclock/hwclock.c:1011 @@ -6068,14 +5980,12 @@ msgstr "" #: hwclock/hwclock.c:1058 #, c-format -msgid "" -"The Hardware Clock does not contain a valid time, so we cannot adjust it.\n" +msgid "The Hardware Clock does not contain a valid time, so we cannot adjust it.\n" msgstr "" #: hwclock/hwclock.c:1066 #, c-format -msgid "" -"Not setting clock because last adjustment time is zero, so history is bad." +msgid "Not setting clock because last adjustment time is zero, so history is bad." msgstr "" #: hwclock/hwclock.c:1089 @@ -6101,8 +6011,7 @@ msgstr "" #: hwclock/hwclock.c:1257 #, c-format msgid "" -"The kernel keeps an epoch value for the Hardware Clock only on an Alpha " -"machine.\n" +"The kernel keeps an epoch value for the Hardware Clock only on an Alpha machine.\n" "This copy of hwclock was built for a machine other than Alpha\n" "(and thus is presumably not running on an Alpha now). No action taken.\n" msgstr "" @@ -6119,9 +6028,7 @@ msgstr "" #: hwclock/hwclock.c:1271 #, c-format -msgid "" -"To set the epoch value, you must use the 'epoch' option to tell to what " -"value to set it.\n" +msgid "To set the epoch value, you must use the 'epoch' option to tell to what value to set it.\n" msgstr "" #: hwclock/hwclock.c:1274 @@ -6134,7 +6041,7 @@ msgstr "" msgid "Unable to set the epoch value in the kernel.\n" msgstr "" -#: hwclock/hwclock.c:1290 misc-utils/cal.c:343 misc-utils/kill.c:189 +#: hwclock/hwclock.c:1290 misc-utils/cal.c:347 misc-utils/kill.c:189 #, fuzzy, c-format msgid "%s from %s\n" msgstr "%s-(e)tik renice-ea\n" @@ -6206,23 +6113,17 @@ msgstr "" #: hwclock/hwclock.c:1565 #, c-format -msgid "" -"%s: The --utc and --localtime options are mutually exclusive. You specified " -"both.\n" +msgid "%s: The --utc and --localtime options are mutually exclusive. You specified both.\n" msgstr "" #: hwclock/hwclock.c:1572 #, c-format -msgid "" -"%s: The --adjust and --noadjfile options are mutually exclusive. You " -"specified both.\n" +msgid "%s: The --adjust and --noadjfile options are mutually exclusive. You specified both.\n" msgstr "" #: hwclock/hwclock.c:1579 #, c-format -msgid "" -"%s: The --adjfile and --noadjfile options are mutually exclusive. You " -"specified both.\n" +msgid "%s: The --adjfile and --noadjfile options are mutually exclusive. You specified both.\n" msgstr "" #: hwclock/hwclock.c:1588 @@ -6247,9 +6148,7 @@ msgstr "" #: hwclock/hwclock.c:1629 #, c-format -msgid "" -"Sorry, only the superuser can change the Hardware Clock epoch in the " -"kernel.\n" +msgid "Sorry, only the superuser can change the Hardware Clock epoch in the kernel.\n" msgstr "" #: hwclock/hwclock.c:1650 @@ -6259,9 +6158,7 @@ msgstr "" #: hwclock/hwclock.c:1654 #, c-format -msgid "" -"Use the --debug option to see the details of our search for an access " -"method.\n" +msgid "Use the --debug option to see the details of our search for an access method.\n" msgstr "" #: hwclock/kd.c:54 @@ -6288,23 +6185,21 @@ msgid "ioctl() failed to read time from %s" msgstr "" #: hwclock/kd.c:140 -#, fuzzy msgid "ioctl KDSHWCLK failed" -msgstr "%s: get size egiterakoan huts egin da" +msgstr "ioctl KDSHWCLK-ek huts egin du" #: hwclock/kd.c:176 msgid "Can't open /dev/tty1 or /dev/vc/1" msgstr "" #: hwclock/kd.c:180 -#, fuzzy msgid "KDGHWCLK ioctl failed" -msgstr "%s: get size egiterakoan huts egin da" +msgstr "KDGHWCLK ioctl-ek huts egin du" #: hwclock/rtc.c:147 hwclock/rtc.c:241 -#, fuzzy, c-format +#, c-format msgid "open() of %s failed" -msgstr "open-ek huts egin du: %s" +msgstr "%s-(r)engan open() egiteak huts egin du" #: hwclock/rtc.c:181 #, c-format @@ -6365,10 +6260,7 @@ msgstr "%s-(e)ren irekierak huts egin du" #: hwclock/rtc.c:410 hwclock/rtc.c:454 #, c-format -msgid "" -"To manipulate the epoch value in the kernel, we must access the Linux 'rtc' " -"device driver via the device special file %s. This file does not exist on " -"this system.\n" +msgid "To manipulate the epoch value in the kernel, we must access the Linux 'rtc' device driver via the device special file %s. This file does not exist on this system.\n" msgstr "" #: hwclock/rtc.c:415 hwclock/rtc.c:459 @@ -6398,8 +6290,7 @@ msgstr "" #: hwclock/rtc.c:469 #, c-format -msgid "" -"The kernel device driver for %s does not have the RTC_EPOCH_SET ioctl.\n" +msgid "The kernel device driver for %s does not have the RTC_EPOCH_SET ioctl.\n" msgstr "" #: hwclock/rtc.c:472 @@ -6408,9 +6299,9 @@ msgid "ioctl(RTC_EPOCH_SET) to %s failed" msgstr "" #: login-utils/agetty.c:360 -#, fuzzy, c-format +#, c-format msgid "%s: can't exec %s: %m" -msgstr "exec %s-(e)k huts egin du" +msgstr "%s: ezin da %s-(r)engan exec egin: %m" #: login-utils/agetty.c:383 #, fuzzy @@ -6468,9 +6359,9 @@ msgid "users" msgstr "erabiltzaileak" #: login-utils/agetty.c:1030 -#, fuzzy, c-format +#, c-format msgid "%s: read: %m" -msgstr "Irakurri:" +msgstr "%s: irakurri: %m" #: login-utils/agetty.c:1077 #, fuzzy, c-format @@ -6480,10 +6371,8 @@ msgstr "sarrera okerra\n" #: login-utils/agetty.c:1206 #, c-format msgid "" -"Usage: %s [-8hiLmUw] [-l login_program] [-t timeout] [-I initstring] [-H " -"login_host] baud_rate,... line [termtype]\n" -"or\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] " -"line baud_rate,... [termtype]\n" +"Usage: %s [-8hiLmUw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] baud_rate,... line [termtype]\n" +"or\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] line baud_rate,... [termtype]\n" msgstr "" #: login-utils/checktty.c:91 login-utils/checktty.c:112 @@ -6546,12 +6435,12 @@ msgstr "" msgid "Changing finger information for %s.\n" msgstr "" -#: login-utils/chfn.c:189 login-utils/chsh.c:188 login-utils/login.c:572 +#: login-utils/chfn.c:189 login-utils/chsh.c:188 login-utils/login.c:576 #, c-format msgid "%s: PAM failure, aborting: %s\n" msgstr "" -#: login-utils/chfn.c:212 login-utils/chsh.c:211 login-utils/login.c:823 +#: login-utils/chfn.c:212 login-utils/chsh.c:211 login-utils/login.c:827 #: login-utils/newgrp.c:79 login-utils/simpleinit.c:340 mount/lomount.c:742 #: mount/lomount.c:745 msgid "Password: " @@ -6579,9 +6468,9 @@ msgid "" msgstr "" #: login-utils/chfn.c:330 -#, fuzzy, c-format +#, c-format msgid "[ --help ] [ --version ]\n" -msgstr "Inprimatu laguntza pantaila" +msgstr "[ --help ] [ --version ]\n" #: login-utils/chfn.c:378 msgid "Office" @@ -6636,9 +6525,7 @@ msgstr "" #: login-utils/chsh.c:164 #, c-format -msgid "" -"%s: Running UID doesn't match UID of user we're altering, shell change " -"denied\n" +msgid "%s: Running UID doesn't match UID of user we're altering, shell change denied\n" msgstr "" #: login-utils/chsh.c:170 @@ -6771,246 +6658,251 @@ msgstr "" msgid "FATAL: can't reopen tty: %s" msgstr "" -#: login-utils/login.c:229 +#: login-utils/login.c:205 +#, c-format +msgid "FATAL: %s is not a terminal" +msgstr "" + +#: login-utils/login.c:238 #, fuzzy msgid "FATAL: bad tty" msgstr "fitxategi luzeera okerra" -#: login-utils/login.c:436 +#: login-utils/login.c:445 #, c-format msgid "login: -h for super-user only.\n" msgstr "" -#: login-utils/login.c:479 +#: login-utils/login.c:488 #, c-format msgid "usage: login [-fp] [username]\n" msgstr "" -#: login-utils/login.c:574 +#: login-utils/login.c:578 #, fuzzy, c-format msgid "Couldn't initialize PAM: %s" msgstr "huts egin da lerro buffer-a hasieratzen\n" -#: login-utils/login.c:591 +#: login-utils/login.c:595 msgid "login: " msgstr "" -#: login-utils/login.c:635 +#: login-utils/login.c:639 #, c-format msgid "FAILED LOGIN %d FROM %s FOR %s, %s" msgstr "" -#: login-utils/login.c:640 +#: login-utils/login.c:644 #, fuzzy, c-format msgid "" "Login incorrect\n" "\n" msgstr "Pasahitz okerra." -#: login-utils/login.c:649 +#: login-utils/login.c:653 #, c-format msgid "TOO MANY LOGIN TRIES (%d) FROM %s FOR %s, %s" msgstr "" -#: login-utils/login.c:653 +#: login-utils/login.c:657 #, c-format msgid "FAILED LOGIN SESSION FROM %s FOR %s, %s" msgstr "" -#: login-utils/login.c:658 +#: login-utils/login.c:662 #, fuzzy, c-format msgid "" "\n" "Login incorrect\n" msgstr "Pasahitz okerra." -#: login-utils/login.c:686 login-utils/login.c:693 login-utils/login.c:727 +#: login-utils/login.c:690 login-utils/login.c:697 login-utils/login.c:731 #, c-format msgid "" "\n" "Session setup problem, abort.\n" msgstr "" -#: login-utils/login.c:687 +#: login-utils/login.c:691 #, c-format msgid "NULL user name in %s:%d. Abort." msgstr "" -#: login-utils/login.c:694 +#: login-utils/login.c:698 #, c-format msgid "Invalid user name \"%s\" in %s:%d. Abort." msgstr "" -#: login-utils/login.c:713 +#: login-utils/login.c:717 #, fuzzy, c-format msgid "login: Out of memory\n" msgstr "memoriatik kanpo" -#: login-utils/login.c:757 +#: login-utils/login.c:761 #, fuzzy msgid "Illegal username" msgstr "Baliogabeko tekla" -#: login-utils/login.c:800 +#: login-utils/login.c:804 #, c-format msgid "%s login refused on this terminal.\n" msgstr "" -#: login-utils/login.c:805 +#: login-utils/login.c:809 #, c-format msgid "LOGIN %s REFUSED FROM %s ON TTY %s" msgstr "" -#: login-utils/login.c:809 +#: login-utils/login.c:813 #, c-format msgid "LOGIN %s REFUSED ON TTY %s" msgstr "" -#: login-utils/login.c:863 +#: login-utils/login.c:867 #, fuzzy, c-format msgid "Login incorrect\n" msgstr "Pasahitz okerra." -#: login-utils/login.c:1088 +#: login-utils/login.c:1092 #, fuzzy, c-format msgid "DIALUP AT %s BY %s" msgstr "%s-(r)en disko etiketa irakurtzen %d sektorean.\n" -#: login-utils/login.c:1095 +#: login-utils/login.c:1099 #, c-format msgid "ROOT LOGIN ON %s FROM %s" msgstr "" -#: login-utils/login.c:1098 +#: login-utils/login.c:1102 #, fuzzy, c-format msgid "ROOT LOGIN ON %s" msgstr " disko guztian. " -#: login-utils/login.c:1101 +#: login-utils/login.c:1105 #, c-format msgid "LOGIN ON %s BY %s FROM %s" msgstr "" -#: login-utils/login.c:1104 +#: login-utils/login.c:1108 #, fuzzy, c-format msgid "LOGIN ON %s BY %s" msgstr " disko guztian. " -#: login-utils/login.c:1125 -#, fuzzy, c-format +#: login-utils/login.c:1129 +#, c-format msgid "You have new mail.\n" -msgstr "Sortu partizio primario berri bat" +msgstr "Posta elektroniko berria duzu.\n" -#: login-utils/login.c:1127 +#: login-utils/login.c:1131 #, c-format msgid "You have mail.\n" msgstr "" -#: login-utils/login.c:1171 +#: login-utils/login.c:1175 #, c-format msgid "login: failure forking: %s" msgstr "" -#: login-utils/login.c:1218 +#: login-utils/login.c:1222 #, fuzzy, c-format msgid "TIOCSCTTY failed: %m" msgstr "stat-ek huts egin du: %s" -#: login-utils/login.c:1224 +#: login-utils/login.c:1228 msgid "setuid() failed" msgstr "setuid()-k huts egin du" -#: login-utils/login.c:1230 +#: login-utils/login.c:1234 #, fuzzy, c-format msgid "No directory %s!\n" msgstr " (ez dago iradokizunik) " -#: login-utils/login.c:1234 +#: login-utils/login.c:1238 #, c-format msgid "Logging in with home = \"/\".\n" msgstr "" -#: login-utils/login.c:1242 +#: login-utils/login.c:1246 #, c-format msgid "login: no memory for shell script.\n" msgstr "" -#: login-utils/login.c:1269 +#: login-utils/login.c:1273 #, c-format msgid "login: couldn't exec shell script: %s.\n" msgstr "" -#: login-utils/login.c:1272 +#: login-utils/login.c:1276 #, fuzzy, c-format msgid "login: no shell: %s.\n" msgstr "Ez dago partizio taularik.\n" -#: login-utils/login.c:1287 +#: login-utils/login.c:1291 #, c-format msgid "" "\n" "%s login: " msgstr "" -#: login-utils/login.c:1298 +#: login-utils/login.c:1302 #, c-format msgid "login name much too long.\n" msgstr "" -#: login-utils/login.c:1299 +#: login-utils/login.c:1303 msgid "NAME too long" msgstr "IZENA luzeegia" -#: login-utils/login.c:1306 +#: login-utils/login.c:1310 #, c-format msgid "login names may not start with '-'.\n" msgstr "" -#: login-utils/login.c:1316 +#: login-utils/login.c:1320 #, fuzzy, c-format msgid "too many bare linefeeds.\n" msgstr "orri txar gehiegi" -#: login-utils/login.c:1317 +#: login-utils/login.c:1321 msgid "EXCESSIVE linefeeds" msgstr "" -#: login-utils/login.c:1349 +#: login-utils/login.c:1353 #, c-format msgid "Login timed out after %d seconds\n" msgstr "" -#: login-utils/login.c:1437 +#: login-utils/login.c:1441 #, fuzzy, c-format msgid "Last login: %.*s " msgstr " Lehena Azkena\n" -#: login-utils/login.c:1441 +#: login-utils/login.c:1445 #, fuzzy, c-format msgid "from %.*s\n" msgstr "%s-(e)tik renice-ea\n" -#: login-utils/login.c:1444 +#: login-utils/login.c:1448 #, fuzzy, c-format msgid "on %.*s\n" msgstr " disko guztian. " -#: login-utils/login.c:1470 +#: login-utils/login.c:1474 #, c-format msgid "LOGIN FAILURE FROM %s, %s" msgstr "" -#: login-utils/login.c:1473 +#: login-utils/login.c:1477 #, fuzzy, c-format msgid "LOGIN FAILURE ON %s, %s" msgstr " disko guztian. " -#: login-utils/login.c:1477 +#: login-utils/login.c:1481 #, c-format msgid "%d LOGIN FAILURES FROM %s, %s" msgstr "" -#: login-utils/login.c:1480 +#: login-utils/login.c:1484 #, fuzzy, c-format msgid "%d LOGIN FAILURES ON %s, %s" msgstr " disko guztian. " @@ -7047,9 +6939,8 @@ msgid "newgrp: Permission denied" msgstr "" #: login-utils/newgrp.c:132 -#, fuzzy msgid "newgrp: setuid" -msgstr "setuid()-k huts egin du" +msgstr "newgrp: setuid" #: login-utils/newgrp.c:138 #, fuzzy @@ -7410,25 +7301,25 @@ msgstr "" msgid "%s: can't read temporary file.\n" msgstr "ezin da badblocks fitxategia irakurri" -#: misc-utils/cal.c:360 misc-utils/cal.c:372 +#: misc-utils/cal.c:364 misc-utils/cal.c:376 #, c-format msgid "illegal day value: use 1-%d" msgstr "baliogabeko egun balorea: erabili 1-%d" -#: misc-utils/cal.c:364 +#: misc-utils/cal.c:368 msgid "illegal month value: use 1-12" msgstr "" -#: misc-utils/cal.c:368 +#: misc-utils/cal.c:372 msgid "illegal year value: use 1-9999" msgstr "" -#: misc-utils/cal.c:462 +#: misc-utils/cal.c:466 #, c-format msgid "%s %d" msgstr "" -#: misc-utils/cal.c:854 +#: misc-utils/cal.c:858 #, c-format msgid "usage: cal [-13smjyV] [[[day] month] year]\n" msgstr "" @@ -7444,9 +7335,9 @@ msgid "St. Tib's Day" msgstr "baliogabeko egun balorea: erabili 1-%d" #: misc-utils/findfs.c:24 -#, fuzzy, c-format +#, c-format msgid "Usage: %s LABEL=