From a23c5022421f8f7e2182300beb938167a3975286 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Thu, 30 Nov 2000 09:53:10 +0000 Subject: [PATCH] Fix a compile problem (e2fs label related). --- CHANGES | 6 +++++- compat/include/bylabel.h | 22 ++++++++++++++++++++++ compat/lib/bylabel.c | 15 +++++++++++++++ dump/main.c | 7 ++++--- 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index bb5f3c8..5d690aa 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.91 2000/11/29 10:13:41 stelian Exp $ +$Id: CHANGES,v 1.92 2000/11/30 09:53:10 stelian Exp $ Changes between versions 0.4b20 and 0.4b21 (released ?????????????????) ======================================================================= @@ -7,6 +7,10 @@ Changes between versions 0.4b20 and 0.4b21 (released ?????????????????) the previous version. Thanks to Andreas Dilger for his help on this one. +2. Fixed again a compilation problem when using old e2fs + headers (filesystem label related). Thanks to many users + who reported this stupid error. + Changes between versions 0.4b19 and 0.4b20 (released November 10, 2000) ======================================================================= diff --git a/compat/include/bylabel.h b/compat/include/bylabel.h index 00ed284..67b6dda 100644 --- a/compat/include/bylabel.h +++ b/compat/include/bylabel.h @@ -1 +1,23 @@ +/* + * Ported to Linux's Second Extended File System as part of the + * dump and restore backup suit + * 1999-02-22 Arkadiusz Mi¶kiewicz + * - added Native Language Support + * 2000-01-20 James Antill + * - Added error message if /proc/partitions cannot be opened + * 2000-05-09 Erik Troan + * - Added cache for UUID and disk labels + * Wed Aug 16 2000 Erik Troan + * - Ported to dump/restore + * Stelian Pop - Alcôve , 2000 + * + * $Id: bylabel.h,v 1.2 2000/11/30 09:53:13 stelian Exp $ + */ + +#ifndef _BYLABEL_H_ +#define _BYLABEL_H_ + const char * get_device_name(const char * item); +const char * get_device_label(const char * spec); + +#endif /* !_BYLABEL_H_ */ diff --git a/compat/lib/bylabel.c b/compat/lib/bylabel.c index c91457d..978a39d 100644 --- a/compat/lib/bylabel.c +++ b/compat/lib/bylabel.c @@ -229,3 +229,18 @@ get_device_name(const char * item) { return rc; } + +const char * +get_device_label(const char * spec) { + struct uuidCache_s *uc; + + uuidcache_init(); + uc = uuidCache; + + while(uc) { + if (!strcmp(spec, uc->device)) + return uc->label[0] == '\0' ? NULL : strdup(uc->label); + uc = uc->next; + } + return NULL; +} diff --git a/dump/main.c b/dump/main.c index b981cd8..9f61fb6 100644 --- a/dump/main.c +++ b/dump/main.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.29 2000/11/10 14:42:25 stelian Exp $"; + "$Id: main.c,v 1.30 2000/11/30 09:53:14 stelian Exp $"; #endif /* not lint */ #include @@ -513,8 +513,9 @@ main(int argc, char *argv[]) } /* if no user label specified, use ext2 filesystem label if available */ if (spcl.c_label[0] == '\0') { - if (fs->super->s_volume_name[0] != '\0') { - strncpy(spcl.c_label, fs->super->s_volume_name,LBLSIZE); + const char *lbl; + if ( (lbl = get_device_label(disk)) != NULL) { + strncpy(spcl.c_label, lbl, LBLSIZE); spcl.c_label[LBLSIZE-1] = '\0'; } else -- 2.39.5