modpost: drop RCS/CVS $Revision handling in MODULE_VERSION()
As far as I understood, this code gets rid of '$Revision$' or '$Revision:' of CVS, RCS or whatever in MODULE_VERSION() tags. Remove the primeval code. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
@@ -429,69 +429,3 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
|
||||
release:
|
||||
release_file(file, len);
|
||||
}
|
||||
|
||||
static void write_version(const char *filename, const char *sum,
|
||||
unsigned long offset)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = open(filename, O_RDWR);
|
||||
if (fd < 0) {
|
||||
warn("changing sum in %s failed: %s\n",
|
||||
filename, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
if (lseek(fd, offset, SEEK_SET) == (off_t)-1) {
|
||||
warn("changing sum in %s:%lu failed: %s\n",
|
||||
filename, offset, strerror(errno));
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (write(fd, sum, strlen(sum)+1) != strlen(sum)+1) {
|
||||
warn("writing sum in %s failed: %s\n",
|
||||
filename, strerror(errno));
|
||||
goto out;
|
||||
}
|
||||
out:
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static int strip_rcs_crap(char *version)
|
||||
{
|
||||
unsigned int len, full_len;
|
||||
|
||||
if (strncmp(version, "$Revision", strlen("$Revision")) != 0)
|
||||
return 0;
|
||||
|
||||
/* Space for version string follows. */
|
||||
full_len = strlen(version) + strlen(version + strlen(version) + 1) + 2;
|
||||
|
||||
/* Move string to start with version number: prefix will be
|
||||
* $Revision$ or $Revision: */
|
||||
len = strlen("$Revision");
|
||||
if (version[len] == ':' || version[len] == '$')
|
||||
len++;
|
||||
while (isspace(version[len]))
|
||||
len++;
|
||||
memmove(version, version+len, full_len-len);
|
||||
full_len -= len;
|
||||
|
||||
/* Preserve up to next whitespace. */
|
||||
len = 0;
|
||||
while (version[len] && !isspace(version[len]))
|
||||
len++;
|
||||
memmove(version + len, version + strlen(version),
|
||||
full_len - strlen(version));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Clean up RCS-style version numbers. */
|
||||
void maybe_frob_rcs_version(const char *modfilename,
|
||||
char *version,
|
||||
void *modinfo,
|
||||
unsigned long version_offset)
|
||||
{
|
||||
if (strip_rcs_crap(version))
|
||||
write_version(modfilename, version, version_offset);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user