1 /*******************************************************************************
5 / Description: Kernel module implementing kernel-space mime_table API
7 / Copyright 2004, François Revol.
9 *******************************************************************************/
12 #include <KernelExport.h>
16 #include <mime_table.h>
17 extern struct ext_mime mimes
[];
20 #define ddprintf(x) dprintf x
25 /* Module static data */
26 const char mime_table_module_name
[] = B_MIME_TABLE_MODULE_NAME
;
29 std_ops(int32 op
, ...)
43 status_t
get_table(struct ext_mime
**table
)
47 /* no need to malloc & copy yet */
52 void free_table(struct ext_mime
*table
)
57 const char *mime_for_ext(const char *ext
)
60 /* should probably be optimized */
61 for (i
= 0; mimes
[i
].extension
; i
++) {
62 if (!strcmp(ext
, mimes
[i
].extension
))
68 const char *ext_for_mime(const char *mime
)
71 /* should probably be optimized */
72 for (i
= 0; mimes
[i
].mime
; i
++) {
73 if (!strcmp(mime
, mimes
[i
].mime
))
74 return mimes
[i
].extension
;
79 static mime_table_module_info mime_table
= {
81 mime_table_module_name
,
91 _EXPORT mime_table_module_info
*modules
[] = {