From e189e3d7799e5886117315cf4561e3ff269bf436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Tue, 4 Jan 2005 10:03:05 +0000 Subject: [PATCH] header for a kernel mime_table module, so not every fs will bundle its own. The API makes it possible to later use faster indexed search on the table. The table could probably also be regenerated by running a script on setmime -dump. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10579 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/drivers/mime_table.h | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 headers/os/drivers/mime_table.h diff --git a/headers/os/drivers/mime_table.h b/headers/os/drivers/mime_table.h new file mode 100644 index 0000000000..e4d7332b72 --- /dev/null +++ b/headers/os/drivers/mime_table.h @@ -0,0 +1,56 @@ +/******************************************************************************* +/ +/ File: mime_table.h +/ +/ Description: Kernel mime table and matcher module API +/ +/ Copyright 2005, François Revol. +/ +*******************************************************************************/ + +#ifndef _MIME_TABLE_MODULE_H_ +#define _MIME_TABLE_MODULE_H_ + +#include + +struct ext_mime { + char *extension; + char *mime; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + status_t get_table(struct ext_mime **table) + Returns the current kernel mime table. + You must call free_table() when finished with it. + + void free_table(struct ext_mime *table) + Frees the given mime table; + + const char * mime_for_ext(const char *ext) + Returns the known mime type for the given extension. + + const char * ext_for_mime(const char *mime) + Returns the known extension for the given mime type. + +*/ + +#define B_MIME_TABLE_MODULE_NAME "generic/mime_table/v1" + +typedef struct { + module_info minfo; + status_t (*get_table)(struct ext_mime **table); + void (*free_table)(struct ext_mime *table); + const char * (*mime_for_ext)(const char *ext); + const char * (*ext_for_mime)(const char *mime); +} mime_table_module_info; + +#ifdef __cplusplus +} +#endif + +#endif +