Loading scripts/mod/modpost.c +2 −36 Original line number Diff line number Diff line Loading @@ -463,7 +463,7 @@ static void sym_set_crc(const char *name, unsigned int crc) s->crc_valid = 1; } void *grab_file(const char *filename, unsigned long *size) static void *grab_file(const char *filename, unsigned long *size) { struct stat st; void *map = MAP_FAILED; Loading @@ -485,41 +485,7 @@ void *grab_file(const char *filename, unsigned long *size) return map; } /** * Return a copy of the next line in a mmap'ed file. * spaces in the beginning of the line is trimmed away. * Return a pointer to a static buffer. **/ char *get_next_line(unsigned long *pos, void *file, unsigned long size) { static char line[4096]; int skip = 1; size_t len = 0; signed char *p = (signed char *)file + *pos; char *s = line; for (; *pos < size ; (*pos)++) { if (skip && isspace(*p)) { p++; continue; } skip = 0; if (*p != '\n' && (*pos < size)) { len++; *s++ = *p++; if (len > 4095) break; /* Too long, stop */ } else { /* End of string */ *s = '\0'; return line; } } /* End of buffer */ return NULL; } void release_file(void *file, unsigned long size) static void release_file(void *file, unsigned long size) { munmap(file, size); } Loading scripts/mod/modpost.h +0 −3 Original line number Diff line number Diff line Loading @@ -193,9 +193,6 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen); /* from modpost.c */ char *read_text_file(const char *filename); char *get_line(char **stringp); void *grab_file(const char *filename, unsigned long *size); char* get_next_line(unsigned long *pos, void *file, unsigned long size); void release_file(void *file, unsigned long size); enum loglevel { LOG_WARN, Loading Loading
scripts/mod/modpost.c +2 −36 Original line number Diff line number Diff line Loading @@ -463,7 +463,7 @@ static void sym_set_crc(const char *name, unsigned int crc) s->crc_valid = 1; } void *grab_file(const char *filename, unsigned long *size) static void *grab_file(const char *filename, unsigned long *size) { struct stat st; void *map = MAP_FAILED; Loading @@ -485,41 +485,7 @@ void *grab_file(const char *filename, unsigned long *size) return map; } /** * Return a copy of the next line in a mmap'ed file. * spaces in the beginning of the line is trimmed away. * Return a pointer to a static buffer. **/ char *get_next_line(unsigned long *pos, void *file, unsigned long size) { static char line[4096]; int skip = 1; size_t len = 0; signed char *p = (signed char *)file + *pos; char *s = line; for (; *pos < size ; (*pos)++) { if (skip && isspace(*p)) { p++; continue; } skip = 0; if (*p != '\n' && (*pos < size)) { len++; *s++ = *p++; if (len > 4095) break; /* Too long, stop */ } else { /* End of string */ *s = '\0'; return line; } } /* End of buffer */ return NULL; } void release_file(void *file, unsigned long size) static void release_file(void *file, unsigned long size) { munmap(file, size); } Loading
scripts/mod/modpost.h +0 −3 Original line number Diff line number Diff line Loading @@ -193,9 +193,6 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen); /* from modpost.c */ char *read_text_file(const char *filename); char *get_line(char **stringp); void *grab_file(const char *filename, unsigned long *size); char* get_next_line(unsigned long *pos, void *file, unsigned long size); void release_file(void *file, unsigned long size); enum loglevel { LOG_WARN, Loading