sync with RHEL4, add new things from Suse

This commit is contained in:
kzak 2006-06-12 11:38:50 +00:00
parent d6dc3e6f70
commit 0c223bc707
11 changed files with 1244 additions and 5 deletions

View File

@ -0,0 +1,28 @@
--- util-linux-2.12a/disk-utils/raw.8.dd 2006-04-24 15:27:39.000000000 +0200
+++ util-linux-2.12a/disk-utils/raw.8 2006-04-24 15:53:46.000000000 +0200
@@ -15,6 +15,12 @@
.PP
.B raw
.B \-qa
+.SH WARNING
+Although Linux includes support for rawio, it is now a deprecated interface. If
+your application performs device access using this interface, Red Hat
+encourages you to modify your application to open the block device with the
+O_DIRECT flag. The rawio interface will exist for the life of Red Hat
+Enterprise Linux 4, but is a candidate for removal from future releases.
.SH DESCRIPTION
.B raw
is used to bind a Linux raw character device to a block device. Any
@@ -82,8 +88,10 @@
.SH BUGS
The Linux
.B dd
-(1) command does not currently align its buffers correctly, and so
-cannot be used on raw devices.
+(1) command should be used without bs= option or the blocksize needs to be a
+multiple of the sector size of the device (512 bytes usually) otherwise it
+will fail with "Invalid Argument" messages (EINVAL).
+
.PP
Raw I/O devices do not maintain cache coherency with the Linux block
device buffer cache. If you use raw I/O to overwrite data already in

View File

