OBS User unknown 2006-12-18 23:15:45 +00:00 committed by Git OBS Bridge
commit a22b964aee
32 changed files with 3620 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

10
close.patch Normal file
View File

@ -0,0 +1,10 @@
--- e2fsprogs-1.39/lib/ext2fs/closefs.c
+++ e2fsprogs-1.39/lib/ext2fs/closefs.c
@@ -217,6 +217,7 @@
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
+ super_shadow = fs->super;
fs_state = fs->super->s_state;
fs->super->s_wtime = fs->now ? fs->now : time(NULL);

View File

@ -0,0 +1,43 @@
--- lib/ext2fs/dirhash.c
+++ lib/ext2fs/dirhash.c
@@ -13,6 +13,7 @@
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include "ext2_fs.h"
#include "ext2fs.h"
--- lib/ext2fs/ext2fs.h
+++ lib/ext2fs/ext2fs.h
@@ -59,6 +59,7 @@
#endif
#include <stdio.h>
+#include <string.h>
#include <stdlib.h>
#include <string.h>
--- resize/resize2fs.h
+++ resize/resize2fs.h
@@ -21,9 +21,18 @@
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
#endif
+
#if HAVE_ERRNO_H
#include <errno.h>
#endif

View File

@ -0,0 +1,30 @@
--- e2fsck/unix.c
+++ e2fsck/unix.c
@@ -995,8 +995,13 @@
*/
if (ctx->device_name == 0 &&
(sb->s_volume_name[0] != 0)) {
- ctx->device_name = string_copy(ctx, sb->s_volume_name,
- sizeof(sb->s_volume_name));
+ ctx->device_name = malloc(sizeof(sb->s_volume_name)+4+
+ (ctx->filesystem_name?strlen(ctx->filesystem_name):1));
+ if (ctx->device_name) {
+ sprintf (ctx->device_name, "%s (%s)",
+ sb->s_volume_name,
+ (ctx->filesystem_name? ctx->filesystem_name: "?"));
+ }
}
if (ctx->device_name == 0)
ctx->device_name = ctx->filesystem_name;
--- misc/fsck.c
+++ misc/fsck.c
@@ -615,6 +615,9 @@
status = EXIT_ERROR;
}
inst->exit_status = status;
+ if (status > 1)
+ printf(_("%s %s failed (status 0x%x). Run manually!\n"),
+ inst->prog, inst->device, status);
if (progress && (inst->flags & FLAG_PROGRESS) &&
!progress_active()) {
for (inst2 = instance_list; inst2; inst2 = inst2->next) {

View File

@ -0,0 +1,19 @@
--- configure.in
+++ configure.in
@@ -553,6 +553,7 @@
else
AC_CHECK_PROGS(BUILD_CC, gcc cc)
fi
+AC_HEADER_TIME
AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h stdint.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/prctl.h sys/queue.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h net/if_dl.h netinet/in.h)
AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
[[
@@ -751,7 +752,7 @@
else
root_bindir='${root_prefix}/bin'
root_sbindir='${root_prefix}/sbin'
- root_libdir='${root_prefix}/lib'
+ root_libdir='${root_prefix}/$(lib)'
root_sysconfdir='${root_prefix}/etc'
fi
AC_SUBST(root_prefix)

View File

@ -0,0 +1,40 @@
--- misc/mke2fs.8.in
+++ misc/mke2fs.8.in
@@ -30,6 +30,10 @@
.I bytes-per-inode
]
[
+.B \-I
+.I inode-size
+]
+[
.B \-j
]
[
@@ -217,7 +221,14 @@
be smaller than the blocksize of the filesystem, since then too many
inodes will be made. Be warned that is not possible to expand the number
of inodes on a filesystem after it is created, so be careful deciding the
-correct value for this parameter.
+correct value for this parameter.
+.TP
+.BI \-I " inode-size"
+Specify the inode size. The default inode-size used by
+.B mke2fs
+is 128.
+.I inode-size
+can be 128, 256, 512 or 1024. This value generally shouldn't be changed!
.TP
.B \-j
Create the filesystem with an ext3 journal. If the
--- misc/mke2fs.c
+++ misc/mke2fs.c
@@ -94,7 +94,7 @@
static void usage(void)
{
fprintf(stderr, _("Usage: %s [-c|-t|-l filename] [-b block-size] "
- "[-f fragment-size]\n\t[-i bytes-per-inode] [-j] [-J journal-options]"
+ "[-f fragment-size]\n\t[-i bytes-per-inode] [-I inode-size] [-j] [-J journal-options]"
" [-N number-of-inodes]\n\t[-m reserved-blocks-percentage] "
"[-o creator-os] [-g blocks-per-group]\n\t[-L volume-label] "
"[-M last-mounted-directory] [-O feature[,...]]\n\t"

View File

@ -0,0 +1,13 @@
--- e2fsprogs-1.39/lib/blkid/probe.c
+++ e2fsprogs-1.39/lib/blkid/probe.c
@@ -348,8 +348,8 @@
}
if (vol_label && memcmp(vol_label, no_name, 11)) {
- label = vol_label;
- label_len = figure_label_len(vol_label, 11);
+ if ((label_len = figure_label_len(vol_label, 11)))
+ label = vol_label;
}
/* We can't just print them as %04X, because they are unaligned */

View File

@ -0,0 +1,12 @@
--- config/parse-types.sh
+++ config/parse-types.sh
@@ -22,6 +22,9 @@
cp asm_types.h asm_types.c
cat >> asm_types.c <<EOF
+#include <stdio.h>
+#include <stdlib.h>
+
main(int argc, char **argv)
{
#ifdef __U8_TYPEDEF

View File

@ -0,0 +1,11 @@
--- resize/resize2fs.8.in
+++ resize/resize2fs.8.in
@@ -60,7 +60,7 @@
The
.B resize2fs
program does not manipulate the size of partitions. If you wish to enlarge
-a filesystem, you must first make sure you can expand the size of the
+a filesystem, you must make sure you can expand the size of the
underlying partition first. This can be done using
.BR fdisk (8)
by deleting the partition and recreating it with a larger size or using

View File

@ -0,0 +1,308 @@
--- e2fsprogs-1.39/lib/uuid/Makefile.in
+++ e2fsprogs-1.39/lib/uuid/Makefile.in
@@ -19,6 +19,8 @@
OBJS= clear.o \
compare.o \
copy.o \
+ pv.o \
+ shm.o \
gen_uuid.o \
isnull.o \
pack.o \
@@ -30,6 +32,8 @@
SRCS= $(srcdir)/clear.c \
$(srcdir)/compare.c \
$(srcdir)/copy.c \
+ $(srcdir)/pv.c \
+ $(srcdir)/shm.c \
$(srcdir)/gen_uuid.c \
$(srcdir)/isnull.c \
$(srcdir)/pack.c \
@@ -82,7 +86,7 @@
uuid_time: $(srcdir)/uuid_time.c $(DEPLIBUUID)
@echo " LD $@"
- @$(CC) $(ALL_CFLAGS) -DDEBUG -o uuid_time $(srcdir)/uuid_time.c \
+ @$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -DDEBUG -o uuid_time $(srcdir)/uuid_time.c \
$(LIBUUID)
uuid.3: $(DEP_SUBSTITUTE) $(srcdir)/uuid.3.in
--- e2fsprogs-1.39/lib/uuid/gen_uuid.c
+++ e2fsprogs-1.39/lib/uuid/gen_uuid.c
@@ -71,6 +71,10 @@
#endif
#include "uuidP.h"
+#include "pv.h"
+#include "shm.h"
+#include <pthread.h>
+#include <stdio.h>
#ifdef HAVE_SRANDOM
#define srand(x) srandom(x)
@@ -224,42 +228,55 @@
/* Assume that the gettimeofday() has microsecond granularity */
#define MAX_ADJUSTMENT 10
+static pthread_once_t m_uuid_init_guard = PTHREAD_ONCE_INIT;
+static pthread_mutex_t m_uuid_mutex = PTHREAD_MUTEX_INITIALIZER;
+static int m_uuid_sem_id = -1;
+
+void m_uuid_init_once()
+{
+ m_uuid_sem_id = uuid_sem_init((int)'u');
+}
+
static int get_clock(uint32_t *clock_high, uint32_t *clock_low, uint16_t *ret_clock_seq)
{
- static int adjustment = 0;
- static struct timeval last = {0, 0};
- static uint16_t clock_seq;
- struct timeval tv;
- unsigned long long clock_reg;
-
+ unsigned long long clock_reg;
+ struct timeval tv;
+ static uint16_t clock_seq;
+ static int adjustment = 0;
+
+ int shm_id = shm_init((int)'s', sizeof(struct timeval));
+ struct timeval *clock_time = (struct timeval*)shm_addr(shm_id);
+
try_again:
gettimeofday(&tv, 0);
- if ((last.tv_sec == 0) && (last.tv_usec == 0)) {
+ if ((clock_time->tv_sec == 0) && (clock_time->tv_usec == 0)) {
get_random_bytes(&clock_seq, sizeof(clock_seq));
clock_seq &= 0x3FFF;
- last = tv;
- last.tv_sec--;
+ *clock_time = tv;
+ clock_time->tv_sec--;
}
- if ((tv.tv_sec < last.tv_sec) ||
- ((tv.tv_sec == last.tv_sec) &&
- (tv.tv_usec < last.tv_usec))) {
+ if ((tv.tv_sec < clock_time->tv_sec) ||
+ ((tv.tv_sec == clock_time->tv_sec) &&
+ (tv.tv_usec < clock_time->tv_usec))) {
clock_seq = (clock_seq+1) & 0x3FFF;
adjustment = 0;
- last = tv;
- } else if ((tv.tv_sec == last.tv_sec) &&
- (tv.tv_usec == last.tv_usec)) {
+ *clock_time = tv;
+ } else if ((tv.tv_sec == clock_time->tv_sec) &&
+ (tv.tv_usec == clock_time->tv_usec)) {
if (adjustment >= MAX_ADJUSTMENT)
goto try_again;
adjustment++;
} else {
adjustment = 0;
- last = tv;
+ *clock_time = tv;
}
-
+
+ clock_seq = (clock_seq+1) & 0x3FFF;
+
clock_reg = tv.tv_usec*10 + adjustment;
- clock_reg += ((unsigned long long) tv.tv_sec)*10000000;
- clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000;
-
+ clock_reg += ((unsigned long)tv.tv_sec)*10000000;
+ clock_reg += (((unsigned long long)0x01B21DD2) << 23) + 0x13814000;
+
*clock_high = clock_reg >> 32;
*clock_low = clock_reg;
*ret_clock_seq = clock_seq;
@@ -268,10 +285,16 @@
void uuid_generate_time(uuid_t out)
{
+ pthread_mutex_lock(&m_uuid_mutex);
+
+ pthread_once(&m_uuid_init_guard, m_uuid_init_once);
+
+ if(m_uuid_sem_id != -1) uuid_sem_P(m_uuid_sem_id);
+
static unsigned char node_id[6];
static int has_init = 0;
struct uuid uu;
- uint32_t clock_mid;
+ uint32_t clock_mid;
if (!has_init) {
if (get_node_id(node_id) <= 0) {
@@ -291,6 +314,10 @@
uu.time_hi_and_version = ((clock_mid >> 16) & 0x0FFF) | 0x1000;
memcpy(uu.node, node_id, 6);
uuid_pack(&uu, out);
+
+ if(m_uuid_sem_id != -1) uuid_sem_V(m_uuid_sem_id);
+
+ pthread_mutex_unlock(&m_uuid_mutex);
}
void uuid_generate_random(uuid_t out)
--- e2fsprogs-1.39/lib/uuid/pv.c
+++ e2fsprogs-1.39/lib/uuid/pv.c
@@ -0,0 +1,88 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/sem.h>
+#include <sys/ipc.h>
+
+#if defined(PV_REPORT_VERBOSE)
+#include <stdio.h>
+
+#define report(msg) perror(msg)
+#else
+#define report(msg)
+#endif
+#include <errno.h>
+
+#include "pv.h"
+
+int uuid_sem_init(int project_id)
+{
+ key_t sem_key;
+ int sem_id;
+
+ sem_key = ftok("/", project_id);
+ if(sem_key == (key_t)-1)
+ {
+ report("Can't generate semaphore key");
+ return -1;
+ }
+
+ sem_id = semget(sem_key, 0, 0);
+ if(sem_id == -1)
+ {
+ sem_id = semget(sem_key, 1, IPC_CREAT | IPC_EXCL |
+ S_IRUSR | S_IWUSR | S_IRGRP |
+ S_IWGRP | S_IROTH | S_IWOTH);
+ if(sem_id != -1)
+ {
+ union semun {
+ int val;
+ struct semid_ds *buf;
+ unsigned short *array;
+ struct seminfo *__buf;
+ } arg;
+ arg.val = 1;
+
+ if(semctl(sem_id, 0, SETVAL, arg) == -1)
+ {
+ report("Can't initialize semaphore");
+
+ /* try to remove -- we've created it */
+ semctl(sem_id, 0, IPC_RMID, (int)0);
+ sem_id = -1;
+ }
+ }
+ else
+ if(errno == EEXIST)
+ {
+ if( (sem_id = semget(sem_key, 0, 0)) == -1)
+ {
+ report("Can't acquire / create semahore");
+ }
+ }
+ else
+ {
+ report("Can't neither acquire nor create semahore");
+ }
+ }
+ return sem_id;
+}
+
+static inline int sem_pv(int id, int op)
+{
+ struct sembuf sb;
+ sb.sem_num = 0;
+ sb.sem_op = op;
+ sb.sem_flg = /*SEM_UNDO*/0;
+ return semop(id, &sb, 1);
+}
+
+int uuid_sem_P(int id)
+{
+ return sem_pv(id, -1);
+}
+
+int uuid_sem_V(int id)
+{
+ return sem_pv(id, 1);
+}
+
--- e2fsprogs-1.39/lib/uuid/pv.h
+++ e2fsprogs-1.39/lib/uuid/pv.h
@@ -0,0 +1,9 @@
+#ifndef PV_H_INCLUDE_GUARD
+#define PV_H_INCLUDE_GUARD
+
+int uuid_sem_init(int project_id);
+int uuid_sem_P(int id);
+int uuid_sem_V(int id);
+
+#endif // PV_H_INCLUDE_GUARD
+
--- e2fsprogs-1.39/lib/uuid/shm.c
+++ e2fsprogs-1.39/lib/uuid/shm.c
@@ -0,0 +1,43 @@
+#include <sys/ipc.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+
+#if defined(SHM_REPORT_VERBOSE)
+#include <stdio.h>
+
+#define report(msg) perror(msg)
+#else
+#define report(msg)
+#endif
+#include <errno.h>
+
+#include "shm.h"
+
+int shm_init(int project_id, size_t size) {
+ key_t key;
+ int id;
+
+ key = ftok("/", project_id);
+ if (key == (key_t)-1) {
+ report("Can't generate shared memory key");
+ return -1;
+ }
+
+ id = shmget(key, 0, 0);
+ if (id == -1) {
+ id = shmget(key, size, 0666 | IPC_CREAT);
+ if (id == -1 && errno == EEXIST) {
+ if ((id = shmget(key, 0, 0)) == -1) {
+ report("Can't acquire/create shared memory");
+ }
+ }
+ else if (id == -1) {
+ report("Can neither acquire nor create shared memory");
+ }
+ }
+ return id;
+}
+
+void *shm_addr(int id) {
+ return shmat(id, NULL, 0);
+}
--- e2fsprogs-1.39/lib/uuid/shm.h
+++ e2fsprogs-1.39/lib/uuid/shm.h
@@ -0,0 +1,9 @@
+#ifndef SHM_H_INCLUDE_GUARD
+#define SHM_H_INCLUDE_GUARD
+
+#include <stddef.h>
+
+int shm_init(int project_id, size_t size);
+void *shm_addr(int id);
+
+#endif // SHM_H_INCLUDE_GUARD

3
e2fsprogs-1.39.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cf9f5259420233c25bf6752ba90966a2fb347eb46d53898196369292d2506294
size 3288868

366
e2fsprogs-base_devt.patch Normal file
View File

@ -0,0 +1,366 @@
--- e2fsprogs-1.39/misc/base_device.c
+++ e2fsprogs-1.39/misc/base_device.c
@@ -31,125 +31,170 @@
#include "fsck.h"
/*
- * Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3
- * pathames.
+ * Same version as above but returns the devicenumber of
+ * base device. Saner, no strings to free, works with everything.
*/
-static const char *devfs_hier[] = {
- "host", "bus", "target", "lun", 0
-};
-
-char *base_device(const char *device)
+dev_t base_devt(const char *device)
{
- char *str, *cp;
- const char **hier, *disk;
- int len;
-
- str = malloc(strlen(device)+1);
- if (!str)
- return NULL;
- strcpy(str, device);
- cp = str;
-
- /* Skip over /dev/; if it's not present, give up. */
- if (strncmp(cp, "/dev/", 5) != 0)
- goto errout;
- cp += 5;
-
- /* Skip over /dev/dsk/... */
- if (strncmp(cp, "dsk/", 4) == 0)
- cp += 4;
-
- /*
- * For md devices, we treat them all as if they were all
- * on one disk, since we don't know how to parallelize them.
- */
- if (cp[0] == 'm' && cp[1] == 'd') {
- *(cp+2) = 0;
- return str;
- }
+ struct stat statbuf;
+ unsigned int dev_major, dev_minor, disk_minor;
- /* Handle DAC 960 devices */
- if (strncmp(cp, "rd/", 3) == 0) {
- cp += 3;
- if (cp[0] != 'c' || cp[2] != 'd' ||
- !isdigit(cp[1]) || !isdigit(cp[3]))
- goto errout;
- *(cp+4) = 0;
- return str;
- }
+ if (stat(device, &statbuf) < 0) {
+ fprintf(stderr,"error on stat() %s: %s\n",
+ device, strerror(errno));
+ return 0;
+ }
+
+ if (!S_ISBLK(statbuf.st_mode))
+ return 0;
+
+ dev_major = major(statbuf.st_mode);
+ dev_minor = minor(statbuf.st_mode);
+
+ switch (dev_major) {
+ case 3: /* IDE / ATAPI disks */
+ case 13: /* PC MFM disks */
+ case 14: /* BIOS HD disks */
+ case 21: /* Acorn MFM disks */
+ case 22: /* 2nd IDE / ATAPI controller */
+ case 33: /* 3rd IDE / ATAPI controller */
+ case 34: /* 4th IDE / ATAPI controller */
+ case 56: /* 5th IDE / ATAPI controller */
+ case 57: /* 6th IDE / ATAPI controller */
+ case 88: /* 7th IDE / ATAPI controller */
+ case 89: /* 8th IDE / ATAPI controller */
+ case 90: /* 9th IDE / ATAPI controller */
+ case 91: /* 10th IDE / ATAPI controller */
+ case 36: /* MCA ESDI disks */
+ disk_minor = dev_minor - (dev_minor % 64);
+ break;
+ case 160: /* Carmel 8-port SATA disks, 1st controller */
+ case 161: /* Carmel 8-port SATA disks, 2nd controller */
+ disk_minor = dev_minor - (dev_minor % 32);
+ break;
+ case 8: /* SCSI devices */
+ case 28: /* Atari ASCI disks */
+ case 44: /* FTL disks */
+ case 45: /* Parallel port IDE disks */
+ case 65: /* SCSI devices */
+ case 66: /* SCSI devices */
+ case 67: /* SCSI devices */
+ case 68: /* SCSI devices */
+ case 69: /* SCSI devices */
+ case 70: /* SCSI devices */
+ case 71: /* SCSI devices */
+ case 72: /* Compaq IDA, 1st controller */
+ case 73: /* Compaq IDA, 2nd controller */
+ case 74: /* Compaq IDA, 3rd controller */
+ case 75: /* Compaq IDA, 4th controller */
+ case 76: /* Compaq IDA, 5th controller */
+ case 77: /* Compaq IDA, 6th controller */
+ case 78: /* Compaq IDA, 7th controller */
+ case 79: /* Compaq IDA, 8th controller */
+ case 80: /* I2O disks */
+ case 81: /* I2O disks */
+ case 82: /* I2O disks */
+ case 83: /* I2O disks */
+ case 84: /* I2O disks */
+ case 85: /* I2O disks */
+ case 86: /* I2O disks */
+ case 87: /* I2O disks */
+ case 93: /* NAND FTL disks */
+ case 96: /* Inverse NAND FTL disks */
+ case 98: /* User-mode Virtual disks */
+ case 101: /* AMI RAID controller */
+ case 102: /* Compressed block device */
+ case 104: /* Compaq CCISS, 1st controller */
+ case 105: /* Compaq CCISS, 2nd controller */
+ case 106: /* Compaq CCISS, 3rd controller */
+ case 107: /* Compaq CCISS, 4th controller */
+ case 108: /* Compaq CCISS, 5th controller */
+ case 109: /* Compaq CCISS, 6th controller */
+ case 110: /* Compaq CCISS, 7th controller */
+ case 111: /* Compaq CCISS, 8th controller */
+ case 114: /* ATARAID devices */
+ case 128: /* SCSI disks */
+ case 129: /* SCSI disks */
+ case 130: /* SCSI disks */
+ case 131: /* SCSI disks */
+ case 132: /* SCSI disks */
+ case 133: /* SCSI disks */
+ case 134: /* SCSI disks */
+ case 135: /* SCSI disks */
+ case 153: /* Enhanced Metadisk RAID */
+ disk_minor = dev_minor - (dev_minor % 16);
+ break;
+ case 48: /* Mylex DAC960 RAID, 1st controller */
+ case 49: /* Mylex DAC960 RAID, 2nd controller */
+ case 50: /* Mylex DAC960 RAID, 3rd controller */
+ case 51: /* Mylex DAC960 RAID, 4th controller */
+ case 52: /* Mylex DAC960 RAID, 5th controller */
+ case 53: /* Mylex DAC960 RAID, 6th controller */
+ case 54: /* Mylex DAC960 RAID, 7th controller */
+ case 55: /* Mylex DAC960 RAID, 8th controller */
+ case 112: /* IBM iSeries virtual disks */
+ case 136: /* Mylex DAC960 RAID, 9th controller */
+ case 137: /* Mylex DAC960 RAID, 10th controller */
+ case 138: /* Mylex DAC960 RAID, 11th controller */
+ case 139: /* Mylex DAC960 RAID, 12th controller */
+ case 140: /* Mylex DAC960 RAID, 13th controller */
+ case 141: /* Mylex DAC960 RAID, 14th controller */
+ case 142: /* Mylex DAC960 RAID, 15th controller */
+ case 143: /* Mylex DAC960 RAID, 16th controller */
+ case 180: /* USB Block devices */
+ disk_minor = dev_minor - (dev_minor % 8);
+ break;
+ case 94: /* IBM S/390 DASD */
+ disk_minor = dev_minor - (dev_minor % 4);
+ break;
+ default:
+ disk_minor = dev_minor;
+ break;
- /* Now let's handle /dev/hd* and /dev/sd* devices.... */
- if ((cp[0] == 'h' || cp[0] == 's') && (cp[1] == 'd')) {
- cp += 2;
- /* If there's a single number after /dev/hd, skip it */
- if (isdigit(*cp))
- cp++;
- /* What follows must be an alpha char, or give up */
- if (!isalpha(*cp))
- goto errout;
- *(cp + 1) = 0;
- return str;
}
- /* Now let's handle devfs (ugh) names */
- len = 0;
- if (strncmp(cp, "ide/", 4) == 0)
- len = 4;
- if (strncmp(cp, "scsi/", 5) == 0)
- len = 5;
- if (len) {
- cp += len;
- /*
- * Now we proceed down the expected devfs hierarchy.
- * i.e., .../host1/bus2/target3/lun4/...
- * If we don't find the expected token, followed by
- * some number of digits at each level, abort.
- */
- for (hier = devfs_hier; *hier; hier++) {
- len = strlen(*hier);
- if (strncmp(cp, *hier, len) != 0)
- goto errout;
- cp += len;
- while (*cp != '/' && *cp != 0) {
- if (!isdigit(*cp))
- goto errout;
- cp++;
- }
- cp++;
- }
- *(cp - 1) = 0;
- return str;
+ return makedev(dev_major,disk_minor);
+}
+
+/*
+ * Check whether two given devices match.
+ * Rather then check for the device names
+ * (which wouldn't work with udev anyway)
+ * check whether the device numbers are
+ * identical.
+ */
+int match_device(const char *dev1, const char *dev2)
+{
+ struct stat statbuf;
+ dev_t saved_devt;
+ int ret = 0;
+
+ if (stat(dev1, &statbuf) < 0) {
+ return 0;
}
- /* Now handle devfs /dev/disc or /dev/disk names */
- disk = 0;
- if (strncmp(cp, "discs/", 6) == 0)
- disk = "disc";
- else if (strncmp(cp, "disks/", 6) == 0)
- disk = "disk";
- if (disk) {
- cp += 6;
- if (strncmp(cp, disk, 4) != 0)
- goto errout;
- cp += 4;
- while (*cp != '/' && *cp != 0) {
- if (!isdigit(*cp))
- goto errout;
- cp++;
- }
- *cp = 0;
- return str;
+ if (!S_ISBLK(statbuf.st_mode))
+ return 0;
+
+ saved_devt = statbuf.st_rdev;
+
+ if (stat(dev2, &statbuf) < 0) {
+ return 0;
}
-errout:
- free(str);
- return NULL;
+ if (!S_ISBLK(statbuf.st_mode))
+ return 0;
+
+ if (saved_devt == statbuf.st_rdev)
+ ret = 1;
+
+ return ret;
}
#ifdef DEBUG
int main(int argc, char** argv)
{
- const char *base;
+ dev_t base;
char buf[256], *cp;
while (1) {
@@ -161,8 +206,8 @@
cp = strchr(buf, '\t');
if (cp)
*cp = 0;
- base = base_device(buf);
- printf("%s\t%s\n", buf, base ? base : "NONE");
+ base = base_devt(buf);
+ printf("%s\t0x%04x\n", buf, base);
}
exit(0);
}
--- e2fsprogs-1.39/misc/fsck.c
+++ e2fsprogs-1.39/misc/fsck.c
@@ -233,8 +233,6 @@
free(i->prog);
if (i->device)
free(i->device);
- if (i->base_device)
- free(i->base_device);
free(i);
return;
}
@@ -389,7 +387,7 @@
return NULL;
for (fs = filesys_info; fs; fs = fs->next) {
- if (!strcmp(filesys, fs->device) ||
+ if (match_device(filesys, fs->device) ||
(fs->mountpt && !strcmp(filesys, fs->mountpt)))
break;
}
@@ -502,7 +500,7 @@
inst->prog = string_copy(prog);
inst->type = string_copy(type);
inst->device = string_copy(device);
- inst->base_device = base_device(device);
+ inst->base_devt = base_devt(device);
inst->start_time = time(0);
inst->next = NULL;
@@ -905,7 +903,7 @@
static int device_already_active(char *device)
{
struct fsck_instance *inst;
- char *base;
+ dev_t disk_devt;
if (force_all_parallel)
return 0;
@@ -918,20 +916,19 @@
return 1;
#endif
- base = base_device(device);
+ disk_devt = base_devt(device);
/*
* If we don't know the base device, assume that the device is
* already active if there are any fsck instances running.
*/
- if (!base)
+ if (!disk_devt)
return (instance_list != 0);
+
for (inst = instance_list; inst; inst = inst->next) {
- if (!inst->base_device || !strcmp(base, inst->base_device)) {
- free(base);
+ if (!inst->base_devt || disk_devt == inst->base_devt) {
return 1;
}
}
- free(base);
return 0;
}
--- e2fsprogs-1.39/misc/fsck.h
+++ e2fsprogs-1.39/misc/fsck.h
@@ -62,9 +62,9 @@
char * prog;
char * type;
char * device;
- char * base_device;
+ dev_t base_devt;
struct fsck_instance *next;
};
-extern char *base_device(const char *device);
-extern const char *identify_fs(const char *fs_name, const char *fs_types);
+extern dev_t base_devt(const char *device);
+extern int match_device(const char *dev1, const char *dev2);

29
e2fsprogs-blkid.diff Normal file
View File

@ -0,0 +1,29 @@
--- misc/fsck.8.in
+++ misc/fsck.8.in
@@ -391,6 +391,15 @@
.B /etc/fstab
file. It is also useful for developers who are testing
.BR fsck .
+.TP
+.B BLKID_FILE
+This environment variable allows the early boot scripts
+to override the standard location of the
+.B /etc/blkid.tab
+file. This file contains a mapping between UUID, LABEL and TYPE
+values to device nodes. The information in the blkid.tab might
+be stale after a reboot if hardware was changed or disks were
+added or removed.
.SH SEE ALSO
.BR fstab (5),
.BR mkfs (8),
--- misc/fsck.c
+++ misc/fsck.c
@@ -1243,7 +1243,7 @@
bindtextdomain(NLS_CAT_NAME, LOCALEDIR);
textdomain(NLS_CAT_NAME);
#endif
- blkid_get_cache(&cache, NULL);
+ blkid_get_cache(&cache, getenv("BLKID_FILE"));
PRS(argc, argv);
if (!notitle)

175
e2fsprogs-codecleanup.diff Normal file
View File

@ -0,0 +1,175 @@
--- debugfs/debugfs.c
+++ debugfs/debugfs.c
@@ -42,6 +42,9 @@
ext2_filsys current_fs = NULL;
ext2_ino_t root, cwd;
+extern int debugfs_read_inode_full(ext2_ino_t, struct ext2_inode *,
+ const char *, int);
+
static void open_filesystem(char *device, int open_flags, blk_t superblock,
blk_t blocksize, int catastrophic,
char *data_filename)
@@ -377,10 +380,10 @@
else
fprintf(lb->f, ", ");
if (lb->first_block == lb->last_block)
- fprintf(lb->f, "(%lld):%u", lb->first_bcnt, lb->first_block);
+ fprintf(lb->f, "(%lld):%u", lb->first_bcnt, (long long)lb->first_block);
else
fprintf(lb->f, "(%lld-%lld):%u-%u", lb->first_bcnt,
- lb->last_bcnt, lb->first_block, lb->last_block);
+ (long long)lb->last_bcnt, (long long)lb->first_block, lb->last_block);
lb->first_block = 0;
}
@@ -507,7 +510,7 @@
list_blocks_proc, (void *)&lb);
finish_range(&lb);
if (lb.total)
- fprintf(f, "\n%sTOTAL: %lld\n", prefix, lb.total);
+ fprintf(f, "\n%sTOTAL: %lld\n", prefix, (long long)lb.total);
fprintf(f,"\n");
}
@@ -538,7 +541,7 @@
__u64 i_size = (inode->i_size |
((unsigned long long)inode->i_size_high << 32));
- fprintf(out, "%lld\n", i_size);
+ fprintf(out, "%lld\n", (long long)i_size);
} else
fprintf(out, "%d\n", inode->i_size);
if (current_fs->super->s_creator_os == EXT2_OS_HURD)
--- debugfs/ls.c
+++ debugfs/ls.c
@@ -92,8 +92,8 @@
if (LINUX_S_ISDIR(inode.i_mode))
fprintf(ls->f, "%5d", inode.i_size);
else
- fprintf(ls->f, "%5lld", inode.i_size |
- ((__u64)inode.i_size_high << 32));
+ fprintf(ls->f, "%5lld", (long long) (inode.i_size |
+ ((__u64)inode.i_size_high << 32)));
fprintf (ls->f, " %s %s\n", datestr, name);
} else {
sprintf(tmp, "%c%u%c (%d) %s ", lbr, dirent->inode, rbr,
--- debugfs/lsdel.c
+++ debugfs/lsdel.c
@@ -190,7 +190,7 @@
for (i = 0; i < num_delarray; i++) {
fprintf(out, "%6u %6d %6o %6llu %4d/%4d %s", delarray[i].ino,
delarray[i].uid, delarray[i].mode, delarray[i].size,
- delarray[i].free_blocks, delarray[i].num_blocks,
+ (unsigned long long)delarray[i].free_blocks, delarray[i].num_blocks,
time_to_string(delarray[i].dtime));
}
fprintf(out, "%d deleted inodes found.\n", num_delarray);
--- e2fsck/message.c
+++ e2fsck/message.c
@@ -263,7 +263,7 @@
else
printf("%u", inode->i_size);
#else
- printf("%llu", (inode->i_size |
+ printf("%llu", (unsigned long long)(inode->i_size |
((__u64) inode->i_size_high << 32)));
#endif
}
@@ -376,7 +376,7 @@
#ifdef EXT2_NO_64_TYPE
printf("%d", ctx->blkcount);
#else
- printf("%lld", ctx->blkcount);
+ printf("%lld", (long long)ctx->blkcount);
#endif
break;
case 'c':
@@ -401,7 +401,7 @@
#ifdef EXT2_NO_64_TYPE
printf("%u", ctx->num);
#else
- printf("%llu", ctx->num);
+ printf("%llu", (unsigned long long)ctx->num);
#endif
break;
case 'p':
@@ -427,7 +427,7 @@
#ifdef EXT2_NO_64_TYPE
printf("0x%x", ctx->num);
#else
- printf("0x%llx", ctx->num);
+ printf("0x%llx", (unsigned long long)ctx->num);
#endif
break;
default:
--- e2fsck/pass1.c
+++ e2fsck/pass1.c
@@ -55,6 +55,9 @@
#define _INLINE_ inline
#endif
+extern void e2fsck_write_inode_full(e2fsck_t, unsigned long,
+ struct ext2_inode *, int, const char *);
+
static int process_block(ext2_filsys fs, blk_t *blocknr,
e2_blkcnt_t blockcnt, blk_t ref_blk,
int ref_offset, void *priv_data);
--- lib/et/error_message.c
+++ lib/et/error_message.c
@@ -35,7 +35,6 @@
int offset;
struct et_list *et;
errcode_t table_num;
- int started = 0;
char *cp;
offset = (int) (code & ((1<<ERRCODE_RANGE)-1));
--- lib/ss/error.c
+++ lib/ss/error.c
@@ -19,11 +19,10 @@
#include <stdarg.h>
-char * ss_name(sci_idx)
- int sci_idx;
+char * ss_name(int sci_idx)
{
- register char *ret_val;
- register ss_data *infop;
+ char *ret_val;
+ ss_data *infop;
infop = ss_info(sci_idx);
if (infop->current_request == (char const *)NULL) {
@@ -36,8 +35,8 @@
return(ret_val);
}
else {
- register char *cp;
- register char const *cp1;
+ char *cp;
+ char const *cp1;
ret_val = malloc((unsigned)sizeof(char) *
(strlen(infop->subsystem_name)+
strlen(infop->current_request)+
@@ -59,7 +58,7 @@
void ss_error (int sci_idx, long code, const char * fmt, ...)
{
- register char *whoami;
+ char *whoami;
va_list pvar;
va_start (pvar, fmt);
--- resize/sim_progress.c
+++ resize/sim_progress.c
@@ -87,7 +87,7 @@
return retval;
memset(prog, 0, sizeof(struct ext2_sim_progress));
- retval = ext2fs_get_mem(strlen(label)+1, (void **) &prog->label);
+ retval = ext2fs_get_mem(strlen(label)+1, &prog->label);
if (retval) {
free(prog);
return retval;

View File

@ -0,0 +1,404 @@
--- misc/Makefile.in
+++ misc/Makefile.in
@@ -36,7 +36,7 @@
DUMPE2FS_OBJS= dumpe2fs.o
BADBLOCKS_OBJS= badblocks.o
E2IMAGE_OBJS= e2image.o
-FSCK_OBJS= fsck.o base_device.o
+FSCK_OBJS= fsck.o base_device.o fsck_udev.o
BLKID_OBJS= blkid.o
FILEFRAG_OBJS= filefrag.o
@@ -57,6 +57,9 @@
LIBS_BLKID= $(LIBBLKID) $(LIBUUID)
DEPLIBS_BLKID= $(LIBBLKID) $(DEPLIBUUID)
+LIBS_VOLID= -lvolume_id
+DEPLIBS_VOLID=
+
LIBS_E2P= $(LIBE2P) $(LIBCOM_ERR)
DEPLIBS_E2P= $(LIBE2P) $(LIBCOM_ERR)
@@ -98,10 +101,6 @@
@$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(srcdir)/base_device.c \
-DDEBUG -o base_device
-check:: base_device
- ./base_device < $(srcdir)/base_device.tst > base_device.out
- cmp $(srcdir)/base_device.tst base_device.out
-
mklost+found: $(MKLPF_OBJS)
@echo " LD $@"
@$(CC) $(ALL_LDFLAGS) -o mklost+found $(MKLPF_OBJS) $(LIBINTL)
@@ -138,9 +137,9 @@
@$(CC) $(ALL_LDFLAGS) -o dumpe2fs $(DUMPE2FS_OBJS) $(LIBS) \
$(LIBS_E2P) $(LIBUUID) $(LIBINTL)
-fsck: $(FSCK_OBJS) $(DEBLIBS_BLKID)
+fsck: $(FSCK_OBJS) $(DEBLIBS_VOLID)
@echo " LD $@"
- @$(CC) $(ALL_LDFLAGS) -o fsck $(FSCK_OBJS) $(LIBS_BLKID) $(LIBINTL)
+ @$(CC) $(ALL_LDFLAGS) -o fsck $(FSCK_OBJS) $(LIBS_VOLID) $(LIBINTL)
badblocks: $(BADBLOCKS_OBJS) $(DEPLIBS)
@echo " LD $@"
--- misc/base_device.c
+++ misc/base_device.c
@@ -27,6 +27,8 @@
#endif
#include <ctype.h>
#include <string.h>
+#include <sys/stat.h>
+#include <errno.h>
#include "fsck.h"
--- misc/fsck.8.in
+++ misc/fsck.8.in
@@ -8,7 +8,7 @@
.SH SYNOPSIS
.B fsck
[
-.B \-sAVRTNP
+.B \-sAVRTMNP
]
[
.B \-C
@@ -236,6 +236,14 @@
.B \-N
Don't execute, just show what would be done.
.TP
+.B \-M
+Emulate
+.BR mount (1)
+behaviour; do not check the filesystem if it's not listed in
+/etc/fstab or if
+.I fs_pass_no
+of the corresponding entry is zero.
+.TP
.B \-P
When the
.B \-A
--- misc/fsck.c
+++ misc/fsck.c
@@ -59,7 +59,6 @@
#include "../version.h"
#include "nls-enable.h"
#include "fsck.h"
-#include "blkid/blkid.h"
#ifndef _PATH_MNTTAB
#define _PATH_MNTTAB "/etc/fstab"
@@ -118,7 +117,6 @@
struct fsck_instance *instance_list;
const char *fsck_prefix_path = "/sbin:/sbin/fs.d:/sbin/fs:/etc/fs:/etc";
char *fsck_path = 0;
-blkid_cache cache = NULL;
static char *string_copy(const char *s)
{
@@ -297,7 +295,7 @@
parse_escape(freq);
parse_escape(passno);
- dev = blkid_get_devname(cache, device, NULL);
+ dev = fsck_get_devname(device);
if (dev)
device = dev;
@@ -322,7 +320,7 @@
if (strcmp(fs->type, "auto") != 0)
return;
- t = blkid_get_tag_value(cache, "TYPE", fs->device);
+ t = fsck_get_fstype(fs->device);
if (t) {
free(fs->type);
fs->type = t;
@@ -1048,7 +1046,7 @@
static void usage(NOARGS)
{
- fputs(_("Usage: fsck [-ANPRTV] [ -C [ fd ] ] [-t fstype] [fs-options] [filesys ...]\n"), stderr);
+ fputs(_("Usage: fsck [-AMNPRTV] [ -C [ fd ] ] [-t fstype] [fs-options] [filesys ...]\n"), stderr);
exit(EXIT_USAGE);
}
@@ -1094,7 +1092,7 @@
progname);
exit(EXIT_ERROR);
}
- dev = blkid_get_devname(cache, arg, NULL);
+ dev = fsck_get_devname(arg);
if (!dev && strchr(arg, '=')) {
/*
* Check to see if we failed because
@@ -1240,7 +1238,7 @@
bindtextdomain(NLS_CAT_NAME, LOCALEDIR);
textdomain(NLS_CAT_NAME);
#endif
- blkid_get_cache(&cache, getenv("BLKID_FILE"));
+ fsck_get_cache(getenv("BLKID_FILE"));
PRS(argc, argv);
if (!notitle)
@@ -1287,6 +1285,16 @@
break;
}
fs = lookup(devices[i]);
+ if (like_mount) {
+ /*
+ * Emulate mount behaviour:
+ * Do not check device if not found
+ * in /etc/fstab or if the passno
+ * is set to '0'
+ */
+ if (!fs || ignore(fs))
+ continue;
+ }
if (!fs) {
fs = create_fs_device(devices[i], 0, "auto",
0, -1, -1);
@@ -1309,6 +1317,6 @@
}
status |= wait_many(FLAG_WAIT_ALL);
free(fsck_path);
- blkid_put_cache(cache);
+ fsck_put_cache();
return status;
}
--- misc/fsck.h
+++ misc/fsck.h
@@ -68,3 +68,9 @@
extern dev_t base_devt(const char *device);
extern int match_device(const char *dev1, const char *dev2);
+
+extern int fsck_get_cache(const char *filename);
+extern void fsck_put_cache(void);
+extern char *fsck_get_devname(const char *device);
+extern char *fsck_get_fstype(const char *device);
+
--- misc/fsck_blkid.c
+++ misc/fsck_blkid.c
@@ -0,0 +1,29 @@
+/*
+ * Wrapper for libblkid
+ */
+
+#include <stdio.h>
+#include "blkid/blkid.h"
+
+static blkid_cache cache = NULL;
+
+int fsck_get_cache(const char *filename)
+{
+ return blkid_get_cache(&cache, name);
+}
+
+void fsck_put_cache(void)
+{
+ blkid_put_cache(cache);
+}
+
+char *fsck_get_devname(const char *device)
+{
+ return blkid_get_devname(cache, device, NULL);
+}
+
+char *fsck_get_fstype(const char *device)
+{
+ return blkid_get_tag_value(cache, "TYPE", device);
+}
+
--- misc/fsck_udev.c
+++ misc/fsck_udev.c
@@ -0,0 +1,188 @@
+/*
+ * Wrapper for libvolume_id
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/mount.h>
+#include <sys/ioctl.h>
+#include <stddef.h>
+#include <libvolume_id.h>
+
+#include "fsck.h"
+
+int fsck_get_cache(const char *filename)
+{
+ return 0;
+}
+
+void fsck_put_cache(void)
+{
+}
+
+char *fsck_get_devname_by_uuid(const char *uuid)
+{
+ char *dev = NULL;
+
+ if (!uuid)
+ return NULL;
+
+ dev = malloc(19 + strlen(uuid));
+ if (dev) {
+ strcpy(dev,"/dev/disk/by-uuid/");
+ strcat(dev,uuid);
+ }
+
+ return dev;
+}
+
+char *fsck_get_devname_by_label(const char *label)
+{
+ char *dev = NULL;
+
+ if (!label)
+ return NULL;
+
+ dev = malloc(20 + strlen(label));
+ if (dev) {
+ strcpy(dev,"/dev/disk/by-label/");
+ strcat(dev,label);
+ }
+
+ return dev;
+}
+
+char *fsck_get_devname(const char *spec)
+{
+ char *token, *cp, *value;
+ char *nspec = NULL;
+
+ if (!spec)
+ return NULL;
+
+ token = strdup(spec);
+ if (!token)
+ return NULL;
+
+ /* We have to return an allocated string */
+ if (!(cp = strchr(token, '=')))
+ return token;
+
+ value = token + (cp - token);
+ *value++ = '\0';
+
+ if (*value == '"' || *value == '\'') {
+ char c = *value++;
+ if (!(cp = strrchr(value, c)))
+ goto errout; /* missing closing quote */
+ *cp = '\0';
+ }
+
+ if (!strcmp(token,"LABEL")) {
+ nspec = fsck_get_devname_by_label(value);
+ } else if (!strcmp(token,"UUID")) {
+ nspec = fsck_get_devname_by_uuid(value);
+ }
+
+ free(token);
+
+ errout:
+ return nspec;
+}
+
+struct volume_id_types_t {
+ int id;
+ char *token;
+ char *env;
+};
+
+enum {
+ VOLUME_ID_NONE=0,
+ VOLUME_ID_TYPE,
+ VOLUME_ID_LABEL,
+ VOLUME_ID_UUID
+};
+
+#define volume_id_offset(member) (unsigned long)offsetof(struct volume_id,member)
+
+struct volume_id_types_t volume_id_types[] = {
+ { VOLUME_ID_TYPE, "TYPE", "ID_FS_TYPE" },
+ { VOLUME_ID_LABEL, "LABEL", "ID_FS_LABEL" },
+ { VOLUME_ID_UUID, "UUID", "ID_FS_UUID" },
+ { VOLUME_ID_NONE, NULL, NULL },
+};
+
+char *volume_id_get_tag(const char *spec, const char *token)
+{
+ struct volume_id *vid;
+ uint64_t size;
+ struct volume_id_types_t *volume_id_ptr = volume_id_types;
+ char *var, *value;
+
+ value = malloc(VOLUME_ID_LABEL_SIZE);
+ if (!value)
+ return NULL;
+
+ if (!spec)
+ return NULL;
+
+ while (volume_id_ptr->token && strcmp(volume_id_ptr->token,token))
+ volume_id_ptr++;
+
+ if (!volume_id_ptr->token) {
+ free(value);
+ value = NULL;
+ goto out;
+ }
+
+ /* Quick exit if ID_FS_* variables are set */
+ if ((var = getenv(volume_id_ptr->env))) {
+ strcpy(value,var);
+ goto out;
+ }
+
+ vid = volume_id_open_node(spec);
+ if (!vid) {
+ free(value);
+ value = NULL;
+ goto out;
+ }
+
+ if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0)
+ size = 0;
+
+ if (volume_id_probe_all(vid, 0, size) == 0) {
+ switch(volume_id_ptr->id) {
+ case VOLUME_ID_TYPE:
+ strcpy(value, vid->type);
+ break;
+ case VOLUME_ID_LABEL:
+ strcpy(value, vid->label);
+ break;
+ case VOLUME_ID_UUID:
+ strcpy(value, vid->uuid);
+ break;
+ default:
+ free(value);
+ value = NULL;
+ break;
+ }
+ } else {
+ free(value);
+ volume_id_close(vid);
+ return NULL;
+ }
+
+ volume_id_close(vid);
+
+ out:
+ return value;
+}
+
+char *fsck_get_fstype(const char *device)
+{
+ return volume_id_get_tag(device, "TYPE");
+}
+

12
e2fsprogs-mdraid.patch Normal file
View File

@ -0,0 +1,12 @@
--- lib/blkid/probe.c
+++ lib/blkid/probe.c
@@ -796,7 +796,8 @@
*/
try_again:
type = 0;
- if (!dev->bid_type || !strcmp(dev->bid_type, "mdraid")) {
+ if ((!dev->bid_type || !strcmp(dev->bid_type, "mdraid")) &&
+ getenv( "BLKID_SKIP_CHECK_MDRAID")==NULL ) {
uuid_t uuid;
if (check_mdraid(probe.fd, uuid) == 0) {

View File

@ -0,0 +1,11 @@
--- MCONFIG.in
+++ MCONFIG.in
@@ -62,7 +62,7 @@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
-MKINSTALLDIRS = @MKINSTALLDIRS@
+MKINSTALLDIRS = mkdir -p
#
# Library definitions

View File

@ -0,0 +1,11 @@
--- lib/blkid/probe.c
+++ lib/blkid/probe.c
@@ -422,7 +422,7 @@
blocksize = blkid_le16(rs->rs_blocksize);
/* If the superblock is inside the journal, we have the wrong one */
- if (id->bim_kboff/(blocksize>>10) > blkid_le32(rs->rs_journal_block))
+ if ((blocksize>>10) && id->bim_kboff/(blocksize>>10) > blkid_le32(rs->rs_journal_block))
return -BLKID_ERR_BIG;
/* LABEL/UUID are only valid for later versions of Reiserfs v3.6. */

View File

@ -0,0 +1,15 @@
--- intl/Makefile.in
+++ intl/Makefile.in
@@ -418,6 +418,12 @@
# Define this as empty until I found a useful application.
installcheck:
+install-shlibs:
+
+uninstall-shlibs:
+
+install-shlibs-strip:
+
uninstall:
if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
&& test '@USE_INCLUDED_LIBINTL@' = yes; then \

635
e2fsprogs.changes Normal file
View File

@ -0,0 +1,635 @@
-------------------------------------------------------------------
Wed Nov 8 02:04:35 CET 2006 - ro@suse.de
- provide libcom_err-devel in libcom_err
-------------------------------------------------------------------
Thu Oct 19 12:01:30 CEST 2006 - mkoenig@suse.de
- fix bug in uuid patch
-------------------------------------------------------------------
Mon Oct 16 14:35:42 CEST 2006 - mkoenig@suse.de
- fix build of shared lib
-------------------------------------------------------------------
Thu Oct 12 14:18:36 CEST 2006 - mkoenig@suse.de
- fix uuid bug [#189640]
- fix blkid problem with empty FAT labels [#211110]
- fix small typo in resize2fs man page
-------------------------------------------------------------------
Tue Sep 26 12:45:40 CEST 2006 - mkoenig@suse.de
- fix bug in fsck udev/libvolume_id patch [#205671]
-------------------------------------------------------------------
Wed Sep 20 10:15:16 CEST 2006 - mkoenig@suse.de
- update to version 1.39:
* Fix 32-bit cleanliness
* Change mke2fs to use /etc/mke2fs.conf
* Mke2fs will now create filesystems hash trees and
on-line resizing enabled by default
* The e2fsprogs tools (resize2fs, e2fsck, mke2fs) will open the
filesystem device node in exclusive mode
* Add support for on-line resizing to resize2fs.
* The blkid library will now store the UUID of the external
journal used by ext3 filesystems
* E2fsck will now consult a configuration file, /etc/e2fsck.conf
* E2fsck will detect if the superblock's last mount field or
last write field is in the future, and offer to fix if so.
* E2fsck now checks to see if the superblock hint for the
location of the external journal is incorrect
* Resize2fs will now automatically determine the RAID stride
parameter that had been used to create the filesystem
* Fix mke2fs so that it correctly creates external journals on
big-endian machines
* Fix a bug in the e2p library
* Add a new debugfs command, set_current_time
* Fix debugfs commands
* Fix mklost+found so that it creates a full-sized directory on
filesystems with larger block sizes.
* Fix a file descriptor leak in blkid library
* Allow fractional percentages to the -m option in mke2fs and tune2fs
* Add support for device mapper library to the blkid library
* Fix the blkid library so that it notices when an ext2 filesystem
is upgraded to ext3.
* Improve the blkid's library VFAT/FAT detectio
* Add support for the reiser4 and software suspend partitions
to the blkid library.
- update ext2resize to version 1.1.19:
* Add support for ext3 online resizing
* Support LARGEFILE compat flag
* Make the resize inode part of the fs struct
* Add the FL_IOCTL flag
* Bugfixes
-------------------------------------------------------------------
Fri Aug 11 11:32:55 CEST 2006 - pth@suse.de
- Fix to comply with gettex 0.15.
- Move ext2resize sources to toplevel directory.
- Fix use of MKINSTALLDIRS.
-------------------------------------------------------------------
Fri Aug 4 12:36:48 CEST 2006 - kay.sievers@suse.de
- update libvolume_id integration to match util-linux
-------------------------------------------------------------------
Fri Jun 16 15:39:01 CEST 2006 - ro@suse.de
- added libvolume_id-devel to BuildRequires
- updated e2fsprogs-udev.patch to match header rename
-------------------------------------------------------------------
Wed Feb 8 10:22:12 CET 2006 - hare@suse.de
- Fix fsck -m (#146606) to really check filesystems.
-------------------------------------------------------------------
Mon Jan 30 12:53:51 CET 2006 - hvogel@suse.de
- Document -I inode-size [#145445]
-------------------------------------------------------------------
Sun Jan 29 15:08:22 CET 2006 - hvogel@suse.de
- fix hares patch
-------------------------------------------------------------------
Fri Jan 27 16:01:07 CET 2006 - hare@suse.de
- Add option to not return an error code for mounted
filesystems (#145400).
-------------------------------------------------------------------
Wed Jan 25 21:30:08 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Fri Jan 20 12:01:31 CET 2006 - hvogel@suse.de
- Support ext2/ext3 online resize
-------------------------------------------------------------------
Mon Dec 12 15:32:45 CET 2005 - hvogel@suse.de
- remove lib/et/test_cases/imap_err* from the tarball because
they are not distributeable.
-------------------------------------------------------------------
Tue Dec 6 10:25:12 CET 2005 - pth@suse.de
- remove unnecessary type-punning
- reduce compiler warnings
-------------------------------------------------------------------
Tue Nov 15 17:00:23 CET 2005 - jblunck@suse.de
- added close.patch provided by Ted Tso (IBM) to fix bug #132708
-------------------------------------------------------------------
Mon Nov 14 12:59:10 CET 2005 - hare@suse.de
- Use devt when comparing devices
- fsck: Use information provided by udev for detecting devices
-------------------------------------------------------------------
Wed Oct 5 13:14:59 CEST 2005 - hvogel@suse.de
- fix too few arguments to a *printf function
- require libcom_err on e2fsprogs-devel
-------------------------------------------------------------------
Fri Sep 9 13:06:48 CEST 2005 - hvogel@suse.de
- add gross hack to avoid divide by zero in probe_reiserfs
[#115827]
-------------------------------------------------------------------
Mon Aug 8 14:16:17 CEST 2005 - hvogel@suse.de
- added environment variable BLKID_SKIP_CHECK_MDRAID to work around
broken software raid detection [Bug #100530]
-------------------------------------------------------------------
Tue Jul 5 16:38:38 CEST 2005 - hvogel@suse.de
- update to version 1.38
- mt reworked his patches a bit. See Bug #66534
-------------------------------------------------------------------
Thu Jun 23 16:00:14 CEST 2005 - hvogel@suse.de
- call ldconfig in post/postun
- add version to devel package dependencie
- readd missing patch (7)
-------------------------------------------------------------------
Thu Apr 28 15:41:16 CEST 2005 - hvogel@suse.de
- update to version 1.37
- mt reworked one libcom_err patch a bit to provide more
meaningfull error handling
- fix retuen value in inode.c
-------------------------------------------------------------------
Thu Mar 31 11:58:54 CEST 2005 - hvogel@suse.de
- split libcom_err to a subpackage
- add mutex synchronization to e2fsprogs/lib/et
- removed usage of a static buffer in error_message()
- disabled init_error_table function
- disabled build of unused e2fsck.static
-------------------------------------------------------------------
Fri Mar 18 17:30:04 CET 2005 - hvogel@suse.de
- fix endian unsafeness in getopt (#73855)
-------------------------------------------------------------------
Tue Feb 8 11:04:02 CET 2005 - hvogel@suse.de
- Update to 1.36 final
-------------------------------------------------------------------
Tue Aug 10 13:27:12 CEST 2004 - pth@suse.de
- Update to 1.35 RC5
-------------------------------------------------------------------
Wed Mar 17 16:28:40 CET 2004 - pth@suse.de
- Don't build the EVMS plugin because it's out of date for
EVMS in kernel 2.6.
-------------------------------------------------------------------
Thu Mar 4 09:26:53 CET 2004 - pth@suse.de
- Add patch from Olaf Hering that makes fsck read a different
blkid file via BLKID_FILE environment var (#35156)
-------------------------------------------------------------------
Thu Feb 19 11:32:11 CET 2004 - kukuk@suse.de
- Remove obsolete recode call
-------------------------------------------------------------------
Mon Jan 12 02:46:32 CET 2004 - ro@suse.de
- removed run_ldconfig again
-------------------------------------------------------------------
Sat Jan 10 16:57:05 CET 2004 - adrian@suse.de
- add %run_ldconfig
-------------------------------------------------------------------
Thu Oct 2 11:04:01 CEST 2003 - pthomas@suse.de
- Add patch from Kurt Garloff to make e2fsprogs compile
with latest kernel headers (SCSI_BLK_MAJOR undefined).
-------------------------------------------------------------------
Mon Sep 15 18:37:05 CEST 2003 - pthomas@suse.de
- Fix czech message catalog which has been transformed twice
from latin2 to utf-8 and add an iconv call to the spec file
that will make building fail if the file is corrected upstream.
-------------------------------------------------------------------
Sat Aug 30 13:58:00 CEST 2003 - agruen@suse.de
- Fix an endianness bug in ext2fs_swap_inode: Fast symlinks that
have extended attributes are acidentally byte swapped on
big-endian machines.
-------------------------------------------------------------------
Fri Aug 1 15:35:21 CEST 2003 - pthomas@suse.de
- Apply patch from Ted T'so for badblocks.
-------------------------------------------------------------------
Thu Jul 31 15:09:15 CEST 2003 - pthomas@suse.de
- Update to 1.34.
- Various fixes to libcom_err to make it really compatible
to the heimdal version.
- Fix int<->pointer casts.
- Fix places that may break strict aliasing.
-------------------------------------------------------------------
Fri Jun 20 01:40:01 CEST 2003 - ro@suse.de
- added directory to filelist
-------------------------------------------------------------------
Wed May 14 09:37:59 CEST 2003 - pthomas@suse.de
- Use %defattr
- Include all installed files.
-------------------------------------------------------------------
Tue Apr 29 17:07:38 CEST 2003 - mfabian@suse.de
- add libblkid.so* and libblkid.a to file lists
-------------------------------------------------------------------
Thu Apr 24 16:19:13 CEST 2003 - pthomas@suse.de
- Update to 1.33 and adapt patches.
- Add missing headers where necessary.
-------------------------------------------------------------------
Thu Apr 24 12:20:23 CEST 2003 - ro@suse.de
- fix install_info --delete call and move from preun to postun
-------------------------------------------------------------------
Fri Feb 7 01:18:15 CET 2003 - ro@suse.de
- added install_info macros
-------------------------------------------------------------------
Tue Oct 1 22:21:42 MEST 2002 - garloff@suse.de
- Fix segfault in display of real device in presence of volume
name. #20422
-------------------------------------------------------------------
Tue Sep 3 21:42:09 MEST 2002 - mls@suse.de
- remove duplicate evms scan (already included in 1.28)
- fix volume group scan bug
-------------------------------------------------------------------
Mon Sep 2 13:51:20 CEST 2002 - agruen@suse.de
- Update to 1.28. Includes very minor fixes in htree, which we have
disabled anyway, one fix that we had in a separate patch, and
has additional release notes.
-------------------------------------------------------------------
Mon Aug 19 15:17:27 CEST 2002 - agruen@suse.de
- Update to 1.28-WIP-0817, which includes Extended Attribute
and several smaller fixes. We disable htree support and don't
install the evms library for now.
- Remove `make gcc-wall' for now (as it does a `make clean' in
doc/).
-------------------------------------------------------------------
Thu Aug 15 14:10:00 MEST 2002 - mls@suse.de
- support jfs, reiserfs, evms in label/uuid scan (code stolen
from util-linux:mount)
-------------------------------------------------------------------
Sun Jul 28 09:07:03 CEST 2002 - kukuk@suse.de
- Remove unused tetex from neededforbuild
-------------------------------------------------------------------
Fri Jul 19 22:00:32 CEST 2002 - olh@suse.de
- use a better method for finding missed filelist entries
-------------------------------------------------------------------
Fri Apr 12 15:03:46 CEST 2002 - sf@suse.de
- added %{_libdir}
- added fix for lib/lib64
-------------------------------------------------------------------
Thu Mar 28 15:22:42 CET 2002 - bk@suse.de
- fix man pages, filelist and add check for missing files in packs
-------------------------------------------------------------------
Wed Mar 27 12:18:11 CET 2002 - bk@suse.de
- Update to 1.27, fixes resource limit problem for other archs and
merges many patches
-------------------------------------------------------------------
Thu Mar 7 19:58:44 CET 2002 - pthomas@suse.de
- Add patch from Ted T'so to keep e2fsck from dumping
core when the journal inode is missing.
-------------------------------------------------------------------
Mon Mar 4 18:25:04 CET 2002 - pthomas@suse.de
- Fix implicit function declarations and some other gcc warnings.
- Include patch from Kurt Garloff to make e2fsck display the
device name in addition to the volume label. Adapt it to 1.26.
- Adapt BSD_disklables.diff to new code.
- Set LC_CTYPE in addition to LC_MESSAGES.
- Repack with bzip2.
-------------------------------------------------------------------
Fri Mar 1 19:21:44 CET 2002 - bk@suse.de
- Update to 1.26. This release has a number of critical bug
fixes over the previous release, version 1.25:
-------------------------------------------------------------------
Fri Feb 15 09:34:46 CET 2002 - pthomas@suse.de
- Use %{_lib} and %{_libdir}.
-------------------------------------------------------------------
Wed Feb 13 14:06:39 CET 2002 - pthomas@suse.de
- Make heimdal-devel conflict e2fsprogs-devel.
Temporary solution for bug #13145
-------------------------------------------------------------------
Thu Dec 13 17:21:35 CET 2001 - pthomas@suse.de
- Add mkfs.ext2.8 because mkfs.8 from util-linux references it.
Fixes bug #12613.
-------------------------------------------------------------------
Fri Nov 23 13:15:37 CET 2001 - pthomas@suse.de
- Add accidently left out e2image to file list. Fixes bug
#12009
-------------------------------------------------------------------
Wed Oct 31 14:24:35 CET 2001 - ro@suse.de
- fix for axp: should malloc buffer _before_ use
-------------------------------------------------------------------
Wed Oct 10 20:06:44 CEST 2001 - pthomas@suse.de
- Update to 1.25.
- Remove patches not needed anymore.
- Change mke2fs to output warnings to stderr not stdout.
- Repack as bz2.
-------------------------------------------------------------------
Mon Sep 24 11:26:20 CEST 2001 - olh@suse.de
- replace ext2fs_d
-------------------------------------------------------------------
Fri Sep 21 15:08:02 CEST 2001 - pthomas@suse.de
- Add patch for mke2fs from 1.25 as that bug seems to be the
reason for the mk_initrd warning.
-------------------------------------------------------------------
Wed Sep 12 15:01:03 CEST 2001 - pthomas@suse.de
- Update to 1.24a:
- Fix brown-paper bug in mke2fs which caused it to segfault.
- Revert the BLKGETSIZE64 support as this ioctl has been used
by an unofficial kernel patch to update the last sector on
the disk, and this was causing disk corruption problems as a
result.
- Mke2fs is now more careful about zapping swap space signatures
and other filesystem/raid superblock magic values so.
- E2fsck will no longer complain if the the mode of
EXT2_RESIZE_INO is a regular file
- mke2fs and tune2fs will allow the use of UUID= or LABEL=
specifiers when specifying the external journal device.
tune2fs will also search devices looking for the external
journal device when removing.
-------------------------------------------------------------------
Fri Aug 17 15:01:14 CEST 2001 - ro@suse.de
- update to 1.23 to enable external journals on ext3
-------------------------------------------------------------------
Wed Aug 15 16:36:15 CEST 2001 - pthomas@suse.de
- Update to 1.22.
- Drop fsck Patch as code changed.
- Use LD_LIBRARY_PATH to run test programs.
-------------------------------------------------------------------
Fri Jun 8 18:06:25 CEST 2001 - pthomas@suse.de
- Remove incorrect use of AC_REQUIRE (fails with autoconf 2.5)
- Recompress tarball with bzip2.
-------------------------------------------------------------------
Thu Jan 18 20:10:32 CET 2001 - schwab@suse.de
- Add Obsoletes: ext2fs_d and Requires: e2fsprogs to devel
subpackage.
-------------------------------------------------------------------
Mon Nov 6 05:33:16 MET 2000 - pthomas@suse.de
- use _mandir and _infodir more consistently in spec file.
-------------------------------------------------------------------
Sun Nov 5 23:16:13 CET 2000 - ro@suse.de
- renamed packages to e2fsprogs/e2fsprogs-devel
-------------------------------------------------------------------
Fri Jun 9 17:50:24 CEST 2000 - kasal@suse.cz
- Build dynamic libraries. Partition Surprise requires them.
- Make /usr/lib/*.so symlinks relative.
-------------------------------------------------------------------
Thu Mar 23 14:22:44 CET 2000 - kukuk@suse.de
- Don't erase BSD labels on Alpha
- Add Y2K fix to debugfs
-------------------------------------------------------------------
Wed Mar 22 21:38:15 CET 2000 - kukuk@suse.de
- Fix ifdefs for gcc 2.95.2
-------------------------------------------------------------------
Tue Feb 22 18:55:13 CET 2000 - garloff@suse.de
- Bugfix for the change ...
- ... and change version no of fsck to 1.18a to reflect the change.
-------------------------------------------------------------------
Sun Feb 20 23:48:17 CET 2000 - garloff@suse.de
- Patch to be more clever WRT to basenames (used to find out wheter
a fsck for this device is already running).
- Give better message in case fsck fails, to tell the user what to
do. (e2fsck only displays the label, nowadays :-( )
-------------------------------------------------------------------
Thu Feb 10 15:02:43 CET 2000 - kukuk@suse.de
- Use autoconf to create new configure
-------------------------------------------------------------------
Wed Jan 19 01:45:21 CET 2000 - ro@suse.de
- man,info -> /usr/share
-------------------------------------------------------------------
Mon Jan 17 00:02:40 CET 2000 - ro@suse.de
- fixed to build on kernels >= 2.3.39
-------------------------------------------------------------------
Sat Nov 13 13:36:05 MET 1999 - kukuk@suse.de
- Update to e2fsprogs 1.18
- Create new sub-package ext2fs_d which includes libs and headers
-------------------------------------------------------------------
Mon Nov 8 18:34:42 CET 1999 - ro@suse.de
-fixed coredump in e2fsck
-------------------------------------------------------------------
Fri Oct 29 10:10:46 CEST 1999 - ro@suse.de
-e2fsprogs: 1.17 vital bugfix in e2fsck
-------------------------------------------------------------------
Sun Oct 24 23:54:17 CEST 1999 - ro@suse.de
- e2fsprogs: update to 1.16, sparse_super is default on when
called on a > 2.2 kernel, can be overridden with -O none
-------------------------------------------------------------------
Fri Oct 15 17:22:57 CEST 1999 - garloff@suse.de
- Disabled flushb again. (Moved to ddrescue.)
-------------------------------------------------------------------
Mon Sep 13 17:23:57 CEST 1999 - bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
-------------------------------------------------------------------
Wed Sep 1 10:36:58 CEST 1999 - ro@suse.de
- mke2fs: sparse superblocks default back to "off"
-------------------------------------------------------------------
Tue Aug 31 11:02:22 CEST 1999 - ro@suse.de
- update to 1.15
- cleanup diff and specfile
-------------------------------------------------------------------
Sun Jul 18 20:25:52 CEST 1999 - garloff@suse.de
- Enabled flushb compilation
-------------------------------------------------------------------
Sat Jun 26 17:50:15 MEST 1999 - kukuk@suse.de
- Add fix for fsck core dump from beta list
-------------------------------------------------------------------
Tue Mar 16 16:28:14 MET 1999 - ro@suse.de
- fixed configure call
-------------------------------------------------------------------
Fri Mar 12 07:35:48 MET 1999 - ro@suse.de
- update to 1.14
-------------------------------------------------------------------
Thu Oct 29 00:26:51 MET 1998 - ro@suse.de
- respect change in 2.1.126 SCSI_DISK_MAJOR
-------------------------------------------------------------------
Tue Sep 1 17:27:47 MEST 1998 - ro@suse.de
- update to 1.12
----------------------------------------------------------------------------
Sat Apr 26 19:14:59 MEST 1997 - florian@suse.de
- update to new version 1.10
----------------------------------------------------------------------------
Sun Apr 13 23:04:29 MEST 1997 - florian@suse.de
- update to new version 1.08
- do not include ext2 libs and include files as they are only used by dump
----------------------------------------------------------------------------
Sat Nov 2 17:35:11 CET 1996 - florian@suse.de
- update to new version 1.06
----------------------------------------------------------------------------
Sat Sep 21 01:18:40 MET DST 1996 - florian@suse.de
- update to newer version
- use now static libs instead of 4 small shared libs
----------------------------------------------------------------------
Sun Aug 25 19:28:50 MET DST 1996 - florian@suse.de
update to version 1.0.4

617
e2fsprogs.spec Normal file
View File

@ -0,0 +1,617 @@
#
# spec file for package e2fsprogs (Version 1.39)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: e2fsprogs
BuildRequires: libvolume_id-devel
License: GNU General Public License (GPL) - all versions
Group: System/Filesystems
Provides: e2fsbn ext2fs
Obsoletes: ext2fs
PreReq: %install_info_prereq
Autoreqprov: on
Version: 1.39
Release: 16
Summary: Utilities for the Second Extended File System
URL: http://e2fsprogs.sourceforge.net
Source: %{name}-%{version}.tar.bz2
Patch1: elf.diff
Patch3: %{name}-1.35-libdir.diff
Patch4: %{name}-1.33-fsckdevdisplay.diff
Patch5: %{name}-1.33-codecleanup.diff
Patch15: e2fsprogs-blkid.diff
Patch16: e2fsprogs-codecleanup.diff
Patch17: e2fsprogs-mdraid.patch
Patch18: e2fsprogs-probe_reiserfs-fpe.patch
Patch19: e2fsprogs-base_devt.patch
Patch20: e2fsprogs-libvolume_id-support.patch
Patch21: close.patch
Patch22: e2fsprogs-1.38-inode_size.patch
Patch23: fsck-ignore-mounted.patch
Patch24: e2fsprogs-mkinstalldirs.patch
Patch25: e2fsprogs-special_make_targets.patch
Patch26: e2fsprogs-1.39-cleanup.patch
Patch27: e2fsprogs-1.39-uuid_duplicates.patch
Patch28: e2fsprogs-1.39-blkid_zero_label.patch
Patch29: e2fsprogs-1.39-resize2fs_manpage.patch
# libcom_err patches
Patch30: libcom_err-no-static-buffer.patch
Patch31: libcom_err-no-init_error_table.patch
Patch32: libcom_err-no-e2fsck.static.patch
Patch33: libcom_err-mutex.patch
# ext2 resize patches
Patch45: ext2resize-byteorder.patch
Patch46: ext2resize-nofallback.patch
Patch47: ext2resize-nowrite.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define ext2resize_name ext2resize-1.1.19
Source1: %{ext2resize_name}.tar.bz2
%description
Utilities needed to create and maintain ext2 and ext3 file systems
under Linux. Included in this package are: chattr, lsattr, mke2fs,
mklost+found, tune2fs, e2fsck, resize2fs, and badblocks.
Authors:
--------
Remy Card <card@masi.ibp.fr>
Theodore Ts'o <tytso@mit.edu>
%package devel
Summary: Include Files and Libraries mandatory for Development.
Group: Development/Libraries/C and C++
Autoreqprov: on
Obsoletes: ext2fs_d
Provides: ext2fs_d
Requires: e2fsprogs == %version libcom_err
%description devel
This package contains all necessary include files and libraries needed
to develop applications that require these.
Authors:
--------
Remy Card <card@masi.ibp.fr>
Theodore Ts'o <tytso@mit.edu>
%package -n libcom_err
Summary: com_err library
Group: System/Libraries
Provides: libcom_err-devel = %{version}
Autoreqprov: on
%description -n libcom_err
com_err is an error message display library.
Authors:
--------
Remy Card <card@masi.ibp.fr>
Theodore Ts'o <tytso@mit.edu>
%prep
%setup -q -b1
# e2fsprogs patches
%patch1
%patch3
%patch4
%patch5
%patch15
%patch16
%patch17
%patch18
%patch19 -p1
%patch20 -p0
%patch21 -p1
%patch22
%patch23
%patch24
%patch26
%patch27 -p1
%patch28 -p1
%patch29
# libcom_err patches
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
# ext2 resize patches
find . -type f|xargs chmod u+w
pushd ../%{ext2resize_name}
%patch45 -p2
%patch46 -p2
%patch47 -p2
popd
%build
%{?suse_update_config:%{suse_update_config -f}}
rm aclocal.m4
rm -f po/Makefile.in
gettextize --copy --force --intl
autoreconf --force --install
%if %{suse_version} > 1010
patch -p0 -i %{P:25}
%endif
./configure --enable-dynamic-e2fsck \
--prefix=%{_prefix} --with-root-prefix='' \
--mandir=%{_mandir} --infodir=%{_infodir} --libdir=%{_libdir} \
--enable-elf-shlibs \
--disable-evms \
--with-ldopts=-pthread \
CFLAGS="$RPM_OPT_FLAGS"
make
#make check
#make gcc-wall
export CFLAGS="$RPM_OPT_FLAGS"
pushd ../%{ext2resize_name}
# aclocal
# automake -a -f
# autoconf
autoreconf --force --install
./configure \
--prefix=%{_prefix} \
--mandir=%{_mandir} --infodir=%{_infodir} --libdir=%{_libdir}
make
popd
%install
rm -rf $RPM_BUILD_ROOT
make install install-libs DESTDIR=$RPM_BUILD_ROOT lib=%{_lib}
%{find_lang} %{name}
rm $RPM_BUILD_ROOT%{_libdir}/e2initrd_helper
pushd ../%{ext2resize_name}
make DESTDIR=$RPM_BUILD_ROOT install
# For now, we only want to package up the ext2online binary. Delete the
# others.
rm -f $RPM_BUILD_ROOT%{_sbindir}/ext2resize
rm -f $RPM_BUILD_ROOT%{_sbindir}/ext2prepare
rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/ext2resize*
rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/ext2prepare*
# We want some of the ext2resize doc files to be clearly identified as
# not being part of e2fsprogs!
mv AUTHORS AUTHORS.ext2resize
mv COPYING COPYING.ext2resize
mv NEWS NEWS.ext2resize
mv README README.ext2resize
mv doc/HOWTO doc/HOWTO.ext2resize
popd
%clean
rm -rf $RPM_BUILD_ROOT
%files -f %{name}.lang
%defattr(-, root, root)
%doc RELEASE-NOTES ChangeLog README doc/draft-leach-uuids-guids-01.txt doc/libblkid.txt
%doc ../%{ext2resize_name}/AUTHORS.ext2resize
%doc ../%{ext2resize_name}/COPYING.ext2resize
%doc ../%{ext2resize_name}/NEWS.ext2resize
%doc ../%{ext2resize_name}/README.ext2resize
%doc ../%{ext2resize_name}/doc/HOWTO.ext2resize
%config /etc/mke2fs.conf
/sbin/badblocks
/sbin/debugfs
/sbin/dumpe2fs
/sbin/e2fsck
/sbin/e2label
/sbin/fsck
/sbin/fsck.ext2
/sbin/fsck.ext3
/sbin/mke2fs
/sbin/mkfs.ext2
/sbin/mkfs.ext3
/sbin/resize2fs
/sbin/tune2fs
/sbin/e2image
/sbin/logsave
/sbin/blkid
/sbin/findfs
/usr/bin/chattr
/usr/bin/lsattr
/usr/bin/uuidgen
/usr/sbin/mklost+found
/usr/sbin/filefrag
/%{_lib}/libblkid.so.*
/%{_lib}/libe2p.so.*
/%{_lib}/libext2fs.so.*
/%{_lib}/libuuid.so.*
%{_infodir}/libext2fs.info.gz
%{_mandir}/man1/chattr.1.gz
%{_mandir}/man1/lsattr.1.gz
%{_mandir}/man1/uuidgen.1.gz
%{_mandir}/man5/e2fsck.conf.5.gz
%{_mandir}/man5/mke2fs.conf.5.gz
%{_mandir}/man8/*.8.gz
# ext2resize files
%{_sbindir}/ext2online
%{_mandir}/man8/ext2online.8*
%post
/sbin/ldconfig
%install_info --info-dir=%{_infodir} %{_infodir}/libext2fs.info.gz
%postun
/sbin/ldconfig
%install_info_delete --info-dir=%{_infodir} %{_infodir}/libext2fs.info.gz
%files devel
%defattr(-, root, root)
%{_libdir}/libblkid.a
%{_libdir}/libe2p.a
%{_libdir}/libext2fs.a
%{_libdir}/libuuid.a
%{_libdir}/libblkid.so
%{_libdir}/libe2p.so
%{_libdir}/libext2fs.so
%{_libdir}/libuuid.so
/usr/include/e2p
/usr/include/ext2fs
/usr/include/uuid
/usr/include/blkid
%_libdir/pkgconfig/blkid.pc
%_libdir/pkgconfig/e2p.pc
%_libdir/pkgconfig/ext2fs.pc
%_libdir/pkgconfig/uuid.pc
%{_mandir}/man3/*.3.gz
%files -n libcom_err
%defattr(-, root, root)
/%{_lib}/libcom_err.so.*
/%{_lib}/libss.so.*
%_datadir/et
%_datadir/ss
%_bindir/compile_et
%_bindir/mk_cmds
%{_mandir}/man1/compile_et.1.gz
%{_mandir}/man1/mk_cmds.1.gz
%{_libdir}/libcom_err.so
%{_libdir}/libcom_err.a
%{_libdir}/libss.a
%{_libdir}/libss.so
%_libdir/pkgconfig/com_err.pc
%_libdir/pkgconfig/ss.pc
%_includedir/et
%_includedir/ss
%post -n libcom_err -p /sbin/ldconfig
%postun -n libcom_err -p /sbin/ldconfig
%changelog -n e2fsprogs
* Wed Nov 08 2006 - ro@suse.de
- provide libcom_err-devel in libcom_err
* Thu Oct 19 2006 - mkoenig@suse.de
- fix bug in uuid patch
* Mon Oct 16 2006 - mkoenig@suse.de
- fix build of shared lib
* Thu Oct 12 2006 - mkoenig@suse.de
- fix uuid bug [#189640]
- fix blkid problem with empty FAT labels [#211110]
- fix small typo in resize2fs man page
* Tue Sep 26 2006 - mkoenig@suse.de
- fix bug in fsck udev/libvolume_id patch [#205671]
* Wed Sep 20 2006 - mkoenig@suse.de
- update to version 1.39:
* Fix 32-bit cleanliness
* Change mke2fs to use /etc/mke2fs.conf
* Mke2fs will now create filesystems hash trees and
on-line resizing enabled by default
* The e2fsprogs tools (resize2fs, e2fsck, mke2fs) will open the
filesystem device node in exclusive mode
* Add support for on-line resizing to resize2fs.
* The blkid library will now store the UUID of the external
journal used by ext3 filesystems
* E2fsck will now consult a configuration file, /etc/e2fsck.conf
* E2fsck will detect if the superblock's last mount field or
last write field is in the future, and offer to fix if so.
* E2fsck now checks to see if the superblock hint for the
location of the external journal is incorrect
* Resize2fs will now automatically determine the RAID stride
parameter that had been used to create the filesystem
* Fix mke2fs so that it correctly creates external journals on
big-endian machines
* Fix a bug in the e2p library
* Add a new debugfs command, set_current_time
* Fix debugfs commands
* Fix mklost+found so that it creates a full-sized directory on
filesystems with larger block sizes.
* Fix a file descriptor leak in blkid library
* Allow fractional percentages to the -m option in mke2fs and tune2fs
* Add support for device mapper library to the blkid library
* Fix the blkid library so that it notices when an ext2 filesystem
is upgraded to ext3.
* Improve the blkid's library VFAT/FAT detectio
* Add support for the reiser4 and software suspend partitions
to the blkid library.
- update ext2resize to version 1.1.19:
* Add support for ext3 online resizing
* Support LARGEFILE compat flag
* Make the resize inode part of the fs struct
* Add the FL_IOCTL flag
* Bugfixes
* Fri Aug 11 2006 - pth@suse.de
- Fix to comply with gettex 0.15.
- Move ext2resize sources to toplevel directory.
- Fix use of MKINSTALLDIRS.
* Fri Aug 04 2006 - kay.sievers@suse.de
- update libvolume_id integration to match util-linux
* Fri Jun 16 2006 - ro@suse.de
- added libvolume_id-devel to BuildRequires
- updated e2fsprogs-udev.patch to match header rename
* Wed Feb 08 2006 - hare@suse.de
- Fix fsck -m (#146606) to really check filesystems.
* Mon Jan 30 2006 - hvogel@suse.de
- Document -I inode-size [#145445]
* Sun Jan 29 2006 - hvogel@suse.de
- fix hares patch
* Fri Jan 27 2006 - hare@suse.de
- Add option to not return an error code for mounted
filesystems (#145400).
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Fri Jan 20 2006 - hvogel@suse.de
- Support ext2/ext3 online resize
* Mon Dec 12 2005 - hvogel@suse.de
- remove lib/et/test_cases/imap_err* from the tarball because
they are not distributeable.
* Tue Dec 06 2005 - pth@suse.de
- remove unnecessary type-punning
- reduce compiler warnings
* Tue Nov 15 2005 - jblunck@suse.de
- added close.patch provided by Ted Tso (IBM) to fix bug #132708
* Mon Nov 14 2005 - hare@suse.de
- Use devt when comparing devices
- fsck: Use information provided by udev for detecting devices
* Wed Oct 05 2005 - hvogel@suse.de
- fix too few arguments to a *printf function
- require libcom_err on e2fsprogs-devel
* Fri Sep 09 2005 - hvogel@suse.de
- add gross hack to avoid divide by zero in probe_reiserfs
[#115827]
* Mon Aug 08 2005 - hvogel@suse.de
- added environment variable BLKID_SKIP_CHECK_MDRAID to work around
broken software raid detection [Bug #100530]
* Tue Jul 05 2005 - hvogel@suse.de
- update to version 1.38
- mt reworked his patches a bit. See Bug #66534
* Thu Jun 23 2005 - hvogel@suse.de
- call ldconfig in post/postun
- add version to devel package dependencie
- readd missing patch (7)
* Thu Apr 28 2005 - hvogel@suse.de
- update to version 1.37
- mt reworked one libcom_err patch a bit to provide more
meaningfull error handling
- fix retuen value in inode.c
* Thu Mar 31 2005 - hvogel@suse.de
- split libcom_err to a subpackage
- add mutex synchronization to e2fsprogs/lib/et
- removed usage of a static buffer in error_message()
- disabled init_error_table function
- disabled build of unused e2fsck.static
* Fri Mar 18 2005 - hvogel@suse.de
- fix endian unsafeness in getopt (#73855)
* Tue Feb 08 2005 - hvogel@suse.de
- Update to 1.36 final
* Tue Aug 10 2004 - pth@suse.de
- Update to 1.35 RC5
* Wed Mar 17 2004 - pth@suse.de
- Don't build the EVMS plugin because it's out of date for
EVMS in kernel 2.6.
* Thu Mar 04 2004 - pth@suse.de
- Add patch from Olaf Hering that makes fsck read a different
blkid file via BLKID_FILE environment var (#35156)
* Thu Feb 19 2004 - kukuk@suse.de
- Remove obsolete recode call
* Mon Jan 12 2004 - ro@suse.de
- removed run_ldconfig again
* Sat Jan 10 2004 - adrian@suse.de
- add %%run_ldconfig
* Thu Oct 02 2003 - pthomas@suse.de
- Add patch from Kurt Garloff to make e2fsprogs compile
with latest kernel headers (SCSI_BLK_MAJOR undefined).
* Mon Sep 15 2003 - pthomas@suse.de
- Fix czech message catalog which has been transformed twice
from latin2 to utf-8 and add an iconv call to the spec file
that will make building fail if the file is corrected upstream.
* Sat Aug 30 2003 - agruen@suse.de
- Fix an endianness bug in ext2fs_swap_inode: Fast symlinks that
have extended attributes are acidentally byte swapped on
big-endian machines.
* Fri Aug 01 2003 - pthomas@suse.de
- Apply patch from Ted T'so for badblocks.
* Thu Jul 31 2003 - pthomas@suse.de
- Update to 1.34.
- Various fixes to libcom_err to make it really compatible
to the heimdal version.
- Fix int<->pointer casts.
- Fix places that may break strict aliasing.
* Fri Jun 20 2003 - ro@suse.de
- added directory to filelist
* Wed May 14 2003 - pthomas@suse.de
- Use %%defattr
- Include all installed files.
* Tue Apr 29 2003 - mfabian@suse.de
- add libblkid.so* and libblkid.a to file lists
* Thu Apr 24 2003 - pthomas@suse.de
- Update to 1.33 and adapt patches.
- Add missing headers where necessary.
* Thu Apr 24 2003 - ro@suse.de
- fix install_info --delete call and move from preun to postun
* Fri Feb 07 2003 - ro@suse.de
- added install_info macros
* Tue Oct 01 2002 - garloff@suse.de
- Fix segfault in display of real device in presence of volume
name. #20422
* Tue Sep 03 2002 - mls@suse.de
- remove duplicate evms scan (already included in 1.28)
- fix volume group scan bug
* Mon Sep 02 2002 - agruen@suse.de
- Update to 1.28. Includes very minor fixes in htree, which we have
disabled anyway, one fix that we had in a separate patch, and
has additional release notes.
* Mon Aug 19 2002 - agruen@suse.de
- Update to 1.28-WIP-0817, which includes Extended Attribute
and several smaller fixes. We disable htree support and don't
install the evms library for now.
- Remove `make gcc-wall' for now (as it does a `make clean' in
doc/).
* Thu Aug 15 2002 - mls@suse.de
- support jfs, reiserfs, evms in label/uuid scan (code stolen
from util-linux:mount)
* Sun Jul 28 2002 - kukuk@suse.de
- Remove unused tetex from neededforbuild
* Fri Jul 19 2002 - olh@suse.de
- use a better method for finding missed filelist entries
* Fri Apr 12 2002 - sf@suse.de
- added %%{_libdir}
- added fix for lib/lib64
* Thu Mar 28 2002 - bk@suse.de
- fix man pages, filelist and add check for missing files in packs
* Wed Mar 27 2002 - bk@suse.de
- Update to 1.27, fixes resource limit problem for other archs and
merges many patches
* Thu Mar 07 2002 - pthomas@suse.de
- Add patch from Ted T'so to keep e2fsck from dumping
core when the journal inode is missing.
* Mon Mar 04 2002 - pthomas@suse.de
- Fix implicit function declarations and some other gcc warnings.
- Include patch from Kurt Garloff to make e2fsck display the
device name in addition to the volume label. Adapt it to 1.26.
- Adapt BSD_disklables.diff to new code.
- Set LC_CTYPE in addition to LC_MESSAGES.
- Repack with bzip2.
* Fri Mar 01 2002 - bk@suse.de
- Update to 1.26. This release has a number of critical bug
fixes over the previous release, version 1.25:
* Fri Feb 15 2002 - pthomas@suse.de
- Use %%{_lib} and %%{_libdir}.
* Wed Feb 13 2002 - pthomas@suse.de
- Make heimdal-devel conflict e2fsprogs-devel.
Temporary solution for bug #13145
* Thu Dec 13 2001 - pthomas@suse.de
- Add mkfs.ext2.8 because mkfs.8 from util-linux references it.
Fixes bug #12613.
* Fri Nov 23 2001 - pthomas@suse.de
- Add accidently left out e2image to file list. Fixes bug
[#12009]
* Wed Oct 31 2001 - ro@suse.de
- fix for axp: should malloc buffer _before_ use
* Wed Oct 10 2001 - pthomas@suse.de
- Update to 1.25.
- Remove patches not needed anymore.
- Change mke2fs to output warnings to stderr not stdout.
- Repack as bz2.
* Mon Sep 24 2001 - olh@suse.de
- replace ext2fs_d
* Fri Sep 21 2001 - pthomas@suse.de
- Add patch for mke2fs from 1.25 as that bug seems to be the
reason for the mk_initrd warning.
* Wed Sep 12 2001 - pthomas@suse.de
- Update to 1.24a:
- Fix brown-paper bug in mke2fs which caused it to segfault.
- Revert the BLKGETSIZE64 support as this ioctl has been used
by an unofficial kernel patch to update the last sector on
the disk, and this was causing disk corruption problems as a
result.
- Mke2fs is now more careful about zapping swap space signatures
and other filesystem/raid superblock magic values so.
- E2fsck will no longer complain if the the mode of
EXT2_RESIZE_INO is a regular file
- mke2fs and tune2fs will allow the use of UUID= or LABEL=
specifiers when specifying the external journal device.
tune2fs will also search devices looking for the external
journal device when removing.
* Fri Aug 17 2001 - ro@suse.de
- update to 1.23 to enable external journals on ext3
* Wed Aug 15 2001 - pthomas@suse.de
- Update to 1.22.
- Drop fsck Patch as code changed.
- Use LD_LIBRARY_PATH to run test programs.
* Fri Jun 08 2001 - pthomas@suse.de
- Remove incorrect use of AC_REQUIRE (fails with autoconf 2.5)
- Recompress tarball with bzip2.
* Thu Jan 18 2001 - schwab@suse.de
- Add Obsoletes: ext2fs_d and Requires: e2fsprogs to devel
subpackage.
* Mon Nov 06 2000 - pthomas@suse.de
- use _mandir and _infodir more consistently in spec file.
* Sun Nov 05 2000 - ro@suse.de
- renamed packages to e2fsprogs/e2fsprogs-devel
* Fri Jun 09 2000 - kasal@suse.cz
- Build dynamic libraries. Partition Surprise requires them.
- Make /usr/lib/*.so symlinks relative.
* Thu Mar 23 2000 - kukuk@suse.de
- Don't erase BSD labels on Alpha
- Add Y2K fix to debugfs
* Wed Mar 22 2000 - kukuk@suse.de
- Fix ifdefs for gcc 2.95.2
* Tue Feb 22 2000 - garloff@suse.de
- Bugfix for the change ...
- ... and change version no of fsck to 1.18a to reflect the change.
* Sun Feb 20 2000 - garloff@suse.de
- Patch to be more clever WRT to basenames (used to find out wheter
a fsck for this device is already running).
- Give better message in case fsck fails, to tell the user what to
do. (e2fsck only displays the label, nowadays :-( )
* Thu Feb 10 2000 - kukuk@suse.de
- Use autoconf to create new configure
* Wed Jan 19 2000 - ro@suse.de
- man,info -> /usr/share
* Mon Jan 17 2000 - ro@suse.de
- fixed to build on kernels >= 2.3.39
* Sat Nov 13 1999 - kukuk@suse.de
- Update to e2fsprogs 1.18
- Create new sub-package ext2fs_d which includes libs and headers
* Mon Nov 08 1999 - ro@suse.de
-fixed coredump in e2fsck
* Fri Oct 29 1999 - ro@suse.de
-e2fsprogs: 1.17 vital bugfix in e2fsck
* Sun Oct 24 1999 - ro@suse.de
- e2fsprogs: update to 1.16, sparse_super is default on when
called on a > 2.2 kernel, can be overridden with -O none
* Fri Oct 15 1999 - garloff@suse.de
- Disabled flushb again. (Moved to ddrescue.)
* Mon Sep 13 1999 - bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
* Wed Sep 01 1999 - ro@suse.de
- mke2fs: sparse superblocks default back to "off"
* Tue Aug 31 1999 - ro@suse.de
- update to 1.15
- cleanup diff and specfile
* Sun Jul 18 1999 - garloff@suse.de
- Enabled flushb compilation
* Sat Jun 26 1999 - kukuk@suse.de
- Add fix for fsck core dump from beta list
* Tue Mar 16 1999 - ro@suse.de
- fixed configure call
* Fri Mar 12 1999 - ro@suse.de
- update to 1.14
* Thu Oct 29 1998 - ro@suse.de
- respect change in 2.1.126 SCSI_DISK_MAJOR
* Tue Sep 01 1998 - ro@suse.de
- update to 1.12
* Sat Apr 26 1997 - florian@suse.de
- update to new version 1.10
* Sun Apr 13 1997 - florian@suse.de
- update to new version 1.08
- do not include ext2 libs and include files as they are only used by dump
* Thu Jan 02 1997 - florian@suse.de
- update to new version 1.06
* Thu Jan 02 1997 - florian@suse.de
- update to newer version
- use now static libs instead of 4 small shared libs
* Thu Jan 02 1997 - florian@suse.de
update to version 1.0.4

11
elf.diff Normal file
View File

@ -0,0 +1,11 @@
--- lib/Makefile.elf-lib
+++ lib/Makefile.elf-lib
@@ -45,7 +45,7 @@
@echo " SYMLINK $(ELF_INSTALL_DIR)/$(ELF_SONAME)"
@$(LN_S) -f $(ELF_LIB) $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_SONAME)
@echo " SYMLINK $(libdir)/$(ELF_IMAGE).so"
- @$(LN_S) -f $(ELF_INSTALL_DIR)/$(ELF_SONAME) \
+ @$(LN_S) -f `echo $(libdir)|sed -e 's,//*[^/][^/]*,/..,g' -e s,/,,`$(ELF_INSTALL_DIR)/$(ELF_SONAME) \
$(DESTDIR)$(libdir)/$(ELF_IMAGE).so
@echo " LDCONFIG"
@-$(LDCONFIG)

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:03e7cc71765b07138e612b46f8e1b3c148966e8bc166da0685fe0f59ca2265b4
size 164526

369
ext2resize-byteorder.patch Normal file
View File

@ -0,0 +1,369 @@
--- BUILD/ext2resize-1.1.19/configure.in
+++ BUILD/ext2resize-1.1.19/configure.in
@@ -26,6 +26,7 @@
AC_CHECK_TYPE(__s32, int32_t)
AC_CHECK_TYPE(__u32, u_int32_t)
AC_CHECK_TYPE(loff_t, unsigned)
+AC_C_BIGENDIAN
dnl Checks for library functions.
AC_CHECK_FUNCS(open64)
--- BUILD/ext2resize-1.1.19/src/Makefile.am
+++ BUILD/ext2resize-1.1.19/src/Makefile.am
@@ -6,8 +6,9 @@
noinst_LIBRARIES = libext2resize.a
-libext2resize_a_SOURCES = ext2.c ext2_block_relocator.c ext2_buffer.c llseek.c \
- ext2_inode_relocator.c ext2_meta.c ext2_resize.c ext2_unix_io.c tune.c
+libext2resize_a_SOURCES = ext2.c ext2_block_relocator.c ext2_buffer.c llseek.c\
+ ext2_inode_relocator.c ext2_meta.c ext2_resize.c ext2_unix_io.c tune.c\
+ swapfs.c
#libext2resize_a_SOURCES += ext2_journal.c ext2_mkfs.c
--- BUILD/ext2resize-1.1.19/src/ext2.c
+++ BUILD/ext2resize-1.1.19/src/ext2.c
@@ -1,6 +1,7 @@
/*
ext2.c -- generic ext2 stuff
Copyright (C) 1998, 1999, 2000 Lennert Buytenhek <buytenh@gnu.org>
+ Portions copyright (C) Red Hat, Inc., 2004
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
@@ -15,6 +16,8 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Byte-ordering fixes: Stephen C. Tweedie <sct@redhat.com>
*/
static const char _ext2_c[] = "$Id: ext2.c,v 1.29 2004/09/30 14:01:40 sct Exp $";
@@ -254,6 +257,9 @@
bh = ext2_bread(fs, blk);
memcpy(inode, bh->data + off, sizeof(struct ext2_inode));
ext2_brelse(bh, 0);
+#ifdef WORDS_BIGENDIAN
+ ext2fs_swap_inode(fs, inode, inode, 0);
+#endif
}
void ext2_set_inode_state(struct ext2_fs *fs, ino_t ino, int state,
@@ -771,10 +777,10 @@
int ret = 1;
if (fs->flags & FL_DEBUG) {
- if (ioc == EXT2_IOC_GROUP_EXTEND)
+ if (ioc == (int) EXT2_IOC_GROUP_EXTEND)
printf("%s: EXTEND group to %u blocks\n",
__FUNCTION__, *(__u32 *)arg);
- else if (ioc == EXT2_IOC_GROUP_ADD)
+ else if (ioc == (int) EXT2_IOC_GROUP_ADD)
printf("%s: ADD group %u\n",
__FUNCTION__, *(__u32 *)arg);
else
@@ -890,6 +896,12 @@
handle->ops->set_blocksize(handle->cookie, 10);
ext2_read_blocks(fs, &fs->sb, 1, 1);
+ /* This will not work with "alien" byte-ordering (ie. bigendian
+ * on-disk), only ext2-standard little-endian on disk. We
+ * should deal OK with bigendian hosts, though. */
+#ifdef WORDS_BIGENDIAN
+ ext2fs_swap_super(&fs->sb);
+#endif
if (fs->sb.s_magic != EXT2_SUPER_MAGIC) {
fprintf(stderr, "%s: ext2_open: invalid superblock\n",fs->prog);
goto error_free_fs;
@@ -1012,6 +1024,14 @@
goto error_free_bcache;
}
ext2_read_blocks(fs, fs->gd, fs->sb.s_first_data_block+1, fs->gdblocks);
+#ifdef WORDS_BIGENDIAN
+ {
+ int i;
+
+ for (i=0; i<fs->numgroups; i++)
+ ext2fs_swap_group_desc(&fs->gd[i]);
+ }
+#endif
if (!ext2_determine_itoffset(fs))
goto error_free_gd;
--- BUILD/ext2resize-1.1.19/src/ext2.h
+++ BUILD/ext2resize-1.1.19/src/ext2.h
@@ -38,7 +38,7 @@
#define min(a,b) (((a)<(b))?(a):(b))
#endif
-#if __BYTE_ORDER__ == __BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
#define le16_to_cpu(a) ((((a) & 0x00ffU) << 8) | (((a) & 0xff00) >> 8))
#define le32_to_cpu(a) ((((a) & 0x000000ffU) << 24)|(((a) & 0x0000ff00U) << 8)\
|(((a) & 0xff000000U) >> 24)|(((a) & 0x00ff0000U) >> 8))
@@ -237,6 +237,13 @@
/* resize */
int ext2_resize_fs(struct ext2_fs *fs);
+/* fs byte-swap */
+void ext2fs_swap_super(struct ext2_super_block * sb);
+void ext2fs_swap_group_desc(struct ext2_group_desc *gdp);
+void ext2fs_swap_inode(struct ext2_fs *fs,
+ struct ext2_inode *t, struct ext2_inode *f,
+ int hostorder);
+
/* unix I/O */
loff_t ext2_llseek(unsigned int fd, loff_t offset, unsigned int whence);
struct ext2_dev_handle *ext2_make_dev_handle_from_file(char *dev, char *dir,
--- BUILD/ext2resize-1.1.19/src/ext2_fs.h
+++ BUILD/ext2resize-1.1.19/src/ext2_fs.h
@@ -459,8 +459,15 @@
__u32 s_journal_inum; /* inode number of journal file */
__u32 s_journal_dev; /* device number of journal file */
__u32 s_last_orphan; /* start of list of inodes to delete */
-
- __u32 s_reserved[197]; /* Padding to the end of the block */
+ __u32 s_hash_seed[4]; /* HTREE hash seed */
+ __u8 s_def_hash_version; /* Default hash version to use */
+ __u8 s_jnl_backup_type; /* Default type of journal backup */
+ __u16 s_reserved_word_pad;
+ __u32 s_default_mount_opts;
+ __u32 s_first_meta_bg; /* First metablock group */
+ __u32 s_mkfs_time; /* When the filesystem was created */
+ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
+ __u32 s_reserved[172]; /* Padding to the end of the block */
};
/*
--- BUILD/ext2resize-1.1.19/src/ext2online.c
+++ BUILD/ext2resize-1.1.19/src/ext2online.c
@@ -238,10 +238,12 @@
unsigned int three = 1, five = 5, seven = 7;
unsigned int group;
int last = 0;
-
- if (dindir_buf[gdb_num % apb] != pri_blk) {
+ blk_t dblk;
+
+ dblk = le32_to_cpu(dindir_buf[gdb_num % apb]);
+ if (dblk != pri_blk) {
fprintf(stderr, "found %d not %d at %d[%d]\n",
- dindir_buf[gdb_num % apb], pri_blk,
+ dblk, pri_blk,
fs->resize.i_block[EXT2_DIND_BLOCK],
gdb_num % apb);
ret = 0;
@@ -253,16 +255,17 @@
while ((group = ext2_list_backups(fs, &three, &five, &seven)) <
fs->numgroups) {
__u32 *pri_buf = (__u32 *)(pri_bh->data);
- blk_t bku_blk;
+ blk_t bku_blk, pblk;
bku_blk = pri_blk + group * fs->sb.s_blocks_per_group;
if (fs->flags & FL_DEBUG)
printf("checking for group block %d in Bond\n",
bku_blk);
- if (pri_buf[last] != bku_blk) {
+ pblk = le32_to_cpu(pri_buf[last]);
+ if (pblk != bku_blk) {
fprintf(stderr, "found %d not %d at %d[%d]\n",
- pri_buf[last], bku_blk, pri_blk, last);
+ pblk, bku_blk, pri_blk, last);
ext2_brelse(pri_bh, 0);
ret = 0;
goto exit_dind;
@@ -340,7 +343,9 @@
}
gdp = (struct ext2_group_desc *)bh->data +
(group % (fs->blocksize/sizeof(struct ext2_group_desc)));
-
+#ifdef WORDS_BIGENDIAN
+ ext2fs_swap_group_desc(gdp);
+#endif
gdp->bg_block_bitmap = start + new_bb;
gdp->bg_inode_bitmap = start + new_ib;
gdp->bg_inode_table = start + fs->itoffset;
--- BUILD/ext2resize-1.1.19/src/swapfs.c
+++ BUILD/ext2resize-1.1.19/src/swapfs.c
@@ -0,0 +1,177 @@
+/*
+ * swapfs.c --- swap ext2 filesystem data structures
+ *
+ * Copyright (C) 1995, 1996, 2002 Theodore Ts'o.
+ *
+ * %Begin-Header%
+ * This file may be redistributed under the terms of the GNU Public
+ * License.
+ * %End-Header%
+ *
+ * Taken from e2fsprogs for ext2online by Stephen Tweedie <sct@redhat.com>
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <time.h>
+
+#include "config.h"
+#include "ext2.h"
+#include "ext2_fs.h"
+
+#define LINUX_S_IFMT 00170000
+#define LINUX_S_IFLNK 00120000
+#define LINUX_S_ISLNK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFLNK)
+
+static inline __u16 ext2fs_swab16(__u16 val)
+{
+ return (val >> 8) | (val << 8);
+}
+
+static inline __u32 ext2fs_swab32(__u32 val)
+{
+ return ((val>>24) | ((val>>8)&0xFF00) |
+ ((val<<8)&0xFF0000) | (val<<24));
+}
+
+static inline blk_t ext2fs_inode_data_blocks(struct ext2_fs *fs,
+ struct ext2_inode *inode)
+{
+ return inode->i_blocks -
+ (inode->i_file_acl ? fs->blocksize >> 9 : 0);
+}
+
+void ext2fs_swap_super(struct ext2_super_block * sb)
+{
+ int i;
+ sb->s_inodes_count = ext2fs_swab32(sb->s_inodes_count);
+ sb->s_blocks_count = ext2fs_swab32(sb->s_blocks_count);
+ sb->s_r_blocks_count = ext2fs_swab32(sb->s_r_blocks_count);
+ sb->s_free_blocks_count = ext2fs_swab32(sb->s_free_blocks_count);
+ sb->s_free_inodes_count = ext2fs_swab32(sb->s_free_inodes_count);
+ sb->s_first_data_block = ext2fs_swab32(sb->s_first_data_block);
+ sb->s_log_block_size = ext2fs_swab32(sb->s_log_block_size);
+ sb->s_log_frag_size = ext2fs_swab32(sb->s_log_frag_size);
+ sb->s_blocks_per_group = ext2fs_swab32(sb->s_blocks_per_group);
+ sb->s_frags_per_group = ext2fs_swab32(sb->s_frags_per_group);
+ sb->s_inodes_per_group = ext2fs_swab32(sb->s_inodes_per_group);
+ sb->s_mtime = ext2fs_swab32(sb->s_mtime);
+ sb->s_wtime = ext2fs_swab32(sb->s_wtime);
+ sb->s_mnt_count = ext2fs_swab16(sb->s_mnt_count);
+ sb->s_max_mnt_count = ext2fs_swab16(sb->s_max_mnt_count);
+ sb->s_magic = ext2fs_swab16(sb->s_magic);
+ sb->s_state = ext2fs_swab16(sb->s_state);
+ sb->s_errors = ext2fs_swab16(sb->s_errors);
+ sb->s_minor_rev_level = ext2fs_swab16(sb->s_minor_rev_level);
+ sb->s_lastcheck = ext2fs_swab32(sb->s_lastcheck);
+ sb->s_checkinterval = ext2fs_swab32(sb->s_checkinterval);
+ sb->s_creator_os = ext2fs_swab32(sb->s_creator_os);
+ sb->s_rev_level = ext2fs_swab32(sb->s_rev_level);
+ sb->s_def_resuid = ext2fs_swab16(sb->s_def_resuid);
+ sb->s_def_resgid = ext2fs_swab16(sb->s_def_resgid);
+ sb->s_first_ino = ext2fs_swab32(sb->s_first_ino);
+ sb->s_inode_size = ext2fs_swab16(sb->s_inode_size);
+ sb->s_block_group_nr = ext2fs_swab16(sb->s_block_group_nr);
+ sb->s_feature_compat = ext2fs_swab32(sb->s_feature_compat);
+ sb->s_feature_incompat = ext2fs_swab32(sb->s_feature_incompat);
+ sb->s_feature_ro_compat = ext2fs_swab32(sb->s_feature_ro_compat);
+ sb->s_algorithm_usage_bitmap = ext2fs_swab32(sb->s_algorithm_usage_bitmap);
+ sb->s_reserved_gdt_blocks = ext2fs_swab16(sb->s_reserved_gdt_blocks);
+ sb->s_journal_inum = ext2fs_swab32(sb->s_journal_inum);
+ sb->s_journal_dev = ext2fs_swab32(sb->s_journal_dev);
+ sb->s_last_orphan = ext2fs_swab32(sb->s_last_orphan);
+ sb->s_default_mount_opts = ext2fs_swab32(sb->s_default_mount_opts);
+ sb->s_first_meta_bg = ext2fs_swab32(sb->s_first_meta_bg);
+ sb->s_mkfs_time = ext2fs_swab32(sb->s_mkfs_time);
+ for (i=0; i < 4; i++)
+ sb->s_hash_seed[i] = ext2fs_swab32(sb->s_hash_seed[i]);
+ for (i=0; i < 17; i++)
+ sb->s_jnl_blocks[i] = ext2fs_swab32(sb->s_jnl_blocks[i]);
+
+}
+
+void ext2fs_swap_group_desc(struct ext2_group_desc *gdp)
+{
+ gdp->bg_block_bitmap = ext2fs_swab32(gdp->bg_block_bitmap);
+ gdp->bg_inode_bitmap = ext2fs_swab32(gdp->bg_inode_bitmap);
+ gdp->bg_inode_table = ext2fs_swab32(gdp->bg_inode_table);
+ gdp->bg_free_blocks_count = ext2fs_swab16(gdp->bg_free_blocks_count);
+ gdp->bg_free_inodes_count = ext2fs_swab16(gdp->bg_free_inodes_count);
+ gdp->bg_used_dirs_count = ext2fs_swab16(gdp->bg_used_dirs_count);
+}
+
+void ext2fs_swap_inode(struct ext2_fs *fs,
+ struct ext2_inode *t, struct ext2_inode *f,
+ int hostorder)
+{
+ unsigned i;
+ int islnk = 0;
+
+ if (hostorder && LINUX_S_ISLNK(f->i_mode))
+ islnk = 1;
+ t->i_mode = ext2fs_swab16(f->i_mode);
+ if (!hostorder && LINUX_S_ISLNK(t->i_mode))
+ islnk = 1;
+ t->i_uid = ext2fs_swab16(f->i_uid);
+ t->i_size = ext2fs_swab32(f->i_size);
+ t->i_atime = ext2fs_swab32(f->i_atime);
+ t->i_ctime = ext2fs_swab32(f->i_ctime);
+ t->i_mtime = ext2fs_swab32(f->i_mtime);
+ t->i_dtime = ext2fs_swab32(f->i_dtime);
+ t->i_gid = ext2fs_swab16(f->i_gid);
+ t->i_links_count = ext2fs_swab16(f->i_links_count);
+ t->i_blocks = ext2fs_swab32(f->i_blocks);
+ t->i_flags = ext2fs_swab32(f->i_flags);
+ t->i_file_acl = ext2fs_swab32(f->i_file_acl);
+ t->i_dir_acl = ext2fs_swab32(f->i_dir_acl);
+ if (!islnk || ext2fs_inode_data_blocks(fs, t)) {
+ for (i = 0; i < EXT2_N_BLOCKS; i++)
+ t->i_block[i] = ext2fs_swab32(f->i_block[i]);
+ } else if (t != f) {
+ for (i = 0; i < EXT2_N_BLOCKS; i++)
+ t->i_block[i] = f->i_block[i];
+ }
+ t->i_generation = ext2fs_swab32(f->i_generation);
+ t->i_faddr = ext2fs_swab32(f->i_faddr);
+
+ switch (fs->sb.s_creator_os) {
+ case EXT2_OS_LINUX:
+ t->osd1.linux1.l_i_reserved1 =
+ ext2fs_swab32(f->osd1.linux1.l_i_reserved1);
+ t->osd2.linux2.l_i_frag = f->osd2.linux2.l_i_frag;
+ t->osd2.linux2.l_i_fsize = f->osd2.linux2.l_i_fsize;
+ t->osd2.linux2.i_pad1 = ext2fs_swab16(f->osd2.linux2.i_pad1);
+ t->osd2.linux2.l_i_uid_high =
+ ext2fs_swab16 (f->osd2.linux2.l_i_uid_high);
+ t->osd2.linux2.l_i_gid_high =
+ ext2fs_swab16 (f->osd2.linux2.l_i_gid_high);
+ t->osd2.linux2.l_i_reserved2 =
+ ext2fs_swab32(f->osd2.linux2.l_i_reserved2);
+ break;
+ case EXT2_OS_HURD:
+ t->osd1.hurd1.h_i_translator =
+ ext2fs_swab32 (f->osd1.hurd1.h_i_translator);
+ t->osd2.hurd2.h_i_frag = f->osd2.hurd2.h_i_frag;
+ t->osd2.hurd2.h_i_fsize = f->osd2.hurd2.h_i_fsize;
+ t->osd2.hurd2.h_i_mode_high =
+ ext2fs_swab16 (f->osd2.hurd2.h_i_mode_high);
+ t->osd2.hurd2.h_i_uid_high =
+ ext2fs_swab16 (f->osd2.hurd2.h_i_uid_high);
+ t->osd2.hurd2.h_i_gid_high =
+ ext2fs_swab16 (f->osd2.hurd2.h_i_gid_high);
+ t->osd2.hurd2.h_i_author =
+ ext2fs_swab32 (f->osd2.hurd2.h_i_author);
+ break;
+ case EXT2_OS_MASIX:
+ t->osd1.masix1.m_i_reserved1 =
+ ext2fs_swab32(f->osd1.masix1.m_i_reserved1);
+ t->osd2.masix2.m_i_frag = f->osd2.masix2.m_i_frag;
+ t->osd2.masix2.m_i_fsize = f->osd2.masix2.m_i_fsize;
+ t->osd2.masix2.m_pad1 = ext2fs_swab16(f->osd2.masix2.m_pad1);
+ t->osd2.masix2.m_i_reserved2[0] =
+ ext2fs_swab32(f->osd2.masix2.m_i_reserved2[0]);
+ t->osd2.masix2.m_i_reserved2[1] =
+ ext2fs_swab32(f->osd2.masix2.m_i_reserved2[1]);
+ break;
+ }
+}

View File

@ -0,0 +1,14 @@
--- BUILD/ext2resize-1.1.19/src/ext2online.c
+++ BUILD/ext2resize-1.1.19/src/ext2online.c
@@ -512,9 +512,9 @@
*/
if (ext2_ioctl(fs, EXT2_IOC_GROUP_EXTEND, &size))
fs->flags |= FL_IOCTL;
- else if (errno != ENOTTY)
+ else
return 0;
-
+
ra = fs->newblocks - size;
/* Add new groups */

20
ext2resize-nowrite.patch Normal file
View File

@ -0,0 +1,20 @@
--- BUILD/ext2resize-1.1.19/src/ext2_unix_io.c
+++ BUILD/ext2resize-1.1.19/src/ext2_unix_io.c
@@ -256,7 +256,7 @@
goto error_free_cookie;
}
- if ((monster->fdwrite = open(dev, O_WRONLY | O_LARGEFILE)) < 0) {
+ if ((monster->fdwrite = open(dev, O_RDONLY | O_LARGEFILE)) < 0) {
char msg[4097];
snprintf(msg, 4096, "%s: writing %s", prog, dev);
@@ -301,7 +301,7 @@
return dh;
error_close_write:
- close(monster->fdread);
+ close(monster->fdwrite);
error_close_read:
close(monster->fdread);

132
fsck-ignore-mounted.patch Normal file
View File

@ -0,0 +1,132 @@
--- misc/fsck.8.in
+++ misc/fsck.8.in
@@ -180,6 +180,10 @@
will use the specified filesystem type. If this type is not
available, then the default file system type (currently ext2) is used.
.TP
+.B \-m
+Do not check mounted filesystems and return an exit code of 0
+for mounted filesystems.
+.TP
.B \-A
Walk through the
.I /etc/fstab
--- misc/fsck.c
+++ misc/fsck.c
@@ -102,6 +102,7 @@
int serialize = 0;
int skip_root = 0;
int like_mount = 0;
+int ignore_mounted = 0;
int notitle = 0;
int parallel_root = 0;
int progress = 0;
@@ -851,6 +852,56 @@
return (cmp->negate ? !ret : ret);
}
+/* Check to see whether a filesystem is already mounted */
+static int is_mounted(struct fs_info *fs)
+{
+ struct stat st_buf;
+ dev_t fs_rdev;
+ char *testdir;
+ int retval = 0;
+
+ if (!fs->mountpt) {
+ /*
+ * We have already read /proc/mounts
+ * so any device without a mountpoint
+ * is indeed not mounted.
+ */
+ return 0;
+ }
+
+ if (!strcmp(fs->mountpt,"/")) {
+ /* Root should be always mounted */
+ return 1;
+ }
+
+ if (stat(fs->mountpt, &st_buf) < 0)
+ return 0;
+
+ if (!S_ISDIR(st_buf.st_mode)) {
+ /* This is not a directory, cannot be mounted */
+ return 0;
+ }
+
+ fs_rdev = st_buf.st_dev;
+
+ /* Compare with the upper directory */
+ testdir = malloc(strlen(fs->mountpt) + 4);
+ strcpy(testdir,fs->mountpt);
+ if (fs->mountpt[strlen(fs->mountpt) - 1] == '/')
+ strcat(testdir,"..");
+ else
+ strcat(testdir,"/..");
+
+ if (stat(testdir, &st_buf) == 0) {
+ if (st_buf.st_dev != fs_rdev) {
+ retval = 1;
+ }
+ }
+ free(testdir);
+
+ return retval;
+}
+
/* Check if we should ignore this filesystem. */
static int ignore(struct fs_info *fs)
{
@@ -997,6 +1048,15 @@
not_done_yet++;
continue;
}
+ if (ignore_mounted) {
+ /*
+ * Ignore mounted devices.
+ */
+ if (is_mounted(fs)) {
+ fs->flags |= FLAG_DONE;
+ continue;
+ }
+ }
/*
* If a filesystem on a particular device has
* already been spawned, then we need to defer
@@ -1174,6 +1234,9 @@
case 'P':
parallel_root++;
break;
+ case 'm':
+ ignore_mounted++;
+ break;
case 's':
serialize++;
break;
@@ -1249,6 +1312,10 @@
fstab = _PATH_MNTTAB;
load_fs_info(fstab);
+ /* Load info from /proc/mounts, too */
+ if (ignore_mounted)
+ load_fs_info("/proc/mounts");
+
/* Update our search path to include uncommon directories. */
if (oldpath) {
fsck_path = malloc (strlen (fsck_prefix_path) + 1 +
@@ -1301,6 +1368,14 @@
if (!fs)
continue;
}
+ if (ignore_mounted) {
+ /*
+ * Ignore mounted devices.
+ */
+ if (is_mounted(fs)) {
+ continue;
+ }
+ }
fsck_device(fs, interactive);
if (serialize ||
(max_running && (num_running >= max_running))) {

177
libcom_err-mutex.patch Normal file
View File

@ -0,0 +1,177 @@
--- e2fsprogs-1.39/lib/et/com_err.pc.in
+++ e2fsprogs-1.39/lib/et/com_err.pc.in
@@ -7,5 +7,5 @@
Description: Common error description library
Version: @E2FSPROGS_VERSION@
Requires:
-Cflags: -I${includedir}
-Libs: -L${libdir} -lcom_err
+Cflags: -I${includedir} -pthread
+Libs: -L${libdir} -lcom_err -pthread
--- e2fsprogs-1.39/lib/et/error_message.c
+++ e2fsprogs-1.39/lib/et/error_message.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <pthread.h>
#include "com_err.h"
#include "error_table.h"
#include "internal.h"
@@ -27,6 +28,17 @@
struct et_list * _et_list = (struct et_list *) NULL;
struct et_list * _et_dynamic_list = (struct et_list *) NULL;
+static pthread_mutex_t _et_lock = PTHREAD_MUTEX_INITIALIZER;
+
+int et_list_lock()
+{
+ return pthread_mutex_lock(&_et_lock);
+}
+
+int et_list_unlock()
+{
+ return pthread_mutex_unlock(&_et_lock);
+}
const char * error_message (errcode_t code)
{
@@ -51,22 +63,32 @@
goto oops;
#endif
}
+ et_list_lock();
for (et = _et_list; et; et = et->next) {
if (et->table->base == table_num) {
/* This is the right table */
- if (et->table->n_msgs <= offset)
- goto oops;
- return(et->table->msgs[offset]);
+ if (et->table->n_msgs <= offset) {
+ break;
+ } else {
+ const char *msg = et->table->msgs[offset];
+ et_list_unlock();
+ return(msg);
+ }
}
}
for (et = _et_dynamic_list; et; et = et->next) {
if (et->table->base == table_num) {
/* This is the right table */
- if (et->table->n_msgs <= offset)
- goto oops;
- return(et->table->msgs[offset]);
+ if (et->table->n_msgs <= offset) {
+ break;
+ } else {
+ const char *msg = et->table->msgs[offset];
+ et_list_unlock();
+ return(msg);
+ }
}
}
+ et_list_unlock();
oops:
return "Unknown code";
}
@@ -81,10 +103,14 @@
if (!(el = (struct et_list *) malloc(sizeof(struct et_list))))
return ENOMEM;
+ if( 0 != et_list_lock())
+ return errno;
+
el->table = et;
el->next = _et_dynamic_list;
_et_dynamic_list = el;
+ et_list_unlock();
return 0;
}
@@ -93,9 +119,13 @@
*/
errcode_t remove_error_table(const struct error_table * et)
{
- struct et_list *el = _et_dynamic_list;
+ struct et_list *el;
struct et_list *el2 = 0;
+ if( 0 != et_list_lock())
+ return ENOENT;
+
+ el = _et_dynamic_list;
while (el) {
if (el->table->base == et->base) {
if (el2) /* Not the beginning of the list */
@@ -103,11 +133,13 @@
else
_et_dynamic_list = el->next;
(void) free(el);
+ et_list_unlock();
return 0;
}
el2 = el;
el = el->next;
}
+ et_list_unlock();
return ENOENT;
}
--- e2fsprogs-1.39/lib/et/error_table.h
+++ e2fsprogs-1.39/lib/et/error_table.h
@@ -19,6 +19,8 @@
const struct error_table *table;
};
extern struct et_list * _et_list;
+extern int et_list_lock(void);
+extern int et_list_unlock(void);
#define ERRCODE_RANGE 8 /* # of bits to shift table number */
#define BITS_PER_CHAR 6 /* # bits to shift per character in name */
--- e2fsprogs-1.39/lib/et/et_c.awk
+++ e2fsprogs-1.39/lib/et/et_c.awk
@@ -225,6 +225,8 @@
print " const struct error_table * table;" > outfile
print "};" > outfile
print "extern struct et_list *_et_list;" > outfile
+ print "extern int et_list_lock();" > outfile
+ print "extern int et_list_unlock();" > outfile
print "" > outfile
if (tab_base_high == 0) {
print "const struct error_table et_" table_name "_error_table = { text, " \
@@ -242,7 +244,22 @@
print "void initialize_" table_name "_error_table(void);" > outfile
print "" > outfile
print "void initialize_" table_name "_error_table(void) {" > outfile
- print " initialize_" table_name "_error_table_r(&_et_list);" > outfile
+ print " if(0 == et_list_lock()) {" > outfile
+ print " if ( !link.table) {" > outfile
+ print " struct et_list *el = _et_list;" > outfile
+ print " while (el) {" > outfile
+ print " if (el->table->base == et_" table_name "_error_table.base) {" > outfile
+ print " et_list_unlock();" > outfile
+ print " return;" > outfile
+ print " }" > outfile
+ print " el = el->next;" > outfile
+ print " }" > outfile
+ print " link.next = _et_list;" > outfile
+ print " link.table = &et_" table_name "_error_table;" > outfile
+ print " _et_list = &link;" > outfile
+ print " }" > outfile
+ print " et_list_unlock();" > outfile
+ print " }" > outfile
print "}" > outfile
print "" > outfile
print "/* For Heimdal compatibility */" > outfile
@@ -255,9 +272,6 @@
print " return;" > outfile
print " et = malloc(sizeof(struct et_list));" > outfile
print " if (et == 0) {" > outfile
- print " if (!link.table)" > outfile
- print " et = &link;" > outfile
- print " else" > outfile
print " return;" > outfile
print " }" > outfile
print " et->table = &et_" table_name "_error_table;" > outfile

View File

@ -0,0 +1,40 @@
--- e2fsprogs-1.39/e2fsck/Makefile.in
+++ e2fsprogs-1.39/e2fsck/Makefile.in
@@ -104,7 +104,7 @@
prof_err.c \
$(MTRACE_SRC)
-all:: profiled $(PROGS) e2fsck.static e2fsck.shared $(MANPAGES) $(FMANPAGES)
+all:: profiled $(PROGS) e2fsck.shared $(MANPAGES) $(FMANPAGES)
@PROFILE_CMT@all:: e2fsck.profiled
--- e2fsprogs-1.39/lib/et/Makefile.in
+++ e2fsprogs-1.39/lib/et/Makefile.in
@@ -110,16 +110,16 @@
$(RM) -rf $(DESTDIR)$(includedir)/et $(DESTDIR)$(datadir)/et
check:: compile_et
- for i in $(srcdir)/test_cases/*.et ; do \
- t=`basename $$i | sed -e 's/.et//'`; \
- ./compile_et --build-tree $$i ; \
- diff -c $(srcdir)/test_cases/$$t.c $$t.c > $$t.failed; \
- if [ $$? -ne 0 ]; then echo Test case $$t failed; exit 1 ; fi ; \
- diff -c $(srcdir)/test_cases/$$t.h $$t.h >> $$t.failed; \
- if [ $$? -ne 0 ]; then echo Test case $$t failed; exit 1 ; fi ; \
- $(RM) -f $$t.c $$t.h $$t.failed; \
- echo "Test case $$t succeeded" ; \
- done
+# for i in $(srcdir)/test_cases/*.et ; do \
+# t=`basename $$i | sed -e 's/.et//'`; \
+# ./compile_et --build-tree $$i ; \
+# diff -c $(srcdir)/test_cases/$$t.c $$t.c > $$t.failed; \
+# if [ $$? -ne 0 ]; then echo Test case $$t failed; exit 1 ; fi ; \
+# diff -c $(srcdir)/test_cases/$$t.h $$t.h >> $$t.failed; \
+# if [ $$? -ne 0 ]; then echo Test case $$t failed; exit 1 ; fi ; \
+# $(RM) -f $$t.c $$t.h $$t.failed; \
+# echo "Test case $$t succeeded" ; \
+# done
clean::
$(RM) -f compile_et libcom_err.a libcom_err_p.a com_err.info

View File

@ -0,0 +1,29 @@
--- e2fsprogs-1.39/lib/et/com_err.h
+++ e2fsprogs-1.39/lib/et/com_err.h
@@ -41,7 +41,10 @@
(const char *, long, const char *, va_list);
extern void (*reset_com_err_hook (void)) (const char *, long,
const char *, va_list);
+#if 0
extern int init_error_table(const char * const *msgs, long base, int count);
+#endif
+#define init_error_table(...) PLEASE_DO_NOT_USE_init_error_table_FUNCTION
extern errcode_t add_error_table(const struct error_table * et);
extern errcode_t remove_error_table(const struct error_table * et);
--- e2fsprogs-1.39/lib/et/init_et.c
+++ e2fsprogs-1.39/lib/et/init_et.c
@@ -16,6 +16,7 @@
* express or implied warranty.
*/
+#if 0
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_STDLIB_H
@@ -50,3 +51,5 @@
_et_dynamic_list = &new_et->etl;
return 0;
}
+#endif
+

View File

@ -0,0 +1,38 @@
--- e2fsprogs-1.39/lib/et/error_message.c
+++ e2fsprogs-1.39/lib/et/error_message.c
@@ -24,8 +24,6 @@
#include "error_table.h"
#include "internal.h"
-static char buffer[25];
-
struct et_list * _et_list = (struct et_list *) NULL;
struct et_list * _et_dynamic_list = (struct et_list *) NULL;
@@ -70,25 +68,7 @@
}
}
oops:
- strcpy (buffer, "Unknown code ");
- if (table_num) {
- strcat (buffer, error_table_name (table_num));
- strcat (buffer, " ");
- }
- for (cp = buffer; *cp; cp++)
- ;
- if (offset >= 100) {
- *cp++ = '0' + offset / 100;
- offset %= 100;
- started++;
- }
- if (started || offset >= 10) {
- *cp++ = '0' + offset / 10;
- offset %= 10;
- }
- *cp++ = '0' + offset;
- *cp = '\0';
- return(buffer);
+ return "Unknown code";
}
/*

0
ready Normal file
View File