Hello community,
here is the log from the commit of package e2fsprogs
checked in at Sun Aug 6 21:34:26 CEST 2006.
--------
--- e2fsprogs/e2fsprogs.changes 2006-06-16 15:43:49.000000000 +0200
+++ e2fsprogs/e2fsprogs.changes 2006-08-04 13:29:00.000000000 +0200
@@ -1,0 +2,5 @@
+Fri Aug 4 12:36:48 CEST 2006 - kay.sievers@suse.de
+
+- update libvolume_id integration to match util-linux
+
+-------------------------------------------------------------------
Old:
----
e2fsprogs-udev.patch
New:
----
e2fsprogs-libvolume_id-support.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ e2fsprogs.spec ++++++
--- /var/tmp/diff_new_pack.h6cPgN/_old 2006-08-06 21:33:50.000000000 +0200
+++ /var/tmp/diff_new_pack.h6cPgN/_new 2006-08-06 21:33:50.000000000 +0200
@@ -11,7 +11,7 @@
# norootforbuild
Name: e2fsprogs
-BuildRequires: libvolume_id-devel udev
+BuildRequires: libvolume_id-devel
License: GPL
Group: System/Filesystems
Provides: e2fsbn ext2fs
@@ -19,7 +19,7 @@
PreReq: %install_info_prereq
Autoreqprov: on
Version: 1.38
-Release: 25
+Release: 26
Summary: Utilities for the Second Extended File System
URL: http://e2fsprogs.sourceforge.net
Source: %{name}-%{version}.tar.bz2
@@ -36,7 +36,7 @@
Patch17: e2fsprogs-mdraid.patch
Patch18: e2fsprogs-probe_reiserfs-fpe.patch
Patch19: e2fsprogs-base_devt.patch
-Patch20: e2fsprogs-udev.patch
+Patch20: e2fsprogs-libvolume_id-support.patch
Patch21: close.patch
Patch22: e2fsprogs-1.38-inode_size.patch
Patch23: fsck-ignore-mounted.patch
@@ -120,7 +120,7 @@
%patch17
%patch18
%patch19 -p1
-%patch20 -p1
+%patch20 -p0
%patch21 -p1
%patch22
%patch23
@@ -289,6 +289,8 @@
%postun -n libcom_err -p /sbin/ldconfig
%changelog -n e2fsprogs
+* 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
++++++ e2fsprogs-libvolume_id-support.patch ++++++
--- lib/ext2fs/bitops.h
+++ lib/ext2fs/bitops.h
@@ -319,7 +319,7 @@
#if !defined(_EXT2_HAVE_ASM_FINDBIT_)
_INLINE_ int ext2fs_find_first_bit_set(void * addr, unsigned size)
{
- char *cp = (unsigned char *) addr;
+ char *cp = (char *) addr;
unsigned res = 0, d0;
if (!size)
--- misc/Makefile.in
+++ misc/Makefile.in
@@ -35,7 +35,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
@@ -54,6 +54,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)
@@ -94,10 +97,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)
@@ -134,9 +133,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
#include
+#include
+#include
#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
@@ -240,6 +240,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"
@@ -119,7 +118,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)
{
@@ -298,7 +296,7 @@
parse_escape(freq);
parse_escape(passno);
- dev = blkid_get_devname(cache, device, NULL);
+ dev = fsck_get_devname(device);
if (dev)
device = dev;
@@ -323,7 +321,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;
@@ -1108,7 +1106,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);
}
@@ -1154,7 +1152,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
@@ -1303,7 +1301,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)
@@ -1354,6 +1352,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);
@@ -1384,6 +1392,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
+#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);
+}
+
--- /dev/null
+++ misc/fsck_udev.c
@@ -0,0 +1,184 @@
+/*
+ * Wrapper for libvolume_id
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#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;
+ }
+ }
+
+ volume_id_close(vid);
+
+ out:
+ return value;
+}
+
+char *fsck_get_fstype(const char *device)
+{
+ return volume_id_get_tag(device, "TYPE");
+}
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...