@ -0,0 +1,236 @@
--- util-linux-2.13-pre7/include/widechar.h.kzak 2005-08-01 20:18:35.000000000 +0200
+++ util-linux-2.13-pre7/include/widechar.h 2006-03-29 19:38:56.000000000 +0200
@@ -2,7 +2,7 @@
/* This file must be included last because the redefinition of wchar_t may
cause conflicts when system include files were included after it. */
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
# include <wchar.h>
# include <wctype.h>
--- util-linux-2.13-pre7/misc-utils/cal.c.kzak 2006-03-29 19:40:26.000000000 +0200
+++ util-linux-2.13-pre7/misc-utils/cal.c 2006-03-29 19:40:34.000000000 +0200
@@ -355,7 +355,7 @@
exit(0);
}
-#ifndef ENABLE_WIDECHAR
+#ifndef HAVE_WIDECHAR
static char *eos(char *s) {
while (s && *s)
s++;
@@ -366,14 +366,14 @@
void headers_init(void)
{
int i, wd;
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
wchar_t day_headings_wc[22],j_day_headings_wc[29];
char *cur_dh = day_headings, *cur_j_dh = j_day_headings;
#endif
strcpy(day_headings,"");
strcpy(j_day_headings,"");
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
wcscpy(day_headings_wc,L"");
wcscpy(j_day_headings_wc,L"");
#endif
@@ -387,7 +387,7 @@
for(i = 0 ; i < 7 ; i++ ) {
ssize_t space_left;
wd = (i + week1stday) % 7;
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
swprintf(day_headings_wc, sizeof(day_headings_wc)/sizeof(day_headings_wc[0]),
L"%1.2s ", weekday(wd));
swprintf(j_day_headings_wc, sizeof(j_day_headings_wc)/sizeof(j_day_headings_wc[0]),
@@ -718,7 +718,7 @@
void
center_str(const char* src, char* dest, size_t dest_size, int width)
{
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
wchar_t str_wc[FMT_ST_CHARS];
#endif
char str[FMT_ST_CHARS];
@@ -727,7 +727,7 @@
len = strlen(src);
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (mbstowcs(str_wc, src, FMT_ST_CHARS) > 0) {
wide_char_enabled = 1;
len = wcswidth(str_wc, SIZE(str_wc));
@@ -736,7 +736,7 @@
if (len > width) {
str_to_print=str;
if (wide_char_enabled) {
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
str_wc[width]=L'\0';
wcstombs(str, str_wc, SIZE(str));
#endif
--- util-linux-2.13-pre7/text-utils/column.c.kzak 2006-03-29 19:41:20.000000000 +0200
+++ util-linux-2.13-pre7/text-utils/column.c 2006-03-29 19:41:25.000000000 +0200
@@ -52,7 +52,7 @@
#include "widechar.h"
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
#define wcs_width(s) wcswidth(s,wcslen(s))
static wchar_t *mbs_to_wcs(const char *);
#else
@@ -312,7 +312,7 @@
}
}
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
static wchar_t *mbs_to_wcs(const char *s)
{
size_t n;
@@ -330,7 +330,7 @@
}
#endif
-#ifndef ENABLE_WIDECHAR
+#ifndef HAVE_WIDECHAR
static char *mtsafe_strtok(char *str, const char *delim, char **ptr)
{
if (str == NULL) {
--- util-linux-2.13-pre7/text-utils/pg.c.kzak 2006-03-29 19:41:52.000000000 +0200
+++ util-linux-2.13-pre7/text-utils/pg.c 2006-03-29 19:41:59.000000000 +0200
@@ -255,7 +255,7 @@
usage();
}
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
/*
* A mbstowcs()-alike function that transparently handles invalid sequences.
*/
@@ -402,7 +402,7 @@
return 0;
}
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
/*
* Return the last character that will fit on the line at col columns
* in case MB_CUR_MAX > 1.
@@ -489,7 +489,7 @@
unsigned pos = 0;
char *t = s;
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (MB_CUR_MAX > 1)
return endline_for_mb(col, s);
#endif
@@ -776,7 +776,7 @@
cmd.count = getcount(cmd.cmdline);
}
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
/*
* Remove backspace formatting, for searches
* in case MB_CUR_MAX > 1.
@@ -817,7 +817,7 @@
{
char *p = s, *q;
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (MB_CUR_MAX > 1)
return colb_for_mb(s);
#endif
@@ -836,7 +836,7 @@
return s;
}
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
/*
* Convert nonprintable characters to spaces
* in case MB_CUR_MAX > 1.
@@ -867,7 +867,7 @@
static void
makeprint(char *s, size_t l)
{
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (MB_CUR_MAX > 1)
return makeprint_for_mb(s, l);
#endif
--- util-linux-2.13-pre7/text-utils/more.c.kzak 2006-03-29 19:41:01.000000000 +0200
+++ util-linux-2.13-pre7/text-utils/more.c 2006-03-29 19:41:08.000000000 +0200
@@ -782,7 +782,7 @@
int column;
static int colflg;
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
int i;
wchar_t wc;
int wc_width;
@@ -805,7 +805,7 @@
c = Getc (f);
}
while (p < &Line[LINSIZ - 1]) {
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (fold_opt && use_mbc_buffer_flag && MB_CUR_MAX > 1) {
use_mbc_buffer_flag = 0;
state_bak = state;
@@ -923,7 +923,7 @@
*length = p - Line;
return (column);
} else {
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (fold_opt && MB_CUR_MAX > 1) {
memset (mbc, '\0', MB_LEN_MAX);
mbc_pos = 0;
@@ -1054,7 +1054,7 @@
my_putstring(state ? ULenter : ULexit);
}
if (c != ' ' || pstate == 0 || state != 0 || ulglitch == 0)
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
{
wchar_t wc;
size_t mblength;
@@ -1070,7 +1070,7 @@
}
#else
putchar(c);
-#endif /* ENABLE_WIDECHAR */
+#endif /* HAVE_WIDECHAR */
if (state && *chUL) {
putsout(chBS);
my_putstring(chUL);
@@ -1867,7 +1867,7 @@
}
else if (((cc_t) c == otty.c_cc[VERASE]) && !slash) {
if (sp > buf) {
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
if (MB_CUR_MAX > 1)
{
wchar_t wc;
--- util-linux-2.13-pre7/text-utils/ul.c.kzak 2006-03-29 19:42:09.000000000 +0200
+++ util-linux-2.13-pre7/text-utils/ul.c 2006-03-29 19:42:25.000000000 +0200
@@ -50,7 +50,7 @@
#include "widechar.h"
-#ifdef ENABLE_WIDECHAR
+#ifdef HAVE_WIDECHAR
static int put1wc(int c) /* Output an ASCII character as a wide character */
{
if (putwchar(c) == WEOF)

View File

@ -0,0 +1,103 @@
--- util-linux-2.13-pre6/fdisk/sfdisk.c.isfull 2006-06-12 13:31:46.000000000 +0200
+++ util-linux-2.13-pre6/fdisk/sfdisk.c 2006-06-12 13:31:47.000000000 +0200
@@ -2413,19 +2413,6 @@
return is_ide;
}
-static int
-is_probably_full_disk(char *name) {
- struct hd_geometry geometry;
- int fd, i = 0;
-
- fd = open(name, O_RDONLY);
- if (fd >= 0) {
- i = ioctl(fd, HDIO_GETGEO, &geometry);
- close(fd);
- }
- return (fd >= 0 && i == 0 && geometry.start == 0);
-}
-
#define PROC_PARTITIONS "/proc/partitions"
static FILE *procf = NULL;
--- util-linux-2.13-pre6/fdisk/common.h.isfull 2004-09-06 20:07:11.000000000 +0200
+++ util-linux-2.13-pre6/fdisk/common.h 2006-06-12 13:31:47.000000000 +0200
@@ -28,5 +28,6 @@
extern struct systypes i386_sys_types[];
extern char *partname(char *dev, int pno, int lth);
+extern int is_probably_full_disk(char *name);
int disksize(int fd, unsigned long long *sectors);
--- util-linux-2.13-pre6/fdisk/partname.c.isfull 2002-07-07 14:16:43.000000000 +0200
+++ util-linux-2.13-pre6/fdisk/partname.c 2006-06-12 13:32:54.000000000 +0200
@@ -1,6 +1,9 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "common.h"
/*
@@ -45,3 +48,30 @@
partname(char *dev, int pno, int lth) {
return partnamebf(dev, pno, lth, 0, NULL);
}
+
+int
+is_probably_full_disk(char *name) {
+#ifdef HDIO_GETGEO
+ struct hd_geometry geometry;
+ int fd, i = 0;
+
+ fd = open(name, O_RDONLY);
+ if (fd >= 0) {
+ i = ioctl(fd, HDIO_GETGEO, &geometry);
+ close(fd);
+ }
+ if (i==0)
+ return (fd >= 0 && geometry.start == 0);
+ /*
+ * "silly heuristic" is still so sexy for us, because
+ * for example Xen doesn't implement HDIO_GETGEO for virtual
+ * block devices (/dev/xvda).
+ * -- kzak@redhat.com (23-Feb-2006)
+ */
+#endif
+ /* silly heuristic */
+ while (*name)
+ name++;
+ return !isdigit(name[-1]);
+}
+
--- util-linux-2.13-pre6/fdisk/fdisk.c.isfull 2006-06-12 13:31:47.000000000 +0200
+++ util-linux-2.13-pre6/fdisk/fdisk.c 2006-06-12 13:31:47.000000000 +0200
@@ -788,26 +788,6 @@
#endif
}
-static int
-is_probably_full_disk(char *name) {
-#ifdef HDIO_GETGEO
- struct hd_geometry geometry;
- int fd, i = 0;
-
- fd = open(name, O_RDONLY);
- if (fd >= 0) {
- i = ioctl(fd, HDIO_GETGEO, &geometry);
- close(fd);
- }
- return (fd >= 0 && i == 0 && geometry.start == 0);
-#else
- /* silly heuristic */
- while (*name)
- name++;
- return !isdigit(name[-1]);
-#endif
-}
-
static void
get_partition_table_geometry(void) {
unsigned char *bufp = MBRbuffer;

View File

@ -0,0 +1,345 @@
--- util-linux-2.13-pre6/fdisk/fdisk.h.sectors 2006-06-12 10:50:11.000000000 +0200
+++ util-linux-2.13-pre6/fdisk/fdisk.h 2006-06-12 10:50:52.000000000 +0200
@@ -81,8 +81,8 @@
#define SINGULAR 1
extern char *const str_units(int);
-extern unsigned int get_start_sect(struct partition *p);
-extern unsigned int get_nr_sects(struct partition *p);
+extern unsigned long long get_start_sect(struct partition *p);
+extern unsigned long long get_nr_sects(struct partition *p);
extern int osf_label;
--- util-linux-2.13-pre6/fdisk/fdisksgilabel.h.sectors 2004-12-14 00:39:29.000000000 +0100
+++ util-linux-2.13-pre6/fdisk/fdisksgilabel.h 2006-06-12 10:50:52.000000000 +0200
@@ -103,8 +103,9 @@
/* fdisk.c */
#define sgilabel ((sgi_partition *)MBRbuffer)
#define sgiparam (sgilabel->devparam)
-extern char MBRbuffer[MAX_SECTOR_SIZE];
-extern unsigned int heads, sectors, cylinders, sector_size;
+extern unsigned char MBRbuffer[MAX_SECTOR_SIZE];
+extern unsigned int heads, cylinders, sector_size;
+extern unsigned long long sectors;
extern int show_begin;
extern int sgi_label;
extern char *partition_type(unsigned char type);
--- util-linux-2.13-pre6/fdisk/fdisksunlabel.h.sectors 2004-12-14 00:39:18.000000000 +0100
+++ util-linux-2.13-pre6/fdisk/fdisksunlabel.h 2006-06-12 10:50:52.000000000 +0200
@@ -37,8 +37,9 @@
: (__u32)(x))
/* fdisk.c */
-extern char MBRbuffer[MAX_SECTOR_SIZE];
-extern unsigned int heads, sectors, cylinders;
+extern unsigned char MBRbuffer[MAX_SECTOR_SIZE];
+extern unsigned int heads, cylinders;
+extern unsigned long long sectors;
extern int show_begin;
extern int sun_label;
extern char *partition_type(unsigned char type);
--- util-linux-2.13-pre6/fdisk/fdiskaixlabel.h.sectors 2004-12-14 00:39:47.000000000 +0100
+++ util-linux-2.13-pre6/fdisk/fdiskaixlabel.h 2006-06-12 10:50:52.000000000 +0200
@@ -19,9 +19,10 @@
/* fdisk.c */
#define aixlabel ((aix_partition *)MBRbuffer)
-extern char MBRbuffer[MAX_SECTOR_SIZE];
+extern unsigned char MBRbuffer[MAX_SECTOR_SIZE];
extern char changed[MAXIMUM_PARTS];
-extern unsigned int heads, sectors, cylinders;
+extern unsigned int heads, cylinders;
+extern unsigned long long sectors;
extern int show_begin;
extern int aix_label;
extern char *partition_type(unsigned char type);
--- util-linux-2.13-pre6/fdisk/fdisksunlabel.c.sectors 2005-07-31 18:00:29.000000000 +0200
+++ util-linux-2.13-pre6/fdisk/fdisksunlabel.c 2006-06-12 10:50:52.000000000 +0200
@@ -348,7 +348,7 @@
}
snprintf(sunlabel->info, sizeof(sunlabel->info),
- "%s%s%s cyl %d alt %d hd %d sec %d",
+ "%s%s%s cyl %d alt %d hd %d sec %llu",
p ? p->vendor : "", (p && *p->vendor) ? " " : "",
p ? p->model
: (floppy ? _("3,5\" floppy") : _("Linux custom")),
@@ -655,7 +655,7 @@
w = strlen(disk_device);
if (xtra)
printf(
- _("\nDisk %s (Sun disk label): %d heads, %d sectors, %d rpm\n"
+ _("\nDisk %s (Sun disk label): %d heads, %llu sectors, %d rpm\n"
"%d cylinders, %d alternate cylinders, %d physical cylinders\n"
"%d extra sects/cyl, interleave %d:1\n"
"%s\n"
@@ -669,7 +669,7 @@
str_units(PLURAL), units_per_sector);
else
printf(
- _("\nDisk %s (Sun disk label): %d heads, %d sectors, %d cylinders\n"
+ _("\nDisk %s (Sun disk label): %d heads, %llu sectors, %d cylinders\n"
"Units = %s of %d * 512 bytes\n\n"),
disk_device, heads, sectors, cylinders,
str_units(PLURAL), units_per_sector);
--- util-linux-2.13-pre6/fdisk/fdisk.c.sectors 2006-06-12 10:50:11.000000000 +0200
+++ util-linux-2.13-pre6/fdisk/fdisk.c 2006-06-12 10:51:53.000000000 +0200
@@ -64,7 +64,7 @@
/* A valid partition table sector ends in 0x55 0xaa */
static unsigned int
-part_table_flag(char *b) {
+part_table_flag(unsigned char *b) {
return ((unsigned int) b[510]) + (((unsigned int) b[511]) << 8);
}
@@ -74,7 +74,7 @@
}
static void
-write_part_table_flag(char *b) {
+write_part_table_flag(unsigned char *b) {
b[510] = 0x55;
b[511] = 0xaa;
}
@@ -101,17 +101,17 @@
store4_little_endian(p->start4, start_sect);
}
-unsigned int
+unsigned long long
get_start_sect(struct partition *p) {
return read4_little_endian(p->start4);
}
static void
-set_nr_sects(struct partition *p, unsigned int nr_sects) {
+set_nr_sects(struct partition *p, unsigned long long nr_sects) {
store4_little_endian(p->size4, nr_sects);
}
-unsigned int
+unsigned long long
get_nr_sects(struct partition *p) {
return read4_little_endian(p->size4);
}
@@ -123,7 +123,7 @@
* Raw disk label. For DOS-type partition tables the MBR,
* with descriptions of the primary partitions.
*/
-char MBRbuffer[MAX_SECTOR_SIZE];
+unsigned char MBRbuffer[MAX_SECTOR_SIZE];
/*
* per partition table entry data
@@ -137,8 +137,8 @@
struct partition *part_table; /* points into sectorbuffer */
struct partition *ext_pointer; /* points into sectorbuffer */
char changed; /* boolean */
- unsigned int offset; /* disk sector number */
- char *sectorbuffer; /* disk sector contents */
+ unsigned long long offset; /* disk sector number */
+ unsigned char *sectorbuffer; /* disk sector contents */
} ptes[MAXIMUM_PARTS];
char *disk_device, /* must be specified */
@@ -157,15 +157,14 @@
unsigned int pt_heads, pt_sectors;
unsigned int kern_heads, kern_sectors;
+unsigned long long sector_offset = 1, extended_offset = 0, sectors;
+
unsigned int heads,
- sectors,
cylinders,
sector_size = DEFAULT_SECTOR_SIZE,
user_set_sector_size = 0,
- sector_offset = 1,
units_per_sector = 1,
- display_in_cyl_units = 1,
- extended_offset = 0; /* offset of link pointers */
+ display_in_cyl_units = 1;
unsigned long long total_number_of_sectors;
@@ -242,21 +241,21 @@
}
static void
-seek_sector(int fd, unsigned int secno) {
+seek_sector(int fd, unsigned long long secno) {
off_t offset = (off_t) secno * sector_size;
if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
fatal(unable_to_seek);
}
static void
-read_sector(int fd, unsigned int secno, char *buf) {
+read_sector(int fd, unsigned long long secno, char *buf) {
seek_sector(fd, secno);
if (read(fd, buf, sector_size) != sector_size)
fatal(unable_to_read);
}
static void
-write_sector(int fd, unsigned int secno, char *buf) {
+write_sector(int fd, unsigned long long secno, char *buf) {
seek_sector(fd, secno);
if (write(fd, buf, sector_size) != sector_size)
fatal(unable_to_write);
@@ -264,11 +263,11 @@
/* Allocate a buffer and read a partition table sector */
static void
-read_pte(int fd, int pno, unsigned int offset) {
+read_pte(int fd, int pno, unsigned long long offset) {
struct pte *pe = &ptes[pno];
pe->offset = offset;
- pe->sectorbuffer = (char *) malloc(sector_size);
+ pe->sectorbuffer = malloc(sector_size);
if (!pe->sectorbuffer)
fatal(out_of_memory);
read_sector(fd, offset, pe->sectorbuffer);
@@ -276,7 +275,7 @@
pe->part_table = pe->ext_pointer = NULL;
}
-static unsigned int
+static unsigned long long
get_partition_start(struct pte *pe) {
return pe->offset + get_start_sect(pe->part_table);
}
@@ -542,10 +541,10 @@
}
static void
-set_partition(int i, int doext, unsigned int start, unsigned int stop,
- int sysid) {
+set_partition(int i, int doext, unsigned long long start,
+ unsigned long long stop, int sysid) {
struct partition *p;
- unsigned int offset;
+ unsigned long long offset;
if (doext) {
p = ptes[i].ext_pointer;
@@ -1544,7 +1543,7 @@
else
printf(_("\nDisk %s: %ld.%ld GB, %lld bytes\n"),
disk_device, megabytes/1000, (megabytes/100)%10, bytes);
- printf(_("%d heads, %d sectors/track, %d cylinders"),
+ printf(_("%d heads, %Ld sectors/track, %d cylinders"),
heads, sectors, cylinders);
if (units_per_sector == 1)
printf(_(", total %llu sectors"),
@@ -1776,20 +1775,21 @@
struct partition *p;
int i;
- printf(_("\nDisk %s: %d heads, %d sectors, %d cylinders\n\n"),
+ printf(_("\nDisk %s: %d heads, %Ld sectors, %d cylinders\n\n"),
disk_device, heads, sectors, cylinders);
printf(_("Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n"));
for (i = 0 ; i < partitions; i++) {
pe = &ptes[i];
p = (extend ? pe->ext_pointer : pe->part_table);
if (p != NULL) {
- printf("%2d %02x%4d%4d%5d%4d%4d%5d%11u%11u %02x\n",
+ printf("%2d %02x%4d%4d%5d%4d%4d%5d%11lu%11lu %02x\n",
i + 1, p->boot_ind, p->head,
sector(p->sector),
cylinder(p->sector, p->cyl), p->end_head,
sector(p->end_sector),
cylinder(p->end_sector, p->end_cyl),
- get_start_sect(p), get_nr_sects(p), p->sys_ind);
+ (unsigned long) get_start_sect(p),
+ (unsigned long) get_nr_sects(p), p->sys_ind);
if (p->sys_ind)
check_consistency(p, i);
}
@@ -1797,7 +1797,7 @@
}
static void
-fill_bounds(unsigned int *first, unsigned int *last) {
+fill_bounds(unsigned long long *first, unsigned long long *last) {
int i;
struct pte *pe = &ptes[0];
struct partition *p;
@@ -1830,7 +1830,7 @@
n, h + 1, heads);
if (real_s >= sectors)
fprintf(stderr, _("Partition %d: sector %d greater than "
- "maximum %d\n"), n, s, sectors);
+ "maximum %Ld\n"), n, s, sectors);
if (real_c >= cylinders)
fprintf(stderr, _("Partitions %d: cylinder %d greater than "
"maximum %d\n"), n, real_c + 1, cylinders);
@@ -1843,8 +1843,8 @@
static void
verify(void) {
int i, j;
- unsigned int total = 1;
- unsigned int first[partitions], last[partitions];
+ unsigned long total = 1;
+ unsigned long long first[partitions], last[partitions];
struct partition *p;
if (warn_geometry())
@@ -1888,7 +1888,7 @@
if (extended_offset) {
struct pte *pex = &ptes[ext_index];
- unsigned int e_last = get_start_sect(pex->part_table) +
+ unsigned long long e_last = get_start_sect(pex->part_table) +
get_nr_sects(pex->part_table) - 1;
for (i = 4; i < partitions; i++) {
@@ -1907,8 +1907,8 @@
}
if (total > total_number_of_sectors)
- printf(_("Total allocated sectors %d greater than the maximum "
- "%lld\n"), total, total_number_of_sectors);
+ printf(_("Total allocated sectors %ld greater than the maximum"
+ " %lld\n"), total, total_number_of_sectors);
else if (total < total_number_of_sectors)
printf(_("%lld unallocated sectors\n"),
total_number_of_sectors - total);
@@ -1921,7 +1921,7 @@
struct partition *p = ptes[n].part_table;
struct partition *q = ptes[ext_index].part_table;
long long llimit;
- unsigned int start, stop = 0, limit, temp,
+ unsigned long long start, stop = 0, limit, temp,
first[partitions], last[partitions];
if (p && p->sys_ind) {
@@ -1967,7 +1967,7 @@
if (start > limit)
break;
if (start >= temp+units_per_sector && read) {
- printf(_("Sector %d is already allocated\n"), temp);
+ printf(_("Sector %llu is already allocated\n"), temp);
temp = start;
read = 0;
}
@@ -2225,14 +2225,14 @@
#define MAX_PER_LINE 16
static void
-print_buffer(char pbuffer[]) {
+print_buffer(unsigned char pbuffer[]) {
int i,
l;
for (i = 0, l = 0; i < sector_size; i++, l++) {
if (l == 0)
printf("0x%03X:", i);
- printf(" %02X", (unsigned char) pbuffer[i]);
+ printf(" %02X", pbuffer[i]);
if (l == MAX_PER_LINE - 1) {
printf("\n");
l = -1;

View File

@ -0,0 +1,17 @@
gcc 4.1.0: "warning: memset used with constant zero length parameter; this
could be due to transposed parameters". So, fix it!
-- 03/30/2006 Karel Zak <kzak@redhat.com>
--- util-linux-2.13-pre7/text-utils/display.c.gcc 2006-03-31 10:44:50.000000000 +0200
+++ util-linux-2.13-pre7/text-utils/display.c 2006-03-31 10:45:22.000000000 +0200
@@ -255,7 +255,8 @@
(void)printf("*\n");
return(NULL);
}
- memset((char *)curp + nread, 0, need);
+ if (need > 0)
+ memset((char *)curp + nread, 0, need);
eaddress = address + nread;
return(curp);
}

View File

@ -0,0 +1,153 @@
This patch adds to the mount man page docs about context, fscontext and
defcontext mount options and translate context options from human to raw
selinux context format. -- 03/30/2006 Karel Zak <kzak@redhat.com>
--- util-linux-2.13-pre7/mount/mount.8.cxt 2006-03-30 17:15:06.000000000 +0200
+++ util-linux-2.13-pre7/mount/mount.8 2006-03-30 17:15:06.000000000 +0200
@@ -661,6 +661,50 @@
.BR noexec ", " nosuid ", and " nodev
(unless overridden by subsequent options, as in the option line
.BR users,exec,dev,suid ).
+.TP
+\fBcontext=\fP\fIcontext\fP, \fBfscontext=\fP\fIcontext\fP and \fBdefcontext=\fP\fIcontext\fP
+The
+.BR context=
+option is useful when mounting filesystems that do not support
+extended attributes, such as a floppy or hard disk formatted with VFAT, or
+systems that are not normally running under SELinux, such as an ext3 formatted
+disk from a non-SELinux workstation. You can also use
+.BR context=
+on filesystems you do not trust, such as a floppy. It also helps in compatibility with
+xattr-supporting filesystems on earlier 2.4.<x> kernel versions. Even where
+xattrs are supported, you can save time not having to label every file by
+assigning the entire disk one security context.
+
+A commonly used option for removable media is
+.BR context=system_u:object_r:removable_t .
+
+Two other options are
+.BR fscontext=
+and
+.BR defcontext= ,
+both of which are mutually exclusive of the context option. This means you
+can use fscontext and defcontext with each other, but neither can be used with
+context.
+
+The
+.BR fscontext=
+option works for all filesystems, regardless of their xattr
+support. The fscontext option sets the overarching filesystem label to a
+specific security context. This filesystem label is separate from the
+individual labels on the files. It represents the entire filesystem for
+certain kinds of permission checks, such as during mount or file creation.
+Individual file labels are still obtained from the xattrs on the files
+themselves. The context option actually sets the aggregate context that
+fscontext provides, in addition to supplying the same label for individual
+files.
+
+You can set the default security context for unlabeled files using
+.BR defcontext=
+option. This overrides the value set for unlabeled files in the policy and requires a
+file system that supports xattr labeling.
+
+For more details see
+.BR selinux (8)
.RE
.TP
.B \-\-bind
--- util-linux-2.13-pre7/mount/mount.c.cxt 2006-03-30 17:15:06.000000000 +0200
+++ util-linux-2.13-pre7/mount/mount.c 2006-03-30 20:16:57.000000000 +0200
@@ -21,6 +21,11 @@
#include <sys/wait.h>
#include <sys/mount.h>
+#ifdef HAVE_LIBSELINUX
+#include <selinux/selinux.h>
+#include <selinux/context.h>
+#endif
+
#include "mount_blkid.h"
#include "mount_constants.h"
#include "sundries.h"
@@ -255,6 +260,49 @@
free((void *) s);
}
+#ifdef HAVE_LIBSELINUX
+/* translates SELinux context from human to raw format and
+ * appends it to the mount extra options.
+ *
+ * returns -1 on error and 0 on success
+ */
+static int
+append_context(const char *optname, const char *optdata, char *extra_opts, int *len)
+{
+ security_context_t raw = NULL;
+ char *buf = NULL;
+ int bufsz;
+
+ if (!is_selinux_enabled())
+ /* ignore the option if we running without selinux */
+ return 0;
+
+ if (optdata==NULL || *optdata=='\0' || optname==NULL)
+ return -1;
+
+ if (selinux_trans_to_raw_context(
+ (security_context_t) optdata, &raw)==-1 ||
+ raw==NULL)
+ return -1;
+
+ if (verbose)
+ printf(_("mount: translated %s '%s' to '%s'\n"),
+ optname, optdata, (char *) raw);
+
+ bufsz = strlen(optname) + strlen(raw) + 2; /* 2 is \0 and '=' */
+ buf = xmalloc(bufsz);
+
+ snprintf(buf, bufsz, "%s=%s", optname, (char *) raw);
+ freecon(raw);
+
+ if ((*len -= bufsz-1) > 0)
+ strcat(extra_opts, buf);
+
+ my_free(buf);
+ return 0;
+}
+#endif
+
/*
* Look for OPT in opt_map table and return mask value.
* If OPT isn't found, tack it onto extra_opts (which is non-NULL).
@@ -313,7 +361,20 @@
return;
}
}
-
+#ifdef HAVE_LIBSELINUX
+ if (strncmp(opt, "context=", 8)==0 && *(opt+8)) {
+ if (append_context("context", opt+8, extra_opts, &len)==0)
+ return;
+ }
+ if (strncmp(opt, "fscontext=", 10)==0 && *(opt+10)) {
+ if (append_context("fscontext", opt+10, extra_opts, &len)==0)
+ return;
+ }
+ if (strncmp(opt, "defcontext=", 11)==0 && *(opt+11)) {
+ if (append_context("defcontext", opt+11, extra_opts, &len)==0)
+ return;
+ }
+#endif
if ((len -= strlen(opt)) > 0)
strcat(extra_opts, opt);
}
@@ -330,7 +391,7 @@
if (options != NULL) {
char *opts = xstrdup(options);
char *opt;
- int len = strlen(opts) + 20;
+ int len = strlen(opts) + 256;
*extra_opts = xmalloc(len);
**extra_opts = '\0';

View File

@ -0,0 +1,39 @@
--- util-linux-2.13-pre7/mount/nfs.5.bugs 2006-03-30 21:37:53.000000000 +0200
+++ util-linux-2.13-pre7/mount/nfs.5 2006-03-30 21:38:13.000000000 +0200
@@ -443,3 +443,10 @@
.P
The umount command should notify the server
when an NFS filesystem is unmounted.
+.P
+Checking files on NFS filesystem referenced by file descriptors (i.e. the
+.BR fcntl
+and
+.BR ioctl
+families of functions) may lead to inconsistent result due to the lack of
+consistency check in kernel even if noac is used.
--- util-linux-2.13-pre7/mount/mount.8.bugs 2006-03-30 21:36:56.000000000 +0200
+++ util-linux-2.13-pre7/mount/mount.8 2006-03-30 21:37:35.000000000 +0200
@@ -2047,6 +2047,23 @@
.IR /proc/partitions .
In particular, it may well fail if the kernel was compiled with devfs
but devfs is not mounted.
+.PP
+It is possible that files
+.IR /etc/mtab
+and
+.IR /proc/mounts
+don't match. The first file is based only on the mount command options, but the
+content of the second file also depends on the kernel and others settings (e.g.
+remote NFS server. In particular case the mount command may reports unreliable
+information about a NFS mount point and the /proc/mounts file usually contains
+more reliable information.)
+.PP
+Checking files on NFS filesystem referenced by file descriptors (i.e. the
+.BR fcntl
+and
+.BR ioctl
+families of functions) may lead to inconsistent result due to the lack of
+consistency check in kernel even if noac is used.
.SH HISTORY
A
.B mount

View File

@ -0,0 +1,28 @@
--- util-linux-2.13-pre6/mount/mount.c.move 2006-06-12 09:19:43.000000000 +0200
+++ util-linux-2.13-pre6/mount/mount.c 2006-06-12 09:45:05.000000000 +0200
@@ -768,6 +768,25 @@
else {
mntFILE *mfp;
+ /* when moving a mount point, we have to make sure the mtab
+ * gets updated properly. We get info about the old mount
+ * point, copy it to the new mount point, and then delete
+ * the old mount point. */
+ if (flags & MS_MOVE) {
+ const char *olddir = mnt.mnt_fsname;
+ struct mntentchn *oldmc = oldmc = getmntfile(olddir);
+ if (oldmc != NULL) {
+ mnt.mnt_fsname = strdup(oldmc->m.mnt_fsname);
+ mnt.mnt_type = oldmc->m.mnt_type;
+ mnt.mnt_opts = oldmc->m.mnt_opts;
+ mnt.mnt_freq = oldmc->m.mnt_freq;
+ mnt.mnt_passno = oldmc->m.mnt_passno;
+ }
+ update_mtab(olddir, NULL);
+ if (oldmc != NULL)
+ my_free(olddir);
+ }
+
lock_mtab();
mfp = my_setmntent(MOUNTED, "a+");
if (mfp == NULL || mfp->mntent_fp == NULL) {

View File

@ -0,0 +1,187 @@
--- util-linux-2.13-pre6/mount/mount.8.subtree 2006-06-12 09:18:26.000000000 +0200
+++ util-linux-2.13-pre6/mount/mount.8 2006-06-12 09:19:43.000000000 +0200
@@ -131,6 +131,41 @@
.B "mount --move olddir newdir"
.RE
+Since Linux 2.6.15 it is possible to mark a mount and its submounts as shared,
+private, slave or unbindable. A shared mount provides ability to create mirrors
+of that mount such that mounts and umounts within any of the mirrors propagate
+to the other mirror. A slave mount receives propagation from its master, but
+any not vice-versa. A private mount carries no propagation abilities. A
+unbindable mount is a private mount which cannot cloned through a bind
+operation. Detailed semantics is documented in Documentation/sharedsubtree.txt
+file in the kernel source tree.
+.RS
+.br
+.B "mount --make-shared mountpoint"
+.br
+.B "mount --make-slave mountpoint"
+.br
+.B "mount --make-private mountpoint"
+.br
+.B "mount --make-unbindable mountpoint"
+.br
+.RE
+
+The following commands allows one to recursively change the type of all the
+mounts under a given mountpoint.
+.RS
+.br
+.B "mount --make-rshared mountpoint"
+.br
+.B "mount --make-rslave mountpoint"
+.br
+.B "mount --make-rprivate mountpoint"
+.br
+.B
+"mount --make-runbindable mountpoint"
+.br
+.RE
+
The
.I proc
file system is not associated with a special device, and when
--- util-linux-2.13-pre6/mount/mount_constants.h.subtree 2002-11-01 01:24:36.000000000 +0100
+++ util-linux-2.13-pre6/mount/mount_constants.h 2006-06-12 09:19:43.000000000 +0200
@@ -57,6 +57,18 @@
#ifndef MS_VERBOSE
#define MS_VERBOSE 0x8000 /* 32768 */
#endif
+#ifndef MS_UNBINDABLE
+#define MS_UNBINDABLE (1<<17) /* 131072 unbindable*/
+#endif
+#ifndef MS_PRIVATE
+#define MS_PRIVATE (1<<18) /* 262144 Private*/
+#endif
+#ifndef MS_SLAVE
+#define MS_SLAVE (1<<19) /* 524288 Slave*/
+#endif
+#ifndef MS_SHARED
+#define MS_SHARED (1<<20) /* 1048576 Shared*/
+#endif
/*
* Magic mount flag number. Had to be or-ed to the flag values.
*/
--- util-linux-2.13-pre6/mount/mount.c.subtree 2006-06-12 09:18:26.000000000 +0200
+++ util-linux-2.13-pre6/mount/mount.c 2006-06-12 09:19:43.000000000 +0200
@@ -74,7 +74,9 @@
/* Add volumelabel in a listing of mounted devices (-l). */
static int list_with_volumelabel = 0;
-/* Nonzero for mount {--bind|--replace|--before|--after|--over|--move} */
+/* Nonzero for mount {--bind|--replace|--before|--after|--over|--move|
+ * make-shared|make-private|make-unbindable|make-slave}
+ */
static int mounttype = 0;
/* True if ruid != euid. */
@@ -109,6 +111,8 @@
/* Options that we keep from appearing in the options field in the mtab. */
#define MS_NOMTAB (MS_REMOUNT|MS_NOAUTO|MS_USERS|MS_USER|MS_PAMCONSOLE)
+#define MS_PROPAGATION (MS_SHARED|MS_SLAVE|MS_UNBINDABLE|MS_PRIVATE)
+
/* Options that we make ordinary users have by default. */
#define MS_SECURE (MS_NOEXEC|MS_NOSUID|MS_NODEV)
@@ -346,6 +350,9 @@
*flags |= MS_RDONLY;
if (readwrite)
*flags &= ~MS_RDONLY;
+
+ if (mounttype & MS_PROPAGATION)
+ *flags &= ~MS_BIND;
*flags |= mounttype;
}
@@ -916,13 +923,15 @@
if (loop)
opt_loopdev = loopdev;
- update_mtab_entry(loop ? loopfile : spec,
+ if (!(mounttype & MS_PROPAGATION)) {
+ update_mtab_entry(loop ? loopfile : spec,
node,
types ? types : "unknown",
fix_opts_string (flags & ~MS_NOMTAB, extra_opts, user),
flags,
freq,
pass);
+ }
block_signals (SIG_UNBLOCK);
res = 0;
@@ -1461,6 +1470,14 @@
{ "move", 0, 0, 133 },
{ "guess-fstype", 1, 0, 134 },
{ "rbind", 0, 0, 135 },
+ { "make-shared", 0, 0, 136 },
+ { "make-slave", 0, 0, 137 },
+ { "make-private", 0, 0, 138 },
+ { "make-unbindable", 0, 0, 139 },
+ { "make-rshared", 0, 0, 140 },
+ { "make-rslave", 0, 0, 141 },
+ { "make-rprivate", 0, 0, 142 },
+ { "make-runbindable", 0, 0, 143 },
{ "internal-only", 0, 0, 'i' },
{ NULL, 0, 0, 0 }
};
@@ -1487,6 +1504,17 @@
" mount --bind olddir newdir\n"
"or move a subtree:\n"
" mount --move olddir newdir\n"
+ "One can change the type of mount containing the directory dir:\n"
+ " mount --make-shared dir\n"
+ " mount --make-slave dir\n"
+ " mount --make-private dir\n"
+ " mount --make-unbindable dir\n"
+ "One can change the type of all the mounts in a mount subtree\n"
+ "containing the directory dir:\n"
+ " mount --make-rshared dir\n"
+ " mount --make-rslave dir\n"
+ " mount --make-rprivate dir\n"
+ " mount --make-runbindable dir\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] [-p passwdfd].\n"
@@ -1638,6 +1666,39 @@
case 135:
mounttype = (MS_BIND | MS_REC);
break;
+
+ case 136:
+ mounttype = MS_SHARED;
+ break;
+
+ case 137:
+ mounttype = MS_SLAVE;
+ break;
+
+ case 138:
+ mounttype = MS_PRIVATE;
+ break;
+
+ case 139:
+ mounttype = MS_UNBINDABLE;
+ break;
+
+ case 140:
+ mounttype = (MS_SHARED | MS_REC);
+ break;
+
+ case 141:
+ mounttype = (MS_SLAVE | MS_REC);
+ break;
+
+ case 142:
+ mounttype = (MS_PRIVATE | MS_REC);
+ break;
+
+ case 143:
+ mounttype = (MS_UNBINDABLE | MS_REC);
+ break;
+
case '?':
default:
usage (stderr, EX_USAGE);

View File

@ -0,0 +1,60 @@
The UUID code in the mount command is broken -- en example UUID= in the fstab
file is reason for SIGSEG when non-root user tries umount any device.
-- 03/30/2006 Karel Zak <kzak@redhat.com>
--- util-linux-2.13-pre6/mount/mount_blkid.h.uuid 2006-03-29 15:34:24.000000000 +0200
+++ util-linux-2.13-pre6/mount/mount_blkid.h 2006-03-29 15:34:57.000000000 +0200
@@ -8,5 +8,6 @@
extern const char *mount_get_devname_by_uuid(const char *uuid);
extern const char *mount_get_devname_by_label(const char *label);
extern const char *mount_get_volume_label_by_spec(const char *spec);
+extern const char *mount_get_volume_uuid_by_spec(const char *spec);
extern const char *mount_get_devname(const char *spec);
extern const char *mount_get_devname_for_mounting(const char *spec);
--- util-linux-2.13-pre6/mount/mount_blkid.c.uuid 2006-03-29 15:33:44.000000000 +0200
+++ util-linux-2.13-pre6/mount/mount_blkid.c 2006-03-29 15:34:14.000000000 +0200
@@ -21,6 +21,11 @@
}
const char *
+mount_get_volume_uuid_by_spec(const char *spec) {
+ return blkid_get_tag_value(blkid, "UUID", spec);
+}
+
+const char *
mount_get_devname(const char *spec) {
return blkid_get_devname(blkid, spec, 0);
}
--- util-linux-2.13-pre6/mount/fstab.c.uuid 2006-03-29 15:29:28.000000000 +0200
+++ util-linux-2.13-pre6/mount/fstab.c 2006-03-29 15:36:30.000000000 +0200
@@ -301,23 +301,19 @@
static int
has_label(const char *device, const char *label) {
const char *devlabel;
- int ret;
- devlabel = mount_get_volume_label_by_spec(device);
- ret = !strcmp(label, devlabel);
- /* free(devlabel); */
- return ret;
+ if (!(devlabel = mount_get_volume_label_by_spec(device)))
+ return 0;
+ return !strcmp(label, devlabel);
}
static int
has_uuid(const char *device, const char *uuid){
const char *devuuid;
- int ret;
- devuuid = mount_get_devname_by_uuid(device);
- ret = !strcmp(uuid, devuuid);
- /* free(devuuid); */
- return ret;
+ if (!(devuuid = mount_get_volume_uuid_by_spec(device)))
+ return 0;
+ return !strcmp(uuid, devuuid);
}
/* Find the entry (SPEC,FILE) in fstab */

View File

@ -25,7 +25,7 @@ BuildRoot: %{_tmppath}/%{name}-root
Summary: A collection of basic system utilities.
Name: util-linux
Version: 2.13
Release: 0.24
Release: 0.25
License: distributable
Group: System Environment/Base
@ -177,8 +177,6 @@ Patch225: util-linux-2.13-schedutils-man.patch
Patch226: util-linux-2.13-login-pam-acct.patch
# 177523 - umount -a should not unmount sysfs
Patch227: util-linux-2.13-umount-sysfs.patch
# 182553 - fdisk -l inside xen guest shows no disks
Patch228: util-linux-2.13-fdisk-xvd.patch
# 169042 - Changed nfsmount to try udp before using tcp when rpc-ing
# the remote rpc.mountd (iff -o tcp is not specified).
Patch229: util-linux-2.13-nfsmount-mountd-udp.patch
@ -188,7 +186,29 @@ Patch230: util-linux-2.13-nfs-noacl.patch
Patch231: util-linux-2.13-nfsmount-retry.patch
# Adds syslog logging to background mounts
Patch232: util-linux-2.13-nfsmount-syslog.patch
# 187014 - umount segfaults for normal user
Patch233: util-linux-2.13-mount-uuid.patch
# 183446 - cal not UTF-8-aware
Patch234: util-linux-2.13-cal-wide.patch
# 186915 - mount does not translate SELIinux context options though libselinux
# 185500 - Need man page entry for -o context= mount option
Patch235: util-linux-2.13-mount-context.patch
# 152579 - missing info about /etc/mtab and /proc/mounts mismatch
# 183890 - missing info about possible ioctl() and fcntl() problems on NFS filesystem
Patch236: util-linux-2.13-mount-man-bugs.patch
# Keep gcc happy
Patch237: util-linux-2.13-hexdump-gcc.patch
# 191230 - using mount --move results in wrong data in /etc/mtab
Patch238: util-linux-2.13-mount-move.patch
# Subtrees support
Patch239: util-linux-2.13-mount-subtree.patch
# wrong number of sectors for large disks (suse#160822)
Patch240: util-linux-2.13-fdisk-sectors.patch
# 182553 - fdisk -l inside xen guest shows no disks
# 188981 - "sfdisk -l" tries to open partitions
Patch241: util-linux-2.13-fdisk-isfull.patch
# 181549 - raw(8) manpage has old information about dd
Patch242: util-linux-2.12a-raw-man-dd.patch
# When adding patches, please make sure that it is easy to find out what bug # the
# patch fixes.
@ -268,11 +288,21 @@ cp %{SOURCE8} %{SOURCE9} .
%patch225 -p1
%patch226 -p1
%patch227 -p1
%patch228 -p1
%patch229 -p1
%patch230 -p1
%patch231 -p1
%patch232 -p1
%patch233 -p1
%patch234 -p1
%patch235 -p1
%patch236 -p1
%patch237 -p1
%patch238 -p1
%patch239 -p1
%patch240 -p1
%patch241 -p1 -b .isfull
%patch242 -p1
%build
unset LINGUAS || :
@ -658,6 +688,19 @@ fi
/sbin/losetup
%changelog
* Mon Jun 12 2006 Karel Zak <kzak@redhat.com> 2.13-0.25
- fix #187014 - umount segfaults for normal user
- fix #183446 - cal not UTF-8-aware
- fix #186915 - mount does not translate SELIinux context options though libselinux
- fix #185500 - Need man page entry for -o context= mount option
- fix #152579 - missing info about /etc/mtab and /proc/mounts mismatch
- fix #183890 - missing info about possible ioctl() and fcntl() problems on NFS filesystem
- fix #191230 - using mount --move results in wrong data in /etc/mtab
- added mount subtrees support
- fdisk: wrong number of sectors for large disks (suse#160822)
- merge fdisk-xvd (#182553) with new fdisk-isfull (#188981) patch
- fix #181549 - raw(8) manpage has old information about dd
* Wed May 24 2006 Dan Walsh <dwalsh@RedHat.com> 2.13-0.24
- Remove requirement on restorecon, since we can do the same thing
- with chcon/matchpathcon, and not add requirement on policycoreutils