From 63cccae4684f83d2a462bc8abf24e51d1bd6efb6 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 7 Dec 2006 00:25:58 +0100 Subject: [PATCH] Imported from util-linux-2.11t tarball. --- HISTORY | 42 + MCONFIG | 17 +- VERSION | 2 +- configure | 112 +- disk-utils/Makefile | 11 +- disk-utils/cramfs.h | 81 ++ disk-utils/fdformat.c | 9 +- disk-utils/fsck.cramfs.c | 625 ++++++++ disk-utils/mkfs.8 | 3 + disk-utils/mkfs.cramfs.c | 828 +++++++++++ fdisk/cfdisk.8 | 1 + fdisk/fdisk.8 | 1 + fdisk/fdisk.c | 97 +- fdisk/fdiskbsdlabel.c | 246 ++-- fdisk/fdiskbsdlabel.h | 4 +- fdisk/fdisksunlabel.c | 4 +- fdisk/partname.c | 5 +- fdisk/sfdisk.8 | 1 + fdisk/sfdisk.c | 6 +- hwclock/Makefile | 4 +- hwclock/README.aeb | 9 - hwclock/README.shhopt-1.1 | 155 -- hwclock/adjtime.patch | 302 ---- hwclock/cmos.c | 34 +- hwclock/hwclock.8 | 3 +- hwclock/hwclock.c | 718 +++++---- hwclock/kd.c | 3 +- hwclock/rtc.c | 38 +- hwclock/shhopt-1.1.lsm | 17 - hwclock/shhopt.c | 468 ------ hwclock/shhopt.h | 33 - lib/nls.h | 2 +- lib/pathnames.h | 2 +- lib/widechar.h | 2 +- mount/Makefile | 16 +- mount/fstab.c | 2 +- mount/linux_fs.h | 55 +- mount/mount.8 | 13 +- mount/mount.c | 436 +++--- mount/mount_by_label.c | 30 + mount/mount_constants.h | 4 + mount/mount_guess_fstype.c | 5 - mount/nfs.5 | 6 +- mount/pivot_root.c | 20 +- mount/sundries.h | 1 - mount/swapon.8 | 18 +- mount/swapon.c | 494 ++++--- partx/gpt.c | 4 +- po/Makefile | 11 +- po/POTFILES.in | 4 +- po/cat-id-tbl.c | 2808 ++++++++++++++++++------------------ po/cs.po | 1584 ++++++++++++-------- po/da.po | 1584 ++++++++++++-------- po/de.po | 1739 +++++++++++++--------- po/es.po | 1625 ++++++++++++--------- po/et.po | 1849 ++++++++++++++---------- po/fr.po | 1629 ++++++++++++--------- po/it.po | 1588 ++++++++++++-------- po/ja.po | 1586 ++++++++++++-------- po/nl.po | 1541 ++++++++++++-------- po/pt_BR.po | 1586 ++++++++++++-------- po/sv.po | 1593 ++++++++++++-------- po/tr.po | 1592 ++++++++++++-------- sys-utils/ipcrm.8 | 109 +- sys-utils/ipcs.c | 8 +- text-utils/LICENSE.pg | 28 + text-utils/Makefile | 31 +- text-utils/README.pg | 23 + text-utils/column.c | 31 +- text-utils/line.1 | 29 +- text-utils/line.c | 38 + text-utils/line.sh | 22 - text-utils/more.c | 15 +- text-utils/pg.1 | 238 +++ text-utils/pg.c | 1775 +++++++++++++++++++++++ 75 files changed, 18460 insertions(+), 11195 deletions(-) create mode 100644 disk-utils/cramfs.h create mode 100644 disk-utils/fsck.cramfs.c create mode 100644 disk-utils/mkfs.cramfs.c delete mode 100644 hwclock/README.aeb delete mode 100644 hwclock/README.shhopt-1.1 delete mode 100644 hwclock/adjtime.patch delete mode 100644 hwclock/shhopt-1.1.lsm delete mode 100644 hwclock/shhopt.c delete mode 100644 hwclock/shhopt.h create mode 100644 text-utils/LICENSE.pg create mode 100644 text-utils/README.pg create mode 100644 text-utils/line.c delete mode 100644 text-utils/line.sh create mode 100644 text-utils/pg.1 create mode 100644 text-utils/pg.c diff --git a/HISTORY b/HISTORY index 8fed606b..fc69018b 100644 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,45 @@ +util-linux 2.11t + +* fdformat: remove test on major +* fsck.cramfs: added NLS +* fdisk: fix device names with sundisklabels under devfs (Kaj-Michael Lang) +* fdisk: minor polishing +* hwclock: also handle ENOTTY ioctl return (Maciej W. Rozycki) +* hwclock: minor polishing +* ipcrm.8: minor polishing +* mkfs.cramfs: added NLS +* mkfs.cramfs: added -v (verbose) option, and made default silent +* mount: patch for make -j (RedHat) +* swapoff: minor polishing + +util-linux 2.11s + +* Estonian messages (Meelis Roos) +* French messages: some minor corrections +* No French messages with permission to distribute (Michel Robitaille) +* German messages (Michael Piefel) +* Spanish messages (Santiago Vila Doncel) +* Swedish messages (Christian Rose) +* Turkish messages (Nilgün Belma Bugüner) +* MCONFIG: allow "make DISABLE_NLS=yes " (Peter Breitenlohner) +* configure: don't run ./conftest - better for cross-compilation (Magnus Damm) +* fdisk: fixes for disks with OSF/1 label +* fsck.cramfs: new (from kernel source) +* hwclock: improved adjtime handling (James P. Rutledge) +* hwclock: remove shhopts stuff +* ipcs: remove unused heading (Michael Kerrisk) +* line: replace by C version - the sh version was broken (Gunnar Ritter) +* login: default root path: added /usr/local/[s]bin (RedHat) +* mkfs.cramfs: new (from kernel source) +* mount: when no type is known, assume that prefix // implies samba (RedHat) +* mount -a: avoid stat on devices that have noauto option (Jeroen Mostert) +* mount by label: ignore RAID partitions (RedHat) +* [u]mount: fstab.c fix (ejb@ql.org) +* pg: new (Gunnar Ritter) +* sfdisk: small BSD partition fix +* swapoff -a: also do swapoff on all files found in /proc/swaps +* swapon -a: skip files already found in /proc/swaps + util-linux 2.11r * Estonian messages (Meelis Roos) diff --git a/MCONFIG b/MCONFIG index e09ec2af..7f7ad581 100644 --- a/MCONFIG +++ b/MCONFIG @@ -93,6 +93,15 @@ HAVE_SLN=no # If HAVE_FDUTILS is set to "yes", then setfdprm won't be installed. HAVE_FDUTILS=no +# If SILENT_PG is set to "yes", then pg will not ring the bell +# when an invalid key is pressed +SILENT_PG=no + +# If configure decides that Native Language Support (NLS) is available, +# it sets MAY_ENABLE_NLS in defines.h. If you don't want NLS, set +# DISABLE_NLS to "yes". +DISABLE_NLS=no + # Different optimizations for different cpus. # gcc 3.0 likes options -mcpu=i486 instead of -m486 ifeq "$(ARCH)" "intel" @@ -198,8 +207,12 @@ INSTALLMAN= $(INSTALL) -m $(MANMODE) INSTALLDAT= $(INSTALL) -m $(DATMODE) INSTALLSUID= $(INSTALL) -m $(SUIDMODE) -o root -CFLAGS := $(OPT) -I$(LIB) $(WARNFLAGS) \ - $(CURSESFLAGS) $(SLANGFLAGS) \ +ifeq "$(DISABLE_NLS)" "yes" +NLSFLAGS = -DDISABLE_NLS +endif + +CFLAGS := $(OPT) -I$(LIB) $(WARNFLAGS) \ + $(CURSESFLAGS) $(SLANGFLAGS) $(NLSFLAGS) \ -D_FILE_OFFSET_BITS=64 \ -DSBINDIR=\"$(SBIN_DIR)\" \ -DUSRSBINDIR=\"$(USRSBIN_DIR)\" \ diff --git a/VERSION b/VERSION index cb5cbc12..af8c274d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.11r +2.11t diff --git a/configure b/configure index 45d567b6..a2f533cc 100755 --- a/configure +++ b/configure @@ -23,6 +23,8 @@ # F4. For hwclock/kd.c: do we have nanosleep()? # F5. For mkswap.c: do we have personality()? # F6. For agetty.c: is updwtmp() available? +# F7. For pg.c: are fseeko() and ftello() available? +# F8. For fsck.cramfs.c: is lchown() available? # # 1. For sys-utils/cytune.c: do we need ? # 2. For cfdisk, setterm, more, ul: do we have ncurses? How installed? @@ -59,6 +61,7 @@ echo LDFLAGS=$LDFLAGS >> make_include DEFS= LIBS= compile='$CC $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1' +compile_with_warnings='$CC $CFLAGS $DEFS conftest.c -o conftest $LIBS 2>&1' static_compile='$CC -static $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1' eval COMPILE='"'$compile'"' export COMPILE @@ -70,7 +73,7 @@ rm -f conftest.c conftest # `-m486' is deprecated. Use `-march=i486' or `-mcpu=i486' instead. # echo " -main(){ exit(0); } +int main(){ exit(0); } " > conftest.c gccout=`$CC $CFLAGS -m386 conftest.c -o conftest 2>&1 | grep "march="` if test -z "$gccout"; then @@ -91,10 +94,10 @@ echo " #define u_char unsigned char #include #undef u_char -main(){ exit(0); } +int main(){ exit(0); } " > conftest.c eval $compile -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then echo "#define HAVE_scsi_h" >> defines.h echo "You have " else @@ -172,14 +175,14 @@ echo " #include #include #include -main(int a, char **v){ +int main(int a, char **v){ if (a == -1) /* false */ inet_aton((const char *) 0, (struct in_addr *) 0); exit(0); } " > conftest.c eval $compile -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then echo "#define HAVE_inet_aton" >> defines.h echo "You have inet_aton()" else @@ -192,14 +195,14 @@ rm -f conftest conftest.c # echo " #include -main(int a, char **v){ +int main(int a, char **v){ if (a == -1) /* false */ fsync(0); exit(0); } " > conftest.c eval $compile -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then echo "#define HAVE_fsync" >> defines.h echo "You have fsync()" else @@ -212,7 +215,7 @@ rm -f conftest conftest.c # echo " #include -main(int a, char **v){ +int main(int a, char **v){ char buf[1]; if (a == -1) /* false */ getdomainname(buf, sizeof buf); @@ -220,7 +223,7 @@ main(int a, char **v){ } " > conftest.c eval $compile -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then echo "#define HAVE_getdomainname" >> defines.h echo "You have getdomainname()" else @@ -240,7 +243,7 @@ int main () { } " > conftest.c eval $compile -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then echo "#define HAVE_nanosleep" >> defines.h echo "You have nanosleep()" else @@ -259,7 +262,7 @@ int main () { } " > conftest.c eval $compile -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then echo "#define HAVE_personality" >> defines.h echo "You have personality()" else @@ -273,7 +276,7 @@ rm -f conftest conftest.c echo ' #include #include -main(int a, char **v){ +int main(int a, char **v){ struct utmp ut; memset (&ut, 0, sizeof(ut)); if (a == -1) /* false */ @@ -282,7 +285,7 @@ main(int a, char **v){ } ' > conftest.c eval $compile -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then echo "#define HAVE_updwtmp" >> defines.h echo "You have updwtmp()" else @@ -290,6 +293,45 @@ else fi rm -f conftest conftest.c +# +# F7. For pg.c: are fseeko() and ftello() available? +# +echo ' +#include +int main(int a, char **v){ + fseeko(stdout, 0, 0); + ftello(stdout); + exit(0); +} +' > conftest.c +eval $compile +if test -s conftest; then + echo "#define HAVE_fseeko" >> defines.h + echo "You have fseeko()" +else + echo "You don't have fseeko()" +fi +rm -f conftest conftest.c + +# +# F8. For fsck.cramfs.c: is lchown() available? +# +echo ' +#include +#include +int main(int a, char **v){ + lchown("nowhere",0,0); + exit(0); +} +' > conftest.c +gccout=`eval $compile_with_warnings | grep "lchown is not implemented"` +if test -s conftest -a -z "$gccout"; then + echo "#define HAVE_lchown" >> defines.h + echo "You have lchown()" +else + echo "You don't have lchown()" +fi +rm -f conftest conftest.c # # 1. cytune.c may need struct tq_struct @@ -297,10 +339,10 @@ rm -f conftest conftest.c echo " #include #include -main(){ exit(0); } +int main(){ exit(0); } " > conftest.c eval $compile -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then echo "You don't need " else echo "#define NEED_tqueue_h" >> defines.h @@ -339,10 +381,10 @@ fi if [ $test_curses_h = 1 ]; then echo " #include - main(){ char *c = NCURSES_VERSION; exit(0); } + int main(){ char *c = NCURSES_VERSION; exit(0); } " > conftest.c eval $compile - if test -s conftest && ./conftest 2>/dev/null; then + if test -s conftest; then echo "HAVE_NCURSES=yes" >> make_include echo "CURSESFLAGS=-DNCH=0" >> make_include echo "You have ncurses. Using ." @@ -366,12 +408,12 @@ fi # echo ' #include -main(){ exit(0); tgetnum("li"); } +int main(){ exit(0); tgetnum("li"); } ' > conftest.c LIBS=-ltermcap eval $compile LIBS= -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then echo "#define HAVE_termcap" >> defines.h echo "HAVE_TERMCAP=yes" >> make_include echo "LIBTERMCAP=-ltermcap" >> make_include @@ -392,10 +434,10 @@ rm -f conftest conftest.c echo ' #define _XOPEN_SOURCE #include -main(){ char *c = crypt("abc","pw"); exit(0); } +int main(){ char *c = crypt("abc","pw"); exit(0); } ' > conftest.c eval $compile -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then echo "NEED_LIBCRYPT=no" >> make_include echo "You don't need -lcrypt" else @@ -408,10 +450,10 @@ rm -f conftest conftest.c # 5. Does static compilation work? # echo " -main(){ return 0; } +int main(){ return 0; } " > conftest.c eval $static_compile -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then : OK, nothing special else echo "CAN_DO_STATIC=no" >> make_include @@ -424,23 +466,21 @@ rm -f conftest.c conftest # echo ' #include -main(int a, char **v){ +int main(int a, char **v){ if (a == -1) /* false */ gettext("There is no gettext man page\n"); exit(0); } ' > conftest.c eval $compile -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then echo '#define HAVE_libintl_h' >> defines.h echo "You have and gettext()" - echo '#define ENABLE_NLS' >> defines.h - echo "Assuming that you want to enable NLS support." - echo "(Otherwise, edit defines.h and remove the line with ENABLE_NLS)" - ENABLE_NLS=yes + echo '#define MAY_ENABLE_NLS' >> defines.h + MAY_ENABLE_NLS=yes else - echo "You don't have " - ENABLE_NLS=no + echo "You don't have native language support" + MAY_ENABLE_NLS=no fi rm -f conftest conftest.c @@ -453,7 +493,7 @@ rm -f conftest conftest.c # Many Linux systems do not have "which". Maybe "env" can be used. # Writing /usr/bin/xgettext is no good: one may have xgettext elsewhere. # -if (test $ENABLE_NLS = yes && type xgettext > /dev/null 2>&1); then +if (test $MAY_ENABLE_NLS = yes && type xgettext > /dev/null 2>&1); then msg=`xgettext --foreign-user 2>&1 | grep unrecognized` if test -n "$msg"; then echo "FOREIGN = " >> make_include @@ -473,10 +513,10 @@ fi echo " #include extern char *__progname; -main(){ printf(__progname); exit(0); } +int main(){ printf(__progname); exit(0); } " > conftest.c eval $compile -if test -s conftest && ./conftest > /dev/null 2>/dev/null; then +if test -s conftest; then echo "#define HAVE_progname" >> defines.h echo "You have __progname" else @@ -489,12 +529,12 @@ rm -f conftest conftest.c # echo " #include -main(){ exit(0); openpty(0, 0, 0, 0, 0); } +int main(){ exit(0); openpty(0, 0, 0, 0, 0); } " > conftest.c LIBS=-lutil eval $compile LIBS= -if test -s conftest && ./conftest 2>/dev/null; then +if test -s conftest; then echo "HAVE_OPENPTY=yes" >> make_include echo "#define HAVE_openpty" >> defines.h echo "You have and openpty()" diff --git a/disk-utils/Makefile b/disk-utils/Makefile index 044a97e6..8c9543fb 100644 --- a/disk-utils/Makefile +++ b/disk-utils/Makefile @@ -14,7 +14,8 @@ MAN8= blockdev.8 fdformat.8 isosize.8 mkfs.8 mkswap.8 elvtune.8 \ # Where to put binaries? # See the "install" rule for the links. . . -SBIN= mkfs mkswap blockdev elvtune fsck.minix mkfs.minix mkfs.bfs +SBIN= mkfs mkswap blockdev elvtune fsck.minix mkfs.minix mkfs.bfs \ + fsck.cramfs mkfs.cramfs USRBIN= fdformat isosize @@ -32,6 +33,14 @@ endif all: $(SBIN) $(USRBIN) +fsck.cramfs: fsck.cramfs.o + cc -o fsck.cramfs fsck.cramfs.o -lz + +mkfs.cramfs: mkfs.cramfs.o + cc -o mkfs.cramfs mkfs.cramfs.o -lz + +fsck.cramfs.o mkfs.cramfs.o: cramfs.h + fsck.minix.o mkfs.minix.o: bitops.h minix.h install: all diff --git a/disk-utils/cramfs.h b/disk-utils/cramfs.h new file mode 100644 index 00000000..34b32ca1 --- /dev/null +++ b/disk-utils/cramfs.h @@ -0,0 +1,81 @@ +#ifndef __CRAMFS_H +#define __CRAMFS_H + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; + +#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ +#define CRAMFS_SIGNATURE "Compressed ROMFS" + +/* + * Width of various bitfields in struct cramfs_inode. + * Primarily used to generate warnings in mkcramfs. + */ +#define CRAMFS_MODE_WIDTH 16 +#define CRAMFS_UID_WIDTH 16 +#define CRAMFS_SIZE_WIDTH 24 +#define CRAMFS_GID_WIDTH 8 +#define CRAMFS_NAMELEN_WIDTH 6 +#define CRAMFS_OFFSET_WIDTH 26 + + +/* + * Reasonably terse representation of the inode data. + */ +struct cramfs_inode { + u32 mode:16, uid:16; + /* SIZE for device files is i_rdev */ + u32 size:24, gid:8; + /* NAMELEN is the length of the file name, divided by 4 and + rounded up. (cramfs doesn't support hard links.) */ + /* OFFSET: For symlinks and non-empty regular files, this + contains the offset (divided by 4) of the file data in + compressed form (starting with an array of block pointers; + see README). For non-empty directories it is the offset + (divided by 4) of the inode of the first file in that + directory. For anything else, offset is zero. */ + u32 namelen:6, offset:26; +}; + +struct cramfs_info { + u32 crc; + u32 edition; + u32 blocks; + u32 files; +}; + +/* + * Superblock information at the beginning of the FS. + */ +struct cramfs_super { + u32 magic; /* 0x28cd3d45 - random number */ + u32 size; /* Not used. mkcramfs currently + writes a constant 1<<16 here. */ + u32 flags; /* 0 */ + u32 future; /* 0 */ + u8 signature[16]; /* "Compressed ROMFS" */ + struct cramfs_info fsid;/* unique filesystem info */ + u8 name[16]; /* user-defined name */ + struct cramfs_inode root; /* Root inode data */ +}; + +#define CRAMFS_FLAG_FSID_VERSION_2 0x00000001 /* fsid version #2 */ +#define CRAMFS_FLAG_SORTED_DIRS 0x00000002 /* sorted dirs */ +#define CRAMFS_FLAG_HOLES 0x00000100 /* support for holes */ +#define CRAMFS_FLAG_WRONG_SIGNATURE 0x00000200 /* reserved */ +#define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400 /* shifted root fs */ + +/* + * Valid values in super.flags. Currently we refuse to mount + * if (flags & ~CRAMFS_SUPPORTED_FLAGS). Maybe that should be + * changed to test super.future instead. + */ +#define CRAMFS_SUPPORTED_FLAGS (0xff) + +/* Uncompression interfaces to the underlying zlib */ +int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen); +int cramfs_uncompress_init(void); +int cramfs_uncompress_exit(void); + +#endif diff --git a/disk-utils/fdformat.c b/disk-utils/fdformat.c index e479059c..e1b38117 100644 --- a/disk-utils/fdformat.c +++ b/disk-utils/fdformat.c @@ -18,12 +18,8 @@ #include "nls.h" -/* cannot include */ -#define MAJOR(a) ((a)>>8) - struct floppy_struct param; -#define FLOPPY_MAJOR 2 #define SECTOR_SIZE 512 #define PERROR(msg) { perror(msg); exit(1); } @@ -130,9 +126,10 @@ int main(int argc,char **argv) } if (argc != 2) usage(progname); if (stat(argv[1],&st) < 0) PERROR(argv[1]); - if (!S_ISBLK(st.st_mode) || MAJOR(st.st_rdev) != FLOPPY_MAJOR) { - fprintf(stderr,_("%s: not a floppy device\n"),argv[1]); + if (!S_ISBLK(st.st_mode)) { + fprintf(stderr,_("%s: not a block device\n"),argv[1]); exit(1); + /* do not test major - perhaps this was an USB floppy */ } if (access(argv[1],W_OK) < 0) PERROR(argv[1]); diff --git a/disk-utils/fsck.cramfs.c b/disk-utils/fsck.cramfs.c new file mode 100644 index 00000000..3485bdc7 --- /dev/null +++ b/disk-utils/fsck.cramfs.c @@ -0,0 +1,625 @@ +/* + * cramfsck - check a cramfs file system + * + * Copyright (C) 2000-2001 Transmeta Corporation + * + * 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 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. + * + * 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 + * + * 1999/12/03: Linus Torvalds (cramfs tester and unarchive program) + * 2000/06/03: Daniel Quinlan (CRC and length checking program) + * 2000/06/04: Daniel Quinlan (merged programs, added options, support + * for special files, preserve permissions and + * ownership, cramfs superblock v2, bogus mode + * test, pathname length test, etc.) + * 2000/06/06: Daniel Quinlan (support for holes, pretty-printing, + * symlink size test) + * 2000/07/11: Daniel Quinlan (file length tests, start at offset 0 or 512, + * fsck-compatible exit codes) + * 2000/07/15: Daniel Quinlan (initial support for block devices) + */ + +/* compile-time options */ +#define INCLUDE_FS_TESTS /* include cramfs checking and extraction */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include /* for major, minor */ + +#include "cramfs.h" +#include "../defines.h" /* for HAVE_lchown */ +#include "nls.h" + +#define BLKGETSIZE _IO(0x12,96) /* return device size */ + +static const char *progname = "cramfsck"; + +static int fd; /* ROM image file descriptor */ +static char *filename; /* ROM image filename */ +struct cramfs_super *super; /* just find the cramfs superblock once */ +static int opt_verbose = 0; /* 1 = verbose (-v), 2+ = very verbose (-vv) */ + +#ifdef INCLUDE_FS_TESTS +static int opt_extract = 0; /* extract cramfs (-x) */ +char *extract_dir = NULL; /* extraction directory (-x) */ + +unsigned long start_inode = 1 << 28; /* start of first non-root inode */ +unsigned long end_inode = 0; /* end of the directory structure */ +unsigned long start_data = 1 << 28; /* start of the data (256 MB = max) */ +unsigned long end_data = 0; /* end of the data */ +/* true? cramfs_super < start_inode < end_inode <= start_data <= end_data */ +static uid_t euid; /* effective UID */ + +#define PAD_SIZE 512 +#define PAGE_CACHE_SIZE (4096) + +/* Guarantee access to at least 8kB at a time */ +#define ROMBUFFER_BITS 13 +#define ROMBUFFERSIZE (1 << ROMBUFFER_BITS) +#define ROMBUFFERMASK (ROMBUFFERSIZE-1) +static char read_buffer[ROMBUFFERSIZE * 2]; +static unsigned long read_buffer_block = ~0UL; + +/* Uncompressing data structures... */ +static char outbuffer[PAGE_CACHE_SIZE*2]; +z_stream stream; + +#endif /* INCLUDE_FS_TESTS */ + +/* Input status of 0 to print help and exit without an error. */ +static void usage(int status) +{ + FILE *stream = status ? stderr : stdout; + + fprintf(stream, _("usage: %s [-hv] [-x dir] file\n" + " -h print this help\n" + " -x dir extract into dir\n" + " -v be more verbose\n" + " file file to test\n"), progname); + + exit(status); +} + +#ifdef INCLUDE_FS_TESTS +static void print_node(char type, struct cramfs_inode *i, char *name) +{ + char info[10]; + + if (S_ISCHR(i->mode) || (S_ISBLK(i->mode))) { + /* major/minor numbers can be as high as 2^12 or 4096 */ + snprintf(info, 10, "%4d,%4d", major(i->size), minor(i->size)); + } + else { + /* size be as high as 2^24 or 16777216 */ + snprintf(info, 10, "%9d", i->size); + } + + printf("%c %04o %s %5d:%-3d %s\n", + type, i->mode & ~S_IFMT, info, i->uid, i->gid, name); +} + +/* + * Create a fake "blocked" access + */ +static void *romfs_read(unsigned long offset) +{ + unsigned int block = offset >> ROMBUFFER_BITS; + if (block != read_buffer_block) { + read_buffer_block = block; + lseek(fd, block << ROMBUFFER_BITS, SEEK_SET); + read(fd, read_buffer, ROMBUFFERSIZE * 2); + } + return read_buffer + (offset & ROMBUFFERMASK); +} + +static struct cramfs_inode *cramfs_iget(struct cramfs_inode * i) +{ + struct cramfs_inode *inode = malloc(sizeof(struct cramfs_inode)); + *inode = *i; + return inode; +} + +static struct cramfs_inode *iget(unsigned int ino) +{ + return cramfs_iget(romfs_read(ino)); +} + +#if 0 +static void iput(struct cramfs_inode *inode) +{ + free(inode); +} +#endif + +/* + * Return the offset of the root directory, + * or 0 if none. + */ +static struct cramfs_inode *read_super(void) +{ + unsigned long offset; + + offset = super->root.offset << 2; + if (super->magic != CRAMFS_MAGIC) + return NULL; + if (memcmp(super->signature, CRAMFS_SIGNATURE, sizeof(super->signature)) != 0) + return NULL; + if (offset < sizeof(super)) + return NULL; + return cramfs_iget(&super->root); +} + +static int uncompress_block(void *src, int len) +{ + int err; + + stream.next_in = src; + stream.avail_in = len; + + stream.next_out = (unsigned char *) outbuffer; + stream.avail_out = PAGE_CACHE_SIZE*2; + + inflateReset(&stream); + + err = inflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + fprintf(stderr, + _("%s: error %d while decompressing! %p(%d)\n"), + filename, err, src, len); + exit(4); + } + return stream.total_out; +} + +#ifdef HAVE_lchown +#define my_lchown lchown +#else +#define my_lchown chown +#endif + +static void change_file_status(char *path, struct cramfs_inode *i) +{ + struct utimbuf epoch = { 0, 0 }; + + if (euid == 0) { + if (my_lchown(path, i->uid, i->gid) < 0) { + perror(path); + exit(8); + } + if (S_ISLNK(i->mode)) + return; + if ((S_ISUID | S_ISGID) & i->mode) { + if (chmod(path, i->mode) < 0) { + perror(path); + exit(8); + } + } + } + if (S_ISLNK(i->mode)) + return; + if (utime(path, &epoch) < 0) { + perror(path); + exit(8); + } +} + +static void do_symlink(char *path, struct cramfs_inode *i) +{ + unsigned long offset = i->offset << 2; + unsigned long curr = offset + 4; + unsigned long next = *(u32 *) romfs_read(offset); + unsigned long size; + + if (next > end_data) { + end_data = next; + } + + size = uncompress_block(romfs_read(curr), next - curr); + if (size != i->size) { + fprintf(stderr, _("%s: size error in symlink `%s'\n"), + filename, path); + exit(4); + } + outbuffer[size] = 0; + if (opt_verbose) { + char *str; + + str = malloc(strlen(outbuffer) + strlen(path) + 5); + strcpy(str, path); + strncat(str, " -> ", 4); + strncat(str, outbuffer, size); + + print_node('l', i, str); + if (opt_verbose > 1) { + printf(_(" uncompressing block at %ld " + "to %ld (%ld)\n"), + curr, next, next - curr); + } + } + if (opt_extract) { + symlink(outbuffer, path); + change_file_status(path, i); + } +} + +static void do_special_inode(char *path, struct cramfs_inode *i) +{ + dev_t devtype = 0; + char type; + + if (S_ISCHR(i->mode)) { + devtype = i->size; + type = 'c'; + } + else if (S_ISBLK(i->mode)) { + devtype = i->size; + type = 'b'; + } + else if (S_ISFIFO(i->mode)) + type = 'p'; + else if (S_ISSOCK(i->mode)) + type = 's'; + else { + fprintf(stderr, _("%s: bogus mode on `%s' (%o)\n"), + filename, path, i->mode); + exit(4); + } + + if (opt_verbose) { + print_node(type, i, path); + } + + if (opt_extract) { + if (mknod(path, i->mode, devtype) < 0) { + perror(path); + exit(8); + } + change_file_status(path, i); + } +} + +static void do_uncompress(int fd, unsigned long offset, unsigned long size) +{ + unsigned long curr = offset + 4 * ((size + PAGE_CACHE_SIZE - 1) / PAGE_CACHE_SIZE); + + do { + unsigned long out = PAGE_CACHE_SIZE; + unsigned long next = *(u32 *) romfs_read(offset); + + if (next > end_data) + end_data = next; + + offset += 4; + if (curr == next) { + if (opt_verbose > 1) { + printf(_(" hole at %ld (%d)\n"), + curr, PAGE_CACHE_SIZE); + } + if (size < PAGE_CACHE_SIZE) + out = size; + memset(outbuffer, 0x00, out); + } + else { + if (opt_verbose > 1) { + printf(_(" uncompressing block at %ld " + "to %ld (%ld)\n"), + curr, next, next - curr); + } + out = uncompress_block(romfs_read(curr), next - curr); + } + if (size >= PAGE_CACHE_SIZE) { + if (out != PAGE_CACHE_SIZE) { + fprintf(stderr, + _("%s: Non-block (%ld) bytes\n"), + filename, out); + exit(4); + } + } else { + if (out != size) { + fprintf(stderr, _("%s: Non-size (%ld vs %ld) " + "bytes\n"), + filename, out, size); + exit(4); + } + } + size -= out; + if (opt_extract) { + write(fd, outbuffer, out); + } + curr = next; + } while (size); +} + +static void expand_fs(int pathlen, char *path, struct cramfs_inode *inode) +{ + if (S_ISDIR(inode->mode)) { + int count = inode->size; + unsigned long offset = inode->offset << 2; + char *newpath = malloc(pathlen + 256); + + if (count > 0 && offset < start_inode) { + start_inode = offset; + } + /* XXX - need to check end_inode for empty case? */ + memcpy(newpath, path, pathlen); + newpath[pathlen] = '/'; + pathlen++; + if (opt_verbose) { + print_node('d', inode, path); + } + if (opt_extract) { + mkdir(path, inode->mode); + change_file_status(path, inode); + } + while (count > 0) { + struct cramfs_inode *child = iget(offset); + int size; + int newlen = child->namelen << 2; + + size = sizeof(struct cramfs_inode) + newlen; + count -= size; + + offset += sizeof(struct cramfs_inode); + + memcpy(newpath + pathlen, romfs_read(offset), newlen); + newpath[pathlen + newlen] = 0; + if ((pathlen + newlen) - strlen(newpath) > 3) { + fprintf(stderr, + _("%s: invalid cramfs--bad " + "path length\n"), + filename); + exit(4); + } + expand_fs(strlen(newpath), newpath, child); + + offset += newlen; + + if (offset > end_inode) { + end_inode = offset; + } + } + return; + } + if (S_ISREG(inode->mode)) { + int fd = 0; + unsigned long offset = inode->offset << 2; + + if (offset > 0 && offset < start_data) { + start_data = offset; + } + if (opt_verbose) { + print_node('f', inode, path); + } + if (opt_extract) { + fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, inode->mode); + } + if (inode->size) { + do_uncompress(fd, offset, inode->size); + } + if (opt_extract) { + close(fd); + change_file_status(path, inode); + } + return; + } + if (S_ISLNK(inode->mode)) { + unsigned long offset = inode->offset << 2; + + if (offset < start_data) { + start_data = offset; + } + do_symlink(path, inode); + return; + } + else { + do_special_inode(path, inode); + return; + } +} +#endif /* INCLUDE_FS_TESTS */ + +int main(int argc, char **argv) +{ + void *buf; + size_t length; + struct stat st; + u32 crc_old, crc_new; +#ifdef INCLUDE_FS_TESTS + struct cramfs_inode *root; +#endif /* INCLUDE_FS_TESTS */ + int c; /* for getopt */ + int start = 0; + + if (argc) + progname = argv[0]; + + /* command line options */ + while ((c = getopt(argc, argv, "hx:v")) != EOF) { + switch (c) { + case 'h': + usage(0); + case 'x': +#ifdef INCLUDE_FS_TESTS + opt_extract = 1; + extract_dir = malloc(strlen(optarg) + 1); + strcpy(extract_dir, optarg); + break; +#else /* not INCLUDE_FS_TESTS */ + fprintf(stderr, _("%s: compiled without -x support\n"), + progname); + exit(16); +#endif /* not INCLUDE_FS_TESTS */ + case 'v': + opt_verbose++; + break; + } + } + + if ((argc - optind) != 1) + usage(16); + filename = argv[optind]; + + /* find the physical size of the file or block device */ + if (lstat(filename, &st) < 0) { + perror(filename); + exit(8); + } + fd = open(filename, O_RDONLY); + if (fd < 0) { + perror(filename); + exit(8); + } + if (S_ISBLK(st.st_mode)) { + if (ioctl(fd, BLKGETSIZE, &length) < 0) { + fprintf(stderr, _("%s: warning--unable to determine " + "filesystem size \n"), filename); + exit(4); + } + length = length * 512; + } + else if (S_ISREG(st.st_mode)) { + length = st.st_size; + } + else { + fprintf(stderr, _("%s is not a block device or file\n"), + filename); + exit(8); + } + + if (length < sizeof(struct cramfs_super)) { + fprintf(stderr, _("%s: invalid cramfs--file length " + "too short\n"), filename); + exit(4); + } + + if (S_ISBLK(st.st_mode)) { + /* nasty because mmap of block devices fails */ + buf = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + read(fd, buf, length); + } + else { + /* nice and easy */ + buf = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); + } + + /* XXX - this could be cleaner... */ + if (((struct cramfs_super *) buf)->magic == CRAMFS_MAGIC) { + start = 0; + super = (struct cramfs_super *) buf; + } + else if (length >= (PAD_SIZE + sizeof(struct cramfs_super)) && + ((((struct cramfs_super *) (buf + PAD_SIZE))->magic == CRAMFS_MAGIC))) + { + start = PAD_SIZE; + super = (struct cramfs_super *) (buf + PAD_SIZE); + } + else { + fprintf(stderr, _("%s: invalid cramfs--wrong magic\n"), + filename); + exit(4); + } + + if (super->flags & CRAMFS_FLAG_FSID_VERSION_2) { + /* length test */ + if (length < super->size) { + fprintf(stderr, _("%s: invalid cramfs--file length " + "too short\n"), filename); + exit(4); + } + else if (length > super->size) { + fprintf(stderr, _("%s: warning--file length too long, " + "padded image?\n"), filename); + } + + /* CRC test */ + crc_old = super->fsid.crc; + super->fsid.crc = crc32(0L, Z_NULL, 0); + crc_new = crc32(0L, Z_NULL, 0); + crc_new = crc32(crc_new, (unsigned char *) buf+start, super->size - start); + if (crc_new != crc_old) { + fprintf(stderr, _("%s: invalid cramfs--crc error\n"), + filename); + exit(4); + } + } + else { + fprintf(stderr, _("%s: warning--old cramfs image, no CRC\n"), + filename); + } + +#ifdef INCLUDE_FS_TESTS + super = (struct cramfs_super *) malloc(sizeof(struct cramfs_super)); + if (((struct cramfs_super *) buf)->magic == CRAMFS_MAGIC) { + memcpy(super, buf, sizeof(struct cramfs_super)); + } + else if (length >= (PAD_SIZE + sizeof(struct cramfs_super)) && + ((((struct cramfs_super *) (buf + PAD_SIZE))->magic == CRAMFS_MAGIC))) + { + memcpy(super, (buf + PAD_SIZE), sizeof(struct cramfs_super)); + } + + munmap(buf, length); + + /* file format test, uses fake "blocked" accesses */ + root = read_super(); + umask(0); + euid = geteuid(); + if (!root) { + fprintf(stderr, _("%s: invalid cramfs--bad superblock\n"), + filename); + exit(4); + } + stream.next_in = NULL; + stream.avail_in = 0; + inflateInit(&stream); + + if (!extract_dir) + extract_dir = "root"; + + expand_fs(strlen(extract_dir), extract_dir, root); + inflateEnd(&stream); + + if (start_data != 1 << 28 && end_inode != start_data) { + fprintf(stderr, + _("%s: invalid cramfs--directory data end " + "(%ld) != file data start (%ld)\n"), + filename, end_inode, start_data); + exit(4); + } + if (super->flags & CRAMFS_FLAG_FSID_VERSION_2) { + if (end_data > super->size) { + fprintf(stderr, + _("%s: invalid cramfs--invalid file " + "data offset\n"), + filename); + exit(4); + } + } +#endif /* INCLUDE_FS_TESTS */ + + exit(0); +} diff --git a/disk-utils/mkfs.8 b/disk-utils/mkfs.8 index da69772c..760a5e08 100644 --- a/disk-utils/mkfs.8 +++ b/disk-utils/mkfs.8 @@ -113,8 +113,11 @@ for the ext2 file system. .BR fsck (8), .BR mkdosfs (8), .BR mke2fs (8), +.BR mkfs.bfs (8), .BR mkfs.ext2 (8), +.BR mkfs.ext3 (8), .BR mkfs.minix (8), .BR mkfs.msdos (8), +.BR mkfs.vfat (8), .BR mkfs.xfs (8), .BR mkfs.xiafs (8) diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c new file mode 100644 index 00000000..5556708e --- /dev/null +++ b/disk-utils/mkfs.cramfs.c @@ -0,0 +1,828 @@ +/* + * mkcramfs - make a cramfs file system + * + * Copyright (C) 1999-2001 Transmeta Corporation + * + * 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 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. + * + * 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 +#include +#include +#include +#include + +#include "cramfs.h" +#include "nls.h" + +#define PAD_SIZE 512 /* only 0 and 512 supported by kernel */ + +static const char *progname = "mkcramfs"; +static int verbose = 0; + +/* Input status of 0 to print help and exit without an error. */ +static void usage(int status) +{ + FILE *stream = status ? stderr : stdout; + + fprintf(stream, + _("usage: %s [-h] [-v] [-e edition] [-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" + " -e edition set edition number (part of fsid)\n" + " -i file insert a file image into the filesystem " + "(requires >= 2.4.0)\n" + " -n name set name of cramfs filesystem\n" + " -p pad by %d bytes for boot code\n" + " -s sort directory entries (old option, ignored)\n" + " -z make explicit holes (requires >= 2.3.39)\n" + " dirname root of the filesystem to be compressed\n" + " outfile output file\n"), + progname, PAD_SIZE); + + exit(status); +} + +#define PAGE_CACHE_SIZE (4096) +/* The kernel assumes PAGE_CACHE_SIZE as block size. */ +static unsigned int blksize = PAGE_CACHE_SIZE; +static long total_blocks = 0, total_nodes = 1; /* pre-count the root node */ +static int image_length = 0; + +/* + * If opt_holes is set, then mkcramfs can create explicit holes in the + * data, which saves 26 bytes per hole (which is a lot smaller a + * saving than most most filesystems). + * + * Note that kernels up to at least 2.3.39 don't support cramfs holes, + * which is why this is turned off by default. + */ +static int opt_edition = 0; +static int opt_errors = 0; +static int opt_holes = 0; +static int opt_pad = 0; +static char *opt_image = NULL; +static char *opt_name = NULL; + +static int warn_dev, warn_gid, warn_namelen, warn_skip, warn_size, warn_uid; + +#ifndef MIN +# define MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b)) +#endif + +/* In-core version of inode / directory entry. */ +struct entry { + /* stats */ + char *name; + unsigned int mode, size, uid, gid; + + /* FS data */ + void *uncompressed; + /* points to other identical file */ + struct entry *same; + unsigned int offset; /* pointer to compressed data in archive */ + unsigned int dir_offset; /* Where in the archive is the directory entry? */ + + /* organization */ + struct entry *child; /* null for non-directories and empty directories */ + struct entry *next; +}; + +/* + * Width of various bitfields in struct cramfs_inode. + * Used only to generate warnings. + */ +#define CRAMFS_SIZE_WIDTH 24 +#define CRAMFS_UID_WIDTH 16 +#define CRAMFS_GID_WIDTH 8 +#define CRAMFS_OFFSET_WIDTH 26 + +/* + * The longest file name component to allow for in the input directory tree. + * Ext2fs (and many others) allow up to 255 bytes. A couple of filesystems + * allow longer (e.g. smbfs 1024), but there isn't much use in supporting + * >255-byte names in the input directory tree given that such names get + * truncated to 255 bytes when written to cramfs. + */ +#define MAX_INPUT_NAMELEN 255 + +static int find_identical_file(struct entry *orig,struct entry *newfile) +{ + if(orig==newfile) return 1; + if(!orig) return 0; + if(orig->size==newfile->size && orig->uncompressed && !memcmp(orig->uncompressed,newfile->uncompressed,orig->size)) { + newfile->same=orig; + return 1; + } + return find_identical_file(orig->child,newfile) || + find_identical_file(orig->next,newfile); +} + +static void eliminate_doubles(struct entry *root,struct entry *orig) { + if(orig) { + if(orig->size && orig->uncompressed) + find_identical_file(root,orig); + eliminate_doubles(root,orig->child); + eliminate_doubles(root,orig->next); + } +} + +/* + * We define our own sorting function instead of using alphasort which + * uses strcoll and changes ordering based on locale information. + */ +static int cramsort (const void *a, const void *b) +{ + return strcmp ((*(const struct dirent **) a)->d_name, + (*(const struct dirent **) b)->d_name); +} + +static unsigned int parse_directory(struct entry *root_entry, const char *name, struct entry **prev, loff_t *fslen_ub) +{ + struct dirent **dirlist; + int totalsize = 0, dircount, dirindex; + char *path, *endpath; + size_t len = strlen(name); + + /* Set up the path. */ + /* TODO: Reuse the parent's buffer to save memcpy'ing and duplication. */ + path = malloc(len + 1 + MAX_INPUT_NAMELEN + 1); + if (!path) { + perror(NULL); + exit(8); + } + memcpy(path, name, len); + endpath = path + len; + *endpath = '/'; + endpath++; + + /* read in the directory and sort */ + dircount = scandir(name, &dirlist, 0, cramsort); + + if (dircount < 0) { + perror(name); + exit(8); + } + + /* process directory */ + for (dirindex = 0; dirindex < dircount; dirindex++) { + struct dirent *dirent; + struct entry *entry; + struct stat st; + int size; + size_t namelen; + + dirent = dirlist[dirindex]; + + /* Ignore "." and ".." - we won't be adding them + to the archive */ + if (dirent->d_name[0] == '.') { + if (dirent->d_name[1] == '\0') + continue; + if (dirent->d_name[1] == '.') { + if (dirent->d_name[2] == '\0') + continue; + } + } + namelen = strlen(dirent->d_name); + if (namelen > MAX_INPUT_NAMELEN) { + fprintf(stderr, + _("Very long (%u bytes) filename `%s' found.\n" + " Please increase MAX_INPUT_NAMELEN in " + "mkcramfs.c and recompile. Exiting.\n"), + namelen, dirent->d_name); + exit(8); + } + memcpy(endpath, dirent->d_name, namelen + 1); + + if (lstat(path, &st) < 0) { + perror(endpath); + warn_skip = 1; + continue; + } + entry = calloc(1, sizeof(struct entry)); + if (!entry) { + perror(NULL); + exit(8); + } + entry->name = strdup(dirent->d_name); + if (!entry->name) { + perror(NULL); + exit(8); + } + if (namelen > 255) { + /* Can't happen when reading from ext2fs. */ + + /* TODO: we ought to avoid chopping in half + multi-byte UTF8 characters. */ + entry->name[namelen = 255] = '\0'; + warn_namelen = 1; + } + entry->mode = st.st_mode; + entry->size = st.st_size; + entry->uid = st.st_uid; + if (entry->uid >= 1 << CRAMFS_UID_WIDTH) + warn_uid = 1; + entry->gid = st.st_gid; + if (entry->gid >= 1 << CRAMFS_GID_WIDTH) + /* TODO: We ought to replace with a default + gid instead of truncating; otherwise there + are security problems. Maybe mode should + be &= ~070. Same goes for uid once Linux + supports >16-bit uids. */ + warn_gid = 1; + size = sizeof(struct cramfs_inode) + ((namelen + 3) & ~3); + *fslen_ub += size; + if (S_ISDIR(st.st_mode)) { + entry->size = parse_directory(root_entry, path, &entry->child, fslen_ub); + } else if (S_ISREG(st.st_mode)) { + /* TODO: We ought to open files in do_compress, one + at a time, instead of amassing all these memory + maps during parse_directory (which don't get used + until do_compress anyway). As it is, we tend to + get EMFILE errors (especially if mkcramfs is run + by non-root). + + While we're at it, do analagously for symlinks + (which would just save a little memory). */ + int fd = open(path, O_RDONLY); + if (fd < 0) { + perror(path); + warn_skip = 1; + continue; + } + if (entry->size) { + if ((entry->size >= 1 << CRAMFS_SIZE_WIDTH)) { + warn_size = 1; + entry->size = (1 << CRAMFS_SIZE_WIDTH) - 1; + } + + entry->uncompressed = mmap(NULL, entry->size, PROT_READ, MAP_PRIVATE, fd, 0); + if (-1 == (int) (long) entry->uncompressed) { + perror("mmap"); + exit(8); + } + } + close(fd); + } else if (S_ISLNK(st.st_mode)) { + entry->uncompressed = malloc(entry->size); + if (!entry->uncompressed) { + perror(NULL); + exit(8); + } + if (readlink(path, entry->uncompressed, entry->size) < 0) { + perror(path); + warn_skip = 1; + continue; + } + } else if (S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode)) { + /* maybe we should skip sockets */ + entry->size = 0; + } else { + entry->size = st.st_rdev; + if (entry->size & -(1<size - 1) / blksize + 1); + + /* block pointers & data expansion allowance + data */ + if(entry->size) + *fslen_ub += (4+26)*blocks + entry->size + 3; + } + + /* Link it into the list */ + *prev = entry; + prev = &entry->next; + totalsize += size; + } + free(path); + free(dirlist); /* allocated by scandir() with malloc() */ + return totalsize; +} + +/* Returns sizeof(struct cramfs_super), which includes the root inode. */ +static unsigned int write_superblock(struct entry *root, char *base, int size) +{ + struct cramfs_super *super = (struct cramfs_super *) base; + unsigned int offset = sizeof(struct cramfs_super) + image_length; + + if (opt_pad) { + offset += opt_pad; + } + + super->magic = CRAMFS_MAGIC; + super->flags = CRAMFS_FLAG_FSID_VERSION_2 | CRAMFS_FLAG_SORTED_DIRS; + if (opt_holes) + super->flags |= CRAMFS_FLAG_HOLES; + if (image_length > 0) + super->flags |= CRAMFS_FLAG_SHIFTED_ROOT_OFFSET; + super->size = size; + memcpy(super->signature, CRAMFS_SIGNATURE, sizeof(super->signature)); + + super->fsid.crc = crc32(0L, Z_NULL, 0); + super->fsid.edition = opt_edition; + super->fsid.blocks = total_blocks; + super->fsid.files = total_nodes; + + memset(super->name, 0x00, sizeof(super->name)); + if (opt_name) + strncpy(super->name, opt_name, sizeof(super->name)); + else + strncpy(super->name, "Compressed", sizeof(super->name)); + + super->root.mode = root->mode; + super->root.uid = root->uid; + super->root.gid = root->gid; + super->root.size = root->size; + super->root.offset = offset >> 2; + + return offset; +} + +static void set_data_offset(struct entry *entry, char *base, unsigned long offset) +{ + struct cramfs_inode *inode = (struct cramfs_inode *) (base + entry->dir_offset); + if (offset >= (1 << (2 + CRAMFS_OFFSET_WIDTH))) { + fprintf(stderr, _("filesystem too big. Exiting.\n")); + exit(8); + } + inode->offset = (offset >> 2); +} + + +/* + * We do a width-first printout of the directory + * entries, using a stack to remember the directories + * we've seen. + */ +#define MAXENTRIES (100) +static unsigned int write_directory_structure(struct entry *entry, char *base, unsigned int offset) +{ + int stack_entries = 0; + struct entry *entry_stack[MAXENTRIES]; + + for (;;) { + int dir_start = stack_entries; + while (entry) { + struct cramfs_inode *inode = + (struct cramfs_inode *) (base + offset); + size_t len = strlen(entry->name); + + entry->dir_offset = offset; + + inode->mode = entry->mode; + inode->uid = entry->uid; + inode->gid = entry->gid; + inode->size = entry->size; + inode->offset = 0; + /* Non-empty directories, regfiles and symlinks will + write over inode->offset later. */ + + offset += sizeof(struct cramfs_inode); + total_nodes++; /* another node */ + memcpy(base + offset, entry->name, len); + /* Pad up the name to a 4-byte boundary */ + while (len & 3) { + *(base + offset + len) = '\0'; + len++; + } + inode->namelen = len >> 2; + offset += len; + + if (verbose) + printf(" %s\n", entry->name); + if (entry->child) { + if (stack_entries >= MAXENTRIES) { + fprintf(stderr, + _("Exceeded MAXENTRIES. Raise" + " this value in mkcramfs.c " + "and recompile. Exiting.\n") + ); + exit(8); + } + entry_stack[stack_entries] = entry; + stack_entries++; + } + entry = entry->next; + } + + /* + * Reverse the order the stack entries pushed during + * this directory, for a small optimization of disk + * access in the created fs. This change makes things + * `ls -UR' order. + */ + { + struct entry **lo = entry_stack + dir_start; + struct entry **hi = entry_stack + stack_entries; + struct entry *tmp; + + while (lo < --hi) { + tmp = *lo; + *lo++ = *hi; + *hi = tmp; + } + } + + /* Pop a subdirectory entry from the stack, and recurse. */ + if (!stack_entries) + break; + stack_entries--; + entry = entry_stack[stack_entries]; + + set_data_offset(entry, base, offset); + if (verbose) + printf("'%s':\n", entry->name); + entry = entry->child; + } + return offset; +} + +static int is_zero(char const *begin, unsigned len) +{ + if (opt_holes) + /* Returns non-zero iff the first LEN bytes from BEGIN are + all NULs. */ + return (len-- == 0 || + (begin[0] == '\0' && + (len-- == 0 || + (begin[1] == '\0' && + (len-- == 0 || + (begin[2] == '\0' && + (len-- == 0 || + (begin[3] == '\0' && + memcmp(begin, begin + 4, len) == 0)))))))); + else + /* Never create holes. */ + return 0; +} + +/* + * One 4-byte pointer per block and then the actual blocked + * output. The first block does not need an offset pointer, + * as it will start immediately after the pointer block; + * so the i'th pointer points to the end of the i'th block + * (i.e. the start of the (i+1)'th block or past EOF). + * + * Note that size > 0, as a zero-sized file wouldn't ever + * have gotten here in the first place. + */ +static unsigned int do_compress(char *base, unsigned int offset, char const *name, char *uncompressed, unsigned int size) +{ + unsigned long original_size = size; + unsigned long original_offset = offset; + unsigned long new_size; + unsigned long blocks = (size - 1) / blksize + 1; + unsigned long curr = offset + 4 * blocks; + int change; + + total_blocks += blocks; + + do { + unsigned long len = 2 * blksize; + unsigned int input = size; + if (input > blksize) + input = blksize; + size -= input; + if (!is_zero (uncompressed, input)) { + compress(base + curr, &len, uncompressed, input); + curr += len; + } + uncompressed += input; + + if (len > blksize*2) { + /* (I don't think this can happen with zlib.) */ + printf(_("AIEEE: block \"compressed\" to > " + "2*blocklength (%ld)\n"), + len); + exit(8); + } + + *(u32 *) (base + offset) = curr; + offset += 4; + } while (size); + + curr = (curr + 3) & ~3; + new_size = curr - original_offset; + /* TODO: Arguably, original_size in these 2 lines should be + st_blocks * 512. But if you say that then perhaps + administrative data should also be included in both. */ + change = new_size - original_size; + if (verbose) + printf(_("%6.2f%% (%+d bytes)\t%s\n"), + (change * 100) / (double) original_size, change, name); + + return curr; +} + + +/* + * Traverse the entry tree, writing data for every item that has + * non-null entry->compressed (i.e. every symlink and non-empty + * regfile). + */ +static unsigned int write_data(struct entry *entry, char *base, unsigned int offset) +{ + do { + if (entry->uncompressed) { + if(entry->same) { + set_data_offset(entry, base, entry->same->offset); + entry->offset=entry->same->offset; + } else { + set_data_offset(entry, base, offset); + entry->offset=offset; + offset = do_compress(base, offset, entry->name, entry->uncompressed, entry->size); + } + } + else if (entry->child) + offset = write_data(entry->child, base, offset); + entry=entry->next; + } while (entry); + return offset; +} + +static unsigned int write_file(char *file, char *base, unsigned int offset) +{ + int fd; + char *buf; + + fd = open(file, O_RDONLY); + if (fd < 0) { + perror(file); + exit(8); + } + buf = mmap(NULL, image_length, PROT_READ, MAP_PRIVATE, fd, 0); + memcpy(base + offset, buf, image_length); + munmap(buf, image_length); + close (fd); + /* Pad up the image_length to a 4-byte boundary */ + while (image_length & 3) { + *(base + offset + image_length) = '\0'; + image_length++; + } + return (offset + image_length); +} + +/* + * Maximum size fs you can create is roughly 256MB. (The last file's + * data must begin within 256MB boundary but can extend beyond that.) + * + * Note that if you want it to fit in a ROM then you're limited to what the + * hardware and kernel can support (64MB?). + */ +#define MAXFSLEN ((((1 << CRAMFS_OFFSET_WIDTH) - 1) << 2) /* offset */ \ + + (1 << CRAMFS_SIZE_WIDTH) - 1 /* filesize */ \ + + (1 << CRAMFS_SIZE_WIDTH) * 4 / PAGE_CACHE_SIZE /* block pointers */ ) + + +/* + * Usage: + * + * mkcramfs directory-name outfile + * + * where "directory-name" is simply the root of the directory + * tree that we want to generate a compressed filesystem out + * of. + */ +int main(int argc, char **argv) +{ + struct stat st; /* used twice... */ + struct entry *root_entry; + char *rom_image; + ssize_t offset, written; + int fd; + /* initial guess (upper-bound) of required filesystem size */ + loff_t fslen_ub = sizeof(struct cramfs_super); + char const *dirname, *outfile; + u32 crc = crc32(0L, Z_NULL, 0); + int c; /* for getopt */ + + total_blocks = 0; + + if (argc) { + char *p; + progname = argv[0]; + if ((p = strrchr(progname, '/')) != NULL) + progname = p+1; + } + + /* command line options */ + while ((c = getopt(argc, argv, "hEe:i:n:psVvz")) != EOF) { + switch (c) { + case 'h': + usage(0); + case 'E': + opt_errors = 1; + break; + case 'e': + opt_edition = atoi(optarg); + break; + case 'i': + opt_image = optarg; + if (lstat(opt_image, &st) < 0) { + perror(opt_image); + exit(16); + } + image_length = st.st_size; /* may be padded later */ + fslen_ub += (image_length + 3); /* 3 is for padding */ + break; + case 'n': + opt_name = optarg; + break; + case 'p': + opt_pad = PAD_SIZE; + fslen_ub += PAD_SIZE; + break; + case 's': + /* old option, ignored */ + break; + case 'V': + printf(_("%s from %s\n"), + progname, util_linux_version); + exit(0); + case 'v': + verbose = 1; + break; + case 'z': + opt_holes = 1; + break; + } + } + + if ((argc - optind) != 2) + usage(16); + dirname = argv[optind]; + outfile = argv[optind + 1]; + + if (stat(dirname, &st) < 0) { + perror(dirname); + exit(16); + } + fd = open(outfile, O_WRONLY | O_CREAT | O_TRUNC, 0666); + + root_entry = calloc(1, sizeof(struct entry)); + if (!root_entry) { + perror(NULL); + exit(8); + } + root_entry->mode = st.st_mode; + root_entry->uid = st.st_uid; + root_entry->gid = st.st_gid; + + root_entry->size = parse_directory(root_entry, dirname, &root_entry->child, &fslen_ub); + + /* always allocate a multiple of blksize bytes because that's + what we're going to write later on */ + fslen_ub = ((fslen_ub - 1) | (blksize - 1)) + 1; + + if (fslen_ub > MAXFSLEN) { + fprintf(stderr, + _("warning: guestimate of required size (upper bound) " + "is %LdMB, but maximum image size is %uMB. " + "We might die prematurely.\n"), + fslen_ub >> 20, + MAXFSLEN >> 20); + fslen_ub = MAXFSLEN; + } + + /* find duplicate files. TODO: uses the most inefficient algorithm + possible. */ + eliminate_doubles(root_entry,root_entry); + + /* TODO: Why do we use a private/anonymous mapping here + followed by a write below, instead of just a shared mapping + and a couple of ftruncate calls? Is it just to save us + having to deal with removing the file afterwards? If we + really need this huge anonymous mapping, we ought to mmap + in smaller chunks, so that the user doesn't need nn MB of + RAM free. If the reason is to be able to write to + un-mmappable block devices, then we could try shared mmap + and revert to anonymous mmap if the shared mmap fails. */ + rom_image = mmap(NULL, + fslen_ub?fslen_ub:1, + PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, + -1, 0); + + if (-1 == (int) (long) rom_image) { + perror("ROM image map"); + exit(8); + } + + /* Skip the first opt_pad bytes for boot loader code */ + offset = opt_pad; + memset(rom_image, 0x00, opt_pad); + + /* Skip the superblock and come back to write it later. */ + offset += sizeof(struct cramfs_super); + + /* Insert a file image. */ + if (opt_image) { + if (verbose) + printf(_("Including: %s\n"), opt_image); + offset = write_file(opt_image, rom_image, offset); + } + + offset = write_directory_structure(root_entry->child, rom_image, offset); + if (verbose) + printf(_("Directory data: %d bytes\n"), offset); + + offset = write_data(root_entry, rom_image, offset); + + /* We always write a multiple of blksize bytes, so that + losetup works. */ + offset = ((offset - 1) | (blksize - 1)) + 1; + if (verbose) + printf(_("Everything: %d kilobytes\n"), offset >> 10); + + /* Write the superblock now that we can fill in all of the fields. */ + write_superblock(root_entry, rom_image+opt_pad, offset); + if (verbose) + printf(_("Super block: %d bytes\n"), + sizeof(struct cramfs_super)); + + /* Put the checksum in. */ + crc = crc32(crc, (rom_image+opt_pad), (offset-opt_pad)); + ((struct cramfs_super *) (rom_image+opt_pad))->fsid.crc = crc; + if (verbose) + printf(_("CRC: %x\n"), crc); + + /* Check to make sure we allocated enough space. */ + if (fslen_ub < offset) { + fprintf(stderr, + _("not enough space allocated for ROM image " + "(%Ld allocated, %d used)\n"), + fslen_ub, offset); + exit(8); + } + + written = write(fd, rom_image, offset); + if (written < 0) { + perror("ROM image"); + exit(8); + } + if (offset != written) { + fprintf(stderr, _("ROM image write failed (%d %d)\n"), + written, offset); + exit(8); + } + + /* (These warnings used to come at the start, but they scroll off the + screen too quickly.) */ + if (warn_namelen) /* (can't happen when reading from ext2fs) */ + fprintf(stderr, /* bytes, not chars: think UTF8. */ + _("warning: filenames truncated to 255 bytes.\n")); + if (warn_skip) + fprintf(stderr, + _("warning: files were skipped due to errors.\n")); + if (warn_size) + fprintf(stderr, + _("warning: file sizes truncated to %luMB " + "(minus 1 byte).\n"), + 1L << (CRAMFS_SIZE_WIDTH - 20)); + if (warn_uid) /* (not possible with current Linux versions) */ + fprintf(stderr, + _("warning: uids truncated to %u bits. " + "(This may be a security concern.)\n"), + CRAMFS_UID_WIDTH); + if (warn_gid) + fprintf(stderr, + _("warning: gids truncated to %u bits. " + "(This may be a security concern.)\n"), + CRAMFS_GID_WIDTH); + if (warn_dev) + fprintf(stderr, + _("WARNING: device numbers truncated to %u bits. " + "This almost certainly means\n" + "that some device files will be wrong.\n"), + CRAMFS_OFFSET_WIDTH); + if (opt_errors && + (warn_namelen|warn_skip|warn_size|warn_uid|warn_gid|warn_dev)) + exit(8); + return 0; +} diff --git a/fdisk/cfdisk.8 b/fdisk/cfdisk.8 index fc956d57..f46be0ef 100644 --- a/fdisk/cfdisk.8 +++ b/fdisk/cfdisk.8 @@ -419,6 +419,7 @@ command (above) for more information on the print formats. 3: cannot get geometry; 4: bad partition table on disk. .SH "SEE ALSO" .BR fdisk (8), +.BR mkfs (8), .BR parted (8), .BR sfdisk (8) .SH BUGS diff --git a/fdisk/fdisk.8 b/fdisk/fdisk.8 index fda58057..3ee111b4 100644 --- a/fdisk/fdisk.8 +++ b/fdisk/fdisk.8 @@ -227,5 +227,6 @@ The option `dump partition table to file' is missing. .\" and many others. .SH "SEE ALSO" .BR cfdisk (8), +.BR mkfs (8), .BR parted (8), .BR sfdisk (8) diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 8000bd27..4d13678a 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -176,7 +176,8 @@ uint heads, int sun_label = 0; /* looking at sun disklabel */ int sgi_label = 0; /* looking at sgi disklabel */ int aix_label = 0; /* looking at aix disklabel */ -int osf_label = 0; /* looking at osf disklabel */ +int osf_label = 0; /* looking at OSF/1 disklabel */ +int possibly_osf_label = 0; jmp_buf listingbuf; @@ -337,7 +338,7 @@ menu(void) { puts(_(" w write table to disk and exit")); puts(_(" x extra functionality (experts only)")); } - else if(sgi_label) { + else if (sgi_label) { puts(_("Command action")); puts(_(" a select bootable partition")); /* sgi flavour */ puts(_(" b edit bootfile entry")); /* sgi */ @@ -355,7 +356,7 @@ menu(void) { puts(_(" v verify the partition table")); puts(_(" w write table to disk and exit")); } - else if(aix_label) { + else if (aix_label) { puts(_("Command action")); puts(_(" m print this menu")); puts(_(" o create a new empty DOS partition table")); @@ -403,7 +404,7 @@ xmenu(void) { puts(_(" w write table to disk and exit")); puts(_(" y change number of physical cylinders")); /*sun*/ } - else if(sgi_label) { + else if (sgi_label) { puts(_("Command action")); puts(_(" b move beginning of data in a partition")); /* !sun */ puts(_(" c change number of cylinders")); @@ -419,7 +420,7 @@ xmenu(void) { puts(_(" v verify the partition table")); puts(_(" w write table to disk and exit")); } - else if(aix_label) { + else if (aix_label) { puts(_("Command action")); puts(_(" b move beginning of data in a partition")); /* !sun */ puts(_(" c change number of cylinders")); @@ -710,7 +711,7 @@ create_doslabel(void) { "content won't be recoverable.\n\n")); sun_nolabel(); /* otherwise always recognised as sun */ sgi_nolabel(); /* otherwise always recognised as sgi */ - aix_label = osf_label = 0; + aix_label = osf_label = possibly_osf_label = 0; partitions = 4; for (i = 510-64; i < 510; i++) @@ -856,6 +857,18 @@ get_boot(enum action what) { partitions = 4; + for (i = 0; i < 4; i++) { + struct pte *pe = &ptes[i]; + + pe->part_table = pt_offset(MBRbuffer, i); + pe->ext_pointer = NULL; + pe->offset = 0; + pe->sectorbuffer = MBRbuffer; + pe->changed = (what == create_empty_dos); + } + + memset(MBRbuffer, 0, 512); + if (what == create_empty_dos) goto got_dos_table; /* skip reading disk */ if (what == create_empty_sun) @@ -867,7 +880,8 @@ get_boot(enum action what) { return 1; fatal(unable_to_open); } else - printf(_("You will not be able to write the partition table.\n")); + printf(_("You will not be able to write " + "the partition table.\n")); } if (512 != read(fd, MBRbuffer, 512)) { @@ -891,8 +905,15 @@ got_table: if (check_aix_label()) return 0; - if (check_osf_label()) - return 0; + if (check_osf_label()) { + possibly_osf_label = 1; + if (!valid_part_table_flag(MBRbuffer)) { + osf_label = 1; + return 0; + } + printf(_("This disk has both DOS and BSD magic.\n" + "Give the 'b' command to go to BSD mode.\n")); + } got_dos_table: @@ -900,8 +921,9 @@ got_dos_table: switch(what) { case fdisk: fprintf(stderr, - _("Device contains neither a valid DOS partition" - " table, nor Sun, SGI or OSF disklabel\n")); + _("Device contains neither a valid DOS " + "partition table, nor Sun, SGI or OSF " + "disklabel\n")); #ifdef __sparc__ create_sunlabel(); #else @@ -924,16 +946,6 @@ got_dos_table: warn_cylinders(); warn_geometry(); - for (i = 0; i < 4; i++) { - struct pte *pe = &ptes[i]; - - pe->part_table = pt_offset(MBRbuffer, i); - pe->ext_pointer = NULL; - pe->offset = 0; - pe->sectorbuffer = MBRbuffer; - pe->changed = (what == create_empty_dos); - } - for (i = 0; i < 4; i++) { struct pte *pe = &ptes[i]; @@ -1229,7 +1241,7 @@ delete_partition(int i) { /* the first logical in a longer chain */ struct pte *pe = &ptes[5]; - if(pe->part_table) /* prevent SEGFAULT */ + if (pe->part_table) /* prevent SEGFAULT */ set_start_sect(pe->part_table, get_partition_start(pe) - extended_offset); @@ -1450,7 +1462,7 @@ fix_chain_of_logicals(void) { /* Stage 1: sort sectors but leave sector of part 4 */ /* (Its sector is the global extended_offset.) */ stage1: - for(j = 5; j < partitions-1; j++) { + for (j = 5; j < partitions-1; j++) { oj = ptes[j].offset; ojj = ptes[j+1].offset; if (oj > ojj) { @@ -1470,7 +1482,7 @@ fix_chain_of_logicals(void) { /* Stage 2: sort starting sectors */ stage2: - for(j = 4; j < partitions-1; j++) { + for (j = 4; j < partitions-1; j++) { pj = ptes[j].part_table; pjj = ptes[j+1].part_table; sj = get_start_sect(pj); @@ -1488,7 +1500,7 @@ fix_chain_of_logicals(void) { } /* Probably something was changed */ - for(j = 4; j < partitions; j++) + for (j = 4; j < partitions; j++) ptes[j].changed = 1; } @@ -1497,7 +1509,7 @@ fix_partition_table_order(void) { struct pte *pei, *pek; int i,k; - if(!wrong_p_order(NULL)) { + if (!wrong_p_order(NULL)) { printf(_("Nothing to do. Ordering is correct already.\n\n")); return; } @@ -1957,7 +1969,7 @@ write_table(void) { if (dos_label) { for (i=0; i<3; i++) - if(ptes[i].changed) + if (ptes[i].changed) ptes[3].changed = 1; for (i = 3; i < partitions; i++) { struct pte *pe = &ptes[i]; @@ -1975,7 +1987,7 @@ write_table(void) { int needw = 0; for (i=0; i<8; i++) - if(ptes[i].changed) + if (ptes[i].changed) needw = 1; if (needw) sun_write_table(); @@ -2001,7 +2013,7 @@ reread_partition_table(int leave) { twice, the second time works. - biro@yggdrasil.com */ sync(); sleep(2); - if((i = ioctl(fd, BLKRRPART)) != 0) + if ((i = ioctl(fd, BLKRRPART)) != 0) error = errno; } @@ -2123,7 +2135,7 @@ xselect(void) { x_list_table(1); break; case 'f': - if(dos_label) + if (dos_label) fix_partition_table_order(); break; case 'g': @@ -2247,7 +2259,7 @@ try(char *device, int user_specified) { /* Ignore other errors, since we try IDE and SCSI hard disks which may not be installed on the system. */ - if(errno == EACCES) { + if (errno == EACCES) { fprintf(stderr, _("Cannot open %s\n"), device); return; } @@ -2272,7 +2284,7 @@ tryprocpt(void) { if (sscanf (line, " %d %d %d %[^\n ]", &ma, &mi, &sz, ptname) != 4) continue; - for(s = ptname; *s; s++); + for (s = ptname; *s; s++); if (isdigit(s[-1])) continue; snprintf(devname, sizeof(devname), "/dev/%s", ptname); @@ -2336,7 +2348,8 @@ main(int argc, char **argv) { } #if 0 - printf(_("This kernel finds the sector size itself - -b option ignored\n")); + printf(_("This kernel finds the sector size itself - " + "-b option ignored\n")); #else if (user_set_sector_size && argc-optind != 1) printf(_("Warning: the -b (set sector size) option should" @@ -2352,7 +2365,7 @@ main(int argc, char **argv) { variable `k' might be clobbered by `longjmp' */ dummy(&k); listing = 1; - for(k=optind; k - i18n/nls 20000101 - David Huggins-Daines - Better - support for OSF/1 disklabels on Alpha. Also fixed unaligned - accesses in alpha_bootblock_checksum() + support for OSF/1 disklabels on Alpha. + Also fixed unaligned accesses in alpha_bootblock_checksum() */ #include @@ -73,7 +73,8 @@ static int xbsd_get_part_index (int max); static int xbsd_check_new_partition (int *i); static void xbsd_list_types (void); static u_short xbsd_dkcksum (struct xbsd_disklabel *lp); -static int xbsd_initlabel (struct partition *p, struct xbsd_disklabel *d, int pindex); +static int xbsd_initlabel (struct partition *p, struct xbsd_disklabel *d, + int pindex); static int xbsd_readlabel (struct partition *p, struct xbsd_disklabel *d); static int xbsd_writelabel (struct partition *p, struct xbsd_disklabel *d); static void sync_disks (void); @@ -101,22 +102,26 @@ static struct xbsd_disklabel xbsd_dlabel; #define bsd_cround(n) \ (display_in_cyl_units ? ((n)/xbsd_dlabel.d_secpercyl) + 1 : (n)) +/* + * Test whether the whole disk has BSD disk label magic. + * + * Note: often reformatting with DOS-type label leaves the BSD magic, + * so this does not mean that there is a BSD disk label. + */ int check_osf_label(void) { - osf_label = 0; - if (xbsd_readlabel (NULL, &xbsd_dlabel) == 0) - return 0; - osf_label = 1; - return 1; + if (xbsd_readlabel (NULL, &xbsd_dlabel) == 0) + return 0; + return 1; } int btrydev (char * dev) { - if (xbsd_readlabel (NULL, &xbsd_dlabel) == 0) - return -1; - printf(_("\nBSD label for device: %s\n"), dev); - xbsd_print_disklabel (0); - return 0; + if (xbsd_readlabel (NULL, &xbsd_dlabel) == 0) + return -1; + printf(_("\nBSD label for device: %s\n"), dev); + xbsd_print_disklabel (0); + return 0; } static void @@ -598,152 +603,159 @@ xbsd_get_part_index (int max) } static int -xbsd_check_new_partition (int *i) -{ - int t; +xbsd_check_new_partition (int *i) { - if (xbsd_dlabel.d_npartitions == BSD_MAXPARTITIONS) - { - for (t=0; t < BSD_MAXPARTITIONS; t++) - if (xbsd_dlabel.d_partitions[t].p_size == 0) - break; + /* room for more? various BSD flavours have different maxima */ + if (xbsd_dlabel.d_npartitions == BSD_MAXPARTITIONS) { + int t; - if (t == BSD_MAXPARTITIONS) - { - fprintf (stderr, _("The maximum number of partitions has been created\n")); - return 0; - } - } - *i = xbsd_get_part_index (BSD_MAXPARTITIONS); + for (t = 0; t < BSD_MAXPARTITIONS; t++) + if (xbsd_dlabel.d_partitions[t].p_size == 0) + break; - if (*i >= xbsd_dlabel.d_npartitions) - xbsd_dlabel.d_npartitions = (*i) + 1; + if (t == BSD_MAXPARTITIONS) { + fprintf (stderr, _("The maximum number of partitions " + "has been created\n")); + return 0; + } + } - if (xbsd_dlabel.d_partitions[*i].p_size != 0) - { - fprintf (stderr, _("This partition already exists.\n")); - return 0; - } - return 1; + *i = xbsd_get_part_index (BSD_MAXPARTITIONS); + + if (*i >= xbsd_dlabel.d_npartitions) + xbsd_dlabel.d_npartitions = (*i) + 1; + + if (xbsd_dlabel.d_partitions[*i].p_size != 0) { + fprintf (stderr, _("This partition already exists.\n")); + return 0; + } + + return 1; } static void -xbsd_list_types (void) -{ - list_types (xbsd_fstypes); +xbsd_list_types (void) { + list_types (xbsd_fstypes); } static u_short -xbsd_dkcksum (struct xbsd_disklabel *lp) -{ - register u_short *start, *end; - register u_short sum = 0; +xbsd_dkcksum (struct xbsd_disklabel *lp) { + u_short *start, *end; + u_short sum = 0; - start = (u_short *)lp; - end = (u_short *)&lp->d_partitions[lp->d_npartitions]; - while (start < end) - sum ^= *start++; - return (sum); + start = (u_short *) lp; + end = (u_short *) &lp->d_partitions[lp->d_npartitions]; + while (start < end) + sum ^= *start++; + return sum; } static int -xbsd_initlabel (struct partition *p, struct xbsd_disklabel *d, int pindex) -{ - struct xbsd_partition *pp; - struct geom g; +xbsd_initlabel (struct partition *p, struct xbsd_disklabel *d, int pindex) { + struct xbsd_partition *pp; + struct geom g; - get_geometry (fd, &g); - bzero (d, sizeof (struct xbsd_disklabel)); + get_geometry (fd, &g); + bzero (d, sizeof (struct xbsd_disklabel)); - d -> d_magic = BSD_DISKMAGIC; + d -> d_magic = BSD_DISKMAGIC; - if (strncmp (disk_device, "/dev/sd", 7) == 0) - d -> d_type = BSD_DTYPE_SCSI; - else - d -> d_type = BSD_DTYPE_ST506; + if (strncmp (disk_device, "/dev/sd", 7) == 0) + d -> d_type = BSD_DTYPE_SCSI; + else + d -> d_type = BSD_DTYPE_ST506; #if 0 /* not used (at least not written to disk) by NetBSD/i386 1.0 */ - d -> d_subtype = BSD_DSTYPE_INDOSPART & pindex; + d -> d_subtype = BSD_DSTYPE_INDOSPART & pindex; #endif #if !defined (__alpha__) - d -> d_flags = BSD_D_DOSPART; + d -> d_flags = BSD_D_DOSPART; #else - d -> d_flags = 0; + d -> d_flags = 0; #endif - d -> d_secsize = SECTOR_SIZE; /* bytes/sector */ - d -> d_nsectors = g.sectors; /* sectors/track */ - d -> d_ntracks = g.heads; /* tracks/cylinder (heads) */ - d -> d_ncylinders = g.cylinders; - d -> d_secpercyl = g.sectors * g.heads; /* sectors/cylinder */ - if (d -> d_secpercyl == 0) - d -> d_secpercyl = 1; /* avoid segfaults */ - d -> d_secperunit = d -> d_secpercyl * d -> d_ncylinders; - - d -> d_rpm = 3600; - d -> d_interleave = 1; - d -> d_trackskew = 0; - d -> d_cylskew = 0; - d -> d_headswitch = 0; - d -> d_trkseek = 0; - - d -> d_magic2 = BSD_DISKMAGIC; - d -> d_bbsize = BSD_BBSIZE; - d -> d_sbsize = BSD_SBSIZE; + d -> d_secsize = SECTOR_SIZE; /* bytes/sector */ + d -> d_nsectors = g.sectors; /* sectors/track */ + d -> d_ntracks = g.heads; /* tracks/cylinder (heads) */ + d -> d_ncylinders = g.cylinders; + d -> d_secpercyl = g.sectors * g.heads;/* sectors/cylinder */ + if (d -> d_secpercyl == 0) + d -> d_secpercyl = 1; /* avoid segfaults */ + d -> d_secperunit = d -> d_secpercyl * d -> d_ncylinders; + + d -> d_rpm = 3600; + d -> d_interleave = 1; + d -> d_trackskew = 0; + d -> d_cylskew = 0; + d -> d_headswitch = 0; + d -> d_trkseek = 0; + + d -> d_magic2 = BSD_DISKMAGIC; + d -> d_bbsize = BSD_BBSIZE; + d -> d_sbsize = BSD_SBSIZE; #if !defined (__alpha__) - d -> d_npartitions = 4; - pp = &d -> d_partitions[2]; /* Partition C should be the NetBSD partition */ - pp -> p_offset = get_start_sect(p); - pp -> p_size = get_nr_sects(p); - pp -> p_fstype = BSD_FS_UNUSED; - pp = &d -> d_partitions[3]; /* Partition D should be the whole disk */ - pp -> p_offset = 0; - pp -> p_size = d -> d_secperunit; - pp -> p_fstype = BSD_FS_UNUSED; + d -> d_npartitions = 4; + pp = &d -> d_partitions[2]; /* Partition C should be + the NetBSD partition */ + pp -> p_offset = get_start_sect(p); + pp -> p_size = get_nr_sects(p); + pp -> p_fstype = BSD_FS_UNUSED; + pp = &d -> d_partitions[3]; /* Partition D should be + the whole disk */ + pp -> p_offset = 0; + pp -> p_size = d -> d_secperunit; + pp -> p_fstype = BSD_FS_UNUSED; #elif defined (__alpha__) - d -> d_npartitions = 3; - pp = &d -> d_partitions[2]; /* Partition C should be the whole disk */ - pp -> p_offset = 0; - pp -> p_size = d -> d_secperunit; - pp -> p_fstype = BSD_FS_UNUSED; + d -> d_npartitions = 3; + pp = &d -> d_partitions[2]; /* Partition C should be + the whole disk */ + pp -> p_offset = 0; + pp -> p_size = d -> d_secperunit; + pp -> p_fstype = BSD_FS_UNUSED; #endif - return 1; + return 1; } +/* + * Read a xbsd_disklabel from sector 0 or from the starting sector of p. + * If it has the right magic, return 1. + */ static int xbsd_readlabel (struct partition *p, struct xbsd_disklabel *d) { - int t, sector; + int t, sector; + /* p is used only to get the starting sector */ #if !defined (__alpha__) - sector = (p ? get_start_sect(p) : 0); + sector = (p ? get_start_sect(p) : 0); #elif defined (__alpha__) - sector = 0; + sector = 0; #endif - if (ext2_llseek (fd, (ext2_loff_t) sector * SECTOR_SIZE, SEEK_SET) == -1) - fatal (unable_to_seek); - if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE)) - fatal (unable_to_read); + if (ext2_llseek (fd, (ext2_loff_t) sector * SECTOR_SIZE, SEEK_SET) == -1) + fatal (unable_to_seek); + if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE)) + fatal (unable_to_read); - bcopy (&disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET], - d, sizeof (struct xbsd_disklabel)); + bcopy (&disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET], + d, sizeof (struct xbsd_disklabel)); - for (t = d -> d_npartitions; t < BSD_MAXPARTITIONS; t++) - { - d -> d_partitions[t].p_size = 0; - d -> d_partitions[t].p_offset = 0; - d -> d_partitions[t].p_fstype = BSD_FS_UNUSED; - } - if (d -> d_magic != BSD_DISKMAGIC || d -> d_magic2 != BSD_DISKMAGIC) - return 0; + if (d -> d_magic != BSD_DISKMAGIC || d -> d_magic2 != BSD_DISKMAGIC) + return 0; - if (d -> d_npartitions > BSD_MAXPARTITIONS) - fprintf (stderr, _("Warning: too many partitions (%d, maximum is %d).\n"), - d -> d_npartitions, BSD_MAXPARTITIONS); - return 1; + for (t = d -> d_npartitions; t < BSD_MAXPARTITIONS; t++) { + d -> d_partitions[t].p_size = 0; + d -> d_partitions[t].p_offset = 0; + d -> d_partitions[t].p_fstype = BSD_FS_UNUSED; + } + + if (d -> d_npartitions > BSD_MAXPARTITIONS) + fprintf (stderr, _("Warning: too many partitions " + "(%d, maximum is %d).\n"), + d -> d_npartitions, BSD_MAXPARTITIONS); + return 1; } static int diff --git a/fdisk/fdiskbsdlabel.h b/fdisk/fdiskbsdlabel.h index 2421585e..279733e8 100644 --- a/fdisk/fdiskbsdlabel.h +++ b/fdisk/fdiskbsdlabel.h @@ -33,12 +33,12 @@ #include /* for __u32, __u16, __u8, __s16 */ -#ifndef BSD_DISKMAGIC /* perhaps from */ +#ifndef BSD_DISKMAGIC #define BSD_DISKMAGIC ((__u32) 0x82564557) #endif #ifndef BSD_MAXPARTITIONS -#define BSD_MAXPARTITIONS 8 +#define BSD_MAXPARTITIONS 16 #endif #define BSD_LINUX_BOOTDIR "/usr/ucb/mdec" diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c index 0036c109..25f07b52 100644 --- a/fdisk/fdisksunlabel.c +++ b/fdisk/fdisksunlabel.c @@ -678,8 +678,8 @@ sun_list_table(int xtra) { __u32 start = SSWAP32(sunlabel->partitions[i].start_cylinder) * heads * sectors; __u32 len = SSWAP32(sunlabel->partitions[i].num_sectors); printf( - "%*s%-2d %c%c %9ld %9ld %9ld%c %2x %s\n", -/* device */ w, disk_device, i + 1, + "%s %c%c %9ld %9ld %9ld%c %2x %s\n", +/* device */ partname(disk_device, i+1, w), /* flags */ (sunlabel->infos[i].flags & 0x01) ? 'u' : ' ', (sunlabel->infos[i].flags & 0x10) ? 'r' : ' ', /* start */ (long) scround(start), diff --git a/fdisk/partname.c b/fdisk/partname.c index b09b958a..e4bc42bc 100644 --- a/fdisk/partname.c +++ b/fdisk/partname.c @@ -33,9 +33,10 @@ partnamebf(char *dev, int pno, int lth, int bufsiz, char *bufp) { wp = strlen(p); if (lth) { - sprintf(bufp, "%*.*s%s%-2u", lth-wp-2, w, dev, p, pno); + snprintf(bufp, bufsiz, "%*.*s%s%-2u", + lth-wp-2, w, dev, p, pno); } else { - sprintf(bufp, "%.*s%s%-2u", w, dev, p, pno); + snprintf(bufp, bufsiz, "%.*s%s%-2u", w, dev, p, pno); } return bufp; } diff --git a/fdisk/sfdisk.8 b/fdisk/sfdisk.8 index c7b152e7..4947e2c4 100644 --- a/fdisk/sfdisk.8 +++ b/fdisk/sfdisk.8 @@ -521,4 +521,5 @@ A. E. Brouwer (aeb@cwi.nl) .SH "SEE ALSO" .BR cfdisk (8), .BR fdisk (8), +.BR mkfs (8), .BR parted (8) diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c index a3549028..52ebce52 100644 --- a/fdisk/sfdisk.c +++ b/fdisk/sfdisk.c @@ -1367,7 +1367,7 @@ extended_partition(char *dev, int fd, struct part_desc *ep, struct disk_desc *z) } #define BSD_DISKMAGIC (0x82564557UL) -#define BSD_MAXPARTITIONS 8 +#define BSD_MAXPARTITIONS 16 #define BSD_FS_UNUSED 0 typedef unsigned char u8; typedef unsigned short u16; @@ -1404,11 +1404,11 @@ bsd_partition(char *dev, int fd, struct part_desc *ep, struct disk_desc *z) { if (!(s = get_sector(dev,fd,start+1))) return; l = (struct bsd_disklabel *) (s->data); - if (l->d_magic != BSD_DISKMAGIC) + if (l->d_magic != BSD_DISKMAGIC || l->d_magic2 != BSD_DISKMAGIC) return; bp = bp0 = &l->d_partitions[0]; - while (bp - bp0 <= BSD_MAXPARTITIONS) { + while (bp - bp0 < BSD_MAXPARTITIONS && bp - bp0 < l->d_npartitions) { if (pno+1 >= SIZE(z->partitions)) { printf(_("too many partitions - ignoring those " "past nr (%d)\n"), pno-1); diff --git a/hwclock/Makefile b/hwclock/Makefile index 70ff6436..88aa50cd 100644 --- a/hwclock/Makefile +++ b/hwclock/Makefile @@ -16,9 +16,9 @@ SBIN= hwclock all: $(SBIN) -hwclock.o: hwclock.c shhopt.h +hwclock.o: hwclock.c hwclock.o cmos.o rtc.o kd.o: clock.h -hwclock: hwclock.o shhopt.o cmos.o rtc.o kd.o +hwclock: hwclock.o cmos.o rtc.o kd.o CWFLAGS := $(subst -Wmissing-prototypes,,$(CFLAGS)) diff --git a/hwclock/README.aeb b/hwclock/README.aeb deleted file mode 100644 index 3955f905..00000000 --- a/hwclock/README.aeb +++ /dev/null @@ -1,9 +0,0 @@ -This directory contains the hwclock stuff as fixed by me. -It should work on all architectures. - -Bryan has backported my changes to his original source, -so the present directory should be superfluous - -however, his code fails on my Sparc. -Will look at it later. - -Andries Brouwer - aeb@cwi.nl diff --git a/hwclock/README.shhopt-1.1 b/hwclock/README.shhopt-1.1 deleted file mode 100644 index 766d6cbd..00000000 --- a/hwclock/README.shhopt-1.1 +++ /dev/null @@ -1,155 +0,0 @@ -shhopt - library for parsing command line options. -================================================== - -This is a set of functions for parsing command line options. Both -traditional one-character options, and GNU-style --long-options are -supported. - - -What separates this from traditional getopt? --------------------------------------------- - -This library does more of the parsing for you. You set up a special -structure describing the names and types of the options you want your -program to support. In the structure you also give addresses of -variables to update or functions to call for the various -options. By calling optParseOptions, all options in argv are parsed -and removed from argv. What is left, are the non-optional arguments to -your program. - -The down-side of this, is that you won't be able to make a program -where the position of the options between the non-options are -significant. - - -Usage ------ - -To see how to use this library, take a look at the sample program -example.c. - -A brief explanation: - -To parse your command line, you need to create and initialize an array -of optStruct's. Each element in the array describes a long and short -version of an option and specifies what type of option it is and how -to handle it. - -The structure fields (see also shhopt.h): - - `shortName' is the short option name without the leading '-'. - - `longName' is the long option name without the leading "--". - - `type' specifies what type of option this is. (Does it expect an - argument? Is it a flag? If it takes an argument,what type should - it be?) - - `arg' is either a function to be called with the argument from - the commandline, or a pointer to a location in which to store - the value. - - `flags' indicates whether `arg' points to a function or a storage - location. - -The different argument types: - - `OPT_END' flags this as the last element in the options array. - - `OPT_FLAG' indicates an option that takes no arguments. If `arg' is - not a function pointer, the value of `arg' will be set to 1 if - this flag is found on the command line. - - `OPT_STRING' expects a string argument. - - `OPT_INT' expects an int argument. - - `OPT_UINT' expects an unsigned int argument. - - `OPT_LONG' expects a long argument. - - `OPT_ULONG' expects an unsigned long argument. - -The different flag types: - - `OPT_CALLFUNC' indicates that `arg' is a function pointer. If this - is not given, `arg' is taken as a pointer to a variable. - - -Notes ------ - -* A dash (`-') by itself is not taken as any kind of an option, as - several programs use this to indicate the special files stdin and - stdout. It is thus left as a normal argument to the program. - -* Two dashes (`--') as an argument, is taken to mean that the rest of - the arguments should not be scanned for options. This simplifies - giving names of files that start with a dash. - -* Short (one-character) options accept parameters in two ways, either - directly following the option in the same argv-entry, or in the next - argv-entry: - - -sPARAMETER - -s PARAMETER - -* Long options accept parameters in two ways: - - --long-option=PARAMETER - --long-option PARAMETER - - To follow the GNU-tradition, your program documentation should use - the first form. - -* Several one-character options may be combined after a single - dash. If any of the options requires a parameter, the rest of the - string is taken as this parameter. If there is no "rest of the - string", the next argument is taken as the parameter. - -* There is no support for floating point (double) arguments to - options. This is to avoid unnecessary linking with the math - library. See example.c for how to get around this by writing a - function converting a string argument to a double. - - -Portability ------------ - -If your libc lacks strtoul, you will need to link with GNU's -liberty, -that may be found by anonymous ftp to prep.ai.mit.edu:/pub/gnu - -The library has (more or less recently) been compiled and `tested' on -the following systems: - - IRIX Release 5.3 IP22 - Linux 1.2.9 - SunOS Release 4.1.3_U1 (-liberty needed) - ULTRIX V4.4 (Rev. 69) - -All compilations were done using GNU's gcc, and GNU's make. - - -Author ------- - -The program is written by - - Sverre H. Huseby - Maridalsvn. 122, leil. 101 - N-0461 Oslo - Norway - - sverrehu@ifi.uio.no - http://www.ifi.uio.no/~sverrehu/ - -You can use and copy this for free. If you decide to use it, please do -me three small favours: - - 1. Tell me! (E-mail, postcard, letter, whatever. If you wish - to give me something, please send a bottle of your - favourite beer (making this BeerWare)) - 2. Let your friends and favourite download site have a copy! - (with all files intact, please..) - 3. Report any bugs you find! - diff --git a/hwclock/adjtime.patch b/hwclock/adjtime.patch deleted file mode 100644 index 81d0430f..00000000 --- a/hwclock/adjtime.patch +++ /dev/null @@ -1,302 +0,0 @@ -From ao112@rgfn.epcc.edu Fri Mar 19 06:27:26 1999 -Received: from rgfn.epcc.edu (rgfn.epcc.edu [208.136.234.19]) by hera.cwi.nl with ESMTP - id GAA27711 for ; Fri, 19 Mar 1999 06:27:23 +0100 (MET) -Received: (from ao112@localhost) - by rgfn.epcc.edu (8.8.8/8.8.8) id WAA16797; - Thu, 18 Mar 1999 22:27:19 -0700 (MST) -Date: Thu, 18 Mar 1999 22:27:19 -0700 (MST) -Message-Id: <199903190527.WAA16797@rgfn.epcc.edu> -From: ao112@rgfn.epcc.edu (James P. Rutledge) -To: Andries.Brouwer@cwi.nl -Subject: Re: hwclock patch for drift_factor calculation improvement -Reply-To: ao112@rgfn.epcc.edu -Status: R - - - -> ->Could you perhaps make your patch relative to ->util-linux-2.9n (found in ftp.cwi.nl/pub/aeb/util-linux/util-linux-2.9n.tar.gz) ->? -> ->(The hwclock stuff has changed quite a bit since 2.9g.) -> ->Andries -> - -Andries; - -Per your request, the patch has been modified for util-linux version -2.9n, from the version for 2.9g. - -The program "hwclock" (version 2.4c) could give more accurate -values for the drift factor that it places in the file "/etc/adjtime". - -A patch to improve the accuracy is included. - -I have incorporated some error sources which were not compensated -for into the drift factor calculation (performed when the "--set" -or the "--systohc" option is used) to make it more accurate. -In particular, the sync delay between the desired set time and the -start of the hardware clock second, and the expected drift since the -last hardware clock adjustment are now accounted for in the drift -factor calculation. - -With this patch, if at any time an adjust operation is attempted and -the hardware clock is found to be not valid, then the calibration -and adjustment time is set to zero to insure that if the hardware -clock should coincidentally return to validity, a calibration is not -done with bad history data (hardware clock info bad) and an adjust is -not attempted on bad (but now passing validity test) hardware clock -data. (With this patch, a previous calibration time of zero causes -the calibration time to initialize with the current time, when the -hardware clock is set, but no change is made to the drift factor, -so in effect, an initial calibration is started over while the previous -drift factor is retained.) - -Also, the behavior in the case of an initially missing "/etc/adjtime" -file or such a file produced by the predecessor "clock" program has -been slightly improved as follows: - - With this patch, if the file exists but was produced by "clock" - and, thus, is given a zero calibration time, the drift factor is - not updated upon the first calibration by "hwclock", but is left alone - and is only changed by subsequent calibrations. - - With this patch, if the file does not exist and, thus, is given - a zero calibration time, the drift factor is set to zero upon the - first calibration by "hwclock" and is then changed, as appropriate, by - subsequent calibrations. - - Also, with this patch, an "--adjust" operation against a non-existent - "/etc/adjtime" file or one which has zero as the last adjustment - time will not change the hardware clock setting. - -A context diff for a patch to the file "hwclock.c" in the directory -"util-linux-2.9n/clock" is appended. -To use the patch, "cd" to the directory "util-linux-2.9n/clock". -Run "patch < bug-report", where "bug-report" is the file name of -this mail message, to get new file "hwclock.c" which contains the proposed -new version. This patch is, of course, submitted per the GPL and the -appropriate "NO WARRANTY OF ANY KIND" and "USE AT YOUR OWN RISK" -disclaimers apply. - -Note that the patch presumptuously changes the "hwclock.c" version -number from 2.4c to 2.4c1 in "hwclock.c". - -Jim - ------------------- Patch file follows ---------------------------- -*** hwclock.c Thu Mar 18 22:04:01 1999 ---- new-hwclock.c Thu Mar 18 22:03:18 1999 -*************** -*** 76,86 **** - - #include "clock.h" - #include "../version.h" - - #define MYNAME "hwclock" -! #define VERSION "2.4c" - - char *progname = MYNAME; - - /* The struct that holds our hardware access routines */ - struct clock_ops *ur; ---- 76,86 ---- - - #include "clock.h" - #include "../version.h" - - #define MYNAME "hwclock" -! #define VERSION "2.4c1" - - char *progname = MYNAME; - - /* The struct that holds our hardware access routines */ - struct clock_ops *ur; -*************** -*** 581,601 **** - - - static void - adjust_drift_factor(struct adjtime *adjtime_p, - const time_t nowtime, -! const bool hclock_valid, const time_t hclocktime ) { - /*--------------------------------------------------------------------------- - Update the drift factor in <*adjtime_p> to reflect the fact that the - Hardware Clock was calibrated to and before that was set - to . - -- We assume that the user has been doing regular drift adjustments -- using the drift factor in the adjtime file, so if and -- are different, that means the adjustment factor isn't -- quite right. -- - We record in the adjtime file the time at which we last calibrated - the clock so we can compute the drift rate each time we calibrate. - - EXCEPT: if is false, assume Hardware Clock was not set - before to anything meaningful and regular adjustments have not been ---- 581,598 ---- - - - static void - adjust_drift_factor(struct adjtime *adjtime_p, - const time_t nowtime, -! const bool hclock_valid, -! const time_t hclocktime, -! const float sync_delay ) { - /*--------------------------------------------------------------------------- - Update the drift factor in <*adjtime_p> to reflect the fact that the - Hardware Clock was calibrated to and before that was set - to . - - We record in the adjtime file the time at which we last calibrated - the clock so we can compute the drift rate each time we calibrate. - - EXCEPT: if is false, assume Hardware Clock was not set - before to anything meaningful and regular adjustments have not been -*************** -*** 604,629 **** - ----------------------------------------------------------------------------*/ - if (!hclock_valid) { - if (debug) - printf("Not adjusting drift factor because the Hardware Clock " - "previously contained garbage.\n"); - } else if ((hclocktime - adjtime_p->last_calib_time) < 23 * 60 * 60) { - if (debug) - printf("Not adjusting drift factor because it has been less than a " - "day since the last calibration.\n"); - } else { -! const float factor_adjust = -! ((float) (nowtime - hclocktime) -! / (hclocktime - adjtime_p->last_calib_time)) -! * 24 * 60 * 60; - - if (debug) -! printf("Clock drifted %d 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", -! (int) (nowtime - hclocktime), -! (int) (hclocktime - adjtime_p->last_calib_time), - adjtime_p->drift_factor, - factor_adjust ); - - adjtime_p->drift_factor += factor_adjust; - } ---- 601,642 ---- - ----------------------------------------------------------------------------*/ - if (!hclock_valid) { - if (debug) - printf("Not adjusting drift factor because the Hardware Clock " - "previously contained garbage.\n"); -+ } else if (adjtime_p->last_calib_time == 0) { -+ if (debug) -+ printf("Not adjusting drift factor because last calibration " -+ "time is zero,\nso history is bad and calibration startover " -+ "is necessary.\n"); - } else if ((hclocktime - adjtime_p->last_calib_time) < 23 * 60 * 60) { - if (debug) - printf("Not adjusting drift factor because it has been less than a " - "day since the last calibration.\n"); - } else { -! const float sec_per_day = 24.0 * 60.0 * 60.0; -! float atime_per_htime; /* adjusted time units per hardware time unit */ -! float adj_days; /* days since last adjustment (in hardware clock time) */ -! float cal_days; /* days since last calibration (in hardware clock time) */ -! float exp_drift; /* expected drift (sec) since last adjustment */ -! float unc_drift; /* uncorrected drift (sec) since last calibration */ -! float factor_adjust; /* amount to add to previous drift factor */ -! atime_per_htime = 1.0 + adjtime_p->drift_factor / sec_per_day; -! adj_days = (float)(hclocktime - adjtime_p->last_adj_time) / sec_per_day; -! exp_drift = adj_days * adjtime_p->drift_factor + adjtime_p->not_adjusted; -! unc_drift = (float)(nowtime - hclocktime) + sync_delay - exp_drift; -! cal_days = ((float)(adjtime_p->last_adj_time - adjtime_p->last_calib_time) -! + adjtime_p->not_adjusted) / (sec_per_day * atime_per_htime) -! + adj_days; -! factor_adjust = unc_drift / cal_days; - - if (debug) -! printf("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", -! unc_drift, -! (int) (nowtime - adjtime_p->last_calib_time), - adjtime_p->drift_factor, - factor_adjust ); - - adjtime_p->drift_factor += factor_adjust; - } -*************** -*** 764,773 **** ---- 777,794 ---- - - ----------------------------------------------------------------------------*/ - if (!hclock_valid) { - fprintf(stderr, "The Hardware Clock does not contain a valid time, " - "so we cannot adjust it.\n"); -+ adjtime_p->last_calib_time = 0; /* calibration startover is required */ -+ adjtime_p->last_adj_time = 0; -+ adjtime_p->not_adjusted = 0; -+ adjtime_p->dirty = TRUE; -+ } else if (adjtime_p->last_adj_time == 0) { -+ if (debug) -+ printf("Not setting clock because last adjustment time is zero, " -+ "so history is bad."); - } else { - int adjustment; - /* Number of seconds we must insert in the Hardware Clock */ - float retro; - /* Fraction of second we have to remove from clock after inserting -*************** -*** 878,888 **** - time_diff(read_time, startup_time)); - *retcode_p = 0; - } else if (set) { - set_hardware_clock_exact(set_time, startup_time, - universal, testing); -! adjust_drift_factor(&adjtime, set_time, hclock_valid, hclocktime); - *retcode_p = 0; - } else if (adjust) { - do_adjustment(&adjtime, hclock_valid, hclocktime, - read_time, universal, testing); - *retcode_p = 0; ---- 899,910 ---- - time_diff(read_time, startup_time)); - *retcode_p = 0; - } else if (set) { - set_hardware_clock_exact(set_time, startup_time, - universal, testing); -! adjust_drift_factor(&adjtime, set_time, hclock_valid, hclocktime, -! time_diff(read_time, startup_time)); - *retcode_p = 0; - } else if (adjust) { - do_adjustment(&adjtime, hclock_valid, hclocktime, - read_time, universal, testing); - *retcode_p = 0; -*************** -*** 898,908 **** - - set_hardware_clock_exact((time_t) reftime.tv_sec, reftime, - universal, testing); - *retcode_p = 0; - adjust_drift_factor(&adjtime, (time_t) reftime.tv_sec, hclock_valid, -! hclocktime); - } else if (hctosys) { - rc = set_system_clock(hclock_valid, hclocktime, testing); - if (rc != 0) { - printf("Unable to set system clock.\n"); - *retcode_p = 1; ---- 920,930 ---- - - set_hardware_clock_exact((time_t) reftime.tv_sec, reftime, - universal, testing); - *retcode_p = 0; - adjust_drift_factor(&adjtime, (time_t) reftime.tv_sec, hclock_valid, -! hclocktime, (float)(read_time.tv_usec / 1E6)); - } else if (hctosys) { - rc = set_system_clock(hclock_valid, hclocktime, testing); - if (rc != 0) { - printf("Unable to set system clock.\n"); - *retcode_p = 1; - diff --git a/hwclock/cmos.c b/hwclock/cmos.c index aed122cb..a5eec037 100644 --- a/hwclock/cmos.c +++ b/hwclock/cmos.c @@ -65,15 +65,18 @@ int inb(int c){ return 0; } #define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) #define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10) -/* The epoch. - Unix uses 1900 as epoch for a struct tm, and 1970 for a time_t. - But what was written to CMOS? - Digital DECstations use 1928 - this is on a mips - Digital Unix uses 1952. - Windows NT uses 1980. - The ARC console expects to boot Windows NT and uses 1980. - (But a Ruffian uses 1900, just like SRM.) - It is reported that ALPHA_PRE_V1_2_SRM_CONSOLE uses 1958. */ +/* + * The epoch. + * + * Unix uses 1900 as epoch for a struct tm, and 1970 for a time_t. + * But what was written to CMOS? + * Digital DECstations use 1928 - this is on a mips or alpha + * Digital Unix uses 1952, e.g. on AXPpxi33 + * Windows NT uses 1980. + * The ARC console expects to boot Windows NT and uses 1980. + * (But a Ruffian uses 1900, just like SRM.) + * It is reported that ALPHA_PRE_V1_2_SRM_CONSOLE uses 1958. + */ #define TM_EPOCH 1900 int cmos_epoch = 1900; @@ -154,12 +157,13 @@ set_cmos_epoch(int ARCconsole, int SRM) { return; } - /* The kernel source today says: read the year. If it is - in 11-43 then the epoch is 1980 (this covers 1991-2023). - Otherwise, if it is less than 96 then the epoch is 1952 - (this covers 1952-1962 and 1996-2047). Otherwise, the epoch - is 1900 (this covers 1996-1999, or rather 1996-2155). */ - + /* The kernel source today says: read the year. + If it is in 0-19 then the epoch is 2000. + If it is in 20-47 then the epoch is 1980. + If it is in 48-69 then the epoch is 1952. + If it is in 70-99 then the epoch is 1928. + Otherwise the epoch is 1900. + Clearly, this must be changed before 2019. */ /* See whether we are dealing with SRM or MILO, as they have different "epoch" ideas. */ diff --git a/hwclock/hwclock.8 b/hwclock/hwclock.8 index d62f5035..0d5f014c 100644 --- a/hwclock/hwclock.8 +++ b/hwclock/hwclock.8 @@ -590,10 +590,9 @@ on old systems) .BR tzset (3) .SH AUTHORS -Written By Bryan Henderson, September 1996 (bryanh@giraffe-data.com), +Written by Bryan Henderson, September 1996 (bryanh@giraffe-data.com), based on work done on the .I clock program by Charles Hedrick, Rob Hooft, and Harald Koenig. See the source code for complete history and credits. - diff --git a/hwclock/hwclock.c b/hwclock/hwclock.c index 20c548eb..9cf46dda 100644 --- a/hwclock/hwclock.c +++ b/hwclock/hwclock.c @@ -20,6 +20,7 @@ * * Fix for Award 2094 bug, Dave Coffin (dcoffin@shore.net) 11/12/98 * Change of local time handling, Stefan Ring + * Change of adjtime handling, James P. Rutledge . * * Distributed under GPL */ @@ -78,13 +79,13 @@ #include #include #include +#include +#include -#include "shhopt.h" #include "clock.h" #include "nls.h" #define MYNAME "hwclock" -#define VERSION "2.4c" char *progname = MYNAME; @@ -108,14 +109,17 @@ struct adjtime { updated since read from the disk file). */ bool dirty; + /* line 1 */ - float drift_factor; + double drift_factor; time_t last_adj_time; - float not_adjusted; + double not_adjusted; + /* line 2 */ time_t last_calib_time; /* The most recent time that we set the clock from an external authority (as opposed to just doing a drift adjustment) */ + /* line 3 */ enum a_local_utc {LOCAL, UTC, UNKNOWN} local_utc; /* To which time zone, local or UTC, we most recently set the @@ -170,18 +174,18 @@ read_date_from_file (struct tm *tm) { write_date_to_file (tm); } -static float +static double time_diff(struct timeval subtrahend, struct timeval subtractor) { /*--------------------------------------------------------------------------- The difference in seconds between two times in "timeval" format. ----------------------------------------------------------------------------*/ - return( (subtrahend.tv_sec - subtractor.tv_sec) - + (subtrahend.tv_usec - subtractor.tv_usec) / 1E6 ); + return (subtrahend.tv_sec - subtractor.tv_sec) + + (subtrahend.tv_usec - subtractor.tv_usec) / 1E6; } static struct timeval -time_inc(struct timeval addend, float increment) { +time_inc(struct timeval addend, double increment) { /*---------------------------------------------------------------------------- The time, in "timeval" format, which is seconds after the time . Of course, may be negative. @@ -199,7 +203,7 @@ time_inc(struct timeval addend, float increment) { newtime.tv_usec -= 1E6; newtime.tv_sec += 1; } - return(newtime); + return newtime; } @@ -223,39 +227,41 @@ hw_clock_is_utc(const bool utc, const bool local_opt, -static void -read_adjtime(struct adjtime *adjtime_p, int *rc_p) { +static int +read_adjtime(struct adjtime *adjtime_p) { /*---------------------------------------------------------------------------- Read the adjustment parameters out of the /etc/adjtime file. Return them as the adjtime structure <*adjtime_p>. - If there is no /etc/adjtime file, return defaults. If values are missing from the file, return defaults for them. - return *rc_p = 0 if all OK, !=0 otherwise. + return value 0 if all OK, !=0 otherwise. -----------------------------------------------------------------------------*/ FILE *adjfile; int rc; /* local return code */ struct stat statbuf; /* We don't even use the contents of this. */ - rc = stat(ADJPATH, &statbuf); - if (rc < 0 && errno == ENOENT) { - /* He doesn't have a adjtime file, so we'll use defaults. */ - adjtime_p->drift_factor = 0; - adjtime_p->last_adj_time = 0; - adjtime_p->not_adjusted = 0; - adjtime_p->last_calib_time = 0; - adjtime_p->local_utc = UNKNOWN; + rc = stat(ADJPATH, &statbuf); + if (rc < 0 && errno == ENOENT) { + /* He doesn't have a adjtime file, so we'll use defaults. */ + adjtime_p->drift_factor = 0; + adjtime_p->last_adj_time = 0; + adjtime_p->not_adjusted = 0; + adjtime_p->last_calib_time = 0; + adjtime_p->local_utc = UNKNOWN; + + return 0; + } - *rc_p = 0; - } else { adjfile = fopen(ADJPATH, "r"); /* open file for reading */ if (adjfile == NULL) { outsyserr("cannot open file " ADJPATH); - *rc_p = 2; - } else { + return EX_OSFILE; + } + + { char line1[81]; /* String: first line of adjtime file */ char line2[81]; /* String: second line of adjtime file */ char line3[81]; /* String: third line of adjtime file */ @@ -277,7 +283,7 @@ read_adjtime(struct adjtime *adjtime_p, int *rc_p) { adjtime_p->last_calib_time = 0; timeval = 0; - sscanf(line1, "%f %ld %f", + sscanf(line1, "%lf %ld %lf", &adjtime_p->drift_factor, &timeval, &adjtime_p->not_adjusted); @@ -299,8 +305,6 @@ read_adjtime(struct adjtime *adjtime_p, int *rc_p) { fprintf(stderr, _("(Expected: `UTC' or `LOCAL' or nothing.)\n")); } } - - *rc_p = 0; } adjtime_p->dirty = FALSE; @@ -313,12 +317,13 @@ read_adjtime(struct adjtime *adjtime_p, int *rc_p) { (adjtime_p->local_utc == LOCAL) ? _("local") : (adjtime_p->local_utc == UTC) ? _("UTC") : _("unknown")); } - } + + return 0; } -static void -synchronize_to_clock_tick(int *retcode_p) { +static int +synchronize_to_clock_tick(void) { /*----------------------------------------------------------------------------- Wait until the falling edge of the Hardware Clock's update flag so that any time that is read from the clock immediately after we @@ -330,14 +335,17 @@ synchronize_to_clock_tick(int *retcode_p) { We wait (up to one second) either blocked waiting for an rtc device or in a CPU spin loop. The former is probably not very accurate. - Return *retcode_p == 0 if it worked, nonzero if it didn't. - + Return 0 if it worked, nonzero if it didn't. -----------------------------------------------------------------------------*/ - if (debug) printf(_("Waiting for clock tick...\n")); + int rc; - *retcode_p = ur->synchronize_to_clock_tick(); + if (debug) printf(_("Waiting for clock tick...\n")); - if (debug) printf(_("...got clock tick\n")); + rc = ur->synchronize_to_clock_tick(); + + if (debug) printf(_("...got clock tick\n")); + + return rc; } @@ -520,7 +528,7 @@ set_hardware_clock_exact(const time_t settime, static void display_time(const bool hclock_valid, const time_t systime, - const float sync_duration) { + const double sync_duration) { /*---------------------------------------------------------------------------- Put the time "systime" on standard output in display format. Except if hclock_valid == false, just tell standard output that we don't @@ -638,7 +646,7 @@ interpret_date_string(const char *date_opt, time_t * const time_p) { } fclose(date_child_fp); - return(retcode); + return retcode; } @@ -663,7 +671,7 @@ set_system_clock(const bool hclock_valid, const time_t newtime, int retcode; if (!hclock_valid) { - fprintf(stderr,_("The Hardware Clock does not contain a valid time, so " + fprintf(stderr, _("The Hardware Clock does not contain a valid time, so " "we cannot set the System Time from it.\n")); retcode = 1; } else { @@ -685,10 +693,10 @@ set_system_clock(const bool hclock_valid, const time_t newtime, #endif if (debug) { - printf( _("Calling settimeofday:\n") ); - printf( _("\ttv.tv_sec = %ld, tv.tv_usec = %ld\n"), - (long) tv.tv_sec, (long) tv.tv_usec ); - printf( _("\ttz.tz_minuteswest = %d\n"), minuteswest); + printf(_("Calling settimeofday:\n")); + printf(_("\ttv.tv_sec = %ld, tv.tv_usec = %ld\n"), + (long) tv.tv_sec, (long) tv.tv_usec); + printf(_("\ttz.tz_minuteswest = %d\n"), minuteswest); } if (testing) { printf(_("Not setting system clock because running in test mode.\n")); @@ -697,85 +705,130 @@ set_system_clock(const bool hclock_valid, const time_t newtime, const struct timezone tz = { minuteswest, 0 }; rc = settimeofday(&tv, &tz); - if (rc != 0) { - if (errno == EPERM) - fprintf(stderr, _("Must be superuser to set system clock.\n")); - else - outsyserr(_("settimeofday() failed")); - retcode = 1; + if (rc) { + if (errno == EPERM) { + fprintf(stderr, + _("Must be superuser to set system clock.\n")); + retcode = EX_NOPERM; + } else { + outsyserr(_("settimeofday() failed")); + retcode = 1; + } } else retcode = 0; } } - return(retcode); + return retcode; } static void adjust_drift_factor(struct adjtime *adjtime_p, const time_t nowtime, - const bool hclock_valid, const time_t hclocktime ) { -/*--------------------------------------------------------------------------- + const bool hclock_valid, + const time_t hclocktime, + const double sync_delay) { +/*------------------------------------------------------------------------ Update the drift factor in <*adjtime_p> to reflect the fact that the Hardware Clock was calibrated to and before that was set to . - We assume that the user has been doing regular drift adjustments - using the drift factor in the adjtime file, so if and - are different, that means the adjustment factor isn't - quite right. - We record in the adjtime file the time at which we last calibrated the clock so we can compute the drift rate each time we calibrate. EXCEPT: if is false, assume Hardware Clock was not set before to anything meaningful and regular adjustments have not been done, so don't adjust the drift factor. - -----------------------------------------------------------------------------*/ - if (!hclock_valid) { - if (debug) - printf(_("Not adjusting drift factor because the Hardware Clock " - "previously contained garbage.\n")); - } else if ((hclocktime - adjtime_p->last_calib_time) < 23 * 60 * 60) { - if (debug) - printf(_("Not adjusting drift factor because it has been less than a " - "day since the last calibration.\n")); - } else if (adjtime_p->last_calib_time != 0) { - const float factor_adjust = - ((float) (nowtime - hclocktime) - / (hclocktime - adjtime_p->last_calib_time)) - * 24 * 60 * 60; - - if (debug) - printf(_("Clock drifted %d 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"), - (int) (nowtime - hclocktime), - (int) (hclocktime - adjtime_p->last_calib_time), - adjtime_p->drift_factor, - factor_adjust ); + ------------------------------------------------------------------------*/ + if (!hclock_valid) { + if (debug) + printf(_("Not adjusting drift factor because the " + "Hardware Clock previously contained " + "garbage.\n")); + } else if (adjtime_p->last_calib_time == 0) { + if (debug) + printf(_("Not adjusting drift factor because last " + "calibration time is zero,\n" + "so history is bad and calibration startover " + "is necessary.\n")); + } else if ((hclocktime - adjtime_p->last_calib_time) < 23 * 60 * 60) { + if (debug) + printf(_("Not adjusting drift factor because it has " + "been less than a day since the last " + "calibration.\n")); + } else if (adjtime_p->last_calib_time != 0) { + /* + * At adjustment time we adjust the hardware clock according + * to the contents of /etc/adjtime. + * + * At calibration time we set the hardware clock and + * update /etc/adjtime, that is, for each calibration + * (except the first) we also do an adjustment. + * + * We are now at calibration time. + * + * Let us do computation in doubles. (Floats almost suffice, + * but 195 days + 1 second equals 195 days in floats.) + */ + const double sec_per_day = 24.0 * 60.0 * 60.0; + double atime_per_htime; + double adj_days, cal_days; + double exp_drift, unc_drift; + double factor_adjust; + + /* Adjusted time units per hardware time unit */ + atime_per_htime = 1.0 + adjtime_p->drift_factor / sec_per_day; + + /* Days since last adjustment (in hardware clock time) */ + adj_days = (double)(hclocktime - adjtime_p->last_adj_time) + / sec_per_day; + + /* Expected drift (sec) since last adjustment */ + exp_drift = adj_days * adjtime_p->drift_factor + + adjtime_p->not_adjusted; + + /* Uncorrected drift (sec) since last calibration */ + unc_drift = (double)(nowtime - hclocktime) + + sync_delay - exp_drift; + + /* Days since last calibration (in hardware clock time) */ + cal_days = ((double)(adjtime_p->last_adj_time + - adjtime_p->last_calib_time) + + adjtime_p->not_adjusted) + / (sec_per_day * atime_per_htime) + adj_days; + + /* Amount to add to previous drift factor */ + factor_adjust = unc_drift / cal_days; + + if (debug) + printf(_("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"), + unc_drift, + (int) (nowtime - adjtime_p->last_calib_time), + adjtime_p->drift_factor, + factor_adjust); - adjtime_p->drift_factor += factor_adjust; - } - adjtime_p->last_calib_time = nowtime; + adjtime_p->drift_factor += factor_adjust; + } + adjtime_p->last_calib_time = nowtime; - adjtime_p->last_adj_time = nowtime; + adjtime_p->last_adj_time = nowtime; - adjtime_p->not_adjusted = 0; + adjtime_p->not_adjusted = 0; - adjtime_p->dirty = TRUE; + adjtime_p->dirty = TRUE; } static void -calculate_adjustment( - const float factor, +calculate_adjustment(const double factor, const time_t last_time, - const float not_adjusted, + const double not_adjusted, const time_t systime, int *adjustment_p, - float *retro_p, + double *retro_p, const int debug ) { /*---------------------------------------------------------------------------- Do the drift adjustment calculation. @@ -790,13 +843,13 @@ calculate_adjustment( advance the clock or insert seconds. Negative means to retard the clock or remove seconds. ----------------------------------------------------------------------------*/ - float exact_adjustment; + double exact_adjustment; - exact_adjustment = ((float) (systime - last_time)) * factor / (24 * 60 * 60) + exact_adjustment = ((double) (systime - last_time)) * factor / (24 * 60 * 60) + not_adjusted; *adjustment_p = FLOOR(exact_adjustment); - *retro_p = exact_adjustment - (float) *adjustment_p; + *retro_p = exact_adjustment - (double) *adjustment_p; if (debug) { printf (_("Time since last adjustment is %d seconds\n"), (int) (systime - last_time)); @@ -897,10 +950,18 @@ do_adjustment(struct adjtime *adjtime_p, if (!hclock_valid) { fprintf(stderr, _("The Hardware Clock does not contain a valid time, " "so we cannot adjust it.\n")); + adjtime_p->last_calib_time = 0; /* calibration startover is required */ + adjtime_p->last_adj_time = 0; + adjtime_p->not_adjusted = 0; + adjtime_p->dirty = TRUE; + } else if (adjtime_p->last_adj_time == 0) { + if (debug) + printf("Not setting clock because last adjustment time is zero, " + "so history is bad."); } else { int adjustment; /* Number of seconds we must insert in the Hardware Clock */ - float retro; + double retro; /* Fraction of second we have to remove from clock after inserting whole seconds. */ @@ -951,13 +1012,13 @@ determine_clock_access_method(const bool user_requests_ISA) { } } -static void +static int manipulate_clock(const bool show, const bool adjust, const bool noadjfile, const bool set, const time_t set_time, const bool hctosys, const bool systohc, const struct timeval startup_time, const bool utc, const bool local_opt, - const bool testing, int *retcode_p) { + const bool testing) { /*--------------------------------------------------------------------------- Do all the normal work of hwclock - read, set clock, etc. @@ -965,24 +1026,26 @@ manipulate_clock(const bool show, const bool adjust, const bool noadjfile, Return rc == 0 if everything went OK, rc != 0 if not. ----------------------------------------------------------------------------*/ - struct adjtime adjtime; - /* Contents of the adjtime file, or what they should be. */ - int rc; /* local return code */ - bool no_auth; /* User lacks necessary authorization to access the clock */ - - no_auth = ur->get_permissions(); - - if (no_auth) *retcode_p = 1; - else { - if (!noadjfile && (adjust || set || systohc || (!utc && !local_opt))) - read_adjtime(&adjtime, &rc); - else { + struct adjtime adjtime; + /* Contents of the adjtime file, or what they should be. */ + int rc; /* local return code */ + bool no_auth; /* User lacks necessary authorization to access the clock */ + + no_auth = ur->get_permissions(); + if (no_auth) + return EX_NOPERM; + + if (!noadjfile && (adjust || set || systohc || (!utc && !local_opt))) { + rc = read_adjtime(&adjtime); + if (rc) + return rc; + } else { /* A little trick to avoid reading the file if we don't have to */ adjtime.dirty = FALSE; rc = 0; } - if (rc != 0) *retcode_p = 2; - else { + + { const bool universal = hw_clock_is_utc(utc, local_opt, adjtime); if ((set || systohc || adjust) && @@ -991,9 +1054,11 @@ manipulate_clock(const bool show, const bool adjust, const bool noadjfile, adjtime.dirty = TRUE; } - synchronize_to_clock_tick(retcode_p); - /* this takes up to 1 second */ - if (*retcode_p == 0) { + rc = synchronize_to_clock_tick(); /* this takes up to 1 second */ + if (rc) + return rc; + + { struct timeval read_time; /* The time at which we read the Hardware Clock */ @@ -1014,16 +1079,14 @@ manipulate_clock(const bool show, const bool adjust, const bool noadjfile, if (show) { display_time(hclock_valid, hclocktime, time_diff(read_time, startup_time)); - *retcode_p = 0; } else if (set) { set_hardware_clock_exact(set_time, startup_time, universal, testing); - adjust_drift_factor(&adjtime, set_time, hclock_valid, hclocktime); - *retcode_p = 0; + adjust_drift_factor(&adjtime, set_time, hclock_valid, hclocktime, + time_diff(read_time, startup_time)); } else if (adjust) { do_adjustment(&adjtime, hclock_valid, hclocktime, read_time, universal, testing); - *retcode_p = 0; } else if (systohc) { struct timeval nowtime, reftime; /* We can only set_hardware_clock_exact to a whole seconds @@ -1036,22 +1099,20 @@ manipulate_clock(const bool show, const bool adjust, const bool noadjfile, set_hardware_clock_exact((time_t) reftime.tv_sec, reftime, universal, testing); - *retcode_p = 0; adjust_drift_factor(&adjtime, (time_t) reftime.tv_sec, hclock_valid, - hclocktime); + hclocktime, (double) read_time.tv_usec / 1E6); } else if (hctosys) { rc = set_system_clock(hclock_valid, hclocktime, testing); - if (rc != 0) { + if (rc) { printf(_("Unable to set system clock.\n")); - *retcode_p = 1; - } else *retcode_p = 0; + return rc; + } } - if (!noadjfile) { + if (!noadjfile) save_adjtime(adjtime, testing); - } } } - } + return 0; } @@ -1104,6 +1165,11 @@ manipulate_epoch(const bool getepoch, const bool setepoch, #define RTC_DEV "/dev/rtc" #endif +static void +out_version(void) { + printf(_("%s from %s\n"), MYNAME, util_linux_version); +} + /* usage - Output (error and) usage information @@ -1148,7 +1214,7 @@ usage( const char *fmt, ... ) { " either --utc or --localtime\n" ),RTC_DEV); #ifdef __alpha__ - fprintf( usageto, _( + fprintf(usageto, _( " --jensen, --arc, --srm, --funky-toy\n" " tell hwclock the type of alpha you have (see hwclock(8))\n" ) ); @@ -1156,200 +1222,272 @@ usage( const char *fmt, ... ) { fflush(stdout); - if( fmt ) { + if (fmt) { usageto = stderr; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); } - exit( fmt ? 99 : 0 ); + exit(fmt ? EX_USAGE : 0); } +static const struct option longopts[] = { + { "adjust", 0, 0, 'a' }, + { "help", 0, 0, 'h' }, + { "show", 0, 0, 'r' }, + { "hctosys", 0, 0, 's' }, + { "utc", 0, 0, 'u' }, + { "version", 0, 0, 'v' }, + { "systohc", 0, 0, 'w' }, + { "debug", 0, 0, 'D' }, +#ifdef __alpha__ + { "ARC", 0, 0, 'A' }, + { "arc", 0, 0, 'A' }, + { "Jensen", 0, 0, 'J' }, + { "jensen", 0, 0, 'J' }, + { "SRM", 0, 0, 'S' }, + { "srm", 0, 0, 'S' }, + { "funky-toy", 0, 0, 'F'} +#endif + { "set", 0, 0, 128 }, + { "getepoch", 0, 0, 129 }, + { "setepoch", 0, 0, 130 }, + { "noadjfile", 0, 0, 131 }, + { "localtime", 0, 0, 132 }, + { "badyear", 0, 0, 133 }, + { "directisa", 0, 0, 134 }, + { "test", 0, 0, 135 }, + { "date", 1, 0, 136 }, + { "epoch", 1, 0, 137 }, + { NULL, 0, 0, 0 } +}; + +/* + * Returns: + * EX_USAGE: bad invocation + * EX_NOPERM: no permission + * EX_OSFILE: cannot open /dev/rtc or /etc/adjtime + * EX_IOERR: ioctl error getting or setting the time + * 0: OK (or not) + * 1: failure + */ int main(int argc, char **argv) { - struct timeval startup_time; - /* The time we started up, in seconds into the epoch, including fractions. - */ - time_t set_time; /* Time to which user said to set Hardware Clock */ + struct timeval startup_time; + /* The time we started up, in seconds into the epoch, including + fractions. */ + time_t set_time; /* Time to which user said to set Hardware Clock */ - bool permitted; /* User is permitted to do the function */ - int retcode; /* Our eventual return code */ + bool permitted; /* User is permitted to do the function */ + int rc, c; - int rc; /* local return code */ + /* Variables set by various options; show may also be set later */ + /* The options debug, badyear and epoch_option are global */ + bool show, set, systohc, hctosys, adjust, getepoch, setepoch; + bool utc, testing, local_opt, noadjfile, directisa; + bool ARCconsole, Jensen, SRM, funky_toy; + char *date_opt; - /* option_def is the control table for the option parser. These other - variables are the results of parsing the options and their meanings - are given by the option_def. The only exception is , which - may be modified after parsing is complete to effect an implied option. - */ - bool help, show, set, systohc, hctosys, adjust, getepoch, setepoch, version; - bool ARCconsole, utc, testing, directisa, Jensen, SRM, funky_toy, noadjfile; - bool local_opt; - char *date_opt; - - const optStruct option_def[] = { - { 'h', (char *) "help", OPT_FLAG, &help, 0 }, - { 'r', (char *) "show", OPT_FLAG, &show, 0 }, - { 0, (char *) "set", OPT_FLAG, &set, 0 }, - { 'w', (char *) "systohc", OPT_FLAG, &systohc, 0 }, - { 's', (char *) "hctosys", OPT_FLAG, &hctosys, 0 }, - { 0, (char *) "getepoch", OPT_FLAG, &getepoch, 0 }, - { 0, (char *) "setepoch", OPT_FLAG, &setepoch, 0 }, - { 'a', (char *) "adjust", OPT_FLAG, &adjust, 0 }, - { 0, (char *) "noadjfile", OPT_FLAG, &noadjfile, 0 }, - { 'v', (char *) "version", OPT_FLAG, &version, 0 }, - { 'V', (char *) "version", OPT_FLAG, &version, 0 }, - { 0, (char *) "date", OPT_STRING, &date_opt, 0 }, - { 0, (char *) "epoch", OPT_UINT, &epoch_option,0 }, - { 'u', (char *) "utc", OPT_FLAG, &utc, 0 }, - { 0, (char *) "localtime", OPT_FLAG, &local_opt, 0 }, - { 0, (char *) "badyear", OPT_FLAG, &badyear, 0 }, - { 0, (char *) "directisa", OPT_FLAG, &directisa, 0 }, - { 0, (char *) "test", OPT_FLAG, &testing, 0 }, - { 'D', (char *) "debug", OPT_FLAG, &debug, 0 }, -#ifdef __alpha__ - { 'A', (char *) "ARC", OPT_FLAG, &ARCconsole,0 }, - { 'A', (char *) "arc", OPT_FLAG, &ARCconsole,0 }, - { 'J', (char *) "Jensen", OPT_FLAG, &Jensen, 0 }, - { 'J', (char *) "jensen", OPT_FLAG, &Jensen, 0 }, - { 'S', (char *) "SRM", OPT_FLAG, &SRM, 0 }, - { 'S', (char *) "srm", OPT_FLAG, &SRM, 0 }, - { 'F', (char *) "funky-toy", OPT_FLAG, &funky_toy, 0 }, -#endif - { 0, (char *) NULL, OPT_END, NULL, 0 } - }; - int argc_parse; /* argc, except we modify it as we parse */ - char **argv_parse; /* argv, except we modify it as we parse */ + /* Remember what time we were invoked */ + gettimeofday(&startup_time, NULL); - gettimeofday(&startup_time, NULL); /* Remember what time we were invoked */ - - setlocale(LC_ALL, ""); + setlocale(LC_ALL, ""); #ifdef LC_NUMERIC - /* We need LC_CTYPE and LC_TIME and LC_MESSAGES, but must avoid - LC_NUMERIC since it gives problems when we write to /etc/adjtime. - - gqueri@mail.dotcom.fr */ - setlocale(LC_NUMERIC, "C"); + /* We need LC_CTYPE and LC_TIME and LC_MESSAGES, but must avoid + LC_NUMERIC since it gives problems when we write to /etc/adjtime. + - gqueri@mail.dotcom.fr */ + setlocale(LC_NUMERIC, "C"); #endif - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); - - /* set option defaults */ - help = show = set = systohc = hctosys = adjust = noadjfile = - getepoch = setepoch = version = utc = local_opt = - ARCconsole = SRM = funky_toy = directisa = badyear = Jensen = - testing = debug = FALSE; - date_opt = NULL; - - argc_parse = argc; argv_parse = argv; - optParseOptions(&argc_parse, argv_parse, option_def, 0); - /* Uses and sets argc_parse, argv_parse. - Sets show, systohc, hctosys, adjust, utc, local_opt, version, - testing, debug, set, date_opt, getepoch, setepoch, epoch_option, - noadjtime */ - /* This is an ugly routine - for example, if I give an incorrect - option, it only says "unrecognized option" without telling - me what options are recognized. Rewrite with standard - getopt() and usage() and throw shhopt out. */ - - if (argc_parse - 1 > 0) { - usage( _("%s takes no non-option arguments. " - "You supplied %d.\n"), - MYNAME, argc_parse - 1); - } + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + /* Set option defaults */ + show = set = systohc = hctosys = adjust = noadjfile = FALSE; + getepoch = setepoch = utc = local_opt = testing = debug = FALSE; + ARCconsole = Jensen = SRM = funky_toy = directisa = badyear = FALSE; + date_opt = NULL; + + while ((c = getopt_long (argc, argv, "?hvVDarsuwAJSF", longopts, NULL)) + != -1) { + switch (c) { + case 'D': + debug = TRUE; + break; + case 'a': + adjust = TRUE; + break; + case 'r': + show = TRUE; + break; + case 's': + hctosys = TRUE; + break; + case 'u': + utc = TRUE; + break; + case 'w': + systohc = TRUE; + break; +#ifdef __alpha__ + case 'A': + ARCconsole = TRUE; + break; + case 'J': + Jensen = TRUE; + break; + case 'S': + SRM = TRUE; + break; + case 'F': + funky_toy = TRUE; + break; +#endif + case 128: + set = TRUE; + break; + case 129: + getepoch = TRUE; + break; + case 130: + setepoch = TRUE; + break; + case 131: + noadjfile = TRUE; + break; + case 132: + local_opt = TRUE; /* --localtime */ + break; + case 133: + badyear = TRUE; + break; + case 134: + directisa = TRUE; + break; + case 135: + testing = TRUE; /* --test */ + break; + case 136: + date_opt = optarg; /* --date */ + break; + case 137: + epoch_option = atoi(optarg); /* --epoch */ + break; + case 'v': /* --version */ + case 'V': + out_version(); + return 0; + case 'h': /* --help */ + case '?': + default: + usage(NULL); + } + } - if (help) - usage( NULL ); + argc -= optind; + argv += optind; - if (show + set + systohc + hctosys + adjust + - getepoch + setepoch + version > 1) { - fprintf(stderr, _("You have specified multiple function options.\n" - "You can only perform one function at a time.\n")); - exit(100); - } + if (argc > 0) { + usage(_("%s takes no non-option arguments. " + "You supplied %d.\n"), + MYNAME, argc); + } - if (utc && local_opt) { - fprintf(stderr, _("%s: The --utc and --localtime options are mutually " - "exclusive. You specified both.\n"), MYNAME); - exit(100); - } + if (show + set + systohc + hctosys + adjust + getepoch + setepoch > 1){ + fprintf(stderr, _("You have specified multiple functions.\n" + "You can only perform one function " + "at a time.\n")); + exit(EX_USAGE); + } - if (adjust && noadjfile) { - fprintf(stderr, _("%s: The --adjust and --noadjfile options are mutually " - "exclusive. You specified both.\n"), MYNAME); - exit(100); - } + if (utc && local_opt) { + fprintf(stderr, _("%s: The --utc and --localtime options " + "are mutually exclusive. You specified " + "both.\n"), MYNAME); + exit(EX_USAGE); + } - if (noadjfile && !(utc || local_opt)) { - fprintf(stderr, _("%s: With --noadjfile, you must specify either " - "--utc or --localtime\n"), MYNAME); - exit(100); - } + if (adjust && noadjfile) { + fprintf(stderr, _("%s: The --adjust and --noadjfile options " + "are mutually exclusive. You specified " + "both.\n"), MYNAME); + exit(EX_USAGE); + } + + if (noadjfile && !(utc || local_opt)) { + fprintf(stderr, _("%s: With --noadjfile, you must specify " + "either --utc or --localtime\n"), MYNAME); + exit(EX_USAGE); + } #ifdef __alpha__ - set_cmos_epoch(ARCconsole, SRM); - set_cmos_access(Jensen, funky_toy); + set_cmos_epoch(ARCconsole, SRM); + set_cmos_access(Jensen, funky_toy); #endif - if (set) { - rc = interpret_date_string(date_opt, &set_time); /* (time-consuming) */ - if (rc != 0) { - fprintf(stderr, _("No usable set-to time. Cannot set clock.\n")); - exit(100); - } - } + if (set) { + rc = interpret_date_string(date_opt, &set_time); + /* (time-consuming) */ + if (rc != 0) { + fprintf(stderr, _("No usable set-to time. " + "Cannot set clock.\n")); + exit(EX_USAGE); + } + } - if (!(show | set | systohc | hctosys | adjust | getepoch | setepoch | - version)) - show = 1; /* default to show */ + if (!(show | set | systohc | hctosys | adjust | getepoch | setepoch)) + show = 1; /* default to show */ - if (getuid() == 0) permitted = TRUE; - else { - /* program is designed to run setuid (in some situations) -- be secure! */ - if (set || hctosys || systohc || adjust) { - fprintf(stderr, - _("Sorry, only the superuser can change the Hardware Clock.\n")); - permitted = FALSE; - } else if (hctosys) { - fprintf(stderr, - _("Sorry, only the superuser can change the System Clock.\n")); - permitted = FALSE; - } else if (setepoch) { - fprintf(stderr, - _("Sorry, only the superuser can change " - "the Hardware Clock epoch in the kernel.\n")); - permitted = FALSE; - } else - permitted = TRUE; - } + if (getuid() == 0) + permitted = TRUE; + else { + /* program is designed to run setuid (in some situations) */ + if (set || hctosys || systohc || adjust) { + fprintf(stderr, + _("Sorry, only the superuser can change " + "the Hardware Clock.\n")); + permitted = FALSE; + } else if (hctosys) { + fprintf(stderr, + _("Sorry, only the superuser can change " + "the System Clock.\n")); + permitted = FALSE; + } else if (setepoch) { + fprintf(stderr, + _("Sorry, only the superuser can change the " + "Hardware Clock epoch in the kernel.\n")); + permitted = FALSE; + } else + permitted = TRUE; + } - if (!permitted) retcode = 2; - else { - retcode = 0; - if (version) { - printf(MYNAME " " VERSION "/%s\n",util_linux_version); - } else if (getepoch || setepoch) { - manipulate_epoch(getepoch, setepoch, epoch_option, testing); - } else { - if (debug) - printf(MYNAME " " VERSION "/%s\n",util_linux_version); - determine_clock_access_method(directisa); - if (!ur) { - fprintf(stderr, - _("Cannot access the Hardware Clock via any known method.\n")); - if (!debug) + if (!permitted) + exit(EX_NOPERM); + + if (getepoch || setepoch) { + manipulate_epoch(getepoch, setepoch, epoch_option, testing); + return 0; + } + + if (debug) + out_version(); + determine_clock_access_method(directisa); + if (!ur) { fprintf(stderr, - _("Use the --debug option to see the details of our " - "search for an access method.\n")); - } else - manipulate_clock(show, adjust, noadjfile, set, set_time, - hctosys, systohc, startup_time, utc, local_opt, - testing, &rc); - } - } - exit(retcode); + _("Cannot access the Hardware Clock via " + "any known method.\n")); + if (!debug) + fprintf(stderr, + _("Use the --debug option to see the details " + "of our search for an access method.\n")); + exit(1); + } + + return manipulate_clock(show, adjust, noadjfile, set, set_time, + hctosys, systohc, startup_time, utc, + local_opt, testing); } /* A single routine for greater uniformity */ diff --git a/hwclock/kd.c b/hwclock/kd.c index f3327e1c..dbbe758f 100644 --- a/hwclock/kd.c +++ b/hwclock/kd.c @@ -1,6 +1,7 @@ /* kd.c - KDGHWCLK stuff, possibly m68k only */ #include /* for close() */ #include /* for O_RDONLY */ +#include #include #include "../defines.h" /* for HAVE_nanosleep */ @@ -90,7 +91,7 @@ read_hardware_clock_kd(struct tm *tm) { if (ioctl(con_fd, KDGHWCLK, &t) == -1) { outsyserr(_("ioctl() failed to read time from %s"), con_fd_filename); - exit(5); + exit(EX_IOERR); } tm->tm_sec = t.sec; diff --git a/hwclock/rtc.c b/hwclock/rtc.c index 2694d866..f6fb0186 100644 --- a/hwclock/rtc.c +++ b/hwclock/rtc.c @@ -1,6 +1,7 @@ /* rtc.c - Use /dev/rtc for clock access */ #include /* for close() */ #include /* for O_RDONLY */ +#include #include #include "clock.h" @@ -90,17 +91,29 @@ struct linux_rtc_time { static char rtc_dev_name[40]; -/* maybe we should not try /dev/misc/efirtc? - maybe we should reset rtc_dev_name to give better error messages */ +/* maybe we should not try /dev/misc/efirtc? */ static int open_rtc(void) { int rtc_fd; sprintf(rtc_dev_name, "/dev/%s", RTC_DEVN); rtc_fd = open(rtc_dev_name, O_RDONLY); - if (rtc_fd < 0) { + if (rtc_fd < 0 && errno == ENOENT) { sprintf(rtc_dev_name, "/dev/misc/%s", RTC_DEVN); rtc_fd = open(rtc_dev_name, O_RDONLY); + if (rtc_fd < 0 && errno == ENOENT) + sprintf(rtc_dev_name, "/dev/%s", RTC_DEVN); + } + return rtc_fd; +} + +static int +open_rtc_or_exit(void) { + int rtc_fd = open_rtc(); + + if (rtc_fd < 0) { + outsyserr(_("open() of %s failed"), rtc_dev_name); + exit(EX_OSFILE); } return rtc_fd; } @@ -135,7 +148,7 @@ do_rtc_read_ioctl(int rtc_fd, struct tm *tm) { perror(ioctlname); fprintf(stderr, _("ioctl() to %s to read the time failed.\n"), rtc_dev_name); - exit(5); + exit(EX_IOERR); } tm->tm_isdst = -1; /* don't know whether it's dst */ @@ -204,7 +217,7 @@ int ret; #else rc = ioctl(rtc_fd, RTC_UIE_ON, 0); #endif - if (rc == -1 && errno == EINVAL) { + if (rc == -1 && (errno == ENOTTY || errno == EINVAL)) { /* This rtc device doesn't have interrupt functions. This is typical on an Alpha, where the Hardware Clock interrupts are used by the kernel for the system clock, so aren't at the user's disposal. @@ -245,11 +258,7 @@ static int read_hardware_clock_rtc(struct tm *tm) { int rtc_fd; - rtc_fd = open_rtc(); - if (rtc_fd == -1) { - outsyserr(_("open() of %s failed"), rtc_dev_name); - exit(5); - } + rtc_fd = open_rtc_or_exit(); /* Read the RTC time/date, return answer via tm */ do_rtc_read_ioctl(rtc_fd, tm); @@ -269,11 +278,8 @@ set_hardware_clock_rtc(const struct tm *new_broken_time) { int rtc_fd; char *ioctlname; - rtc_fd = open_rtc(); - if (rtc_fd < 0) { - outsyserr(_("Unable to open %s"), rtc_dev_name); - exit(5); - } + rtc_fd = open_rtc_or_exit(); + #ifdef __sparc__ { struct sparc_rtc_time stm; @@ -299,7 +305,7 @@ set_hardware_clock_rtc(const struct tm *new_broken_time) { perror(ioctlname); fprintf(stderr, _("ioctl() to %s to set the time failed.\n"), rtc_dev_name); - exit(5); + exit(EX_IOERR); } if (debug) diff --git a/hwclock/shhopt-1.1.lsm b/hwclock/shhopt-1.1.lsm deleted file mode 100644 index a61a2696..00000000 --- a/hwclock/shhopt-1.1.lsm +++ /dev/null @@ -1,17 +0,0 @@ -Begin3 -Title: shhopt - library for parsing command line options. -Version: 1.1 -Entered-date: 06JUN96 -Description: C-functions for parsing command line options, both - traditional one-character options, and GNU'ish - --long-options. -Keywords: programming, library, lib, commandline -Author: sverrehu@ifi.uio.no (Sverre H. Huseby) -Primary-site: sunsite.unc.edu /pub/Linux/libs - shhopt-1.1.tar.gz -Platforms: Requires ANSI C-compiler. -Copying-policy: BeerWare: If you have the time and money, send me a bottle - of your favourite beer. If not, just send me a mail or - something. Copy and use as you wish; just leave the - author's name where you find it. -End diff --git a/hwclock/shhopt.c b/hwclock/shhopt.c deleted file mode 100644 index ac341282..00000000 --- a/hwclock/shhopt.c +++ /dev/null @@ -1,468 +0,0 @@ -/* $Id: shhopt.c,v 2.2 1997/07/06 23:11:55 aebr Exp $ */ -/************************************************************************** - * - * FILE shhopt.c - * - * DESCRIPTION Functions for parsing command line arguments. Values - * of miscellaneous types may be stored in variables, - * or passed to functions as specified. - * - * REQUIREMENTS Some systems lack the ANSI C -function strtoul. If your - * system is one of those, you'll ned to write one yourself, - * or get the GNU liberty-library (from prep.ai.mit.edu). - * - * WRITTEN BY Sverre H. Huseby - * - **************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -#include "shhopt.h" -#include "nls.h" - -/************************************************************************** - * * - * P R I V A T E D A T A * - * * - **************************************************************************/ - -static void optFatalFunc(const char *, ...); -static void (*optFatal)(const char *format, ...) = optFatalFunc; - - - -/************************************************************************** - * * - * P R I V A T E F U N C T I O N S * - * * - **************************************************************************/ - -/*------------------------------------------------------------------------- - * - * NAME optFatalFunc - * - * FUNCTION Show given message and abort the program. - * - * INPUT format, ... - * Arguments used as with printf(). - * - * RETURNS Never returns. The program is aborted. - * - */ -void optFatalFunc(const char *format, ...) -{ - va_list ap; - - fflush(stdout); - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - exit(99); -} - - - -/*------------------------------------------------------------------------- - * - * NAME optStructCount - * - * FUNCTION Get number of options in a optStruct. - * - * INPUT opt array of possible options. - * - * RETURNS Number of options in the given array. - * - * DESCRIPTION Count elements in an optStruct-array. The strcture must - * be ended using an element of type OPT_END. - * - */ -static int optStructCount(const optStruct opt[]) -{ - int ret = 0; - - while (opt[ret].type != OPT_END) - ++ret; - return ret; -} - - - -/*------------------------------------------------------------------------- - * - * NAME optMatch - * - * FUNCTION Find a matching option. - * - * INPUT opt array of possible options. - * s string to match, without `-' or `--'. - * lng match long option, otherwise short. - * - * RETURNS Index to the option if found, -1 if not found. - * - * DESCRIPTION Short options are matched from the first character in - * the given string. - * - */ -static int optMatch(const optStruct opt[], const char *s, int lng) -{ - int nopt, q, matchlen = 0; - char *p; - - nopt = optStructCount(opt); - if (lng) { - if ((p = strchr(s, '=')) != NULL) - matchlen = p - s; - else - matchlen = strlen(s); - } - for (q = 0; q < nopt; q++) { - if (lng) { - if (!opt[q].longName) - continue; - if (strncmp(s, opt[q].longName, matchlen) == 0) - return q; - } else { - if (!opt[q].shortName) - continue; - if (*s == opt[q].shortName) - return q; - } - } - return -1; -} - - - -/*------------------------------------------------------------------------- - * - * NAME optString - * - * FUNCTION Return a (static) string with the option name. - * - * INPUT opt the option to stringify. - * lng is it a long option? - * - * RETURNS Pointer to static string. - * - */ -static char *optString(const optStruct *opt, int lng) -{ - static char ret[31]; - - if (lng) { - strcpy(ret, "--"); - strncpy(ret + 2, opt->longName, 28); - } else { - ret[0] = '-'; - ret[1] = opt->shortName; - ret[2] = '\0'; - } - return ret; -} - - - -/*------------------------------------------------------------------------- - * - * NAME optNeedsArgument - * - * FUNCTION Check if an option requires an argument. - * - * INPUT opt the option to check. - * - * RETURNS Boolean value. - * - */ -static int optNeedsArgument(const optStruct *opt) -{ - return opt->type == OPT_STRING - || opt->type == OPT_INT - || opt->type == OPT_UINT - || opt->type == OPT_LONG - || opt->type == OPT_ULONG; -} - - - -/*------------------------------------------------------------------------- - * - * NAME argvRemove - * - * FUNCTION Remove an entry from an argv-array. - * - * INPUT argc pointer to number of options. - * argv array of option-/argument-strings. - * i index of option to remove. - * - * OUTPUT argc new argument count. - * argv array with given argument removed. - * - */ -static void argvRemove(int *argc, char *argv[], int i) -{ - if (i >= *argc) - return; - while (i++ < *argc) - argv[i - 1] = argv[i]; - --*argc; -} - - - -/*------------------------------------------------------------------------- - * - * NAME optExecute - * - * FUNCTION Perform the action of an option. - * - * INPUT opt array of possible options. - * arg argument to option, if it applies. - * lng was the option given as a long option? - * - * RETURNS Nothing. Aborts in case of error. - * - */ -static void optExecute(const optStruct *opt, char *arg, int lng) -{ - switch (opt->type) { - case OPT_FLAG: - if (opt->flags & OPT_CALLFUNC) - ((void (*)(void)) opt->arg)(); - else - *((int *) opt->arg) = 1; - break; - - case OPT_STRING: - if (opt->flags & OPT_CALLFUNC) - ((void (*)(char *)) opt->arg)(arg); - else - *((char **) opt->arg) = arg; - break; - - case OPT_INT: - case OPT_LONG: { - long tmp; - char *e; - - tmp = strtol(arg, &e, 10); - if (*e) - optFatal(_("invalid number `%s'\n"), arg); - if (errno == ERANGE - || (opt->type == OPT_INT && (tmp > INT_MAX || tmp < INT_MIN))) - optFatal(_("number `%s' to `%s' out of range\n"), - arg, optString(opt, lng)); - if (opt->type == OPT_INT) { - if (opt->flags & OPT_CALLFUNC) - ((void (*)(int)) opt->arg)((int) tmp); - else - *((int *) opt->arg) = (int) tmp; - } else /* OPT_LONG */ { - if (opt->flags & OPT_CALLFUNC) - ((void (*)(long)) opt->arg)(tmp); - else - *((long *) opt->arg) = tmp; - } - break; - } - - case OPT_UINT: - case OPT_ULONG: { - unsigned long tmp; - char *e; - - tmp = strtoul(arg, &e, 10); - if (*e) - optFatal(_("invalid number `%s'\n"), arg); - if (errno == ERANGE - || (opt->type == OPT_UINT && tmp > UINT_MAX)) - optFatal(_("number `%s' to `%s' out of range\n"), - arg, optString(opt, lng)); - if (opt->type == OPT_UINT) { - if (opt->flags & OPT_CALLFUNC) - ((void (*)(unsigned)) opt->arg)((unsigned) tmp); - else - *((unsigned *) opt->arg) = (unsigned) tmp; - } else /* OPT_ULONG */ { - if (opt->flags & OPT_CALLFUNC) - ((void (*)(unsigned long)) opt->arg)(tmp); - else - *((unsigned long *) opt->arg) = tmp; - } - break; - } - - default: - break; - } -} - - - -/************************************************************************** - * * - * P U B L I C F U N C T I O N S * - * * - **************************************************************************/ - -/*------------------------------------------------------------------------- - * - * NAME optSetFatalFunc - * - * FUNCTION Set function used to display error message and exit. - * - * SYNOPSIS #include "shhmsg.h" - * void optSetFatalFunc(void (*f)(const char *, ...)); - * - * INPUT f function accepting printf()'like parameters, - * that _must_ abort the program. - * - */ -void optSetFatalFunc(void (*f)(const char *, ...)) -{ - optFatal = f; -} - - - -/*------------------------------------------------------------------------- - * - * NAME optParseOptions - * - * FUNCTION Parse commandline options. - * - * SYNOPSIS #include "shhopt.h" - * void optParseOptions(int *argc, char *argv[], - * const optStruct opt[], int allowNegNum); - * - * INPUT argc Pointer to number of options. - * argv Array of option-/argument-strings. - * opt Array of possible options. - * allowNegNum - * a negative number is not to be taken as - * an option. - * - * OUTPUT argc new argument count. - * argv array with arguments removed. - * - * RETURNS Nothing. Aborts in case of error. - * - * DESCRIPTION This function checks each option in the argv-array - * against strings in the opt-array, and `executes' any - * matching action. Any arguments to the options are - * extracted and stored in the variables or passed to - * functions pointed to by entries in opt. - * - * Options and arguments used are removed from the argv- - * array, and argc is decreased accordingly. - * - * Any error leads to program abortion. - * - */ -void optParseOptions(int *argc, char *argv[], - const optStruct opt[], int allowNegNum) -{ - int ai, /* argv index. */ - optarg, /* argv index of option argument, or -1 if none. */ - mi, /* Match index in opt. */ - done; - char *arg, /* Pointer to argument to an option. */ - *o, /* pointer to an option character */ - *p; - - /* - * Loop through all arguments. - */ - for (ai = 0; ai < *argc; ) { - /* - * "--" indicates that the rest of the argv-array does not - * contain options. - */ - if (strcmp(argv[ai], "--") == 0) { - argvRemove(argc, argv, ai); - break; - } - - if (allowNegNum && argv[ai][0] == '-' && isdigit(argv[ai][1])) { - ++ai; - continue; - } else if (strncmp(argv[ai], "--", 2) == 0) { - /* long option */ - /* find matching option */ - if ((mi = optMatch(opt, argv[ai] + 2, 1)) < 0) - optFatal(_("unrecognized option `%s'\n"), argv[ai]); - - /* possibly locate the argument to this option. */ - arg = NULL; - if ((p = strchr(argv[ai], '=')) != NULL) - arg = p + 1; - - /* does this option take an argument? */ - optarg = -1; - if (optNeedsArgument(&opt[mi])) { - /* option needs an argument. find it. */ - if (!arg) { - if ((optarg = ai + 1) == *argc) - optFatal(_("option `%s' requires an argument\n"), - optString(&opt[mi], 1)); - arg = argv[optarg]; - } - } else { - if (arg) - optFatal(_("option `%s' doesn't allow an argument\n"), - optString(&opt[mi], 1)); - } - /* perform the action of this option. */ - optExecute(&opt[mi], arg, 1); - /* remove option and any argument from the argv-array. */ - if (optarg >= 0) - argvRemove(argc, argv, ai); - argvRemove(argc, argv, ai); - } else if (*argv[ai] == '-') { - /* A dash by itself is not considered an option. */ - if (argv[ai][1] == '\0') { - ++ai; - continue; - } - /* Short option(s) following */ - o = argv[ai] + 1; - done = 0; - optarg = -1; - while (*o && !done) { - /* find matching option */ - if ((mi = optMatch(opt, o, 0)) < 0) - optFatal(_("unrecognized option `-%c'\n"), *o); - - /* does this option take an argument? */ - optarg = -1; - arg = NULL; - if (optNeedsArgument(&opt[mi])) { - /* option needs an argument. find it. */ - arg = o + 1; - if (!*arg) { - if ((optarg = ai + 1) == *argc) - optFatal(_("option `%s' requires an argument\n"), - optString(&opt[mi], 0)); - arg = argv[optarg]; - } - done = 1; - } - /* perform the action of this option. */ - optExecute(&opt[mi], arg, 0); - ++o; - } - /* remove option and any argument from the argv-array. */ - if (optarg >= 0) - argvRemove(argc, argv, ai); - argvRemove(argc, argv, ai); - } else { - /* a non-option argument */ - ++ai; - } - } -} diff --git a/hwclock/shhopt.h b/hwclock/shhopt.h deleted file mode 100644 index ca8501ef..00000000 --- a/hwclock/shhopt.h +++ /dev/null @@ -1,33 +0,0 @@ -/* $Id: shhopt.h,v 2.2 1997/07/06 23:11:58 aebr Exp $ */ -#ifndef SHHOPT_H -#define SHHOPT_H - -/* constants for recognized option types. */ -typedef enum { - OPT_END, /* nothing. used as ending element. */ - OPT_FLAG, /* no argument following. sets variable to 1. */ - OPT_STRING, /* string argument. */ - OPT_INT, /* signed integer argument. */ - OPT_UINT, /* unsigned integer argument. */ - OPT_LONG, /* signed long integer argument. */ - OPT_ULONG, /* unsigned long integer argument. */ -} optArgType; - -/* flags modifying the default way options are handeled. */ -#define OPT_CALLFUNC 1 /* pass argument to a function. */ - -typedef struct { - char shortName; /* Short option name. */ - char *longName; /* Long option name, no including '--'. */ - optArgType type; /* Option type. */ - void *arg; /* Pointer to variable to fill with argument, - * or pointer to function if Type == OPT_FUNC. */ - int flags; /* Modifier flags. */ -} optStruct; - - -void optSetFatalFunc(void (*f)(const char *, ...)); -void optParseOptions(int *argc, char *argv[], - const optStruct opt[], int allowNegNum); - -#endif diff --git a/lib/nls.h b/lib/nls.h index d36a5bc8..f54f94df 100644 --- a/lib/nls.h +++ b/lib/nls.h @@ -14,7 +14,7 @@ int main(int argc, char *argv[]); # include #endif -#ifdef ENABLE_NLS +#if defined MAY_ENABLE_NLS && !defined DISABLE_NLS # include # define _(Text) gettext (Text) # ifdef gettext_noop diff --git a/lib/pathnames.h b/lib/pathnames.h index 33886a5c..d9e05b32 100644 --- a/lib/pathnames.h +++ b/lib/pathnames.h @@ -105,7 +105,7 @@ Libc5 and glibc 2.0-2.1 have /var/spool/mail, but glibc 2.1.1 has /var/mail. /* no more . in DEFPATH */ #define _PATH_DEFPATH "/usr/local/bin:/bin:/usr/bin" -#define _PATH_DEFPATH_ROOT SBINDIR ":/bin:" USRSBINDIR ":/usr/bin" +#define _PATH_DEFPATH_ROOT "/usr/local/sbin:/usr/local/bin:" SBINDIR ":/bin:" USRSBINDIR ":/usr/bin" #define _PATH_HUSHLOGIN ".hushlogin" #define _PATH_LASTLOG LOGDIR "/lastlog" diff --git a/lib/widechar.h b/lib/widechar.h index 1aa91f3f..61021be3 100644 --- a/lib/widechar.h +++ b/lib/widechar.h @@ -14,7 +14,7 @@ #if 1 /* explicit prototypes, since sometimes does not give them */ -extern int wcwidth (wint_t c); +extern int wcwidth (wchar_t c); /* old: wint_t c */ extern int wcswidth (const wchar_t *s, size_t n); extern size_t wcslen (const wchar_t *s); extern wchar_t *wcsdup (const wchar_t *s); diff --git a/mount/Makefile b/mount/Makefile index 453b640a..52c4cff6 100644 --- a/mount/Makefile +++ b/mount/Makefile @@ -91,15 +91,25 @@ nfsmount_xdr.o: nfsmount_xdr.c $(COMPILE) $(RPC_CFLAGS) nfsmount_xdr.c ifeq "$(HAVE_GOOD_RPC)" "yes" -nfsmount.h nfsmount_xdr.c nfsmount_clnt.c: nfsmount.x - rm -f nfsmount.h nfsmount_xdr.c nfsmount_clnt.c +nfsmount.h: nfsmount.x + rm -f nfsmount.h $(RPCGEN) -h -o nfsmount.h nfsmount.x + +nfsmount_xdr.c: nfsmount.x + rm -f nfsmount_xdr.c $(RPCGEN) -c -o nfsmount_xdr.c nfsmount.x + +nfsmount_clnt.c: nfsmount.x + rm -f nfsmount_clnt.c $(RPCGEN) -l -o nfsmount_clnt.c nfsmount.x else -nfsmount.h nfsmount_xdr.c nfsmount_clnt.c: +nfsmount.h: cp $(RPCSVCDIR)/nfsmount.h . + +nfsmount_xdr.c: cp $(RPCSVCDIR)/nfsmount_xdr.c . + +nfsmount_clnt.c: cp $(RPCSVCDIR)/nfsmount_clnt.c . endif diff --git a/mount/fstab.c b/mount/fstab.c index 9329d1ce..3e314223 100644 --- a/mount/fstab.c +++ b/mount/fstab.c @@ -515,7 +515,7 @@ update_mtab (const char *dir, struct mntent *instead) { /* write chain to mtemp */ mftmp = my_setmntent (MOUNTED_TEMP, "w"); - if (mftmp == NULL || mfp->mntent_fp == NULL) { + if (mftmp == NULL || mftmp->mntent_fp == NULL) { int errsv = errno; error (_("cannot open %s (%s) - mtab not updated"), MOUNTED_TEMP, strerror (errsv)); diff --git a/mount/linux_fs.h b/mount/linux_fs.h index 3885d724..4bcf80b6 100644 --- a/mount/linux_fs.h +++ b/mount/linux_fs.h @@ -21,7 +21,7 @@ struct minix_super_block { u_char s_dummy[16]; u_char s_magic[2]; }; -#define minixmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8)) +#define minixmagic(s) assemble2le(s.s_magic) #define ISODCL(from, to) (to - from + 1) #define ISO_STANDARD_ID "CD001" @@ -46,7 +46,7 @@ struct ext_super_block { u_char s_dummy[56]; u_char s_magic[2]; }; -#define extmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8)) +#define extmagic(s) assemble2le(s.s_magic) #define EXT2_PRE_02B_MAGIC 0xEF51 #define EXT2_SUPER_MAGIC 0xEF53 @@ -63,7 +63,7 @@ struct ext2_super_block { u_char s_dummy3[88]; u_char s_journal_inum[4]; /* ext3 only */ }; -#define ext2magic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8)) +#define ext2magic(s) assemble2le(s.s_magic) struct reiserfs_super_block { @@ -96,9 +96,7 @@ struct xiafs_super_block { u_char s_dummy[60]; u_char s_magic[4]; }; -#define xiafsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ - (((uint) s.s_magic[2]) << 16) + \ - (((uint) s.s_magic[3]) << 24)) +#define xiafsmagic(s) assemble4le(s.s_magic) /* From jj@sunsite.ms.mff.cuni.cz Mon Mar 23 15:19:05 1998 */ #define UFS_SUPER_MAGIC_LE 0x00011954 @@ -107,9 +105,7 @@ struct ufs_super_block { u_char s_dummy[0x55c]; u_char s_magic[4]; }; -#define ufsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ - (((uint) s.s_magic[2]) << 16) + \ - (((uint) s.s_magic[3]) << 24)) +#define ufsmagic(s) assemble4le(s.s_magic) /* From Richard.Russon@ait.co.uk Wed Feb 24 08:05:27 1999 */ #define NTFS_SUPER_MAGIC "NTFS" @@ -150,9 +146,7 @@ struct cramfs_super_block { u_char s_dummy[12]; u_char s_id[16]; }; -#define cramfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ - (((uint) s.s_magic[2]) << 16) + \ - (((uint) s.s_magic[3]) << 24)) +#define cramfsmagic(s) assemble4le(s.s_magic) #define HFS_SUPER_MAGIC 0x4244 struct hfs_super_block { @@ -160,20 +154,15 @@ struct hfs_super_block { u_char s_dummy[18]; u_char s_blksize[4]; }; -#define hfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8)) -#define hfsblksize(s) ((uint) s.s_blksize[0] + \ - (((uint) s.s_blksize[1]) << 8) + \ - (((uint) s.s_blksize[2]) << 16) + \ - (((uint) s.s_blksize[3]) << 24)) +#define hfsmagic(s) assemble2le(s.s_magic) +#define hfsblksize(s) assemble4le(s.s_blksize) #define HPFS_SUPER_MAGIC 0xf995e849 struct hpfs_super_block { u_char s_magic[4]; u_char s_magic2[4]; }; -#define hpfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ - (((uint) s.s_magic[2]) << 16) + \ - (((uint) s.s_magic[3]) << 24)) +#define hpfsmagic(s) assemble4le(s.s_magic) struct adfs_super_block { u_char s_dummy[448]; @@ -187,9 +176,7 @@ struct adfs_super_block { struct vxfs_super_block { u_char s_magic[4]; }; -#define vxfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ - (((uint) s.s_magic[2]) << 16) + \ - (((uint) s.s_magic[3]) << 24)) +#define vxfsmagic(s) assemble4le(s.s_magic) #define VXFS_SUPER_MAGIC 0xa501FCF5 struct jfs_super_block { @@ -200,14 +187,26 @@ struct jfs_super_block { #define JFS_SUPER1_OFF 0x8000 #define JFS_MAGIC "JFS1" -#define SYSV_SUPER_MAGIC 0xfd187e20 - struct sysv_super_block { u_char s_dummy1[504]; u_char s_magic[4]; u_char type[4]; }; +#define sysvmagic(s) assemble4le(s.s_magic) +#define SYSV_SUPER_MAGIC 0xfd187e20 + +struct mdp_super_block { + u_char md_magic[4]; +}; +#define MD_SB_MAGIC 0xa92b4efc +#define mdsbmagic(s) assemble4le(s.md_magic) + +static inline int +assemble2le(unsigned char *p) { + return (p[0] | (p[1] << 8)); +} -#define sysvmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ - (((uint) s.s_magic[2]) << 16) + \ - (((uint) s.s_magic[3]) << 24)) +static inline int +assemble4le(unsigned char *p) { + return (p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24)); +} diff --git a/mount/mount.8 b/mount/mount.8 index 7f2f4d93..763e8fca 100644 --- a/mount/mount.8 +++ b/mount/mount.8 @@ -548,6 +548,11 @@ effect. .B sync All I/O to the file system should be done synchronously. .TP +.B dirsync +All directory updates within the file system should be done synchronously. +This affects the following system calls: creat, link, unlink, symlink, +mkdir, rmdir, mknod and rename. +.TP .B user Allow an ordinary user to mount the file system. The name of the mounting user is written to mtab so that he can unmount @@ -1125,8 +1130,8 @@ For details, see Especially useful options include .TP .B rsize=8192,wsize=8192 -This will make your nfs connection much faster than with the default -buffer size of 1024. (NFSv2 does not work with larger values of +This will make your nfs connection faster than with the default +buffer size of 4096. (NFSv2 does not work with larger values of .B rsize and .BR wsize .) @@ -1175,6 +1180,7 @@ hard links instead of being suppressed. .TP \fBuid=\fP\fIvalue\fP, \fBgid=\fP\fIvalue\fP and \fBumask=\fP\fIvalue\fP Set the file permission on the filesystem. +The umask value is given in octal. By default, the files are owned by root and not readable by somebody else. .SH "Mount options for proc" @@ -1316,6 +1322,7 @@ Set the default group. .TP .B umask= Set the default umask. +The value is given in octal. .TP .B uid= Set the default user. @@ -1661,7 +1668,7 @@ temporary file It is possible for a corrupted file system to cause a crash. .PP Some Linux file systems don't support -.B "\-o sync" +.B "\-o sync and \-o dirsync" (the ext2 and ext3 file systems .I do support synchronous updates (a la BSD) when mounted with the diff --git a/mount/mount.c b/mount/mount.c index 125cf1ab..fb1ca716 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -94,7 +94,7 @@ int sloppy = 0; static int readwrite = 0; /* True for all mount (-a). */ -int all = 0; +int mount_all = 0; /* True for fork() during all mount (-F). */ static int optfork = 0; @@ -148,6 +148,7 @@ static const struct opt_map opt_map[] = { { "nodev", 0, 0, MS_NODEV }, /* don't interpret devices */ { "sync", 0, 0, MS_SYNCHRONOUS}, /* synchronous I/O */ { "async", 0, 1, MS_SYNCHRONOUS}, /* asynchronous I/O */ + { "dirsync", 0, 0, MS_DIRSYNC}, /* synchronous directory modifications */ { "remount", 0, 0, MS_REMOUNT}, /* Alter flags of mounted FS */ { "bind", 0, 0, MS_BIND }, /* Remount part of tree elsewhere */ { "auto", 0, 1, MS_NOAUTO }, /* Can be mounted using -a */ @@ -201,25 +202,25 @@ static struct string_opt_map { static void clear_string_opts(void) { - struct string_opt_map *m; + struct string_opt_map *m; - for (m = &string_opt_map[0]; m->tag; m++) - *(m->valptr) = NULL; + for (m = &string_opt_map[0]; m->tag; m++) + *(m->valptr) = NULL; } static int parse_string_opt(char *s) { - struct string_opt_map *m; - int lth; - - for (m = &string_opt_map[0]; m->tag; m++) { - lth = strlen(m->tag); - if (!strncmp(s, m->tag, lth)) { - *(m->valptr) = xstrdup(s + lth); - return 1; - } - } - return 0; + struct string_opt_map *m; + int lth; + + for (m = &string_opt_map[0]; m->tag; m++) { + lth = strlen(m->tag); + if (!strncmp(s, m->tag, lth)) { + *(m->valptr) = xstrdup(s + lth); + return 1; + } + } + return 0; } int mount_quiet=0; @@ -264,54 +265,54 @@ print_all (char *types) { */ static inline void parse_opt (const char *opt, int *mask, char *extra_opts) { - const struct opt_map *om; - - for (om = opt_map; om->opt != NULL; om++) - if (streq (opt, om->opt)) { - if (om->inv) - *mask &= ~om->mask; - else - *mask |= om->mask; - if ((om->mask == MS_USER || om->mask == MS_USERS) - && !om->inv) - *mask |= MS_SECURE; - if ((om->mask == MS_OWNER) && !om->inv) - *mask |= MS_OWNERSECURE; + const struct opt_map *om; + + for (om = opt_map; om->opt != NULL; om++) + if (streq (opt, om->opt)) { + if (om->inv) + *mask &= ~om->mask; + else + *mask |= om->mask; + if ((om->mask == MS_USER || om->mask == MS_USERS) + && !om->inv) + *mask |= MS_SECURE; + if ((om->mask == MS_OWNER) && !om->inv) + *mask |= MS_OWNERSECURE; #ifdef MS_SILENT - if (om->mask == MS_SILENT && om->inv) { - mount_quiet = 1; - verbose = 0; - } + if (om->mask == MS_SILENT && om->inv) { + mount_quiet = 1; + verbose = 0; + } #endif - return; - } + return; + } - if (*extra_opts) - strcat(extra_opts, ","); + if (*extra_opts) + strcat(extra_opts, ","); - /* convert nonnumeric ids to numeric */ - if (!strncmp(opt, "uid=", 4) && !isdigit(opt[4])) { - struct passwd *pw = getpwnam(opt+4); - char uidbuf[20]; + /* convert nonnumeric ids to numeric */ + if (!strncmp(opt, "uid=", 4) && !isdigit(opt[4])) { + struct passwd *pw = getpwnam(opt+4); + char uidbuf[20]; - if (pw) { - sprintf(uidbuf, "uid=%d", pw->pw_uid); - strcat(extra_opts, uidbuf); - return; - } - } - if (!strncmp(opt, "gid=", 4) && !isdigit(opt[4])) { - struct group *gr = getgrnam(opt+4); - char gidbuf[20]; - - if (gr) { - sprintf(gidbuf, "gid=%d", gr->gr_gid); - strcat(extra_opts, gidbuf); - return; - } - } + if (pw) { + sprintf(uidbuf, "uid=%d", pw->pw_uid); + strcat(extra_opts, uidbuf); + return; + } + } + if (!strncmp(opt, "gid=", 4) && !isdigit(opt[4])) { + struct group *gr = getgrnam(opt+4); + char gidbuf[20]; + + if (gr) { + sprintf(gidbuf, "gid=%d", gr->gr_gid); + strcat(extra_opts, gidbuf); + return; + } + } - strcat(extra_opts, opt); + strcat(extra_opts, opt); } /* Take -o options list and compute 4th and 5th args to mount(2). flags @@ -344,30 +345,31 @@ parse_opts (char *opts, int *flags, char **extra_opts) { /* Try to build a canonical options string. */ static char * fix_opts_string (int flags, const char *extra_opts, const char *user) { - const struct opt_map *om; - const struct string_opt_map *m; - char *new_opts; - - new_opts = (flags & MS_RDONLY) ? "ro" : "rw"; - for (om = opt_map; om->opt != NULL; om++) { - if (om->skip) - continue; - if (om->inv || !om->mask || (flags & om->mask) != om->mask) - continue; - new_opts = xstrconcat3(new_opts, ",", om->opt); - flags &= ~om->mask; - } - for (m = &string_opt_map[0]; m->tag; m++) { - if (!m->skip && *(m->valptr)) - new_opts = xstrconcat4(new_opts, ",", m->tag, *(m->valptr)); - } - if (extra_opts && *extra_opts) { - new_opts = xstrconcat3(new_opts, ",", extra_opts); - } - if (user) { - new_opts = xstrconcat3(new_opts, ",user=", user); - } - return new_opts; + const struct opt_map *om; + const struct string_opt_map *m; + char *new_opts; + + new_opts = (flags & MS_RDONLY) ? "ro" : "rw"; + for (om = opt_map; om->opt != NULL; om++) { + if (om->skip) + continue; + if (om->inv || !om->mask || (flags & om->mask) != om->mask) + continue; + new_opts = xstrconcat3(new_opts, ",", om->opt); + flags &= ~om->mask; + } + for (m = &string_opt_map[0]; m->tag; m++) { + if (!m->skip && *(m->valptr)) + new_opts = xstrconcat4(new_opts, ",", + m->tag, *(m->valptr)); + } + if (extra_opts && *extra_opts) { + new_opts = xstrconcat3(new_opts, ",", extra_opts); + } + if (user) { + new_opts = xstrconcat3(new_opts, ",user=", user); + } + return new_opts; } static int @@ -757,12 +759,12 @@ try_mount_one (const char *spec0, const char *node0, char *types0, parse_opts (xstrdup (opts), &flags, &extra_opts); - suid_check (spec, node, &flags, &user); - /* quietly succeed for fstab entries that don't get mounted automatically */ - if (all && (flags & MS_NOAUTO)) + if (mount_all && (flags & MS_NOAUTO)) return 0; + suid_check (spec, node, &flags, &user); + mount_opts = extra_opts; if (opt_speed) @@ -872,7 +874,7 @@ retry_nfs: /* heuristic: if /proc/version exists, then probably proc is mounted */ if (stat ("/proc/version", &statbuf)) /* proc mounted? */ error (_("mount: %s is busy"), node); /* no */ - else if(!all || verbose) /* yes, don't mention it */ + else if (!mount_all || verbose) /* yes, don't mention it */ error (_("mount: proc already mounted")); } else { error (_("mount: %s already mounted or %s busy"), spec, node); @@ -1095,10 +1097,11 @@ mount_one (const char *spec, const char *node, char *types, const char *opts, specset = 1; nspec = get_spec_by_uuid(spec+5); } else if (!strncmp(spec, "LABEL=", 6)) { - const char *nspec2; + const char *nspec2 = NULL; specset = 2; nspec = get_spec_by_volume_label(spec+6); - nspec2 = second_occurrence_of_vol_label(spec+6); + if (nspec) + nspec2 = second_occurrence_of_vol_label(spec+6); if (nspec2) { if (verbose) printf(_("mount: the label %s occurs on " @@ -1117,7 +1120,7 @@ mount_one (const char *spec, const char *node, char *types, const char *opts, if (verbose > 1) printf(_("mount: going to mount %s by %s\n"), spec, (specset==1) ? _("UUID") : _("label")); - } else if(!all) + } else if(!mount_all) die (EX_USAGE, _("mount: no such partition found")); /* if -a then we may be rescued by a noauto option */ } @@ -1128,6 +1131,11 @@ mount_one (const char *spec, const char *node, char *types, const char *opts, if (verbose) printf(_("mount: no type was given - " "I'll assume nfs because of the colon\n")); + } else if(!strncmp(spec, "//", 2)) { + types = "smb"; + if (verbose) + printf(_("mount: no type was given - " + "I'll assume smb because of the // prefix\n")); } } @@ -1181,6 +1189,19 @@ mounted (char *spec, char *node) { return 0; } +/* avoid using stat() on things we are not going to mount anyway.. */ +static int +has_noauto (char *opts) { + char *s; + + if (!opts) + return 0; + s = strstr(opts, "noauto"); + if (!s) + return 0; + return (s == opts || s[-1] == ',') && (s[6] == 0 || s[6] == ','); +} + /* Mount all filesystems of the specified types except swap and root. */ /* With the --fork option: fork and let different incarnations of mount handle different filesystems. However, try to avoid several @@ -1188,118 +1209,131 @@ mounted (char *spec, char *node) { #define DISKMAJOR(m) (((int) m) & ~0xf) static int -mount_all (char *types, char *options) { - struct mntentchn *mc, *mc0, *mtmp; - int status = 0; - struct stat statbuf; - struct child { - pid_t pid; - char *group; - struct mntentchn *mec; - struct mntentchn *meclast; - struct child *nxt; - } childhead, *childtail, *cp; - char major[22]; - char *g, *colon; - - /* build a chain of what we have to do, or maybe - several chains, one for each major or NFS host */ - childhead.nxt = 0; - childtail = &childhead; - mc0 = fstab_head(); - for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) { - if (matching_type (mc->m.mnt_type, types) - && !streq (mc->m.mnt_dir, "/") - && !streq (mc->m.mnt_dir, "root")) { - if (mounted (mc->m.mnt_fsname, mc->m.mnt_dir)) { - if (verbose) - printf(_("mount: %s already mounted on %s\n"), - mc->m.mnt_fsname, mc->m.mnt_dir); - } else { - mtmp = (struct mntentchn *) xmalloc(sizeof(*mtmp)); - *mtmp = *mc; - mtmp->nxt = 0; - g = NULL; - if (optfork) { - if (stat(mc->m.mnt_fsname, &statbuf) == 0 && - S_ISBLK(statbuf.st_mode)) { - sprintf(major, "#%x", DISKMAJOR(statbuf.st_rdev)); - g = major; - } +do_mount_all (char *types, char *options) { + struct mntentchn *mc, *mc0, *mtmp; + int status = 0; + struct stat statbuf; + struct child { + pid_t pid; + char *group; + struct mntentchn *mec; + struct mntentchn *meclast; + struct child *nxt; + } childhead, *childtail, *cp; + char major[22]; + char *g, *colon; + + /* build a chain of what we have to do, or maybe + several chains, one for each major or NFS host */ + childhead.nxt = 0; + childtail = &childhead; + mc0 = fstab_head(); + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) { + if (has_noauto (mc->m.mnt_opts)) + continue; + if (matching_type (mc->m.mnt_type, types) + && !streq (mc->m.mnt_dir, "/") + && !streq (mc->m.mnt_dir, "root")) { + + if (mounted (mc->m.mnt_fsname, mc->m.mnt_dir)) { + if (verbose) + printf(_("mount: %s already mounted " + "on %s\n"), + mc->m.mnt_fsname, + mc->m.mnt_dir); + continue; + } + + mtmp = (struct mntentchn *) xmalloc(sizeof(*mtmp)); + *mtmp = *mc; + mtmp->nxt = 0; + g = NULL; + if (optfork) { + if (stat(mc->m.mnt_fsname, &statbuf) == 0 && + S_ISBLK(statbuf.st_mode)) { + sprintf(major, "#%x", + DISKMAJOR(statbuf.st_rdev)); + g = major; + } #ifdef HAVE_NFS - if (strcmp(mc->m.mnt_type, "nfs") == 0) { - g = xstrdup(mc->m.mnt_fsname); - colon = strchr(g, ':'); - if (colon) - *colon = '\0'; - } + if (strcmp(mc->m.mnt_type, "nfs") == 0) { + g = xstrdup(mc->m.mnt_fsname); + colon = strchr(g, ':'); + if (colon) + *colon = '\0'; + } #endif - } - if (g) { - for (cp = childhead.nxt; cp; cp = cp->nxt) - if (cp->group && strcmp(cp->group, g) == 0) { - cp->meclast->nxt = mtmp; - cp->meclast = mtmp; - goto fnd; - } - } - cp = (struct child *) xmalloc(sizeof *cp); - cp->nxt = 0; - cp->mec = cp->meclast = mtmp; - cp->group = xstrdup(g); - cp->pid = 0; - childtail->nxt = cp; - childtail = cp; - fnd:; - } - } - } + } + if (g) { + for (cp = childhead.nxt; cp; cp = cp->nxt) + if (cp->group && + strcmp(cp->group, g) == 0) { + cp->meclast->nxt = mtmp; + cp->meclast = mtmp; + goto fnd; + } + } + cp = (struct child *) xmalloc(sizeof *cp); + cp->nxt = 0; + cp->mec = cp->meclast = mtmp; + cp->group = xstrdup(g); + cp->pid = 0; + childtail->nxt = cp; + childtail = cp; + fnd:; + + } + } - /* now do everything */ - for (cp = childhead.nxt; cp; cp = cp->nxt) { - pid_t p = -1; - if (optfork) { - p = fork(); - if (p == -1) { - int errsv = errno; - error(_("mount: cannot fork: %s"), strerror (errsv)); - } - else if (p != 0) - cp->pid = p; - } + /* now do everything */ + for (cp = childhead.nxt; cp; cp = cp->nxt) { + pid_t p = -1; + if (optfork) { + p = fork(); + if (p == -1) { + int errsv = errno; + error(_("mount: cannot fork: %s"), + strerror (errsv)); + } + else if (p != 0) + cp->pid = p; + } - /* if child, or not forked, do the mounting */ - if (p == 0 || p == -1) { - for (mc = cp->mec; mc; mc = mc->nxt) - status |= mount_one (mc->m.mnt_fsname, mc->m.mnt_dir, - mc->m.mnt_type, mc->m.mnt_opts, - options, 0, 0); - if (mountcount) - status |= EX_SOMEOK; - if (p == 0) - exit(status); - } - } + /* if child, or not forked, do the mounting */ + if (p == 0 || p == -1) { + for (mc = cp->mec; mc; mc = mc->nxt) { + status |= mount_one (mc->m.mnt_fsname, + mc->m.mnt_dir, + mc->m.mnt_type, + mc->m.mnt_opts, + options, 0, 0); + } + if (mountcount) + status |= EX_SOMEOK; + if (p == 0) + exit(status); + } + } - /* wait for children, if any */ - while ((cp = childhead.nxt) != NULL) { - childhead.nxt = cp->nxt; - if (cp->pid) { - int ret; - keep_waiting: - if(waitpid(cp->pid, &ret, 0) == -1) { - if (errno == EINTR) - goto keep_waiting; - perror("waitpid"); - } else if (WIFEXITED(ret)) - status |= WEXITSTATUS(ret); - else - status |= EX_SYSERR; - } - } - if (mountcount) - status |= EX_SOMEOK; - return status; + /* wait for children, if any */ + while ((cp = childhead.nxt) != NULL) { + childhead.nxt = cp->nxt; + if (cp->pid) { + int ret; + keep_waiting: + if(waitpid(cp->pid, &ret, 0) == -1) { + if (errno == EINTR) + goto keep_waiting; + perror("waitpid"); + } else if (WIFEXITED(ret)) + status |= WEXITSTATUS(ret); + else + status |= EX_SYSERR; + } + } + if (mountcount) + status |= EX_SOMEOK; + return status; } extern char version[]; @@ -1391,10 +1425,10 @@ main (int argc, char *argv[]) { while ((c = getopt_long (argc, argv, "afFhlL:no:rsU:vVwt:", longopts, NULL)) != -1) { switch (c) { - case 'a': /* mount everything in fstab */ - ++all; + case 'a': /* mount everything in fstab */ + ++mount_all; break; - case 'f': /* fake: don't actually call mount(2) */ + case 'f': /* fake: don't actually call mount(2) */ ++fake; break; case 'F': @@ -1484,7 +1518,7 @@ main (int argc, char *argv[]) { specseen = (uuid || volumelabel) ? 1 : 0; /* yes, .. i know */ - if (argc+specseen == 0 && !all) { + if (argc+specseen == 0 && !mount_all) { if (options || mounttype) usage (stderr, EX_USAGE); return print_all (types); @@ -1492,7 +1526,7 @@ main (int argc, char *argv[]) { if (getuid () != geteuid ()) { suid = 1; - if (types || options || readwrite || nomtab || all || + if (types || options || readwrite || nomtab || mount_all || fake || mounttype || (argc + specseen) != 1) die (EX_USAGE, _("mount: only root can do that")); } @@ -1527,7 +1561,7 @@ main (int argc, char *argv[]) { switch (argc+specseen) { case 0: /* mount -a */ - result = mount_all (types, options); + result = do_mount_all (types, options); if (result == 0 && verbose) error(_("nothing was mounted")); break; diff --git a/mount/mount_by_label.c b/mount/mount_by_label.c index ee3b1d52..2ae351d1 100644 --- a/mount/mount_by_label.c +++ b/mount/mount_by_label.c @@ -39,6 +39,30 @@ static struct uuidCache_s { char *device; } *uuidCache = NULL; +/* + * See whether this device has (the magic of) a RAID superblock at the end. + * If so, it probably is, or has been, part of a RAID array. + */ +static int +is_raid_partition(int fd) { + struct mdp_super_block mdsb; + int n; + + /* hardcode 4096 here in various places, because that's + what it's defined to be. Note that even if we used + the actual kernel headers, sizeof(mdp_super_t) is + slightly larger in the 2.2 kernel on 64-bit archs, + so using that wouldn't work. */ + lseek(fd, -4096, SEEK_END); /* Ignore possible error + about return value overflow */ + n = 4096; + if (sizeof(mdsb) < n) + n = sizeof(mdsb); + if (read(fd, &mdsb, n) != n) + return 1; /* error */ + return (mdsbmagic(mdsb) == MD_SB_MAGIC); +} + /* for now, only ext2, ext3 and xfs are supported */ static int get_label_uuid(const char *device, char **label, char *uuid) { @@ -56,6 +80,12 @@ get_label_uuid(const char *device, char **label, char *uuid) { if (fd < 0) return rv; + /* If there is a RAID partition, or an error, ignore this partition */ + if (is_raid_partition(fd)) { + close(fd); + return rv; + } + if (lseek(fd, 1024, SEEK_SET) == 1024 && read(fd, (char *) &e2sb, sizeof(e2sb)) == sizeof(e2sb) && (ext2magic(e2sb) == EXT2_SUPER_MAGIC)) { diff --git a/mount/mount_constants.h b/mount/mount_constants.h index cdbced88..1eab36e0 100644 --- a/mount/mount_constants.h +++ b/mount/mount_constants.h @@ -19,6 +19,10 @@ #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_ACTION_MASK #define MS_ACTION_MASK 0x380 /* Remount, but new filesystem may be different from old. Atomic diff --git a/mount/mount_guess_fstype.c b/mount/mount_guess_fstype.c index 63b00ba8..23a11685 100644 --- a/mount/mount_guess_fstype.c +++ b/mount/mount_guess_fstype.c @@ -60,11 +60,6 @@ swapped(unsigned short a) { return (a>>8) | (a<<8); } -static inline int -assemble4le(unsigned char *p) { - return (p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24)); -} - /* char *guess_fstype(const char *device); diff --git a/mount/nfs.5 b/mount/nfs.5 index d2165b85..3f177660 100644 --- a/mount/nfs.5 +++ b/mount/nfs.5 @@ -144,7 +144,8 @@ for hosts that can run multiple NFS servers. The default value is version 2. .TP 1.5i .I nolock -Disable NFS locking. This has to be used with some old NFS servers +Disable NFS locking. Do not start lockd. +This has to be used with some old NFS servers that don't support locking. .TP 1.5i .I bg @@ -196,9 +197,6 @@ server performance penalty but it allows two different NFS clients to get reasonable good results when both clients are actively writing to common filesystem on the server. .TP 1.5i -.I nolock -Do not use locking. Do not start lockd. -.TP 1.5i .I tcp Mount the NFS filesystem using the TCP protocol instead of the default UDP protocol. Many NFS servers only support UDP. diff --git a/mount/pivot_root.c b/mount/pivot_root.c index 674271ad..faa0e4d5 100644 --- a/mount/pivot_root.c +++ b/mount/pivot_root.c @@ -15,15 +15,15 @@ static _syscall2(int,pivot_root,const char *,new_root,const char *,put_old) #endif -int main(int argc,const char **argv) +int main(int argc, const char **argv) { - if (argc != 3) { - fprintf(stderr,"usage: %s new_root put_old\n",argv[0]); - return 1; - } - if (pivot_root(argv[1],argv[2]) < 0) { - perror("pivot_root"); - return 1; - } - return 0; + if (argc != 3) { + fprintf(stderr, "usage: %s new_root put_old\n", argv[0]); + return 1; + } + if (pivot_root(argv[1],argv[2]) < 0) { + perror("pivot_root"); + return 1; + } + return 0; } diff --git a/mount/sundries.h b/mount/sundries.h index 5b91ca1e..788bef64 100644 --- a/mount/sundries.h +++ b/mount/sundries.h @@ -22,7 +22,6 @@ extern int sloppy; /* Functions in sundries.c that are used in mount.c and umount.c */ void block_signals (int how); char *canonicalize (const char *path); -char *realpath (const char *path, char *resolved_path); void error (const char *fmt, ...); int matching_type (const char *type, const char *types); void *xmalloc (size_t size); diff --git a/mount/swapon.8 b/mount/swapon.8 index 61cd3b37..4e03cf38 100644 --- a/mount/swapon.8 +++ b/mount/swapon.8 @@ -74,10 +74,8 @@ Provide help Display version .TP .B \-s -Display swap usage summary by device. -This option is only available if -.I /proc/swaps -exists (probably not before kernel 2.1.25). +Display swap usage summary by device. Equivalent to "cat /proc/swaps". +Not available before Linux 2.1.25. .TP .B \-a All devices marked as ``sw'' swap devices in @@ -101,12 +99,14 @@ for use with .BR "swapon -a" . .PP .B Swapoff -disables swapping on the specified devices and files, or on all swap -entries in -.I /etc/fstab -when the +disables swapping on the specified devices and files. +When the .B \-a -flag is given. +flag is given, swapping is disabled on all known swap devices and files +(as found in +.I /proc/swaps +or +.IR /etc/fstab ). .SH NOTE You should not use .B swapon diff --git a/mount/swapon.c b/mount/swapon.c index 29c859db..c2ae20a9 100644 --- a/mount/swapon.c +++ b/mount/swapon.c @@ -1,13 +1,13 @@ /* * A swapon(8)/swapoff(8) for Linux 0.99. * swapon.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp - * Added '-s' (Summary option) 02/1997. * + * 1997-02-xx + * - added '-s' (summary option) * 1999-02-22 Arkadiusz Mi¶kiewicz * - added Native Language Support - * Sun Mar 21 1999 - Arnaldo Carvalho de Melo + * 1999-03-21 Arnaldo Carvalho de Melo * - fixed strerr(errno) in gettext calls - * */ #include @@ -28,32 +28,46 @@ #define SWAPON_NEEDS_TWO_ARGS -/* Nonzero for chatty (-v). This is a nonstandard flag (not in BSD). */ +#define QUIET 1 + +int all = 0; int verbose = 0; int priority = -1; /* non-prioritized swap by default */ extern char version[]; static char *program_name; -static struct option longopts[] = -{ - { "all", 0, 0, 'a' }, - { "help", 0, 0, 'h' }, - { "priority", required_argument, 0, 'p' }, - { "summary", 0, 0, 's' }, - { "verbose", 0, 0, 'v' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } + +static struct option longswaponopts[] = { + /* swapon only */ + { "priority", required_argument, 0, 'p' }, + { "summary", 0, 0, 's' }, + /* also for swapoff */ + { "all", 0, 0, 'a' }, + { "help", 0, 0, 'h' }, + { "verbose", 0, 0, 'v' }, + { "version", 0, 0, 'V' }, + { NULL, 0, 0, 0 } }; +static struct option *longswapoffopts = &longswaponopts[2]; + static void -usage (FILE *fp, int n) -{ - fprintf (fp, _("usage: %s [-hV]\n" - " %s -a [-v]\n" - " %s [-v] [-p priority] special ...\n" - " %s [-s]\n"), - program_name, program_name, program_name, program_name); - exit (n); +swapon_usage(FILE *fp, int n) { + fprintf(fp, _("usage: %s [-hV]\n" + " %s -a [-v]\n" + " %s [-v] [-p priority] special ...\n" + " %s [-s]\n"), + program_name, program_name, program_name, program_name); + exit(n); +} + +static void +swapoff_usage(FILE *fp, int n) { + fprintf(fp, _("usage: %s [-hV]\n" + " %s -a [-v]\n" + " %s [-v] special ...\n"), + program_name, program_name, program_name); + exit(n); } #ifdef SWAPON_HAS_TWO_ARGS @@ -78,168 +92,326 @@ _syscall1(int, swapoff, const char *, path); #include #endif -static int -swap (const char *special, int prio) -{ - int status; - struct stat st; - if (verbose) - printf(_("%s on %s\n"), program_name, special); +/* + * contents of /proc/swaps + */ +static int numSwaps; +static char **swapFiles; /* array of swap file and partition names */ - if (streq (program_name, "swapon")) { - if (stat(special, &st) < 0) { - int errsv = errno; - fprintf (stderr, _("swapon: cannot stat %s: %s\n"), - special, strerror (errsv)); - return -1; - } - - /* people generally dislike this warning - now it is printed - only when `verbose' is set */ - if (verbose) { - int permMask = (S_ISBLK(st.st_mode) ? 07007 : 07077); - - if ((st.st_mode & permMask) != 0) { - fprintf(stderr, - _("swapon: warning: %s has insecure permissions %04o, " - "%04o suggested\n"), - special, st.st_mode & 07777, ~permMask & 0666); - } - } - - /* test for holes by LBT */ - if (S_ISREG(st.st_mode)) { - if (st.st_blocks * 512 < st.st_size) { - fprintf(stderr, - _("swapon: Skipping file %s - it appears to have holes.\n"), - special); - return -1; - } - } +static void +read_proc_swaps(void) { + FILE *swaps; + char line[1024]; + char *p; -#ifdef SWAPON_NEEDS_TWO_ARGS - { - int flags = 0; + numSwaps = 0; + swapFiles = NULL; -#ifdef SWAP_FLAG_PREFER - if (prio >= 0) { - if (prio > SWAP_FLAG_PRIO_MASK) - prio = SWAP_FLAG_PRIO_MASK; - flags = SWAP_FLAG_PREFER - | ((prio & SWAP_FLAG_PRIO_MASK) << SWAP_FLAG_PRIO_SHIFT); - } -#endif - status = swapon (special, flags); - } -#else - status = swapon (special); -#endif - } else - status = swapoff (special); + swaps = fopen(PROC_SWAPS, "r"); + if (swaps == NULL) + return; /* nothing wrong */ + + /* skip the first line */ + fgets(line, sizeof(line), swaps); - if (status < 0) { - int errsv = errno; - fprintf (stderr, "%s: %s: %s\n", program_name, special, strerror (errsv)); - } + while (fgets(line, sizeof(line), swaps)) { + /* + * Cut the line "swap_device ... more info" after device. + * This will fail with names with embedded spaces. + */ + for (p = line; *p && *p != ' '; p++); + *p = 0; - return status; + numSwaps++; + swapFiles = realloc(swapFiles, + numSwaps * sizeof(*swapFiles)); + swapFiles[numSwaps-1] = strdup(line); + } + fclose(swaps); +} + +static int +is_in_proc_swaps(char *fname) { + int i; + + for (i = 0; i < numSwaps; i++) + if (!strcmp(fname, swapFiles[i])) + return 1; + return 0; } static int display_summary(void) { FILE *swaps; - char line[200] ; + char line[1024] ; if ((swaps = fopen(PROC_SWAPS, "r")) == NULL) { int errsv = errno; - fprintf (stderr, "%s: %s: %s\n", program_name, PROC_SWAPS, - strerror (errsv)); + fprintf(stderr, "%s: %s: %s\n", program_name, PROC_SWAPS, + strerror(errsv)); return -1 ; } - while ( fgets(line, sizeof(line), swaps)) - printf ("%s", line); + while (fgets(line, sizeof(line), swaps)) + printf("%s", line); fclose(swaps); return 0 ; } -int -main (int argc, char *argv[]) -{ - struct mntent *fstab; - int status; - int all = 0; - int c; - - setlocale(LC_ALL, ""); - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); - - if (strrchr (argv[0], '/') != NULL) - program_name = strrchr (argv[0], '/') + 1; - else - program_name = argv[0]; - - while ((c = getopt_long (argc, argv, "ahp:svV", longopts, NULL)) != -1) - switch (c) - { - case 'a': /* all */ - ++all; - break; - case 'h': /* help */ - usage (stdout, 0); - break; - case 'p': /* priority */ - priority = atoi(optarg); - break; - case 's': /* tell about current use of swap areas */ - status = display_summary(); - exit(status); - case 'v': /* be chatty */ - ++verbose; - break; - case 'V': /* version */ - printf ("%s: %s\n", program_name, version); - exit (0); - case 0: - break; - case '?': - default: - usage (stderr, 1); - } - - argv += optind; - - status = 0; - - if (all) { - FILE *fp = setmntent(_PATH_FSTAB, "r"); - if (fp == NULL) { - int errsv = errno; - fprintf(stderr, _("%s: cannot open %s: %s\n"), program_name, - _PATH_FSTAB, strerror(errsv)); - exit(2); - } - while ((fstab = getmntent(fp)) != NULL) { - if (streq (fstab->mnt_type, MNTTYPE_SWAP)) { - /* parse mount options; */ - char *opt, *opts = strdup(fstab->mnt_opts); +static int +do_swapon(const char *special, int prio) { + int status; + struct stat st; + + if (verbose) + printf(_("%s on %s\n"), program_name, special); + + if (stat(special, &st) < 0) { + int errsv = errno; + fprintf(stderr, _("swapon: cannot stat %s: %s\n"), + special, strerror(errsv)); + return -1; + } + + /* people generally dislike this warning - now it is printed + only when `verbose' is set */ + if (verbose) { + int permMask = (S_ISBLK(st.st_mode) ? 07007 : 07077); + + if ((st.st_mode & permMask) != 0) { + fprintf(stderr, _("swapon: warning: %s has " + "insecure permissions %04o, " + "%04o suggested\n"), + special, st.st_mode & 07777, + ~permMask & 0666); + } + } + + /* test for holes by LBT */ + if (S_ISREG(st.st_mode)) { + if (st.st_blocks * 512 < st.st_size) { + fprintf(stderr, + _("swapon: Skipping file %s - it appears " + "to have holes.\n"), + special); + return -1; + } + } + +#ifdef SWAPON_NEEDS_TWO_ARGS + { + int flags = 0; + +#ifdef SWAP_FLAG_PREFER + if (prio >= 0) { + if (prio > SWAP_FLAG_PRIO_MASK) + prio = SWAP_FLAG_PRIO_MASK; + flags = SWAP_FLAG_PREFER + | ((prio & SWAP_FLAG_PRIO_MASK) + << SWAP_FLAG_PRIO_SHIFT); + } +#endif + status = swapon(special, flags); + } +#else + status = swapon(special); +#endif + if (status < 0) { + int errsv = errno; + fprintf(stderr, "%s: %s: %s\n", program_name, + special, strerror(errsv)); + } + + return status; +} + +static int +do_swapoff(const char *special, int quiet) { + if (verbose) + printf(_("%s on %s\n"), program_name, special); + + if (swapoff(special) == 0) + return 0; /* success */ + + if (errno == EPERM) { + fprintf(stderr, _("Not superuser.\n")); + exit(1); /* any further swapoffs will also fail */ + } + + if (!quiet) { + int errsv = errno; + fprintf(stderr, "%s: %s: %s\n", program_name, + special, strerror(errsv)); + } + return -1; +} + +static int +main_swapon(int argc, char *argv[]) { + FILE *fp; + struct mntent *fstab; + int status = 0; + int c; + + while ((c = getopt_long(argc, argv, "ahp:svV", + longswaponopts, NULL)) != -1) { + switch (c) { + case 'a': /* all */ + ++all; + break; + case 'h': /* help */ + swapon_usage(stdout, 0); + break; + case 'p': /* priority */ + priority = atoi(optarg); + break; + case 's': /* status report */ + status = display_summary(); + exit(status); + case 'v': /* be chatty */ + ++verbose; + break; + case 'V': /* version */ + printf("%s: %s\n", program_name, version); + exit(0); + case 0: + break; + case '?': + default: + swapon_usage(stderr, 1); + } + } + argv += optind; + + if (!all && *argv == NULL) + swapon_usage(stderr, 2); + + if (all) { + read_proc_swaps(); + + fp = setmntent(_PATH_FSTAB, "r"); + if (fp == NULL) { + int errsv = errno; + fprintf(stderr, _("%s: cannot open %s: %s\n"), + program_name, _PATH_FSTAB, strerror(errsv)); + exit(2); + } + while ((fstab = getmntent(fp)) != NULL) { + char *special = fstab->mnt_fsname; + + if (streq(fstab->mnt_type, MNTTYPE_SWAP) && + !is_in_proc_swaps(special)) { + /* parse mount options; */ + char *opt, *opts = strdup(fstab->mnt_opts); - for (opt = strtok (opts, ","); opt != NULL; - opt = strtok (NULL, ",")) - if (strncmp(opt, "pri=", 4) == 0) - priority = atoi(opt+4); - status |= swap (fstab->mnt_fsname, priority); - } - } - } else if (*argv == NULL) { - usage (stderr, 2); - } else { - while (*argv != NULL) - status |= swap (*argv++,priority); - } - return status; + for (opt = strtok(opts, ","); opt != NULL; + opt = strtok(NULL, ",")) + if (strncmp(opt, "pri=", 4) == 0) + priority = atoi(opt+4); + status |= do_swapon(special, priority); + } + } + } + + while (*argv != NULL) + status |= do_swapon(*argv++, priority); + + return status; +} + +static int +main_swapoff(int argc, char *argv[]) { + FILE *fp; + struct mntent *fstab; + int status = 0; + int c, i; + + while ((c = getopt_long(argc, argv, "ahvV", + longswapoffopts, NULL)) != -1) { + switch (c) { + case 'a': /* all */ + ++all; + break; + case 'h': /* help */ + swapoff_usage(stdout, 0); + break; + case 'v': /* be chatty */ + ++verbose; + break; + case 'V': /* version */ + printf("%s: %s\n", program_name, version); + exit(0); + case 0: + break; + case '?': + default: + swapoff_usage(stderr, 1); + } + } + argv += optind; + + if (!all && *argv == NULL) + swapoff_usage(stderr, 2); + + /* + * swapoff any explicitly given arguments. + * Complain in case the swapoff call fails. + */ + while (*argv != NULL) + status |= do_swapoff(*argv++, !QUIET); + + if (all) { + /* + * In case /proc/swaps exists, unmount stuff listed there. + * We are quiet but report errors in status. + * Errors might mean that /proc/swaps + * exists as ordinary file, not in procfs. + * do_swapoff() exits immediately on EPERM. + */ + read_proc_swaps(); + for(i=0; imnt_type, MNTTYPE_SWAP) && + !is_in_proc_swaps(fstab->mnt_fsname)) + do_swapoff(fstab->mnt_fsname, QUIET); + } + } + + return status; +} + +int +main(int argc, char *argv[]) { + char *p; + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + program_name = argv[0]; + p = strrchr(program_name, '/'); + if (p) + program_name = p+1; + + if (streq(program_name, "swapon")) + return main_swapon(argc, argv); + else + return main_swapoff(argc, argv); } diff --git a/partx/gpt.c b/partx/gpt.c index bf90fdeb..244320b3 100644 --- a/partx/gpt.c +++ b/partx/gpt.c @@ -38,8 +38,8 @@ #include "gpt.h" #include "partx.h" -#define BLKGETLASTSECT _IO(0x12,108) /* get last sector of block device */ -#define BLKGETSIZE _IO(0x12,96) /* return device size */ +#define BLKGETLASTSECT _IO(0x12,108) /* get last sector of block device */ +#define BLKGETSIZE _IO(0x12,96) /* return device size */ #define BLKSSZGET _IO(0x12,104) /* get block device sector size */ #define BLKGETSIZE64 _IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */ diff --git a/po/Makefile b/po/Makefile index 50c266d4..648577cb 100644 --- a/po/Makefile +++ b/po/Makefile @@ -3,6 +3,12 @@ PACKAGE = util-linux include ../make_include include ../MCONFIG +ifeq "(DISABLE_NLS)" "yes" + DO_NLS=no +else + DO_NLS=$(HAVE_XGETTEXT) +endif + # # po2tbl.sed is not taken from /usr/share/gettext/intl # Often it is not present. @@ -61,7 +67,7 @@ INSTOBJEXT = .mo sed -f $(PO2TBL) < $< > $*.msg \ && rm -f $@ && $(GENCAT) $@ $*.msg -all: all-$(HAVE_XGETTEXT) +all: all-$(DO_NLS) all-yes: cat-id-tbl.c $(CATALOGS) all-no: @@ -86,7 +92,7 @@ stamp-cat-id: util-linux.pot fi rm -f stamp-cat-id && echo timestamp > stamp-cat-id -install: install-data-$(HAVE_XGETTEXT) +install: install-data-$(DO_NLS) install-data-no: all install-data-yes: all @catalogs='$(CATALOGS)'; \ @@ -125,6 +131,7 @@ distclean: clean rm -f POTFILES *.gmo *.mo *.msg *.cat *.cat.m update-po: + rm -f util-linux.pot $(MAKE) util-linux.pot catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ diff --git a/po/POTFILES.in b/po/POTFILES.in index 8d0931c8..c6ff12cf 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,10 +1,12 @@ disk-utils/blockdev.c disk-utils/elvtune.c disk-utils/fdformat.c +disk-utils/fsck.cramfs.c disk-utils/fsck.minix.c disk-utils/isosize.c disk-utils/mkfs.bfs.c disk-utils/mkfs.c +disk-utils/mkfs.cramfs.c disk-utils/mkfs.minix.c disk-utils/mkswap.c disk-utils/raw.c @@ -25,7 +27,6 @@ hwclock/cmos.c hwclock/hwclock.c hwclock/kd.c hwclock/rtc.c -hwclock/shhopt.c lib/carefulputc.c lib/env.c lib/err.c @@ -103,5 +104,6 @@ text-utils/hexsyntax.c text-utils/more.c text-utils/odsyntax.c text-utils/parse.c +text-utils/pg.c text-utils/rev.c text-utils/ul.c diff --git a/po/cat-id-tbl.c b/po/cat-id-tbl.c index e87d3b6f..39e5894b 100644 --- a/po/cat-id-tbl.c +++ b/po/cat-id-tbl.c @@ -543,145 +543,146 @@ content won't be recoverable.\n\ {"Note: sector size is %d (not %d)\n", 452}, {"You will not be able to write the partition table.\n", 453}, {"\ +This disk has both DOS and BSD magic.\n\ +Give the 'b' command to go to BSD mode.\n", 454}, + {"\ Device contains neither a valid DOS partition table, nor Sun, SGI or OSF \ -disklabel\n", 454}, - {"Internal error\n", 455}, - {"Ignoring extra extended partition %d\n", 456}, +disklabel\n", 455}, + {"Internal error\n", 456}, + {"Ignoring extra extended partition %d\n", 457}, {"\ Warning: invalid flag 0x%04x of partition table %d will be corrected by w\ -(rite)\n", 457}, +(rite)\n", 458}, {"\ \n\ -got EOF thrice - exiting..\n", 458}, - {"Hex code (type L to list codes): ", 459}, - {"%s (%d-%d, default %d): ", 460}, - {"Using default value %d\n", 461}, - {"Value out of range.\n", 462}, - {"Partition number", 463}, - {"Warning: partition %d has empty type\n", 464}, - {"cylinder", 465}, - {"sector", 466}, - {"Changing display/entry units to %s\n", 467}, - {"WARNING: Partition %d is an extended partition\n", 468}, - {"DOS Compatibility flag is set\n", 469}, - {"DOS Compatibility flag is not set\n", 470}, - {"Partition %d does not exist yet!\n", 471}, +got EOF thrice - exiting..\n", 459}, + {"Hex code (type L to list codes): ", 460}, + {"%s (%d-%d, default %d): ", 461}, + {"Using default value %d\n", 462}, + {"Value out of range.\n", 463}, + {"Partition number", 464}, + {"Warning: partition %d has empty type\n", 465}, + {"cylinder", 466}, + {"sector", 467}, + {"Changing display/entry units to %s\n", 468}, + {"WARNING: Partition %d is an extended partition\n", 469}, + {"DOS Compatibility flag is set\n", 470}, + {"DOS Compatibility flag is not set\n", 471}, + {"Partition %d does not exist yet!\n", 472}, {"\ Type 0 means free space to many systems\n\ (but not to Linux). Having partitions of\n\ type 0 is probably unwise. You can delete\n\ -a partition using the `d' command.\n", 472}, +a partition using the `d' command.\n", 473}, {"\ You cannot change a partition into an extended one or vice versa\n\ -Delete it first.\n", 473}, +Delete it first.\n", 474}, {"\ Consider leaving partition 3 as Whole disk (5),\n\ as SunOS/Solaris expects it and even Linux likes it.\n\ -\n", 474}, +\n", 475}, {"\ Consider leaving partition 9 as volume header (0),\n\ and partition 11 as entire volume (6)as IRIX expects it.\n\ -\n", 475}, - {"Changed system type of partition %d to %x (%s)\n", 476}, - {"Partition %d has different physical/logical beginnings (non-Linux?):\n", 477}, - {" phys=(%d, %d, %d) ", 478}, - {"logical=(%d, %d, %d)\n", 479}, - {"Partition %d has different physical/logical endings:\n", 480}, - {"Partition %i does not start on cylinder boundary:\n", 481}, - {"should be (%d, %d, 1)\n", 482}, - {"Partition %i does not end on cylinder boundary:\n", 483}, - {"should be (%d, %d, %d)\n", 484}, +\n", 476}, + {"Changed system type of partition %d to %x (%s)\n", 477}, + {"Partition %d has different physical/logical beginnings (non-Linux?):\n", 478}, + {" phys=(%d, %d, %d) ", 479}, + {"logical=(%d, %d, %d)\n", 480}, + {"Partition %d has different physical/logical endings:\n", 481}, + {"Partition %i does not start on cylinder boundary:\n", 482}, + {"should be (%d, %d, 1)\n", 483}, + {"Partition %i does not end on cylinder boundary:\n", 484}, + {"should be (%d, %d, %d)\n", 485}, {"\ \n\ Disk %s: %d heads, %d sectors, %d cylinders\n\ Units = %s of %d * %d bytes\n\ -\n", 485}, +\n", 486}, {"\ Nothing to do. Ordering is correct already.\n\ -\n", 486}, - {"%*s Boot Start End Blocks Id System\n", 487}, - {"Device", 488}, +\n", 487}, + {"%*s Boot Start End Blocks Id System\n", 488}, + {"Device", 489}, {"\ \n\ -Partition table entries are not in disk order\n", 489}, +Partition table entries are not in disk order\n", 490}, {"\ \n\ Disk %s: %d heads, %d sectors, %d cylinders\n\ -\n", 490}, - {"Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n", 491}, - {"Warning: partition %d contains sector 0\n", 492}, - {"Partition %d: head %d greater than maximum %d\n", 493}, - {"Partition %d: sector %d greater than maximum %d\n", 494}, - {"Partitions %d: cylinder %d greater than maximum %d\n", 495}, - {"Partition %d: previous sectors %d disagrees with total %d\n", 496}, - {"Warning: bad start-of-data in partition %d\n", 497}, - {"Warning: partition %d overlaps partition %d.\n", 498}, - {"Warning: partition %d is empty\n", 499}, - {"Logical partition %d not entirely in partition %d\n", 500}, - {"Total allocated sectors %d greater than the maximum %d\n", 501}, - {"%d unallocated sectors\n", 502}, - {"Partition %d is already defined. Delete it before re-adding it.\n", 503}, - {"First %s", 504}, - {"Sector %d is already allocated\n", 505}, - {"No free sectors available\n", 506}, - {"Last %s or +size or +sizeM or +sizeK", 507}, +\n", 491}, + {"Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n", 492}, + {"Warning: partition %d contains sector 0\n", 493}, + {"Partition %d: head %d greater than maximum %d\n", 494}, + {"Partition %d: sector %d greater than maximum %d\n", 495}, + {"Partitions %d: cylinder %d greater than maximum %d\n", 496}, + {"Partition %d: previous sectors %d disagrees with total %d\n", 497}, + {"Warning: bad start-of-data in partition %d\n", 498}, + {"Warning: partition %d overlaps partition %d.\n", 499}, + {"Warning: partition %d is empty\n", 500}, + {"Logical partition %d not entirely in partition %d\n", 501}, + {"Total allocated sectors %d greater than the maximum %d\n", 502}, + {"%d unallocated sectors\n", 503}, + {"Partition %d is already defined. Delete it before re-adding it.\n", 504}, + {"First %s", 505}, + {"Sector %d is already allocated\n", 506}, + {"No free sectors available\n", 507}, + {"Last %s or +size or +sizeM or +sizeK", 508}, {"\ \tSorry - this fdisk cannot handle AIX disk labels.\n\ \tIf you want to add DOS-type partitions, create\n\ \ta new empty DOS partition table first. (Use o.)\n\ -\tWARNING: This will destroy the present disk contents.\n", 508}, - {"The maximum number of partitions has been created\n", 509}, - {"You must delete some partition and add an extended partition first\n", 510}, +\tWARNING: This will destroy the present disk contents.\n", 509}, + {"The maximum number of partitions has been created\n", 510}, + {"You must delete some partition and add an extended partition first\n", 511}, {"\ Command action\n\ %s\n\ - p primary partition (1-4)\n", 511}, - {"l logical (5 or over)", 512}, - {"e extended", 513}, - {"Invalid partition number for type `%c'\n", 514}, + p primary partition (1-4)\n", 512}, + {"l logical (5 or over)", 513}, + {"e extended", 514}, + {"Invalid partition number for type `%c'\n", 515}, {"\ The partition table has been altered!\n\ -\n", 515}, - {"Calling ioctl() to re-read partition table.\n", 516}, +\n", 516}, + {"Calling ioctl() to re-read partition table.\n", 517}, {"\ \n\ WARNING: Re-reading the partition table failed with error %d: %s.\n\ The kernel still uses the old table.\n\ -The new table will be used at the next reboot.\n", 517}, +The new table will be used at the next reboot.\n", 518}, {"\ \n\ WARNING: If you have created or modified any DOS 6.x\n\ partitions, please see the fdisk manual page for additional\n\ -information.\n", 518}, - {"Syncing disks.\n", 519}, - {"Partition %d has no data area\n", 520}, - {"New beginning of data", 521}, - {"Expert command (m for help): ", 522}, - {"Number of cylinders", 523}, - {"Number of heads", 524}, - {"Number of sectors", 525}, - {"Warning: setting sector offset for DOS compatiblity\n", 526}, - {"Disk %s doesn't contain a valid partition table\n", 527}, - {"Cannot open %s\n", 528}, - {"cannot open %s\n", 529}, - {"%c: unknown command\n", 530}, - {"This kernel finds the sector size itself - -b option ignored\n", 531}, +information.\n", 519}, + {"Syncing disks.\n", 520}, + {"Partition %d has no data area\n", 521}, + {"New beginning of data", 522}, + {"Expert command (m for help): ", 523}, + {"Number of cylinders", 524}, + {"Number of heads", 525}, + {"Number of sectors", 526}, + {"Warning: setting sector offset for DOS compatiblity\n", 527}, + {"Disk %s doesn't contain a valid partition table\n", 528}, + {"Cannot open %s\n", 529}, + {"cannot open %s\n", 530}, + {"%c: unknown command\n", 531}, + {"This kernel finds the sector size itself - -b option ignored\n", 532}, {"\ Warning: the -b (set sector size) option should be used with one specified \ -device\n", 532}, - {"\ -Detected an OSF/1 disklabel on %s, entering disklabel mode.\n\ -To return to DOS partition table mode, use the 'r' command.\n", 533}, - {"Command (m for help): ", 534}, +device\n", 533}, + {"Detected an OSF/1 disklabel on %s, entering disklabel mode.\n", 534}, + {"Command (m for help): ", 535}, {"\ \n\ -The current boot file is: %s\n", 535}, - {"Please enter the name of the new boot file: ", 536}, - {"Boot file unchanged\n", 537}, +The current boot file is: %s\n", 536}, + {"Please enter the name of the new boot file: ", 537}, + {"Boot file unchanged\n", 538}, {"\ \n\ \tSorry, no experts menu for SGI partition tables available.\n\ -\n", 538}, +\n", 539}, {"\ \n\ \tThere is a valid AIX label on this disk.\n\ @@ -694,94 +695,94 @@ The current boot file is: %s\n", 535}, \t erase the other disks as well, if unmirrored.)\n\ \t3. Before deleting this physical volume be sure\n\ \t to remove the disk logically from your AIX\n\ -\t machine. (Otherwise you become an AIXpert).", 539}, +\t machine. (Otherwise you become an AIXpert).", 540}, {"\ \n\ -BSD label for device: %s\n", 540}, - {" d delete a BSD partition", 541}, - {" e edit drive data", 542}, - {" i install bootstrap", 543}, - {" l list known filesystem types", 544}, - {" n add a new BSD partition", 545}, - {" p print BSD partition table", 546}, - {" s show complete disklabel", 547}, - {" t change a partition's filesystem id", 548}, - {" u change units (cylinders/sectors)", 549}, - {" w write disklabel to disk", 550}, - {" x link BSD partition to non-BSD partition", 551}, - {"Partition %s has invalid starting sector 0.\n", 552}, - {"Reading disklabel of %s at sector %d.\n", 553}, - {"There is no *BSD partition on %s.\n", 554}, - {"BSD disklabel command (m for help): ", 555}, - {"type: %s\n", 556}, - {"type: %d\n", 557}, - {"disk: %.*s\n", 558}, - {"label: %.*s\n", 559}, - {"flags:", 560}, - {" removable", 561}, - {" ecc", 562}, - {" badsect", 563}, - {"bytes/sector: %ld\n", 564}, - {"sectors/track: %ld\n", 565}, - {"tracks/cylinder: %ld\n", 566}, - {"sectors/cylinder: %ld\n", 567}, - {"cylinders: %ld\n", 568}, - {"rpm: %d\n", 569}, - {"interleave: %d\n", 570}, - {"trackskew: %d\n", 571}, - {"cylinderskew: %d\n", 572}, - {"headswitch: %ld\t\t# milliseconds\n", 573}, - {"track-to-track seek: %ld\t# milliseconds\n", 574}, - {"drivedata: ", 575}, +BSD label for device: %s\n", 541}, + {" d delete a BSD partition", 542}, + {" e edit drive data", 543}, + {" i install bootstrap", 544}, + {" l list known filesystem types", 545}, + {" n add a new BSD partition", 546}, + {" p print BSD partition table", 547}, + {" s show complete disklabel", 548}, + {" t change a partition's filesystem id", 549}, + {" u change units (cylinders/sectors)", 550}, + {" w write disklabel to disk", 551}, + {" x link BSD partition to non-BSD partition", 552}, + {"Partition %s has invalid starting sector 0.\n", 553}, + {"Reading disklabel of %s at sector %d.\n", 554}, + {"There is no *BSD partition on %s.\n", 555}, + {"BSD disklabel command (m for help): ", 556}, + {"type: %s\n", 557}, + {"type: %d\n", 558}, + {"disk: %.*s\n", 559}, + {"label: %.*s\n", 560}, + {"flags:", 561}, + {" removable", 562}, + {" ecc", 563}, + {" badsect", 564}, + {"bytes/sector: %ld\n", 565}, + {"sectors/track: %ld\n", 566}, + {"tracks/cylinder: %ld\n", 567}, + {"sectors/cylinder: %ld\n", 568}, + {"cylinders: %ld\n", 569}, + {"rpm: %d\n", 570}, + {"interleave: %d\n", 571}, + {"trackskew: %d\n", 572}, + {"cylinderskew: %d\n", 573}, + {"headswitch: %ld\t\t# milliseconds\n", 574}, + {"track-to-track seek: %ld\t# milliseconds\n", 575}, + {"drivedata: ", 576}, {"\ \n\ -%d partitions:\n", 576}, - {"# start end size fstype [fsize bsize cpg]\n", 577}, - {"Writing disklabel to %s.\n", 578}, - {"%s contains no disklabel.\n", 579}, - {"Do you want to create a disklabel? (y/n) ", 580}, - {"bytes/sector", 581}, - {"sectors/track", 582}, - {"tracks/cylinder", 583}, - {"sectors/cylinder", 584}, - {"Must be <= sectors/track * tracks/cylinder (default).\n", 585}, - {"rpm", 586}, - {"interleave", 587}, - {"trackskew", 588}, - {"cylinderskew", 589}, - {"headswitch", 590}, - {"track-to-track seek", 591}, - {"Bootstrap: %sboot -> boot%s (%s): ", 592}, - {"Bootstrap overlaps with disk label!\n", 593}, - {"Bootstrap installed on %s.\n", 594}, - {"Partition (a-%c): ", 595}, - {"This partition already exists.\n", 596}, - {"Warning: too many partitions (%d, maximum is %d).\n", 597}, +%d partitions:\n", 577}, + {"# start end size fstype [fsize bsize cpg]\n", 578}, + {"Writing disklabel to %s.\n", 579}, + {"%s contains no disklabel.\n", 580}, + {"Do you want to create a disklabel? (y/n) ", 581}, + {"bytes/sector", 582}, + {"sectors/track", 583}, + {"tracks/cylinder", 584}, + {"sectors/cylinder", 585}, + {"Must be <= sectors/track * tracks/cylinder (default).\n", 586}, + {"rpm", 587}, + {"interleave", 588}, + {"trackskew", 589}, + {"cylinderskew", 590}, + {"headswitch", 591}, + {"track-to-track seek", 592}, + {"Bootstrap: %sboot -> boot%s (%s): ", 593}, + {"Bootstrap overlaps with disk label!\n", 594}, + {"Bootstrap installed on %s.\n", 595}, + {"Partition (a-%c): ", 596}, + {"This partition already exists.\n", 597}, + {"Warning: too many partitions (%d, maximum is %d).\n", 598}, {"\ \n\ -Syncing disks.\n", 598}, - {"SGI volhdr", 599}, - {"SGI trkrepl", 600}, - {"SGI secrepl", 601}, - {"SGI raw", 602}, - {"SGI bsd", 603}, - {"SGI sysv", 604}, - {"SGI volume", 605}, - {"SGI efs", 606}, - {"SGI lvol", 607}, - {"SGI rlvol", 608}, - {"SGI xfs", 609}, - {"SGI xfslog", 610}, - {"SGI xlv", 611}, - {"SGI xvm", 612}, - {"Linux swap", 613}, - {"Linux native", 614}, - {"Linux LVM", 615}, - {"Linux RAID", 616}, +Syncing disks.\n", 599}, + {"SGI volhdr", 600}, + {"SGI trkrepl", 601}, + {"SGI secrepl", 602}, + {"SGI raw", 603}, + {"SGI bsd", 604}, + {"SGI sysv", 605}, + {"SGI volume", 606}, + {"SGI efs", 607}, + {"SGI lvol", 608}, + {"SGI rlvol", 609}, + {"SGI xfs", 610}, + {"SGI xfslog", 611}, + {"SGI xlv", 612}, + {"SGI xvm", 613}, + {"Linux swap", 614}, + {"Linux native", 615}, + {"Linux LVM", 616}, + {"Linux RAID", 617}, {"\ According to MIPS Computer Systems, Inc the Label must not contain more than \ -512 bytes\n", 617}, - {"Detected sgi disklabel with wrong checksum.\n", 618}, +512 bytes\n", 618}, + {"Detected sgi disklabel with wrong checksum.\n", 619}, {"\ \n\ Disk %s (SGI disk label): %d heads, %d sectors\n\ @@ -789,141 +790,141 @@ Disk %s (SGI disk label): %d heads, %d sectors\n\ %d extra sects/cyl, interleave %d:1\n\ %s\n\ Units = %s of %d * 512 bytes\n\ -\n", 619}, +\n", 620}, {"\ \n\ Disk %s (SGI disk label): %d heads, %d sectors, %d cylinders\n\ Units = %s of %d * 512 bytes\n\ -\n", 620}, +\n", 621}, {"\ ----- partitions -----\n\ -Pt# %*s Info Start End Sectors Id System\n", 621}, +Pt# %*s Info Start End Sectors Id System\n", 622}, {"\ ----- Bootinfo -----\n\ Bootfile: %s\n\ ------ Directory Entries -----\n", 622}, - {"%2d: %-10s sector%5u size%8u\n", 623}, +----- Directory Entries -----\n", 623}, + {"%2d: %-10s sector%5u size%8u\n", 624}, {"\ \n\ Invalid Bootfile!\n\ \tThe bootfile must be an absolute non-zero pathname,\n\ -\te.g. \"/unix\" or \"/unix.save\".\n", 624}, +\te.g. \"/unix\" or \"/unix.save\".\n", 625}, {"\ \n\ -\tName of Bootfile too long: 16 bytes maximum.\n", 625}, +\tName of Bootfile too long: 16 bytes maximum.\n", 626}, {"\ \n\ -\tBootfile must have a fully qualified pathname.\n", 626}, +\tBootfile must have a fully qualified pathname.\n", 627}, {"\ \n\ \tBe aware, that the bootfile is not checked for existence.\n\ -\tSGI's default is \"/unix\" and for backup \"/unix.save\".\n", 627}, +\tSGI's default is \"/unix\" and for backup \"/unix.save\".\n", 628}, {"\ \n\ -\tBootfile is changed to \"%s\".\n", 628}, - {"More than one entire disk entry present.\n", 629}, - {"No partitions defined\n", 630}, - {"IRIX likes when Partition 11 covers the entire disk.\n", 631}, +\tBootfile is changed to \"%s\".\n", 629}, + {"More than one entire disk entry present.\n", 630}, + {"No partitions defined\n", 631}, + {"IRIX likes when Partition 11 covers the entire disk.\n", 632}, {"\ The entire disk partition should start at block 0,\n\ -not at diskblock %d.\n", 632}, +not at diskblock %d.\n", 633}, {"\ The entire disk partition is only %d diskblock large,\n\ -but the disk is %d diskblocks long.\n", 633}, - {"One Partition (#11) should cover the entire disk.\n", 634}, - {"Partition %d does not start on cylinder boundary.\n", 635}, - {"Partition %d does not end on cylinder boundary.\n", 636}, - {"The Partition %d and %d overlap by %d sectors.\n", 637}, - {"Unused gap of %8d sectors - sectors %8d-%d\n", 638}, +but the disk is %d diskblocks long.\n", 634}, + {"One Partition (#11) should cover the entire disk.\n", 635}, + {"Partition %d does not start on cylinder boundary.\n", 636}, + {"Partition %d does not end on cylinder boundary.\n", 637}, + {"The Partition %d and %d overlap by %d sectors.\n", 638}, + {"Unused gap of %8d sectors - sectors %8d-%d\n", 639}, {"\ \n\ -The boot partition does not exist.\n", 639}, +The boot partition does not exist.\n", 640}, {"\ \n\ -The swap partition does not exist.\n", 640}, +The swap partition does not exist.\n", 641}, {"\ \n\ -The swap partition has no swap type.\n", 641}, - {"\tYou have chosen an unusual boot file name.\n", 642}, - {"Sorry You may change the Tag of non-empty partitions.\n", 643}, +The swap partition has no swap type.\n", 642}, + {"\tYou have chosen an unusual boot file name.\n", 643}, + {"Sorry You may change the Tag of non-empty partitions.\n", 644}, {"\ It is highly recommended that the partition at offset 0\n\ is of type \"SGI volhdr\", the IRIX system will rely on it to\n\ retrieve from its directory standalone tools like sash and fx.\n\ Only the \"SGI volume\" entire disk section may violate this.\n\ -Type YES if you are sure about tagging this partition differently.\n", 644}, - {"YES\n", 645}, - {"Do You know, You got a partition overlap on the disk?\n", 646}, - {"Attempting to generate entire disk entry automatically.\n", 647}, - {"The entire disk is already covered with partitions.\n", 648}, - {"You got a partition overlap on the disk. Fix it first!\n", 649}, +Type YES if you are sure about tagging this partition differently.\n", 645}, + {"YES\n", 646}, + {"Do You know, You got a partition overlap on the disk?\n", 647}, + {"Attempting to generate entire disk entry automatically.\n", 648}, + {"The entire disk is already covered with partitions.\n", 649}, + {"You got a partition overlap on the disk. Fix it first!\n", 650}, {"\ It is highly recommended that eleventh partition\n\ -covers the entire disk and is of type `SGI volume'\n", 650}, - {"You will get a partition overlap on the disk. Fix it first!\n", 651}, - {" Last %s", 652}, +covers the entire disk and is of type `SGI volume'\n", 651}, + {"You will get a partition overlap on the disk. Fix it first!\n", 652}, + {" Last %s", 653}, {"\ Building a new SGI disklabel. Changes will remain in memory only,\n\ until you decide to write them. After that, of course, the previous\n\ content will be unrecoverably lost.\n\ -\n", 653}, - {"Trying to keep parameters of partition %d.\n", 654}, - {"ID=%02x\tSTART=%d\tLENGTH=%d\n", 655}, - {"Empty", 656}, - {"SunOS root", 657}, - {"SunOS swap", 658}, - {"SunOS usr", 659}, - {"Whole disk", 660}, - {"SunOS stand", 661}, - {"SunOS var", 662}, - {"SunOS home", 663}, - {"Linux raid autodetect", 664}, +\n", 654}, + {"Trying to keep parameters of partition %d.\n", 655}, + {"ID=%02x\tSTART=%d\tLENGTH=%d\n", 656}, + {"Empty", 657}, + {"SunOS root", 658}, + {"SunOS swap", 659}, + {"SunOS usr", 660}, + {"Whole disk", 661}, + {"SunOS stand", 662}, + {"SunOS var", 663}, + {"SunOS home", 664}, + {"Linux raid autodetect", 665}, {"\ Detected sun disklabel with wrong checksum.\n\ Probably you'll have to set all the values,\n\ e.g. heads, sectors, cylinders and partitions\n\ -or force a fresh label (s command in main menu)\n", 665}, - {"Autoconfigure found a %s%s%s\n", 666}, +or force a fresh label (s command in main menu)\n", 666}, + {"Autoconfigure found a %s%s%s\n", 667}, {"\ Building a new sun disklabel. Changes will remain in memory only,\n\ until you decide to write them. After that, of course, the previous\n\ content won't be recoverable.\n\ -\n", 667}, +\n", 668}, {"\ Drive type\n\ ? auto configure\n\ - 0 custom (with hardware detected defaults)", 668}, - {"Select type (? for auto, 0 for custom): ", 669}, - {"Autoconfigure failed.\n", 670}, - {"Sectors/track", 671}, - {"Alternate cylinders", 672}, - {"Physical cylinders", 673}, - {"Rotation speed (rpm)", 674}, - {"Interleave factor", 675}, - {"Extra sectors per cylinder", 676}, - {"You may change all the disk params from the x menu", 677}, - {"3,5\" floppy", 678}, - {"Linux custom", 679}, - {"Partition %d doesn't end on cylinder boundary\n", 680}, - {"Partition %d overlaps with others in sectors %d-%d\n", 681}, - {"Unused gap - sectors 0-%d\n", 682}, - {"Unused gap - sectors %d-%d\n", 683}, + 0 custom (with hardware detected defaults)", 669}, + {"Select type (? for auto, 0 for custom): ", 670}, + {"Autoconfigure failed.\n", 671}, + {"Sectors/track", 672}, + {"Alternate cylinders", 673}, + {"Physical cylinders", 674}, + {"Rotation speed (rpm)", 675}, + {"Interleave factor", 676}, + {"Extra sectors per cylinder", 677}, + {"You may change all the disk params from the x menu", 678}, + {"3,5\" floppy", 679}, + {"Linux custom", 680}, + {"Partition %d doesn't end on cylinder boundary\n", 681}, + {"Partition %d overlaps with others in sectors %d-%d\n", 682}, + {"Unused gap - sectors 0-%d\n", 683}, + {"Unused gap - sectors %d-%d\n", 684}, {"\ Other partitions already cover the whole disk.\n\ -Delete some/shrink them before retry.\n", 684}, +Delete some/shrink them before retry.\n", 685}, {"\ You haven't covered the whole disk with the 3rd partition, but your value\n\ %d %s covers some other partition. Your entry has been changed\n\ -to %d %s\n", 685}, +to %d %s\n", 686}, {"\ If you want to maintain SunOS/Solaris compatibility, consider leaving this\n\ -partition as Whole disk (5), starting at 0, with %u sectors\n", 686}, +partition as Whole disk (5), starting at 0, with %u sectors\n", 687}, {"\ It is highly recommended that the partition at offset 0\n\ is UFS, EXT2FS filesystem or SunOS swap. Putting Linux swap\n\ there may destroy your partition table and bootblock.\n\ Type YES if you're very sure you would like that partition\n\ -tagged with 82 (Linux swap): ", 687}, +tagged with 82 (Linux swap): ", 688}, {"\ \n\ Disk %s (Sun disk label): %d heads, %d sectors, %d rpm\n\ @@ -931,456 +932,456 @@ Disk %s (Sun disk label): %d heads, %d sectors, %d rpm\n\ %d extra sects/cyl, interleave %d:1\n\ %s\n\ Units = %s of %d * 512 bytes\n\ -\n", 688}, +\n", 689}, {"\ \n\ Disk %s (Sun disk label): %d heads, %d sectors, %d cylinders\n\ Units = %s of %d * 512 bytes\n\ -\n", 689}, - {"%*s Flag Start End Blocks Id System\n", 690}, - {"Number of alternate cylinders", 691}, - {"Number of physical cylinders", 692}, - {"FAT12", 693}, - {"XENIX root", 694}, - {"XENIX usr", 695}, - {"FAT16 <32M", 696}, - {"Extended", 697}, - {"FAT16", 698}, - {"HPFS/NTFS", 699}, - {"AIX", 700}, - {"AIX bootable", 701}, - {"OS/2 Boot Manager", 702}, - {"Win95 FAT32", 703}, - {"Win95 FAT32 (LBA)", 704}, - {"Win95 FAT16 (LBA)", 705}, - {"Win95 Ext'd (LBA)", 706}, - {"OPUS", 707}, - {"Hidden FAT12", 708}, - {"Compaq diagnostics", 709}, - {"Hidden FAT16 <32M", 710}, - {"Hidden FAT16", 711}, - {"Hidden HPFS/NTFS", 712}, - {"AST SmartSleep", 713}, - {"Hidden Win95 FAT32", 714}, - {"Hidden Win95 FAT32 (LBA)", 715}, - {"Hidden Win95 FAT16 (LBA)", 716}, - {"NEC DOS", 717}, - {"Plan 9", 718}, - {"PartitionMagic recovery", 719}, - {"Venix 80286", 720}, - {"PPC PReP Boot", 721}, - {"SFS", 722}, - {"QNX4.x", 723}, - {"QNX4.x 2nd part", 724}, - {"QNX4.x 3rd part", 725}, - {"OnTrack DM", 726}, - {"OnTrack DM6 Aux1", 727}, - {"CP/M", 728}, - {"OnTrack DM6 Aux3", 729}, - {"OnTrackDM6", 730}, - {"EZ-Drive", 731}, - {"Golden Bow", 732}, - {"Priam Edisk", 733}, - {"SpeedStor", 734}, - {"GNU HURD or SysV", 735}, - {"Novell Netware 286", 736}, - {"Novell Netware 386", 737}, - {"DiskSecure Multi-Boot", 738}, - {"PC/IX", 739}, - {"Old Minix", 740}, - {"Minix / old Linux", 741}, - {"OS/2 hidden C: drive", 742}, - {"Linux extended", 743}, - {"NTFS volume set", 744}, - {"Amoeba", 745}, - {"Amoeba BBT", 746}, - {"BSD/OS", 747}, - {"IBM Thinkpad hibernation", 748}, - {"FreeBSD", 749}, - {"OpenBSD", 750}, - {"NeXTSTEP", 751}, - {"Darwin UFS", 752}, - {"NetBSD", 753}, - {"Darwin boot", 754}, - {"BSDI fs", 755}, - {"BSDI swap", 756}, - {"Boot Wizard hidden", 757}, - {"Solaris boot", 758}, - {"DRDOS/sec (FAT-12)", 759}, - {"DRDOS/sec (FAT-16 < 32M)", 760}, - {"DRDOS/sec (FAT-16)", 761}, - {"Syrinx", 762}, - {"Non-FS data", 763}, - {"CP/M / CTOS / ...", 764}, - {"Dell Utility", 765}, - {"BootIt", 766}, - {"DOS access", 767}, - {"DOS R/O", 768}, - {"BeOS fs", 769}, - {"EFI GPT", 770}, - {"EFI (FAT-12/16/32)", 771}, - {"Linux/PA-RISC boot", 772}, - {"DOS secondary", 773}, - {"LANstep", 774}, - {"BBT", 775}, - {"seek error on %s - cannot seek to %lu\n", 776}, - {"seek error: wanted 0x%08x%08x, got 0x%08x%08x\n", 777}, - {"out of memory - giving up\n", 778}, - {"read error on %s - cannot read sector %lu\n", 779}, - {"ERROR: sector %lu does not have an msdos signature\n", 780}, - {"write error on %s - cannot write sector %lu\n", 781}, - {"cannot open partition sector save file (%s)\n", 782}, - {"write error on %s\n", 783}, - {"cannot stat partition restore file (%s)\n", 784}, - {"partition restore file has wrong size - not restoring\n", 785}, - {"out of memory?\n", 786}, - {"cannot open partition restore file (%s)\n", 787}, - {"error reading %s\n", 788}, - {"cannot open device %s for writing\n", 789}, - {"error writing sector %lu on %s\n", 790}, - {"Disk %s: cannot get size\n", 791}, - {"Disk %s: cannot get geometry\n", 792}, +\n", 690}, + {"%*s Flag Start End Blocks Id System\n", 691}, + {"Number of alternate cylinders", 692}, + {"Number of physical cylinders", 693}, + {"FAT12", 694}, + {"XENIX root", 695}, + {"XENIX usr", 696}, + {"FAT16 <32M", 697}, + {"Extended", 698}, + {"FAT16", 699}, + {"HPFS/NTFS", 700}, + {"AIX", 701}, + {"AIX bootable", 702}, + {"OS/2 Boot Manager", 703}, + {"Win95 FAT32", 704}, + {"Win95 FAT32 (LBA)", 705}, + {"Win95 FAT16 (LBA)", 706}, + {"Win95 Ext'd (LBA)", 707}, + {"OPUS", 708}, + {"Hidden FAT12", 709}, + {"Compaq diagnostics", 710}, + {"Hidden FAT16 <32M", 711}, + {"Hidden FAT16", 712}, + {"Hidden HPFS/NTFS", 713}, + {"AST SmartSleep", 714}, + {"Hidden Win95 FAT32", 715}, + {"Hidden Win95 FAT32 (LBA)", 716}, + {"Hidden Win95 FAT16 (LBA)", 717}, + {"NEC DOS", 718}, + {"Plan 9", 719}, + {"PartitionMagic recovery", 720}, + {"Venix 80286", 721}, + {"PPC PReP Boot", 722}, + {"SFS", 723}, + {"QNX4.x", 724}, + {"QNX4.x 2nd part", 725}, + {"QNX4.x 3rd part", 726}, + {"OnTrack DM", 727}, + {"OnTrack DM6 Aux1", 728}, + {"CP/M", 729}, + {"OnTrack DM6 Aux3", 730}, + {"OnTrackDM6", 731}, + {"EZ-Drive", 732}, + {"Golden Bow", 733}, + {"Priam Edisk", 734}, + {"SpeedStor", 735}, + {"GNU HURD or SysV", 736}, + {"Novell Netware 286", 737}, + {"Novell Netware 386", 738}, + {"DiskSecure Multi-Boot", 739}, + {"PC/IX", 740}, + {"Old Minix", 741}, + {"Minix / old Linux", 742}, + {"OS/2 hidden C: drive", 743}, + {"Linux extended", 744}, + {"NTFS volume set", 745}, + {"Amoeba", 746}, + {"Amoeba BBT", 747}, + {"BSD/OS", 748}, + {"IBM Thinkpad hibernation", 749}, + {"FreeBSD", 750}, + {"OpenBSD", 751}, + {"NeXTSTEP", 752}, + {"Darwin UFS", 753}, + {"NetBSD", 754}, + {"Darwin boot", 755}, + {"BSDI fs", 756}, + {"BSDI swap", 757}, + {"Boot Wizard hidden", 758}, + {"Solaris boot", 759}, + {"DRDOS/sec (FAT-12)", 760}, + {"DRDOS/sec (FAT-16 < 32M)", 761}, + {"DRDOS/sec (FAT-16)", 762}, + {"Syrinx", 763}, + {"Non-FS data", 764}, + {"CP/M / CTOS / ...", 765}, + {"Dell Utility", 766}, + {"BootIt", 767}, + {"DOS access", 768}, + {"DOS R/O", 769}, + {"BeOS fs", 770}, + {"EFI GPT", 771}, + {"EFI (FAT-12/16/32)", 772}, + {"Linux/PA-RISC boot", 773}, + {"DOS secondary", 774}, + {"LANstep", 775}, + {"BBT", 776}, + {"seek error on %s - cannot seek to %lu\n", 777}, + {"seek error: wanted 0x%08x%08x, got 0x%08x%08x\n", 778}, + {"out of memory - giving up\n", 779}, + {"read error on %s - cannot read sector %lu\n", 780}, + {"ERROR: sector %lu does not have an msdos signature\n", 781}, + {"write error on %s - cannot write sector %lu\n", 782}, + {"cannot open partition sector save file (%s)\n", 783}, + {"write error on %s\n", 784}, + {"cannot stat partition restore file (%s)\n", 785}, + {"partition restore file has wrong size - not restoring\n", 786}, + {"out of memory?\n", 787}, + {"cannot open partition restore file (%s)\n", 788}, + {"error reading %s\n", 789}, + {"cannot open device %s for writing\n", 790}, + {"error writing sector %lu on %s\n", 791}, + {"Disk %s: cannot get size\n", 792}, + {"Disk %s: cannot get geometry\n", 793}, {"\ Warning: start=%lu - this looks like a partition rather than\n\ the entire disk. Using fdisk on it is probably meaningless.\n\ -[Use the --force option if you really want this]\n", 793}, - {"Warning: HDIO_GETGEO says that there are %lu heads\n", 794}, - {"Warning: HDIO_GETGEO says that there are %lu sectors\n", 795}, - {"Warning: BLKGETSIZE/HDIO_GETGEO says that there are %lu cylinders\n", 796}, +[Use the --force option if you really want this]\n", 794}, + {"Warning: HDIO_GETGEO says that there are %lu heads\n", 795}, + {"Warning: HDIO_GETGEO says that there are %lu sectors\n", 796}, + {"Warning: BLKGETSIZE/HDIO_GETGEO says that there are %lu cylinders\n", 797}, {"\ Warning: unlikely number of sectors (%lu) - usually at most 63\n\ -This will give problems with all software that uses C/H/S addressing.\n", 797}, +This will give problems with all software that uses C/H/S addressing.\n", 798}, {"\ \n\ -Disk %s: %lu cylinders, %lu heads, %lu sectors/track\n", 798}, +Disk %s: %lu cylinders, %lu heads, %lu sectors/track\n", 799}, {"\ -%s of partition %s has impossible value for head: %lu (should be in 0-%lu)\n", 799}, +%s of partition %s has impossible value for head: %lu (should be in 0-%lu)\n", 800}, {"\ %s of partition %s has impossible value for sector: %lu (should be in 1-%\ -lu)\n", 800}, +lu)\n", 801}, {"\ %s of partition %s has impossible value for cylinders: %lu (should be in 0-%\ -lu)\n", 801}, +lu)\n", 802}, {"\ Id Name\n\ -\n", 802}, - {"Re-reading the partition table ...\n", 803}, +\n", 803}, + {"Re-reading the partition table ...\n", 804}, {"\ The command to re-read the partition table failed\n\ -Reboot your system now, before using mkfs\n", 804}, - {"Error closing %s\n", 805}, - {"%s: no such partition\n", 806}, - {"unrecognized format - using sectors\n", 807}, - {"# partition table of %s\n", 808}, - {"unimplemented format - using %s\n", 809}, +Reboot your system now, before using mkfs\n", 805}, + {"Error closing %s\n", 806}, + {"%s: no such partition\n", 807}, + {"unrecognized format - using sectors\n", 808}, + {"# partition table of %s\n", 809}, + {"unimplemented format - using %s\n", 810}, {"\ Units = cylinders of %lu bytes, blocks of 1024 bytes, counting from %d\n\ -\n", 810}, - {" Device Boot Start End #cyls #blocks Id System\n", 811}, +\n", 811}, + {" Device Boot Start End #cyls #blocks Id System\n", 812}, {"\ Units = sectors of 512 bytes, counting from %d\n\ -\n", 812}, - {" Device Boot Start End #sectors Id System\n", 813}, +\n", 813}, + {" Device Boot Start End #sectors Id System\n", 814}, {"\ Units = blocks of 1024 bytes, counting from %d\n\ -\n", 814}, - {" Device Boot Start End #blocks Id System\n", 815}, +\n", 815}, + {" Device Boot Start End #blocks Id System\n", 816}, {"\ Units = megabytes of 1048576 bytes, blocks of 1024 bytes, counting from %d\n\ -\n", 816}, - {" Device Boot Start End MB #blocks Id System\n", 817}, - {"\t\tstart: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 818}, - {"\t\tend: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 819}, - {"partition ends on cylinder %ld, beyond the end of the disk\n", 820}, - {"No partitions found\n", 821}, +\n", 817}, + {" Device Boot Start End MB #blocks Id System\n", 818}, + {"\t\tstart: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 819}, + {"\t\tend: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 820}, + {"partition ends on cylinder %ld, beyond the end of the disk\n", 821}, + {"No partitions found\n", 822}, {"\ Warning: The partition table looks like it was made\n\ for C/H/S=*/%ld/%ld (instead of %ld/%ld/%ld).\n\ -For this listing I'll assume that geometry.\n", 822}, - {"no partition table present.\n", 823}, - {"strange, only %d partitions defined.\n", 824}, - {"Warning: partition %s has size 0 but is not marked Empty\n", 825}, - {"Warning: partition %s has size 0 and is bootable\n", 826}, - {"Warning: partition %s has size 0 and nonzero start\n", 827}, - {"Warning: partition %s ", 828}, - {"is not contained in partition %s\n", 829}, - {"Warning: partitions %s ", 830}, - {"and %s overlap\n", 831}, +For this listing I'll assume that geometry.\n", 823}, + {"no partition table present.\n", 824}, + {"strange, only %d partitions defined.\n", 825}, + {"Warning: partition %s has size 0 but is not marked Empty\n", 826}, + {"Warning: partition %s has size 0 and is bootable\n", 827}, + {"Warning: partition %s has size 0 and nonzero start\n", 828}, + {"Warning: partition %s ", 829}, + {"is not contained in partition %s\n", 830}, + {"Warning: partitions %s ", 831}, + {"and %s overlap\n", 832}, {"\ Warning: partition %s contains part of the partition table (sector %lu),\n\ -and will destroy it when filled\n", 832}, - {"Warning: partition %s starts at sector 0\n", 833}, - {"Warning: partition %s extends past end of disk\n", 834}, +and will destroy it when filled\n", 833}, + {"Warning: partition %s starts at sector 0\n", 834}, + {"Warning: partition %s extends past end of disk\n", 835}, {"\ Among the primary partitions, at most one can be extended\n\ - (although this is not a problem under Linux)\n", 835}, - {"Warning: partition %s does not start at a cylinder boundary\n", 836}, - {"Warning: partition %s does not end at a cylinder boundary\n", 837}, + (although this is not a problem under Linux)\n", 836}, + {"Warning: partition %s does not start at a cylinder boundary\n", 837}, + {"Warning: partition %s does not end at a cylinder boundary\n", 838}, {"\ Warning: more than one primary partition is marked bootable (active)\n\ -This does not matter for LILO, but the DOS MBR will not boot this disk.\n", 838}, +This does not matter for LILO, but the DOS MBR will not boot this disk.\n", 839}, {"\ Warning: usually one can boot from primary partitions only\n\ -LILO disregards the `bootable' flag.\n", 839}, +LILO disregards the `bootable' flag.\n", 840}, {"\ 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", 840}, +This does not matter for LILO, but the DOS MBR will not boot this disk.\n", 841}, {"\ -partition %s: start: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 841}, - {"partition %s: end: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 842}, - {"partition %s ends on cylinder %ld, beyond the end of the disk\n", 843}, +partition %s: start: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 842}, + {"partition %s: end: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 843}, + {"partition %s ends on cylinder %ld, beyond the end of the disk\n", 844}, {"\ Warning: shifted start of the extd partition from %ld to %ld\n\ -(For listing purposes only. Do not change its contents.)\n", 844}, +(For listing purposes only. Do not change its contents.)\n", 845}, {"\ Warning: extended partition does not start at a cylinder boundary.\n\ -DOS and Linux will interpret the contents differently.\n", 845}, - {"too many partitions - ignoring those past nr (%d)\n", 846}, - {"tree of partitions?\n", 847}, - {"detected Disk Manager - unable to handle that\n", 848}, - {"DM6 signature found - giving up\n", 849}, - {"strange..., an extended partition of size 0?\n", 850}, - {"strange..., a BSD partition of size 0?\n", 851}, - {" %s: unrecognized partition\n", 852}, - {"-n flag was given: Nothing changed\n", 853}, - {"Failed saving the old sectors - aborting\n", 854}, - {"Failed writing the partition on %s\n", 855}, - {"long or incomplete input line - quitting\n", 856}, - {"input error: `=' expected after %s field\n", 857}, - {"input error: unexpected character %c after %s field\n", 858}, - {"unrecognized input: %s\n", 859}, - {"number too big\n", 860}, - {"trailing junk after number\n", 861}, - {"no room for partition descriptor\n", 862}, - {"cannot build surrounding extended partition\n", 863}, - {"too many input fields\n", 864}, - {"No room for more\n", 865}, - {"Illegal type\n", 866}, - {"Warning: given size (%lu) exceeds max allowable size (%lu)\n", 867}, - {"Warning: empty partition\n", 868}, - {"Warning: bad partition start (earliest %lu)\n", 869}, - {"unrecognized bootable flag - choose - or *\n", 870}, - {"partial c,h,s specification?\n", 871}, - {"Extended partition not where expected\n", 872}, - {"bad input\n", 873}, - {"too many partitions\n", 874}, +DOS and Linux will interpret the contents differently.\n", 846}, + {"too many partitions - ignoring those past nr (%d)\n", 847}, + {"tree of partitions?\n", 848}, + {"detected Disk Manager - unable to handle that\n", 849}, + {"DM6 signature found - giving up\n", 850}, + {"strange..., an extended partition of size 0?\n", 851}, + {"strange..., a BSD partition of size 0?\n", 852}, + {" %s: unrecognized partition\n", 853}, + {"-n flag was given: Nothing changed\n", 854}, + {"Failed saving the old sectors - aborting\n", 855}, + {"Failed writing the partition on %s\n", 856}, + {"long or incomplete input line - quitting\n", 857}, + {"input error: `=' expected after %s field\n", 858}, + {"input error: unexpected character %c after %s field\n", 859}, + {"unrecognized input: %s\n", 860}, + {"number too big\n", 861}, + {"trailing junk after number\n", 862}, + {"no room for partition descriptor\n", 863}, + {"cannot build surrounding extended partition\n", 864}, + {"too many input fields\n", 865}, + {"No room for more\n", 866}, + {"Illegal type\n", 867}, + {"Warning: given size (%lu) exceeds max allowable size (%lu)\n", 868}, + {"Warning: empty partition\n", 869}, + {"Warning: bad partition start (earliest %lu)\n", 870}, + {"unrecognized bootable flag - choose - or *\n", 871}, + {"partial c,h,s specification?\n", 872}, + {"Extended partition not where expected\n", 873}, + {"bad input\n", 874}, + {"too many partitions\n", 875}, {"\ Input in the following format; absent fields get a default value.\n\ \n\ -Usually you only need to specify and (and perhaps ).\n", 875}, - {"version", 876}, - {"Usage: %s [options] device ...\n", 877}, - {"device: something like /dev/hda or /dev/sda", 878}, - {"useful options:", 879}, - {" -s [or --show-size]: list size of a partition", 880}, - {" -c [or --id]: print or change partition Id", 881}, - {" -l [or --list]: list partitions of each device", 882}, - {" -d [or --dump]: idem, but in a format suitable for later input", 883}, - {" -i [or --increment]: number cylinders etc. from 1 instead of from 0", 884}, +Usually you only need to specify and (and perhaps ).\n", 876}, + {"version", 877}, + {"Usage: %s [options] device ...\n", 878}, + {"device: something like /dev/hda or /dev/sda", 879}, + {"useful options:", 880}, + {" -s [or --show-size]: list size of a partition", 881}, + {" -c [or --id]: print or change partition Id", 882}, + {" -l [or --list]: list partitions of each device", 883}, + {" -d [or --dump]: idem, but in a format suitable for later input", 884}, + {" -i [or --increment]: number cylinders etc. from 1 instead of from 0", 885}, {"\ -uS, -uB, -uC, -uM: accept/report in units of sectors/blocks/cylinders/\ -MB", 885}, - {" -T [or --list-types]:list the known partition types", 886}, - {" -D [or --DOS]: for DOS-compatibility: waste a little space", 887}, - {" -R [or --re-read]: make kernel reread partition table", 888}, - {" -N# : change only the partition with number #", 889}, - {" -n : do not actually write to disk", 890}, - {"\ - -O file : save the sectors that will be overwritten to file", 891}, - {" -I file : restore these sectors again", 892}, - {" -v [or --version]: print version", 893}, - {" -? [or --help]: print this message", 894}, - {"dangerous options:", 895}, - {" -g [or --show-geometry]: print the kernel's idea of the geometry", 896}, +MB", 886}, + {" -T [or --list-types]:list the known partition types", 887}, + {" -D [or --DOS]: for DOS-compatibility: waste a little space", 888}, + {" -R [or --re-read]: make kernel reread partition table", 889}, + {" -N# : change only the partition with number #", 890}, + {" -n : do not actually write to disk", 891}, + {"\ + -O file : save the sectors that will be overwritten to file", 892}, + {" -I file : restore these sectors again", 893}, + {" -v [or --version]: print version", 894}, + {" -? [or --help]: print this message", 895}, + {"dangerous options:", 896}, + {" -g [or --show-geometry]: print the kernel's idea of the geometry", 897}, {"\ -x [or --show-extended]: also list extended partitions on output\n\ - or expect descriptors for them on input", 897}, - {"\ - -L [or --Linux]: do not complain about things irrelevant for Linux", 898}, - {" -q [or --quiet]: suppress warning messages", 899}, - {" You can override the detected geometry using:", 900}, - {" -C# [or --cylinders #]:set the number of cylinders to use", 901}, - {" -H# [or --heads #]: set the number of heads to use", 902}, - {" -S# [or --sectors #]: set the number of sectors to use", 903}, - {"You can disable all consistency checking with:", 904}, - {" -f [or --force]: do what I say, even if it is stupid", 905}, - {"Usage:", 906}, - {"%s device\t\t list active partitions on device\n", 907}, - {"%s device n1 n2 ... activate partitions n1 ..., inactivate the rest\n", 908}, - {"%s -An device\t activate partition n, inactivate the other ones\n", 909}, - {"no command?\n", 910}, - {"total: %d blocks\n", 911}, - {"usage: sfdisk --print-id device partition-number\n", 912}, - {"usage: sfdisk --change-id device partition-number Id\n", 913}, - {"usage: sfdisk --id device partition-number [Id]\n", 914}, - {"can specify only one device (except with -l or -s)\n", 915}, - {"cannot open %s read-write\n", 916}, - {"cannot open %s for reading\n", 917}, - {"%s: OK\n", 918}, - {"%s: %ld cylinders, %ld heads, %ld sectors/track\n", 919}, - {"BLKGETSIZE ioctl failed for %s\n", 920}, - {"bad active byte: 0x%x instead of 0x80\n", 921}, + or expect descriptors for them on input", 898}, + {"\ + -L [or --Linux]: do not complain about things irrelevant for Linux", 899}, + {" -q [or --quiet]: suppress warning messages", 900}, + {" You can override the detected geometry using:", 901}, + {" -C# [or --cylinders #]:set the number of cylinders to use", 902}, + {" -H# [or --heads #]: set the number of heads to use", 903}, + {" -S# [or --sectors #]: set the number of sectors to use", 904}, + {"You can disable all consistency checking with:", 905}, + {" -f [or --force]: do what I say, even if it is stupid", 906}, + {"Usage:", 907}, + {"%s device\t\t list active partitions on device\n", 908}, + {"%s device n1 n2 ... activate partitions n1 ..., inactivate the rest\n", 909}, + {"%s -An device\t activate partition n, inactivate the other ones\n", 910}, + {"no command?\n", 911}, + {"total: %d blocks\n", 912}, + {"usage: sfdisk --print-id device partition-number\n", 913}, + {"usage: sfdisk --change-id device partition-number Id\n", 914}, + {"usage: sfdisk --id device partition-number [Id]\n", 915}, + {"can specify only one device (except with -l or -s)\n", 916}, + {"cannot open %s read-write\n", 917}, + {"cannot open %s for reading\n", 918}, + {"%s: OK\n", 919}, + {"%s: %ld cylinders, %ld heads, %ld sectors/track\n", 920}, + {"BLKGETSIZE ioctl failed for %s\n", 921}, + {"bad active byte: 0x%x instead of 0x80\n", 922}, {"\ Done\n\ -\n", 922}, +\n", 923}, {"\ 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", 923}, - {"partition %s has id %x and is not hidden\n", 924}, - {"Bad Id %lx\n", 925}, - {"This disk is currently in use.\n", 926}, - {"Fatal error: cannot find %s\n", 927}, - {"Warning: %s is not a block device\n", 928}, - {"Checking that no-one is using this disk right now ...\n", 929}, +but the DOS MBR will only boot a disk with 1 active partition.\n", 924}, + {"partition %s has id %x and is not hidden\n", 925}, + {"Bad Id %lx\n", 926}, + {"This disk is currently in use.\n", 927}, + {"Fatal error: cannot find %s\n", 928}, + {"Warning: %s is not a block device\n", 929}, + {"Checking that no-one is using this disk right now ...\n", 930}, {"\ \n\ This disk is currently in use - repartitioning is probably a bad idea.\n\ Umount all file systems, and swapoff all swap partitions on this disk.\n\ -Use the --no-reread flag to suppress this check.\n", 930}, - {"Use the --force flag to overrule all checks.\n", 931}, - {"OK\n", 932}, - {"Old situation:\n", 933}, - {"Partition %d does not exist, cannot change it\n", 934}, - {"New situation:\n", 935}, +Use the --no-reread flag to suppress this check.\n", 931}, + {"Use the --force flag to overrule all checks.\n", 932}, + {"OK\n", 933}, + {"Old situation:\n", 934}, + {"Partition %d does not exist, cannot change it\n", 935}, + {"New situation:\n", 936}, {"\ I don't like these partitions - nothing changed.\n\ -(If you really want this, use the --force option.)\n", 936}, - {"I don't like this - probably you should answer No\n", 937}, - {"Are you satisfied with this? [ynq] ", 938}, - {"Do you want to write this to disk? [ynq] ", 939}, +(If you really want this, use the --force option.)\n", 937}, + {"I don't like this - probably you should answer No\n", 938}, + {"Are you satisfied with this? [ynq] ", 939}, + {"Do you want to write this to disk? [ynq] ", 940}, {"\ \n\ -sfdisk: premature end of input\n", 940}, - {"Quitting - nothing changed\n", 941}, - {"Please answer one of y,n,q\n", 942}, +sfdisk: premature end of input\n", 941}, + {"Quitting - nothing changed\n", 942}, + {"Please answer one of y,n,q\n", 943}, {"\ Successfully wrote the new partition table\n\ -\n", 943}, +\n", 944}, {"\ If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)\n\ to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1\n\ -(See fdisk(8).)\n", 944}, - {"Try `getopt --help' for more information.\n", 945}, - {"empty long option after -l or --long argument", 946}, - {"unknown shell after -s or --shell argument", 947}, - {"Usage: getopt optstring parameters\n", 948}, - {" getopt [options] [--] optstring parameters\n", 949}, - {" getopt [options] -o|--options optstring [options] [--]\n", 950}, - {" parameters\n", 951}, - {"\ - -a, --alternative Allow long options starting with single -\n", 952}, - {" -h, --help This small usage guide\n", 953}, - {" -l, --longoptions=longopts Long options to be recognized\n", 954}, - {"\ - -n, --name=progname The name under which errors are reported\n", 955}, - {" -o, --options=optstring Short options to be recognized\n", 956}, - {" -q, --quiet Disable error reporting by getopt(3)\n", 957}, - {" -Q, --quiet-output No normal output\n", 958}, - {" -s, --shell=shell Set shell quoting conventions\n", 959}, - {" -T, --test Test for getopt(1) version\n", 960}, - {" -u, --unqote Do not quote the output\n", 961}, - {" -V, --version Output version information\n", 962}, - {"missing optstring argument", 963}, - {"getopt (enhanced) 1.1.2\n", 964}, - {"internal error, contact the author.", 965}, - {"booted from MILO\n", 966}, - {"Ruffian BCD clock\n", 967}, - {"clockport adjusted to 0x%x\n", 968}, - {"funky TOY!\n", 969}, - {"%s: atomic %s failed for 1000 iterations!", 970}, - {"Cannot open /dev/port: %s", 971}, - {"I failed to get permission because I didn't try.\n", 972}, - {"%s is unable to get I/O port access: the iopl(3) call failed.\n", 973}, - {"Probably you need root privileges.\n", 974}, - {"Assuming hardware clock is kept in %s time.\n", 975}, - {"UTC", 976}, - {"local", 977}, - {"%s: Warning: unrecognized third line in adjtime file\n", 978}, - {"(Expected: `UTC' or `LOCAL' or nothing.)\n", 979}, - {"Last drift adjustment done at %ld seconds after 1969\n", 980}, - {"Last calibration done at %ld seconds after 1969\n", 981}, - {"Hardware clock is on %s time\n", 982}, - {"unknown", 983}, - {"Waiting for clock tick...\n", 984}, - {"...got clock tick\n", 985}, - {"Invalid values in hardware clock: %4d/%.2d/%.2d %.2d:%.2d:%.2d\n", 986}, - {"Hw clock time : %4d/%.2d/%.2d %.2d:%.2d:%.2d = %ld seconds since 1969\n", 987}, - {"Time read from Hardware Clock: %4d/%.2d/%.2d %02d:%02d:%02d\n", 988}, - {"Setting Hardware Clock to %.2d:%.2d:%.2d = %ld seconds since 1969\n", 989}, - {"Clock not changed - testing only.\n", 990}, +(See fdisk(8).)\n", 945}, + {"Try `getopt --help' for more information.\n", 946}, + {"empty long option after -l or --long argument", 947}, + {"unknown shell after -s or --shell argument", 948}, + {"Usage: getopt optstring parameters\n", 949}, + {" getopt [options] [--] optstring parameters\n", 950}, + {" getopt [options] -o|--options optstring [options] [--]\n", 951}, + {" parameters\n", 952}, + {"\ + -a, --alternative Allow long options starting with single -\n", 953}, + {" -h, --help This small usage guide\n", 954}, + {" -l, --longoptions=longopts Long options to be recognized\n", 955}, + {"\ + -n, --name=progname The name under which errors are reported\n", 956}, + {" -o, --options=optstring Short options to be recognized\n", 957}, + {" -q, --quiet Disable error reporting by getopt(3)\n", 958}, + {" -Q, --quiet-output No normal output\n", 959}, + {" -s, --shell=shell Set shell quoting conventions\n", 960}, + {" -T, --test Test for getopt(1) version\n", 961}, + {" -u, --unqote Do not quote the output\n", 962}, + {" -V, --version Output version information\n", 963}, + {"missing optstring argument", 964}, + {"getopt (enhanced) 1.1.2\n", 965}, + {"internal error, contact the author.", 966}, + {"booted from MILO\n", 967}, + {"Ruffian BCD clock\n", 968}, + {"clockport adjusted to 0x%x\n", 969}, + {"funky TOY!\n", 970}, + {"%s: atomic %s failed for 1000 iterations!", 971}, + {"Cannot open /dev/port: %s", 972}, + {"I failed to get permission because I didn't try.\n", 973}, + {"%s is unable to get I/O port access: the iopl(3) call failed.\n", 974}, + {"Probably you need root privileges.\n", 975}, + {"Assuming hardware clock is kept in %s time.\n", 976}, + {"UTC", 977}, + {"local", 978}, + {"%s: Warning: unrecognized third line in adjtime file\n", 979}, + {"(Expected: `UTC' or `LOCAL' or nothing.)\n", 980}, + {"Last drift adjustment done at %ld seconds after 1969\n", 981}, + {"Last calibration done at %ld seconds after 1969\n", 982}, + {"Hardware clock is on %s time\n", 983}, + {"unknown", 984}, + {"Waiting for clock tick...\n", 985}, + {"...got clock tick\n", 986}, + {"Invalid values in hardware clock: %4d/%.2d/%.2d %.2d:%.2d:%.2d\n", 987}, + {"Hw clock time : %4d/%.2d/%.2d %.2d:%.2d:%.2d = %ld seconds since 1969\n", 988}, + {"Time read from Hardware Clock: %4d/%.2d/%.2d %02d:%02d:%02d\n", 989}, + {"Setting Hardware Clock to %.2d:%.2d:%.2d = %ld seconds since 1969\n", 990}, + {"Clock not changed - testing only.\n", 991}, {"\ Time elapsed since reference time has been %.6f seconds.\n\ -Delaying further to reach the next full second.\n", 991}, +Delaying further to reach the next full second.\n", 992}, {"\ 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", 992}, - {"%s %.6f seconds\n", 993}, - {"No --date option specified.\n", 994}, - {"--date argument too long\n", 995}, +50th day of month) or beyond the range we can handle (e.g. Year 2095).\n", 993}, + {"%s %.6f seconds\n", 994}, + {"No --date option specified.\n", 995}, + {"--date argument too long\n", 996}, {"\ The value of the --date option is not a valid date.\n\ -In particular, it contains quotation marks.\n", 996}, - {"Issuing date command: %s\n", 997}, - {"Unable to run 'date' program in /bin/sh shell. popen() failed", 998}, - {"response from date command = %s\n", 999}, +In particular, it contains quotation marks.\n", 997}, + {"Issuing date command: %s\n", 998}, + {"Unable to run 'date' program in /bin/sh shell. popen() failed", 999}, + {"response from date command = %s\n", 1000}, {"\ The date command issued by %s returned unexpected results.\n\ The command was:\n\ %s\n\ The response was:\n\ - %s\n", 1000}, + %s\n", 1001}, {"\ 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", 1001}, - {"date string %s equates to %ld seconds since 1969.\n", 1002}, + %s\n", 1002}, + {"date string %s equates to %ld seconds since 1969.\n", 1003}, {"\ The Hardware Clock does not contain a valid time, so we cannot set the \ -System Time from it.\n", 1003}, - {"Calling settimeofday:\n", 1004}, - {"\ttv.tv_sec = %ld, tv.tv_usec = %ld\n", 1005}, - {"\ttz.tz_minuteswest = %d\n", 1006}, - {"Not setting system clock because running in test mode.\n", 1007}, - {"Must be superuser to set system clock.\n", 1008}, - {"settimeofday() failed", 1009}, +System Time from it.\n", 1004}, + {"Calling settimeofday:\n", 1005}, + {"\ttv.tv_sec = %ld, tv.tv_usec = %ld\n", 1006}, + {"\ttz.tz_minuteswest = %d\n", 1007}, + {"Not setting system clock because running in test mode.\n", 1008}, + {"Must be superuser to set system clock.\n", 1009}, + {"settimeofday() failed", 1010}, {"\ Not adjusting drift factor because the Hardware Clock previously contained \ -garbage.\n", 1010}, +garbage.\n", 1011}, {"\ Not adjusting drift factor because it has been less than a day since the \ -last calibration.\n", 1011}, +last calibration.\n", 1012}, {"\ -Clock drifted %d seconds in the past %d seconds in spite of a drift factor \ +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", 1012}, - {"Time since last adjustment is %d seconds\n", 1013}, - {"Need to insert %d seconds and refer time back %.6f seconds ago\n", 1014}, - {"Not updating adjtime file because of testing mode.\n", 1015}, +Adjusting drift factor by %f seconds/day\n", 1013}, + {"Time since last adjustment is %d seconds\n", 1014}, + {"Need to insert %d seconds and refer time back %.6f seconds ago\n", 1015}, + {"Not updating adjtime file because of testing mode.\n", 1016}, {"\ Would have written the following to %s:\n\ -%s", 1016}, - {"Drift adjustment parameters not updated.\n", 1017}, +%s", 1017}, + {"Drift adjustment parameters not updated.\n", 1018}, {"\ -The Hardware Clock does not contain a valid time, so we cannot adjust it.\n", 1018}, - {"Needed adjustment is less than one second, so not setting clock.\n", 1019}, - {"Using %s.\n", 1020}, - {"No usable clock interface found.\n", 1021}, - {"Unable to set system clock.\n", 1022}, +The Hardware Clock does not contain a valid time, so we cannot adjust it.\n", 1019}, + {"Needed adjustment is less than one second, so not setting clock.\n", 1020}, + {"Using %s.\n", 1021}, + {"No usable clock interface found.\n", 1022}, + {"Unable to set system clock.\n", 1023}, {"\ 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", 1023}, - {"Unable to get the epoch value from the kernel.\n", 1024}, - {"Kernel is assuming an epoch value of %lu\n", 1025}, +(and thus is presumably not running on an Alpha now). No action taken.\n", 1024}, + {"Unable to get the epoch value from the kernel.\n", 1025}, + {"Kernel is assuming an epoch value of %lu\n", 1026}, {"\ To set the epoch value, you must use the 'epoch' option to tell to what \ -value to set it.\n", 1026}, - {"Not setting the epoch to %d - testing only.\n", 1027}, - {"Unable to set the epoch value in the kernel.\n", 1028}, +value to set it.\n", 1027}, + {"Not setting the epoch to %d - testing only.\n", 1028}, + {"Unable to set the epoch value in the kernel.\n", 1029}, {"\ hwclock - query and set the hardware clock (RTC)\n\ \n\ @@ -1408,47 +1409,46 @@ Options: \n\ --epoch=year specifies the year which is the beginning of the \n\ hardware clock's epoch value\n\ --noadjfile do not access /etc/adjtime. Requires the use of\n\ - either --utc or --localtime\n", 1029}, + either --utc or --localtime\n", 1030}, {"\ --jensen, --arc, --srm, --funky-toy\n\ - tell hwclock the type of alpha you have (see hwclock(8))\n", 1030}, - {"%s takes no non-option arguments. You supplied %d.\n", 1031}, + tell hwclock the type of alpha you have (see hwclock(8))\n", 1031}, + {"%s takes no non-option arguments. You supplied %d.\n", 1032}, {"\ -You have specified multiple function options.\n\ -You can only perform one function at a time.\n", 1032}, +You have specified multiple functions.\n\ +You can only perform one function at a time.\n", 1033}, {"\ %s: The --utc and --localtime options are mutually exclusive. You specified \ -both.\n", 1033}, +both.\n", 1034}, {"\ %s: The --adjust and --noadjfile options are mutually exclusive. You \ -specified both.\n", 1034}, - {"%s: With --noadjfile, you must specify either --utc or --localtime\n", 1035}, - {"No usable set-to time. Cannot set clock.\n", 1036}, - {"Sorry, only the superuser can change the Hardware Clock.\n", 1037}, - {"Sorry, only the superuser can change the System Clock.\n", 1038}, +specified both.\n", 1035}, + {"%s: With --noadjfile, you must specify either --utc or --localtime\n", 1036}, + {"No usable set-to time. Cannot set clock.\n", 1037}, + {"Sorry, only the superuser can change the Hardware Clock.\n", 1038}, + {"Sorry, only the superuser can change the System Clock.\n", 1039}, {"\ Sorry, only the superuser can change the Hardware Clock epoch in the \ -kernel.\n", 1039}, - {"Cannot access the Hardware Clock via any known method.\n", 1040}, +kernel.\n", 1040}, + {"Cannot access the Hardware Clock via any known method.\n", 1041}, {"\ Use the --debug option to see the details of our search for an access \ -method.\n", 1041}, - {"Waiting in loop for time from KDGHWCLK to change\n", 1042}, - {"KDGHWCLK ioctl to read time failed", 1043}, - {"Timed out waiting for time change.\n", 1044}, - {"KDGHWCLK ioctl to read time failed in loop", 1045}, - {"ioctl() failed to read time from %s", 1046}, - {"ioctl KDSHWCLK failed", 1047}, - {"Can't open /dev/tty1 or /dev/vc/1", 1048}, - {"KDGHWCLK ioctl failed", 1049}, - {"ioctl() to %s to read the time failed.\n", 1050}, - {"Waiting in loop for time from %s to change\n", 1051}, - {"open() of %s failed", 1052}, - {"%s does not have interrupt functions. ", 1053}, - {"read() to %s to wait for clock tick failed", 1054}, - {"ioctl() to %s to turn off update interrupts failed", 1055}, - {"ioctl() to %s to turn on update interrupts failed unexpectedly", 1056}, - {"Unable to open %s", 1057}, +method.\n", 1042}, + {"Waiting in loop for time from KDGHWCLK to change\n", 1043}, + {"KDGHWCLK ioctl to read time failed", 1044}, + {"Timed out waiting for time change.\n", 1045}, + {"KDGHWCLK ioctl to read time failed in loop", 1046}, + {"ioctl() failed to read time from %s", 1047}, + {"ioctl KDSHWCLK failed", 1048}, + {"Can't open /dev/tty1 or /dev/vc/1", 1049}, + {"KDGHWCLK ioctl failed", 1050}, + {"open() of %s failed", 1051}, + {"ioctl() to %s to read the time failed.\n", 1052}, + {"Waiting in loop for time from %s to change\n", 1053}, + {"%s does not have interrupt functions. ", 1054}, + {"read() to %s to wait for clock tick failed", 1055}, + {"ioctl() to %s to turn off update interrupts failed", 1056}, + {"ioctl() to %s to turn on update interrupts failed unexpectedly", 1057}, {"ioctl() to %s to set the time failed.\n", 1058}, {"ioctl(%s) was successful.\n", 1059}, {"Open of %s failed", 1060}, @@ -1456,513 +1456,509 @@ method.\n", 1041}, 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", 1061}, - {"ioctl(RTC_EPOCH_READ) to %s failed", 1062}, - {"we have read epoch %ld from %s with RTC_EPOCH_READ ioctl.\n", 1063}, - {"The epoch value may not be less than 1900. You requested %ld\n", 1064}, - {"setting epoch to %ld with RTC_EPOCH_SET ioctl to %s.\n", 1065}, - {"\ -The kernel device driver for %s does not have the RTC_EPOCH_SET ioctl.\n", 1066}, - {"ioctl(RTC_EPOCH_SET) to %s failed", 1067}, - {"invalid number `%s'\n", 1068}, - {"number `%s' to `%s' out of range\n", 1069}, - {"unrecognized option `%s'\n", 1070}, - {"option `%s' requires an argument\n", 1071}, - {"option `%s' doesn't allow an argument\n", 1072}, - {"unrecognized option `-%c'\n", 1073}, - {"calling open_tty\n", 1074}, - {"calling termio_init\n", 1075}, - {"writing init string\n", 1076}, - {"before autobaud\n", 1077}, - {"waiting for cr-lf\n", 1078}, - {"read %c\n", 1079}, - {"reading login name\n", 1080}, - {"%s: can't exec %s: %m", 1081}, - {"can't malloc initstring", 1082}, - {"bad timeout value: %s", 1083}, - {"after getopt loop\n", 1084}, - {"exiting parseargs\n", 1085}, - {"entered parse_speeds\n", 1086}, - {"bad speed: %s", 1087}, - {"too many alternate speeds", 1088}, - {"exiting parsespeeds\n", 1089}, - {"/dev: chdir() failed: %m", 1090}, - {"/dev/%s: not a character device", 1091}, - {"open(2)\n", 1092}, - {"/dev/%s: cannot open as standard input: %m", 1093}, - {"%s: not open for read/write", 1094}, - {"duping\n", 1095}, - {"%s: dup problem: %m", 1096}, - {"term_io 2\n", 1097}, - {"user", 1098}, - {"users", 1099}, - {"%s: read: %m", 1100}, - {"%s: input overrun", 1101}, + {"Unable to open %s", 1062}, + {"ioctl(RTC_EPOCH_READ) to %s failed", 1063}, + {"we have read epoch %ld from %s with RTC_EPOCH_READ ioctl.\n", 1064}, + {"The epoch value may not be less than 1900. You requested %ld\n", 1065}, + {"setting epoch to %ld with RTC_EPOCH_SET ioctl to %s.\n", 1066}, + {"\ +The kernel device driver for %s does not have the RTC_EPOCH_SET ioctl.\n", 1067}, + {"ioctl(RTC_EPOCH_SET) to %s failed", 1068}, + {"calling open_tty\n", 1069}, + {"calling termio_init\n", 1070}, + {"writing init string\n", 1071}, + {"before autobaud\n", 1072}, + {"waiting for cr-lf\n", 1073}, + {"read %c\n", 1074}, + {"reading login name\n", 1075}, + {"%s: can't exec %s: %m", 1076}, + {"can't malloc initstring", 1077}, + {"bad timeout value: %s", 1078}, + {"after getopt loop\n", 1079}, + {"exiting parseargs\n", 1080}, + {"entered parse_speeds\n", 1081}, + {"bad speed: %s", 1082}, + {"too many alternate speeds", 1083}, + {"exiting parsespeeds\n", 1084}, + {"/dev: chdir() failed: %m", 1085}, + {"/dev/%s: not a character device", 1086}, + {"open(2)\n", 1087}, + {"/dev/%s: cannot open as standard input: %m", 1088}, + {"%s: not open for read/write", 1089}, + {"duping\n", 1090}, + {"%s: dup problem: %m", 1091}, + {"term_io 2\n", 1092}, + {"user", 1093}, + {"users", 1094}, + {"%s: read: %m", 1095}, + {"%s: input overrun", 1096}, {"\ Usage: %s [-hiLmw] [-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", 1102}, - {"login: memory low, login may fail\n", 1103}, - {"can't malloc for ttyclass", 1104}, - {"can't malloc for grplist", 1105}, - {"Login on %s from %s denied by default.\n", 1106}, - {"Login on %s from %s denied.\n", 1107}, - {"%s: you (user %d) don't exist.\n", 1108}, - {"%s: user \"%s\" does not exist.\n", 1109}, - {"%s: can only change local entries; use yp%s instead.\n", 1110}, - {"Changing finger information for %s.\n", 1111}, - {"Password error.", 1112}, - {"Password: ", 1113}, - {"Incorrect password.", 1114}, - {"Finger information not changed.\n", 1115}, - {"Usage: %s [ -f full-name ] [ -o office ] ", 1116}, +line baud_rate,... [termtype]\n", 1097}, + {"login: memory low, login may fail\n", 1098}, + {"can't malloc for ttyclass", 1099}, + {"can't malloc for grplist", 1100}, + {"Login on %s from %s denied by default.\n", 1101}, + {"Login on %s from %s denied.\n", 1102}, + {"%s: you (user %d) don't exist.\n", 1103}, + {"%s: user \"%s\" does not exist.\n", 1104}, + {"%s: can only change local entries; use yp%s instead.\n", 1105}, + {"Changing finger information for %s.\n", 1106}, + {"Password error.", 1107}, + {"Password: ", 1108}, + {"Incorrect password.", 1109}, + {"Finger information not changed.\n", 1110}, + {"Usage: %s [ -f full-name ] [ -o office ] ", 1111}, {"\ [ -p office-phone ]\n\ -\t[ -h home-phone ] ", 1117}, - {"[ --help ] [ --version ]\n", 1118}, +\t[ -h home-phone ] ", 1112}, + {"[ --help ] [ --version ]\n", 1113}, {"\ \n\ -Aborted.\n", 1119}, - {"field is too long.\n", 1120}, - {"'%c' is not allowed.\n", 1121}, - {"Control characters are not allowed.\n", 1122}, - {"Finger information *NOT* changed. Try again later.\n", 1123}, - {"Finger information changed.\n", 1124}, - {"malloc failed", 1125}, - {"%s: Your shell is not in /etc/shells, shell change denied\n", 1126}, - {"Changing shell for %s.\n", 1127}, - {"New shell", 1128}, - {"Shell not changed.\n", 1129}, - {"Shell *NOT* changed. Try again later.\n", 1130}, - {"Shell changed.\n", 1131}, +Aborted.\n", 1114}, + {"field is too long.\n", 1115}, + {"'%c' is not allowed.\n", 1116}, + {"Control characters are not allowed.\n", 1117}, + {"Finger information *NOT* changed. Try again later.\n", 1118}, + {"Finger information changed.\n", 1119}, + {"malloc failed", 1120}, + {"%s: Your shell is not in /etc/shells, shell change denied\n", 1121}, + {"Changing shell for %s.\n", 1122}, + {"New shell", 1123}, + {"Shell not changed.\n", 1124}, + {"Shell *NOT* changed. Try again later.\n", 1125}, + {"Shell changed.\n", 1126}, {"\ Usage: %s [ -s shell ] [ --list-shells ] [ --help ] [ --version ]\n\ - [ username ]\n", 1132}, - {"%s: shell must be a full path name.\n", 1133}, - {"%s: \"%s\" does not exist.\n", 1134}, - {"%s: \"%s\" is not executable.\n", 1135}, - {"%s: '%c' is not allowed.\n", 1136}, - {"%s: Control characters are not allowed.\n", 1137}, - {"Warning: \"%s\" is not listed in /etc/shells\n", 1138}, - {"%s: \"%s\" is not listed in /etc/shells.\n", 1139}, - {"%s: use -l option to see list\n", 1140}, - {"Warning: \"%s\" is not listed in /etc/shells.\n", 1141}, - {"Use %s -l to see list.\n", 1142}, - {"No known shells.\n", 1143}, - {"couldn't open /dev/urandom", 1144}, - {"couldn't read random data from /dev/urandom", 1145}, - {"can't open %s for reading", 1146}, - {"can't stat(%s)", 1147}, - {"%s doesn't have the correct filemodes", 1148}, - {"can't read data from %s", 1149}, - {"Can't read %s, exiting.", 1150}, - {"usage: last [-#] [-f file] [-t tty] [-h hostname] [user ...]\n", 1151}, - {" still logged in", 1152}, + [ username ]\n", 1127}, + {"%s: shell must be a full path name.\n", 1128}, + {"%s: \"%s\" does not exist.\n", 1129}, + {"%s: \"%s\" is not executable.\n", 1130}, + {"%s: '%c' is not allowed.\n", 1131}, + {"%s: Control characters are not allowed.\n", 1132}, + {"Warning: \"%s\" is not listed in /etc/shells\n", 1133}, + {"%s: \"%s\" is not listed in /etc/shells.\n", 1134}, + {"%s: use -l option to see list\n", 1135}, + {"Warning: \"%s\" is not listed in /etc/shells.\n", 1136}, + {"Use %s -l to see list.\n", 1137}, + {"No known shells.\n", 1138}, + {"couldn't open /dev/urandom", 1139}, + {"couldn't read random data from /dev/urandom", 1140}, + {"can't open %s for reading", 1141}, + {"can't stat(%s)", 1142}, + {"%s doesn't have the correct filemodes", 1143}, + {"can't read data from %s", 1144}, + {"Can't read %s, exiting.", 1145}, + {"usage: last [-#] [-f file] [-t tty] [-h hostname] [user ...]\n", 1146}, + {" still logged in", 1147}, {"\ \n\ -wtmp begins %s", 1153}, - {"last: malloc failure.\n", 1154}, - {"last: gethostname", 1155}, +wtmp begins %s", 1148}, + {"last: malloc failure.\n", 1149}, + {"last: gethostname", 1150}, {"\ \n\ -interrupted %10.10s %5.5s \n", 1156}, - {"FATAL: can't reopen tty: %s", 1157}, - {"login: -h for super-user only.\n", 1158}, - {"usage: login [-fp] [username]\n", 1159}, - {"login: PAM Failure, aborting: %s\n", 1160}, - {"Couldn't initialize PAM: %s", 1161}, - {"login: ", 1162}, - {"FAILED LOGIN %d FROM %s FOR %s, %s", 1163}, +interrupted %10.10s %5.5s \n", 1151}, + {"FATAL: can't reopen tty: %s", 1152}, + {"login: -h for super-user only.\n", 1153}, + {"usage: login [-fp] [username]\n", 1154}, + {"login: PAM Failure, aborting: %s\n", 1155}, + {"Couldn't initialize PAM: %s", 1156}, + {"login: ", 1157}, + {"FAILED LOGIN %d FROM %s FOR %s, %s", 1158}, {"\ Login incorrect\n\ -\n", 1164}, - {"TOO MANY LOGIN TRIES (%d) FROM %s FOR %s, %s", 1165}, - {"FAILED LOGIN SESSION FROM %s FOR %s, %s", 1166}, +\n", 1159}, + {"TOO MANY LOGIN TRIES (%d) FROM %s FOR %s, %s", 1160}, + {"FAILED LOGIN SESSION FROM %s FOR %s, %s", 1161}, {"\ \n\ -Login incorrect\n", 1167}, +Login incorrect\n", 1162}, {"\ \n\ -Session setup problem, abort.\n", 1168}, - {"NULL user name in %s:%d. Abort.", 1169}, - {"Invalid user name \"%s\" in %s:%d. Abort.", 1170}, - {"login: Out of memory\n", 1171}, - {"Illegal username", 1172}, - {"%s login refused on this terminal.\n", 1173}, - {"LOGIN %s REFUSED FROM %s ON TTY %s", 1174}, - {"LOGIN %s REFUSED ON TTY %s", 1175}, - {"Login incorrect\n", 1176}, +Session setup problem, abort.\n", 1163}, + {"NULL user name in %s:%d. Abort.", 1164}, + {"Invalid user name \"%s\" in %s:%d. Abort.", 1165}, + {"login: Out of memory\n", 1166}, + {"Illegal username", 1167}, + {"%s login refused on this terminal.\n", 1168}, + {"LOGIN %s REFUSED FROM %s ON TTY %s", 1169}, + {"LOGIN %s REFUSED ON TTY %s", 1170}, + {"Login incorrect\n", 1171}, {"\ Too many users logged on already.\n\ -Try again later.\n", 1177}, - {"You have too many processes running.\n", 1178}, - {"DIALUP AT %s BY %s", 1179}, - {"ROOT LOGIN ON %s FROM %s", 1180}, - {"ROOT LOGIN ON %s", 1181}, - {"LOGIN ON %s BY %s FROM %s", 1182}, - {"LOGIN ON %s BY %s", 1183}, - {"You have new mail.\n", 1184}, - {"You have mail.\n", 1185}, - {"login: failure forking: %s", 1186}, - {"TIOCSCTTY failed: %m", 1187}, - {"setuid() failed", 1188}, - {"No directory %s!\n", 1189}, - {"Logging in with home = \"/\".\n", 1190}, - {"login: no memory for shell script.\n", 1191}, - {"login: couldn't exec shell script: %s.\n", 1192}, - {"login: no shell: %s.\n", 1193}, +Try again later.\n", 1172}, + {"You have too many processes running.\n", 1173}, + {"DIALUP AT %s BY %s", 1174}, + {"ROOT LOGIN ON %s FROM %s", 1175}, + {"ROOT LOGIN ON %s", 1176}, + {"LOGIN ON %s BY %s FROM %s", 1177}, + {"LOGIN ON %s BY %s", 1178}, + {"You have new mail.\n", 1179}, + {"You have mail.\n", 1180}, + {"login: failure forking: %s", 1181}, + {"TIOCSCTTY failed: %m", 1182}, + {"setuid() failed", 1183}, + {"No directory %s!\n", 1184}, + {"Logging in with home = \"/\".\n", 1185}, + {"login: no memory for shell script.\n", 1186}, + {"login: couldn't exec shell script: %s.\n", 1187}, + {"login: no shell: %s.\n", 1188}, {"\ \n\ -%s login: ", 1194}, - {"login name much too long.\n", 1195}, - {"NAME too long", 1196}, - {"login names may not start with '-'.\n", 1197}, - {"too many bare linefeeds.\n", 1198}, - {"EXCESSIVE linefeeds", 1199}, - {"Login timed out after %d seconds\n", 1200}, - {"Last login: %.*s ", 1201}, - {"from %.*s\n", 1202}, - {"on %.*s\n", 1203}, - {"LOGIN FAILURE FROM %s, %s", 1204}, - {"LOGIN FAILURE ON %s, %s", 1205}, - {"%d LOGIN FAILURES FROM %s, %s", 1206}, - {"%d LOGIN FAILURES ON %s, %s", 1207}, - {"is y\n", 1208}, - {"is n\n", 1209}, - {"usage: mesg [y | n]\n", 1210}, - {"newgrp: Who are you?", 1211}, - {"newgrp: setgid", 1212}, - {"newgrp: No such group.", 1213}, - {"newgrp: Permission denied", 1214}, - {"newgrp: setuid", 1215}, - {"No shell", 1216}, - {"The password must have at least 6 characters, try again.\n", 1217}, +%s login: ", 1189}, + {"login name much too long.\n", 1190}, + {"NAME too long", 1191}, + {"login names may not start with '-'.\n", 1192}, + {"too many bare linefeeds.\n", 1193}, + {"EXCESSIVE linefeeds", 1194}, + {"Login timed out after %d seconds\n", 1195}, + {"Last login: %.*s ", 1196}, + {"from %.*s\n", 1197}, + {"on %.*s\n", 1198}, + {"LOGIN FAILURE FROM %s, %s", 1199}, + {"LOGIN FAILURE ON %s, %s", 1200}, + {"%d LOGIN FAILURES FROM %s, %s", 1201}, + {"%d LOGIN FAILURES ON %s, %s", 1202}, + {"is y\n", 1203}, + {"is n\n", 1204}, + {"usage: mesg [y | n]\n", 1205}, + {"newgrp: Who are you?", 1206}, + {"newgrp: setgid", 1207}, + {"newgrp: No such group.", 1208}, + {"newgrp: Permission denied", 1209}, + {"newgrp: setuid", 1210}, + {"No shell", 1211}, + {"The password must have at least 6 characters, try again.\n", 1212}, {"\ The password must contain characters out of two of the following\n\ classes: upper and lower case letters, digits and non alphanumeric\n\ -characters. See passwd(1) for more information.\n", 1218}, - {"You cannot reuse the old password.\n", 1219}, - {"Please don't use something like your username as password!\n", 1220}, - {"Please don't use something like your realname as password!\n", 1221}, - {"Usage: passwd [username [password]]\n", 1222}, - {"Only root may use the one and two argument forms.\n", 1223}, - {"Usage: passwd [-foqsvV] [user [password]]\n", 1224}, - {"Can't exec %s: %s\n", 1225}, - {"Cannot find login name", 1226}, - {"Only root can change the password for others.\n", 1227}, - {"Too many arguments.\n", 1228}, - {"Can't find username anywhere. Is `%s' really a user?", 1229}, - {"Sorry, I can only change local passwords. Use yppasswd instead.", 1230}, - {"UID and username does not match, imposter!", 1231}, - {"Changing password for %s\n", 1232}, - {"Enter old password: ", 1233}, - {"Illegal password, imposter.", 1234}, - {"Enter new password: ", 1235}, - {"Password not changed.", 1236}, - {"Re-type new password: ", 1237}, - {"You misspelled it. Password not changed.", 1238}, - {"password changed, user %s", 1239}, - {"ROOT PASSWORD CHANGED", 1240}, - {"password changed by root, user %s", 1241}, - {"calling setpwnam to set password.\n", 1242}, - {"Password *NOT* changed. Try again later.\n", 1243}, - {"Password changed.\n", 1244}, - {"Usage: shutdown [-h|-r] [-fqs] [now|hh:ss|+mins]\n", 1245}, - {"Shutdown process aborted", 1246}, - {"%s: Only root can shut a system down.\n", 1247}, - {"That must be tomorrow, can't you wait till then?\n", 1248}, - {"for maintenance; bounce, bounce", 1249}, - {"timeout = %d, quiet = %d, reboot = %d\n", 1250}, - {"The system is being shut down within 5 minutes", 1251}, - {"Login is therefore prohibited.", 1252}, - {"rebooted by %s: %s", 1253}, - {"halted by %s: %s", 1254}, +characters. See passwd(1) for more information.\n", 1213}, + {"You cannot reuse the old password.\n", 1214}, + {"Please don't use something like your username as password!\n", 1215}, + {"Please don't use something like your realname as password!\n", 1216}, + {"Usage: passwd [username [password]]\n", 1217}, + {"Only root may use the one and two argument forms.\n", 1218}, + {"Usage: passwd [-foqsvV] [user [password]]\n", 1219}, + {"Can't exec %s: %s\n", 1220}, + {"Cannot find login name", 1221}, + {"Only root can change the password for others.\n", 1222}, + {"Too many arguments.\n", 1223}, + {"Can't find username anywhere. Is `%s' really a user?", 1224}, + {"Sorry, I can only change local passwords. Use yppasswd instead.", 1225}, + {"UID and username does not match, imposter!", 1226}, + {"Changing password for %s\n", 1227}, + {"Enter old password: ", 1228}, + {"Illegal password, imposter.", 1229}, + {"Enter new password: ", 1230}, + {"Password not changed.", 1231}, + {"Re-type new password: ", 1232}, + {"You misspelled it. Password not changed.", 1233}, + {"password changed, user %s", 1234}, + {"ROOT PASSWORD CHANGED", 1235}, + {"password changed by root, user %s", 1236}, + {"calling setpwnam to set password.\n", 1237}, + {"Password *NOT* changed. Try again later.\n", 1238}, + {"Password changed.\n", 1239}, + {"Usage: shutdown [-h|-r] [-fqs] [now|hh:ss|+mins]\n", 1240}, + {"Shutdown process aborted", 1241}, + {"%s: Only root can shut a system down.\n", 1242}, + {"That must be tomorrow, can't you wait till then?\n", 1243}, + {"for maintenance; bounce, bounce", 1244}, + {"timeout = %d, quiet = %d, reboot = %d\n", 1245}, + {"The system is being shut down within 5 minutes", 1246}, + {"Login is therefore prohibited.", 1247}, + {"rebooted by %s: %s", 1248}, + {"halted by %s: %s", 1249}, {"\ \n\ -Why am I still alive after reboot?", 1255}, +Why am I still alive after reboot?", 1250}, {"\ \n\ -Now you can turn off the power...", 1256}, - {"Calling kernel power-off facility...\n", 1257}, - {"Error powering off\t%s\n", 1258}, - {"Executing the program \"%s\" ...\n", 1259}, - {"Error executing\t%s\n", 1260}, - {"URGENT: broadcast message from %s:", 1261}, - {"System going down in %d hours %d minutes", 1262}, - {"System going down in 1 hour %d minutes", 1263}, - {"System going down in %d minutes\n", 1264}, - {"System going down in 1 minute\n", 1265}, - {"System going down IMMEDIATELY!\n", 1266}, - {"\t... %s ...\n", 1267}, - {"Cannot fork for swapoff. Shrug!", 1268}, - {"Cannot exec swapoff, hoping umount will do the trick.", 1269}, - {"Cannot fork for umount, trying manually.", 1270}, - {"Cannot exec %s, trying umount.\n", 1271}, - {"Cannot exec umount, giving up on umount.", 1272}, - {"Unmounting any remaining filesystems...", 1273}, - {"shutdown: Couldn't umount %s: %s\n", 1274}, - {"Booting to single user mode.\n", 1275}, - {"exec of single user shell failed\n", 1276}, - {"fork of single user shell failed\n", 1277}, - {"error opening fifo\n", 1278}, - {"error running finalprog\n", 1279}, - {"error forking finalprog\n", 1280}, +Now you can turn off the power...", 1251}, + {"Calling kernel power-off facility...\n", 1252}, + {"Error powering off\t%s\n", 1253}, + {"Executing the program \"%s\" ...\n", 1254}, + {"Error executing\t%s\n", 1255}, + {"URGENT: broadcast message from %s:", 1256}, + {"System going down in %d hours %d minutes", 1257}, + {"System going down in 1 hour %d minutes", 1258}, + {"System going down in %d minutes\n", 1259}, + {"System going down in 1 minute\n", 1260}, + {"System going down IMMEDIATELY!\n", 1261}, + {"\t... %s ...\n", 1262}, + {"Cannot fork for swapoff. Shrug!", 1263}, + {"Cannot exec swapoff, hoping umount will do the trick.", 1264}, + {"Cannot fork for umount, trying manually.", 1265}, + {"Cannot exec %s, trying umount.\n", 1266}, + {"Cannot exec umount, giving up on umount.", 1267}, + {"Unmounting any remaining filesystems...", 1268}, + {"shutdown: Couldn't umount %s: %s\n", 1269}, + {"Booting to single user mode.\n", 1270}, + {"exec of single user shell failed\n", 1271}, + {"fork of single user shell failed\n", 1272}, + {"error opening fifo\n", 1273}, + {"error running finalprog\n", 1274}, + {"error forking finalprog\n", 1275}, {"\ \n\ -Wrong password.\n", 1281}, - {"lstat of path failed\n", 1282}, - {"stat of path failed\n", 1283}, - {"open of directory failed\n", 1284}, - {"fork failed\n", 1285}, - {"exec failed\n", 1286}, - {"cannot open inittab\n", 1287}, - {"no TERM or cannot stat tty\n", 1288}, - {"error stopping service: \"%s\"", 1289}, - {"too many iov's (change code in wall/ttymsg.c)", 1290}, - {"excessively long line arg", 1291}, - {"cannot fork", 1292}, - {"fork: %s", 1293}, - {"%s: BAD ERROR", 1294}, - {"%s: the password file is busy.\n", 1295}, - {"%s: the group file is busy.\n", 1296}, - {"%s: the %s file is busy (%s present)\n", 1297}, - {"%s: can't link %s: %s\n", 1298}, - {"%s: can't unlock %s: %s (your changes are still in %s)\n", 1299}, - {"%s: Cannot fork\n", 1300}, - {"%s: %s unchanged\n", 1301}, - {"%s: no changes made\n", 1302}, - {"You are using shadow groups on this system.\n", 1303}, - {"You are using shadow passwords on this system.\n", 1304}, - {"Would you like to edit %s now [y/n]? ", 1305}, - {"usage: %s [file]\n", 1306}, - {"%s: can't open temporary file.\n", 1307}, - {"Broadcast Message from %s@%s", 1308}, - {"%s: will not read %s - use stdin.\n", 1309}, - {"%s: can't read %s.\n", 1310}, - {"%s: can't stat temporary file.\n", 1311}, - {"%s: can't read temporary file.\n", 1312}, - {"illegal month value: use 1-12", 1313}, - {"illegal year value: use 1-9999", 1314}, - {"%s %d", 1315}, - {"usage: cal [-13smjyV] [[month] year]\n", 1316}, - {"usage: %s [+format] [day month year]\n", 1317}, - {"St. Tib's Day", 1318}, - {"%s: unknown signal %s\n", 1319}, - {"%s: can't find process \"%s\"\n", 1320}, - {"%s: unknown signal %s; valid signals:\n", 1321}, - {"usage: %s [ -s signal | -p ] [ -a ] pid ...\n", 1322}, - {" %s -l [ signal ]\n", 1323}, - {"logger: %s: %s.\n", 1324}, - {"logger: unknown facility name: %s.\n", 1325}, - {"logger: unknown priority name: %s.\n", 1326}, - {"\ -usage: logger [-is] [-f file] [-p pri] [-t tag] [-u socket] [ message ... ]\n", 1327}, - {"usage: look [-dfa] [-t char] string [file]\n", 1328}, - {"Could not open %s\n", 1329}, - {"Got %d bytes from %s\n", 1330}, - {"namei: unable to get current directory - %s\n", 1331}, - {"namei: unable to chdir to %s - %s (%d)\n", 1332}, - {"usage: namei [-mx] pathname [pathname ...]\n", 1333}, - {"namei: could not chdir to root!\n", 1334}, - {"namei: could not stat root!\n", 1335}, - {"namei: buf overflow\n", 1336}, - {" ? could not chdir into %s - %s (%d)\n", 1337}, - {" ? problems reading symlink %s - %s (%d)\n", 1338}, - {" *** EXCEEDED UNIX LIMIT OF SYMLINKS ***\n", 1339}, - {"namei: unknown file type 0%06o on file %s\n", 1340}, - {"%s: out of memory\n", 1341}, - {"%s: renaming %s to %s failed: %s\n", 1342}, - {"call: %s from to files...\n", 1343}, +Wrong password.\n", 1276}, + {"lstat of path failed\n", 1277}, + {"stat of path failed\n", 1278}, + {"open of directory failed\n", 1279}, + {"fork failed\n", 1280}, + {"exec failed\n", 1281}, + {"cannot open inittab\n", 1282}, + {"no TERM or cannot stat tty\n", 1283}, + {"error stopping service: \"%s\"", 1284}, + {"too many iov's (change code in wall/ttymsg.c)", 1285}, + {"excessively long line arg", 1286}, + {"cannot fork", 1287}, + {"fork: %s", 1288}, + {"%s: BAD ERROR", 1289}, + {"%s: the password file is busy.\n", 1290}, + {"%s: the group file is busy.\n", 1291}, + {"%s: the %s file is busy (%s present)\n", 1292}, + {"%s: can't link %s: %s\n", 1293}, + {"%s: can't unlock %s: %s (your changes are still in %s)\n", 1294}, + {"%s: Cannot fork\n", 1295}, + {"%s: %s unchanged\n", 1296}, + {"%s: no changes made\n", 1297}, + {"You are using shadow groups on this system.\n", 1298}, + {"You are using shadow passwords on this system.\n", 1299}, + {"Would you like to edit %s now [y/n]? ", 1300}, + {"usage: %s [file]\n", 1301}, + {"%s: can't open temporary file.\n", 1302}, + {"Broadcast Message from %s@%s", 1303}, + {"%s: will not read %s - use stdin.\n", 1304}, + {"%s: can't read %s.\n", 1305}, + {"%s: can't stat temporary file.\n", 1306}, + {"%s: can't read temporary file.\n", 1307}, + {"illegal month value: use 1-12", 1308}, + {"illegal year value: use 1-9999", 1309}, + {"%s %d", 1310}, + {"usage: cal [-13smjyV] [[month] year]\n", 1311}, + {"usage: %s [+format] [day month year]\n", 1312}, + {"St. Tib's Day", 1313}, + {"%s: unknown signal %s\n", 1314}, + {"%s: can't find process \"%s\"\n", 1315}, + {"%s: unknown signal %s; valid signals:\n", 1316}, + {"usage: %s [ -s signal | -p ] [ -a ] pid ...\n", 1317}, + {" %s -l [ signal ]\n", 1318}, + {"logger: %s: %s.\n", 1319}, + {"logger: unknown facility name: %s.\n", 1320}, + {"logger: unknown priority name: %s.\n", 1321}, + {"\ +usage: logger [-is] [-f file] [-p pri] [-t tag] [-u socket] [ message ... ]\n", 1322}, + {"usage: look [-dfa] [-t char] string [file]\n", 1323}, + {"Could not open %s\n", 1324}, + {"Got %d bytes from %s\n", 1325}, + {"namei: unable to get current directory - %s\n", 1326}, + {"namei: unable to chdir to %s - %s (%d)\n", 1327}, + {"usage: namei [-mx] pathname [pathname ...]\n", 1328}, + {"namei: could not chdir to root!\n", 1329}, + {"namei: could not stat root!\n", 1330}, + {"namei: buf overflow\n", 1331}, + {" ? could not chdir into %s - %s (%d)\n", 1332}, + {" ? problems reading symlink %s - %s (%d)\n", 1333}, + {" *** EXCEEDED UNIX LIMIT OF SYMLINKS ***\n", 1334}, + {"namei: unknown file type 0%06o on file %s\n", 1335}, + {"%s: out of memory\n", 1336}, + {"%s: renaming %s to %s failed: %s\n", 1337}, + {"call: %s from to files...\n", 1338}, {"\ Warning: `%s' is a link.\n\ Use `%s [options] %s' if you really want to use it.\n\ -Script not started.\n", 1344}, - {"usage: script [-a] [-f] [-q] [-t] [file]\n", 1345}, - {"Script started, file is %s\n", 1346}, - {"Script started on %s", 1347}, +Script not started.\n", 1339}, + {"usage: script [-a] [-f] [-q] [-t] [file]\n", 1340}, + {"Script started, file is %s\n", 1341}, + {"Script started on %s", 1342}, {"\ \n\ -Script done on %s", 1348}, - {"Script done, file is %s\n", 1349}, - {"openpty failed\n", 1350}, - {"Out of pty's\n", 1351}, - {"%s: Argument error, usage\n", 1352}, - {" [ -term terminal_name ]\n", 1353}, - {" [ -reset ]\n", 1354}, - {" [ -initialize ]\n", 1355}, - {" [ -cursor [on|off] ]\n", 1356}, - {" [ -snow [on|off] ]\n", 1357}, - {" [ -softscroll [on|off] ]\n", 1358}, - {" [ -repeat [on|off] ]\n", 1359}, - {" [ -appcursorkeys [on|off] ]\n", 1360}, - {" [ -linewrap [on|off] ]\n", 1361}, - {" [ -default ]\n", 1362}, - {" [ -foreground black|blue|green|cyan", 1363}, - {"|red|magenta|yellow|white|default ]\n", 1364}, - {" [ -background black|blue|green|cyan", 1365}, - {" [ -ulcolor black|grey|blue|green|cyan", 1366}, - {"|red|magenta|yellow|white ]\n", 1367}, - {" [ -ulcolor bright blue|green|cyan", 1368}, - {" [ -hbcolor black|grey|blue|green|cyan", 1369}, - {" [ -hbcolor bright blue|green|cyan", 1370}, - {" [ -standout [ attr ] ]\n", 1371}, - {" [ -inversescreen [on|off] ]\n", 1372}, - {" [ -bold [on|off] ]\n", 1373}, - {" [ -half-bright [on|off] ]\n", 1374}, - {" [ -blink [on|off] ]\n", 1375}, - {" [ -reverse [on|off] ]\n", 1376}, - {" [ -underline [on|off] ]\n", 1377}, - {" [ -store ]\n", 1378}, - {" [ -clear [all|rest] ]\n", 1379}, - {" [ -tabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n", 1380}, - {" [ -clrtabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n", 1381}, - {" [ -regtabs [1-160] ]\n", 1382}, - {" [ -blank [0-60] ]\n", 1383}, - {" [ -dump [1-NR_CONSOLES] ]\n", 1384}, - {" [ -append [1-NR_CONSOLES] ]\n", 1385}, - {" [ -file dumpfilename ]\n", 1386}, - {" [ -msg [on|off] ]\n", 1387}, - {" [ -msglevel [0-8] ]\n", 1388}, - {" [ -powersave [on|vsync|hsync|powerdown|off] ]\n", 1389}, - {" [ -powerdown [0-60] ]\n", 1390}, - {" [ -blength [0-2000] ]\n", 1391}, - {" [ -bfreq freqnumber ]\n", 1392}, - {"cannot (un)set powersave mode\n", 1393}, - {"klogctl error: %s\n", 1394}, - {"Error reading %s\n", 1395}, - {"Error writing screendump\n", 1396}, - {"couldn't read %s, and cannot ioctl dump\n", 1397}, - {"%s: $TERM is not defined.\n", 1398}, - {"whereis [ -sbmu ] [ -SBM dir ... -f ] name...\n", 1399}, - {"write: can't find your tty's name\n", 1400}, - {"write: you have write permission turned off.\n", 1401}, - {"write: %s is not logged in on %s.\n", 1402}, - {"write: %s has messages disabled on %s\n", 1403}, - {"usage: write user [tty]\n", 1404}, - {"write: %s is not logged in\n", 1405}, - {"write: %s has messages disabled\n", 1406}, - {"write: %s is logged in more than once; writing to %s\n", 1407}, - {"Message from %s@%s (as %s) on %s at %s ...", 1408}, - {"Message from %s@%s on %s at %s ...", 1409}, - {"warning: error reading %s: %s", 1410}, - {"warning: can't open %s: %s", 1411}, - {"mount: could not open %s - using %s instead\n", 1412}, - {"can't create lock file %s: %s (use -n flag to override)", 1413}, - {"can't link lock file %s: %s (use -n flag to override)", 1414}, - {"can't open lock file %s: %s (use -n flag to override)", 1415}, - {"Can't lock lock file %s: %s\n", 1416}, - {"can't lock lock file %s: %s", 1417}, - {"timed out", 1418}, +Script done on %s", 1343}, + {"Script done, file is %s\n", 1344}, + {"openpty failed\n", 1345}, + {"Out of pty's\n", 1346}, + {"%s: Argument error, usage\n", 1347}, + {" [ -term terminal_name ]\n", 1348}, + {" [ -reset ]\n", 1349}, + {" [ -initialize ]\n", 1350}, + {" [ -cursor [on|off] ]\n", 1351}, + {" [ -snow [on|off] ]\n", 1352}, + {" [ -softscroll [on|off] ]\n", 1353}, + {" [ -repeat [on|off] ]\n", 1354}, + {" [ -appcursorkeys [on|off] ]\n", 1355}, + {" [ -linewrap [on|off] ]\n", 1356}, + {" [ -default ]\n", 1357}, + {" [ -foreground black|blue|green|cyan", 1358}, + {"|red|magenta|yellow|white|default ]\n", 1359}, + {" [ -background black|blue|green|cyan", 1360}, + {" [ -ulcolor black|grey|blue|green|cyan", 1361}, + {"|red|magenta|yellow|white ]\n", 1362}, + {" [ -ulcolor bright blue|green|cyan", 1363}, + {" [ -hbcolor black|grey|blue|green|cyan", 1364}, + {" [ -hbcolor bright blue|green|cyan", 1365}, + {" [ -standout [ attr ] ]\n", 1366}, + {" [ -inversescreen [on|off] ]\n", 1367}, + {" [ -bold [on|off] ]\n", 1368}, + {" [ -half-bright [on|off] ]\n", 1369}, + {" [ -blink [on|off] ]\n", 1370}, + {" [ -reverse [on|off] ]\n", 1371}, + {" [ -underline [on|off] ]\n", 1372}, + {" [ -store ]\n", 1373}, + {" [ -clear [all|rest] ]\n", 1374}, + {" [ -tabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n", 1375}, + {" [ -clrtabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n", 1376}, + {" [ -regtabs [1-160] ]\n", 1377}, + {" [ -blank [0-60] ]\n", 1378}, + {" [ -dump [1-NR_CONSOLES] ]\n", 1379}, + {" [ -append [1-NR_CONSOLES] ]\n", 1380}, + {" [ -file dumpfilename ]\n", 1381}, + {" [ -msg [on|off] ]\n", 1382}, + {" [ -msglevel [0-8] ]\n", 1383}, + {" [ -powersave [on|vsync|hsync|powerdown|off] ]\n", 1384}, + {" [ -powerdown [0-60] ]\n", 1385}, + {" [ -blength [0-2000] ]\n", 1386}, + {" [ -bfreq freqnumber ]\n", 1387}, + {"cannot (un)set powersave mode\n", 1388}, + {"klogctl error: %s\n", 1389}, + {"Error reading %s\n", 1390}, + {"Error writing screendump\n", 1391}, + {"couldn't read %s, and cannot ioctl dump\n", 1392}, + {"%s: $TERM is not defined.\n", 1393}, + {"whereis [ -sbmu ] [ -SBM dir ... -f ] name...\n", 1394}, + {"write: can't find your tty's name\n", 1395}, + {"write: you have write permission turned off.\n", 1396}, + {"write: %s is not logged in on %s.\n", 1397}, + {"write: %s has messages disabled on %s\n", 1398}, + {"usage: write user [tty]\n", 1399}, + {"write: %s is not logged in\n", 1400}, + {"write: %s has messages disabled\n", 1401}, + {"write: %s is logged in more than once; writing to %s\n", 1402}, + {"Message from %s@%s (as %s) on %s at %s ...", 1403}, + {"Message from %s@%s on %s at %s ...", 1404}, + {"warning: error reading %s: %s", 1405}, + {"warning: can't open %s: %s", 1406}, + {"mount: could not open %s - using %s instead\n", 1407}, + {"can't create lock file %s: %s (use -n flag to override)", 1408}, + {"can't link lock file %s: %s (use -n flag to override)", 1409}, + {"can't open lock file %s: %s (use -n flag to override)", 1410}, + {"Can't lock lock file %s: %s\n", 1411}, + {"can't lock lock file %s: %s", 1412}, + {"timed out", 1413}, {"\ Cannot create link %s\n\ -Perhaps there is a stale lock file?\n", 1419}, - {"cannot open %s (%s) - mtab not updated", 1420}, - {"error writing %s: %s", 1421}, - {"error changing mode of %s: %s\n", 1422}, - {"can't rename %s to %s: %s\n", 1423}, - {"loop: can't open device %s: %s\n", 1424}, - {"loop: can't get info on device %s: %s\n", 1425}, - {"%s: [%04x]:%ld (%s) offset %d, %s encryption\n", 1426}, - {"mount: could not find any device /dev/loop#", 1427}, +Perhaps there is a stale lock file?\n", 1414}, + {"cannot open %s (%s) - mtab not updated", 1415}, + {"error writing %s: %s", 1416}, + {"error changing mode of %s: %s\n", 1417}, + {"can't rename %s to %s: %s\n", 1418}, + {"loop: can't open device %s: %s\n", 1419}, + {"loop: can't get info on device %s: %s\n", 1420}, + {"%s: [%04x]:%ld (%s) offset %d, %s encryption\n", 1421}, + {"mount: could not find any device /dev/loop#", 1422}, {"\ mount: Could not find any loop device.\n\ - Maybe /dev/loop# has a wrong major number?", 1428}, + Maybe /dev/loop# has a wrong major number?", 1423}, {"\ mount: Could not find any loop device, and, according to %s,\n\ this kernel does not know about the loop device.\n\ - (If so, then recompile or `insmod loop.o'.)", 1429}, + (If so, then recompile or `insmod loop.o'.)", 1424}, {"\ mount: Could not find any loop device. Maybe this kernel does not know\n\ about the loop device (then recompile or `insmod loop.o'), or\n\ - maybe /dev/loop# has the wrong major number?", 1430}, - {"mount: could not find any free loop device", 1431}, - {"Unsupported encryption type %s\n", 1432}, - {"Couldn't lock into memory, exiting.\n", 1433}, - {"Init (up to 16 hex digits): ", 1434}, - {"Non-hex digit '%c'.\n", 1435}, - {"Don't know how to get key for encryption system %d\n", 1436}, - {"set_loop(%s,%s,%d): success\n", 1437}, - {"loop: can't delete device %s: %s\n", 1438}, - {"del_loop(%s): success\n", 1439}, - {"This mount was compiled without loop support. Please recompile.\n", 1440}, + maybe /dev/loop# has the wrong major number?", 1425}, + {"mount: could not find any free loop device", 1426}, + {"Unsupported encryption type %s\n", 1427}, + {"Couldn't lock into memory, exiting.\n", 1428}, + {"Init (up to 16 hex digits): ", 1429}, + {"Non-hex digit '%c'.\n", 1430}, + {"Don't know how to get key for encryption system %d\n", 1431}, + {"set_loop(%s,%s,%d): success\n", 1432}, + {"loop: can't delete device %s: %s\n", 1433}, + {"del_loop(%s): success\n", 1434}, + {"This mount was compiled without loop support. Please recompile.\n", 1435}, {"\ usage:\n\ %s loop_device # give info\n\ %s -d loop_device # delete\n\ - %s [ -e encryption ] [ -o offset ] loop_device file # setup\n", 1441}, - {"not enough memory", 1442}, - {"No loop support was available at compile time. Please recompile.\n", 1443}, - {"[mntent]: warning: no final newline at the end of %s\n", 1444}, - {"[mntent]: line %d in %s is bad%s\n", 1445}, - {"; rest of file ignored", 1446}, - {"mount: according to mtab, %s is already mounted on %s", 1447}, - {"mount: according to mtab, %s is mounted on %s", 1448}, - {"mount: can't open %s for writing: %s", 1449}, - {"mount: error writing %s: %s", 1450}, - {"mount: error changing mode of %s: %s", 1451}, - {"%s looks like swapspace - not mounted", 1452}, - {"mount failed", 1453}, - {"mount: only root can mount %s on %s", 1454}, - {"mount: loop device specified twice", 1455}, - {"mount: type specified twice", 1456}, - {"mount: skipping the setup of a loop device\n", 1457}, - {"mount: going to use the loop device %s\n", 1458}, - {"mount: failed setting up loop device\n", 1459}, - {"mount: setup loop device successfully\n", 1460}, - {"mount: can't open %s: %s", 1461}, - {"mount: cannot open %s for setting speed", 1462}, - {"mount: cannot set speed: %s", 1463}, - {"mount: cannot fork: %s", 1464}, - {"mount: this version was compiled without support for the type `nfs'", 1465}, - {"mount: failed with nfs mount version 4, trying 3..\n", 1466}, - {"\ -mount: I could not determine the filesystem type, and none was specified", 1467}, - {"mount: you must specify the filesystem type", 1468}, - {"mount: mount failed", 1469}, - {"mount: mount point %s is not a directory", 1470}, - {"mount: permission denied", 1471}, - {"mount: must be superuser to use mount", 1472}, - {"mount: %s is busy", 1473}, - {"mount: proc already mounted", 1474}, - {"mount: %s already mounted or %s busy", 1475}, - {"mount: mount point %s does not exist", 1476}, - {"mount: mount point %s is a symbolic link to nowhere", 1477}, - {"mount: special device %s does not exist", 1478}, + %s [ -e encryption ] [ -o offset ] loop_device file # setup\n", 1436}, + {"not enough memory", 1437}, + {"No loop support was available at compile time. Please recompile.\n", 1438}, + {"[mntent]: warning: no final newline at the end of %s\n", 1439}, + {"[mntent]: line %d in %s is bad%s\n", 1440}, + {"; rest of file ignored", 1441}, + {"mount: according to mtab, %s is already mounted on %s", 1442}, + {"mount: according to mtab, %s is mounted on %s", 1443}, + {"mount: can't open %s for writing: %s", 1444}, + {"mount: error writing %s: %s", 1445}, + {"mount: error changing mode of %s: %s", 1446}, + {"%s looks like swapspace - not mounted", 1447}, + {"mount failed", 1448}, + {"mount: only root can mount %s on %s", 1449}, + {"mount: loop device specified twice", 1450}, + {"mount: type specified twice", 1451}, + {"mount: skipping the setup of a loop device\n", 1452}, + {"mount: going to use the loop device %s\n", 1453}, + {"mount: failed setting up loop device\n", 1454}, + {"mount: setup loop device successfully\n", 1455}, + {"mount: can't open %s: %s", 1456}, + {"mount: cannot open %s for setting speed", 1457}, + {"mount: cannot set speed: %s", 1458}, + {"mount: cannot fork: %s", 1459}, + {"mount: this version was compiled without support for the type `nfs'", 1460}, + {"mount: failed with nfs mount version 4, trying 3..\n", 1461}, + {"\ +mount: I could not determine the filesystem type, and none was specified", 1462}, + {"mount: you must specify the filesystem type", 1463}, + {"mount: mount failed", 1464}, + {"mount: mount point %s is not a directory", 1465}, + {"mount: permission denied", 1466}, + {"mount: must be superuser to use mount", 1467}, + {"mount: %s is busy", 1468}, + {"mount: proc already mounted", 1469}, + {"mount: %s already mounted or %s busy", 1470}, + {"mount: mount point %s does not exist", 1471}, + {"mount: mount point %s is a symbolic link to nowhere", 1472}, + {"mount: special device %s does not exist", 1473}, {"\ mount: special device %s does not exist\n\ - (a path prefix is not a directory)\n", 1479}, - {"mount: %s not mounted already, or bad option", 1480}, + (a path prefix is not a directory)\n", 1474}, + {"mount: %s not mounted already, or bad option", 1475}, {"\ mount: wrong fs type, bad option, bad superblock on %s,\n\ - or too many mounted file systems", 1481}, - {"mount table full", 1482}, - {"mount: %s: can't read superblock", 1483}, - {"mount: %s: unknown device", 1484}, - {"mount: fs type %s not supported by kernel", 1485}, - {"mount: probably you meant %s", 1486}, - {"mount: maybe you meant iso9660 ?", 1487}, - {"mount: %s has wrong device number or fs type %s not supported", 1488}, - {"mount: %s is not a block device, and stat fails?", 1489}, + or too many mounted file systems", 1476}, + {"mount table full", 1477}, + {"mount: %s: can't read superblock", 1478}, + {"mount: %s: unknown device", 1479}, + {"mount: fs type %s not supported by kernel", 1480}, + {"mount: probably you meant %s", 1481}, + {"mount: maybe you meant iso9660 ?", 1482}, + {"mount: %s has wrong device number or fs type %s not supported", 1483}, + {"mount: %s is not a block device, and stat fails?", 1484}, {"\ mount: the kernel does not recognize %s as a block device\n\ - (maybe `insmod driver'?)", 1490}, - {"mount: %s is not a block device (maybe try `-o loop'?)", 1491}, - {"mount: %s is not a block device", 1492}, - {"mount: %s is not a valid block device", 1493}, - {"block device ", 1494}, - {"mount: cannot mount %s%s read-only", 1495}, - {"mount: %s%s is write-protected but explicit `-w' flag given", 1496}, - {"mount: %s%s is write-protected, mounting read-only", 1497}, - {"mount: the label %s occurs on both %s and %s\n", 1498}, - {"mount: %s duplicate - not mounted", 1499}, - {"mount: going to mount %s by %s\n", 1500}, - {"UUID", 1501}, - {"label", 1502}, - {"mount: no such partition found", 1503}, - {"mount: no type was given - I'll assume nfs because of the colon\n", 1504}, - {"mount: backgrounding \"%s\"\n", 1505}, - {"mount: giving up \"%s\"\n", 1506}, - {"mount: %s already mounted on %s\n", 1507}, + (maybe `insmod driver'?)", 1485}, + {"mount: %s is not a block device (maybe try `-o loop'?)", 1486}, + {"mount: %s is not a block device", 1487}, + {"mount: %s is not a valid block device", 1488}, + {"block device ", 1489}, + {"mount: cannot mount %s%s read-only", 1490}, + {"mount: %s%s is write-protected but explicit `-w' flag given", 1491}, + {"mount: %s%s is write-protected, mounting read-only", 1492}, + {"mount: the label %s occurs on both %s and %s\n", 1493}, + {"mount: %s duplicate - not mounted", 1494}, + {"mount: going to mount %s by %s\n", 1495}, + {"UUID", 1496}, + {"label", 1497}, + {"mount: no such partition found", 1498}, + {"mount: no type was given - I'll assume nfs because of the colon\n", 1499}, + {"mount: no type was given - I'll assume smb because of the // prefix\n", 1500}, + {"mount: backgrounding \"%s\"\n", 1501}, + {"mount: giving up \"%s\"\n", 1502}, + {"mount: %s already mounted on %s\n", 1503}, {"\ Usage: mount -V : print version\n\ mount -h : print this help\n\ @@ -1984,285 +1980,289 @@ or move a subtree:\n\ A device can be given by name, say /dev/hda1 or /dev/cdrom,\n\ or by label, using -L label or by uuid, using -U uuid .\n\ Other options: [-nfFrsvw] [-o options].\n\ -For many more details, say man 8 mount .\n", 1508}, - {"mount: only root can do that", 1509}, - {"mount: no %s found - creating it..\n", 1510}, - {"mount: the label %s occurs on both %s and %s - not mounted\n", 1511}, - {"mount: mounting %s\n", 1512}, - {"nothing was mounted", 1513}, - {"mount: cannot find %s in %s", 1514}, - {"mount: can't find %s in %s or %s", 1515}, - {"\ -mount: could not open %s, so UUID and LABEL conversion cannot be done.\n", 1516}, - {"mount: bad UUID", 1517}, - {"mount: error while guessing filesystem type\n", 1518}, - {"mount: you didn't specify a filesystem type for %s\n", 1519}, - {" I will try all types mentioned in %s or %s\n", 1520}, - {" and it looks like this is swapspace\n", 1521}, - {" I will try type %s\n", 1522}, - {"Trying %s\n", 1523}, - {"mount: excessively long host:dir argument\n", 1524}, - {"mount: warning: multiple hostnames not supported\n", 1525}, - {"mount: directory to mount not in host:dir format\n", 1526}, - {"mount: can't get address for %s\n", 1527}, - {"mount: got bad hp->h_length\n", 1528}, - {"mount: excessively long option argument\n", 1529}, - {"Warning: Unrecognized proto= option.\n", 1530}, - {"Warning: Option namlen is not supported.\n", 1531}, - {"unknown nfs mount parameter: %s=%d\n", 1532}, - {"Warning: option nolock is not supported.\n", 1533}, - {"unknown nfs mount option: %s%s\n", 1534}, - {"mount: got bad hp->h_length?\n", 1535}, - {"NFS over TCP is not supported.\n", 1536}, - {"nfs socket", 1537}, - {"nfs bindresvport", 1538}, - {"nfs server reported service unavailable", 1539}, - {"used portmapper to find NFS port\n", 1540}, - {"using port %d for nfs deamon\n", 1541}, - {"nfs connect", 1542}, - {"unknown nfs status return value: %d", 1543}, - {"bug in xstrndup call", 1544}, +For many more details, say man 8 mount .\n", 1504}, + {"mount: only root can do that", 1505}, + {"mount: no %s found - creating it..\n", 1506}, + {"mount: the label %s occurs on both %s and %s - not mounted\n", 1507}, + {"mount: mounting %s\n", 1508}, + {"nothing was mounted", 1509}, + {"mount: cannot find %s in %s", 1510}, + {"mount: can't find %s in %s or %s", 1511}, + {"\ +mount: could not open %s, so UUID and LABEL conversion cannot be done.\n", 1512}, + {"mount: bad UUID", 1513}, + {"mount: error while guessing filesystem type\n", 1514}, + {"mount: you didn't specify a filesystem type for %s\n", 1515}, + {" I will try all types mentioned in %s or %s\n", 1516}, + {" and it looks like this is swapspace\n", 1517}, + {" I will try type %s\n", 1518}, + {"Trying %s\n", 1519}, + {"mount: excessively long host:dir argument\n", 1520}, + {"mount: warning: multiple hostnames not supported\n", 1521}, + {"mount: directory to mount not in host:dir format\n", 1522}, + {"mount: can't get address for %s\n", 1523}, + {"mount: got bad hp->h_length\n", 1524}, + {"mount: excessively long option argument\n", 1525}, + {"Warning: Unrecognized proto= option.\n", 1526}, + {"Warning: Option namlen is not supported.\n", 1527}, + {"unknown nfs mount parameter: %s=%d\n", 1528}, + {"Warning: option nolock is not supported.\n", 1529}, + {"unknown nfs mount option: %s%s\n", 1530}, + {"mount: got bad hp->h_length?\n", 1531}, + {"NFS over TCP is not supported.\n", 1532}, + {"nfs socket", 1533}, + {"nfs bindresvport", 1534}, + {"nfs server reported service unavailable", 1535}, + {"used portmapper to find NFS port\n", 1536}, + {"using port %d for nfs deamon\n", 1537}, + {"nfs connect", 1538}, + {"unknown nfs status return value: %d", 1539}, + {"bug in xstrndup call", 1540}, {"\ usage: %s [-hV]\n\ %s -a [-v]\n\ %s [-v] [-p priority] special ...\n\ - %s [-s]\n", 1545}, - {"%s on %s\n", 1546}, - {"swapon: cannot stat %s: %s\n", 1547}, - {"swapon: warning: %s has insecure permissions %04o, %04o suggested\n", 1548}, - {"swapon: Skipping file %s - it appears to have holes.\n", 1549}, - {"%s: cannot open %s: %s\n", 1550}, - {"umount: compiled without support for -f\n", 1551}, - {"host: %s, directory: %s\n", 1552}, - {"umount: can't get address for %s\n", 1553}, - {"umount: got bad hostp->h_length\n", 1554}, - {"umount: %s: invalid block device", 1555}, - {"umount: %s: not mounted", 1556}, - {"umount: %s: can't write superblock", 1557}, - {"umount: %s: device is busy", 1558}, - {"umount: %s: not found", 1559}, - {"umount: %s: must be superuser to umount", 1560}, - {"umount: %s: block devices not permitted on fs", 1561}, - {"umount: %s: %s", 1562}, - {"no umount2, trying umount...\n", 1563}, - {"could not umount %s - trying %s instead\n", 1564}, - {"umount: %s busy - remounted read-only\n", 1565}, - {"umount: could not remount %s read-only\n", 1566}, - {"%s umounted\n", 1567}, - {"umount: cannot find list of filesystems to unmount", 1568}, + %s [-s]\n", 1541}, + {"\ +usage: %s [-hV]\n\ + %s -a [-v]\n\ + %s [-v] special ...\n", 1542}, + {"%s on %s\n", 1543}, + {"swapon: cannot stat %s: %s\n", 1544}, + {"swapon: warning: %s has insecure permissions %04o, %04o suggested\n", 1545}, + {"swapon: Skipping file %s - it appears to have holes.\n", 1546}, + {"Not superuser.\n", 1547}, + {"%s: cannot open %s: %s\n", 1548}, + {"umount: compiled without support for -f\n", 1549}, + {"host: %s, directory: %s\n", 1550}, + {"umount: can't get address for %s\n", 1551}, + {"umount: got bad hostp->h_length\n", 1552}, + {"umount: %s: invalid block device", 1553}, + {"umount: %s: not mounted", 1554}, + {"umount: %s: can't write superblock", 1555}, + {"umount: %s: device is busy", 1556}, + {"umount: %s: not found", 1557}, + {"umount: %s: must be superuser to umount", 1558}, + {"umount: %s: block devices not permitted on fs", 1559}, + {"umount: %s: %s", 1560}, + {"no umount2, trying umount...\n", 1561}, + {"could not umount %s - trying %s instead\n", 1562}, + {"umount: %s busy - remounted read-only\n", 1563}, + {"umount: could not remount %s read-only\n", 1564}, + {"%s umounted\n", 1565}, + {"umount: cannot find list of filesystems to unmount", 1566}, {"\ Usage: umount [-hV]\n\ umount -a [-f] [-r] [-n] [-v] [-t vfstypes]\n\ - umount [-f] [-r] [-n] [-v] special | node...\n", 1569}, - {"Trying to umount %s\n", 1570}, - {"Could not find %s in mtab\n", 1571}, - {"umount: %s is not mounted (according to mtab)", 1572}, - {"umount: it seems %s is mounted multiple times", 1573}, - {"umount: %s is not in the fstab (and you are not root)", 1574}, - {"umount: %s mount disagrees with the fstab", 1575}, - {"umount: only root can unmount %s from %s", 1576}, - {"umount: only root can do that", 1577}, - {"You must be root to set the Ctrl-Alt-Del behaviour.\n", 1578}, - {"Usage: ctrlaltdel hard|soft\n", 1579}, + umount [-f] [-r] [-n] [-v] special | node...\n", 1567}, + {"Trying to umount %s\n", 1568}, + {"Could not find %s in mtab\n", 1569}, + {"umount: %s is not mounted (according to mtab)", 1570}, + {"umount: it seems %s is mounted multiple times", 1571}, + {"umount: %s is not in the fstab (and you are not root)", 1572}, + {"umount: %s mount disagrees with the fstab", 1573}, + {"umount: only root can unmount %s from %s", 1574}, + {"umount: only root can do that", 1575}, + {"You must be root to set the Ctrl-Alt-Del behaviour.\n", 1576}, + {"Usage: ctrlaltdel hard|soft\n", 1577}, {"\ File %s, For threshold value %lu, Maximum characters in fifo were %d,\n\ -and the maximum transfer rate in characters/second was %f\n", 1580}, +and the maximum transfer rate in characters/second was %f\n", 1578}, {"\ 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", 1581}, - {"Invalid interval value: %s\n", 1582}, - {"Invalid set value: %s\n", 1583}, - {"Invalid default value: %s\n", 1584}, - {"Invalid set time value: %s\n", 1585}, - {"Invalid default time value: %s\n", 1586}, +and the maximum transfer rate in characters/second was %f\n", 1579}, + {"Invalid interval value: %s\n", 1580}, + {"Invalid set value: %s\n", 1581}, + {"Invalid default value: %s\n", 1582}, + {"Invalid set time value: %s\n", 1583}, + {"Invalid default time value: %s\n", 1584}, {"\ Usage: %s [-q [-i interval]] ([-s value]|[-S value]) ([-t value]|[-T value]) \ -[-g|-G] file [file...]\n", 1587}, - {"Can't open %s: %s\n", 1588}, - {"Can't set %s to threshold %d: %s\n", 1589}, - {"Can't set %s to time threshold %d: %s\n", 1590}, - {"Can't get threshold for %s: %s\n", 1591}, - {"Can't get timeout for %s: %s\n", 1592}, - {"%s: %ld current threshold and %ld current timeout\n", 1593}, - {"%s: %ld default threshold and %ld default timeout\n", 1594}, - {"Can't set signal handler", 1595}, - {"gettimeofday failed", 1596}, - {"Can't issue CYGETMON on %s: %s\n", 1597}, - {"\ -%s: %lu ints, %lu/%lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n", 1598}, - {" %f int/sec; %f rec, %f send (char/sec)\n", 1599}, - {"\ -%s: %lu ints, %lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n", 1600}, - {" %f int/sec; %f rec (char/sec)\n", 1601}, - {"Usage: %s [-c] [-n level] [-s bufsize]\n", 1602}, - {"invalid id: %s\n", 1603}, - {"cannot remove id %s (%s)\n", 1604}, - {"deprecated usage: %s {shm | msg | sem} id ...\n", 1605}, - {"unknown resource type: %s\n", 1606}, - {"resource(s) deleted\n", 1607}, +[-g|-G] file [file...]\n", 1585}, + {"Can't open %s: %s\n", 1586}, + {"Can't set %s to threshold %d: %s\n", 1587}, + {"Can't set %s to time threshold %d: %s\n", 1588}, + {"Can't get threshold for %s: %s\n", 1589}, + {"Can't get timeout for %s: %s\n", 1590}, + {"%s: %ld current threshold and %ld current timeout\n", 1591}, + {"%s: %ld default threshold and %ld default timeout\n", 1592}, + {"Can't set signal handler", 1593}, + {"gettimeofday failed", 1594}, + {"Can't issue CYGETMON on %s: %s\n", 1595}, + {"\ +%s: %lu ints, %lu/%lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n", 1596}, + {" %f int/sec; %f rec, %f send (char/sec)\n", 1597}, + {"\ +%s: %lu ints, %lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n", 1598}, + {" %f int/sec; %f rec (char/sec)\n", 1599}, + {"Usage: %s [-c] [-n level] [-s bufsize]\n", 1600}, + {"invalid id: %s\n", 1601}, + {"cannot remove id %s (%s)\n", 1602}, + {"deprecated usage: %s {shm | msg | sem} id ...\n", 1603}, + {"unknown resource type: %s\n", 1604}, + {"resource(s) deleted\n", 1605}, {"\ usage: %s [ [-q msqid] [-m shmid] [-s semid]\n\ - [-Q msgkey] [-M shmkey] [-S semkey] ... ]\n", 1608}, - {"%s: illegal option -- %c\n", 1609}, - {"%s: illegal key (%s)\n", 1610}, - {"permission denied for key", 1611}, - {"already removed key", 1612}, - {"invalid key", 1613}, - {"unknown error in key", 1614}, - {"permission denied for id", 1615}, - {"invalid id", 1616}, - {"already removed id", 1617}, - {"unknown error in id", 1618}, - {"%s: %s (%s)\n", 1619}, - {"%s: unknown argument: %s\n", 1620}, - {"usage : %s -asmq -tclup \n", 1621}, - {"\t%s [-s -m -q] -i id\n", 1622}, - {"\t%s -h for help.\n", 1623}, - {"\ -%s provides information on ipc facilities for which you have read access.\n", 1624}, + [-Q msgkey] [-M shmkey] [-S semkey] ... ]\n", 1606}, + {"%s: illegal option -- %c\n", 1607}, + {"%s: illegal key (%s)\n", 1608}, + {"permission denied for key", 1609}, + {"already removed key", 1610}, + {"invalid key", 1611}, + {"unknown error in key", 1612}, + {"permission denied for id", 1613}, + {"invalid id", 1614}, + {"already removed id", 1615}, + {"unknown error in id", 1616}, + {"%s: %s (%s)\n", 1617}, + {"%s: unknown argument: %s\n", 1618}, + {"usage : %s -asmq -tclup \n", 1619}, + {"\t%s [-s -m -q] -i id\n", 1620}, + {"\t%s -h for help.\n", 1621}, + {"\ +%s provides information on ipc facilities for which you have read access.\n", 1622}, {"\ Resource Specification:\n\ \t-m : shared_mem\n\ -\t-q : messages\n", 1625}, +\t-q : messages\n", 1623}, {"\ \t-s : semaphores\n\ -\t-a : all (default)\n", 1626}, +\t-a : all (default)\n", 1624}, {"\ Output Format:\n\ \t-t : time\n\ \t-p : pid\n\ -\t-c : creator\n", 1627}, +\t-c : creator\n", 1625}, {"\ \t-l : limits\n\ -\t-u : summary\n", 1628}, - {"-i id [-s -q -m] : details on resource identified by id\n", 1629}, - {"kernel not configured for shared memory\n", 1630}, - {"------ Shared Memory Limits --------\n", 1631}, - {"max number of segments = %ld\n", 1632}, - {"max seg size (kbytes) = %ld\n", 1633}, - {"max total shared memory (kbytes) = %ld\n", 1634}, - {"min seg size (bytes) = %ld\n", 1635}, - {"------ Shared Memory Status --------\n", 1636}, - {"segments allocated %d\n", 1637}, - {"pages allocated %ld\n", 1638}, - {"pages resident %ld\n", 1639}, - {"pages swapped %ld\n", 1640}, - {"Swap performance: %ld attempts\t %ld successes\n", 1641}, - {"------ Shared Memory Segment Creators/Owners --------\n", 1642}, - {"%-10s %-10s %-10s %-10s %-10s %-10s\n", 1643}, - {"shmid", 1644}, - {"perms", 1645}, - {"cuid", 1646}, - {"cgid", 1647}, - {"uid", 1648}, - {"gid", 1649}, - {"------ Shared Memory Attach/Detach/Change Times --------\n", 1650}, - {"%-10s %-10s %-20s %-20s %-20s\n", 1651}, - {"owner", 1652}, - {"attached", 1653}, - {"detached", 1654}, - {"changed", 1655}, - {"------ Shared Memory Creator/Last-op --------\n", 1656}, - {"%-10s %-10s %-10s %-10s\n", 1657}, - {"cpid", 1658}, - {"lpid", 1659}, - {"------ Shared Memory Segments --------\n", 1660}, - {"%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n", 1661}, - {"key", 1662}, - {"bytes", 1663}, - {"nattch", 1664}, - {"status", 1665}, - {"Not set", 1666}, - {"dest", 1667}, - {"locked", 1668}, - {"kernel not configured for semaphores\n", 1669}, - {"------ Semaphore Limits --------\n", 1670}, - {"max number of arrays = %d\n", 1671}, - {"max semaphores per array = %d\n", 1672}, - {"max semaphores system wide = %d\n", 1673}, - {"max ops per semop call = %d\n", 1674}, - {"semaphore max value = %d\n", 1675}, - {"------ Semaphore Status --------\n", 1676}, - {"used arrays = %d\n", 1677}, - {"allocated semaphores = %d\n", 1678}, - {"------ Semaphore Arrays Creators/Owners --------\n", 1679}, - {"semid", 1680}, - {"------ Shared Memory Operation/Change Times --------\n", 1681}, - {"%-8s %-10s %-26.24s %-26.24s\n", 1682}, - {"last-op", 1683}, - {"last-changed", 1684}, - {"------ Semaphore Arrays --------\n", 1685}, - {"%-10s %-10s %-10s %-10s %-10s %-12s\n", 1686}, - {"nsems", 1687}, - {"kernel not configured for message queues\n", 1688}, - {"------ Messages: Limits --------\n", 1689}, - {"max queues system wide = %d\n", 1690}, - {"max size of message (bytes) = %d\n", 1691}, - {"default max size of queue (bytes) = %d\n", 1692}, - {"------ Messages: Status --------\n", 1693}, - {"allocated queues = %d\n", 1694}, - {"used headers = %d\n", 1695}, - {"used space = %d bytes\n", 1696}, - {"------ Message Queues: Creators/Owners --------\n", 1697}, - {"msqid", 1698}, - {"------ Message Queues Send/Recv/Change Times --------\n", 1699}, - {"%-8s %-10s %-20s %-20s %-20s\n", 1700}, - {"send", 1701}, - {"recv", 1702}, - {"change", 1703}, - {"------ Message Queues PIDs --------\n", 1704}, - {"lspid", 1705}, - {"lrpid", 1706}, - {"------ Message Queues --------\n", 1707}, - {"%-10s %-10s %-10s %-10s %-12s %-12s\n", 1708}, - {"used-bytes", 1709}, - {"messages", 1710}, +\t-u : summary\n", 1626}, + {"-i id [-s -q -m] : details on resource identified by id\n", 1627}, + {"kernel not configured for shared memory\n", 1628}, + {"------ Shared Memory Limits --------\n", 1629}, + {"max number of segments = %ld\n", 1630}, + {"max seg size (kbytes) = %ld\n", 1631}, + {"max total shared memory (kbytes) = %ld\n", 1632}, + {"min seg size (bytes) = %ld\n", 1633}, + {"------ Shared Memory Status --------\n", 1634}, + {"segments allocated %d\n", 1635}, + {"pages allocated %ld\n", 1636}, + {"pages resident %ld\n", 1637}, + {"pages swapped %ld\n", 1638}, + {"Swap performance: %ld attempts\t %ld successes\n", 1639}, + {"------ Shared Memory Segment Creators/Owners --------\n", 1640}, + {"%-10s %-10s %-10s %-10s %-10s %-10s\n", 1641}, + {"shmid", 1642}, + {"perms", 1643}, + {"cuid", 1644}, + {"cgid", 1645}, + {"uid", 1646}, + {"gid", 1647}, + {"------ Shared Memory Attach/Detach/Change Times --------\n", 1648}, + {"%-10s %-10s %-20s %-20s %-20s\n", 1649}, + {"owner", 1650}, + {"attached", 1651}, + {"detached", 1652}, + {"changed", 1653}, + {"------ Shared Memory Creator/Last-op --------\n", 1654}, + {"%-10s %-10s %-10s %-10s\n", 1655}, + {"cpid", 1656}, + {"lpid", 1657}, + {"------ Shared Memory Segments --------\n", 1658}, + {"%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n", 1659}, + {"key", 1660}, + {"bytes", 1661}, + {"nattch", 1662}, + {"status", 1663}, + {"Not set", 1664}, + {"dest", 1665}, + {"locked", 1666}, + {"kernel not configured for semaphores\n", 1667}, + {"------ Semaphore Limits --------\n", 1668}, + {"max number of arrays = %d\n", 1669}, + {"max semaphores per array = %d\n", 1670}, + {"max semaphores system wide = %d\n", 1671}, + {"max ops per semop call = %d\n", 1672}, + {"semaphore max value = %d\n", 1673}, + {"------ Semaphore Status --------\n", 1674}, + {"used arrays = %d\n", 1675}, + {"allocated semaphores = %d\n", 1676}, + {"------ Semaphore Arrays Creators/Owners --------\n", 1677}, + {"semid", 1678}, + {"------ Shared Memory Operation/Change Times --------\n", 1679}, + {"%-8s %-10s %-26.24s %-26.24s\n", 1680}, + {"last-op", 1681}, + {"last-changed", 1682}, + {"------ Semaphore Arrays --------\n", 1683}, + {"%-10s %-10s %-10s %-10s %-10s\n", 1684}, + {"nsems", 1685}, + {"kernel not configured for message queues\n", 1686}, + {"------ Messages: Limits --------\n", 1687}, + {"max queues system wide = %d\n", 1688}, + {"max size of message (bytes) = %d\n", 1689}, + {"default max size of queue (bytes) = %d\n", 1690}, + {"------ Messages: Status --------\n", 1691}, + {"allocated queues = %d\n", 1692}, + {"used headers = %d\n", 1693}, + {"used space = %d bytes\n", 1694}, + {"------ Message Queues: Creators/Owners --------\n", 1695}, + {"msqid", 1696}, + {"------ Message Queues Send/Recv/Change Times --------\n", 1697}, + {"%-8s %-10s %-20s %-20s %-20s\n", 1698}, + {"send", 1699}, + {"recv", 1700}, + {"change", 1701}, + {"------ Message Queues PIDs --------\n", 1702}, + {"lspid", 1703}, + {"lrpid", 1704}, + {"------ Message Queues --------\n", 1705}, + {"%-10s %-10s %-10s %-10s %-12s %-12s\n", 1706}, + {"used-bytes", 1707}, + {"messages", 1708}, {"\ \n\ -Shared memory Segment shmid=%d\n", 1711}, - {"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\n", 1712}, - {"mode=%#o\taccess_perms=%#o\n", 1713}, - {"bytes=%d\tlpid=%d\tcpid=%d\tnattch=%ld\n", 1714}, - {"att_time=%-26.24s\n", 1715}, - {"det_time=%-26.24s\n", 1716}, - {"change_time=%-26.24s\n", 1717}, +Shared memory Segment shmid=%d\n", 1709}, + {"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\n", 1710}, + {"mode=%#o\taccess_perms=%#o\n", 1711}, + {"bytes=%d\tlpid=%d\tcpid=%d\tnattch=%ld\n", 1712}, + {"att_time=%-26.24s\n", 1713}, + {"det_time=%-26.24s\n", 1714}, + {"change_time=%-26.24s\n", 1715}, {"\ \n\ -Message Queue msqid=%d\n", 1718}, - {"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\tmode=%#o\n", 1719}, - {"cbytes=%ld\tqbytes=%ld\tqnum=%ld\tlspid=%d\tlrpid=%d\n", 1720}, - {"send_time=%-26.24s\n", 1721}, - {"rcv_time=%-26.24s\n", 1722}, +Message Queue msqid=%d\n", 1716}, + {"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\tmode=%#o\n", 1717}, + {"cbytes=%ld\tqbytes=%ld\tqnum=%ld\tlspid=%d\tlrpid=%d\n", 1718}, + {"send_time=%-26.24s\n", 1719}, + {"rcv_time=%-26.24s\n", 1720}, {"\ \n\ -Semaphore Array semid=%d\n", 1723}, - {"uid=%d\t gid=%d\t cuid=%d\t cgid=%d\n", 1724}, - {"mode=%#o, access_perms=%#o\n", 1725}, - {"nsems = %ld\n", 1726}, - {"otime = %-26.24s\n", 1727}, - {"ctime = %-26.24s\n", 1728}, - {"%-10s %-10s %-10s %-10s %-10s\n", 1729}, - {"semnum", 1730}, - {"value", 1731}, - {"ncount", 1732}, - {"zcount", 1733}, - {"pid", 1734}, - {"usage: rdev [ -rv ] [ -o OFFSET ] [ IMAGE [ VALUE [ OFFSET ] ] ]", 1735}, - {"\ - rdev /dev/fd0 (or rdev /linux, etc.) displays the current ROOT device", 1736}, - {" rdev /dev/fd0 /dev/hda2 sets ROOT to /dev/hda2", 1737}, - {" rdev -R /dev/fd0 1 set the ROOTFLAGS (readonly status)", 1738}, - {" rdev -r /dev/fd0 627 set the RAMDISK size", 1739}, - {" rdev -v /dev/fd0 1 set the bootup VIDEOMODE", 1740}, - {" rdev -o N ... use the byte offset N", 1741}, - {" rootflags ... same as rdev -R", 1742}, - {" ramsize ... same as rdev -r", 1743}, - {" vidmode ... same as rdev -v", 1744}, - {"\ -Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,...", 1745}, - {" use -R 1 to mount root readonly, -R 0 for read/write.", 1746}, - {"missing comma", 1747}, +Semaphore Array semid=%d\n", 1721}, + {"uid=%d\t gid=%d\t cuid=%d\t cgid=%d\n", 1722}, + {"mode=%#o, access_perms=%#o\n", 1723}, + {"nsems = %ld\n", 1724}, + {"otime = %-26.24s\n", 1725}, + {"ctime = %-26.24s\n", 1726}, + {"semnum", 1727}, + {"value", 1728}, + {"ncount", 1729}, + {"zcount", 1730}, + {"pid", 1731}, + {"usage: rdev [ -rv ] [ -o OFFSET ] [ IMAGE [ VALUE [ OFFSET ] ] ]", 1732}, + {"\ + rdev /dev/fd0 (or rdev /linux, etc.) displays the current ROOT device", 1733}, + {" rdev /dev/fd0 /dev/hda2 sets ROOT to /dev/hda2", 1734}, + {" rdev -R /dev/fd0 1 set the ROOTFLAGS (readonly status)", 1735}, + {" rdev -r /dev/fd0 627 set the RAMDISK size", 1736}, + {" rdev -v /dev/fd0 1 set the bootup VIDEOMODE", 1737}, + {" rdev -o N ... use the byte offset N", 1738}, + {" rootflags ... same as rdev -R", 1739}, + {" ramsize ... same as rdev -r", 1740}, + {" vidmode ... same as rdev -v", 1741}, + {"\ +Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,...", 1742}, + {" use -R 1 to mount root readonly, -R 0 for read/write.", 1743}, + {"missing comma", 1744}, {"\ %s: Usage: \"%s [options]\n\ \t -m (default = \"%s\")\n\ @@ -2273,108 +2273,128 @@ Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,...", 1 \t -a print all symbols, even if count is 0\n\ \t -r reset all the counters (root only)\n\ \t -n disable byte order auto-detection\n\ -\t -V print version and exit\n", 1748}, - {"out of memory", 1749}, - {"%s Version %s\n", 1750}, - {"Sampling_step: %i\n", 1751}, - {"%s: %s(%i): wrong map line\n", 1752}, - {"%s: can't find \"_stext\" in %s\n", 1753}, - {"%s: profile address out of range. Wrong map file?\n", 1754}, - {"total", 1755}, - {"\ -usage: renice priority [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] users ]\n", 1756}, - {"renice: %s: unknown user\n", 1757}, - {"renice: %s: bad value\n", 1758}, - {"getpriority", 1759}, - {"setpriority", 1760}, - {"%d: old priority %d, new priority %d\n", 1761}, - {"usage: %s program [arg ...]\n", 1762}, +\t -V print version and exit\n", 1745}, + {"out of memory", 1746}, + {"%s Version %s\n", 1747}, + {"Sampling_step: %i\n", 1748}, + {"%s: %s(%i): wrong map line\n", 1749}, + {"%s: can't find \"_stext\" in %s\n", 1750}, + {"%s: profile address out of range. Wrong map file?\n", 1751}, + {"total", 1752}, + {"\ +usage: renice priority [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] users ]\n", 1753}, + {"renice: %s: unknown user\n", 1754}, + {"renice: %s: bad value\n", 1755}, + {"getpriority", 1756}, + {"setpriority", 1757}, + {"%d: old priority %d, new priority %d\n", 1758}, + {"usage: %s program [arg ...]\n", 1759}, {"\ Usage: %s [ -i | -t