diff options
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | getopt/getopt.c | 1 | ||||
-rw-r--r-- | include/all-io.h | 4 | ||||
-rw-r--r-- | include/blkdev.h | 21 | ||||
-rw-r--r-- | include/list.h | 4 | ||||
-rw-r--r-- | lib/blkdev.c | 48 | ||||
-rw-r--r-- | lib/env.c | 2 | ||||
-rw-r--r-- | lib/pager.c | 3 | ||||
-rw-r--r-- | lib/randutils.c | 3 | ||||
-rw-r--r-- | lib/sysfs.c | 2 | ||||
-rw-r--r-- | libmount/src/mountP.h | 2 | ||||
-rw-r--r-- | libmount/src/optstr.c | 5 | ||||
-rw-r--r-- | login-utils/su.c | 2 | ||||
-rw-r--r-- | misc-utils/Makefile.am | 4 | ||||
-rw-r--r-- | misc-utils/blkid.c | 4 | ||||
-rw-r--r-- | misc-utils/kill.c | 3 | ||||
-rw-r--r-- | misc-utils/lsblk.c | 18 | ||||
-rw-r--r-- | misc-utils/uuidd.rc | 2 | ||||
-rw-r--r-- | misc-utils/wipefs.c | 11 | ||||
-rw-r--r-- | mount/fstab.c | 2 | ||||
-rw-r--r-- | partx/partx.8 | 231 | ||||
-rw-r--r-- | sys-utils/eject.c | 8 | ||||
-rw-r--r-- | sys-utils/setarch.c | 6 | ||||
-rw-r--r-- | term-utils/agetty.c | 2 | ||||
-rw-r--r-- | term-utils/script.c | 1 | ||||
-rw-r--r-- | term-utils/wall.c | 1 |
26 files changed, 259 insertions, 141 deletions
diff --git a/configure.ac b/configure.ac index 2280e7e51..0669f0ab5 100644 --- a/configure.ac +++ b/configure.ac @@ -262,6 +262,16 @@ AC_CHECK_DECL([lseek64], #define _LARGEFILE64_SOURCE #include <unistd.h>]) +AC_CHECK_DECL([environ], + [AC_DEFINE(HAVE_ENVIRON_DECL, 1, + [Define to 1 if have **environ prototype])], +) + +AC_CHECK_DECL([strsignal], + [AC_DEFINE(HAVE_STRSIGNAL_DECL, 1, + [Define to 1 if have strsignal function prototype])], +) + AC_CHECK_FUNCS([ \ __fpending \ __secure_getenv \ diff --git a/getopt/getopt.c b/getopt/getopt.c index dcc55b6b1..4ba340193 100644 --- a/getopt/getopt.c +++ b/getopt/getopt.c @@ -86,7 +86,6 @@ int (*getopt_long_fp) (int argc, char *const *argv, const char *optstr, static const char *normalize(const char *arg); static int generate_output(char *argv[], int argc, const char *optstr, const struct option *longopts); -int main(int argc, char *argv[]); static void parse_error(const char *message); static void add_long_options(char *options); static void add_longopt(const char *name, int has_arg); diff --git a/include/all-io.h b/include/all-io.h index b79d702bd..38a760ff6 100644 --- a/include/all-io.h +++ b/include/all-io.h @@ -15,7 +15,7 @@ static inline int write_all(int fd, const void *buf, size_t count) if (tmp > 0) { count -= tmp; if (count) - buf += tmp; + buf = (void *) ((char *) buf + tmp); } else if (errno != EINTR && errno != EAGAIN) return -1; if (errno == EAGAIN) /* Try later, *sigh* */ @@ -35,7 +35,7 @@ static inline int fwrite_all(const void *ptr, size_t size, if (tmp > 0) { nmemb -= tmp; if (nmemb) - ptr += (tmp * size); + ptr = (void *) ((char *) ptr + (tmp * size)); } else if (errno != EINTR && errno != EAGAIN) return -1; if (errno == EAGAIN) /* Try later, *sigh* */ diff --git a/include/blkdev.h b/include/blkdev.h index 56dbce75c..84c26dd33 100644 --- a/include/blkdev.h +++ b/include/blkdev.h @@ -78,6 +78,24 @@ # define CDROM_GET_CAPABILITY 0x5331 #endif +/* SCSI device types. Copied almost as-is from kernel header. + * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=include/scsi/scsi.h */ +#define SCSI_TYPE_DISK 0x00 +#define SCSI_TYPE_TAPE 0x01 +#define SCSI_TYPE_PRINTER 0x02 +#define SCSI_TYPE_PROCESSOR 0x03 /* HP scanners use this */ +#define SCSI_TYPE_WORM 0x04 /* Treated as ROM by our system */ +#define SCSI_TYPE_ROM 0x05 +#define SCSI_TYPE_SCANNER 0x06 +#define SCSI_TYPE_MOD 0x07 /* Magneto-optical disk - treated as SCSI_TYPE_DISK */ +#define SCSI_TYPE_MEDIUM_CHANGER 0x08 +#define SCSI_TYPE_COMM 0x09 /* Communications device */ +#define SCSI_TYPE_RAID 0x0c +#define SCSI_TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ +#define SCSI_TYPE_RBC 0x0e +#define SCSI_TYPE_OSD 0x11 +#define SCSI_TYPE_NO_LUN 0x7f + struct hd_geometry { unsigned char heads; unsigned char sectors; @@ -113,4 +131,7 @@ int blkdev_is_cdrom(int fd); /* get device's geometry - legacy */ int blkdev_get_geometry(int fd, unsigned int *h, unsigned int *s); +/* convert scsi type code to name */ +char *blkdev_scsi_type_to_name(int type); + #endif /* BLKDEV_H */ diff --git a/include/list.h b/include/list.h index d8c3bf018..1824af05d 100644 --- a/include/list.h +++ b/include/list.h @@ -221,7 +221,7 @@ _INLINE_ struct list_head *merge(int (*cmp)(struct list_head *a, } tail = tail->next; } - tail->next = a?:b; + tail->next = a ? a : b; return head.next; } @@ -252,7 +252,7 @@ _INLINE_ void merge_and_restore_back_links(int (*cmp)(struct list_head *a, } tail = tail->next; } - tail->next = a ? : b; + tail->next = a ? a : b; do { /* diff --git a/lib/blkdev.c b/lib/blkdev.c index 9e13e1370..35ec36954 100644 --- a/lib/blkdev.c +++ b/lib/blkdev.c @@ -21,8 +21,9 @@ #endif #include "blkdev.h" -#include "linux_version.h" #include "c.h" +#include "linux_version.h" +#include "xalloc.h" static long blkdev_valid_offset (int fd, off_t offset) { @@ -288,6 +289,51 @@ int blkdev_get_geometry(int fd, unsigned int *h, unsigned int *s) return -1; } +/* + * Convert scsi type to human readable string. Return value is + * expected to free'd after use. + */ +char *blkdev_scsi_type_to_name(int type) +{ + char *type_str = NULL; + + switch (type) { + case SCSI_TYPE_DISK: + return xstrdup("disk"); + case SCSI_TYPE_TAPE: + return xstrdup("tape"); + case SCSI_TYPE_PRINTER: + return xstrdup("printer"); + case SCSI_TYPE_PROCESSOR: + return xstrdup("processor"); + case SCSI_TYPE_WORM: + return xstrdup("worm"); + case SCSI_TYPE_ROM: + return xstrdup("rom"); + case SCSI_TYPE_SCANNER: + return xstrdup("scanner"); + case SCSI_TYPE_MOD: + return xstrdup("mo-disk"); + case SCSI_TYPE_MEDIUM_CHANGER: + return xstrdup("changer"); + case SCSI_TYPE_COMM: + return xstrdup("comm"); + case SCSI_TYPE_RAID: + return xstrdup("raid"); + case SCSI_TYPE_ENCLOSURE: + return xstrdup("enclosure"); + case SCSI_TYPE_RBC: + return xstrdup("rbc"); + case SCSI_TYPE_OSD: + return xstrdup("osd"); + case SCSI_TYPE_NO_LUN: + return xstrdup("no-lun"); + default: + xasprintf(&type_str, "0x%02x", type); + return type_str; + } +} + #ifdef TEST_PROGRAM #include <stdio.h> #include <stdlib.h> @@ -21,7 +21,9 @@ #include "env.h" +#ifndef HAVE_ENVIRON_DECL extern char **environ; +#endif static char * const forbid[] = { "_RLD_=", diff --git a/lib/pager.c b/lib/pager.c index f02d55d4f..4c50de4ba 100644 --- a/lib/pager.c +++ b/lib/pager.c @@ -200,7 +200,8 @@ void setup_pager(void) #define MAX 255 -int main(int argc, char *argv[]) +int main(int argc __attribute__ ((__unused__)), + char *argv[] __attribute__ ((__unused__))) { int i; diff --git a/lib/randutils.c b/lib/randutils.c index b90c88691..85cb1a99e 100644 --- a/lib/randutils.c +++ b/lib/randutils.c @@ -105,7 +105,8 @@ void random_get_bytes(void *buf, size_t nbytes) } #ifdef TEST_PROGRAM -int main(int argc, char *argv[]) +int main(int argc __attribute__ ((__unused__)), + char *argv[] __attribute__ ((__unused__))) { unsigned int v, i; diff --git a/lib/sysfs.c b/lib/sysfs.c index 3b5d045c4..312191f03 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -90,7 +90,7 @@ dev_t sysfs_devname_to_devno(const char *name, const char *parent) if (!f) return 0; - if (fscanf(f, "%u:%u", &maj, &min) == 2) + if (fscanf(f, "%d:%d", &maj, &min) == 2) dev = makedev(maj, min); fclose(f); } diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h index c7d378eeb..f7cd7d53d 100644 --- a/libmount/src/mountP.h +++ b/libmount/src/mountP.h @@ -380,7 +380,6 @@ extern int mnt_context_guess_fstype(struct libmnt_context *cxt); extern int mnt_context_prepare_helper(struct libmnt_context *cxt, const char *name, const char *type); extern int mnt_context_prepare_update(struct libmnt_context *cxt); -extern struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt); extern int mnt_context_merge_mflags(struct libmnt_context *cxt); extern int mnt_context_update_tabs(struct libmnt_context *cxt); @@ -395,7 +394,6 @@ extern int mnt_context_clear_loopdev(struct libmnt_context *cxt); extern int mnt_fork_context(struct libmnt_context *cxt); /* tab_update.c */ -extern struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd); extern int mnt_update_set_filename(struct libmnt_update *upd, const char *filename, int userspace_only); diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c index bf9f8b71f..cc1bef84f 100644 --- a/libmount/src/optstr.c +++ b/libmount/src/optstr.c @@ -774,7 +774,10 @@ err: * * Returns: 0 on success, negative number in case of error. */ -int mnt_optstr_fix_secontext(char **optstr, char *value, size_t valsz, char **next) +int mnt_optstr_fix_secontext(char **optstr __attribute__ ((__unused__)), + char *value __attribute__ ((__unused__)), + size_t valsz __attribute__ ((__unused__)), + char **next __attribute__ ((__unused__))) { int rc = 0; diff --git a/login-utils/su.c b/login-utils/su.c index 20cc92912..68f1919bd 100644 --- a/login-utils/su.c +++ b/login-utils/su.c @@ -78,7 +78,9 @@ enum /* The user to become if none is specified. */ #define DEFAULT_USER "root" +#ifndef HAVE_ENVIRON_DECL extern char **environ; +#endif static void run_shell (char const *, char const *, char **, size_t) __attribute__ ((__noreturn__)); diff --git a/misc-utils/Makefile.am b/misc-utils/Makefile.am index 9dd358365..52d7e9864 100644 --- a/misc-utils/Makefile.am +++ b/misc-utils/Makefile.am @@ -56,9 +56,11 @@ dist_man_MANS += lsblk.8 lsblk_SOURCES = \ lsblk.c \ $(top_srcdir)/lib/at.c \ + $(top_srcdir)/lib/blkdev.c \ $(top_srcdir)/lib/canonicalize.c \ - $(top_srcdir)/lib/mbsalign.c \ + $(top_srcdir)/lib/linux_version.c \ $(top_srcdir)/lib/mangle.c \ + $(top_srcdir)/lib/mbsalign.c \ $(top_srcdir)/lib/strutils.c \ $(top_srcdir)/lib/sysfs.c \ $(top_srcdir)/lib/tt.c diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index 25e6c00e8..840cfe4f6 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -365,8 +365,10 @@ static int append_str(char **res, size_t *sz, const char *a, const char *b) return -1; str = realloc(str, len + 1); - if (!str) + if (!str) { + free(*res); return -1; + } *res = str; str += *sz; diff --git a/misc-utils/kill.c b/misc-utils/kill.c index c592f5203..8e2a1d87e 100644 --- a/misc-utils/kill.c +++ b/misc-utils/kill.c @@ -139,7 +139,6 @@ struct signv { #endif }; -int main (int argc, char *argv[]); extern char *mybasename(char *); int signame_to_signum (char *sig); int arg_to_signum (char *arg, int mask); @@ -149,8 +148,6 @@ void printsignals (FILE *fp); int usage (int status); int kill_verbose (char *procname, int pid, int sig); -extern int *get_pids (char *, int); - static char *progname; #ifdef HAVE_SIGQUEUE diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 9e894ef27..6746f85a1 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -512,24 +512,8 @@ static char *get_type(struct blkdev_cxt *cxt) } else { const char *type = cxt->partition ? "part" : "disk"; int x = 0; - sysfs_read_int(&cxt->sysfs, "device/type", &x); - - switch (x) { - case 0x0c: /* TYPE_RAID */ - type = "raid"; break; - case 0x01: /* TYPE_TAPE */ - type = "raid"; break; - case 0x04: /* TYPE_WORM */ - case 0x05: /* TYPE_ROM */ - type = "rom"; break; - case 0x07: /* TYPE_MOD */ - type = "mo-disk"; break; - case 0x0e: /* TYPE_RBC */ - type = "rbc"; break; - } - - res = xstrdup(type); + res = blkdev_scsi_type_to_name(x); } for (p = res; p && *p; p++) diff --git a/misc-utils/uuidd.rc b/misc-utils/uuidd.rc index dbdd5f5c3..d10fced4a 100644 --- a/misc-utils/uuidd.rc +++ b/misc-utils/uuidd.rc @@ -49,7 +49,7 @@ case "$1" in log_end_msg $? ;; status) - if pidofproc -p $PIDFILE $DAEMON >& /dev/null ; then + if pidofproc -p $PIDFILE $DAEMON >/dev/null 2>&1; then echo "$DAEMON is running"; exit 0; else diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c index e0ced2f69..259ca3766 100644 --- a/misc-utils/wipefs.c +++ b/misc-utils/wipefs.c @@ -56,8 +56,10 @@ struct wipe_desc { struct wipe_desc *next; }; -#define WP_MODE_PRETTY 0 /* default */ -#define WP_MODE_PARSABLE 1 +enum { + WP_MODE_PRETTY, /* default */ + WP_MODE_PARSABLE +}; static const char *type_pattern; @@ -117,6 +119,8 @@ print_all(struct wipe_desc *wp, int mode) case WP_MODE_PARSABLE: print_parsable(wp, n++); break; + default: + abort(); } wp = wp->next; } @@ -375,7 +379,8 @@ int main(int argc, char **argv) { struct wipe_desc *wp0 = NULL, *wp; - int c, all = 0, has_offset = 0, noact = 0, mode = 0, quiet = 0; + int c, all = 0, has_offset = 0, noact = 0, quiet = 0; + int mode = WP_MODE_PRETTY; static const struct option longopts[] = { { "all", 0, 0, 'a' }, diff --git a/mount/fstab.c b/mount/fstab.c index 043cc43e2..a39459138 100644 --- a/mount/fstab.c +++ b/mount/fstab.c @@ -578,7 +578,9 @@ static int lockfile_fd = -1; static int signals_have_been_setup = 0; /* Ensure that the lock is released if we are interrupted. */ +#ifndef HAVE_STRSIGNAL_DECL extern char *strsignal(int sig); /* not always in <string.h> */ +#endif static void handler (int sig) { diff --git a/partx/partx.8 b/partx/partx.8 index dd5ebe7be..86350c412 100644 --- a/partx/partx.8 +++ b/partx/partx.8 @@ -3,132 +3,171 @@ .\" Copyright 2007 Red Hat, Inc. .\" Copyright 2010 Davidlohr Bueso <dave@gnu.org> .\" May be distributed under the GNU General Public License -.TH PARTX 8 "February 2011" "util-linux" "System Administration" +.TH PARTX "8" "June 2012" "util-linux" "System Administration" .SH NAME -partx \- -tell the Linux kernel about the presence and numbering of on-disk partitions +partx \- tell the Linux kernel about the presence and numbering of +on-disk partitions .SH SYNOPSIS -.B partx -.RB [ \-a | \-d | \-s ] -.RB [ \-t -.IR TYPE ] -.RB [ \-n -.IR M:N ] -.RI [ \- ] -.I disk - -.B partx -.RB [ \-a | \-d | \-s ] -.RB [ \-t -.IR TYPE ] -.I partition -.RI [ disk ] - +partx [\-a|\-d|\-s] [\-t TYPE] [\-n M:N] [\-] disk +.br +partx [\-a|\-d|\-s] [\-t TYPE] partition [disk] .SH DESCRIPTION -Given a device or disk-image, \fBpartx\fP tries to parse the partition table and -list its contents. It optionally adds or removes partitions. - +Given a device or disk-image, +.B partx +tries to parse the partition table and list its contents. It +optionally adds or removes partitions. +.PP The .I disk -argument is optional when a -.I partition -argument is provided. To force scanning a partition as if it were a whole disk -(for example to list nested subpartitions), use the argument "-". For example: - -.RS -.br -.B partx \-\-show \- /dev/sda3 +argument is optional when a +.I partition +argument is provided. To force scanning a partition as if it were a +whole disk (for example to list nested subpartitions), use the argument +"-". For example: +.RS 7 +.TP +partx \-\-show \- /dev/sda3 .RE - +.PP This will see sda3 as a whole-disk rather than a partition. - -.B This is not an fdisk program -\-\- adding and removing partitions -does not change the disk, it just tells the kernel -about the presence and numbering of on-disk partitions. - +.PP +The +.B partx is not an fdisk program +\-\- adding and removing partitions does not change the disk, it just +tells the kernel about the presence and numbering of on-disk +partitions. .SH OPTIONS -.IP "\fB\-a, \-\-add\fP" +.IP "\fB\-a\fR, \fB\-\-add\fP" Add the specified partitions, or read the disk and add all partitions. -.IP "\fB\-b, \-\-bytes\fP" +.IP "\fB\-b\fR, \fB\-\-bytes\fP" Print the SIZE column in bytes rather than in human-readable format. -.IP "\fB\-d, \-\-delete\fP" +.IP "\fB\-d\fR, \fB\-\-delete\fP" Delete the specified partitions or all partitions. -.IP "\fB\-g, \-\-noheadings\fP" +.IP "\fB\-g\fR, \fB\-\-noheadings\fP" Do not print a header line. -.IP "\fB\-h, \-\-help\fP" +.IP "\fB\-h\fR, \fB\-\-help\fP" Print a help text and exit. -.IP "\fB\-l, \-\-list\fP" -List the partitions. Note that all numbers are in 512-byte sectors. This output -format is DEPRECATED in favour of \fB\-\-show\fP. Don't use it in newly written -scripts. -.IP "\fB\-o, \-\-output \fIlist\fP" -Define the output columns to use for \fB\-\-show\fP and \fB\-\-raw\fP output. -If no output arrangement is specified, then a default set is used. -Use \fB\-\-help\fP to get list of all supported columns. -.IP "\fB\-P, \-\-pairs\fP" -Use key="value" output format. -.IP "\fB\-n, \-\-nr \fIM:N\fP" -Specify the range of partitions. For backward compatibility also the format -<M-N> is supported. The range may contain negative -numbers, for example "--nr :-1" means the last partition, and "--nr -2:-1" means -the last two partitions. Supported range specifications are: -.RS +.IP "\fB\-l\fR, \fB\-\-list\fP" +List the partitions. Note that all numbers are in 512-byte sectors. +This output format is DEPRECATED in favour of +.BR \-\-show . +Do not use it in newly written scripts. +.IP "\fB\-o\fR, \fB\-\-output \fIlist\fP" +Define the output columns to use for +.B \-\-show +and +.B \-\-raw +output. If no output arrangement is specified, then a default set is +used. Use +.B \-\-help +to get +.I list +of all supported columns. This option cannot be combined with +.BR \-\-add , +.B \-\-delete +or +.B \-\-list +options. +.IP "\fB\-P\fR, \fB\-\-pairs\fP" +Output using key="value" format. +.IP "\fB\-n\fR, \fB\-\-nr \fIM:N\fP" +Specify the range of partitions. For backward compatibility also the +format +.I M-N +is supported. The range may contain negative numbers, for example +.BI \-\-nr \ :\-1 +means the last partition, and +.BI \-\-nr \ \-2:\-1 +means the last two partitions. Supported range specifications are: +.RS 14 .TP -.B <M> -Specifies just one partition (e.g. --nr 3). +.I M +Specifies just one partition (e.g. \fB\-\-nr\fR +.IR 3 ). .TP -.B <M:> -Specifies lower limit only (e.g. --nr 2:). +.I M: +Specifies lower limit only (e.g. \fB\-\-nr\fR +.IR 2: ). .TP -.B <:N> -Specifies upper limit only (e.g. --nr :4). +.I :N +Specifies upper limit only (e.g. \fB\-\-nr\fR +.IR :4 ). .TP -.B <M:N> -or -.B <M-N> -Specifies lower and upper limits (e.g. --nr 2:4). +.IR M:N \ or +.TQ +.I M-N +Specifies lower and upper limits (e.g. \fB--nr\fR +.IR 2:4 ). .RE -.IP "\fB\-r, \-\-raw\fP" +.IP "\fB\-r\fR, \fB\-\-raw\fP" Use the raw output format. -.IP "\fB\-s, \-\-show\fP" -List the partitions. All numbers (except SIZE) are in 512-byte sectors. The output -columns can be rearranged with the \fB\-\-output\fP option. -.IP "\fB\-t, \-\-type \fItype\fP" -Specify the partition table type -- aix, bsd, dos, gpt, mac, minix, sgi, solaris_x86, -sun, ultrix or unixware. -.IP "\fB\-v, \-\-verbose\fP" +.IP "\fB\-s\fR, \fB\-\-show\fP" +List the partitions. All numbers (except SIZE) are in 512-byte +sectors. The output columns can be rearranged with the +.B \-\-output +option. +.IP "\fB\-t\fR, \fB\-\-type \fItype\fP" +Specify the partition table type +.IR aix , +.IR bsd , +.IR dos , +.IR gpt , +.IR mac , +.IR minix , +.IR sgi , +.IR solaris_x86 , +.IR sun , +.I ultrix +or +.IR unixware . +.IP "\fB\-v\fR, \fB\-\-verbose\fP" Verbose mode. .SH EXAMPLES -.IP "\fBpartx \-\-show /dev/sdb3\fP" -.IP "\fBpartx \-\-show --nr 3 /dev/sdb\fP" -.IP "\fBpartx \-\-show /dev/sdb3 /dev/sdb\fP" +.TP +partx \-\-show /dev/sdb3 +.TQ +partx \-\-show --nr 3 /dev/sdb +.TQ +partx \-\-show /dev/sdb3 /dev/sdb All three commands list partition 3 of /dev/sdb. -.IP "\fBpartx \-\-show \- /dev/sdb3\fP" -Lists all subpartitions on /dev/sdb3 (the device is used as whole-disk). -.IP "\fBpartx \-o START -g --nr 3 /dev/sdb\fP" -Prints the start sector of partition 5 on /dev/sda without header. -.IP "\fBpartx \-o SECTORS,SIZE /dev/sda5 /dev/sda\fP" -Lists the length in sectors and human-readable size of partition 5 on /dev/sda. -.IP "\fBpartx \-\-add --nr 3:5 /dev/sdd\fP" +.TP +partx \-\-show \- /dev/sdb3 +Lists all subpartitions on /dev/sdb3 (the device is used as +whole-disk). +.TP +partx \-o START -g --nr 5 /dev/sdb +Prints the start sector of partition 5 on /dev/sdb without header. +.TP +partx \-o SECTORS,SIZE /dev/sda5 /dev/sda +Lists the length in sectors and human-readable size of partition 5 on +/dev/sda. +.TP +partx \-\-add --nr 3:5 /dev/sdd Adds all available partitions from 3 to 5 (inclusive) on /dev/sdd. -.IP "\fBpartx \-d --nr :-1 /dev/sdd\fP" +.TP +partx \-d --nr :-1 /dev/sdd Removes the last partition on /dev/sdd. - .SH SEE ALSO .BR addpart (8), .BR delpart (8), .BR fdisk (8), .BR parted (8), .BR partprobe (8) - .SH AUTHORS -.nf -Davidlohr Bueso <dave@gnu.org> -Karel Zak <kzak@redhat.com> -.fi - -The original version was written by Andries E. Brouwer <aeb@cwi.nl>. +.MT dave@gnu.org +Davidlohr Bueso +.ME +.br +.MT kzak@redhat.com +Karel Zak +.ME +.PP +The original version was written by +.MT aeb@cwi.nl +Andries E. Brouwer +.ME . .SH AVAILABILITY The partx command is part of the util-linux package and is available from -ftp://ftp.kernel.org/pub/linux/utils/util-linux/. +.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/ +Linux Kernel Archive +.UE . diff --git a/sys-utils/eject.c b/sys-utils/eject.c index 096f37090..f621b062e 100644 --- a/sys-utils/eject.c +++ b/sys-utils/eject.c @@ -435,6 +435,14 @@ static void toggle_tray(int fd) if (eject_cdrom(fd)) err(EXIT_FAILURE, _("CD-ROM eject command failed")); return; + case CDS_NO_INFO: + warnx(_("no CD-ROM information available")); + return; + case CDS_DRIVE_NOT_READY: + warnx(_("CD-ROM drive is not ready")); + return; + default: + abort(); } #endif diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c index 97269f45a..a0c6ea81f 100644 --- a/sys-utils/setarch.c +++ b/sys-utils/setarch.c @@ -259,12 +259,12 @@ int main(int argc, char *argv[]) p = program_invocation_short_name; if (!strcmp(p, "setarch")) { - argv++; argc--; if (argc < 1) show_usage(_("Not enough arguments")); - p = argv[0]; - argv[0] = argv[-1]; /* for getopt_long() to get the program name */ + p = argv[1]; + argv[1] = argv[0]; /* for getopt_long() to get the program name */ + argv++; if (!strcmp(p, "-h") || !strcmp(p, "--help")) show_help(); else if (!strcmp(p, "-V") || !strcmp(p, "--version")) diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 9101e7fd3..862b8c49d 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -533,8 +533,6 @@ static void login_options_to_argv(char *argv[], int *argc, /* Parse command-line arguments. */ static void parse_args(int argc, char **argv, struct options *op) { - extern char *optarg; - extern int optind; int c; enum { diff --git a/term-utils/script.c b/term-utils/script.c index 07be7e987..05d9f8541 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -158,7 +158,6 @@ int main(int argc, char **argv) { sigset_t block_mask, unblock_mask; struct sigaction sa; - extern int optind; int ch; FILE *timingfd = stderr; diff --git a/term-utils/wall.c b/term-utils/wall.c index 3255a5166..996650638 100644 --- a/term-utils/wall.c +++ b/term-utils/wall.c @@ -93,7 +93,6 @@ static void __attribute__((__noreturn__)) usage(FILE *out) int main(int argc, char **argv) { - extern int optind; int ch; struct iovec iov; struct utmp *utmpptr; |