/* direct_compress for fusecompress. * Copyright (C) 2005 Anders Aagaard <aagaande@gmail.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. */#include "list.h"#include "structs.h"typedef struct { char *filename; unsigned int filename_hash; pthread_mutex_t *lock; int accesses; // Number of threads accessing this. struct compress_module *compressor; // NULL if file isn't compressed struct list_head list; // kernel linked list} database_entry_h;#define COMPRESSOR_READ filedata->database->compressor->read#define COMPRESSOR_WRITE filedata->database->compressor->write#define COMPRESSOR_OPEN filedata->database->compressor->open#define COMPRESSOR_CLOSE filedata->database->compressor->close/* TODO : */#define LOCK_DATABASE#define UNLOCK_DATABASE#define LOCK_ENTRY#define UNLOCK_ENTRY#define _CACHE_MSG(fmt,...)#define _TODO_// DEFINES THAT SHOULD BE MOVED ELSEWHERE// This is from fusecompress.c:int decompress(int fd_source, const char *source, struct compress_module *compressor);/* This should be moved to fusecompress, and fi->fh should point to this instead of a fd */typedef struct { database_entry_h *database; // link to database, can't be free'd until accesses = 0 int fd; // file descriptor void *compressor_data; // for example gzFile int offset; // offset in file (this if for compression data)} filedata_h;#define FALSE 0#define TRUE 1#define FAIL -1