Updates for new fdb code
This commit is contained in:
parent
17ab344dee
commit
b10f7ae4c0
@ -63,12 +63,16 @@ v0.51.4 11-Apr-2004
|
||||
Reading news works, no posts yet.
|
||||
|
||||
mbsebbs:
|
||||
Added loging of virus scanner results.
|
||||
Added logging of virus scanner results.
|
||||
Patches for offline reader programs that create messages with
|
||||
wrong line terminaters (Sempoint).
|
||||
Added new experimental files database code which will only be
|
||||
used if configured with --enable-experiment.
|
||||
|
||||
mball:
|
||||
Added new experimental files database code which will only be
|
||||
used if configured with --enable-experiment.
|
||||
|
||||
mbsetup:
|
||||
Added auto setup for message area creation date. Also creates
|
||||
a faked newsgroup name in echomail areas. Both settings are
|
||||
@ -78,6 +82,8 @@ v0.51.4 11-Apr-2004
|
||||
Fixed a header include.
|
||||
Fixed an error where new created file areas were created
|
||||
without a file header.
|
||||
Added new experimental files database code which will only be
|
||||
used if configured with --enable-experiment.
|
||||
|
||||
mbtask:
|
||||
Removed debug logging for the disk thread.
|
||||
|
@ -268,16 +268,23 @@ void BotBox(FILE *fp, int doit)
|
||||
|
||||
void Masterlist()
|
||||
{
|
||||
FILE *fp, *np, *pAreas, *pFile, *pHeader;
|
||||
FILE *fp, *np, *pAreas, *pHeader;
|
||||
int AreaNr = 0, z, x = 0, New;
|
||||
unsigned long AllFiles = 0, AllKBytes = 0, NewFiles = 0, NewKBytes = 0;
|
||||
unsigned long AllAreaFiles, AllAreaBytes, popdown, down;
|
||||
unsigned long NewAreaFiles, NewAreaBytes;
|
||||
char *sAreas, *fAreas;
|
||||
char *sAreas;
|
||||
char temp[81], pop[81];
|
||||
#ifdef USE_EXPERIMENT
|
||||
struct _fdbarea *fdb_area = NULL;
|
||||
#else
|
||||
FILE *pFile;
|
||||
char *fAreas;
|
||||
|
||||
fAreas = calloc(PATH_MAX, sizeof(char));
|
||||
#endif
|
||||
|
||||
sAreas = calloc(PATH_MAX, sizeof(char));
|
||||
fAreas = calloc(PATH_MAX, sizeof(char));
|
||||
|
||||
IsDoing("Create Allfiles list");
|
||||
|
||||
@ -334,14 +341,24 @@ void Masterlist()
|
||||
if (area.Available && (area.LTSec.level <= CFG.security.level)) {
|
||||
|
||||
Nopper();
|
||||
sprintf(fAreas, "%s/fdb/file%d.data", getenv("MBSE_ROOT"), AreaNr);
|
||||
|
||||
#ifdef USE_EXPERIMENT
|
||||
if ((fdb_area = mbsedb_OpenFDB(AreaNr, 30)) == 0) {
|
||||
#else
|
||||
sprintf(fAreas, "%s/fdb/file%d.data", getenv("MBSE_ROOT"), AreaNr);
|
||||
if ((pFile = fopen (fAreas, "r")) == NULL) {
|
||||
#endif
|
||||
WriteError("$Can't open Area %d (%s)! Skipping ...", AreaNr, area.Name);
|
||||
} else {
|
||||
#ifndef USE_EXPERIMENT
|
||||
fread(&fdbhdr, sizeof(fdbhdr), 1, pFile);
|
||||
#endif
|
||||
popdown = 0;
|
||||
#ifdef USE_EXPERIMENT
|
||||
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
|
||||
#else
|
||||
while (fread(&fdb, fdbhdr.recsize, 1, pFile) == 1) {
|
||||
#endif
|
||||
if (!fdb.Deleted) {
|
||||
/*
|
||||
* The next is to reduce system load.
|
||||
@ -395,8 +412,13 @@ void Masterlist()
|
||||
BotBox(fp, TRUE);
|
||||
BotBox(np, NewAreaFiles);
|
||||
|
||||
#ifdef USE_EXPERIMENT
|
||||
fseek(fdb_area->fp, fdbhdr.hdrsize, SEEK_SET);
|
||||
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
|
||||
#else
|
||||
fseek(pFile, fdbhdr.hdrsize, SEEK_SET);
|
||||
while (fread(&fdb, fdbhdr.recsize, 1, pFile) == 1) {
|
||||
#endif
|
||||
if (!fdb.Deleted) {
|
||||
New = (((t_start - fdb.UploadDate) / 84400) <= CFG.newdays);
|
||||
sprintf(temp, "%-12s%10lu K %s [%04ld] Uploader: %s",
|
||||
@ -427,7 +449,11 @@ void Masterlist()
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef USE_EXPERIMENT
|
||||
mbsedb_CloseFDB(fdb_area);
|
||||
#else
|
||||
fclose(pFile);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} /* End of While Loop Checking for Areas Done */
|
||||
@ -474,7 +500,9 @@ void Masterlist()
|
||||
Syslog('+', "Allfiles: %ld, %ld MBytes", AllFiles, AllKBytes / 1024);
|
||||
Syslog('+', "Newfiles: %ld, %ld MBytes", NewFiles, NewKBytes / 1024);
|
||||
free(sAreas);
|
||||
#ifndef USE_EXPERIMENT
|
||||
free(fAreas);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,7 +81,7 @@ m_protocol.o: ../config.h ../lib/mbselib.h ../paths.h screen.h mutil.h ledit.h s
|
||||
m_ticarea.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h grlist.h m_global.h m_node.h m_fgroup.h m_farea.h m_archive.h m_ticarea.h
|
||||
mbsetup.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h screen.h mutil.h ledit.h m_global.h m_bbs.h m_farea.h m_fgroup.h m_mail.h m_mgroup.h m_hatch.h m_tic.h m_ticarea.h m_magic.h m_fido.h m_lang.h m_archive.h m_virus.h m_tty.h m_limits.h m_users.h m_node.h m_fdb.h m_new.h m_ol.h m_bbslist.h m_protocol.h m_ff.h m_modem.h m_marea.h m_ngroup.h m_service.h m_domain.h m_task.h m_route.h
|
||||
ledit.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/msg.h screen.h mutil.h ledit.h
|
||||
m_farea.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h m_global.h m_fgroup.h m_archive.h m_farea.h m_fgroup.h m_ngroup.h
|
||||
m_farea.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h screen.h mutil.h ledit.h m_global.h m_fgroup.h m_archive.h m_farea.h m_fgroup.h m_ngroup.h
|
||||
m_fido.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_global.h m_fido.h
|
||||
m_limits.o: ../config.h ../lib/mbselib.h ../lib/users.h screen.h mutil.h ledit.h stlist.h m_global.h m_limits.h
|
||||
m_menu.o: ../config.h ../lib/mbselib.h mutil.h screen.h ledit.h m_lang.h m_global.h m_menu.h
|
||||
@ -90,7 +90,7 @@ m_service.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_gl
|
||||
m_tty.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_modem.h m_global.h m_tty.h
|
||||
mutil.o: ../config.h ../lib/mbselib.h ../lib/diesel.h screen.h ledit.h mutil.h
|
||||
m_archive.o: ../config.h ../lib/mbselib.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_archive.h
|
||||
m_fdb.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h m_global.h m_farea.h m_fdb.h
|
||||
m_fdb.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h screen.h mutil.h ledit.h m_global.h m_farea.h m_fdb.h
|
||||
m_global.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_fgroup.h m_mgroup.h m_limits.h m_global.h
|
||||
m_magic.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_ticarea.h m_global.h m_magic.h
|
||||
m_mgroup.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_global.h m_node.h m_marea.h m_mgroup.h
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
#include "../config.h"
|
||||
#include "../lib/mbselib.h"
|
||||
#include "../lib/users.h"
|
||||
#include "../lib/mbsedb.h"
|
||||
#include "screen.h"
|
||||
#include "mutil.h"
|
||||
#include "ledit.h"
|
||||
@ -244,7 +246,7 @@ void FileScreen(void)
|
||||
*/
|
||||
int EditFileRec(int Area)
|
||||
{
|
||||
FILE *fil, *fp;
|
||||
FILE *fil;
|
||||
char mfile[PATH_MAX], *temp, tpath[65], frpath[81], topath[81];
|
||||
long offset;
|
||||
unsigned long crc, crc1;
|
||||
@ -252,6 +254,11 @@ int EditFileRec(int Area)
|
||||
DIR *dp;
|
||||
struct dirent *de;
|
||||
struct stat stb;
|
||||
#ifdef USE_EXPERIMENT
|
||||
struct _fdbarea *fdb_area = NULL;
|
||||
#else
|
||||
FILE *fp;
|
||||
#endif
|
||||
|
||||
clr_index();
|
||||
working(1, 0, 0);
|
||||
@ -370,6 +377,17 @@ int EditFileRec(int Area)
|
||||
/*
|
||||
* Attempt to disable this area, but check first.
|
||||
*/
|
||||
#ifdef USE_EXPERIMENT
|
||||
if ((fdb_area = mbsedb_OpenFDB(Area, 30))) {
|
||||
fseek(fdb_area->fp, 0, SEEK_END);
|
||||
files = ((ftell(fdb_area->fp) - fdbhdr.hdrsize) / fdbhdr.recsize);
|
||||
if (files) {
|
||||
errmsg("There are stil %d files in this area", files);
|
||||
Available = TRUE;
|
||||
}
|
||||
mbsedb_CloseFDB(fdb_area);
|
||||
}
|
||||
#else
|
||||
if ((fp = fopen(temp, "r"))) {
|
||||
if (fread(&fdbhdr, sizeof(fdbhdr), 1, fp) == 1) {
|
||||
fseek(fp, 0, SEEK_END);
|
||||
@ -381,6 +399,7 @@ int EditFileRec(int Area)
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
#endif
|
||||
if (!Available) {
|
||||
if (yes_no((char *)"Are you sure you want to delete this area") == 0)
|
||||
Available = TRUE;
|
||||
@ -416,6 +435,10 @@ int EditFileRec(int Area)
|
||||
}
|
||||
if (!area.Available && Available) {
|
||||
area.Available = TRUE;
|
||||
#ifdef USE_EXPERIMENT
|
||||
if ((fdb_area = mbsedb_OpenFDB(Area, 30)))
|
||||
mbsedb_CloseFDB(fdb_area);
|
||||
#else
|
||||
if ((fp = fopen(temp, "a+")) == NULL) {
|
||||
WriteError("$Can't create file database %s", temp);
|
||||
} else {
|
||||
@ -425,6 +448,7 @@ int EditFileRec(int Area)
|
||||
fclose(fp);
|
||||
}
|
||||
chmod(temp, 0660);
|
||||
#endif
|
||||
}
|
||||
free(temp);
|
||||
break;
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
#include "../config.h"
|
||||
#include "../lib/mbselib.h"
|
||||
#include "../lib/users.h"
|
||||
#include "../lib/mbsedb.h"
|
||||
#include "screen.h"
|
||||
#include "mutil.h"
|
||||
#include "ledit.h"
|
||||
@ -357,6 +359,9 @@ void InitFDB(void)
|
||||
struct dirent *de;
|
||||
struct OldFILERecord old;
|
||||
struct stat sb;
|
||||
#ifdef USE_EXPERIMENT
|
||||
struct _fdbarea *fdb_area = NULL;
|
||||
#endif
|
||||
|
||||
records = CountFilearea();
|
||||
if (records <= 0)
|
||||
@ -448,7 +453,17 @@ void InitFDB(void)
|
||||
fclose(fp1);
|
||||
sprintf(temp, "%s/fdb/fdb%ld.data", getenv("MBSE_ROOT"), Area);
|
||||
unlink(temp);
|
||||
}
|
||||
} // Old area type upgrade.
|
||||
|
||||
/*
|
||||
* Current area, check
|
||||
*/
|
||||
#ifdef USE_EXPERIMENT
|
||||
if ((fdb_area = mbsedb_OpenFDB(Area, 30)) == NULL)
|
||||
WriteError("InitFDB(): database area %ld might be corrupt", Area);
|
||||
else
|
||||
mbsedb_CloseFDB(fdb_area);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
fclose(fil);
|
||||
|
Reference in New Issue
Block a user