Commit b2e02284 authored by Kurt Kanzenbach's avatar Kurt Kanzenbach Committed by Greg Kroah-Hartman

staging: usbip: userspace: libsrc: cleanup parsing

Since the names.c/names.h are taken from another project, some
functions which names.c provides aren't used by usbipd.
This patch fixes:
 - removed useless comments
 - unified debug/error messages by using the macros
   provided by usbip_common.h
 - removed unnused code

The code cleanup includes:
 - remove unused data structures
 - remove code to create them
 - remove code to access them

The file names.c is used to parse the `usb.ids' file. The parser
stores a lot of information about usb devices that is never used.

The `usb.ids' file has several sections. Some variables (like
`lasthut') store the ID of the current section, and those variables
are used to decide which section is currently being parsed (i.e. in
which data structure the current line will be  stored).

We removed the code to read those IDs because they are never used
anyway. We replaced them by the pseudo-ID `1' (instead of reading the
ID from the file) to indicate that the parser is in a section that
can be ignored. If the parser is in such a section, the current line
(which contains sub-items for this section) is discarded.
Signed-off-by: default avatarKurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: default avatarStefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e71e781b
/*****************************************************************************/
/* /*
* names.h -- USB name database manipulation routines * names.h -- USB name database manipulation routines
* *
...@@ -20,39 +18,24 @@ ...@@ -20,39 +18,24 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* *
*/ *
/*
* Copyright (C) 2005 Takahiro Hirofuchi * Copyright (C) 2005 Takahiro Hirofuchi
* - names_free() is added. * - names_free() is added.
*/ */
/*****************************************************************************/
#ifndef _NAMES_H #ifndef _NAMES_H
#define _NAMES_H #define _NAMES_H
#include <sys/types.h> #include <sys/types.h>
/* ---------------------------------------------------------------------- */ /* used by usbip_common.c */
extern const char *names_vendor(u_int16_t vendorid); extern const char *names_vendor(u_int16_t vendorid);
extern const char *names_product(u_int16_t vendorid, u_int16_t productid); extern const char *names_product(u_int16_t vendorid, u_int16_t productid);
extern const char *names_class(u_int8_t classid); extern const char *names_class(u_int8_t classid);
extern const char *names_subclass(u_int8_t classid, u_int8_t subclassid); extern const char *names_subclass(u_int8_t classid, u_int8_t subclassid);
extern const char *names_protocol(u_int8_t classid, u_int8_t subclassid, extern const char *names_protocol(u_int8_t classid, u_int8_t subclassid,
u_int8_t protocolid); u_int8_t protocolid);
extern const char *names_audioterminal(u_int16_t termt);
extern const char *names_hid(u_int8_t hidd);
extern const char *names_reporttag(u_int8_t rt);
extern const char *names_huts(unsigned int data);
extern const char *names_hutus(unsigned int data);
extern const char *names_langid(u_int16_t langid);
extern const char *names_physdes(u_int8_t ph);
extern const char *names_bias(u_int8_t b);
extern const char *names_countrycode(unsigned int countrycode);
extern int names_init(char *n); extern int names_init(char *n);
extern void names_free(void); extern void names_free(void);
/* ---------------------------------------------------------------------- */
#endif /* _NAMES_H */ #endif /* _NAMES_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment