summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto <alberto.ruiz@codethink.co.uk>2011-09-30 16:39:27 +0100
committerAlberto <alberto.ruiz@codethink.co.uk>2011-09-30 16:39:27 +0100
commitd05847e42d47b4c4b9bcc7dfdc5dbccc3cbc3138 (patch)
treed0938a6bf7f25fb5e0832b406c852907fca0d839
parent5999e1205dd85b408f12da0391d29f2436af692c (diff)
downloadtbdiff-d05847e42d47b4c4b9bcc7dfdc5dbccc3cbc3138.tar.gz
type name replacement otap_stat_t -> tdb_stat_t
-rw-r--r--libtbd_create.c94
-rw-r--r--libtbd_stat.c58
-rw-r--r--libtbd_stat.h34
-rw-r--r--tbdiff.h2
-rw-r--r--tbdiff_create.c2
5 files changed, 95 insertions, 95 deletions
diff --git a/libtbd_create.c b/libtbd_create.c
index 932ee93..1e0b53d 100644
--- a/libtbd_create.c
+++ b/libtbd_create.c
@@ -124,7 +124,7 @@ _otap_create_cmd_update(FILE* stream)
}
static int
-_otap_create_cmd_file_create(FILE* stream, otap_stat_t* f)
+_otap_create_cmd_file_create(FILE* stream, tbd_stat_t* f)
{
int err;
if((err = _otap_create_fwrite_cmd(stream, OTAP_CMD_FILE_CREATE)) != 0 ||
@@ -158,8 +158,8 @@ _otap_create_cmd_file_create(FILE* stream, otap_stat_t* f)
}
static uint16_t
-_otap_metadata_mask(otap_stat_t *a,
- otap_stat_t *b)
+_otap_metadata_mask(tbd_stat_t *a,
+ tbd_stat_t *b)
{
uint16_t metadata_mask = OTAP_METADATA_NONE;
@@ -178,8 +178,8 @@ _otap_metadata_mask(otap_stat_t *a,
static int
_otap_create_cmd_file_metadata_update(FILE *stream,
- otap_stat_t *a,
- otap_stat_t *b)
+ tbd_stat_t *a,
+ tbd_stat_t *b)
{
int err;
uint16_t metadata_mask = _otap_metadata_mask(a, b);
@@ -200,8 +200,8 @@ _otap_create_cmd_file_metadata_update(FILE *stream,
static int
_otap_create_cmd_file_delta(FILE *stream,
- otap_stat_t *a,
- otap_stat_t *b)
+ tbd_stat_t *a,
+ tbd_stat_t *b)
{
FILE* fpa = otap_stat_fopen(a, "rb");
if(fpa == NULL)
@@ -345,7 +345,7 @@ _otap_create_cmd_file_delta(FILE *stream,
static int
_otap_create_cmd_dir_create(FILE *stream,
- otap_stat_t *d)
+ tbd_stat_t *d)
{
int err;
@@ -406,8 +406,8 @@ _otap_create_cmd_entity_delete(FILE *stream,
static int
_otap_create_cmd_dir_delta(FILE *stream,
- otap_stat_t *a,
- otap_stat_t *b)
+ tbd_stat_t *a,
+ tbd_stat_t *b)
{
int err;
uint16_t metadata_mask = _otap_metadata_mask(a, b);
@@ -428,7 +428,7 @@ _otap_create_cmd_dir_delta(FILE *stream,
static int
_otap_create_cmd_symlink_create(FILE *stream,
- otap_stat_t *symlink)
+ tbd_stat_t *symlink)
{
int err;
char path[PATH_BUFFER_LENGTH];
@@ -452,8 +452,8 @@ _otap_create_cmd_symlink_create(FILE *stream,
static int
_otap_create_cmd_symlink_delta(FILE *stream,
- otap_stat_t *a,
- otap_stat_t *b)
+ tbd_stat_t *a,
+ tbd_stat_t *b)
{
int err;
char path_a[PATH_BUFFER_LENGTH];
@@ -489,7 +489,7 @@ _otap_create_cmd_symlink_delta(FILE *stream,
static int
_otap_create_cmd_special_create(FILE *stream,
- otap_stat_t *nod)
+ tbd_stat_t *nod)
{
int err;
@@ -505,8 +505,8 @@ _otap_create_cmd_special_create(FILE *stream,
static int
_otap_create_cmd_special_delta(FILE *stream,
- otap_stat_t *a,
- otap_stat_t *b)
+ tbd_stat_t *a,
+ tbd_stat_t *b)
{
uint16_t metadata_mask = OTAP_METADATA_NONE;
@@ -534,7 +534,7 @@ _otap_create_cmd_special_delta(FILE *stream,
static int
_otap_create_dir(FILE *stream,
- otap_stat_t *d)
+ tbd_stat_t *d)
{
int err;
if(((err =_otap_create_cmd_dir_create(stream, d)) != 0) ||
@@ -543,25 +543,25 @@ _otap_create_dir(FILE *stream,
uintptr_t i;
for(i = 0; i < d->size; i++) {
- otap_stat_t* f = otap_stat_entry(d, i);
+ tbd_stat_t* f = otap_stat_entry(d, i);
if(f == NULL)
otap_error(OTAP_ERROR_UNABLE_TO_STAT_FILE);
switch(f->type) {
- case OTAP_STAT_TYPE_FILE:
+ case tbd_stat_tYPE_FILE:
err = _otap_create_cmd_file_create(stream, f);
break;
- case OTAP_STAT_TYPE_DIR:
+ case tbd_stat_tYPE_DIR:
err = _otap_create_dir(stream, f);
break;
- case OTAP_STAT_TYPE_SYMLINK:
+ case tbd_stat_tYPE_SYMLINK:
err = _otap_create_cmd_symlink_create(stream, f);
break;
- case OTAP_STAT_TYPE_BLKDEV:
- case OTAP_STAT_TYPE_CHRDEV:
- case OTAP_STAT_TYPE_FIFO:
- case OTAP_STAT_TYPE_SOCKET:
+ case tbd_stat_tYPE_BLKDEV:
+ case tbd_stat_tYPE_CHRDEV:
+ case tbd_stat_tYPE_FIFO:
+ case tbd_stat_tYPE_SOCKET:
err = _otap_create_cmd_special_create(stream, f);
break;
default:
@@ -579,8 +579,8 @@ _otap_create_dir(FILE *stream,
static int
_otap_create(FILE *stream,
- otap_stat_t *a,
- otap_stat_t *b,
+ tbd_stat_t *a,
+ tbd_stat_t *b,
bool top)
{
if((a == NULL) && (b == NULL))
@@ -595,19 +595,19 @@ _otap_create(FILE *stream,
if((a == NULL) || ((b != NULL) && (a->type != b->type))) {
switch(b->type) {
- case OTAP_STAT_TYPE_FILE:
+ case tbd_stat_tYPE_FILE:
fprintf(stderr, "file new %s\n", b->name);
return _otap_create_cmd_file_create(stream, b);
- case OTAP_STAT_TYPE_DIR:
+ case tbd_stat_tYPE_DIR:
fprintf(stderr, "dir new %s\n", b->name);
return _otap_create_dir(stream, b);
- case OTAP_STAT_TYPE_SYMLINK:
+ case tbd_stat_tYPE_SYMLINK:
fprintf(stderr, "symlink new %s\n", b->name);
return _otap_create_cmd_symlink_create(stream, b);
- case OTAP_STAT_TYPE_CHRDEV:
- case OTAP_STAT_TYPE_BLKDEV:
- case OTAP_STAT_TYPE_FIFO:
- case OTAP_STAT_TYPE_SOCKET:
+ case tbd_stat_tYPE_CHRDEV:
+ case tbd_stat_tYPE_BLKDEV:
+ case tbd_stat_tYPE_FIFO:
+ case tbd_stat_tYPE_SOCKET:
fprintf(stderr, "special new %s\n", b->name);
return _otap_create_cmd_special_create(stream, b);
default:
@@ -617,19 +617,19 @@ _otap_create(FILE *stream,
}
switch(b->type) {
- case OTAP_STAT_TYPE_FILE:
+ case tbd_stat_tYPE_FILE:
fprintf(stderr, "file delta %s\n", a->name);
return _otap_create_cmd_file_delta(stream, a, b);
- case OTAP_STAT_TYPE_SYMLINK:
+ case tbd_stat_tYPE_SYMLINK:
fprintf(stderr, "symlink delta %s\n", a->name);
return _otap_create_cmd_symlink_delta(stream, a, b);
- case OTAP_STAT_TYPE_CHRDEV:
- case OTAP_STAT_TYPE_BLKDEV:
- case OTAP_STAT_TYPE_FIFO:
- case OTAP_STAT_TYPE_SOCKET:
+ case tbd_stat_tYPE_CHRDEV:
+ case tbd_stat_tYPE_BLKDEV:
+ case tbd_stat_tYPE_FIFO:
+ case tbd_stat_tYPE_SOCKET:
fprintf(stderr, "special delta %s\n", a->name);
return _otap_create_cmd_special_delta(stream, a, b);
- case OTAP_STAT_TYPE_DIR:
+ case tbd_stat_tYPE_DIR:
if(!top) {
fprintf(stderr, "dir delta %s\n", a->name);
_otap_create_cmd_dir_delta(stream, a, b);
@@ -645,10 +645,10 @@ _otap_create(FILE *stream,
// Handle changes/additions.
uintptr_t i;
for(i = 0; i < b->size; i++) {
- otap_stat_t* _b = otap_stat_entry(b, i);
+ tbd_stat_t* _b = otap_stat_entry(b, i);
if(_b == NULL)
otap_error(OTAP_ERROR_UNABLE_TO_STAT_FILE);
- otap_stat_t* _a = otap_stat_entry_find(a, _b->name);
+ tbd_stat_t* _a = otap_stat_entry_find(a, _b->name);
err = _otap_create(stream, _a, _b, false);
otap_stat_free(_a);
otap_stat_free(_b);
@@ -658,10 +658,10 @@ _otap_create(FILE *stream,
// Handle deletions.
for(i = 0; i < a->size; i++) {
- otap_stat_t* _a = otap_stat_entry(a, i);
+ tbd_stat_t* _a = otap_stat_entry(a, i);
if(_a == NULL)
otap_error(OTAP_ERROR_UNABLE_TO_STAT_FILE);
- otap_stat_t* _b = otap_stat_entry_find(b, _a->name);
+ tbd_stat_t* _b = otap_stat_entry_find(b, _a->name);
fprintf(stderr, "file delete %s\n", _a->name);
err = (_b != NULL ? 0 : _otap_create_cmd_entity_delete(stream, _a->name));
otap_stat_free(_b);
@@ -677,8 +677,8 @@ _otap_create(FILE *stream,
int
otap_create(FILE *stream,
- otap_stat_t *a,
- otap_stat_t *b)
+ tbd_stat_t *a,
+ tbd_stat_t *b)
{
if((stream == NULL) || (a == NULL) || (b == NULL))
otap_error(OTAP_ERROR_NULL_POINTER);
diff --git a/libtbd_stat.c b/libtbd_stat.c
index dcef9fb..513c6c1 100644
--- a/libtbd_stat.c
+++ b/libtbd_stat.c
@@ -30,7 +30,7 @@
-static otap_stat_t*
+static tbd_stat_t*
__otap_stat(const char *name,
const char *path)
{
@@ -40,19 +40,19 @@ __otap_stat(const char *name,
return NULL;
size_t nlen = strlen(name);
- otap_stat_t* ret = (otap_stat_t*)malloc(sizeof(otap_stat_t) + (nlen + 1));
+ tbd_stat_t* ret = (tbd_stat_t*)malloc(sizeof(tbd_stat_t) + (nlen + 1));
if(ret == NULL)
return NULL;
ret->parent = NULL;
- ret->name = (char*)((uintptr_t)ret + sizeof(otap_stat_t));
+ ret->name = (char*)((uintptr_t)ret + sizeof(tbd_stat_t));
memcpy(ret->name, name, (nlen + 1));
if(S_ISREG(info.st_mode)) {
- ret->type = OTAP_STAT_TYPE_FILE;
+ ret->type = tbd_stat_tYPE_FILE;
ret->size = info.st_size;
} else if(S_ISDIR(info.st_mode)) {
- ret->type = OTAP_STAT_TYPE_DIR;
+ ret->type = tbd_stat_tYPE_DIR;
DIR* dp = opendir(path);
if(dp == NULL) {
@@ -71,19 +71,19 @@ __otap_stat(const char *name,
}
closedir(dp);
} else if(S_ISLNK(info.st_mode)) {
- ret->type = OTAP_STAT_TYPE_SYMLINK;
+ ret->type = tbd_stat_tYPE_SYMLINK;
ret->size = 0;
} else if(S_ISCHR(info.st_mode)) {
- ret->type = OTAP_STAT_TYPE_CHRDEV;
+ ret->type = tbd_stat_tYPE_CHRDEV;
ret->size = 0;
} else if(S_ISBLK(info.st_mode)) {
- ret->type = OTAP_STAT_TYPE_BLKDEV;
+ ret->type = tbd_stat_tYPE_BLKDEV;
ret->size = 0;
} else if(S_ISFIFO(info.st_mode)) {
- ret->type = OTAP_STAT_TYPE_FIFO;
+ ret->type = tbd_stat_tYPE_FIFO;
ret->size = 0;
} else if(S_ISSOCK(info.st_mode)) {
- ret->type = OTAP_STAT_TYPE_SOCKET;
+ ret->type = tbd_stat_tYPE_SOCKET;
ret->size = 0;
} else {
free(ret);
@@ -99,30 +99,30 @@ __otap_stat(const char *name,
return ret;
}
-otap_stat_t*
+tbd_stat_t*
otap_stat(const char* path)
{
- otap_stat_t* ret = __otap_stat(path, path);
+ tbd_stat_t* ret = __otap_stat(path, path);
return ret;
}
void
-otap_stat_free(otap_stat_t* file)
+otap_stat_free(tbd_stat_t* file)
{
free(file);
}
void
-otap_stat_print(otap_stat_t* file)
+otap_stat_print(tbd_stat_t* file)
{
(void)file;
}
-otap_stat_t*
-otap_stat_entry(otap_stat_t* file, uint32_t entry)
+tbd_stat_t*
+otap_stat_entry(tbd_stat_t* file, uint32_t entry)
{
if((file == NULL)
- || (file->type != OTAP_STAT_TYPE_DIR)
+ || (file->type != tbd_stat_tYPE_DIR)
|| (entry >= file->size))
return NULL;
@@ -152,7 +152,7 @@ otap_stat_entry(otap_stat_t* file, uint32_t entry)
if(spath == NULL)
return NULL;
- otap_stat_t* ret = __otap_stat(ds->d_name, (const char*)spath);
+ tbd_stat_t* ret = __otap_stat(ds->d_name, (const char*)spath);
free(spath);
@@ -163,11 +163,11 @@ otap_stat_entry(otap_stat_t* file, uint32_t entry)
return ret;
}
-otap_stat_t*
-otap_stat_entry_find(otap_stat_t* file, const char* name)
+tbd_stat_t*
+otap_stat_entry_find(tbd_stat_t* file, const char* name)
{
if((file == NULL)
- || (file->type != OTAP_STAT_TYPE_DIR))
+ || (file->type != tbd_stat_tYPE_DIR))
return NULL;
char *path = otap_stat_path (file);
@@ -185,7 +185,7 @@ otap_stat_entry_find(otap_stat_t* file, const char* name)
if(spath == NULL)
return NULL;
- otap_stat_t* ret = __otap_stat(ds->d_name, (const char *)spath);
+ tbd_stat_t* ret = __otap_stat(ds->d_name, (const char *)spath);
free(spath);
ret->parent = file;
@@ -198,7 +198,7 @@ otap_stat_entry_find(otap_stat_t* file, const char* name)
}
char*
-otap_stat_subpath(otap_stat_t *file,
+otap_stat_subpath(tbd_stat_t *file,
const char *entry)
{
if(file == NULL)
@@ -207,11 +207,11 @@ otap_stat_subpath(otap_stat_t *file,
size_t elen = ((entry == NULL) ? 0 : (strlen(entry) + 1));
size_t plen;
- otap_stat_t* root;
+ tbd_stat_t* root;
for(root = file, plen = 0;
root != NULL;
plen += (strlen(root->name) + 1),
- root = (otap_stat_t*)root->parent);
+ root = (tbd_stat_t*)root->parent);
plen += elen;
@@ -225,7 +225,7 @@ otap_stat_subpath(otap_stat_t *file,
memcpy(ptr, entry, elen);
}
- for(root = file; root != NULL; root = (otap_stat_t*)root->parent) {
+ for(root = file; root != NULL; root = (tbd_stat_t*)root->parent) {
size_t rlen = strlen(root->name) + 1;
ptr = (char*)((uintptr_t)ptr - rlen);
memcpy(ptr, root->name, rlen);
@@ -237,13 +237,13 @@ otap_stat_subpath(otap_stat_t *file,
}
char*
-otap_stat_path(otap_stat_t* file)
+otap_stat_path(tbd_stat_t* file)
{
return otap_stat_subpath(file, NULL);
}
int
-otap_stat_open(otap_stat_t* file, int flags)
+otap_stat_open(tbd_stat_t* file, int flags)
{
char* path = otap_stat_path(file);
if(path == NULL)
@@ -254,7 +254,7 @@ otap_stat_open(otap_stat_t* file, int flags)
}
FILE*
-otap_stat_fopen(otap_stat_t *file,
+otap_stat_fopen(tbd_stat_t *file,
const char *mode)
{
char* path = otap_stat_path(file);
diff --git a/libtbd_stat.h b/libtbd_stat.h
index d9b1749..c056f42 100644
--- a/libtbd_stat.h
+++ b/libtbd_stat.h
@@ -24,13 +24,13 @@
#include <sys/types.h>
typedef enum {
- OTAP_STAT_TYPE_FILE = 'f',
- OTAP_STAT_TYPE_DIR = 'd',
- OTAP_STAT_TYPE_SYMLINK = 'l',
- OTAP_STAT_TYPE_CHRDEV = 'c',
- OTAP_STAT_TYPE_BLKDEV = 'b',
- OTAP_STAT_TYPE_FIFO = 'p',
- OTAP_STAT_TYPE_SOCKET = 's'
+ 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 {
@@ -43,16 +43,16 @@ typedef struct {
uint32_t gid;
uint32_t mode;
uint32_t rdev;
-} otap_stat_t;
+} tbd_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);
-extern otap_stat_t* otap_stat_entry(otap_stat_t* file, uint32_t entry);
-extern otap_stat_t* otap_stat_entry_find(otap_stat_t* file, const char* name);
-extern char* otap_stat_subpath(otap_stat_t* file, const char* entry);
-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);
+extern tbd_stat_t* otap_stat(const char* path);
+extern void otap_stat_free(tbd_stat_t* file);
+extern void otap_stat_print(tbd_stat_t* file);
+extern tbd_stat_t* otap_stat_entry(tbd_stat_t* file, uint32_t entry);
+extern tbd_stat_t* otap_stat_entry_find(tbd_stat_t* file, const char* name);
+extern char* otap_stat_subpath(tbd_stat_t* file, const char* entry);
+extern char* otap_stat_path(tbd_stat_t* file);
+extern int otap_stat_open(tbd_stat_t* file, int flags);
+extern FILE* otap_stat_fopen(tbd_stat_t* file, const char* mode);
#endif /* __LIBTBD_STAT_H__ */
diff --git a/tbdiff.h b/tbdiff.h
index 4436bed..aaa39ae 100644
--- a/tbdiff.h
+++ b/tbdiff.h
@@ -82,6 +82,6 @@ typedef enum {
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);
+extern int otap_create(FILE* stream, tbd_stat_t* a, tbd_stat_t* b);
#endif /* __TBDIFF_H__ */
diff --git a/tbdiff_create.c b/tbdiff_create.c
index f33356e..8cdf734 100644
--- a/tbdiff_create.c
+++ b/tbdiff_create.c
@@ -39,7 +39,7 @@ main(int argc,
if(getcwd(cwd_buff, cwd_size) == NULL)
return EXIT_FAILURE;
- otap_stat_t* tstat[2];
+ tbd_stat_t* tstat[2];
tstat[0] = otap_stat(argv[2]);
if(tstat[0] == NULL) {