Moving some files and cleaning up.
This commit is contained in:
parent
8cafb25c42
commit
073c210814
16 changed files with 62 additions and 61 deletions
23
Makefile
23
Makefile
|
|
@ -9,24 +9,23 @@
|
|||
#DB_NAME := dbname
|
||||
#DB_TBL := dbtable
|
||||
|
||||
ifdef DEBUG
|
||||
CFLAGS := -g
|
||||
DEFS := -D__DEBUG__
|
||||
endif
|
||||
|
||||
LIBS := `mysql_config --libs`
|
||||
CFLAGS := -Werror $(LIBS) $(DEFS)
|
||||
CC := gcc
|
||||
CFLAGS := -Werror `mysql_config --cflags`
|
||||
LDFLAGS := -L/usr/lib/mysql -lmysqlclient
|
||||
|
||||
ifdef DEBUG
|
||||
CFLAGS += -g -D__DEBUG__
|
||||
endif
|
||||
|
||||
SOURCES := \
|
||||
src/arch.c \
|
||||
src/arch/mysql.c \
|
||||
src/arch/mysql.c \
|
||||
src/indexer.c \
|
||||
src/common/path.c \
|
||||
src/common/rbtree.c \
|
||||
src/fs/notify_inotify.c \
|
||||
src/fs/notify_event.c \
|
||||
src/fs/tree.c
|
||||
src/notify/inotify.c \
|
||||
src/notify/event.c \
|
||||
src/notify/tree.c
|
||||
|
||||
BUILD := ./build
|
||||
|
||||
|
|
@ -37,7 +36,7 @@ ifdef DB_HOST
|
|||
else
|
||||
@echo "Tip: edit this Makefile DB_* macros to enable generation of a wrapper shellscript"
|
||||
endif
|
||||
$(CC) $(CFLAGS) $(SOURCES) -o $(BUILD)/arch
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(SOURCES) -o $(BUILD)/arch
|
||||
|
||||
wrapper :
|
||||
@echo "#!/bin/sh" > $(BUILD)/wrapper
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "arch/db.h"
|
||||
#include "fs/notify.h"
|
||||
#include "notify/notify.h"
|
||||
|
||||
/* only way to exit the application properly
|
||||
when in main loop is by signal */
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
#include "common/debug.h"
|
||||
#include "common/path.h"
|
||||
#include "arch/db.h"
|
||||
#include "fs/notify.h"
|
||||
#include "fs/tree.h"
|
||||
#include "notify/notify.h"
|
||||
#include "notify/tree.h"
|
||||
#include "indexer.h"
|
||||
|
||||
static char *stack[256];
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* fs/notify_event.c - notify event implementation
|
||||
/* notify/event.c - notify event implementation
|
||||
*
|
||||
* (C) Copyright 2010 Henrik Hautakoski <henrik@fiktivkod.org>
|
||||
* (C) Copyright 2010 Fredric Nilsson <fredric@fiktivkod.org>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "notify_event.h"
|
||||
#include "event.h"
|
||||
#include "../common/path.h"
|
||||
|
||||
#define dealloc_data(ev) \
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* fs/notify_event.h - event data structure and operation's for notify API
|
||||
/* notify/event.h - event data structure and operation's for notify API
|
||||
*
|
||||
* (C) Copyright 2010 Henrik Hautakoski <henrik@fiktivkod.org>
|
||||
* (C) Copyright 2010 Fredric Nilsson <fredric@fiktivkod.org>
|
||||
|
|
@ -9,9 +9,8 @@
|
|||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef _NOTIFY_EVENT_H
|
||||
|
||||
#define _NOTIFY_EVENT_H
|
||||
#ifndef __NOTIFY_EVENT_H
|
||||
#define __NOTIFY_EVENT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
@ -45,4 +44,4 @@ void notify_event_set_type(notify_event *event, uint8_t type);
|
|||
|
||||
const char* notify_event_typetostr(notify_event *event);
|
||||
|
||||
#endif /* _NOTIFY_EVENT_H */
|
||||
#endif /* __NOTIFY_EVENT_H */
|
||||
2
src/fs/notify_inotify.c → src/notify/inotify.c
Executable file → Normal file
2
src/fs/notify_inotify.c → src/notify/inotify.c
Executable file → Normal file
|
|
@ -1,4 +1,4 @@
|
|||
/* fs/notify_inotify.c - inotify implementation
|
||||
/* notify/inotify.c - inotify implementation
|
||||
*
|
||||
* (C) Copyright 2010 Henrik Hautakoski <henrik.hautakoski@gmail.com>
|
||||
* (C) Copyright 2010 Fredric Nilsson <fredric@unknown.org>
|
||||
10
src/fs/notify.h → src/notify/notify.h
Executable file → Normal file
10
src/fs/notify.h → src/notify/notify.h
Executable file → Normal file
|
|
@ -1,4 +1,4 @@
|
|||
/* fs/notify.h - filesystem notification API
|
||||
/* notify/notify.h - filesystem notification API
|
||||
*
|
||||
* (C) Copyright 2010 Henrik Hautakoski <henrik@fiktivkod.org>
|
||||
* (C) Copyright 2010 Fredric Nilsson <fredric@fiktivkod.org>
|
||||
|
|
@ -9,11 +9,11 @@
|
|||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef _FS_NOTIFY_H
|
||||
#define _FS_NOTIFY_H
|
||||
#ifndef __NOTIFY_NOTIFY_H
|
||||
#define __NOTIFY_NOTIFY_H
|
||||
|
||||
/* notify event def's and operations */
|
||||
#include "notify_event.h"
|
||||
#include "event.h"
|
||||
|
||||
int notify_init();
|
||||
|
||||
|
|
@ -32,4 +32,4 @@ void notify_stat();
|
|||
/* TODO: context-switch/threading should be implementation specific. */
|
||||
int notify_is_ready();
|
||||
|
||||
#endif /* _FS_NOTIFY_H */
|
||||
#endif /* __NOTIFY_NOTIFY_H */
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* src/fs/notify_queue.c
|
||||
/* notify/queue.c
|
||||
*
|
||||
* Copyright (C) 2010 Henrik Hautakoski <henrik@fiktivkod.org>
|
||||
*
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* src/fs/notify_queue.c
|
||||
/* notify/queue.h
|
||||
*
|
||||
* Copyright (C) 2010 Henrik Hautakoski <henrik@fiktivkod.org>
|
||||
*
|
||||
|
|
@ -11,8 +11,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __FS_QUEUE_H
|
||||
#define __FS_QUEUE_H
|
||||
#ifndef __NOTIFY_QUEUE_H
|
||||
#define __NOTIFY_QUEUE_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
|
@ -32,4 +32,4 @@ void queue_clear(queue_t *q);
|
|||
|
||||
void queue_destroy(queue_t *q);
|
||||
|
||||
#endif /* __FS_QUEUE_H */
|
||||
#endif /* __NOTIFY_QUEUE_H */
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* fs/tree.c - Filesystem traversal
|
||||
/* notify/tree.c - Filesystem traversal
|
||||
*
|
||||
* (C) Copyright 2010 Henrik Hautakoski <henrik@fiktivkod.org>
|
||||
*
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* fs/tree.h - Filesystem traversal
|
||||
/* notify/tree.h - Filesystem traversal
|
||||
*
|
||||
* (C) Copyright 2010 Henrik Hautakoski <henrik@fiktivkod.org>
|
||||
*
|
||||
|
|
@ -8,9 +8,8 @@
|
|||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef _FS_TREE_H
|
||||
|
||||
#define _FS_TREE_H
|
||||
#ifndef __NOTIFY_TREE_H
|
||||
#define __NOTIFY_TREE_H
|
||||
|
||||
#define MAX_DEPTH 0x20
|
||||
|
||||
|
|
@ -40,4 +39,4 @@ struct entry* tree_cpy_ent(struct entry *ent);
|
|||
|
||||
struct entry* tree_next_ent(struct tree *tree);
|
||||
|
||||
#endif /* _FS_TREE_H */
|
||||
#endif /* __NOTIFY_TREE_H */
|
||||
|
|
@ -1,21 +1,15 @@
|
|||
# Test makefile
|
||||
DEFS= -D__DEBUG__
|
||||
CC=gcc
|
||||
CFLAGS=-g
|
||||
CFLAGS=-g -D__DEBUG__
|
||||
LDFLAGS=-L/usr/lib64/mysql -lmysqlclient
|
||||
|
||||
all :
|
||||
make rbtree
|
||||
make inotify
|
||||
make mysql
|
||||
all : raw_inotify strbuf path rbtree inotify tree indexer mysql queue
|
||||
|
||||
raw_inotify :
|
||||
$(CC) -linotifytools raw_inotify.c -o raw_inotify
|
||||
$(CC) -linotifytools t_raw_inotify.c -o test_raw_inotify
|
||||
|
||||
strbuf :
|
||||
$(CC) $(CFLAGS) ../src/common/strbuf.c t_strbuf.c -o test_strbuf
|
||||
|
||||
config :
|
||||
$(CC) ../src/common/config.c t_config.c -o test_config
|
||||
|
||||
path :
|
||||
$(CC) $(DEFS) $(CFLAGS) unit.c ../src/common/path.c t_path.c -o test_path
|
||||
|
|
@ -27,20 +21,30 @@ inotify :
|
|||
$(CC) -lpthread -D INOTIFY_DEBUG -D RB_DEBUG $(CFLAGS) \
|
||||
../src/common/rbtree.c \
|
||||
../src/common/path.c \
|
||||
../src/fs/scan.c \
|
||||
../src/fs/notify_event.c \
|
||||
../src/fs/inotify.c \
|
||||
../src/notify/event.c \
|
||||
../src/notify/tree.c \
|
||||
../src/notify/inotify.c \
|
||||
t_inotify.c -o test_inotify
|
||||
|
||||
tree :
|
||||
$(CC) $(CFLAGS) $(DEFS) ../src/common/path.c ../src/fs/tree.c t_tree.c -o test_tree
|
||||
$(CC) $(CFLAGS) ../src/common/path.c ../src/notify/tree.c t_tree.c -o test_tree
|
||||
|
||||
indexer :
|
||||
$(CC) $(CFLAGS) -D__DEBUG__ ../src/common/path.c ../src/fs/tree.c ../src/indexer.c t_indexer.c -o test_indexer
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) \
|
||||
../src/common/rbtree.c \
|
||||
../src/common/path.c \
|
||||
../src/notify/tree.c \
|
||||
../src/notify/inotify.c \
|
||||
../src/notify/event.c \
|
||||
../src/arch/mysql.c \
|
||||
../src/indexer.c \
|
||||
t_indexer.c -o test_indexer
|
||||
|
||||
mysql :
|
||||
$(CC) -D DB_DEBUG $(CFLAGS) ../src/arch/mysql.c -L/usr/lib64/mysql \
|
||||
-lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto t_mysql.c -o test_mysql
|
||||
$(CC) -D DB_DEBUG $(CFLAGS) $(LDFLAGS) ../src/arch/mysql.c t_mysql.c -o test_mysql
|
||||
|
||||
queue :
|
||||
$(CC) $(CFLAGS) ../src/fs/queue.c t_queue.c -o test_queue
|
||||
$(CC) $(CFLAGS) ../src/notify/queue.c t_queue.c -o test_queue
|
||||
|
||||
clean :
|
||||
rm -f test_*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include "../src/fs/notify.h"
|
||||
#include "../src/notify/notify.h"
|
||||
|
||||
PROT_SCAN_CALLBACK(my_callback) {
|
||||
//printf("FROM THREAD -- path: %s; is_dir = %i\n", path, dir);
|
||||
|
|
@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
|
|||
"Filename: %s\n"
|
||||
"Directory: %u\n"
|
||||
"====================\n"
|
||||
, notify_event_masktostr(event), event->path, event->filename, event->dir);
|
||||
, notify_event_typetostr(event), event->path, event->filename, event->dir);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include "../src/fs/queue.h"
|
||||
#include "../src/notify/queue.h"
|
||||
|
||||
int main() {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include "../src/fs/tree.h"
|
||||
#include "../src/notify/tree.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
|
|
|
|||
Reference in a new issue