summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto <alberto.ruiz@codethink.co.uk>2011-09-30 16:37:08 +0100
committerAlberto <alberto.ruiz@codethink.co.uk>2011-09-30 16:37:08 +0100
commit5999e1205dd85b408f12da0391d29f2436af692c (patch)
tree9519c18d87faf07907bdf32bfc4055dfeeb029b5
parent4fa0b0dbfb90b042a7633d7c69e592263cf2d179 (diff)
downloadtbdiff-5999e1205dd85b408f12da0391d29f2436af692c.tar.gz
Remove otap name from the file structure
-rw-r--r--Makefile10
-rw-r--r--libtbd_apply.c (renamed from libtdb_apply.c)3
-rw-r--r--libtbd_create.c (renamed from libtdb_create.c)3
-rw-r--r--libtbd_stat.c (renamed from stat.c)2
-rw-r--r--libtbd_stat.h (renamed from stat.h)11
-rw-r--r--otap.h57
-rw-r--r--tbdiff-private.h5
-rw-r--r--tbdiff.h (renamed from error.h)43
-rw-r--r--tbdiff_create.c4
-rw-r--r--tbdiff_deploy.c6
10 files changed, 61 insertions, 83 deletions
diff --git a/Makefile b/Makefile
index 79cfc8d..70a9d3a 100644
--- a/Makefile
+++ b/Makefile
@@ -11,19 +11,19 @@ CFLAGS ?=
CFLAGS += -g
CFLAGS += -Wall -Wextra -Werror $(OPT)
-SHARED_SRC := stat.c
-DEPLOY_SRC := tbdiff_deploy.c libtdb_create.c
-CREATE_SRC := tbdiff_create.c libtdb_apply.c
+SHARED_SRC := libtbd_stat.c
+DEPLOY_SRC := tbdiff_deploy.c libtbd_create.c
+CREATE_SRC := tbdiff_create.c libtbd_apply.c
DEPLOY_OBJ := $(patsubst %.c,%.o,$(SHARED_SRC) $(DEPLOY_SRC))
CREATE_OBJ := $(patsubst %.c,%.o,$(SHARED_SRC) $(CREATE_SRC))
all: $(DEPLOY) $(CREATE)
-$(DEPLOY): tbdiff_deploy.o libtdb_apply.o stat.o
+$(DEPLOY): tbdiff_deploy.o libtbd_apply.o libtbd_stat.o
$(CC) $(LDFLAGS) -o $@ $^
-$(CREATE): tbdiff_create.o libtdb_create.o stat.o
+$(CREATE): tbdiff_create.o libtbd_create.o libtbd_stat.o
$(CC) $(LDFLAGS) -o $@ $^
%.o: %.c
diff --git a/libtdb_apply.c b/libtbd_apply.c
index 8c18b4a..aef8ac3 100644
--- a/libtdb_apply.c
+++ b/libtbd_apply.c
@@ -15,9 +15,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "otap.h"
+#include "tbdiff.h"
#include "tbdiff-private.h"
-#include "error.h"
#include <stdlib.h>
#include <stdio.h>
diff --git a/libtdb_create.c b/libtbd_create.c
index bca0550..932ee93 100644
--- a/libtdb_create.c
+++ b/libtbd_create.c
@@ -15,9 +15,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "otap.h"
+#include "tbdiff.h"
#include "tbdiff-private.h"
-#include "error.h"
#include <stdlib.h>
diff --git a/stat.c b/libtbd_stat.c
index 2b0b42d..dcef9fb 100644
--- a/stat.c
+++ b/libtbd_stat.c
@@ -15,7 +15,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "stat.h"
+#include "libtbd_stat.h"
#include <stdlib.h>
#include <stdio.h>
diff --git a/stat.h b/libtbd_stat.h
index 4f14ccc..d9b1749 100644
--- a/stat.h
+++ b/libtbd_stat.h
@@ -15,8 +15,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __otap_stat_h__
-#define __otap_stat_h__
+#ifndef __LIBTBD_STAT_H__
+#define __LIBTBD_STAT_H__
#include <stdio.h>
#include <stdint.h>
@@ -31,12 +31,12 @@ typedef enum {
OTAP_STAT_TYPE_BLKDEV = 'b',
OTAP_STAT_TYPE_FIFO = 'p',
OTAP_STAT_TYPE_SOCKET = 's'
-} otap_stat_type_e;
+} tbd_stat_type_e;
typedef struct {
void* parent;
char* name;
- otap_stat_type_e type;
+ tbd_stat_type_e type;
uint32_t mtime;
uint32_t size; // Count for directory.
uint32_t uid;
@@ -45,7 +45,6 @@ typedef struct {
uint32_t rdev;
} otap_stat_t;
-
extern otap_stat_t* otap_stat(const char* path);
extern void otap_stat_free(otap_stat_t* file);
extern void otap_stat_print(otap_stat_t* file);
@@ -56,4 +55,4 @@ extern char* otap_stat_path(otap_stat_t* file);
extern int otap_stat_open(otap_stat_t* file, int flags);
extern FILE* otap_stat_fopen(otap_stat_t* file, const char* mode);
-#endif
+#endif /* __LIBTBD_STAT_H__ */
diff --git a/otap.h b/otap.h
deleted file mode 100644
index 0942192..0000000
--- a/otap.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#ifndef __otap_h__
-#define __otap_h__
-
-#include <stdio.h>
-#include <stdint.h>
-
-#include "stat.h"
-
-typedef enum {
- OTAP_CMD_IDENTIFY = 0x00,
- OTAP_CMD_UPDATE = 0x01,
- OTAP_CMD_DIR_CREATE = 0x10,
- OTAP_CMD_DIR_ENTER = 0x11,
- OTAP_CMD_DIR_LEAVE = 0x12,
- OTAP_CMD_DIR_DELTA = 0x13,
- OTAP_CMD_FILE_CREATE = 0x20,
- OTAP_CMD_FILE_DELTA = 0x21,
- OTAP_CMD_FILE_METADATA_UPDATE = 0x22,
- OTAP_CMD_ENTITY_MOVE = 0x30,
- OTAP_CMD_ENTITY_COPY = 0x31,
- OTAP_CMD_ENTITY_DELETE = 0x32,
- OTAP_CMD_SYMLINK_CREATE = 0x40,
- OTAP_CMD_SPECIAL_CREATE = 0x50,
-} otap_cmd_e;
-
-typedef enum {
- OTAP_METADATA_NONE = 0x0,
- OTAP_METADATA_MTIME = 0x1,
- OTAP_METADATA_MODE = 0x2,
- OTAP_METADATA_UID = 0x4,
- OTAP_METADATA_GID = 0x8,
- OTAP_METADATA_RDEV = 0x10,
-} otap_metadata_type_e;
-
-extern const char* otap_ident;
-
-extern int otap_apply(FILE* stream);
-extern int otap_create(FILE* stream, otap_stat_t* a, otap_stat_t* b);
-
-#endif
diff --git a/tbdiff-private.h b/tbdiff-private.h
index e298016..a991f12 100644
--- a/tbdiff-private.h
+++ b/tbdiff-private.h
@@ -15,4 +15,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef __TBDIFF_PRIVATE_H__
+#define __TBDIFF_PRIVATE_H__
+
#define TB_DIFF_PROTOCOL_ID "CodeThink:OTAPv0"
+
+#endif
diff --git a/error.h b/tbdiff.h
index 7ce5b4c..4436bed 100644
--- a/error.h
+++ b/tbdiff.h
@@ -15,8 +15,39 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __otap_error_h__
-#define __otap_error_h__
+#ifndef __TBDIFF_H__
+#define __TBDIFF_H__
+
+#include <stdio.h>
+#include <stdint.h>
+
+#include "libtbd_stat.h"
+
+typedef enum {
+ OTAP_CMD_IDENTIFY = 0x00,
+ OTAP_CMD_UPDATE = 0x01,
+ OTAP_CMD_DIR_CREATE = 0x10,
+ OTAP_CMD_DIR_ENTER = 0x11,
+ OTAP_CMD_DIR_LEAVE = 0x12,
+ OTAP_CMD_DIR_DELTA = 0x13,
+ OTAP_CMD_FILE_CREATE = 0x20,
+ OTAP_CMD_FILE_DELTA = 0x21,
+ OTAP_CMD_FILE_METADATA_UPDATE = 0x22,
+ OTAP_CMD_ENTITY_MOVE = 0x30,
+ OTAP_CMD_ENTITY_COPY = 0x31,
+ OTAP_CMD_ENTITY_DELETE = 0x32,
+ OTAP_CMD_SYMLINK_CREATE = 0x40,
+ OTAP_CMD_SPECIAL_CREATE = 0x50,
+} tbd_cmd_e;
+
+typedef enum {
+ OTAP_METADATA_NONE = 0x0,
+ OTAP_METADATA_MTIME = 0x1,
+ OTAP_METADATA_MODE = 0x2,
+ OTAP_METADATA_UID = 0x4,
+ OTAP_METADATA_GID = 0x8,
+ OTAP_METADATA_RDEV = 0x10,
+} tbd_metadata_type_e;
typedef enum {
OTAP_ERROR_SUCCESS = 0,
@@ -41,7 +72,7 @@ typedef enum {
OTAP_ERROR_UNABLE_TO_CREATE_SYMLINK = -19,
OTAP_ERROR_UNABLE_TO_READ_SPECIAL_FILE = -20,
OTAP_ERROR_UNABLE_TO_CREATE_SPECIAL_FILE = - 21,
-} otap_error_e;
+} tbd_error_e;
#ifdef NDEBUG
#define otap_error(e) return e
@@ -49,4 +80,8 @@ typedef enum {
#define otap_error(e) { if(e != 0) fprintf(stderr, "OTAP error '%s' in function '%s' at line %d of file '%s'.\n", #e, __FUNCTION__, __LINE__, __FILE__); return e; }
#endif
-#endif
+extern const char* otap_ident;
+extern int otap_apply(FILE* stream);
+extern int otap_create(FILE* stream, otap_stat_t* a, otap_stat_t* b);
+
+#endif /* __TBDIFF_H__ */
diff --git a/tbdiff_create.c b/tbdiff_create.c
index 599c368..f33356e 100644
--- a/tbdiff_create.c
+++ b/tbdiff_create.c
@@ -21,8 +21,8 @@
#include <unistd.h>
-#include "stat.h"
-#include "otap.h"
+#include "libtbd_stat.h"
+#include "tbdiff.h"
int
diff --git a/tbdiff_deploy.c b/tbdiff_deploy.c
index c2d49ec..807b339 100644
--- a/tbdiff_deploy.c
+++ b/tbdiff_deploy.c
@@ -15,15 +15,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "tbdiff.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
-
#include <unistd.h>
-
-#include "otap.h"
-
#include <errno.h>
int