From: Karel Zak Date: Wed, 6 Dec 2006 23:25:54 +0000 (+0100) Subject: Imported from util-linux-2.11q tarball. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d4ad1decc539c9729b592e6050460d6487c95f4;p=util-linux Imported from util-linux-2.11q tarball. --- diff --git a/HISTORY b/HISTORY index 36fd0e38..b07312da 100644 --- a/HISTORY +++ b/HISTORY @@ -1,7 +1,33 @@ +util-linux 2.11q + +* fdisk: geometry improvement +* login: open tty fix (Denis Vlasenko) +* more: wide character patches (Mitsuru Chinen) +* mount: complain on mount-by-label when label is not unique (Matt Copping) +* partx: add GUID Partition Tables (Matt Domsch) + +util-linux 2.11p + +* Danish messages (Claus Hindsgaul) +* No French messages with permission to distribute (Michel Robitaille) +* German messages (Karl Eichwalder) +* Spanish messages (Santiago Vila Doncel) +* Swedish messages (Christian Rose) +* Turkish messages (Nilgün Belma Bugüner) +* ipcrm: make POSIX compatible (Andre Corwin Mazzone) +* ipcrm.8: idem +* kill: fixed Makefile +* login: setsid fixes(?) +* mkswap: max size of swap space is very large (Peter Chubb) +* mount: JFS support for mount-by-label (hch) +* nfsmount: check for (hch) +* readprofile: keep track of line numbers (John Levon) +* umount: fix for MNT_DETACH + util-linux 2.11o * Estonian messages (Meelis Roos) -* No new French messages yet (Michel Robitaille) +* No French messages with permission to distribute (Michel Robitaille) * Japanese messages (Daisuke Yamashita) * Spanish messages (Santiago Vila Doncel) * cal: option -s: Sunday is first day of the week @@ -10,6 +36,7 @@ util-linux 2.11o * colrm: wide character fix (Elliot Lee) * *fdisk: added Darwin types (Vincent Bourgonjen) * fstab.5: updated +* hexdump: -C option * hwclock: cmos.c: do not include on alpha * mount: improved detection of ufs (and slowdown of detection of iso9660) * mount.8: added info on * in /etc/filesystems, shortname option of vfat, @@ -27,7 +54,7 @@ util-linux 2.11o util-linux 2.11n * Danish messages (Claus Hindsgaul) -* No new French messages yet (Michel Robitaille) +* No French messages with permission to distribute (Michel Robitaille) * German messages (Karl Eichwalder) * Swedish messages (Christian Rose) * Turkish messages now in UTF-8 (Nilgün Belma Bugüner) @@ -92,7 +119,7 @@ util-linux 2.11k util-linux 2.11j -* No new French messages yet (Michel Robitaille) +* No French messages with permission to distribute (Michel Robitaille) * fdisk: fix for AIX label (Olaf Hering) * fdisk: fix for creating DOS label when BSD label is present * mount.8: added remark about blocksize to ext2 sb= mount option description. diff --git a/VERSION b/VERSION index 4ce74c6e..462c6ad9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.11o +2.11q diff --git a/configure b/configure index 4f7b5050..45d567b6 100755 --- a/configure +++ b/configure @@ -12,8 +12,9 @@ # H4. For nls.h: do we have ? # H5. For cal.c: do we have ? # H6. For mkswap.c: do we have or ? -# H7. For nfsmount.h (nfsmount_xdr.c: int32_t): do we have ? -# H8. For raw.c: do we have ? +# H7. For nfsmount.c: do we have ? +# H8. For nfsmount.h (nfsmount_xdr.c: int32_t): do we have ? +# H9. For raw.c: do we have ? # # Existence of functions: # F1. For nfsmount.c: is inet_aton() available? @@ -139,14 +140,21 @@ else if ./testincl "asm/page.h"; then fi fi # -# H7. For nfsmount.h: do we have ? +# H7. For nfsmount.c: do we have ? +# +if ./testincl "rpcsvc/nfs_prot.h"; then + echo "#define HAVE_rpcsvc_nfs_prot_h" >> defines.h +fi + +# +# H8. For nfsmount.h: do we have ? # if ./testincl "asm/types.h"; then echo "#define HAVE_asm_types_h" >> defines.h fi # -# H8. For raw.c: do we have ? +# H9. For raw.c: do we have ? # if ./testincl "linux/raw.h"; then echo "HAVE_RAW_H=yes" >> make_include diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index ea2ec20d..b02e8ff9 100644 --- a/disk-utils/mkswap.c +++ b/disk-utils/mkswap.c @@ -238,6 +238,12 @@ write_signature(char *sig) { #define V1_MAX_PAGES ((1 << 17) - 1) #elif defined(__sparc__) #define V1_MAX_PAGES (is_sparc64() ? ((3 << 29) - 1) : ((1 << 18) - 1)) +#elif defined(__ia64__) +/* + * The actual size will depend on the amount of virtual address space + * available to vmalloc the swap map. + */ +#define V1_MAX_PAGES ((1UL << 54) - 1) #else #define V1_MAX_PAGES V1_OLD_MAX_PAGES #endif @@ -373,7 +379,7 @@ check_blocks(void) { } static long -valid_offset (int fd, int offset) { +valid_offset (int fd, off_t offset) { char ch; if (lseek (fd, offset, 0) < 0) @@ -383,16 +389,15 @@ valid_offset (int fd, int offset) { return 1; } -static int +static off_t find_size (int fd) { - unsigned int high, low; + off_t high, low; low = 0; for (high = 1; high > 0 && valid_offset (fd, high); high *= 2) low = high; - while (low < high - 1) - { - const int mid = (low + high) / 2; + while (low < high - 1) { + const off_t mid = (low + high) / 2; if (valid_offset (fd, mid)) low = mid; @@ -432,9 +437,9 @@ int main(int argc, char ** argv) { struct stat statbuf; int i, sz; - int maxpages; - int goodpages; - int offset; + long maxpages; + long goodpages; + off_t offset; int force = 0; char *block_count = 0; char *pp; @@ -603,8 +608,8 @@ the -f option to force it.\n"), goodpages = PAGES - badpages - 1; if (goodpages <= 0) die(_("Unable to set up swap-space: unreadable")); - printf(_("Setting up swapspace version %d, size = %ld bytes\n"), - version, (long)(goodpages*pagesize)); + printf(_("Setting up swapspace version %d, size = %lu bytes\n"), + version, (unsigned long)goodpages * pagesize); write_signature((version == 0) ? "SWAP-SPACE" : "SWAPSPACE2"); offset = ((version == 0) ? 0 : 1024); diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 6c07186d..ce0bdaba 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -161,6 +161,8 @@ int fd, /* the disk */ partitions = 4; /* maximum partition + 1 */ uint user_cylinders, user_heads, user_sectors; +uint pt_heads, pt_sectors; +uint kern_heads, kern_sectors; uint heads, sectors, @@ -756,52 +758,84 @@ get_sectorsize(int fd) { #endif } -/* - * Ask kernel about geometry. Invent something reasonable - * in case the kernel has no opinion. - */ +static void +get_kernel_geometry(int fd) { +#ifdef HDIO_GETGEO + struct hd_geometry geometry; + + if (!ioctl(fd, HDIO_GETGEO, &geometry)) { + kern_heads = geometry.heads; + kern_sectors = geometry.sectors; + /* never use geometry.cylinders - it is truncated */ + } +#endif +} + +static void +get_partition_table_geometry(void) { + unsigned char *bufp = MBRbuffer; + struct partition *p; + int i, h, s, hh, ss; + int first = 1; + int bad = 0; + + if (!(valid_part_table_flag(bufp))) + return; + + hh = ss = 0; + for (i=0; i<4; i++) { + p = pt_offset(bufp, i); + if (p->sys_ind != 0) { + h = p->end_head + 1; + s = (p->end_sector & 077); + if (first) { + hh = h; + ss = s; + first = 0; + } else if (hh != h || ss != s) + bad = 1; + } + } + + if (!first && !bad) { + pt_heads = hh; + pt_sectors = ss; + } +} + void get_geometry(int fd, struct geom *g) { int sec_fac; long longsectors; - struct hd_geometry geometry; - int res1, res2; get_sectorsize(fd); sec_fac = sector_size / 512; guess_device_type(fd); - res1 = ioctl(fd, BLKGETSIZE, &longsectors); -#ifdef HDIO_REQ - res2 = ioctl(fd, HDIO_REQ, &geometry); -#else - res2 = ioctl(fd, HDIO_GETGEO, &geometry); -#endif - - /* never use geometry.cylinders - it is truncated */ heads = cylinders = sectors = 0; + kern_heads = kern_sectors = 0; + pt_heads = pt_sectors = 0; + + get_kernel_geometry(fd); + get_partition_table_geometry(); + + heads = user_heads ? user_heads : + pt_heads ? pt_heads : + kern_heads ? kern_heads : 255; + sectors = user_sectors ? user_sectors : + pt_sectors ? pt_sectors : + kern_sectors ? kern_sectors : 63; + + if (ioctl(fd, BLKGETSIZE, &longsectors)) + longsectors = 0; + sector_offset = 1; - if (res2 == 0) { - heads = geometry.heads; - sectors = geometry.sectors; - if (heads * sectors == 0) - res2 = -1; - else if (dos_compatible_flag) - sector_offset = sectors; - } - if (res1 == 0 && res2 == 0) { /* normal case */ - cylinders = longsectors / (heads * sectors); - cylinders /= sec_fac; /* do not round up */ - } else if (res1 == 0) { /* size but no geometry */ - heads = cylinders = 1; - sectors = longsectors / sec_fac; - } + if (dos_compatible_flag) + sector_offset = sectors; - if (!sectors) - sectors = user_sectors; - if (!heads) - heads = user_heads; + cylinders = longsectors / (heads * sectors); + cylinders /= sec_fac; if (!cylinders) cylinders = user_cylinders; @@ -838,16 +872,16 @@ get_boot(enum action what) { printf(_("You will not be able to write the partition table.\n")); } - get_geometry(fd, NULL); - - update_units(); - - if (sector_size != read(fd, MBRbuffer, sector_size)) { + if (512 != read(fd, MBRbuffer, 512)) { if (what == try_only) return 1; fatal(unable_to_read); } + get_geometry(fd, NULL); + + update_units(); + got_table: if (check_sun_label()) diff --git a/login-utils/login.c b/login-utils/login.c index 048316bc..0d2b1123 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -230,6 +230,7 @@ char *hostname; /* idem */ static char *username, *tty_name, *tty_number; static char thishost[100]; static int failures = 1; +static pid_t pid; #ifndef __linux__ struct sgttyb sgttyb; @@ -256,19 +257,27 @@ const char *months[] = { belongs). */ static void opentty(const char * tty) { - int i; - int fd = open(tty, O_RDWR | O_NONBLOCK); - int flags = fcntl(fd, F_GETFL); + int i, fd, flags; + + fd = open(tty, O_RDWR | O_NONBLOCK); + if (fd == -1) { + syslog(LOG_ERR, _("FATAL: can't reopen tty: %s"), + strerror(errno)); + sleep(1); + exit(1); + } - flags &= ~O_NONBLOCK; - fcntl(fd, F_SETFL, flags); + flags = fcntl(fd, F_GETFL); + flags &= ~O_NONBLOCK; + fcntl(fd, F_SETFL, flags); - for (i = 0 ; i < fd ; i++) - close(i); - for (i = 0 ; i < 3 ; i++) - dup2(fd, i); - if (fd >= 3) - close(fd); + for (i = 0; i < fd; i++) + close(i); + for (i = 0; i < 3; i++) + if (fd != i) + dup2(fd, i); + if (fd >= 3) + close(fd); } /* true if the filedescriptor fd is a console tty, very Linux specific */ @@ -316,7 +325,7 @@ logbtmp(const char *line, const char *username, const char *hostname) { #endif ut.ut_type = LOGIN_PROCESS; /* XXX doesn't matter */ - ut.ut_pid = getpid(); + ut.ut_pid = pid; if (hostname) { xstrncpy(ut.ut_host, hostname, sizeof(ut.ut_host)); if (hostaddress[0]) @@ -359,6 +368,8 @@ main(int argc, char **argv) int ioctlval; #endif + pid = getpid(); + signal(SIGALRM, timedout); alarm((unsigned int)timeout); signal(SIGQUIT, SIG_IGN); @@ -491,7 +502,9 @@ main(int argc, char **argv) snprintf(vcsan, sizeof(vcsan), "/dev/vcsa%s", tty_number); #endif + /* set pgid to pid */ setpgrp(); + /* this means that setsid() will fail */ { struct termios tt, ttt; @@ -509,12 +522,11 @@ main(int argc, char **argv) signal(SIGHUP, SIG_IGN); /* so vhangup() wont kill us */ vhangup(); signal(SIGHUP, SIG_DFL); - - setsid(); - - /* re-open stdin,stdout,stderr after vhangup() closed them */ - /* if it did, after 0.99.5 it doesn't! */ + + /* open stdin,stdout,stderr to the tty */ opentty(ttyn); + + /* restore tty modes */ tcsetattr(0,TCSAFLUSH,&tt); } @@ -536,7 +548,7 @@ main(int argc, char **argv) retcode = pam_start("login",username, &conv, &pamh); if(retcode != PAM_SUCCESS) { fprintf(stderr, _("login: PAM Failure, aborting: %s\n"), - pam_strerror(pamh, retcode)); + pam_strerror(pamh, retcode)); syslog(LOG_ERR, _("Couldn't initialize PAM: %s"), pam_strerror(pamh, retcode)); exit(99); @@ -629,9 +641,10 @@ main(int argc, char **argv) PAM_FAIL_CHECK; } - /* Grab the user information out of the password file for future usage - First get the username that we are actually using, though. - */ + /* + * Grab the user information out of the password file for future usage + * First get the username that we are actually using, though. + */ retcode = pam_get_item(pamh, PAM_USER, (const void **) &username); PAM_FAIL_CHECK; @@ -650,8 +663,10 @@ main(int argc, char **argv) exit(1); } - /* Create a copy of the pwd struct - otherwise it may get - * clobbered by PAM */ + /* + * Create a copy of the pwd struct - otherwise it may get + * clobbered by PAM + */ memcpy(&pwdcopy, pwd, sizeof(*pwd)); pwd = &pwdcopy; pwd->pw_name = strdup(pwd->pw_name); @@ -885,12 +900,11 @@ main(int argc, char **argv) { struct utmp ut; struct utmp *utp; - pid_t mypid = getpid(); utmpname(_PATH_UTMP); setutent(); - /* Find mypid in utmp. + /* Find pid in utmp. login sometimes overwrites the runlevel entry in /var/run/utmp, confusing sysvinit. I added a test for the entry type, and the problem was gone. (In a runlevel entry, st_pid is not really a pid but some number @@ -898,7 +912,7 @@ calculated from the previous and current runlevel). Michael Riepe */ while ((utp = getutent())) - if (utp->ut_pid == mypid + if (utp->ut_pid == pid && utp->ut_type >= INIT_PROCESS && utp->ut_type <= DEAD_PROCESS) break; @@ -936,7 +950,7 @@ Michael Riepe } #endif ut.ut_type = USER_PROCESS; - ut.ut_pid = mypid; + ut.ut_pid = pid; if (hostname) { xstrncpy(ut.ut_host, hostname, sizeof(ut.ut_host)); if (hostaddress[0]) @@ -1004,13 +1018,6 @@ Michael Riepe if (*pwd->pw_shell == '\0') pwd->pw_shell = _PATH_BSHELL; -#ifndef __linux__ - /* turn on new line discipline for the csh */ - else if (!strcmp(pwd->pw_shell, _PATH_CSHELL)) { - ioctlval = NTTYDISC; - ioctl(0, TIOCSETD, &ioctlval); - } -#endif /* preserve TERM even without -p flag */ { @@ -1113,37 +1120,50 @@ Michael Riepe * We must fork before setuid() because we need to call * pam_close_session() as root. */ - /* - * Problem: if the user's shell is a shell like ash that doesnt do - * setsid() or setpgrp(), then a ctrl-\, sending SIGQUIT to every - * process in the pgrp, will kill us. - * Solution: use TIOCNOTTY and setsid(). - */ - signal(SIGINT, SIG_IGN); - signal(SIGHUP, SIG_IGN); /* ignore signal from TIOCNOTTY below */ childPid = fork(); if (childPid < 0) { int errsv = errno; /* error in fork() */ - fprintf(stderr,_("login: failure forking: %s"), strerror(errsv)); + fprintf(stderr, _("login: failure forking: %s"), strerror(errsv)); PAM_END; exit(0); - } else if (childPid) { + } + + if (childPid) { /* parent - wait for child to finish, then cleanup session */ - ioctl(0, TIOCNOTTY, NULL); - signal(SIGHUP, SIG_DFL); + signal(SIGHUP, SIG_IGN); + signal(SIGINT, SIG_IGN); + signal(SIGQUIT, SIG_IGN); + signal(SIGTSTP, SIG_IGN); + signal(SIGTTIN, SIG_IGN); + signal(SIGTTOU, SIG_IGN); wait(NULL); PAM_END; exit(0); } + /* child */ + /* + * Problem: if the user's shell is a shell like ash that doesnt do + * setsid() or setpgrp(), then a ctrl-\, sending SIGQUIT to every + * process in the pgrp, will kill us. + */ + + /* start new session */ setsid(); - /* reopen, as we need controlling tty in the child */ + + /* make sure we have a controlling tty */ opentty(ttyn); + openlog("login", LOG_ODELAY, LOG_AUTHPRIV); /* reopen */ + + /* + * TIOCSCTTY: steal tty from other process group. + */ + if (ioctl(0, TIOCSCTTY, 1)) + syslog(LOG_ERR, _("TIOCSCTTY failed: %m")); #endif - signal(SIGHUP, SIG_DFL); signal(SIGINT, SIG_DFL); /* discard permissions last so can't get killed and drop core */ diff --git a/misc-utils/Makefile b/misc-utils/Makefile index d61add41..0f56cfea 100644 --- a/misc-utils/Makefile +++ b/misc-utils/Makefile @@ -97,7 +97,9 @@ endif install: all $(INSTALLDIR) $(BINDIR) $(USRBINDIR) +ifneq "$(BIN)" "" $(INSTALLBIN) $(BIN) $(BINDIR) +endif $(INSTALLBIN) $(USRBIN) $(USRBINDIR) $(INSTALLDIR) $(MAN1DIR) $(INSTALLMAN) $(MAN1) $(MAN1DIR) diff --git a/mount/linux_fs.h b/mount/linux_fs.h index c6ef8105..3885d724 100644 --- a/mount/linux_fs.h +++ b/mount/linux_fs.h @@ -193,7 +193,9 @@ struct vxfs_super_block { #define VXFS_SUPER_MAGIC 0xa501FCF5 struct jfs_super_block { - char s_magic[4]; + char s_magic[4]; + u_char s_dummy1[97]; + char s_fpack[11]; }; #define JFS_SUPER1_OFF 0x8000 #define JFS_MAGIC "JFS1" diff --git a/mount/mount.8 b/mount/mount.8 index 01a722b7..7f2f4d93 100644 --- a/mount/mount.8 +++ b/mount/mount.8 @@ -1375,6 +1375,7 @@ Possible values are: .TP .B old Old format of ufs, this is the default, read only. +(Don't forget to give the \-r option.) .TP .B 44bsd For filesystems created by a BSD-like system (NetBSD,FreeBSD,OpenBSD). diff --git a/mount/mount.c b/mount/mount.c index dc10e64b..125cf1ab 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -1092,11 +1092,22 @@ mount_one (const char *spec, const char *node, char *types, const char *opts, opts = xstrconcat3(opts, ",", cmdlineopts); if (!strncmp(spec, "UUID=", 5)) { - nspec = get_spec_by_uuid(spec+5); specset = 1; + nspec = get_spec_by_uuid(spec+5); } else if (!strncmp(spec, "LABEL=", 6)) { - nspec = get_spec_by_volume_label(spec+6); + const char *nspec2; specset = 2; + nspec = get_spec_by_volume_label(spec+6); + nspec2 = second_occurrence_of_vol_label(spec+6); + if (nspec2) { + if (verbose) + printf(_("mount: the label %s occurs on " + "both %s and %s\n"), + spec+6, nspec, nspec2); + die (EX_FAIL, + _("mount: %s duplicate - not mounted"), + spec, _PATH_FSTAB); + } } else nspec = 0; /* just for gcc */ @@ -1496,8 +1507,16 @@ main (int argc, char *argv[]) { if (specseen) { if (uuid) spec = get_spec_by_uuid(uuid); - else + else { + const char *spec2; spec = get_spec_by_volume_label(volumelabel); + spec2 = second_occurrence_of_vol_label(volumelabel); + if (spec2) + die (EX_FAIL, + _("mount: the label %s occurs on " + "both %s and %s - not mounted\n"), + volumelabel, spec, spec2); + } if (!spec) die (EX_USAGE, _("mount: no such partition found")); if (verbose) diff --git a/mount/mount_by_label.c b/mount/mount_by_label.c index 988974f7..ee3b1d52 100644 --- a/mount/mount_by_label.c +++ b/mount/mount_by_label.c @@ -11,6 +11,8 @@ * - Added XFS support * 2001-11-22 Kirby Bohling * - Added support of labels on LVM + * 2002-03-21 Christoph Hellwig + * - Added JFS support */ #include @@ -48,6 +50,7 @@ get_label_uuid(const char *device, char **label, char *uuid) { size_t namesize; struct ext2_super_block e2sb; struct xfs_super_block xfsb; + struct jfs_super_block jfssb; fd = open(device, O_RDONLY); if (fd < 0) @@ -71,6 +74,16 @@ get_label_uuid(const char *device, char **label, char *uuid) { memcpy(*label, xfsb.s_fname, namesize); rv = 0; } + else if (lseek(fd, JFS_SUPER1_OFF, SEEK_SET) == JFS_SUPER1_OFF + && read(fd, (char *) &jfssb, sizeof(jfssb)) == sizeof(jfssb) + && (strncmp(jfssb.s_magic, JFS_MAGIC, 4) == 0)) { + /* what to do with non-existant UUID? --hch */ + memset(uuid, 0, 16); + namesize = sizeof(jfssb.s_fpack); + if ((*label = calloc(namesize + 1, 1)) != NULL) + memcpy(*label, jfssb.s_fpack, namesize); + rv = 0; + } close(fd); return rv; @@ -83,7 +96,7 @@ uuidcache_addentry(char *device, char *label, char *uuid) { if (!uuidCache) { last = uuidCache = malloc(sizeof(*uuidCache)); } else { - for (last = uuidCache; last->next; last = last->next) ; + for (last = uuidCache; last->next; last = last->next); last->next = malloc(sizeof(*uuidCache)); last = last->next; } @@ -142,6 +155,9 @@ uuidcache_init(void) { char device[110]; int firstPass; int handleOnFirst; +#if 0 + char *iobuf = 0; +#endif if (uuidCache) return; @@ -155,6 +171,24 @@ uuidcache_init(void) { PROC_PARTITIONS); return; } +#if 0 +/* Ugly kludge - the contents of /proc/partitions change in time, + and this causes failures when the file is not read in one go. + In particular, one cannot use stdio on /proc/partitions. + Doing this ourselves is not easy either, since stat returns 0 + so the size is unknown. We might try increasing buffer sizes + until a single read gets all. For now only pick a largish buffer size. */ +/* All these troubles are mainly caused by people who patch the kernel + to keep statistics in /proc/partitions. Of course, statistics belong + in some /proc/diskstats, not in some /proc file that happened to + exist already. */ + { +#define CBBUF (16 * 1024) + iobuf = (char *) malloc(CBBUF); + if (iobuf) + setvbuf(procpt, iobuf, _IOFBF, CBBUF); + } +#endif for (firstPass = 1; firstPass >= 0; firstPass--) { fseek(procpt, 0, SEEK_SET); @@ -176,6 +210,7 @@ uuidcache_init(void) { /* skip entire disk (minor 0, 64, ... on ide; 0, 16, ... on sd) */ /* heuristic: partition name ends in a digit */ + /* devfs has .../disc and .../part1 etc. */ for(s = ptname; *s; s++); if (isdigit(s[-1])) { @@ -196,7 +231,10 @@ uuidcache_init(void) { } fclose(procpt); - +#if 0 + if (iobuf) + free(iobuf); +#endif uuidcache_init_lvm(); } @@ -273,7 +311,32 @@ get_volume_label_by_spec(const char *spec) { while(uc) { if (!strcmp(spec, uc->device)) return uc->label; - uc = uc->next; + uc = uc->next; } return NULL; } + +/* + * second_occurrence_of_vol_label() + * As labels are user defined they are not necessarily + * system-wide unique. Make sure that they are. + */ +const char * +second_occurrence_of_vol_label (const char *label) { + struct uuidCache_s *last; + int occurrences = 0; + + uuidcache_init(); + + for (last = uuidCache; last->next; last = last->next) { + if (!strcmp(last->label, label)) { + occurrences++; + if (occurrences == 2) + return last->device; + } + } + + return NULL; +} + + diff --git a/mount/mount_by_label.h b/mount/mount_by_label.h index 64bbbfa7..451d0685 100644 --- a/mount/mount_by_label.h +++ b/mount/mount_by_label.h @@ -1,3 +1,4 @@ char *get_spec_by_uuid(const char *uuid); char *get_spec_by_volume_label(const char *volumelabel); const char *get_volume_label_by_spec(const char *spec); +const char *second_occurrence_of_vol_label(const char *label); diff --git a/mount/nfsmount.c b/mount/nfsmount.c index c0e27f0d..a7f5770c 100644 --- a/mount/nfsmount.c +++ b/mount/nfsmount.c @@ -32,6 +32,8 @@ * nfsmount.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp */ +#include "../defines.h" /* for HAVE_rpcsvc_nfs_prot_h and HAVE_inet_aton */ + #include #include #include @@ -51,14 +53,18 @@ #include "sundries.h" #include "nfsmount.h" +#ifdef HAVE_rpcsvc_nfs_prot_h +#include +#else #include +#define nfsstat nfs_stat +#endif + #include "mount_constants.h" #include "nfs_mount4.h" #include "nls.h" -#include "../defines.h" /* for HAVE_inet_aton */ - #ifndef NFS_PORT #define NFS_PORT 2049 #endif @@ -802,7 +808,7 @@ int nfsmount(const char *spec, const char *node, int *flags, #endif static struct { - enum nfs_stat stat; + enum nfsstat stat; int errnum; } nfs_errtbl[] = { { NFS_OK, 0 }, diff --git a/mount/umount.c b/mount/umount.c index 4688495e..0c1306a2 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -270,12 +270,11 @@ umount_one (const char *spec, const char *node, const char *type, umnt_err = umnt_err2 = 0; if (lazy) { res = umount2 (node, MNT_DETACH); - if (res < 0) { - complain(errno, node); - return 1; - } else - return 0; + if (res < 0) + umnt_err = errno; + goto writemtab; } + if (force) { /* only supported for NFS */ res = umount2 (node, MNT_FORCE); if (res == -1) { @@ -373,6 +372,7 @@ umount_one (const char *spec, const char *node, const char *type, if (loopdev) del_loop(loopdev); + writemtab: if (!nomtab && mtab_is_writable() && (umnt_err == 0 || umnt_err == EINVAL || umnt_err == ENOENT)) { update_mtab (node, NULL); diff --git a/partx/Makefile b/partx/Makefile index 39237e01..9f9a9dbe 100644 --- a/partx/Makefile +++ b/partx/Makefile @@ -1,4 +1,5 @@ -OBJ = bsd.o dos.o partx.o solaris.o unixware.o +OBJ = bsd.o dos.o partx.o solaris.o unixware.o gpt.o crc32.o +CFLAGS += -Wall all: addpart delpart partx diff --git a/partx/crc32.c b/partx/crc32.c new file mode 100644 index 00000000..42d803d1 --- /dev/null +++ b/partx/crc32.c @@ -0,0 +1,393 @@ +/* + * crc32.c + * This code is in the public domain; copyright abandoned. + * Liability for non-performance of this code is limited to the amount + * you paid for it. Since it is distributed for free, your refund will + * be very very small. If it breaks, you get to keep both pieces. + */ + +#include "crc32.h" + +#if __GNUC__ >= 3 /* 2.x has "attribute", but only 3.0 has "pure */ +#define attribute(x) __attribute__(x) +#else +#define attribute(x) +#endif + +/* + * There are multiple 16-bit CRC polynomials in common use, but this is + * *the* standard CRC-32 polynomial, first popularized by Ethernet. + * x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0 + */ +#define CRCPOLY_LE 0xedb88320 +#define CRCPOLY_BE 0x04c11db7 + +/* How many bits at a time to use. Requires a table of 4< 8 || CRC_LE_BITS < 1 || CRC_LE_BITS & CRC_LE_BITS-1 +# error CRC_LE_BITS must be a power of 2 between 1 and 8 +#endif + +#if CRC_LE_BITS == 1 +/* + * In fact, the table-based code will work in this case, but it can be + * simplified by inlining the table in ?: form. + */ +#define crc32init_le() +#define crc32cleanup_le() +/** + * crc32_le() - Calculate bitwise little-endian Ethernet AUTODIN II CRC32 + * @crc - seed value for computation. ~0 for Ethernet, sometimes 0 for + * other uses, or the previous crc32 value if computing incrementally. + * @p - pointer to buffer over which CRC is run + * @len - length of buffer @p + * + */ +uint32_t attribute((pure)) crc32_le(uint32_t crc, unsigned char const *p, size_t len) +{ + int i; + while (len--) { + crc ^= *p++; + for (i = 0; i < 8; i++) + crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0); + } + return crc; +} +#else /* Table-based approach */ + +static uint32_t *crc32table_le; +/** + * crc32init_le() - allocate and initialize LE table data + * + * crc is the crc of the byte i; other entries are filled in based on the + * fact that crctable[i^j] = crctable[i] ^ crctable[j]. + * + */ +static int +crc32init_le(void) +{ + unsigned i, j; + uint32_t crc = 1; + + crc32table_le = + malloc((1 << CRC_LE_BITS) * sizeof(uint32_t)); + if (!crc32table_le) + return 1; + crc32table_le[0] = 0; + + for (i = 1 << (CRC_LE_BITS - 1); i; i >>= 1) { + crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0); + for (j = 0; j < 1 << CRC_LE_BITS; j += 2 * i) + crc32table_le[i + j] = crc ^ crc32table_le[j]; + } + return 0; +} + +/** + * crc32cleanup_le(): free LE table data + */ +static void +crc32cleanup_le(void) +{ + if (crc32table_le) free(crc32table_le); + crc32table_le = NULL; +} + +/** + * crc32_le() - Calculate bitwise little-endian Ethernet AUTODIN II CRC32 + * @crc - seed value for computation. ~0 for Ethernet, sometimes 0 for + * other uses, or the previous crc32 value if computing incrementally. + * @p - pointer to buffer over which CRC is run + * @len - length of buffer @p + * + */ +uint32_t attribute((pure)) crc32_le(uint32_t crc, unsigned char const *p, size_t len) +{ + while (len--) { +# if CRC_LE_BITS == 8 + crc = (crc >> 8) ^ crc32table_le[(crc ^ *p++) & 255]; +# elif CRC_LE_BITS == 4 + crc ^= *p++; + crc = (crc >> 4) ^ crc32table_le[crc & 15]; + crc = (crc >> 4) ^ crc32table_le[crc & 15]; +# elif CRC_LE_BITS == 2 + crc ^= *p++; + crc = (crc >> 2) ^ crc32table_le[crc & 3]; + crc = (crc >> 2) ^ crc32table_le[crc & 3]; + crc = (crc >> 2) ^ crc32table_le[crc & 3]; + crc = (crc >> 2) ^ crc32table_le[crc & 3]; +# endif + } + return crc; +} +#endif + +/* + * Big-endian CRC computation. Used with serial bit streams sent + * msbit-first. Be sure to use cpu_to_be32() to append the computed CRC. + */ +#if CRC_BE_BITS > 8 || CRC_BE_BITS < 1 || CRC_BE_BITS & CRC_BE_BITS-1 +# error CRC_BE_BITS must be a power of 2 between 1 and 8 +#endif + +#if CRC_BE_BITS == 1 +/* + * In fact, the table-based code will work in this case, but it can be + * simplified by inlining the table in ?: form. + */ +#define crc32init_be() +#define crc32cleanup_be() + +/** + * crc32_be() - Calculate bitwise big-endian Ethernet AUTODIN II CRC32 + * @crc - seed value for computation. ~0 for Ethernet, sometimes 0 for + * other uses, or the previous crc32 value if computing incrementally. + * @p - pointer to buffer over which CRC is run + * @len - length of buffer @p + * + */ +uint32_t attribute((pure)) crc32_be(uint32_t crc, unsigned char const *p, size_t len) +{ + int i; + while (len--) { + crc ^= *p++ << 24; + for (i = 0; i < 8; i++) + crc = + (crc << 1) ^ ((crc & 0x80000000) ? CRCPOLY_BE : + 0); + } + return crc; +} + +#else /* Table-based approach */ +static uint32_t *crc32table_be; + +/** + * crc32init_be() - allocate and initialize BE table data + */ +static int +crc32init_be(void) +{ + unsigned i, j; + uint32_t crc = 0x80000000; + + crc32table_be = + malloc((1 << CRC_BE_BITS) * sizeof(uint32_t)); + if (!crc32table_be) + return 1; + crc32table_be[0] = 0; + + for (i = 1; i < 1 << CRC_BE_BITS; i <<= 1) { + crc = (crc << 1) ^ ((crc & 0x80000000) ? CRCPOLY_BE : 0); + for (j = 0; j < i; j++) + crc32table_be[i + j] = crc ^ crc32table_be[j]; + } + return 0; +} + +/** + * crc32cleanup_be(): free BE table data + */ +static void +crc32cleanup_be(void) +{ + if (crc32table_be) free(crc32table_be); + crc32table_be = NULL; +} + + +/** + * crc32_be() - Calculate bitwise big-endian Ethernet AUTODIN II CRC32 + * @crc - seed value for computation. ~0 for Ethernet, sometimes 0 for + * other uses, or the previous crc32 value if computing incrementally. + * @p - pointer to buffer over which CRC is run + * @len - length of buffer @p + * + */ +uint32_t attribute((pure)) crc32_be(uint32_t crc, unsigned char const *p, size_t len) +{ + while (len--) { +# if CRC_BE_BITS == 8 + crc = (crc << 8) ^ crc32table_be[(crc >> 24) ^ *p++]; +# elif CRC_BE_BITS == 4 + crc ^= *p++ << 24; + crc = (crc << 4) ^ crc32table_be[crc >> 28]; + crc = (crc << 4) ^ crc32table_be[crc >> 28]; +# elif CRC_BE_BITS == 2 + crc ^= *p++ << 24; + crc = (crc << 2) ^ crc32table_be[crc >> 30]; + crc = (crc << 2) ^ crc32table_be[crc >> 30]; + crc = (crc << 2) ^ crc32table_be[crc >> 30]; + crc = (crc << 2) ^ crc32table_be[crc >> 30]; +# endif + } + return crc; +} +#endif + +/* + * A brief CRC tutorial. + * + * A CRC is a long-division remainder. You add the CRC to the message, + * and the whole thing (message+CRC) is a multiple of the given + * CRC polynomial. To check the CRC, you can either check that the + * CRC matches the recomputed value, *or* you can check that the + * remainder computed on the message+CRC is 0. This latter approach + * is used by a lot of hardware implementations, and is why so many + * protocols put the end-of-frame flag after the CRC. + * + * It's actually the same long division you learned in school, except that + * - We're working in binary, so the digits are only 0 and 1, and + * - When dividing polynomials, there are no carries. Rather than add and + * subtract, we just xor. Thus, we tend to get a bit sloppy about + * the difference between adding and subtracting. + * + * A 32-bit CRC polynomial is actually 33 bits long. But since it's + * 33 bits long, bit 32 is always going to be set, so usually the CRC + * is written in hex with the most significant bit omitted. (If you're + * familiar with the IEEE 754 floating-point format, it's the same idea.) + * + * Note that a CRC is computed over a string of *bits*, so you have + * to decide on the endianness of the bits within each byte. To get + * the best error-detecting properties, this should correspond to the + * order they're actually sent. For example, standard RS-232 serial is + * little-endian; the most significant bit (sometimes used for parity) + * is sent last. And when appending a CRC word to a message, you should + * do it in the right order, matching the endianness. + * + * Just like with ordinary division, the remainder is always smaller than + * the divisor (the CRC polynomial) you're dividing by. Each step of the + * division, you take one more digit (bit) of the dividend and append it + * to the current remainder. Then you figure out the appropriate multiple + * of the divisor to subtract to being the remainder back into range. + * In binary, it's easy - it has to be either 0 or 1, and to make the + * XOR cancel, it's just a copy of bit 32 of the remainder. + * + * When computing a CRC, we don't care about the quotient, so we can + * throw the quotient bit away, but subtract the appropriate multiple of + * the polynomial from the remainder and we're back to where we started, + * ready to process the next bit. + * + * A big-endian CRC written this way would be coded like: + * for (i = 0; i < input_bits; i++) { + * multiple = remainder & 0x80000000 ? CRCPOLY : 0; + * remainder = (remainder << 1 | next_input_bit()) ^ multiple; + * } + * Notice how, to get at bit 32 of the shifted remainder, we look + * at bit 31 of the remainder *before* shifting it. + * + * But also notice how the next_input_bit() bits we're shifting into + * the remainder don't actually affect any decision-making until + * 32 bits later. Thus, the first 32 cycles of this are pretty boring. + * Also, to add the CRC to a message, we need a 32-bit-long hole for it at + * the end, so we have to add 32 extra cycles shifting in zeros at the + * end of every message, + * + * So the standard trick is to rearrage merging in the next_input_bit() + * until the moment it's needed. Then the first 32 cycles can be precomputed, + * and merging in the final 32 zero bits to make room for the CRC can be + * skipped entirely. + * This changes the code to: + * for (i = 0; i < input_bits; i++) { + * remainder ^= next_input_bit() << 31; + * multiple = (remainder & 0x80000000) ? CRCPOLY : 0; + * remainder = (remainder << 1) ^ multiple; + * } + * With this optimization, the little-endian code is simpler: + * for (i = 0; i < input_bits; i++) { + * remainder ^= next_input_bit(); + * multiple = (remainder & 1) ? CRCPOLY : 0; + * remainder = (remainder >> 1) ^ multiple; + * } + * + * Note that the other details of endianness have been hidden in CRCPOLY + * (which must be bit-reversed) and next_input_bit(). + * + * However, as long as next_input_bit is returning the bits in a sensible + * order, we can actually do the merging 8 or more bits at a time rather + * than one bit at a time: + * for (i = 0; i < input_bytes; i++) { + * remainder ^= next_input_byte() << 24; + * for (j = 0; j < 8; j++) { + * multiple = (remainder & 0x80000000) ? CRCPOLY : 0; + * remainder = (remainder << 1) ^ multiple; + * } + * } + * Or in little-endian: + * for (i = 0; i < input_bytes; i++) { + * remainder ^= next_input_byte(); + * for (j = 0; j < 8; j++) { + * multiple = (remainder & 1) ? CRCPOLY : 0; + * remainder = (remainder << 1) ^ multiple; + * } + * } + * If the input is a multiple of 32 bits, you can even XOR in a 32-bit + * word at a time and increase the inner loop count to 32. + * + * You can also mix and match the two loop styles, for example doing the + * bulk of a message byte-at-a-time and adding bit-at-a-time processing + * for any fractional bytes at the end. + * + * The only remaining optimization is to the byte-at-a-time table method. + * Here, rather than just shifting one bit of the remainder to decide + * in the correct multiple to subtract, we can shift a byte at a time. + * This produces a 40-bit (rather than a 33-bit) intermediate remainder, + * but again the multiple of the polynomial to subtract depends only on + * the high bits, the high 8 bits in this case. + * + * The multile we need in that case is the low 32 bits of a 40-bit + * value whose high 8 bits are given, and which is a multiple of the + * generator polynomial. This is simply the CRC-32 of the given + * one-byte message. + * + * Two more details: normally, appending zero bits to a message which + * is already a multiple of a polynomial produces a larger multiple of that + * polynomial. To enable a CRC to detect this condition, it's common to + * invert the CRC before appending it. This makes the remainder of the + * message+crc come out not as zero, but some fixed non-zero value. + * + * The same problem applies to zero bits prepended to the message, and + * a similar solution is used. Instead of starting with a remainder of + * 0, an initial remainder of all ones is used. As long as you start + * the same way on decoding, it doesn't make a difference. + */ + + +/** + * init_crc32(): generates CRC32 tables + * + * On successful initialization, use count is increased. + * This guarantees that the library functions will stay resident + * in memory, and prevents someone from 'rmmod crc32' while + * a driver that needs it is still loaded. + * This also greatly simplifies drivers, as there's no need + * to call an initialization/cleanup function from each driver. + * Since crc32.o is a library module, there's no requirement + * that the user can unload it. + */ +int +init_crc32(void) +{ + int rc1, rc2, rc; + rc1 = crc32init_le(); + rc2 = crc32init_be(); + rc = rc1 || rc2; + return rc; +} + +/** + * cleanup_crc32(): frees crc32 data when no longer needed + */ +void +cleanup_crc32(void) +{ + crc32cleanup_le(); + crc32cleanup_be(); +} diff --git a/partx/crc32.h b/partx/crc32.h new file mode 100644 index 00000000..a4505b84 --- /dev/null +++ b/partx/crc32.h @@ -0,0 +1,19 @@ +/* + * crc32.h + */ +#ifndef _CRC32_H +#define _CRC32_H + +#include +#include + +extern int init_crc32(void); +extern void cleanup_crc32(void); +extern uint32_t crc32_le(uint32_t crc, unsigned char const *p, size_t len); +extern uint32_t crc32_be(uint32_t crc, unsigned char const *p, size_t len); + +#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)data, length) +#define ether_crc_le(length, data) crc32_le(~0, data, length) +#define ether_crc(length, data) crc32_be(~0, data, length) + +#endif /* _CRC32_H */ diff --git a/partx/dos.c b/partx/dos.c index b32801e0..7b61d0b0 100644 --- a/partx/dos.c +++ b/partx/dos.c @@ -1,14 +1,6 @@ #include #include "partx.h" - -struct partition { - unsigned char boot_ind; /* 0x80 - active */ - unsigned char bh, bs, bc; - unsigned char sys_type; - unsigned char eh, es, ec; - unsigned int start_sect; - unsigned int nr_sects; -}; +#include "dos.h" static int is_extended(int type) { @@ -17,9 +9,10 @@ is_extended(int type) { static int read_extended_partition(int fd, struct partition *ep, - struct slice *sp, int ns) { + struct slice *sp, int ns) +{ struct partition *p; - unsigned long start, here, next; + unsigned long start, here; unsigned char *bp; int loopct = 0; int moretodo = 1; @@ -68,6 +61,11 @@ read_extended_partition(int fd, struct partition *ep, return n; } +static int +is_gpt(int type) { + return (type == 0xEE); +} + int read_dos_pt(int fd, struct slice all, struct slice *sp, int ns) { struct partition *p; @@ -82,6 +80,13 @@ read_dos_pt(int fd, struct slice all, struct slice *sp, int ns) { if (bp[510] != 0x55 || bp[511] != 0xaa) return -1; + p = (struct partition *) (bp + 0x1be); + for (i=0; i<4; i++) { + if (is_gpt(p->sys_type)) { + return 0; + } + p++; + } p = (struct partition *) (bp + 0x1be); for (i=0; i<4; i++) { /* always add, even if zero length */ diff --git a/partx/dos.h b/partx/dos.h new file mode 100644 index 00000000..429f3d39 --- /dev/null +++ b/partx/dos.h @@ -0,0 +1,13 @@ +#ifndef DOS_H_INCLUDED +#define DOS_H_INCLUDED + +struct partition { + unsigned char boot_ind; /* 0x80 - active */ + unsigned char bh, bs, bc; + unsigned char sys_type; + unsigned char eh, es, ec; + unsigned int start_sect; + unsigned int nr_sects; +}; + +#endif /* DOS_H_INCLUDED */ diff --git a/partx/efi.h b/partx/efi.h new file mode 100644 index 00000000..fcf27409 --- /dev/null +++ b/partx/efi.h @@ -0,0 +1,57 @@ +/* + efi.[ch] - Manipulates EFI variables as exported in /proc/efi/vars + + Copyright (C) 2001 Dell Computer 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 + */ + +#ifndef EFI_H +#define EFI_H + +/* + * Extensible Firmware Interface + * Based on 'Extensible Firmware Interface Specification' + * version 1.02, 12 December, 2000 + */ +#include + +typedef struct { + uint8_t b[16]; +} efi_guid_t; + +#define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \ +((efi_guid_t) \ +{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \ + (b) & 0xff, ((b) >> 8) & 0xff, \ + (c) & 0xff, ((c) >> 8) & 0xff, \ + (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}) + + +/****************************************************** + * GUIDs + ******************************************************/ +#define NULL_GUID \ +EFI_GUID( 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) + +static inline int +efi_guidcmp(efi_guid_t left, efi_guid_t right) +{ + return memcmp(&left, &right, sizeof (efi_guid_t)); +} + +typedef uint16_t efi_char16_t; /* UNICODE character */ + +#endif /* EFI_H */ diff --git a/partx/gpt.c b/partx/gpt.c new file mode 100644 index 00000000..bf90fdeb --- /dev/null +++ b/partx/gpt.c @@ -0,0 +1,630 @@ +/* + gpt.[ch] + + Copyright (C) 2000-2001 Dell Computer Corporation + + EFI GUID Partition Table handling + Per Intel EFI Specification v1.02 + http://developer.intel.com/technology/efi/efi.htm + + 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 +*/ + +#define _FILE_OFFSET_BITS 64 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "crc32.h" +#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 BLKSSZGET _IO(0x12,104) /* get block device sector size */ +#define BLKGETSIZE64 _IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */ + +struct blkdev_ioctl_param { + unsigned int block; + size_t content_length; + char * block_contents; +}; + +/** + * efi_crc32() - EFI version of crc32 function + * @buf: buffer to calculate crc32 of + * @len - length of buf + * + * Description: Returns EFI-style CRC32 value for @buf + * + * This function uses the little endian Ethernet polynomial + * but seeds the function with ~0, and xor's with ~0 at the end. + * Note, the EFI Specification, v1.02, has a reference to + * Dr. Dobbs Journal, May 1994 (actually it's in May 1992). + */ +static inline uint32_t +efi_crc32(const void *buf, unsigned long len) +{ + return (crc32(~0L, buf, len) ^ ~0L); +} + +/** + * is_pmbr_valid(): test Protective MBR for validity + * @mbr: pointer to a legacy mbr structure + * + * Description: Returns 1 if PMBR is valid, 0 otherwise. + * Validity depends on two things: + * 1) MSDOS signature is in the last two bytes of the MBR + * 2) One partition of type 0xEE is found + */ +static int +is_pmbr_valid(legacy_mbr *mbr) +{ + int i, found = 0, signature = 0; + if (!mbr) + return 0; + signature = (__le16_to_cpu(mbr->signature) == MSDOS_MBR_SIGNATURE); + for (i = 0; signature && i < 4; i++) { + if (mbr->partition[i].sys_type == + EFI_PMBR_OSTYPE_EFI_GPT) { + found = 1; + break; + } + } + return (signature && found); +} + + +/************************************************************ + * get_sector_size + * Requires: + * - filedes is an open file descriptor, suitable for reading + * Modifies: nothing + * Returns: + * sector size, or 512. + ************************************************************/ +static int +get_sector_size(int filedes) +{ + int rc, sector_size = 512; + + rc = ioctl(filedes, BLKSSZGET, §or_size); + if (rc) + sector_size = 512; + return sector_size; +} + +/************************************************************ + * _get_num_sectors + * Requires: + * - filedes is an open file descriptor, suitable for reading + * Modifies: nothing + * Returns: + * Last LBA value on success + * 0 on error + * + * Try getting BLKGETSIZE64 and BLKSSZGET first, + * then BLKGETSIZE if necessary. + * Kernels 2.4.15-2.4.18 and 2.5.0-2.5.3 have a broken BLKGETSIZE64 + * which returns the number of 512-byte sectors, not the size of + * the disk in bytes. Fixed in kernels 2.4.18-pre8 and 2.5.4-pre3. + ************************************************************/ +static uint64_t +_get_num_sectors(int filedes) +{ + unsigned long sectors=0; + int rc; +#if 0 + uint64_t bytes=0; + + rc = ioctl(filedes, BLKGETSIZE64, &bytes); + if (!rc) + return bytes / get_sector_size(filedes); +#endif + rc = ioctl(filedes, BLKGETSIZE, §ors); + if (rc) + return 0; + + return sectors; +} + +/************************************************************ + * last_lba(): return number of last logical block of device + * + * @fd + * + * Description: returns Last LBA value on success, 0 on error. + * Notes: The value st_blocks gives the size of the file + * in 512-byte blocks, which is OK if + * EFI_BLOCK_SIZE_SHIFT == 9. + ************************************************************/ + +static uint64_t +last_lba(int filedes) +{ + int rc; + uint64_t sectors = 0; + struct stat s; + memset(&s, 0, sizeof (s)); + rc = fstat(filedes, &s); + if (rc == -1) { + fprintf(stderr, "last_lba() could not stat: %s\n", + strerror(errno)); + return 0; + } + + if (S_ISBLK(s.st_mode)) { + sectors = _get_num_sectors(filedes); + } else { + fprintf(stderr, + "last_lba(): I don't know how to handle files with mode %x\n", + s.st_mode); + sectors = 1; + } + + return sectors - 1; +} + + +static ssize_t +read_lastoddsector(int fd, uint64_t lba, void *buffer, size_t count) +{ + int rc; + struct blkdev_ioctl_param ioctl_param; + + if (!buffer) return 0; + + ioctl_param.block = 0; /* read the last sector */ + ioctl_param.content_length = count; + ioctl_param.block_contents = buffer; + + rc = ioctl(fd, BLKGETLASTSECT, &ioctl_param); + if (rc == -1) perror("read failed"); + + return !rc; +} + +static ssize_t +read_lba(int fd, uint64_t lba, void *buffer, size_t bytes) +{ + int sector_size = get_sector_size(fd); + off_t offset = lba * sector_size; + ssize_t bytesread; + + lseek(fd, offset, SEEK_SET); + bytesread = read(fd, buffer, bytes); + + /* Kludge. This is necessary to read/write the last + block of an odd-sized disk, until Linux 2.5.x kernel fixes. + This is only used by gpt.c, and only to read + one sector, so we don't have to be fancy. + */ + if (!bytesread && !(last_lba(fd) & 1) && lba == last_lba(fd)) { + bytesread = read_lastoddsector(fd, lba, buffer, bytes); + } + return bytesread; +} + +/** + * alloc_read_gpt_entries(): reads partition entries from disk + * @fd is an open file descriptor to the whole disk + * @gpt is a buffer into which the GPT will be put + * Description: Returns ptes on success, NULL on error. + * Allocates space for PTEs based on information found in @gpt. + * Notes: remember to free pte when you're done! + */ +static gpt_entry * +alloc_read_gpt_entries(int fd, gpt_header * gpt) +{ + gpt_entry *pte; + size_t count = __le32_to_cpu(gpt->num_partition_entries) * + __le32_to_cpu(gpt->sizeof_partition_entry); + + if (!count) return NULL; + + pte = (gpt_entry *)malloc(count); + if (!pte) + return NULL; + memset(pte, 0, count); + + if (!read_lba(fd, __le64_to_cpu(gpt->partition_entry_lba), pte, + count)) { + free(pte); + return NULL; + } + return pte; +} + +/** + * alloc_read_gpt_header(): Allocates GPT header, reads into it from disk + * @fd is an open file descriptor to the whole disk + * @lba is the Logical Block Address of the partition table + * + * Description: returns GPT header on success, NULL on error. Allocates + * and fills a GPT header starting at @ from @bdev. + * Note: remember to free gpt when finished with it. + */ +static gpt_header * +alloc_read_gpt_header(int fd, uint64_t lba) +{ + gpt_header *gpt; + gpt = (gpt_header *) + malloc(sizeof (gpt_header)); + if (!gpt) + return NULL; + memset(gpt, 0, sizeof (*gpt)); + if (!read_lba(fd, lba, gpt, sizeof (gpt_header))) { + free(gpt); + return NULL; + } + + return gpt; +} + +/** + * is_gpt_valid() - tests one GPT header and PTEs for validity + * @fd is an open file descriptor to the whole disk + * @lba is the logical block address of the GPT header to test + * @gpt is a GPT header ptr, filled on return. + * @ptes is a PTEs ptr, filled on return. + * + * Description: returns 1 if valid, 0 on error. + * If valid, returns pointers to newly allocated GPT header and PTEs. + */ +static int +is_gpt_valid(int fd, uint64_t lba, + gpt_header ** gpt, gpt_entry ** ptes) +{ + int rc = 0; /* default to not valid */ + uint32_t crc, origcrc; + + if (!gpt || !ptes) + return 0; + if (!(*gpt = alloc_read_gpt_header(fd, lba))) + return 0; + + /* Check the GUID Partition Table signature */ + if (__le64_to_cpu((*gpt)->signature) != GPT_HEADER_SIGNATURE) { + /* + printf("GUID Partition Table Header signature is wrong: %" PRIx64" != %" PRIx64 "\n", + __le64_to_cpu((*gpt)->signature), GUID_PT_HEADER_SIGNATURE); + */ + free(*gpt); + *gpt = NULL; + return rc; + } + + /* Check the GUID Partition Table Header CRC */ + origcrc = __le32_to_cpu((*gpt)->header_crc32); + (*gpt)->header_crc32 = 0; + crc = efi_crc32(*gpt, __le32_to_cpu((*gpt)->header_size)); + if (crc != origcrc) { + // printf( "GPTH CRC check failed, %x != %x.\n", origcrc, crc); + (*gpt)->header_crc32 = __cpu_to_le32(origcrc); + free(*gpt); + *gpt = NULL; + return 0; + } + (*gpt)->header_crc32 = __cpu_to_le32(origcrc); + + /* Check that the my_lba entry points to the LBA + * that contains the GPT we read */ + if (__le64_to_cpu((*gpt)->my_lba) != lba) { + // printf( "my_lba % PRIx64 "x != lba %"PRIx64 "x.\n", __le64_to_cpu((*gpt)->my_lba), lba); + free(*gpt); + *gpt = NULL; + return 0; + } + + if (!(*ptes = alloc_read_gpt_entries(fd, *gpt))) { + free(*gpt); + *gpt = NULL; + return 0; + } + + /* Check the GUID Partition Entry Array CRC */ + crc = efi_crc32(*ptes, + __le32_to_cpu((*gpt)->num_partition_entries) * + __le32_to_cpu((*gpt)->sizeof_partition_entry)); + if (crc != __le32_to_cpu((*gpt)->partition_entry_array_crc32)) { + // printf("GUID Partitition Entry Array CRC check failed.\n"); + free(*gpt); + *gpt = NULL; + free(*ptes); + *ptes = NULL; + return 0; + } + + /* We're done, all's well */ + return 1; +} +/** + * compare_gpts() - Search disk for valid GPT headers and PTEs + * @pgpt is the primary GPT header + * @agpt is the alternate GPT header + * @lastlba is the last LBA number + * Description: Returns nothing. Sanity checks pgpt and agpt fields + * and prints warnings on discrepancies. + * + */ +static void +compare_gpts(gpt_header *pgpt, gpt_header *agpt, uint64_t lastlba) +{ + int error_found = 0; + if (!pgpt || !agpt) + return; + if (__le64_to_cpu(pgpt->my_lba) != __le64_to_cpu(agpt->alternate_lba)) { + fprintf(stderr, + "GPT:Primary header LBA != Alt. header alternate_lba\n"); + fprintf(stderr, "GPT:%" PRIx64 "x != %" PRIx64 "x\n", + __le64_to_cpu(pgpt->my_lba), + __le64_to_cpu(agpt->alternate_lba)); + error_found++; + } + if (__le64_to_cpu(pgpt->alternate_lba) != __le64_to_cpu(agpt->my_lba)) { + fprintf(stderr, + "GPT:Primary header alternate_lba != Alt. header my_lba\n"); + fprintf(stderr, "GPT:%" PRIx64 " != %" PRIx64 "\n", + __le64_to_cpu(pgpt->alternate_lba), + __le64_to_cpu(agpt->my_lba)); + error_found++; + } + if (__le64_to_cpu(pgpt->first_usable_lba) != + __le64_to_cpu(agpt->first_usable_lba)) { + fprintf(stderr, "GPT:first_usable_lbas don't match.\n"); + fprintf(stderr, "GPT:%" PRIx64 " != %" PRIx64 "\n", + __le64_to_cpu(pgpt->first_usable_lba), + __le64_to_cpu(agpt->first_usable_lba)); + error_found++; + } + if (__le64_to_cpu(pgpt->last_usable_lba) != + __le64_to_cpu(agpt->last_usable_lba)) { + fprintf(stderr, "GPT:last_usable_lbas don't match.\n"); + fprintf(stderr, "GPT:%" PRIx64 " != %" PRIx64 "\n", + __le64_to_cpu(pgpt->last_usable_lba), + __le64_to_cpu(agpt->last_usable_lba)); + error_found++; + } + if (efi_guidcmp(pgpt->disk_guid, agpt->disk_guid)) { + fprintf(stderr, "GPT:disk_guids don't match.\n"); + error_found++; + } + if (__le32_to_cpu(pgpt->num_partition_entries) != + __le32_to_cpu(agpt->num_partition_entries)) { + fprintf(stderr, "GPT:num_partition_entries don't match: " + "0x%x != 0x%x\n", + __le32_to_cpu(pgpt->num_partition_entries), + __le32_to_cpu(agpt->num_partition_entries)); + error_found++; + } + if (__le32_to_cpu(pgpt->sizeof_partition_entry) != + __le32_to_cpu(agpt->sizeof_partition_entry)) { + fprintf(stderr, + "GPT:sizeof_partition_entry values don't match: " + "0x%x != 0x%x\n", + __le32_to_cpu(pgpt->sizeof_partition_entry), + __le32_to_cpu(agpt->sizeof_partition_entry)); + error_found++; + } + if (__le32_to_cpu(pgpt->partition_entry_array_crc32) != + __le32_to_cpu(agpt->partition_entry_array_crc32)) { + fprintf(stderr, + "GPT:partition_entry_array_crc32 values don't match: " + "0x%x != 0x%x\n", + __le32_to_cpu(pgpt->partition_entry_array_crc32), + __le32_to_cpu(agpt->partition_entry_array_crc32)); + error_found++; + } + if (__le64_to_cpu(pgpt->alternate_lba) != lastlba) { + fprintf(stderr, + "GPT:Primary header thinks Alt. header is not at the end of the disk.\n"); + fprintf(stderr, "GPT:%" PRIx64 " != %" PRIx64 "\n", + __le64_to_cpu(pgpt->alternate_lba), lastlba); + error_found++; + } + + if (__le64_to_cpu(agpt->my_lba) != lastlba) { + fprintf(stderr, + "GPT:Alternate GPT header not at the end of the disk.\n"); + fprintf(stderr, "GPT:%" PRIx64 " != %" PRIx64 "\n", + __le64_to_cpu(agpt->my_lba), lastlba); + error_found++; + } + + if (error_found) + fprintf(stderr, + "GPT: Use GNU Parted to correct GPT errors.\n"); + return; +} + +/** + * find_valid_gpt() - Search disk for valid GPT headers and PTEs + * @fd is an open file descriptor to the whole disk + * @gpt is a GPT header ptr, filled on return. + * @ptes is a PTEs ptr, filled on return. + * Description: Returns 1 if valid, 0 on error. + * If valid, returns pointers to newly allocated GPT header and PTEs. + * Validity depends on finding either the Primary GPT header and PTEs valid, + * or the Alternate GPT header and PTEs valid, and the PMBR valid. + */ +static int +find_valid_gpt(int fd, gpt_header ** gpt, gpt_entry ** ptes) +{ + extern int force_gpt; + int good_pgpt = 0, good_agpt = 0, good_pmbr = 0; + gpt_header *pgpt = NULL, *agpt = NULL; + gpt_entry *pptes = NULL, *aptes = NULL; + legacy_mbr *legacymbr = NULL; + uint64_t lastlba; + if (!gpt || !ptes) + return 0; + + lastlba = last_lba(fd); + good_pgpt = is_gpt_valid(fd, GPT_PRIMARY_PARTITION_TABLE_LBA, + &pgpt, &pptes); + if (good_pgpt) { + good_agpt = is_gpt_valid(fd, + __le64_to_cpu(pgpt->alternate_lba), + &agpt, &aptes); + if (!good_agpt) { + good_agpt = is_gpt_valid(fd, lastlba, + &agpt, &aptes); + } + } + else { + good_agpt = is_gpt_valid(fd, lastlba, + &agpt, &aptes); + } + + /* The obviously unsuccessful case */ + if (!good_pgpt && !good_agpt) { + goto fail; + } + + /* This will be added to the EFI Spec. per Intel after v1.02. */ + legacymbr = malloc(sizeof (*legacymbr)); + if (legacymbr) { + memset(legacymbr, 0, sizeof (*legacymbr)); + read_lba(fd, 0, (uint8_t *) legacymbr, + sizeof (*legacymbr)); + good_pmbr = is_pmbr_valid(legacymbr); + free(legacymbr); + legacymbr=NULL; + } + + /* Failure due to bad PMBR */ + if ((good_pgpt || good_agpt) && !good_pmbr && !force_gpt) { + fprintf(stderr, + " Warning: Disk has a valid GPT signature " + "but invalid PMBR.\n" + " Assuming this disk is *not* a GPT disk anymore.\n" + " Use gpt kernel option to override. " + "Use GNU Parted to correct disk.\n"); + goto fail; + } + + /* Would fail due to bad PMBR, but force GPT anyhow */ + if ((good_pgpt || good_agpt) && !good_pmbr && force_gpt) { + fprintf(stderr, + " Warning: Disk has a valid GPT signature but " + "invalid PMBR.\n" + " Use GNU Parted to correct disk.\n" + " gpt option taken, disk treated as GPT.\n"); + } + + compare_gpts(pgpt, agpt, lastlba); + + /* The good cases */ + if (good_pgpt && (good_pmbr || force_gpt)) { + *gpt = pgpt; + *ptes = pptes; + if (agpt) { free(agpt); agpt = NULL; } + if (aptes) { free(aptes); aptes = NULL; } + if (!good_agpt) { + fprintf(stderr, + "Alternate GPT is invalid, " + "using primary GPT.\n"); + } + return 1; + } + else if (good_agpt && (good_pmbr || force_gpt)) { + *gpt = agpt; + *ptes = aptes; + if (pgpt) { free(pgpt); pgpt = NULL; } + if (pptes) { free(pptes); pptes = NULL; } + fprintf(stderr, + "Primary GPT is invalid, using alternate GPT.\n"); + return 1; + } + + fail: + if (pgpt) { free(pgpt); pgpt=NULL; } + if (agpt) { free(agpt); agpt=NULL; } + if (pptes) { free(pptes); pptes=NULL; } + if (aptes) { free(aptes); aptes=NULL; } + *gpt = NULL; + *ptes = NULL; + return 0; +} + +/** + * read_gpt_pt() + * @fd + * @all - slice with start/size of whole disk + * + * 0 if this isn't our partition table + * number of partitions if successful + * + */ +int +read_gpt_pt (int fd, struct slice all, struct slice *sp, int ns) +{ + gpt_header *gpt = NULL; + gpt_entry *ptes = NULL; + uint32_t i; + int n = 0; + int last_used_index=-1; + + if (!find_valid_gpt (fd, &gpt, &ptes) || !gpt || !ptes) { + if (gpt) + free (gpt); + if (ptes) + free (ptes); + return 0; + } + + for (i = 0; i < __le32_to_cpu(gpt->num_partition_entries) && i < ns; i++) { + if (!efi_guidcmp (NULL_GUID, ptes[i].partition_type_guid)) { + sp[n].start = 0; + sp[n].size = 0; + n++; + } else { + sp[n].start = __le64_to_cpu(ptes[i].starting_lba); + sp[n].size = __le64_to_cpu(ptes[i].ending_lba); + last_used_index=n; + n++; + } + } + free (ptes); + free (gpt); + return last_used_index+1; +} + + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-indent-level: 4 + * c-brace-imaginary-offset: 0 + * c-brace-offset: -4 + * c-argdecl-indent: 4 + * c-label-offset: -4 + * c-continued-statement-offset: 4 + * c-continued-brace-offset: 0 + * indent-tabs-mode: nil + * tab-width: 8 + * End: + */ diff --git a/partx/gpt.h b/partx/gpt.h new file mode 100644 index 00000000..d0a81f5f --- /dev/null +++ b/partx/gpt.h @@ -0,0 +1,131 @@ +/* + gpt.[ch] + + Copyright (C) 2000-2001 Dell Computer Corporation + + EFI GUID Partition Table handling + Per Intel EFI Specification v1.02 + http://developer.intel.com/technology/efi/efi.htm + + 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 +*/ + +#ifndef _GPT_H +#define _GPT_H + + +#include +#include "partx.h" +#include "dos.h" +#include "efi.h" + +#define EFI_PMBR_OSTYPE_EFI 0xEF +#define EFI_PMBR_OSTYPE_EFI_GPT 0xEE +#define MSDOS_MBR_SIGNATURE 0xaa55 +#define GPT_BLOCK_SIZE 512 + +#define GPT_HEADER_SIGNATURE 0x5452415020494645 +#define GPT_HEADER_REVISION_V1_02 0x00010200 +#define GPT_HEADER_REVISION_V1_00 0x00010000 +#define GPT_HEADER_REVISION_V0_99 0x00009900 +#define GPT_PRIMARY_PARTITION_TABLE_LBA 1 + +typedef struct _gpt_header { + uint64_t signature; + uint32_t revision; + uint32_t header_size; + uint32_t header_crc32; + uint32_t reserved1; + uint64_t my_lba; + uint64_t alternate_lba; + uint64_t first_usable_lba; + uint64_t last_usable_lba; + efi_guid_t disk_guid; + uint64_t partition_entry_lba; + uint32_t num_partition_entries; + uint32_t sizeof_partition_entry; + uint32_t partition_entry_array_crc32; + uint8_t reserved2[GPT_BLOCK_SIZE - 92]; +} __attribute__ ((packed)) gpt_header; + +typedef struct _gpt_entry_attributes { + uint64_t required_to_function:1; + uint64_t reserved:47; + uint64_t type_guid_specific:16; +} __attribute__ ((packed)) gpt_entry_attributes; + +typedef struct _gpt_entry { + efi_guid_t partition_type_guid; + efi_guid_t unique_partition_guid; + uint64_t starting_lba; + uint64_t ending_lba; + gpt_entry_attributes attributes; + efi_char16_t partition_name[72 / sizeof(efi_char16_t)]; +} __attribute__ ((packed)) gpt_entry; + + +/* + These values are only defaults. The actual on-disk structures + may define different sizes, so use those unless creating a new GPT disk! +*/ + +#define GPT_DEFAULT_RESERVED_PARTITION_ENTRY_ARRAY_SIZE 16384 +/* + Number of actual partition entries should be calculated + as: +*/ +#define GPT_DEFAULT_RESERVED_PARTITION_ENTRIES \ + (GPT_DEFAULT_RESERVED_PARTITION_ENTRY_ARRAY_SIZE / \ + sizeof(gpt_entry)) + + +/* Protected Master Boot Record & Legacy MBR share same structure */ +/* Needs to be packed because the u16s force misalignment. */ + +typedef struct _legacy_mbr { + uint8_t bootcode[440]; + uint32_t unique_mbr_signature; + uint16_t unknown; + struct partition partition[4]; + uint16_t signature; +} __attribute__ ((packed)) legacy_mbr; + + +#define EFI_GPT_PRIMARY_PARTITION_TABLE_LBA 1 + +/* Functions */ +int read_gpt_pt (int fd, struct slice all, struct slice *sp, int ns); + + +#endif + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-indent-level: 4 + * c-brace-imaginary-offset: 0 + * c-brace-offset: -4 + * c-argdecl-indent: 4 + * c-label-offset: -4 + * c-continued-statement-offset: 4 + * c-continued-brace-offset: 0 + * indent-tabs-mode: nil + * tab-width: 8 + * End: + */ diff --git a/partx/partx.c b/partx/partx.c index 212f651b..f56c2d57 100644 --- a/partx/partx.c +++ b/partx/partx.c @@ -9,7 +9,7 @@ * * Call: * partx [-{l|a|d}] [--type TYPE] [--nr M-N] [partition] wholedisk - * where TYPE is {dos|bsd|solaris|unixware}. + * where TYPE is {dos|bsd|solaris|unixware|gpt}. * * Read wholedisk and add all partitions: * partx -a wholedisk @@ -35,12 +35,14 @@ #include #include #include +#include #include #include /* HDIO_GETGEO */ #include #define BLKGETSIZE _IO(0x12,96) /* return device size */ #include "partx.h" +#include "crc32.h" static void errmerge(int err, int m, char *msg1, char *msg2); #define SIZE(a) (sizeof(a)/sizeof((a)[0])) @@ -58,7 +60,9 @@ struct pt { } pts[MAXTYPES]; int ptct; -addpts(char *t, ptreader f) { +static void +addpts(char *t, ptreader f) +{ if (ptct >= MAXTYPES) { fprintf(stderr, "addpts: too many types\n"); exit(1); @@ -68,20 +72,27 @@ addpts(char *t, ptreader f) { ptct++; } -initpts(){ +static void +initpts(void) +{ + addpts("gpt", read_gpt_pt); addpts("dos", read_dos_pt); addpts("bsd", read_bsd_pt); addpts("solaris", read_solaris_pt); addpts("unixware", read_unixware_pt); } -static char short_opts[] = "ladvn:t:"; +static char short_opts[] = "ladgvn:t:"; static const struct option long_opts[] = { + { "gpt", no_argument, NULL, 'g' }, { "type", required_argument, NULL, 't' }, { "nr", required_argument, NULL, 'n' }, { NULL, 0, NULL, 0 } }; +/* Used in gpt.c */ +int force_gpt=0; + int main(int argc, char **argv){ int fd, fd2, c, i, j, k, n; @@ -98,6 +109,7 @@ main(int argc, char **argv){ int ret = 0; initpts(); + init_crc32(); lower = upper = 0; type = device = diskdevice = NULL; @@ -110,6 +122,8 @@ main(int argc, char **argv){ what = ADD; break; case 'd': what = DELETE; break; + case 'g': + force_gpt=1; break; case 'n': p = optarg; lower = atoi(p); @@ -256,8 +270,8 @@ main(int argc, char **argv){ slices[j].start, slices[j].start+slices[j].size-1, slices[j].size, - ((512 * (long long) slices[j].size) - / 1000000)); + (int)((512 * (long long) slices[j].size) + / 1000000)); } if (n > 0 && what == ADD) { /* test for overlap, as in the case of an diff --git a/partx/partx.h b/partx/partx.h index b96588a5..efaa0640 100644 --- a/partx/partx.h +++ b/partx/partx.h @@ -1,3 +1,6 @@ +#ifndef PARTX_H_INCLUDED +#define PARTX_H_INCLUDED + /* * For each partition type there is a routine that takes * a block device and a range, and returns the list of @@ -16,7 +19,7 @@ struct slice { typedef int (ptreader)(int fd, struct slice all, struct slice *sp, int ns); -extern ptreader read_dos_pt, read_bsd_pt, read_solaris_pt, read_unixware_pt; +extern ptreader read_dos_pt, read_bsd_pt, read_solaris_pt, read_unixware_pt, read_gpt_pt; char *getblock(int fd, unsigned int secnr); @@ -24,3 +27,5 @@ static inline int four2int(unsigned char *p) { return p[0] + (p[1]<<8) + (p[2]<<16) + (p[3]<<24); } + +#endif /* PARTX_H_INCLUDED */ diff --git a/partx/unixware.c b/partx/unixware.c index 3b3f21e1..34cc226a 100644 --- a/partx/unixware.c +++ b/partx/unixware.c @@ -3,8 +3,8 @@ #define UNIXWARE_FS_UNUSED 0 #define UNIXWARE_NUMSLICE 16 -#define UNIXWARE_DISKMAGIC (0xCA5E600DUL) -#define UNIXWARE_DISKMAGIC2 (0x600DDEEEUL) +#define UNIXWARE_DISKMAGIC (0xCA5E600D) +#define UNIXWARE_DISKMAGIC2 (0x600DDEEE) struct unixware_slice { unsigned short s_label; /* label */ diff --git a/po/cat-id-tbl.c b/po/cat-id-tbl.c index 2171553c..f187b10a 100644 --- a/po/cat-id-tbl.c +++ b/po/cat-id-tbl.c @@ -225,7 +225,7 @@ This probably means creating v0 swap would destroy your partition table\n\ No swap created. If you really want to create swap v0 on that device, use\n\ the -f option to force it.\n", 189}, {"Unable to set up swap-space: unreadable", 190}, - {"Setting up swapspace version %d, size = %ld bytes\n", 191}, + {"Setting up swapspace version %d, size = %lu bytes\n", 191}, {"unable to rewind swap-device", 192}, {"unable to write signature page", 193}, {"fsync failed", 194}, @@ -1566,399 +1566,401 @@ wtmp begins %s", 1153}, {"\ \n\ interrupted %10.10s %5.5s \n", 1156}, - {"login: -h for super-user only.\n", 1157}, - {"usage: login [-fp] [username]\n", 1158}, - {"login: PAM Failure, aborting: %s\n", 1159}, - {"Couldn't initialize PAM: %s", 1160}, - {"login: ", 1161}, - {"FAILED LOGIN %d FROM %s FOR %s, %s", 1162}, + {"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}, {"\ Login incorrect\n\ -\n", 1163}, - {"TOO MANY LOGIN TRIES (%d) FROM %s FOR %s, %s", 1164}, - {"FAILED LOGIN SESSION FROM %s FOR %s, %s", 1165}, +\n", 1164}, + {"TOO MANY LOGIN TRIES (%d) FROM %s FOR %s, %s", 1165}, + {"FAILED LOGIN SESSION FROM %s FOR %s, %s", 1166}, {"\ \n\ -Login incorrect\n", 1166}, +Login incorrect\n", 1167}, {"\ \n\ -Session setup problem, abort.\n", 1167}, - {"NULL user name in %s:%d. Abort.", 1168}, - {"Invalid user name \"%s\" in %s:%d. Abort.", 1169}, - {"login: Out of memory\n", 1170}, - {"Illegal username", 1171}, - {"%s login refused on this terminal.\n", 1172}, - {"LOGIN %s REFUSED FROM %s ON TTY %s", 1173}, - {"LOGIN %s REFUSED ON TTY %s", 1174}, - {"Login incorrect\n", 1175}, +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}, {"\ Too many users logged on already.\n\ -Try again later.\n", 1176}, - {"You have too many processes running.\n", 1177}, - {"DIALUP AT %s BY %s", 1178}, - {"ROOT LOGIN ON %s FROM %s", 1179}, - {"ROOT LOGIN ON %s", 1180}, - {"LOGIN ON %s BY %s FROM %s", 1181}, - {"LOGIN ON %s BY %s", 1182}, - {"You have new mail.\n", 1183}, - {"You have mail.\n", 1184}, - {"login: failure forking: %s", 1185}, - {"setuid() failed", 1186}, - {"No directory %s!\n", 1187}, - {"Logging in with home = \"/\".\n", 1188}, - {"login: no memory for shell script.\n", 1189}, - {"login: couldn't exec shell script: %s.\n", 1190}, - {"login: no shell: %s.\n", 1191}, +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}, {"\ \n\ -%s login: ", 1192}, - {"login name much too long.\n", 1193}, - {"NAME too long", 1194}, - {"login names may not start with '-'.\n", 1195}, - {"too many bare linefeeds.\n", 1196}, - {"EXCESSIVE linefeeds", 1197}, - {"Login timed out after %d seconds\n", 1198}, - {"Last login: %.*s ", 1199}, - {"from %.*s\n", 1200}, - {"on %.*s\n", 1201}, - {"LOGIN FAILURE FROM %s, %s", 1202}, - {"LOGIN FAILURE ON %s, %s", 1203}, - {"%d LOGIN FAILURES FROM %s, %s", 1204}, - {"%d LOGIN FAILURES ON %s, %s", 1205}, - {"is y\n", 1206}, - {"is n\n", 1207}, - {"usage: mesg [y | n]\n", 1208}, - {"newgrp: Who are you?", 1209}, - {"newgrp: setgid", 1210}, - {"newgrp: No such group.", 1211}, - {"newgrp: Permission denied", 1212}, - {"newgrp: setuid", 1213}, - {"No shell", 1214}, - {"The password must have at least 6 characters, try again.\n", 1215}, +%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}, {"\ 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", 1216}, - {"You cannot reuse the old password.\n", 1217}, - {"Please don't use something like your username as password!\n", 1218}, - {"Please don't use something like your realname as password!\n", 1219}, - {"Usage: passwd [username [password]]\n", 1220}, - {"Only root may use the one and two argument forms.\n", 1221}, - {"Usage: passwd [-foqsvV] [user [password]]\n", 1222}, - {"Can't exec %s: %s\n", 1223}, - {"Cannot find login name", 1224}, - {"Only root can change the password for others.\n", 1225}, - {"Too many arguments.\n", 1226}, - {"Can't find username anywhere. Is `%s' really a user?", 1227}, - {"Sorry, I can only change local passwords. Use yppasswd instead.", 1228}, - {"UID and username does not match, imposter!", 1229}, - {"Changing password for %s\n", 1230}, - {"Enter old password: ", 1231}, - {"Illegal password, imposter.", 1232}, - {"Enter new password: ", 1233}, - {"Password not changed.", 1234}, - {"Re-type new password: ", 1235}, - {"You misspelled it. Password not changed.", 1236}, - {"password changed, user %s", 1237}, - {"ROOT PASSWORD CHANGED", 1238}, - {"password changed by root, user %s", 1239}, - {"calling setpwnam to set password.\n", 1240}, - {"Password *NOT* changed. Try again later.\n", 1241}, - {"Password changed.\n", 1242}, - {"Usage: shutdown [-h|-r] [-fqs] [now|hh:ss|+mins]\n", 1243}, - {"Shutdown process aborted", 1244}, - {"%s: Only root can shut a system down.\n", 1245}, - {"That must be tomorrow, can't you wait till then?\n", 1246}, - {"for maintenance; bounce, bounce", 1247}, - {"timeout = %d, quiet = %d, reboot = %d\n", 1248}, - {"The system is being shut down within 5 minutes", 1249}, - {"Login is therefore prohibited.", 1250}, - {"rebooted by %s: %s", 1251}, - {"halted by %s: %s", 1252}, +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}, {"\ \n\ -Why am I still alive after reboot?", 1253}, +Why am I still alive after reboot?", 1255}, {"\ \n\ -Now you can turn off the power...", 1254}, - {"Calling kernel power-off facility...\n", 1255}, - {"Error powering off\t%s\n", 1256}, - {"Executing the program \"%s\" ...\n", 1257}, - {"Error executing\t%s\n", 1258}, - {"URGENT: broadcast message from %s:", 1259}, - {"System going down in %d hours %d minutes", 1260}, - {"System going down in 1 hour %d minutes", 1261}, - {"System going down in %d minutes\n", 1262}, - {"System going down in 1 minute\n", 1263}, - {"System going down IMMEDIATELY!\n", 1264}, - {"\t... %s ...\n", 1265}, - {"Cannot fork for swapoff. Shrug!", 1266}, - {"Cannot exec swapoff, hoping umount will do the trick.", 1267}, - {"Cannot fork for umount, trying manually.", 1268}, - {"Cannot exec %s, trying umount.\n", 1269}, - {"Cannot exec umount, giving up on umount.", 1270}, - {"Unmounting any remaining filesystems...", 1271}, - {"shutdown: Couldn't umount %s: %s\n", 1272}, - {"Booting to single user mode.\n", 1273}, - {"exec of single user shell failed\n", 1274}, - {"fork of single user shell failed\n", 1275}, - {"error opening fifo\n", 1276}, - {"error running finalprog\n", 1277}, - {"error forking finalprog\n", 1278}, +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}, {"\ \n\ -Wrong password.\n", 1279}, - {"lstat of path failed\n", 1280}, - {"stat of path failed\n", 1281}, - {"open of directory failed\n", 1282}, - {"fork failed\n", 1283}, - {"exec failed\n", 1284}, - {"cannot open inittab\n", 1285}, - {"no TERM or cannot stat tty\n", 1286}, - {"error stopping service: \"%s\"", 1287}, - {"too many iov's (change code in wall/ttymsg.c)", 1288}, - {"excessively long line arg", 1289}, - {"cannot fork", 1290}, - {"fork: %s", 1291}, - {"%s: BAD ERROR", 1292}, - {"%s: the password file is busy.\n", 1293}, - {"%s: the group file is busy.\n", 1294}, - {"%s: the %s file is busy (%s present)\n", 1295}, - {"%s: can't link %s: %s\n", 1296}, - {"%s: can't unlock %s: %s (your changes are still in %s)\n", 1297}, - {"%s: Cannot fork\n", 1298}, - {"%s: %s unchanged\n", 1299}, - {"%s: no changes made\n", 1300}, - {"You are using shadow groups on this system.\n", 1301}, - {"You are using shadow passwords on this system.\n", 1302}, - {"Would you like to edit %s now [y/n]? ", 1303}, - {"usage: %s [file]\n", 1304}, - {"%s: can't open temporary file.\n", 1305}, - {"Broadcast Message from %s@%s", 1306}, - {"%s: will not read %s - use stdin.\n", 1307}, - {"%s: can't read %s.\n", 1308}, - {"%s: can't stat temporary file.\n", 1309}, - {"%s: can't read temporary file.\n", 1310}, - {"illegal month value: use 1-12", 1311}, - {"illegal year value: use 1-9999", 1312}, - {"%s %d", 1313}, - {"usage: cal [-13smjyV] [[month] year]\n", 1314}, - {"usage: %s [+format] [day month year]\n", 1315}, - {"St. Tib's Day", 1316}, - {"%s: unknown signal %s\n", 1317}, - {"%s: can't find process \"%s\"\n", 1318}, - {"%s: unknown signal %s; valid signals:\n", 1319}, - {"usage: %s [ -s signal | -p ] [ -a ] pid ...\n", 1320}, - {" %s -l [ signal ]\n", 1321}, - {"logger: %s: %s.\n", 1322}, - {"logger: unknown facility name: %s.\n", 1323}, - {"logger: unknown priority name: %s.\n", 1324}, - {"\ -usage: logger [-is] [-f file] [-p pri] [-t tag] [-u socket] [ message ... ]\n", 1325}, - {"usage: look [-dfa] [-t char] string [file]\n", 1326}, - {"Could not open %s\n", 1327}, - {"Got %d bytes from %s\n", 1328}, - {"namei: unable to get current directory - %s\n", 1329}, - {"namei: unable to chdir to %s - %s (%d)\n", 1330}, - {"usage: namei [-mx] pathname [pathname ...]\n", 1331}, - {"namei: could not chdir to root!\n", 1332}, - {"namei: could not stat root!\n", 1333}, - {"namei: buf overflow\n", 1334}, - {" ? could not chdir into %s - %s (%d)\n", 1335}, - {" ? problems reading symlink %s - %s (%d)\n", 1336}, - {" *** EXCEEDED UNIX LIMIT OF SYMLINKS ***\n", 1337}, - {"namei: unknown file type 0%06o on file %s\n", 1338}, - {"%s: out of memory\n", 1339}, - {"%s: renaming %s to %s failed: %s\n", 1340}, - {"call: %s from to files...\n", 1341}, +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}, {"\ Warning: `%s' is a link.\n\ Use `%s [options] %s' if you really want to use it.\n\ -Script not started.\n", 1342}, - {"usage: script [-a] [-f] [-q] [-t] [file]\n", 1343}, - {"Script started, file is %s\n", 1344}, - {"Script started on %s", 1345}, +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}, {"\ \n\ -Script done on %s", 1346}, - {"Script done, file is %s\n", 1347}, - {"openpty failed\n", 1348}, - {"Out of pty's\n", 1349}, - {"%s: Argument error, usage\n", 1350}, - {" [ -term terminal_name ]\n", 1351}, - {" [ -reset ]\n", 1352}, - {" [ -initialize ]\n", 1353}, - {" [ -cursor [on|off] ]\n", 1354}, - {" [ -snow [on|off] ]\n", 1355}, - {" [ -softscroll [on|off] ]\n", 1356}, - {" [ -repeat [on|off] ]\n", 1357}, - {" [ -appcursorkeys [on|off] ]\n", 1358}, - {" [ -linewrap [on|off] ]\n", 1359}, - {" [ -default ]\n", 1360}, - {" [ -foreground black|blue|green|cyan", 1361}, - {"|red|magenta|yellow|white|default ]\n", 1362}, - {" [ -background black|blue|green|cyan", 1363}, - {" [ -ulcolor black|grey|blue|green|cyan", 1364}, - {"|red|magenta|yellow|white ]\n", 1365}, - {" [ -ulcolor bright blue|green|cyan", 1366}, - {" [ -hbcolor black|grey|blue|green|cyan", 1367}, - {" [ -hbcolor bright blue|green|cyan", 1368}, - {" [ -standout [ attr ] ]\n", 1369}, - {" [ -inversescreen [on|off] ]\n", 1370}, - {" [ -bold [on|off] ]\n", 1371}, - {" [ -half-bright [on|off] ]\n", 1372}, - {" [ -blink [on|off] ]\n", 1373}, - {" [ -reverse [on|off] ]\n", 1374}, - {" [ -underline [on|off] ]\n", 1375}, - {" [ -store ]\n", 1376}, - {" [ -clear [all|rest] ]\n", 1377}, - {" [ -tabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n", 1378}, - {" [ -clrtabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n", 1379}, - {" [ -regtabs [1-160] ]\n", 1380}, - {" [ -blank [0-60] ]\n", 1381}, - {" [ -dump [1-NR_CONSOLES] ]\n", 1382}, - {" [ -append [1-NR_CONSOLES] ]\n", 1383}, - {" [ -file dumpfilename ]\n", 1384}, - {" [ -msg [on|off] ]\n", 1385}, - {" [ -msglevel [0-8] ]\n", 1386}, - {" [ -powersave [on|vsync|hsync|powerdown|off] ]\n", 1387}, - {" [ -powerdown [0-60] ]\n", 1388}, - {" [ -blength [0-2000] ]\n", 1389}, - {" [ -bfreq freqnumber ]\n", 1390}, - {"cannot (un)set powersave mode\n", 1391}, - {"klogctl error: %s\n", 1392}, - {"Error reading %s\n", 1393}, - {"Error writing screendump\n", 1394}, - {"couldn't read %s, and cannot ioctl dump\n", 1395}, - {"%s: $TERM is not defined.\n", 1396}, - {"whereis [ -sbmu ] [ -SBM dir ... -f ] name...\n", 1397}, - {"write: can't find your tty's name\n", 1398}, - {"write: you have write permission turned off.\n", 1399}, - {"write: %s is not logged in on %s.\n", 1400}, - {"write: %s has messages disabled on %s\n", 1401}, - {"usage: write user [tty]\n", 1402}, - {"write: %s is not logged in\n", 1403}, - {"write: %s has messages disabled\n", 1404}, - {"write: %s is logged in more than once; writing to %s\n", 1405}, - {"Message from %s@%s (as %s) on %s at %s ...", 1406}, - {"Message from %s@%s on %s at %s ...", 1407}, - {"warning: error reading %s: %s", 1408}, - {"warning: can't open %s: %s", 1409}, - {"mount: could not open %s - using %s instead\n", 1410}, - {"can't create lock file %s: %s (use -n flag to override)", 1411}, - {"can't link lock file %s: %s (use -n flag to override)", 1412}, - {"can't open lock file %s: %s (use -n flag to override)", 1413}, - {"Can't lock lock file %s: %s\n", 1414}, - {"can't lock lock file %s: %s", 1415}, - {"timed out", 1416}, +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}, {"\ Cannot create link %s\n\ -Perhaps there is a stale lock file?\n", 1417}, - {"cannot open %s (%s) - mtab not updated", 1418}, - {"error writing %s: %s", 1419}, - {"error changing mode of %s: %s\n", 1420}, - {"can't rename %s to %s: %s\n", 1421}, - {"loop: can't open device %s: %s\n", 1422}, - {"loop: can't get info on device %s: %s\n", 1423}, - {"%s: [%04x]:%ld (%s) offset %d, %s encryption\n", 1424}, - {"mount: could not find any device /dev/loop#", 1425}, +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}, {"\ mount: Could not find any loop device.\n\ - Maybe /dev/loop# has a wrong major number?", 1426}, + Maybe /dev/loop# has a wrong major number?", 1428}, {"\ 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'.)", 1427}, + (If so, then recompile or `insmod loop.o'.)", 1429}, {"\ 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?", 1428}, - {"mount: could not find any free loop device", 1429}, - {"Unsupported encryption type %s\n", 1430}, - {"Couldn't lock into memory, exiting.\n", 1431}, - {"Init (up to 16 hex digits): ", 1432}, - {"Non-hex digit '%c'.\n", 1433}, - {"Don't know how to get key for encryption system %d\n", 1434}, - {"set_loop(%s,%s,%d): success\n", 1435}, - {"loop: can't delete device %s: %s\n", 1436}, - {"del_loop(%s): success\n", 1437}, - {"This mount was compiled without loop support. Please recompile.\n", 1438}, + 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}, {"\ usage:\n\ %s loop_device # give info\n\ %s -d loop_device # delete\n\ - %s [ -e encryption ] [ -o offset ] loop_device file # setup\n", 1439}, - {"not enough memory", 1440}, - {"No loop support was available at compile time. Please recompile.\n", 1441}, - {"[mntent]: warning: no final newline at the end of %s\n", 1442}, - {"[mntent]: line %d in %s is bad%s\n", 1443}, - {"; rest of file ignored", 1444}, - {"mount: according to mtab, %s is already mounted on %s", 1445}, - {"mount: according to mtab, %s is mounted on %s", 1446}, - {"mount: can't open %s for writing: %s", 1447}, - {"mount: error writing %s: %s", 1448}, - {"mount: error changing mode of %s: %s", 1449}, - {"%s looks like swapspace - not mounted", 1450}, - {"mount failed", 1451}, - {"mount: only root can mount %s on %s", 1452}, - {"mount: loop device specified twice", 1453}, - {"mount: type specified twice", 1454}, - {"mount: skipping the setup of a loop device\n", 1455}, - {"mount: going to use the loop device %s\n", 1456}, - {"mount: failed setting up loop device\n", 1457}, - {"mount: setup loop device successfully\n", 1458}, - {"mount: can't open %s: %s", 1459}, - {"mount: cannot open %s for setting speed", 1460}, - {"mount: cannot set speed: %s", 1461}, - {"mount: cannot fork: %s", 1462}, - {"mount: this version was compiled without support for the type `nfs'", 1463}, - {"mount: failed with nfs mount version 4, trying 3..\n", 1464}, - {"\ -mount: I could not determine the filesystem type, and none was specified", 1465}, - {"mount: you must specify the filesystem type", 1466}, - {"mount: mount failed", 1467}, - {"mount: mount point %s is not a directory", 1468}, - {"mount: permission denied", 1469}, - {"mount: must be superuser to use mount", 1470}, - {"mount: %s is busy", 1471}, - {"mount: proc already mounted", 1472}, - {"mount: %s already mounted or %s busy", 1473}, - {"mount: mount point %s does not exist", 1474}, - {"mount: mount point %s is a symbolic link to nowhere", 1475}, - {"mount: special device %s does not exist", 1476}, + %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}, {"\ mount: special device %s does not exist\n\ - (a path prefix is not a directory)\n", 1477}, - {"mount: %s not mounted already, or bad option", 1478}, + (a path prefix is not a directory)\n", 1479}, + {"mount: %s not mounted already, or bad option", 1480}, {"\ mount: wrong fs type, bad option, bad superblock on %s,\n\ - or too many mounted file systems", 1479}, - {"mount table full", 1480}, - {"mount: %s: can't read superblock", 1481}, - {"mount: %s: unknown device", 1482}, - {"mount: fs type %s not supported by kernel", 1483}, - {"mount: probably you meant %s", 1484}, - {"mount: maybe you meant iso9660 ?", 1485}, - {"mount: %s has wrong device number or fs type %s not supported", 1486}, - {"mount: %s is not a block device, and stat fails?", 1487}, + 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}, {"\ mount: the kernel does not recognize %s as a block device\n\ - (maybe `insmod driver'?)", 1488}, - {"mount: %s is not a block device (maybe try `-o loop'?)", 1489}, - {"mount: %s is not a block device", 1490}, - {"mount: %s is not a valid block device", 1491}, - {"block device ", 1492}, - {"mount: cannot mount %s%s read-only", 1493}, - {"mount: %s%s is write-protected but explicit `-w' flag given", 1494}, - {"mount: %s%s is write-protected, mounting read-only", 1495}, - {"mount: going to mount %s by %s\n", 1496}, - {"UUID", 1497}, - {"label", 1498}, - {"mount: no such partition found", 1499}, - {"mount: no type was given - I'll assume nfs because of the colon\n", 1500}, - {"mount: backgrounding \"%s\"\n", 1501}, - {"mount: giving up \"%s\"\n", 1502}, - {"mount: %s already mounted on %s\n", 1503}, + (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: going to mount %s by %s\n", 1498}, + {"UUID", 1499}, + {"label", 1500}, + {"mount: no such partition found", 1501}, + {"mount: no type was given - I'll assume nfs because of the colon\n", 1502}, + {"mount: backgrounding \"%s\"\n", 1503}, + {"mount: giving up \"%s\"\n", 1504}, + {"mount: %s already mounted on %s\n", 1505}, {"\ Usage: mount -V : print version\n\ mount -h : print this help\n\ @@ -1980,269 +1982,284 @@ 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", 1504}, - {"mount: only root can do that", 1505}, - {"mount: no %s found - creating it..\n", 1506}, - {"mount: mounting %s\n", 1507}, - {"nothing was mounted", 1508}, - {"mount: cannot find %s in %s", 1509}, - {"mount: can't find %s in %s or %s", 1510}, - {"\ -mount: could not open %s, so UUID and LABEL conversion cannot be done.\n", 1511}, - {"mount: bad UUID", 1512}, - {"mount: error while guessing filesystem type\n", 1513}, - {"mount: you didn't specify a filesystem type for %s\n", 1514}, - {" I will try all types mentioned in %s or %s\n", 1515}, - {" and it looks like this is swapspace\n", 1516}, - {" I will try type %s\n", 1517}, - {"Trying %s\n", 1518}, - {"mount: excessively long host:dir argument\n", 1519}, - {"mount: warning: multiple hostnames not supported\n", 1520}, - {"mount: directory to mount not in host:dir format\n", 1521}, - {"mount: can't get address for %s\n", 1522}, - {"mount: got bad hp->h_length\n", 1523}, - {"mount: excessively long option argument\n", 1524}, - {"Warning: Unrecognized proto= option.\n", 1525}, - {"Warning: Option namlen is not supported.\n", 1526}, - {"unknown nfs mount parameter: %s=%d\n", 1527}, - {"Warning: option nolock is not supported.\n", 1528}, - {"unknown nfs mount option: %s%s\n", 1529}, - {"mount: got bad hp->h_length?\n", 1530}, - {"NFS over TCP is not supported.\n", 1531}, - {"nfs socket", 1532}, - {"nfs bindresvport", 1533}, - {"nfs server reported service unavailable", 1534}, - {"used portmapper to find NFS port\n", 1535}, - {"using port %d for nfs deamon\n", 1536}, - {"nfs connect", 1537}, - {"unknown nfs status return value: %d", 1538}, - {"bug in xstrndup call", 1539}, +For many more details, say man 8 mount .\n", 1506}, + {"mount: only root can do that", 1507}, + {"mount: no %s found - creating it..\n", 1508}, + {"mount: mounting %s\n", 1509}, + {"nothing was mounted", 1510}, + {"mount: cannot find %s in %s", 1511}, + {"mount: can't find %s in %s or %s", 1512}, + {"\ +mount: could not open %s, so UUID and LABEL conversion cannot be done.\n", 1513}, + {"mount: bad UUID", 1514}, + {"mount: error while guessing filesystem type\n", 1515}, + {"mount: you didn't specify a filesystem type for %s\n", 1516}, + {" I will try all types mentioned in %s or %s\n", 1517}, + {" and it looks like this is swapspace\n", 1518}, + {" I will try type %s\n", 1519}, + {"Trying %s\n", 1520}, + {"mount: excessively long host:dir argument\n", 1521}, + {"mount: warning: multiple hostnames not supported\n", 1522}, + {"mount: directory to mount not in host:dir format\n", 1523}, + {"mount: can't get address for %s\n", 1524}, + {"mount: got bad hp->h_length\n", 1525}, + {"mount: excessively long option argument\n", 1526}, + {"Warning: Unrecognized proto= option.\n", 1527}, + {"Warning: Option namlen is not supported.\n", 1528}, + {"unknown nfs mount parameter: %s=%d\n", 1529}, + {"Warning: option nolock is not supported.\n", 1530}, + {"unknown nfs mount option: %s%s\n", 1531}, + {"mount: got bad hp->h_length?\n", 1532}, + {"NFS over TCP is not supported.\n", 1533}, + {"nfs socket", 1534}, + {"nfs bindresvport", 1535}, + {"nfs server reported service unavailable", 1536}, + {"used portmapper to find NFS port\n", 1537}, + {"using port %d for nfs deamon\n", 1538}, + {"nfs connect", 1539}, + {"unknown nfs status return value: %d", 1540}, + {"bug in xstrndup call", 1541}, {"\ usage: %s [-hV]\n\ %s -a [-v]\n\ %s [-v] [-p priority] special ...\n\ - %s [-s]\n", 1540}, - {"%s on %s\n", 1541}, - {"swapon: cannot stat %s: %s\n", 1542}, - {"swapon: warning: %s has insecure permissions %04o, %04o suggested\n", 1543}, - {"swapon: Skipping file %s - it appears to have holes.\n", 1544}, - {"%s: cannot open %s: %s\n", 1545}, - {"umount: compiled without support for -f\n", 1546}, - {"host: %s, directory: %s\n", 1547}, - {"umount: can't get address for %s\n", 1548}, - {"umount: got bad hostp->h_length\n", 1549}, - {"umount: %s: invalid block device", 1550}, - {"umount: %s: not mounted", 1551}, - {"umount: %s: can't write superblock", 1552}, - {"umount: %s: device is busy", 1553}, - {"umount: %s: not found", 1554}, - {"umount: %s: must be superuser to umount", 1555}, - {"umount: %s: block devices not permitted on fs", 1556}, - {"umount: %s: %s", 1557}, - {"no umount2, trying umount...\n", 1558}, - {"could not umount %s - trying %s instead\n", 1559}, - {"umount: %s busy - remounted read-only\n", 1560}, - {"umount: could not remount %s read-only\n", 1561}, - {"%s umounted\n", 1562}, - {"umount: cannot find list of filesystems to unmount", 1563}, + %s [-s]\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}, + {"%s: cannot open %s: %s\n", 1547}, + {"umount: compiled without support for -f\n", 1548}, + {"host: %s, directory: %s\n", 1549}, + {"umount: can't get address for %s\n", 1550}, + {"umount: got bad hostp->h_length\n", 1551}, + {"umount: %s: invalid block device", 1552}, + {"umount: %s: not mounted", 1553}, + {"umount: %s: can't write superblock", 1554}, + {"umount: %s: device is busy", 1555}, + {"umount: %s: not found", 1556}, + {"umount: %s: must be superuser to umount", 1557}, + {"umount: %s: block devices not permitted on fs", 1558}, + {"umount: %s: %s", 1559}, + {"no umount2, trying umount...\n", 1560}, + {"could not umount %s - trying %s instead\n", 1561}, + {"umount: %s busy - remounted read-only\n", 1562}, + {"umount: could not remount %s read-only\n", 1563}, + {"%s umounted\n", 1564}, + {"umount: cannot find list of filesystems to unmount", 1565}, {"\ Usage: umount [-hV]\n\ umount -a [-f] [-r] [-n] [-v] [-t vfstypes]\n\ - umount [-f] [-r] [-n] [-v] special | node...\n", 1564}, - {"Trying to umount %s\n", 1565}, - {"Could not find %s in mtab\n", 1566}, - {"umount: %s is not mounted (according to mtab)", 1567}, - {"umount: it seems %s is mounted multiple times", 1568}, - {"umount: %s is not in the fstab (and you are not root)", 1569}, - {"umount: %s mount disagrees with the fstab", 1570}, - {"umount: only root can unmount %s from %s", 1571}, - {"umount: only root can do that", 1572}, - {"You must be root to set the Ctrl-Alt-Del behaviour.\n", 1573}, - {"Usage: ctrlaltdel hard|soft\n", 1574}, + umount [-f] [-r] [-n] [-v] special | node...\n", 1566}, + {"Trying to umount %s\n", 1567}, + {"Could not find %s in mtab\n", 1568}, + {"umount: %s is not mounted (according to mtab)", 1569}, + {"umount: it seems %s is mounted multiple times", 1570}, + {"umount: %s is not in the fstab (and you are not root)", 1571}, + {"umount: %s mount disagrees with the fstab", 1572}, + {"umount: only root can unmount %s from %s", 1573}, + {"umount: only root can do that", 1574}, + {"You must be root to set the Ctrl-Alt-Del behaviour.\n", 1575}, + {"Usage: ctrlaltdel hard|soft\n", 1576}, {"\ File %s, For threshold value %lu, Maximum characters in fifo were %d,\n\ -and the maximum transfer rate in characters/second was %f\n", 1575}, +and the maximum transfer rate in characters/second was %f\n", 1577}, {"\ 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", 1576}, - {"Invalid interval value: %s\n", 1577}, - {"Invalid set value: %s\n", 1578}, - {"Invalid default value: %s\n", 1579}, - {"Invalid set time value: %s\n", 1580}, - {"Invalid default time value: %s\n", 1581}, +and the maximum transfer rate in characters/second was %f\n", 1578}, + {"Invalid interval value: %s\n", 1579}, + {"Invalid set value: %s\n", 1580}, + {"Invalid default value: %s\n", 1581}, + {"Invalid set time value: %s\n", 1582}, + {"Invalid default time value: %s\n", 1583}, {"\ Usage: %s [-q [-i interval]] ([-s value]|[-S value]) ([-t value]|[-T value]) \ -[-g|-G] file [file...]\n", 1582}, - {"Can't open %s: %s\n", 1583}, - {"Can't set %s to threshold %d: %s\n", 1584}, - {"Can't set %s to time threshold %d: %s\n", 1585}, - {"Can't get threshold for %s: %s\n", 1586}, - {"Can't get timeout for %s: %s\n", 1587}, - {"%s: %ld current threshold and %ld current timeout\n", 1588}, - {"%s: %ld default threshold and %ld default timeout\n", 1589}, - {"Can't set signal handler", 1590}, - {"gettimeofday failed", 1591}, - {"Can't issue CYGETMON on %s: %s\n", 1592}, - {"\ -%s: %lu ints, %lu/%lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n", 1593}, - {" %f int/sec; %f rec, %f send (char/sec)\n", 1594}, - {"\ -%s: %lu ints, %lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n", 1595}, - {" %f int/sec; %f rec (char/sec)\n", 1596}, - {"Usage: %s [-c] [-n level] [-s bufsize]\n", 1597}, - {"invalid id: %s\n", 1598}, - {"cannot remove id %s (%s)\n", 1599}, - {"usage: %s {shm | msg | sem} id ...\n", 1600}, - {"unknown resource type: %s\n", 1601}, - {"resource(s) deleted\n", 1602}, - {"usage : %s -asmq -tclup \n", 1603}, - {"\t%s [-s -m -q] -i id\n", 1604}, - {"\t%s -h for help.\n", 1605}, - {"\ -%s provides information on ipc facilities for which you have read access.\n", 1606}, +[-g|-G] file [file...]\n", 1584}, + {"Can't open %s: %s\n", 1585}, + {"Can't set %s to threshold %d: %s\n", 1586}, + {"Can't set %s to time threshold %d: %s\n", 1587}, + {"Can't get threshold for %s: %s\n", 1588}, + {"Can't get timeout for %s: %s\n", 1589}, + {"%s: %ld current threshold and %ld current timeout\n", 1590}, + {"%s: %ld default threshold and %ld default timeout\n", 1591}, + {"Can't set signal handler", 1592}, + {"gettimeofday failed", 1593}, + {"Can't issue CYGETMON on %s: %s\n", 1594}, + {"\ +%s: %lu ints, %lu/%lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n", 1595}, + {" %f int/sec; %f rec, %f send (char/sec)\n", 1596}, + {"\ +%s: %lu ints, %lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n", 1597}, + {" %f int/sec; %f rec (char/sec)\n", 1598}, + {"Usage: %s [-c] [-n level] [-s bufsize]\n", 1599}, + {"invalid id: %s\n", 1600}, + {"cannot remove id %s (%s)\n", 1601}, + {"deprecated usage: %s {shm | msg | sem} id ...\n", 1602}, + {"unknown resource type: %s\n", 1603}, + {"resource(s) deleted\n", 1604}, + {"\ +usage: %s [ [-q msqid] [-m shmid] [-s semid]\n\ + [-Q msgkey] [-M shmkey] [-S semkey] ... ]\n", 1605}, + {"%s: illegal option -- %c\n", 1606}, + {"%s: illegal key (%s)\n", 1607}, + {"permission denied for key", 1608}, + {"already removed key", 1609}, + {"invalid key", 1610}, + {"unknown error in key", 1611}, + {"permission denied for id", 1612}, + {"invalid id", 1613}, + {"already removed id", 1614}, + {"unknown error in id", 1615}, + {"%s: %s (%s)\n", 1616}, + {"%s: unknown argument: %s\n", 1617}, + {"usage : %s -asmq -tclup \n", 1618}, + {"\t%s [-s -m -q] -i id\n", 1619}, + {"\t%s -h for help.\n", 1620}, + {"\ +%s provides information on ipc facilities for which you have read access.\n", 1621}, {"\ Resource Specification:\n\ \t-m : shared_mem\n\ -\t-q : messages\n", 1607}, +\t-q : messages\n", 1622}, {"\ \t-s : semaphores\n\ -\t-a : all (default)\n", 1608}, +\t-a : all (default)\n", 1623}, {"\ Output Format:\n\ \t-t : time\n\ \t-p : pid\n\ -\t-c : creator\n", 1609}, +\t-c : creator\n", 1624}, {"\ \t-l : limits\n\ -\t-u : summary\n", 1610}, - {"-i id [-s -q -m] : details on resource identified by id\n", 1611}, - {"kernel not configured for shared memory\n", 1612}, - {"------ Shared Memory Limits --------\n", 1613}, - {"max number of segments = %ld\n", 1614}, - {"max seg size (kbytes) = %ld\n", 1615}, - {"max total shared memory (kbytes) = %ld\n", 1616}, - {"min seg size (bytes) = %ld\n", 1617}, - {"------ Shared Memory Status --------\n", 1618}, - {"segments allocated %d\n", 1619}, - {"pages allocated %ld\n", 1620}, - {"pages resident %ld\n", 1621}, - {"pages swapped %ld\n", 1622}, - {"Swap performance: %ld attempts\t %ld successes\n", 1623}, - {"------ Shared Memory Segment Creators/Owners --------\n", 1624}, - {"%-10s %-10s %-10s %-10s %-10s %-10s\n", 1625}, - {"shmid", 1626}, - {"perms", 1627}, - {"cuid", 1628}, - {"cgid", 1629}, - {"uid", 1630}, - {"gid", 1631}, - {"------ Shared Memory Attach/Detach/Change Times --------\n", 1632}, - {"%-10s %-10s %-20s %-20s %-20s\n", 1633}, - {"owner", 1634}, - {"attached", 1635}, - {"detached", 1636}, - {"changed", 1637}, - {"------ Shared Memory Creator/Last-op --------\n", 1638}, - {"%-10s %-10s %-10s %-10s\n", 1639}, - {"cpid", 1640}, - {"lpid", 1641}, - {"------ Shared Memory Segments --------\n", 1642}, - {"%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n", 1643}, - {"key", 1644}, - {"bytes", 1645}, - {"nattch", 1646}, - {"status", 1647}, - {"Not set", 1648}, - {"dest", 1649}, - {"locked", 1650}, - {"kernel not configured for semaphores\n", 1651}, - {"------ Semaphore Limits --------\n", 1652}, - {"max number of arrays = %d\n", 1653}, - {"max semaphores per array = %d\n", 1654}, - {"max semaphores system wide = %d\n", 1655}, - {"max ops per semop call = %d\n", 1656}, - {"semaphore max value = %d\n", 1657}, - {"------ Semaphore Status --------\n", 1658}, - {"used arrays = %d\n", 1659}, - {"allocated semaphores = %d\n", 1660}, - {"------ Semaphore Arrays Creators/Owners --------\n", 1661}, - {"semid", 1662}, - {"------ Shared Memory Operation/Change Times --------\n", 1663}, - {"%-8s %-10s %-26.24s %-26.24s\n", 1664}, - {"last-op", 1665}, - {"last-changed", 1666}, - {"------ Semaphore Arrays --------\n", 1667}, - {"%-10s %-10s %-10s %-10s %-10s %-12s\n", 1668}, - {"nsems", 1669}, - {"kernel not configured for message queues\n", 1670}, - {"------ Messages: Limits --------\n", 1671}, - {"max queues system wide = %d\n", 1672}, - {"max size of message (bytes) = %d\n", 1673}, - {"default max size of queue (bytes) = %d\n", 1674}, - {"------ Messages: Status --------\n", 1675}, - {"allocated queues = %d\n", 1676}, - {"used headers = %d\n", 1677}, - {"used space = %d bytes\n", 1678}, - {"------ Message Queues: Creators/Owners --------\n", 1679}, - {"msqid", 1680}, - {"------ Message Queues Send/Recv/Change Times --------\n", 1681}, - {"%-8s %-10s %-20s %-20s %-20s\n", 1682}, - {"send", 1683}, - {"recv", 1684}, - {"change", 1685}, - {"------ Message Queues PIDs --------\n", 1686}, - {"lspid", 1687}, - {"lrpid", 1688}, - {"------ Message Queues --------\n", 1689}, - {"%-10s %-10s %-10s %-10s %-12s %-12s\n", 1690}, - {"used-bytes", 1691}, - {"messages", 1692}, +\t-u : summary\n", 1625}, + {"-i id [-s -q -m] : details on resource identified by id\n", 1626}, + {"kernel not configured for shared memory\n", 1627}, + {"------ Shared Memory Limits --------\n", 1628}, + {"max number of segments = %ld\n", 1629}, + {"max seg size (kbytes) = %ld\n", 1630}, + {"max total shared memory (kbytes) = %ld\n", 1631}, + {"min seg size (bytes) = %ld\n", 1632}, + {"------ Shared Memory Status --------\n", 1633}, + {"segments allocated %d\n", 1634}, + {"pages allocated %ld\n", 1635}, + {"pages resident %ld\n", 1636}, + {"pages swapped %ld\n", 1637}, + {"Swap performance: %ld attempts\t %ld successes\n", 1638}, + {"------ Shared Memory Segment Creators/Owners --------\n", 1639}, + {"%-10s %-10s %-10s %-10s %-10s %-10s\n", 1640}, + {"shmid", 1641}, + {"perms", 1642}, + {"cuid", 1643}, + {"cgid", 1644}, + {"uid", 1645}, + {"gid", 1646}, + {"------ Shared Memory Attach/Detach/Change Times --------\n", 1647}, + {"%-10s %-10s %-20s %-20s %-20s\n", 1648}, + {"owner", 1649}, + {"attached", 1650}, + {"detached", 1651}, + {"changed", 1652}, + {"------ Shared Memory Creator/Last-op --------\n", 1653}, + {"%-10s %-10s %-10s %-10s\n", 1654}, + {"cpid", 1655}, + {"lpid", 1656}, + {"------ Shared Memory Segments --------\n", 1657}, + {"%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n", 1658}, + {"key", 1659}, + {"bytes", 1660}, + {"nattch", 1661}, + {"status", 1662}, + {"Not set", 1663}, + {"dest", 1664}, + {"locked", 1665}, + {"kernel not configured for semaphores\n", 1666}, + {"------ Semaphore Limits --------\n", 1667}, + {"max number of arrays = %d\n", 1668}, + {"max semaphores per array = %d\n", 1669}, + {"max semaphores system wide = %d\n", 1670}, + {"max ops per semop call = %d\n", 1671}, + {"semaphore max value = %d\n", 1672}, + {"------ Semaphore Status --------\n", 1673}, + {"used arrays = %d\n", 1674}, + {"allocated semaphores = %d\n", 1675}, + {"------ Semaphore Arrays Creators/Owners --------\n", 1676}, + {"semid", 1677}, + {"------ Shared Memory Operation/Change Times --------\n", 1678}, + {"%-8s %-10s %-26.24s %-26.24s\n", 1679}, + {"last-op", 1680}, + {"last-changed", 1681}, + {"------ Semaphore Arrays --------\n", 1682}, + {"%-10s %-10s %-10s %-10s %-10s %-12s\n", 1683}, + {"nsems", 1684}, + {"kernel not configured for message queues\n", 1685}, + {"------ Messages: Limits --------\n", 1686}, + {"max queues system wide = %d\n", 1687}, + {"max size of message (bytes) = %d\n", 1688}, + {"default max size of queue (bytes) = %d\n", 1689}, + {"------ Messages: Status --------\n", 1690}, + {"allocated queues = %d\n", 1691}, + {"used headers = %d\n", 1692}, + {"used space = %d bytes\n", 1693}, + {"------ Message Queues: Creators/Owners --------\n", 1694}, + {"msqid", 1695}, + {"------ Message Queues Send/Recv/Change Times --------\n", 1696}, + {"%-8s %-10s %-20s %-20s %-20s\n", 1697}, + {"send", 1698}, + {"recv", 1699}, + {"change", 1700}, + {"------ Message Queues PIDs --------\n", 1701}, + {"lspid", 1702}, + {"lrpid", 1703}, + {"------ Message Queues --------\n", 1704}, + {"%-10s %-10s %-10s %-10s %-12s %-12s\n", 1705}, + {"used-bytes", 1706}, + {"messages", 1707}, {"\ \n\ -Shared memory Segment shmid=%d\n", 1693}, - {"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\n", 1694}, - {"mode=%#o\taccess_perms=%#o\n", 1695}, - {"bytes=%d\tlpid=%d\tcpid=%d\tnattch=%ld\n", 1696}, - {"att_time=%-26.24s\n", 1697}, - {"det_time=%-26.24s\n", 1698}, - {"change_time=%-26.24s\n", 1699}, +Shared memory Segment shmid=%d\n", 1708}, + {"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\n", 1709}, + {"mode=%#o\taccess_perms=%#o\n", 1710}, + {"bytes=%d\tlpid=%d\tcpid=%d\tnattch=%ld\n", 1711}, + {"att_time=%-26.24s\n", 1712}, + {"det_time=%-26.24s\n", 1713}, + {"change_time=%-26.24s\n", 1714}, {"\ \n\ -Message Queue msqid=%d\n", 1700}, - {"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\tmode=%#o\n", 1701}, - {"cbytes=%ld\tqbytes=%ld\tqnum=%ld\tlspid=%d\tlrpid=%d\n", 1702}, - {"send_time=%-26.24s\n", 1703}, - {"rcv_time=%-26.24s\n", 1704}, +Message Queue msqid=%d\n", 1715}, + {"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\tmode=%#o\n", 1716}, + {"cbytes=%ld\tqbytes=%ld\tqnum=%ld\tlspid=%d\tlrpid=%d\n", 1717}, + {"send_time=%-26.24s\n", 1718}, + {"rcv_time=%-26.24s\n", 1719}, {"\ \n\ -Semaphore Array semid=%d\n", 1705}, - {"uid=%d\t gid=%d\t cuid=%d\t cgid=%d\n", 1706}, - {"mode=%#o, access_perms=%#o\n", 1707}, - {"nsems = %ld\n", 1708}, - {"otime = %-26.24s\n", 1709}, - {"ctime = %-26.24s\n", 1710}, - {"%-10s %-10s %-10s %-10s %-10s\n", 1711}, - {"semnum", 1712}, - {"value", 1713}, - {"ncount", 1714}, - {"zcount", 1715}, - {"pid", 1716}, - {"usage: rdev [ -rv ] [ -o OFFSET ] [ IMAGE [ VALUE [ OFFSET ] ] ]", 1717}, - {"\ - rdev /dev/fd0 (or rdev /linux, etc.) displays the current ROOT device", 1718}, - {" rdev /dev/fd0 /dev/hda2 sets ROOT to /dev/hda2", 1719}, - {" rdev -R /dev/fd0 1 set the ROOTFLAGS (readonly status)", 1720}, - {" rdev -r /dev/fd0 627 set the RAMDISK size", 1721}, - {" rdev -v /dev/fd0 1 set the bootup VIDEOMODE", 1722}, - {" rdev -o N ... use the byte offset N", 1723}, - {" rootflags ... same as rdev -R", 1724}, - {" ramsize ... same as rdev -r", 1725}, - {" vidmode ... same as rdev -v", 1726}, - {"\ -Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,...", 1727}, - {" use -R 1 to mount root readonly, -R 0 for read/write.", 1728}, - {"missing comma", 1729}, +Semaphore Array semid=%d\n", 1720}, + {"uid=%d\t gid=%d\t cuid=%d\t cgid=%d\n", 1721}, + {"mode=%#o, access_perms=%#o\n", 1722}, + {"nsems = %ld\n", 1723}, + {"otime = %-26.24s\n", 1724}, + {"ctime = %-26.24s\n", 1725}, + {"%-10s %-10s %-10s %-10s %-10s\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\ @@ -2253,108 +2270,108 @@ 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", 1730}, - {"out of memory", 1731}, - {"%s Version %s\n", 1732}, - {"Sampling_step: %i\n", 1733}, - {"%s: %s(%i): wrong map line\n", 1734}, - {"%s: can't find \"_stext\" in %s\n", 1735}, - {"%s: profile address out of range. Wrong map file?\n", 1736}, - {"total", 1737}, - {"\ -usage: renice priority [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] users ]\n", 1738}, - {"renice: %s: unknown user\n", 1739}, - {"renice: %s: bad value\n", 1740}, - {"getpriority", 1741}, - {"setpriority", 1742}, - {"%d: old priority %d, new priority %d\n", 1743}, - {"usage: %s program [arg ...]\n", 1744}, +\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