summaryrefslogtreecommitdiff
path: root/tbdiff/tbdiff-stat.h
diff options
context:
space:
mode:
Diffstat (limited to 'tbdiff/tbdiff-stat.h')
-rw-r--r--tbdiff/tbdiff-stat.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/tbdiff/tbdiff-stat.h b/tbdiff/tbdiff-stat.h
new file mode 100644
index 0000000..d23cc80
--- /dev/null
+++ b/tbdiff/tbdiff-stat.h
@@ -0,0 +1,62 @@
+/*
+ * 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_STAT_H__
+#define __TBDIFF_STAT_H__
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sys/types.h>
+
+typedef enum {
+ TBD_STAT_TYPE_FILE = 'f',
+ TBD_STAT_TYPE_DIR = 'd',
+ TBD_STAT_TYPE_SYMLINK = 'l',
+ TBD_STAT_TYPE_CHRDEV = 'c',
+ TBD_STAT_TYPE_BLKDEV = 'b',
+ TBD_STAT_TYPE_FIFO = 'p',
+ TBD_STAT_TYPE_SOCKET = 's'
+} tbd_stat_type_e;
+
+typedef struct {
+ void* parent;
+ char* name;
+ tbd_stat_type_e type;
+ time_t mtime;
+ uint32_t size; // Count for directory.
+ uid_t uid;
+ gid_t gid;
+ mode_t mode;
+ uint32_t rdev;
+} tbd_stat_t;
+
+extern tbd_stat_t* tbd_stat(const char *path);
+extern void tbd_stat_free(tbd_stat_t *file);
+extern void tbd_stat_print(tbd_stat_t *file);
+extern tbd_stat_t* tbd_stat_entry(tbd_stat_t *file, uint32_t entry);
+extern tbd_stat_t* tbd_stat_entry_find(tbd_stat_t *file, const char *name);
+extern char* tbd_stat_subpath(tbd_stat_t *file, const char *entry);
+extern char* tbd_stat_path(tbd_stat_t *file);
+extern int tbd_stat_open(tbd_stat_t *file, int flags);
+extern FILE* tbd_stat_fopen(tbd_stat_t *file, const char *mode);
+
+#endif /* !__TBDIFF_STAT_H__ */