summaryrefslogtreecommitdiff
path: root/tbdiff/tbdiff-xattrs.h
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-03-22 13:55:30 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-03-22 15:32:12 +0000
commitc7a4f00fd701c7e1bd071c7a5aa8199f96833823 (patch)
tree9f3d83669527a1691fd2ad9e687671ba472f6bc4 /tbdiff/tbdiff-xattrs.h
parent55551592563c26d28c62d055e3ebc657ad687a0a (diff)
downloadtbdiff-c7a4f00fd701c7e1bd071c7a5aa8199f96833823.tar.gz
Switch to a shared tbdiff library and make this an autotools project.
This commit converts tbdiff to being an autotools-based project. This means that we now support the usual autoreconf -i && ./configure && make && make install process, plus we provide 'make check' for the tbdiff test suite. The tbdiff library is now build as a shared library and is also installed into the system for others to use. The library is libtool-versioned and ships a pkg-config file (tbdiff-1.pc). The headers were adjusted so that only tbdiff/tbdiff.h may be included directly; all others are considered internal. The tbdiff-create and tbdiff-deploy tools were changed to include this header file. The tbdiff library is still GPL, not LGPL. We might want to change this in the future. Thanks to switching to autotools we now have a way to make releases by means of 'make dist' and 'make distcheck'. Unfortunately, the latter currently fails, probably due to something being missing in tbdiff/Makefile.am.
Diffstat (limited to 'tbdiff/tbdiff-xattrs.h')
-rw-r--r--tbdiff/tbdiff-xattrs.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/tbdiff/tbdiff-xattrs.h b/tbdiff/tbdiff-xattrs.h
new file mode 100644
index 0000000..ba4a79e
--- /dev/null
+++ b/tbdiff/tbdiff-xattrs.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2011-2012 Codethink Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#if !defined (TBDIFF_INSIDE_TBDIFF_H) && !defined (TBDIFF_COMPILATION)
+#error "Only <tbdiff/tbdiff.h> may be included directly. This file might disappear or change contents."
+#endif
+
+#ifndef _TBDIFF_XATTRS_H
+#define _TBDIFF_XATTRS_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* structure for names data */
+typedef struct tbd_xattrs_names {
+ char const *begin;
+ char const *end;
+} tbd_xattrs_names_t;
+
+/* gets a list of the names of the file referenced by path */
+extern int tbd_xattrs_names(char const *path, tbd_xattrs_names_t *names_out);
+
+/* frees up the INTERNAL resources of the list, doesn't free the list itself */
+extern void tbd_xattrs_names_free(tbd_xattrs_names_t *names);
+
+/* calls f with every name in the list */
+extern int tbd_xattrs_names_each(tbd_xattrs_names_t const *names,
+ int (*f)(char const *name, void *ud),
+ void *ud);
+
+/* gets how many different attributes there are in the list */
+extern int tbd_xattrs_names_count(tbd_xattrs_names_t const *names, uint32_t *count);
+
+/* puts the value of the attribute called name into *buf with size *bufsize
+ * if *buf is NULL or *bufsize is 0 then memory will be allocated for it
+ * if *buf was too small it will be reallocated
+ * if it is successful, *buf will contain *valsize bytes of data
+ */
+extern int tbd_xattrs_get(char const *path, char const* name, void **buf,
+ size_t *bufsize, size_t *valsize);
+
+/* removes all attributes of the file referenced by path */
+extern int tbd_xattrs_removeall(char const *path);
+
+/* calls f for every attribute:value pair in the list */
+typedef int (*tbd_xattrs_pairs_callback_t)(char const *name, void const *data,
+ size_t size, void *ud);
+extern int tbd_xattrs_pairs(tbd_xattrs_names_t const *names, char const *path,
+ tbd_xattrs_pairs_callback_t f, void *ud);
+#endif /* !__TBDIFF_XATTRS_H__ */