From 36caf25f8d61eb8ffddc9895463bce5807e96808 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 26 Oct 1999 14:29:22 +0000 Subject: [PATCH] ChangeLog, e2p.h, feature.c: feature.c: Fix GCC warnings; add const to the char * types in the function prototypes for e2p_feature2string and e2p_edit_feature. ChangeLog, uuid.h, uuid_time.c: uuid_time.c (variant_string): Declare to be static to avoid gcc warnings. uuid.h: Add function prototypes for uuid_generate_random() and uuid_generate_time(). ChangeLog, chattr.c: chattr.c: Add hack to compile in a definition for S_ISLNK so we can successfully compile even with warnings turned on. --- lib/e2p/ChangeLog | 6 ++++++ lib/e2p/e2p.h | 4 ++-- lib/e2p/feature.c | 30 ++++++++++++++++-------------- lib/uuid/ChangeLog | 8 ++++++++ lib/uuid/uuid.h | 2 ++ lib/uuid/uuid_time.c | 2 +- misc/ChangeLog | 5 +++++ misc/chattr.c | 8 ++++++++ 8 files changed, 48 insertions(+), 17 deletions(-) diff --git a/lib/e2p/ChangeLog b/lib/e2p/ChangeLog index f9180f6..02dad9f 100644 --- a/lib/e2p/ChangeLog +++ b/lib/e2p/ChangeLog @@ -1,3 +1,9 @@ +1999-10-26 + + * feature.c: Fix GCC warnings; add const to the char * types in + the function prototypes for e2p_feature2string and + e2p_edit_feature. + 1999-10-22 * Release of E2fsprogs 1.16 diff --git a/lib/e2p/e2p.h b/lib/e2p/e2p.h index 2ccbecc..9f5636c 100644 --- a/lib/e2p/e2p.h +++ b/lib/e2p/e2p.h @@ -24,9 +24,9 @@ void print_fs_state (FILE * f, unsigned short state); int setflags (int fd, unsigned long flags); int setversion (int fd, unsigned long version); -char *e2p_feature2string(int compat, unsigned int mask); +const char *e2p_feature2string(int compat, unsigned int mask); int e2p_string2feature(char *string, int *compat, unsigned int *mask); -int e2p_edit_feature(char *str, __u32 *compat_array, __u32 *ok_array); +int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array); int e2p_is_null_uuid(void *uu); void e2p_uuid_to_str(void *uu, char *out); diff --git a/lib/e2p/feature.c b/lib/e2p/feature.c index 00b5336..eee64e6 100644 --- a/lib/e2p/feature.c +++ b/lib/e2p/feature.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "e2p.h" @@ -59,7 +60,7 @@ struct feature { int compat; unsigned int mask; - char *string; + const char *string; }; struct feature feature_list[] = { @@ -84,7 +85,7 @@ struct feature feature_list[] = { { 0, 0, 0 }, }; -char *e2p_feature2string(int compat, unsigned int mask) +const char *e2p_feature2string(int compat, unsigned int mask) { struct feature *f; static char buf[20]; @@ -115,7 +116,7 @@ char *e2p_feature2string(int compat, unsigned int mask) return buf; } -int e2p_string2feature(char *string, int *compat, unsigned int *mask) +int e2p_string2feature(char *string, int *compat_type, unsigned int *mask) { struct feature *f; char *eptr; @@ -123,7 +124,7 @@ int e2p_string2feature(char *string, int *compat, unsigned int *mask) for (f = feature_list; f->string; f++) { if (!strcasecmp(string, f->string)) { - *compat = f->compat; + *compat_type = f->compat; *mask = f->mask; return 0; } @@ -134,15 +135,15 @@ int e2p_string2feature(char *string, int *compat, unsigned int *mask) switch (string[8]) { case 'c': case 'C': - *compat = E2P_FEATURE_COMPAT; + *compat_type = E2P_FEATURE_COMPAT; break; case 'i': case 'I': - *compat = E2P_FEATURE_INCOMPAT; + *compat_type = E2P_FEATURE_INCOMPAT; break; case 'r': case 'R': - *compat = E2P_FEATURE_RO_INCOMPAT; + *compat_type = E2P_FEATURE_RO_INCOMPAT; break; default: return 1; @@ -165,7 +166,7 @@ static char *skip_over_blanks(char *cp) return cp; } -char *skip_over_word(char *cp) +static char *skip_over_word(char *cp) { while (*cp && !isspace(*cp) && *cp != ',') cp++; @@ -177,11 +178,12 @@ char *skip_over_word(char *cp) * if set, allows the application to limit what features the user is * allowed to set or clear using this function. */ -int e2p_edit_feature(char *str, __u32 *compat_array, __u32 *ok_array) +int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array) { char *cp, *buf, *next; int neg; - unsigned int compat, mask; + unsigned int mask; + int compat_type; buf = malloc(strlen(str)+1); if (!buf) @@ -204,14 +206,14 @@ int e2p_edit_feature(char *str, __u32 *compat_array, __u32 *ok_array) cp++; break; } - if (e2p_string2feature(cp, &compat, &mask)) + if (e2p_string2feature(cp, &compat_type, &mask)) return 1; - if (ok_array && !(ok_array[compat] & mask)) + if (ok_array && !(ok_array[compat_type] & mask)) return 1; if (neg) - compat_array[compat] &= ~mask; + compat_array[compat_type] &= ~mask; else - compat_array[compat] |= mask; + compat_array[compat_type] |= mask; cp = next ? next+1 : 0; } return 0; diff --git a/lib/uuid/ChangeLog b/lib/uuid/ChangeLog index 83abc89..858bb54 100644 --- a/lib/uuid/ChangeLog +++ b/lib/uuid/ChangeLog @@ -1,3 +1,11 @@ +1999-10-26 + + * uuid_time.c (variant_string): Declare to be static to avoid gcc + warnings. + + * uuid.h: Add function prototypes for uuid_generate_random() and + uuid_generate_time(). + 1999-10-25 * gen_uuid_nt.c (uuid_generate): W2K strikes again! An diff --git a/lib/uuid/uuid.h b/lib/uuid/uuid.h index 8354111..12afabf 100644 --- a/lib/uuid/uuid.h +++ b/lib/uuid/uuid.h @@ -32,6 +32,8 @@ void uuid_copy(uuid_t uu1, uuid_t uu2); /* gen_uuid.c */ void uuid_generate(uuid_t out); +void uuid_generate_random(uuid_t out); +void uuid_generate_time(uuid_t out); /* isnull.c */ int uuid_is_null(uuid_t uu); diff --git a/lib/uuid/uuid_time.c b/lib/uuid/uuid_time.c index 6526496..f2fddfa 100644 --- a/lib/uuid/uuid_time.c +++ b/lib/uuid/uuid_time.c @@ -69,7 +69,7 @@ int uuid_variant(uuid_t uu) } #ifdef DEBUG -const char *variant_string(int variant) +static const char *variant_string(int variant) { switch (variant) { case UUID_VARIANT_NCS: diff --git a/misc/ChangeLog b/misc/ChangeLog index 508aafb..7bf0bfc 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,8 @@ +1999-10-26 + + * chattr.c: Add hack to compile in a definition for S_ISLNK so we + can successfully compile even with warnings turned on. + 1999-10-25 * mke2fs.c (show_stats): Capitalized Hurd to make the GNU types diff --git a/misc/chattr.c b/misc/chattr.c index 848c1d5..de1480c 100644 --- a/misc/chattr.c +++ b/misc/chattr.c @@ -32,6 +32,14 @@ #include #include +#ifndef S_ISLNK /* So we can compile even with gcc-warn */ +# ifdef __S_IFLNK +# define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK) +# else +# define S_ISLNK(mode) 0 +# endif +#endif + #include "et/com_err.h" #include "e2p/e2p.h" -- 1.8.3.1