gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r19527 - in gnunet/src: fs include


From: gnunet
Subject: [GNUnet-SVN] r19527 - in gnunet/src: fs include
Date: Mon, 30 Jan 2012 13:21:21 +0100

Author: grothoff
Date: 2012-01-30 13:21:21 +0100 (Mon, 30 Jan 2012)
New Revision: 19527

Modified:
   gnunet/src/fs/Makefile.am
   gnunet/src/fs/fs_file_information.c
   gnunet/src/fs/gnunet-helper-fs-publish.c
   gnunet/src/include/gnunet_fs_service.h
Log:
-all meta data extraction should happen in helper, removing from API

Modified: gnunet/src/fs/Makefile.am
===================================================================
--- gnunet/src/fs/Makefile.am   2012-01-30 12:18:56 UTC (rev 19526)
+++ gnunet/src/fs/Makefile.am   2012-01-30 12:21:21 UTC (rev 19527)
@@ -44,8 +44,7 @@
 libgnunetfs_la_LIBADD = \
   $(top_builddir)/src/datastore/libgnunetdatastore.la \
   $(top_builddir)/src/util/libgnunetutil.la \
-  -lextractor \
-  $(GN_LIBINTL) $(XLIB) -lunistring
+  $(GN_LIBINTL) $(XLIB) -lunistring -lextractor
 
 libgnunetfs_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  $(WINFLAGS) \
@@ -114,7 +113,6 @@
 gnunet_helper_fs_publish_SOURCES =  \
  gnunet-helper-fs-publish.c 
 gnunet_helper_fs_publish_LDADD =  \
- $(top_builddir)/src/fs/libgnunetfs.la \
  $(top_builddir)/src/util/libgnunetutil.la \
  -lextractor \
  $(GN_LIBINTL)

Modified: gnunet/src/fs/fs_file_information.c
===================================================================
--- gnunet/src/fs/fs_file_information.c 2012-01-30 12:18:56 UTC (rev 19526)
+++ gnunet/src/fs/fs_file_information.c 2012-01-30 12:21:21 UTC (rev 19527)
@@ -22,10 +22,6 @@
  * @file fs/fs_file_information.c
  * @brief  Manage information for publishing directory hierarchies
  * @author Christian Grothoff
- *
- * TODO:
- * - metadata filename clean up code
- * - metadata/ksk generation for directories from contained files
  */
 #include "platform.h"
 #include <extractor.h>
@@ -35,61 +31,6 @@
 
 
 /**
- * Add meta data that libextractor finds to our meta data
- * container.
- *
- * @param cls closure, our meta data container
- * @param plugin_name name of the plugin that produced this value;
- *        special values can be used (i.e. '&lt;zlib&gt;' for zlib being
- *        used in the main libextractor library and yielding
- *        meta data).
- * @param type libextractor-type describing the meta data
- * @param format basic format information about data
- * @param data_mime_type mime-type of data (not of the original file);
- *        can be NULL (if mime-type is not known)
- * @param data actual meta-data found
- * @param data_len number of bytes in data
- * @return always 0 to continue extracting
- */
-static int
-add_to_md (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
-           enum EXTRACTOR_MetaFormat format, const char *data_mime_type,
-           const char *data, size_t data_len)
-{
-  struct GNUNET_CONTAINER_MetaData *md = cls;
-
-  (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format,
-                                            data_mime_type, data, data_len);
-  return 0;
-}
-
-
-/**
- * Extract meta-data from a file.
- *
- * @return GNUNET_SYSERR on error, otherwise the number
- *   of meta-data items obtained
- */
-int
-GNUNET_FS_meta_data_extract_from_file (struct GNUNET_CONTAINER_MetaData *md,
-                                       const char *filename,
-                                       struct EXTRACTOR_PluginList *extractors)
-{
-  int old;
-
-  if (filename == NULL)
-    return GNUNET_SYSERR;
-  if (extractors == NULL)
-    return 0;
-  old = GNUNET_CONTAINER_meta_data_iterate (md, NULL, NULL);
-  GNUNET_assert (old >= 0);
-  EXTRACTOR_extract (extractors, filename, NULL, 0, &add_to_md, md);
-  return (GNUNET_CONTAINER_meta_data_iterate (md, NULL, NULL) - old);
-}
-
-
-
-/**
  * Obtain the name under which this file information
  * structure is stored on disk.  Only works for top-level
  * file information structures.

Modified: gnunet/src/fs/gnunet-helper-fs-publish.c
===================================================================
--- gnunet/src/fs/gnunet-helper-fs-publish.c    2012-01-30 12:18:56 UTC (rev 
19526)
+++ gnunet/src/fs/gnunet-helper-fs-publish.c    2012-01-30 12:21:21 UTC (rev 
19527)
@@ -88,6 +88,36 @@
 
 
 /**
+ * Add meta data that libextractor finds to our meta data
+ * container.
+ *
+ * @param cls closure, our meta data container
+ * @param plugin_name name of the plugin that produced this value;
+ *        special values can be used (i.e. '&lt;zlib&gt;' for zlib being
+ *        used in the main libextractor library and yielding
+ *        meta data).
+ * @param type libextractor-type describing the meta data
+ * @param format basic format information about data
+ * @param data_mime_type mime-type of data (not of the original file);
+ *        can be NULL (if mime-type is not known)
+ * @param data actual meta-data found
+ * @param data_len number of bytes in data
+ * @return always 0 to continue extracting
+ */
+static int
+add_to_md (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
+           enum EXTRACTOR_MetaFormat format, const char *data_mime_type,
+           const char *data, size_t data_len)
+{
+  struct GNUNET_CONTAINER_MetaData *md = cls;
+
+  (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format,
+                                            data_mime_type, data, data_len);
+  return 0;
+}
+
+
+/**
  * Free memory of the 'tree' structure
  *
  * @param tree tree to free
@@ -322,9 +352,8 @@
   
   /* this is the expensive operation, *afterwards* we'll check for aborts */
   meta = GNUNET_CONTAINER_meta_data_create ();
-  GNUNET_FS_meta_data_extract_from_file (meta, 
-                                        item->filename,
-                                        plugins);
+  if (NULL != plugins)
+    EXTRACTOR_extract (plugins, item->filename, NULL, 0, &add_to_md, meta);
   slen = strlen (item->filename) + 1;
   size = GNUNET_CONTAINER_meta_data_get_serialized_size (meta);
   if ( (-1 == size) ||

Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h      2012-01-30 12:18:56 UTC (rev 
19526)
+++ gnunet/src/include/gnunet_fs_service.h      2012-01-30 12:21:21 UTC (rev 
19527)
@@ -1696,21 +1696,6 @@
 
 
 /**
- * Extract meta-data from a file.
- *
- * @param md metadata to set
- * @param filename name of file to inspect
- * @param extractors plugins to use
- * @return GNUNET_SYSERR on error, otherwise the number
- *   of meta-data items obtained
- */
-int
-GNUNET_FS_meta_data_extract_from_file (struct GNUNET_CONTAINER_MetaData *md,
-                                       const char *filename,
-                                       struct EXTRACTOR_PluginList 
*extractors);
-
-
-/**
  * Function called on entries in a GNUNET_FS_FileInformation publish-structure.
  *
  * @param cls closure




reply via email to

[Prev in Thread] Current Thread [Next in Thread]