From: Kern Sibbald Date: Sun, 19 May 2002 07:38:06 +0000 (+0000) Subject: First cut AutoPrune X-Git-Tag: Release-1.20~7 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b5752d5d38754259dc2bb30e1461ae0431c2333d;p=bacula%2Fbacula First cut AutoPrune git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@25 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/Makefile.in b/bacula/Makefile.in index 723f1e48ee..d6495b358e 100755 --- a/bacula/Makefile.in +++ b/bacula/Makefile.in @@ -1,5 +1,5 @@ # -# $Id$ +# Version $Id$ # @MCOMMON@ diff --git a/bacula/src/Makefile.in b/bacula/src/Makefile.in index ee55b709d4..cc8f974fa3 100644 --- a/bacula/src/Makefile.in +++ b/bacula/src/Makefile.in @@ -1,5 +1,5 @@ # -# $Id$ +# Version $Id$ # @MCOMMON@ diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index 9051c75425..d7393b19a4 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -1,23 +1,27 @@ /* * General header file configurations that apply to * all daemons. System dependent stuff goes here. + * + * Version $Id$ */ /* - Copyright (C) 2000, 2001 Kern Sibbald and John Walker + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + modify it under the terms of the GNU 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 General Public License for more details. + 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., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. - 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ diff --git a/bacula/src/bacula.h b/bacula/src/bacula.h index fa0ea3fa73..5a2ae3d89e 100644 --- a/bacula/src/bacula.h +++ b/bacula/src/bacula.h @@ -1,25 +1,26 @@ /* * bacula.h -- main header file to include in all Bacula source * + * Version $Id$ */ /* - - Copyright (C) 2000, 2001 Kern Sibbald and John Walker + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + modify it under the terms of the GNU 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 General Public License for more details. + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + 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., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ diff --git a/bacula/src/bc_types.h b/bacula/src/bc_types.h index 640463f4f3..56922205fb 100644 --- a/bacula/src/bc_types.h +++ b/bacula/src/bc_types.h @@ -12,24 +12,26 @@ Also, we define types such as file address lengths. + Version $Id$ + */ /* - - Copyright (C) 2000, 2001 Kern Sibbald and John Walker + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + modify it under the terms of the GNU 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 General Public License for more details. + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + 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., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ diff --git a/bacula/src/cats/bdb.c b/bacula/src/cats/bdb.c index 95ebf715fe..063f59fa71 100644 --- a/bacula/src/cats/bdb.c +++ b/bacula/src/cats/bdb.c @@ -7,8 +7,12 @@ * system. * * Kern Sibbald, January MMI + * + * Version $Id$ + * */ + /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/cats/bdb_create.c b/bacula/src/cats/bdb_create.c index b415463048..8d6ecccb82 100644 --- a/bacula/src/cats/bdb_create.c +++ b/bacula/src/cats/bdb_create.c @@ -9,6 +9,8 @@ * system. * * Kern Sibbald, January MMI + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/bdb_delete.c b/bacula/src/cats/bdb_delete.c index 3537ef34b1..5ccbd071c3 100644 --- a/bacula/src/cats/bdb_delete.c +++ b/bacula/src/cats/bdb_delete.c @@ -9,6 +9,8 @@ * system. * * Kern Sibbald, January MMI + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/bdb_find.c b/bacula/src/cats/bdb_find.c index 71363d33bd..9e99479b16 100644 --- a/bacula/src/cats/bdb_find.c +++ b/bacula/src/cats/bdb_find.c @@ -13,6 +13,8 @@ * system. * * Kern Sibbald, January MMI + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/bdb_get.c b/bacula/src/cats/bdb_get.c index c94c3e73e9..c33f6acf78 100644 --- a/bacula/src/cats/bdb_get.c +++ b/bacula/src/cats/bdb_get.c @@ -12,6 +12,8 @@ * system. * * Kern Sibbald, January MMI + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/bdb_list.c b/bacula/src/cats/bdb_list.c index 36d22e73b9..48af9c26d2 100644 --- a/bacula/src/cats/bdb_list.c +++ b/bacula/src/cats/bdb_list.c @@ -9,6 +9,8 @@ * system. * * Kern Sibbald, January MMI + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/bdb_update.c b/bacula/src/cats/bdb_update.c index d75187dcda..00bed656bf 100755 --- a/bacula/src/cats/bdb_update.c +++ b/bacula/src/cats/bdb_update.c @@ -10,7 +10,8 @@ * * Kern Sibbald, January MMI * - * $Id: + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 4570d4b27a..b01d416d46 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -1,6 +1,8 @@ /* * SQL header file * + * by Kern E. Sibbald + * * Anyone who accesses the database will need to include * this file. * @@ -8,6 +10,8 @@ * the external world, and definitions destined only * for the external world. This is control with * the define __SQL_C, which is defined only in sql.c + * + * Version $Id$ */ /* @@ -50,57 +54,57 @@ struct sqlite { char dummy; }; -#define IS_NUM(x) ((x) == 1) -#define IS_NOT_NULL(x) ((x) == 1) +#define IS_NUM(x) ((x) == 1) +#define IS_NOT_NULL(x) ((x) == 1) typedef struct s_sql_field { - char *name; /* name of column */ - uint32_t length; /* length */ - uint32_t max_length; /* max length */ - uint32_t type; /* type */ - uint32_t flags; /* flags */ + char *name; /* name of column */ + uint32_t length; /* length */ + uint32_t max_length; /* max length */ + uint32_t type; /* type */ + uint32_t flags; /* flags */ } SQL_FIELD; /* * This is the "real" definition that should only be * used inside sql.c and associated database interface * subroutines. - * S Q L I T E + * S Q L I T E */ typedef struct s_db { - BQUEUE bq; /* queue control */ + BQUEUE bq; /* queue control */ pthread_mutex_t mutex; struct sqlite *db; char **result; - int nrow; /* nrow returned from sqlite */ - int ncolumn; /* ncolum returned from sqlite */ - int num_rows; /* used by code */ - int row; /* seek row */ - int have_insert_id; /* do not have insert id */ - int fields_defined; /* set when fields defined */ - int field; /* seek field */ - SQL_FIELD **fields; /* defined fields */ + int nrow; /* nrow returned from sqlite */ + int ncolumn; /* ncolum returned from sqlite */ + int num_rows; /* used by code */ + int row; /* seek row */ + int have_insert_id; /* do not have insert id */ + int fields_defined; /* set when fields defined */ + int field; /* seek field */ + SQL_FIELD **fields; /* defined fields */ int ref_count; char *db_name; char *db_user; char *db_password; int connected; - char *sqlite_errmsg; /* error message returned by sqlite */ - char *errmsg; /* nicely edited error message */ - char *cmd; /* SQL command string */ + char *sqlite_errmsg; /* error message returned by sqlite */ + char *errmsg; /* nicely edited error message */ + char *cmd; /* SQL command string */ } B_DB; /* * "Generic" names for easier conversion * - * S Q L I T E + * S Q L I T E */ #define sql_store_result(x) x->result #define sql_free_result(x) my_sqlite_free_table(x) #define sql_fetch_row(x) my_sqlite_fetch_row(x) #define sql_query(x, y) my_sqlite_query(x, y) -#define sql_close(x) sqlite_close(x->db) +#define sql_close(x) sqlite_close(x->db) #define sql_strerror(x) x->sqlite_errmsg?x->sqlite_errmsg:"unknown" #define sql_num_rows(x) x->nrow #define sql_data_seek(x, i) x->row = i @@ -109,7 +113,7 @@ typedef struct s_db { #define sql_field_seek(x, y) my_sqlite_field_seek(x, y) #define sql_fetch_field(x) my_sqlite_fetch_field(x) #define sql_num_fields(x) (unsigned)((x)->ncolumn) -#define SQL_ROW char** +#define SQL_ROW char** @@ -131,10 +135,10 @@ extern void my_sqlite_free_table(B_DB *mdb); * used inside sql.c and associated database interface * subroutines. * - * M Y S Q L + * M Y S Q L */ typedef struct s_db { - BQUEUE bq; /* queue control */ + BQUEUE bq; /* queue control */ pthread_mutex_t mutex; MYSQL mysql; MYSQL *db; @@ -144,10 +148,10 @@ typedef struct s_db { char *db_name; char *db_user; char *db_password; - int have_insert_id; /* do have insert_id() */ + int have_insert_id; /* do have insert_id() */ int connected; - char *errmsg; /* nicely edited error message */ - char *cmd; /* SQL command string */ + char *errmsg; /* nicely edited error message */ + char *cmd; /* SQL command string */ } B_DB; @@ -156,7 +160,7 @@ typedef struct s_db { #define sql_free_result(x) mysql_free_result(x->result) #define sql_fetch_row(x) mysql_fetch_row(x->result) #define sql_query(x, y) mysql_query(x->db, y) -#define sql_close(x) mysql_close(x->db) +#define sql_close(x) mysql_close(x->db) #define sql_strerror(x) mysql_error(x->db) #define sql_num_rows(x) mysql_num_rows(x->result) #define sql_data_seek(x, i) mysql_data_seek(x->result, i) @@ -165,8 +169,8 @@ typedef struct s_db { #define sql_field_seek(x, y) mysql_field_seek(x->result, y) #define sql_fetch_field(x) mysql_fetch_field(x->result) #define sql_num_fields(x) mysql_num_fields(x->result) -#define SQL_ROW MYSQL_ROW -#define SQL_FIELD MYSQL_FIELD +#define SQL_ROW MYSQL_ROW +#define SQL_FIELD MYSQL_FIELD #else /* USE BACULA DB routines */ @@ -175,17 +179,17 @@ typedef struct s_db { /* Change this each time there is some incompatible * file format change!!!! */ -#define BDB_VERSION 8 /* file version number */ +#define BDB_VERSION 8 /* file version number */ struct s_control { - int bdb_version; /* Version number */ - uint32_t JobId; /* next Job Id */ - uint32_t PoolId; /* next Pool Id */ - uint32_t MediaId; /* next Media Id */ - uint32_t JobMediaId; /* next JobMedia Id */ - uint32_t ClientId; /* next Client Id */ - uint32_t FileSetId; /* nest FileSet Id */ - time_t time; /* time file written */ + int bdb_version; /* Version number */ + uint32_t JobId; /* next Job Id */ + uint32_t PoolId; /* next Pool Id */ + uint32_t MediaId; /* next Media Id */ + uint32_t JobMediaId; /* next JobMedia Id */ + uint32_t ClientId; /* next Client Id */ + uint32_t FileSetId; /* nest FileSet Id */ + time_t time; /* time file written */ }; @@ -193,20 +197,20 @@ struct s_control { * Bacula internal DB */ typedef struct s_db { - BQUEUE bq; /* queue control */ - pthread_mutex_t mutex; /* single thread lock */ - int ref_count; /* number of times opened */ - struct s_control control; /* control file structure */ - int cfd; /* control file device */ - FILE *jobfd; /* Jobs records file descriptor */ - FILE *poolfd; /* Pool records fd */ - FILE *mediafd; /* Media records fd */ - FILE *jobmediafd; /* JobMedia records fd */ - FILE *clientfd; /* Client records fd */ - FILE *filesetfd; /* FileSet records fd */ - char *db_name; /* name of database */ - char *errmsg; /* nicely edited error message */ - char *cmd; /* Command string */ + BQUEUE bq; /* queue control */ + pthread_mutex_t mutex; /* single thread lock */ + int ref_count; /* number of times opened */ + struct s_control control; /* control file structure */ + int cfd; /* control file device */ + FILE *jobfd; /* Jobs records file descriptor */ + FILE *poolfd; /* Pool records fd */ + FILE *mediafd; /* Media records fd */ + FILE *jobmediafd; /* JobMedia records fd */ + FILE *clientfd; /* Client records fd */ + FILE *filesetfd; /* FileSet records fd */ + char *db_name; /* name of database */ + char *errmsg; /* nicely edited error message */ + char *cmd; /* Command string */ } B_DB; #endif /* HAVE_MYSQL */ @@ -219,19 +223,19 @@ typedef struct s_db { #define DELETE_DB(db, cmd) DeleteDB(__FILE__, __LINE__, db, cmd) -#else /* not __SQL_C */ +#else /* not __SQL_C */ /* This is a "dummy" definition for use outside of sql.c */ -typedef struct s_db { - int dummy; /* for SunOS compiler */ +typedef struct s_db { + int dummy; /* for SunOS compiler */ } B_DB; #endif /* __SQL_C */ /* ***FIXME*** FileId_t should be uint64_t */ typedef uint32_t FileId_t; -typedef uint32_t DBId_t; /* general DB id type */ +typedef uint32_t DBId_t; /* general DB id type */ typedef uint32_t JobId_t; @@ -243,18 +247,18 @@ typedef uint32_t JobId_t; /* Job record */ typedef struct { JobId_t JobId; - char Job[MAX_NAME_LENGTH]; /* Job unique name */ - char Name[MAX_NAME_LENGTH]; /* Job base name */ - int Type; /* actually char(1) */ - int Level; /* actually char(1) */ - int JobStatus; /* actually char(1) */ - uint32_t ClientId; /* Id of client */ - uint32_t PoolId; /* Id of pool */ - uint32_t FileSetId; /* Id of FileSet */ - time_t SchedTime; /* Time job scheduled */ - time_t StartTime; /* Job start time */ - time_t EndTime; /* Job termination time */ - btime_t JobTDate; /* Backup time/date in seconds */ + char Job[MAX_NAME_LENGTH]; /* Job unique name */ + char Name[MAX_NAME_LENGTH]; /* Job base name */ + int Type; /* actually char(1) */ + int Level; /* actually char(1) */ + int JobStatus; /* actually char(1) */ + uint32_t ClientId; /* Id of client */ + uint32_t PoolId; /* Id of pool */ + uint32_t FileSetId; /* Id of FileSet */ + time_t SchedTime; /* Time job scheduled */ + time_t StartTime; /* Job start time */ + time_t EndTime; /* Job termination time */ + btime_t JobTDate; /* Backup time/date in seconds */ uint32_t VolSessionId; uint32_t VolSessionTime; uint32_t JobFiles; @@ -265,8 +269,8 @@ typedef struct { /* Note, FirstIndex, LastIndex, Start/End File and Block * are only used in the JobMedia record. */ - uint32_t FirstIndex; /* First index this Volume */ - uint32_t LastIndex; /* Last index this Volume */ + uint32_t FirstIndex; /* First index this Volume */ + uint32_t LastIndex; /* Last index this Volume */ uint32_t StartFile; uint32_t EndFile; uint32_t StartBlock; @@ -284,15 +288,15 @@ typedef struct { */ /* JobMedia record */ typedef struct { - uint32_t JobMediaId; /* record id */ - JobId_t JobId; /* JobId */ - uint32_t MediaId; /* MediaId */ - uint32_t FirstIndex; /* First index this Volume */ - uint32_t LastIndex; /* Last index this Volume */ - uint32_t StartFile; /* File for start of data */ - uint32_t EndFile; /* End file on Volume */ - uint32_t StartBlock; /* start block on tape */ - uint32_t EndBlock; /* last block */ + uint32_t JobMediaId; /* record id */ + JobId_t JobId; /* JobId */ + uint32_t MediaId; /* MediaId */ + uint32_t FirstIndex; /* First index this Volume */ + uint32_t LastIndex; /* Last index this Volume */ + uint32_t StartFile; /* File for start of data */ + uint32_t EndFile; /* End file on Volume */ + uint32_t StartBlock; /* start block on tape */ + uint32_t EndBlock; /* last block */ } JOBMEDIA_DBR; @@ -301,9 +305,9 @@ typedef struct { * records (e.g. pathname, filename, fileattributes). */ typedef struct { - char *fname; /* full path & filename */ - char *link; /* link if any */ - char *attr; /* attributes statp */ + char *fname; /* full path & filename */ + char *link; /* link if any */ + char *attr; /* attributes statp */ uint32_t FileIndex; uint32_t Stream; JobId_t JobId; @@ -329,16 +333,16 @@ typedef struct { /* Pool record -- same format as database */ typedef struct { uint32_t PoolId; - char Name[MAX_NAME_LENGTH]; /* Pool name */ - uint32_t NumVols; /* total number of volumes */ - uint32_t MaxVols; /* max allowed volumes */ - int UseOnce; /* set to use once only */ - int UseCatalog; /* set to use catalog */ - int AcceptAnyVolume; /* set to accept any volume sequence */ - int AutoPrune; /* set to prune automatically */ - int Recycle; /* default Vol recycle flag */ - btime_t VolRetention; /* retention period in seconds */ - char PoolType[MAX_NAME_LENGTH]; + char Name[MAX_NAME_LENGTH]; /* Pool name */ + uint32_t NumVols; /* total number of volumes */ + uint32_t MaxVols; /* max allowed volumes */ + int UseOnce; /* set to use once only */ + int UseCatalog; /* set to use catalog */ + int AcceptAnyVolume; /* set to accept any volume sequence */ + int AutoPrune; /* set to prune automatically */ + int Recycle; /* default Vol recycle flag */ + btime_t VolRetention; /* retention period in seconds */ + char PoolType[MAX_NAME_LENGTH]; char LabelFormat[MAX_NAME_LENGTH]; /* Extra stuff not in DB */ faddr_t rec_addr; @@ -346,45 +350,45 @@ typedef struct { /* Media record -- same as the database */ typedef struct { - uint32_t MediaId; /* Unique volume id */ + uint32_t MediaId; /* Unique volume id */ char VolumeName[MAX_NAME_LENGTH]; /* Volume name */ char MediaType[MAX_NAME_LENGTH]; /* Media type */ - uint32_t PoolId; /* Pool id */ - time_t FirstWritten; /* Time Volume first written */ - time_t LastWritten; /* Time Volume last written */ - time_t LabelDate; /* Date/Time Volume labelled */ - uint32_t VolJobs; /* number of jobs on this medium */ - uint32_t VolFiles; /* Number of files */ - uint32_t VolBlocks; /* Number of blocks */ - uint32_t VolMounts; /* Number of times mounted */ - uint32_t VolErrors; /* Number of read/write errors */ - uint32_t VolWrites; /* Number of writes */ - uint32_t VolReads; /* Number of reads */ - uint64_t VolBytes; /* Number of bytes written */ - uint64_t VolMaxBytes; /* max bytes to write */ - uint64_t VolCapacityBytes; /* capacity estimate */ - btime_t VolRetention; /* Volume retention in seconds */ - int Recycle; /* recycle yes/no */ - char VolStatus[20]; /* Volume status */ + uint32_t PoolId; /* Pool id */ + time_t FirstWritten; /* Time Volume first written */ + time_t LastWritten; /* Time Volume last written */ + time_t LabelDate; /* Date/Time Volume labelled */ + uint32_t VolJobs; /* number of jobs on this medium */ + uint32_t VolFiles; /* Number of files */ + uint32_t VolBlocks; /* Number of blocks */ + uint32_t VolMounts; /* Number of times mounted */ + uint32_t VolErrors; /* Number of read/write errors */ + uint32_t VolWrites; /* Number of writes */ + uint32_t VolReads; /* Number of reads */ + uint64_t VolBytes; /* Number of bytes written */ + uint64_t VolMaxBytes; /* max bytes to write */ + uint64_t VolCapacityBytes; /* capacity estimate */ + btime_t VolRetention; /* Volume retention in seconds */ + int Recycle; /* recycle yes/no */ + char VolStatus[20]; /* Volume status */ /* Extra stuff not in DB */ - faddr_t rec_addr; /* found record address */ + faddr_t rec_addr; /* found record address */ } MEDIA_DBR; /* Client record -- same as the database */ typedef struct { - uint32_t ClientId; /* Unique Client id */ + uint32_t ClientId; /* Unique Client id */ int AutoPrune; btime_t FileRetention; btime_t JobRetention; - char Name[MAX_NAME_LENGTH]; /* Client name */ - char Uname[256]; /* Uname for client */ + char Name[MAX_NAME_LENGTH]; /* Client name */ + char Uname[256]; /* Uname for client */ } CLIENT_DBR; /* FileSet record -- same as the database */ typedef struct { - uint32_t FileSetId; /* Unique FileSet id */ + uint32_t FileSetId; /* Unique FileSet id */ char FileSet[MAX_NAME_LENGTH]; /* FileSet name */ - char MD5[50]; /* MD5 signature of include/exclude */ + char MD5[50]; /* MD5 signature of include/exclude */ } FILESET_DBR; diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index e251ae94b6..6389782770 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -4,6 +4,8 @@ * other files are generic. * * Kern Sibbald, March 2000 + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/protos.h b/bacula/src/cats/protos.h index 68b931fe35..0c3a95f638 100644 --- a/bacula/src/cats/protos.h +++ b/bacula/src/cats/protos.h @@ -1,3 +1,7 @@ +/* + * + * Version $Id$ + */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -82,7 +86,7 @@ int db_update_job_start_record(B_DB *db, JOB_DBR *jr); int db_update_job_end_record(B_DB *db, JOB_DBR *jr); int db_update_pool_record(B_DB *db, POOL_DBR *pr); int db_update_media_record(B_DB *db, MEDIA_DBR *mr); -int db_add_MD5_to_file_record(B_DB *mdb, FileId_t FileId, char *MD5); +int db_add_MD5_to_file_record(B_DB *mdb, FileId_t FileId, char *MD5); int db_mark_file_record(B_DB *mdb, FileId_t FileId, int JobId); #endif /* __SQL_PROTOS_H */ diff --git a/bacula/src/cats/sql.c b/bacula/src/cats/sql.c index 647d4115c5..6924de8df9 100644 --- a/bacula/src/cats/sql.c +++ b/bacula/src/cats/sql.c @@ -5,6 +5,8 @@ * (with a little more work) * * Kern Sibbald, March 2000 + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index 479f97fea0..7f10ba49cb 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -2,6 +2,8 @@ * Bacula Catalog Database Create record interface routines * * Kern Sibbald, March 2000 + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/sql_delete.c b/bacula/src/cats/sql_delete.c index a022f84901..aaa0776e33 100644 --- a/bacula/src/cats/sql_delete.c +++ b/bacula/src/cats/sql_delete.c @@ -2,6 +2,8 @@ * Bacula Catalog Database Delete record interface routines * * Kern Sibbald, December 2000 + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/sql_find.c b/bacula/src/cats/sql_find.c index d49efab49a..ef3d89f2b8 100644 --- a/bacula/src/cats/sql_find.c +++ b/bacula/src/cats/sql_find.c @@ -6,6 +6,8 @@ * request are in get.c * * Kern Sibbald, December 2000 + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 5c154917f8..0de036b7c3 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -5,6 +5,8 @@ * should be in find.c * * Kern Sibbald, March 2000 + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/sql_list.c b/bacula/src/cats/sql_list.c index 2fdef3f191..c2197b69bf 100644 --- a/bacula/src/cats/sql_list.c +++ b/bacula/src/cats/sql_list.c @@ -2,6 +2,8 @@ * Bacula Catalog Database List records interface routines * * Kern Sibbald, March 2000 + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index af77ff3408..d84eeab77c 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -2,6 +2,8 @@ * Bacula Catalog Database Update record interface routines * * Kern Sibbald, March 2000 + * + * Version $Id$ */ /* diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index bbe0d09f10..e687da4b78 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -2,6 +2,8 @@ * Bacula Catalog Database routines specific to SQLite * * Kern Sibbald, January 2002 + * + * Version $Id$ */ /* diff --git a/bacula/src/console/Makefile.in b/bacula/src/console/Makefile.in index 2cafd53e6a..5f0f1438bc 100644 --- a/bacula/src/console/Makefile.in +++ b/bacula/src/console/Makefile.in @@ -1,3 +1,6 @@ +# +# Version $Id$ +# @MCOMMON@ srcdir = . diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index bbe0e3fd8c..f20c683fc9 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -3,6 +3,8 @@ * Bacula Console interface to the Director * * Kern Sibbald, September MM + * + * Version $Id$ */ /* diff --git a/bacula/src/console/console_conf.h b/bacula/src/console/console_conf.h index 89b345b806..b12153138c 100644 --- a/bacula/src/console/console_conf.h +++ b/bacula/src/console/console_conf.h @@ -2,44 +2,46 @@ * Bacula User Agent specific configuration and defines * * Kern Sibbald, Sep MM + * + * Version $Id$ */ /* * Resource codes -- they must be sequential for indexing */ -#define R_FIRST 1001 +#define R_FIRST 1001 -#define R_CONSOLE 1001 -#define R_DIRECTOR 1002 +#define R_CONSOLE 1001 +#define R_DIRECTOR 1002 -#define R_LAST R_DIRECTOR +#define R_LAST R_DIRECTOR /* * Some resource attributes */ -#define R_NAME 1020 -#define R_ADDRESS 1021 -#define R_PASSWORD 1022 -#define R_TYPE 1023 -#define R_BACKUP 1024 +#define R_NAME 1020 +#define R_ADDRESS 1021 +#define R_PASSWORD 1022 +#define R_TYPE 1023 +#define R_BACKUP 1024 /* Definition of the contents of each Resource */ /* Console "globals" */ struct s_res_cons { - RES hdr; - char *rc_file; /* startup file */ - char *hist_file; /* command history file */ + RES hdr; + char *rc_file; /* startup file */ + char *hist_file; /* command history file */ }; typedef struct s_res_cons CONSRES; /* Director */ struct s_res_dir { - RES hdr; - int DIRport; /* UA server port */ - char *address; /* UA server address */ - char *password; /* UA server password */ + RES hdr; + int DIRport; /* UA server port */ + char *address; /* UA server address */ + char *password; /* UA server password */ }; typedef struct s_res_dir DIRRES; @@ -48,8 +50,8 @@ typedef struct s_res_dir DIRRES; * resource structure definitions. */ union u_res { - struct s_res_dir res_dir; - struct s_res_cons res_cons; + struct s_res_dir res_dir; + struct s_res_cons res_cons; RES hdr; }; diff --git a/bacula/src/dird/Makefile.in b/bacula/src/dird/Makefile.in index a7aeaf24b3..fd0c0d1c04 100644 --- a/bacula/src/dird/Makefile.in +++ b/bacula/src/dird/Makefile.in @@ -1,5 +1,7 @@ # # Bacula Director Makefile +# +# Version $Id$ # @MCOMMON@ @@ -20,7 +22,8 @@ first_rule: all dummy: # -SVRSRCS = dird.c authenticate.c backup.c \ +SVRSRCS = dird.c authenticate.c autoprune.c \ + backup.c \ catreq.c dird_conf.c \ fd_cmds.c getmsg.c job.c \ mountreq.c msgchan.c newvol.c \ @@ -32,7 +35,8 @@ SVRSRCS = dird.c authenticate.c backup.c \ ua_purge.c ua_run.c \ ua_select.c ua_server.c \ ua_status.c verify.c -SVROBJS = dird.o authenticate.o backup.o \ +SVROBJS = dird.o authenticate.o autoprune.o \ + backup.o \ catreq.o dird_conf.o \ fd_cmds.o getmsg.o job.o \ mountreq.o msgchan.o newvol.o \ diff --git a/bacula/src/dird/authenticate.c b/bacula/src/dird/authenticate.c index f6ffa208f5..16c3da759a 100644 --- a/bacula/src/dird/authenticate.c +++ b/bacula/src/dird/authenticate.c @@ -7,7 +7,7 @@ * * This routine runs as a thread and must be thread reentrant. * - * Basic tasks done here: + * Version $Id$ * */ /* diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 631a971c5d..386f826698 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -14,6 +14,7 @@ * to do the backup. * When the File daemon finishes the job, update the DB. * + * Version $Id$ */ /* @@ -397,7 +398,7 @@ Volume names(s): %s\n\ Volume Session Id: %d\n\ Volume Session Time: %d\n\ Volume Bytes: %s\n\ -Termination: %s\n"), +Termination: %s\n\n"), edt, jcr->jr.JobId, jcr->jr.Job, diff --git a/bacula/src/dird/catreq.c b/bacula/src/dird/catreq.c index d13d23c446..de26079d7f 100644 --- a/bacula/src/dird/catreq.c +++ b/bacula/src/dird/catreq.c @@ -10,6 +10,7 @@ * Basic tasks done here: * Handle Catalog services. * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c index cc93770be0..e96b49a923 100644 --- a/bacula/src/dird/dird.c +++ b/bacula/src/dird/dird.c @@ -3,6 +3,8 @@ * Bacula Director daemon -- this is the main program * * Kern Sibbald, March MM + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/dird/dird.h b/bacula/src/dird/dird.h index 28d8caeb87..efe5c4f92f 100644 --- a/bacula/src/dird/dird.h +++ b/bacula/src/dird/dird.h @@ -2,6 +2,8 @@ * Includes specific to the Director * * Kern Sibbald, December MM + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 9043edcab0..4073fb2680 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -19,7 +19,7 @@ * * Kern Sibbald, January MM * - * $Id$ + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/dird/dird_conf.h b/bacula/src/dird/dird_conf.h index 07ca5c20c8..eebc692dfd 100644 --- a/bacula/src/dird/dird_conf.h +++ b/bacula/src/dird/dird_conf.h @@ -2,6 +2,8 @@ * Director specific configuration and defines * * Kern Sibbald, Feb MM + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -248,8 +250,11 @@ typedef union u_res URES; /* Run structure contained in Schedule Resource */ struct s_run { struct s_run *next; /* points to next run record */ - int level; + int level; /* level override */ int job_type; + POOL *pool; /* Pool override */ + STORE *storage; /* Storage override */ + MSGS *msgs; /* Messages override */ char *since; int level_no; int minute; /* minute to run job */ diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index f358f4e409..c61cbb800e 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -10,6 +10,7 @@ * Utility functions for sending info to File Daemon. * These functions are used by both backup and verify. * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/dird/getmsg.c b/bacula/src/dird/getmsg.c index b37abe2999..ca6273cc02 100644 --- a/bacula/src/dird/getmsg.c +++ b/bacula/src/dird/getmsg.c @@ -18,6 +18,7 @@ * Requests are any message that does not begin with a digit. * In affect, they are commands. * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index ea2dbd22d9..9813b16525 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -3,6 +3,8 @@ * Bacula Director Job processing routines * * Kern Sibbald, October MM + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -152,15 +154,19 @@ static void job_thread(void *arg) switch (jcr->JobType) { case JT_BACKUP: do_backup(jcr); + do_autoprune(jcr); break; case JT_VERIFY: do_verify(jcr); + do_autoprune(jcr); break; case JT_RESTORE: do_restore(jcr); + do_autoprune(jcr); break; case JT_ADMIN: /* No actual job */ + do_autoprune(jcr); break; default: Dmsg1(0, "Unimplemented job type: %d\n", jcr->JobType); @@ -304,7 +310,8 @@ void dird_free_jcr(JCR *jcr) * Set some defaults in the JCR necessary to * run. These items are pulled from the job * definition as defaults, but can be overridden - * later. + * later either by the Run record in the Schedule resource, + * or by the Console program. */ void set_jcr_defaults(JCR *jcr, JOB *job) { diff --git a/bacula/src/dird/mountreq.c b/bacula/src/dird/mountreq.c index 68dc820090..831b02d4fd 100644 --- a/bacula/src/dird/mountreq.c +++ b/bacula/src/dird/mountreq.c @@ -10,6 +10,7 @@ * Basic tasks done here: * Handle Mount services. * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/dird/msgchan.c b/bacula/src/dird/msgchan.c index b59fcb1ccf..e832e95dde 100644 --- a/bacula/src/dird/msgchan.c +++ b/bacula/src/dird/msgchan.c @@ -13,6 +13,7 @@ * Create a thread to interact with the Storage daemon * who returns a job status and requests Catalog services, etc. * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/dird/newvol.c b/bacula/src/dird/newvol.c index bf698a382b..92c2b1f691 100644 --- a/bacula/src/dird/newvol.c +++ b/bacula/src/dird/newvol.c @@ -8,8 +8,9 @@ * This routine runs as a thread and must be thread reentrant. * * Basic tasks done here: - * If possible create a new Media entry + * If possible create a new Media entry * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -52,22 +53,22 @@ int newVolume(JCR *jcr) if (db_get_pool_record(jcr->db, &pr) && pr.LabelFormat[0] && pr.LabelFormat[0] != '*') { if (pr.MaxVols == 0 || pr.NumVols < pr.MaxVols) { - memset(&mr, 0, sizeof(mr)); - mr.PoolId = jcr->PoolId; - strcpy(mr.MediaType, jcr->store->media_type); - strcpy(name, pr.LabelFormat); + memset(&mr, 0, sizeof(mr)); + mr.PoolId = jcr->PoolId; + strcpy(mr.MediaType, jcr->store->media_type); + strcpy(name, pr.LabelFormat); strcat(name, "%04d"); - sprintf(mr.VolumeName, name, ++pr.NumVols); + sprintf(mr.VolumeName, name, ++pr.NumVols); strcpy(mr.VolStatus, "Append"); - mr.Recycle = pr.Recycle; - mr.VolRetention = pr.VolRetention; - if (db_create_media_record(jcr->db, &mr) && - db_update_pool_record(jcr->db, &pr) == 1) { + mr.Recycle = pr.Recycle; + mr.VolRetention = pr.VolRetention; + if (db_create_media_record(jcr->db, &mr) && + db_update_pool_record(jcr->db, &pr) == 1) { Dmsg1(90, "Created new Volume=%s\n", mr.VolumeName); - return 1; - } else { + return 1; + } else { Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db)); - } + } } } return 0; diff --git a/bacula/src/dird/protos.h b/bacula/src/dird/protos.h index 7f09c081a6..8496d1caac 100644 --- a/bacula/src/dird/protos.h +++ b/bacula/src/dird/protos.h @@ -1,7 +1,7 @@ /* * Director external function prototypes * - * $Id: + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -28,6 +28,10 @@ extern int authenticate_storage_daemon(JCR *jcr); extern int authenticate_file_daemon(JCR *jcr); extern int authenticate_user_agent(BSOCK *ua); +/* autoprune.c */ +extern int do_autoprune(JCR *jcr); + + /* catreq.c */ extern void catalog_request(JCR *jcr, BSOCK *bs, char *buf); extern void catalog_update(JCR *jcr, BSOCK *bs, char *buf); diff --git a/bacula/src/dird/restore.c b/bacula/src/dird/restore.c index a63c47eb1f..f92efb0e2d 100644 --- a/bacula/src/dird/restore.c +++ b/bacula/src/dird/restore.c @@ -17,6 +17,7 @@ * to do the restore. * Update the DB according to what files where restored???? * + * Version $Id$ */ /* @@ -248,7 +249,7 @@ static void restore_cleanup(JCR *jcr, int status) update_job_end_record(jcr); bstrftime(dt, sizeof(dt), jcr->jr.EndTime); - Jmsg(jcr, M_INFO, 0, _("%s End Restore Job %s.\n"), + Jmsg(jcr, M_INFO, 0, _("%s End Restore Job %s.\n\n"), dt, jcr->Job); Dmsg0(20, "Leaving restore_cleanup\n"); diff --git a/bacula/src/dird/run_conf.c b/bacula/src/dird/run_conf.c index 3fe299354a..e173356a54 100644 --- a/bacula/src/dird/run_conf.c +++ b/bacula/src/dird/run_conf.c @@ -4,6 +4,8 @@ * directives, which are part of the Schedule Resource * * Kern Sibbald, May MM + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -141,6 +143,14 @@ static int is_num(char *num) return TRUE; } +/* Keywords (RHS) permitted in Run records */ +static struct s_kw RunFields[] = { + {"pool", 'P'}, + {"level", 'L'}, + {"storage", 'S'}, + {"messages", 'M'}, + {NULL, 0} +}; /* * Store Schedule Run information @@ -157,11 +167,13 @@ static int is_num(char *num) */ void store_run(LEX *lc, struct res_items *item, int index, int pass) { - int token, state, state2, i, code, code2; + int i, j, found; + int token, state, state2, code, code2; int options = lc->options; RUN **run = (RUN **)(item->value); RUN *trun; char *p; + RES *res; lc->options |= LOPT_NO_IDENT; /* want only "strings" */ @@ -170,28 +182,74 @@ void store_run(LEX *lc, struct res_items *item, int index, int pass) memset(&lrun, 0, sizeof(RUN)); /* scan for Job level "full", "incremental", ... */ - token = lex_get_token(lc); - if (token != T_STRING) { - scan_err1(lc, _("Expected a Job level identifier, got: %s"), lc->str); - } else { - if (strcasecmp(lc->str, "level")) { - if (lex_get_token(lc) != T_EQUALS) { - scan_err1(lc, "Expected an equals, got: %s", lc->str); - } - token = lex_get_token(lc); - } - for (i=0; joblevels[i].level_name; i++) { - if (strcasecmp(lc->str, joblevels[i].level_name) == 0) { - lrun.level = joblevels[i].level; - lrun.job_type = joblevels[i].job_type; - i = 0; - break; - } - } - if (i != 0) { - scan_err1(lc, _("Job level field: %s not found in run record"), lc->str); + for (found=TRUE; found; ) { + found = FALSE; + token = lex_get_token(lc); + if (token != T_IDENTIFIER && token != T_STRING && token != T_QUOTED_STRING) { + scan_err1(lc, "Expected a keyword name, got: %s", lc->str); } - } + for (i=0; RunFields[i].name; i++) { + if (strcasecmp(lc->str, RunFields[i].name) == 0) { + found = TRUE; + if (lex_get_token(lc) != T_EQUALS) { + scan_err1(lc, "Expected an equals, got: %s", lc->str); + } + token = lex_get_token(lc); + if (token != T_IDENTIFIER && token != T_STRING && token != T_QUOTED_STRING) { + scan_err1(lc, "Expected a keyword name, got: %s", lc->str); + } + switch (RunFields[i].token) { + case 'L': /* level */ + for (j=0; joblevels[j].level_name; j++) { + if (strcasecmp(lc->str, joblevels[j].level_name) == 0) { + lrun.level = joblevels[j].level; + lrun.job_type = joblevels[j].job_type; + j = 0; + break; + } + } + if (j != 0) { + scan_err1(lc, _("Job level field: %s not found in run record"), lc->str); + } + break; + case 'P': /* Pool */ + if (pass == 2) { + res = GetResWithName(R_POOL, lc->str); + if (res == NULL) { + scan_err1(lc, "Could not find specified Pool Resource: %s", + lc->str); + } + lrun.pool = (POOL *)res; + } + break; + case 'S': /* storage */ + if (pass == 2) { + res = GetResWithName(R_STORAGE, lc->str); + if (res == NULL) { + scan_err1(lc, "Could not find specified Storage Resource: %s", + lc->str); + } + lrun.storage = (STORE *)res; + } + break; + case 'M': /* messages */ + if (pass == 2) { + res = GetResWithName(R_MSGS, lc->str); + if (res == NULL) { + scan_err1(lc, "Could not find specified Messages Resource: %s", + lc->str); + } + lrun.msgs = (MSGS *)res; + } + break; + default: + scan_err1(lc, "Expected a keyword name, got: %s", lc->str); + break; + } /* end switch */ + } /* end if strcasecmp */ + } /* end for RunFields */ + } /* end for found */ + /* * Scan schedule times. @@ -220,9 +278,8 @@ void store_run(LEX *lc, struct res_items *item, int index, int pass) break; } /* everything else must be a keyword */ - lcase(lc->str); for (i=0; keyw[i].name; i++) { - if (strcmp(lc->str, keyw[i].name) == 0) { + if (strcasecmp(lc->str, keyw[i].name) == 0) { state = keyw[i].state; code = keyw[i].code; i = 0; diff --git a/bacula/src/dird/scheduler.c b/bacula/src/dird/scheduler.c index e65f12b40d..cda74b0e82 100644 --- a/bacula/src/dird/scheduler.c +++ b/bacula/src/dird/scheduler.c @@ -6,6 +6,8 @@ * fire them up. * * Kern Sibbald, May MM + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -126,9 +128,21 @@ JCR *wait_for_next_job(char *job_to_run) runjobs[jobindex].runtime = 0; /* remove from list */ run->last_run = now; /* mark as run */ rem_runjobs--; /* decrement count of remaining jobs */ + jcr = new_jcr(sizeof(JCR), dird_free_jcr); set_jcr_defaults(jcr, job); - jcr->level = run->level; /* override run level */ + if (run->level) { + jcr->level = run->level; /* override run level */ + } + if (run->pool) { + jcr->pool = run->pool; /* override pool */ + } + if (run->storage) { + jcr->store = run->storage; /* override storage */ + } + if (run->msgs) { + jcr->msgs = run->msgs; /* override messages */ + } Dmsg0(200, "Leave wait_for_next_job()\n"); return jcr; } diff --git a/bacula/src/dird/ua.h b/bacula/src/dird/ua.h index 2336a4b2b2..13c092dbf9 100644 --- a/bacula/src/dird/ua.h +++ b/bacula/src/dird/ua.h @@ -3,7 +3,7 @@ * * Kern Sibbald, August MMI * - * $Id: + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -25,7 +25,7 @@ */ -#define MAX_ARGS 20 +#define MAX_ARGS 30 typedef struct s_ua_context { BSOCK *UA_sock; @@ -33,19 +33,19 @@ typedef struct s_ua_context { JCR *jcr; B_DB *db; CAT *catalog; - char *cmd; /* return command/name buffer */ - char *args; /* command line arguments */ - char *argk[MAX_ARGS]; /* argument keywords */ - char *argv[MAX_ARGS]; /* argument values */ - int argc; /* number of arguments */ - char **prompt; /* list of prompts */ - int max_prompts; /* max size of list */ - int num_prompts; /* current number in list */ - int auto_display_messages; /* if set, display messages */ + POOLMEM *cmd; /* return command/name buffer */ + POOLMEM *args; /* command line arguments */ + char *argk[MAX_ARGS]; /* argument keywords */ + char *argv[MAX_ARGS]; /* argument values */ + int argc; /* number of arguments */ + char **prompt; /* list of prompts */ + int max_prompts; /* max size of list */ + int num_prompts; /* current number in list */ + int auto_display_messages; /* if set, display messages */ int user_notified_msg_pending; /* set when user notified */ - int automount; /* if set, mount after label */ - int quit; /* if set, quit */ - int verbose; /* set for normal UA verbosity */ + int automount; /* if set, mount after label */ + int quit; /* if set, quit */ + int verbose; /* set for normal UA verbosity */ } UAContext; /* ua_cmds.c */ @@ -77,7 +77,7 @@ int select_pool_and_media_dbr(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr); void start_prompt(UAContext *ua, char *msg); void add_prompt(UAContext *ua, char *prompt); int do_prompt(UAContext *ua, char *msg, char *prompt); -CAT *get_catalog_resource(UAContext *ua); +CAT *get_catalog_resource(UAContext *ua); STORE *get_storage_resource(UAContext *ua, char *cmd); int get_media_type(UAContext *ua, char *MediaType); int get_pool_dbr(UAContext *ua, POOL_DBR *pr); @@ -88,3 +88,8 @@ int get_job_dbr(UAContext *ua, JOB_DBR *jr); int find_arg_keyword(UAContext *ua, char **list); int do_keyword_prompt(UAContext *ua, char *msg, char **list); int confirm_retention(UAContext *ua, btime_t *ret, char *msg); + +/* ua_prune.c */ +int prune_files(UAContext *ua, CLIENT *client); +int prune_jobs(UAContext *ua, CLIENT *client); +int prune_volume(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr); diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 06a08498a2..3f1ee1c59f 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -3,6 +3,8 @@ * Bacula Director -- User Agent Commands * * Kern Sibbald, September MM + * + * Version $Id$ */ /* @@ -381,12 +383,7 @@ static int cancelcmd(UAContext *ua, char *cmd) free_jcr(jcr); return 1; - case JS_Running: - case JS_WaitSD: - case JS_WaitFD: - case JS_WaitMedia: - case JS_WaitMount: - case JS_Blocked: + default: jcr->JobStatus = JS_Cancelled; /* Cancel File daemon */ @@ -423,9 +420,6 @@ static int cancelcmd(UAContext *ua, char *cmd) bnet_close(sd); ua->jcr->store_bsock = NULL; - default: - bsendmsg(ua, _("JobId %d Job %s Status=%c cannot be cancelled.\n"), - jcr->JobId, jcr->Job, jcr->JobStatus); } free_jcr(jcr); diff --git a/bacula/src/dird/ua_dotcmds.c b/bacula/src/dird/ua_dotcmds.c index a466e3e185..3ecd6eb39e 100644 --- a/bacula/src/dird/ua_dotcmds.c +++ b/bacula/src/dird/ua_dotcmds.c @@ -7,6 +7,8 @@ * returned results are (supposed to be) predictable. * * Kern Sibbald, April MMII + * + * Version $Id$ */ /* diff --git a/bacula/src/dird/ua_input.c b/bacula/src/dird/ua_input.c index 9a24d052b1..85d7feefdd 100644 --- a/bacula/src/dird/ua_input.c +++ b/bacula/src/dird/ua_input.c @@ -3,6 +3,8 @@ * Bacula Director -- User Agent Input and scanning code * * Kern Sibbald, October MMI + * + * Version $Id$ */ /* diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index ff572affa4..2df7c9d702 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -4,6 +4,8 @@ * I.e. messages, listing database, showing resources, ... * * Kern Sibbald, September MM + * + * Version $Id$ */ /* diff --git a/bacula/src/dird/ua_prune.c b/bacula/src/dird/ua_prune.c index 2111d09e99..c6e32556b5 100644 --- a/bacula/src/dird/ua_prune.c +++ b/bacula/src/dird/ua_prune.c @@ -5,7 +5,7 @@ * * Kern Sibbald, February MMII * - * $Id$ + * Version $Id$ */ /* diff --git a/bacula/src/dird/ua_purge.c b/bacula/src/dird/ua_purge.c index b2c4a50215..f544a79081 100644 --- a/bacula/src/dird/ua_purge.c +++ b/bacula/src/dird/ua_purge.c @@ -8,7 +8,7 @@ * * Kern Sibbald, February MMII * - * $Id$ + * Version $Id$ */ /* diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index a44d73ea03..ad4e8c2326 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -3,6 +3,8 @@ * Bacula Director -- Run Command * * Kern Sibbald, December MMI + * + * Version $Id$ */ /* diff --git a/bacula/src/dird/ua_select.c b/bacula/src/dird/ua_select.c index 5992c63f49..0a2fddddca 100644 --- a/bacula/src/dird/ua_select.c +++ b/bacula/src/dird/ua_select.c @@ -4,7 +4,7 @@ * * Kern Sibbald, October MMI * - * $Id$ + * Version $Id$ */ /* diff --git a/bacula/src/dird/ua_server.c b/bacula/src/dird/ua_server.c index 8722a028d7..86dbc0f36d 100644 --- a/bacula/src/dird/ua_server.c +++ b/bacula/src/dird/ua_server.c @@ -3,6 +3,8 @@ * Bacula Director -- User Agent Server * * Kern Sibbald, September MM + * + * Version $Id$ */ /* @@ -99,12 +101,12 @@ static void handle_UA_client_request(void *arg) memset(&ua, 0, sizeof(ua)); ua.automount = TRUE; - ua.verbose = TRUE; + ua.verbose = 1; ua.jcr = new_jcr(sizeof(JCR), dird_free_jcr); ua.jcr->sd_auth_key = bstrdup("dummy"); /* dummy Storage daemon key */ ua.UA_sock = UA_sock; - ua.cmd = (char *) get_pool_memory(PM_FNAME); - ua.args = (char *) get_pool_memory(PM_FNAME); + ua.cmd = get_pool_memory(PM_FNAME); + ua.args = get_pool_memory(PM_FNAME); create_unique_job_name(ua.jcr, "*Console*"); ua.jcr->sched_time = ua.jcr->start_time; diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index eb8b651f71..6d287c9d04 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -3,6 +3,8 @@ * Bacula Director -- User Agent Status Command * * Kern Sibbald, August MMI + * + * Version $Id$ */ /* diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index ea1b9583f8..2134be18d2 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -17,6 +17,7 @@ * When the File daemon sends the attributes, compare them to * what is in the DB. * + * Version $Id$ */ /* @@ -264,7 +265,7 @@ Client: %s\n\ Start time: %s\n\ End time: %s\n\ Files Examined: %s\n\ -Termination: %s\n"), +Termination: %s\n\n"), edt, jcr->jr.JobId, jcr->jr.Job, diff --git a/bacula/src/filed/authenticate.c b/bacula/src/filed/authenticate.c index cecf3e52ca..1a2b6b4d72 100644 --- a/bacula/src/filed/authenticate.c +++ b/bacula/src/filed/authenticate.c @@ -2,6 +2,8 @@ * Authenticate Director who is attempting to connect. * * Kern Sibbald, October 2000 + * + * Version $Id$ * */ /* diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index 9bbcff6b41..58b1cb427b 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -4,6 +4,8 @@ * * Kern Sibbald, March MM * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/filed/estimate.c b/bacula/src/filed/estimate.c index fa020ff76b..c5821b69c2 100644 --- a/bacula/src/filed/estimate.c +++ b/bacula/src/filed/estimate.c @@ -4,6 +4,8 @@ * * Kern Sibbald, September MMI * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/filed/filed.c b/bacula/src/filed/filed.c index 83dc02ed44..4124f8c4be 100644 --- a/bacula/src/filed/filed.c +++ b/bacula/src/filed/filed.c @@ -3,6 +3,8 @@ * * Kern Sibbald, March MM * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/filed/filed.h b/bacula/src/filed/filed.h index e376722b4e..4cce69b2ac 100644 --- a/bacula/src/filed/filed.h +++ b/bacula/src/filed/filed.h @@ -2,6 +2,8 @@ * Bacula File Daemon specific configuration and defines * * Kern Sibbald, Jan MMI + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -30,9 +32,9 @@ #include "protos.h" /* file daemon prototypes */ #include "filed_conf.h" #ifdef HAVE_LIBZ -#include /* compression headers */ +#include /* compression headers */ #else #define uLongf uint32_t #endif -extern int win32_client; /* Are we running on Windows? */ +extern int win32_client; /* Are we running on Windows? */ diff --git a/bacula/src/filed/filed_conf.c b/bacula/src/filed/filed_conf.c index 21a756765e..c2ef765ef6 100644 --- a/bacula/src/filed/filed_conf.c +++ b/bacula/src/filed/filed_conf.c @@ -18,6 +18,8 @@ * for the resource records. * * Kern Sibbald, September MM + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/filed/filed_conf.h b/bacula/src/filed/filed_conf.h index c2547a99eb..56a3ef9827 100644 --- a/bacula/src/filed/filed_conf.h +++ b/bacula/src/filed/filed_conf.h @@ -2,6 +2,8 @@ * Bacula File Daemon specific configuration * * Kern Sibbald, Sep MM + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -26,34 +28,34 @@ /* * Resource codes -- they must be sequential for indexing */ -#define R_FIRST 1001 +#define R_FIRST 1001 -#define R_DIRECTOR 1001 -#define R_CLIENT 1002 -#define R_MSGS 1003 +#define R_DIRECTOR 1001 +#define R_CLIENT 1002 +#define R_MSGS 1003 -#define R_LAST R_MSGS +#define R_LAST R_MSGS /* * Some resource attributes */ -#define R_NAME 1020 -#define R_ADDRESS 1021 -#define R_PASSWORD 1022 -#define R_TYPE 1023 +#define R_NAME 1020 +#define R_ADDRESS 1021 +#define R_PASSWORD 1022 +#define R_TYPE 1023 /* Definition of the contents of each Resource */ struct s_res_dir { - RES hdr; - char *password; /* Director password */ - char *address; /* Director address or zero */ + RES hdr; + char *password; /* Director password */ + char *address; /* Director address or zero */ }; typedef struct s_res_dir DIRRES; struct s_res_client { - RES hdr; - int FDport; /* where we listen for Directors */ + RES hdr; + int FDport; /* where we listen for Directors */ char *working_directory; char *pid_directory; char *subsys_directory; @@ -67,9 +69,9 @@ typedef struct s_res_client CLIENT; * resource structure definitions. */ union u_res { - struct s_res_dir res_dir; - struct s_res_client res_client; - struct s_res_msgs res_msgs; + struct s_res_dir res_dir; + struct s_res_client res_client; + struct s_res_msgs res_msgs; RES hdr; }; diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 419f9e99a9..5ec027e62c 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -3,6 +3,8 @@ * * Kern Sibbald, October MM * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/filed/protos.h b/bacula/src/filed/protos.h index af93c8ab70..286eb2644d 100644 --- a/bacula/src/filed/protos.h +++ b/bacula/src/filed/protos.h @@ -1,3 +1,7 @@ +/* + * Version $Id$ + */ + /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -24,4 +28,3 @@ extern void do_restore(JCR *jcr, char *addr, int port); extern int authenticate_director(JCR *jcr); extern int authenticate_storagedaemon(JCR *jcr); extern int make_estimate(JCR *jcr); - diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c index 7e3da87f8c..2d57ef5bcc 100644 --- a/bacula/src/filed/restore.c +++ b/bacula/src/filed/restore.c @@ -3,6 +3,8 @@ * * Kern Sibbald, November MM * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index 832f7511f9..91e6e92876 100755 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -3,6 +3,8 @@ * * Kern Sibbald, August MMI * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/filed/verify.c b/bacula/src/filed/verify.c index a083c0b1e0..a3af127d77 100644 --- a/bacula/src/filed/verify.c +++ b/bacula/src/filed/verify.c @@ -3,6 +3,8 @@ * * Kern Sibbald, October MM * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 48b0eae699..78fdf56938 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -6,24 +6,27 @@ * * Kern Sibbald, Nov MM * + * Version $Id$ */ /* - Copyright (C) 2000, 2001 Kern Sibbald and John Walker + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + modify it under the terms of the GNU 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 General Public License for more details. + 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., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. - 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __JCR_H_ diff --git a/bacula/src/lib/alloc.c b/bacula/src/lib/alloc.c index f65c94236e..f25ee348bc 100644 --- a/bacula/src/lib/alloc.c +++ b/bacula/src/lib/alloc.c @@ -2,6 +2,7 @@ Error checking memory allocator + Version $Id$ */ /* diff --git a/bacula/src/lib/base64.c b/bacula/src/lib/base64.c index af470181fd..6a9f8a8382 100644 --- a/bacula/src/lib/base64.c +++ b/bacula/src/lib/base64.c @@ -2,6 +2,8 @@ * Generic base 64 input and output routines * * Written by Kern E. Sibbald, March MM. + * + * Version $Id$ */ /* diff --git a/bacula/src/lib/bits.h b/bacula/src/lib/bits.h index ef88741808..b2ad6bc774 100644 --- a/bacula/src/lib/bits.h +++ b/bacula/src/lib/bits.h @@ -3,6 +3,8 @@ * Kern Sibbald, MM * * NOTE: base 0 + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/lib/bnet.c b/bacula/src/lib/bnet.c index def42e8578..4991646a3c 100644 --- a/bacula/src/lib/bnet.c +++ b/bacula/src/lib/bnet.c @@ -6,6 +6,7 @@ * Adapted and enhanced for Bacula, originally written * for inclusion in the Apcupsd package * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -456,7 +457,7 @@ again: bs->msglen = bvsnprintf(bs->msg, maxlen, fmt, arg_ptr); va_end(arg_ptr); if (bs->msglen < 0 || bs->msglen >= maxlen) { - bs->msg = (char *) realloc_pool_memory(bs->msg, maxlen + 200); + bs->msg = (POOLMEM *)realloc_pool_memory(bs->msg, maxlen + 200); goto again; } return bnet_send(bs) < 0 ? 0 : 1; @@ -570,14 +571,15 @@ char *bnet_sig_to_ascii(BSOCK *bs) BSOCK * init_bsock(int sockfd, char *who, char *host, int port) { - BSOCK *bsock = (BSOCK *) malloc(sizeof(BSOCK)); + BSOCK *bsock = (BSOCK *)malloc(sizeof(BSOCK)); if (bsock == NULL) { Emsg0(M_ABORT, 0, "Out of memory in init_bsock.\n"); } memset(bsock, 0, sizeof(BSOCK)); bsock->fd = sockfd; bsock->errors = 0; - bsock->msg = (char *) get_pool_memory(PM_MESSAGE); + bsock->msg = (POOLMEM *)get_pool_memory(PM_MESSAGE); + bsock->errmsg = (POOLMEM *)get_pool_memory(PM_MESSAGE); bsock->who = bstrdup(who); bsock->host = bstrdup(host); bsock->port = port; @@ -597,7 +599,8 @@ dup_bsock(BSOCK *osock) Emsg0(M_ABORT, 0, "Out of memory in dup_bsock.\n"); } memcpy(bsock, osock, sizeof(BSOCK)); - bsock->msg = (char *) get_pool_memory(PM_MESSAGE); + bsock->msg = (POOLMEM *)get_pool_memory(PM_MESSAGE); + bsock->errmsg = (POOLMEM *)get_pool_memory(PM_MESSAGE); bsock->duped = TRUE; return bsock; } @@ -625,6 +628,7 @@ void term_bsock(BSOCK *bsock) { free_pool_memory(bsock->msg); + free_pool_memory(bsock->errmsg); free(bsock->who); free(bsock->host); free(bsock); diff --git a/bacula/src/lib/bnet_server.c b/bacula/src/lib/bnet_server.c index ef9bc47ada..a3abc674bf 100644 --- a/bacula/src/lib/bnet_server.c +++ b/bacula/src/lib/bnet_server.c @@ -18,7 +18,10 @@ */ /* - * Originally written by Kern Sibbald for inclusion in apcupsd. + * Originally written by Kern Sibbald for inclusion in apcupsd, + * but heavily modified for Bacula + * + * Version $Id$ */ #include "bacula.h" @@ -77,12 +80,16 @@ bnet_thread_server(int port, int max_clients, workq_t *client_wq, serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); serv_addr.sin_port = htons(port); + int tmax = 30 * (60 / 5); /* wait 30 minutes max */ for (tlog=0; bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0; tlog -= 5 ) { if (tlog <= 0) { tlog = 2*60; /* Complain every 2 minutes */ Emsg2(M_WARNING, 0, "Cannot bind port %d: %s. Retrying ...\n", port, strerror(errno)); } sleep(5); + if (--tmax <= 0) { + Emsg2(M_ABORT, 0, "Cannot bind port %d: %s.\n", port, strerror(errno)); + } } listen(sockfd, 5); /* tell system we are ready */ @@ -147,6 +154,7 @@ bnet_thread_server(int port, int max_clients, workq_t *client_wq, } +#ifdef REALLY_USED /* * Bind an address so that we may accept connections * one at a time. @@ -288,6 +296,7 @@ bnet_accept(BSOCK *bsock, char *who) } } +#endif @@ -295,7 +304,7 @@ bnet_accept(BSOCK *bsock, char *who) * The following code will soon be deleted, don't attempt * to use it. */ -#ifdef dont_have_threads_junk +#ifdef dont_have_threads /* * This routine is called by the main process to diff --git a/bacula/src/lib/bshm.c b/bacula/src/lib/bshm.c index 5af82774d5..89a6274f84 100644 --- a/bacula/src/lib/bshm.c +++ b/bacula/src/lib/bshm.c @@ -8,6 +8,8 @@ * * By Kern Sibbald, May MM * + * Version $Id$ + * * Note, this routine was originally written so that the DEVICE structures * could be shared between the child processes. Now that the Storage * daemon is threaded, these routines are no longer needed. Rather than diff --git a/bacula/src/lib/bshm.h b/bacula/src/lib/bshm.h index 3d901b216b..15e913ec22 100644 --- a/bacula/src/lib/bshm.h +++ b/bacula/src/lib/bshm.h @@ -3,12 +3,14 @@ * * Kern Sibbald, May MM * - * NB: these items are deprecated. Shared memory was - * used in a first version of the Storage daemon - * when it forked. Since then it has been converted - * to use threads. However, there are still some - * vestiges of the shared memory code that remain and - * can be removed. + * NB: these items are deprecated. Shared memory was + * used in a first version of the Storage daemon + * when it forked. Since then it has been converted + * to use threads. However, there are still some + * vestiges of the shared memory code that remain and + * can be removed. + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -31,10 +33,10 @@ */ typedef struct s_bshm { - int size; /* length desired */ - int perms; /* permissions desired */ + int size; /* length desired */ + int perms; /* permissions desired */ - int shmid; /* id set by shm_create and shm_open */ - key_t shmkey; /* key set by shm_create */ - void *shmbuf; /* set by shm_open */ + int shmid; /* id set by shm_create and shm_open */ + key_t shmkey; /* key set by shm_create */ + void *shmbuf; /* set by shm_open */ } BSHM; diff --git a/bacula/src/lib/bsock.h b/bacula/src/lib/bsock.h index c9ed782bcb..92b9ded460 100644 --- a/bacula/src/lib/bsock.h +++ b/bacula/src/lib/bsock.h @@ -9,6 +9,7 @@ * Negative msglen, is special "signal" (no data follows). * See below for SIGNAL codes. * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -44,10 +45,10 @@ typedef struct s_bsock { int timeout; /* time out after this value */ int terminated; /* set when BNET_TERMINATE arrives */ int duped; /* set if duped BSOCK */ - char *msg; /* message pool buffer */ + POOLMEM *msg; /* message pool buffer */ char *who; /* Name of daemon to which we are talking */ char *host; /* Host name/IP */ - char *errmsg; /* edited error message (to be implemented) */ + POOLMEM *errmsg; /* edited error message (to be implemented) */ RES *res; /* Resource to which we are connected */ struct s_bsock *next; /* next BSOCK if duped */ } BSOCK; diff --git a/bacula/src/lib/btime.c b/bacula/src/lib/btime.c index c3f1b31f92..dbd7cd8e1a 100644 --- a/bacula/src/lib/btime.c +++ b/bacula/src/lib/btime.c @@ -1,5 +1,7 @@ /* * Bacula time and date routines -- John Walker + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/lib/btime.h b/bacula/src/lib/btime.h index b298279c04..3a324d1881 100644 --- a/bacula/src/lib/btime.h +++ b/bacula/src/lib/btime.h @@ -1,10 +1,17 @@ -/* Time and date structures and functions. +/* + + Time and date structures and functions. Date and time are always represented internally as 64 bit floating point Julian day numbers and fraction. The day number and fraction are kept as separate quantities to avoid round-off of - day fraction. John Walker */ + day fraction. John Walker + + Version $Id$ + + */ + /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/lib/cram-md5.c b/bacula/src/lib/cram-md5.c index e9e6cd77de..f1658044e9 100644 --- a/bacula/src/lib/cram-md5.c +++ b/bacula/src/lib/cram-md5.c @@ -4,6 +4,8 @@ * cram-md5 is based on RFC2104. * * Written for Bacula by Kern E. Sibbald, May MMI. + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/lib/crc32.c b/bacula/src/lib/crc32.c index 81eefa7dfd..4f69f3cada 100644 --- a/bacula/src/lib/crc32.c +++ b/bacula/src/lib/crc32.c @@ -3,6 +3,8 @@ * * By Kern Sibbald, January 2001 * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/lib/daemon.c b/bacula/src/lib/daemon.c index 387a47b142..6613b7f6aa 100644 --- a/bacula/src/lib/daemon.c +++ b/bacula/src/lib/daemon.c @@ -1,6 +1,8 @@ /* * daemon.c by Kern Sibbald * + * Version $Id$ + * * this code is inspired by the Prentice Hall book * "Unix Network Programming" by W. Richard Stevens * and later updated from his book "Advanced Programming diff --git a/bacula/src/lib/events.c b/bacula/src/lib/events.c index 29c0319c86..3333655826 100644 --- a/bacula/src/lib/events.c +++ b/bacula/src/lib/events.c @@ -3,6 +3,8 @@ * * Kern Sibbald, August MMI * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/lib/hmac.c b/bacula/src/lib/hmac.c index bb8e46508f..40432aa51e 100644 --- a/bacula/src/lib/hmac.c +++ b/bacula/src/lib/hmac.c @@ -4,6 +4,8 @@ * hmac_md5 was based on sample code in RFC2104 (thanks guys). * * Adapted to Bacula by Kern E. Sibbald, February MMI. + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index c17616793c..fd94021147 100755 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -3,6 +3,8 @@ * * Kern E. Sibbald, December 2000 * + * Version $Id$ + * * These routines are thread safe. * */ diff --git a/bacula/src/lib/lex.c b/bacula/src/lib/lex.c index db20bf0170..9e07c6a518 100644 --- a/bacula/src/lib/lex.c +++ b/bacula/src/lib/lex.c @@ -1,6 +1,8 @@ /* * Lexical scanner for Bacula configuration file * + * Version $Id$ + * */ /* diff --git a/bacula/src/lib/lex.h b/bacula/src/lib/lex.h index e295c2d0e2..4b52291818 100644 --- a/bacula/src/lib/lex.h +++ b/bacula/src/lib/lex.h @@ -1,10 +1,12 @@ /* * lex.h * - * Lexial scanning of configuration files, used by parsers. + * Lexical scanning of configuration files, used by parsers. * * Kern Sibbald, MM * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -30,26 +32,26 @@ #define _LEX_H /* Lex get_char() return values */ -#define L_EOF (-1) -#define L_EOL (-2) +#define L_EOF (-1) +#define L_EOL (-2) /* Internal tokens */ -#define T_NONE 100 +#define T_NONE 100 /* Tokens returned by get_token() */ -#define T_EOF 101 -#define T_NUMBER 102 -#define T_IPADDR 103 -#define T_IDENTIFIER 104 -#define T_STRING 105 -#define T_QUOTED_STRING 106 -#define T_BOB 108 /* begin block */ -#define T_EOB 109 /* end of block */ -#define T_EQUALS 110 -#define T_COMMA 111 -#define T_EOL 112 -#define T_SEMI 113 -#define T_ERROR 200 +#define T_EOF 101 +#define T_NUMBER 102 +#define T_IPADDR 103 +#define T_IDENTIFIER 104 +#define T_STRING 105 +#define T_QUOTED_STRING 106 +#define T_BOB 108 /* begin block */ +#define T_EOB 109 /* end of block */ +#define T_EQUALS 110 +#define T_COMMA 111 +#define T_EOL 112 +#define T_SEMI 113 +#define T_ERROR 200 /* Lexical state */ enum lex_state { @@ -64,22 +66,22 @@ enum lex_state { }; /* Lex scan options */ -#define LOPT_NO_IDENT 0x1 /* No Identifiers -- use string */ +#define LOPT_NO_IDENT 0x1 /* No Identifiers -- use string */ /* Lexical context */ typedef struct s_lex_context { - int options; /* scan options */ - char *fname; /* filename */ - FILE *fd; /* file descriptor */ - char line[MAXSTRING]; /* input line */ - char str[MAXSTRING]; /* string being scanned */ - int str_len; /* length of string */ - int line_no; /* file line number */ - int col_no; /* char position on line */ - enum lex_state state; /* lex_state variable */ - int ch; /* last char/L_VAL returned by get_char */ + int options; /* scan options */ + char *fname; /* filename */ + FILE *fd; /* file descriptor */ + char line[MAXSTRING]; /* input line */ + char str[MAXSTRING]; /* string being scanned */ + int str_len; /* length of string */ + int line_no; /* file line number */ + int col_no; /* char position on line */ + enum lex_state state; /* lex_state variable */ + int ch; /* last char/L_VAL returned by get_char */ int token; - struct s_lex_context *next; /* pointer to next lexical context */ + struct s_lex_context *next; /* pointer to next lexical context */ } LEX; #endif /* _LEX_H */ diff --git a/bacula/src/lib/lib.h b/bacula/src/lib/lib.h index b3dc512206..600a4c4eb2 100644 --- a/bacula/src/lib/lib.h +++ b/bacula/src/lib/lib.h @@ -1,5 +1,7 @@ /* * Library includes for Bacula lib directory + * + * Version $Id$ */ /* @@ -40,4 +42,3 @@ #include "md5.h" #include "protos.h" - diff --git a/bacula/src/lib/md5.c b/bacula/src/lib/md5.c index 9ea7671f8c..9b4b7b805a 100644 --- a/bacula/src/lib/md5.c +++ b/bacula/src/lib/md5.c @@ -13,6 +13,8 @@ * MD5Context structure, pass it to MD5Init, call MD5Update as * needed on buffers full of bytes, and then call MD5Final, which * will fill a supplied 16-byte array with the digest. + * + * Version $Id$ */ /* Brutally hacked by John Walker back from ANSI C to K&R (no diff --git a/bacula/src/lib/md5.h b/bacula/src/lib/md5.h index 2a39ad1891..53faa028b6 100644 --- a/bacula/src/lib/md5.h +++ b/bacula/src/lib/md5.h @@ -2,6 +2,8 @@ * Bacula MD5 definitions * * Kern Sibbald, 2001 + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/lib/mem_pool.c b/bacula/src/lib/mem_pool.c index 1762cea4bc..9eddd47ad1 100644 --- a/bacula/src/lib/mem_pool.c +++ b/bacula/src/lib/mem_pool.c @@ -16,6 +16,8 @@ * with the desired size and it will adjust only if necessary. * * Kern E. Sibbald + * + * Version $Id$ */ /* diff --git a/bacula/src/lib/mem_pool.h b/bacula/src/lib/mem_pool.h index 17f8d5671b..5378ea7411 100644 --- a/bacula/src/lib/mem_pool.h +++ b/bacula/src/lib/mem_pool.h @@ -2,6 +2,8 @@ * Memory Pool prototypes * * Kern Sibbald, 2000 + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -40,13 +42,13 @@ extern POOLMEM *get_memory(size_t size); #define free_memory(x) free_pool_memory(x) extern void free_pool_memory(POOLMEM *buf); extern size_t sizeof_pool_memory(POOLMEM *buf); -extern POOLMEM *realloc_pool_memory(POOLMEM *buf, size_t size); -extern POOLMEM *check_pool_memory_size(POOLMEM *buf, size_t size); +extern POOLMEM *realloc_pool_memory(POOLMEM *buf, size_t size); +extern POOLMEM *check_pool_memory_size(POOLMEM *buf, size_t size); extern void close_memory_pool(); extern void print_memory_pool_stats(); -#define PM_NOPOOL 0 /* nonpooled memory */ -#define PM_FNAME 1 /* file name buffer */ -#define PM_MESSAGE 2 /* daemon message */ -#define PM_EMSG 3 /* error message */ -#define PM_MAX PM_EMSG /* Number of types */ +#define PM_NOPOOL 0 /* nonpooled memory */ +#define PM_FNAME 1 /* file name buffer */ +#define PM_MESSAGE 2 /* daemon message */ +#define PM_EMSG 3 /* error message */ +#define PM_MAX PM_EMSG /* Number of types */ diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 41e804e37d..7c911cb7ff 100755 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -3,6 +3,8 @@ * * Kern Sibbald, April 2000 * + * Version $Id$ + * */ /* diff --git a/bacula/src/lib/message.h b/bacula/src/lib/message.h index 6d3d9c5bd8..9d111a14d6 100644 --- a/bacula/src/lib/message.h +++ b/bacula/src/lib/message.h @@ -1,6 +1,8 @@ /* * Define Message Types for Bacula * Kern Sibbald, 2000 + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -24,53 +26,53 @@ #include "bits.h" -#undef M_DEBUG -#undef M_ABORT -#undef M_FATAL -#undef M_ERROR -#undef M_WARNING -#undef M_INFO -#undef M_MOUNT -#undef M_TERM +#undef M_DEBUG +#undef M_ABORT +#undef M_FATAL +#undef M_ERROR +#undef M_WARNING +#undef M_INFO +#undef M_MOUNT +#undef M_TERM -#define M_DEBUG 1 /* debug message */ -#define M_ABORT 2 /* MUST abort immediately */ -#define M_FATAL 3 /* Fatal error, stopping job */ -#define M_ERROR 4 /* Error, but recoverable */ -#define M_WARNING 5 /* Warning message */ -#define M_INFO 6 /* Informational message */ -#define M_SAVED 7 /* Info on saved file */ -#define M_NOTSAVED 8 /* Info on notsaved file */ -#define M_SKIPPED 9 /* File skipped by option setting */ -#define M_MOUNT 10 /* Mount requests */ -#define M_TERM 11 /* Termination request */ +#define M_DEBUG 1 /* debug message */ +#define M_ABORT 2 /* MUST abort immediately */ +#define M_FATAL 3 /* Fatal error, stopping job */ +#define M_ERROR 4 /* Error, but recoverable */ +#define M_WARNING 5 /* Warning message */ +#define M_INFO 6 /* Informational message */ +#define M_SAVED 7 /* Info on saved file */ +#define M_NOTSAVED 8 /* Info on notsaved file */ +#define M_SKIPPED 9 /* File skipped by option setting */ +#define M_MOUNT 10 /* Mount requests */ +#define M_TERM 11 /* Termination request */ -#define M_MAX M_TERM /* keep this updated ! */ +#define M_MAX M_TERM /* keep this updated ! */ /* Define message destination structure */ /* *** FIXME **** where should be extended to handle multiple values */ typedef struct s_dest { struct s_dest *next; - int dest_code; /* destination (one of the MD_ codes) */ - int max_len; /* max mail line length */ - FILE *fd; /* file descriptor */ + int dest_code; /* destination (one of the MD_ codes) */ + int max_len; /* max mail line length */ + FILE *fd; /* file descriptor */ char msg_types[nbytes_for_bits(M_MAX+1)]; /* message type mask */ - char *where; /* filename/program name */ - char *mail_cmd; /* mail command */ - char *mail_filename; /* unique mail filename */ + char *where; /* filename/program name */ + char *mail_cmd; /* mail command */ + char *mail_filename; /* unique mail filename */ } DEST; /* Message Destination values for dest field of DEST */ -#define MD_SYSLOG 1 /* send msg to syslog */ -#define MD_MAIL 2 /* email group of messages */ -#define MD_FILE 3 /* write messages to a file */ -#define MD_APPEND 4 /* append messages to a file */ -#define MD_STDOUT 5 /* print messages */ -#define MD_STDERR 6 /* print messages to stderr */ -#define MD_DIRECTOR 7 /* send message to the Director */ -#define MD_OPERATOR 8 /* email a single message to the operator */ -#define MD_CONSOLE 9 /* send msg to UserAgent or console */ -#define MD_MAIL_ON_ERROR 10 /* email messages if job errors */ +#define MD_SYSLOG 1 /* send msg to syslog */ +#define MD_MAIL 2 /* email group of messages */ +#define MD_FILE 3 /* write messages to a file */ +#define MD_APPEND 4 /* append messages to a file */ +#define MD_STDOUT 5 /* print messages */ +#define MD_STDERR 6 /* print messages to stderr */ +#define MD_DIRECTOR 7 /* send message to the Director */ +#define MD_OPERATOR 8 /* email a single message to the operator */ +#define MD_CONSOLE 9 /* send msg to UserAgent or console */ +#define MD_MAIL_ON_ERROR 10 /* email messages if job errors */ void d_msg(char *file, int line, int level, char *fmt,...); diff --git a/bacula/src/lib/parse_conf.c b/bacula/src/lib/parse_conf.c index 6978470c24..da676363a2 100755 --- a/bacula/src/lib/parse_conf.c +++ b/bacula/src/lib/parse_conf.c @@ -19,6 +19,8 @@ * for the resource records. * * Kern Sibbald, January MM + * + * Version $Id$ */ /* diff --git a/bacula/src/lib/parse_conf.h b/bacula/src/lib/parse_conf.h index aec35192b9..f1503b73d9 100644 --- a/bacula/src/lib/parse_conf.h +++ b/bacula/src/lib/parse_conf.h @@ -1,3 +1,6 @@ +/* + * Version $Id$ + */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -18,7 +21,7 @@ */ -struct res_items; /* Declare forward referenced structure */ +struct res_items; /* Declare forward referenced structure */ typedef void (MSG_RES_HANDLER)(LEX *lc, struct res_items *item, int index, int pass); /* This is the structure that defines @@ -27,30 +30,30 @@ typedef void (MSG_RES_HANDLER)(LEX *lc, struct res_items *item, int index, int p * tables. */ struct res_items { - char *name; /* Resource name i.e. Director, ... */ - MSG_RES_HANDLER *handler; /* Routine storing the resource item */ - void **value; /* Where to store the item */ - int code; /* item code/additional info */ - int flags; /* flags: default, required, ... */ - int default_value; /* default value */ + char *name; /* Resource name i.e. Director, ... */ + MSG_RES_HANDLER *handler; /* Routine storing the resource item */ + void **value; /* Where to store the item */ + int code; /* item code/additional info */ + int flags; /* flags: default, required, ... */ + int default_value; /* default value */ }; /* For storing name_addr items in res_items table */ #define ITEM(x) ((void **)&res_all.x) -#define MAX_RES_ITEMS 32 /* maximum resource items per RES */ +#define MAX_RES_ITEMS 32 /* maximum resource items per RES */ /* This is the universal header that is * at the beginning of every resource * record. */ struct s_reshdr { - char *name; /* resource name */ - char *desc; /* resource description */ - int rcode; /* resource id or type */ - int refcnt; /* reference count for releasing */ + char *name; /* resource name */ + char *desc; /* resource description */ + int rcode; /* resource id or type */ + int refcnt; /* reference count for releasing */ char item_present[MAX_RES_ITEMS]; /* set if item is present in conf file */ - struct s_reshdr *next; /* pointer to next resource of this type */ + struct s_reshdr *next; /* pointer to next resource of this type */ }; typedef struct s_reshdr RES; @@ -60,26 +63,26 @@ typedef struct s_reshdr RES; * This is the structure that defines the * resources that are available to this daemon. */ -struct s_res { - char *name; /* resource name */ - struct res_items *items; /* list of resource keywords */ - int rcode; /* code if needed */ - RES *res_head; /* where to store it */ +struct s_res { + char *name; /* resource name */ + struct res_items *items; /* list of resource keywords */ + int rcode; /* code if needed */ + RES *res_head; /* where to store it */ }; /* Common Resource definitions */ -#define MAX_RES_NAME_LENGTH MAX_NAME_LENGTH-1 /* maximum resource name length */ +#define MAX_RES_NAME_LENGTH MAX_NAME_LENGTH-1 /* maximum resource name length */ -#define ITEM_REQUIRED 0x1 /* item required */ -#define ITEM_DEFAULT 0x2 /* default supplied */ +#define ITEM_REQUIRED 0x1 /* item required */ +#define ITEM_DEFAULT 0x2 /* default supplied */ /* Message Resource */ struct s_res_msgs { - RES hdr; - char *mail_cmd; /* mail command */ - char *operator_cmd; /* Operator command */ - DEST *dest_chain; /* chain of destinations */ + RES hdr; + char *mail_cmd; /* mail command */ + char *operator_cmd; /* Operator command */ + DEST *dest_chain; /* chain of destinations */ char send_msg[nbytes_for_bits(M_MAX+1)]; /* bit array of types */ }; typedef struct s_res_msgs MSGS; @@ -89,7 +92,7 @@ typedef struct s_res_msgs MSGS; * resource structure definitions. */ union cu_res { - struct s_res_msgs res_msgs; + struct s_res_msgs res_msgs; RES hdr; }; @@ -97,7 +100,7 @@ typedef union cu_res CURES; /* Configuration routines */ -void parse_config __PROTO((char *cf)); +void parse_config __PROTO((char *cf)); void free_config_resources __PROTO(()); /* Resource routines */ diff --git a/bacula/src/lib/protos.h b/bacula/src/lib/protos.h index 470c2560d1..7fc99d14bf 100644 --- a/bacula/src/lib/protos.h +++ b/bacula/src/lib/protos.h @@ -1,5 +1,7 @@ /* * Prototypes for lib directory of Bacula + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/lib/queue.c b/bacula/src/lib/queue.c index d799d107c9..1fa05ed9c0 100644 --- a/bacula/src/lib/queue.c +++ b/bacula/src/lib/queue.c @@ -3,10 +3,13 @@ Q U E U E Queue Handling Routines - Taken from smartall by John Walker. + Taken from smartall written by John Walker. http://www.fourmilab.ch/smartall/ + + Version $Id$ + */ /* diff --git a/bacula/src/lib/queue.h b/bacula/src/lib/queue.h index e9afef4997..c6cbe1080d 100644 --- a/bacula/src/lib/queue.h +++ b/bacula/src/lib/queue.h @@ -1,3 +1,8 @@ +/* + * Version $Id$ + */ + + /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -23,15 +28,15 @@ /* General purpose queue */ struct b_queue { - struct b_queue *qnext, /* Next item in queue */ - *qprev; /* Previous item in queue */ + struct b_queue *qnext, /* Next item in queue */ + *qprev; /* Previous item in queue */ }; typedef struct b_queue BQUEUE; /* Queue functions */ -void qinsert(BQUEUE *qhead, BQUEUE *object); +void qinsert(BQUEUE *qhead, BQUEUE *object); BQUEUE *qnext(BQUEUE *qhead, BQUEUE *qitem); BQUEUE *qdchain(BQUEUE *qitem); BQUEUE *qremove(BQUEUE *qhead); diff --git a/bacula/src/lib/rwlock.c b/bacula/src/lib/rwlock.c index 81850c940c..dd7558be88 100644 --- a/bacula/src/lib/rwlock.c +++ b/bacula/src/lib/rwlock.c @@ -4,6 +4,8 @@ * * Kern Sibbald, January MMI * + * Version $Id$ + * * This code adapted from "Programming with POSIX Threads", by * David R. Butenhof * diff --git a/bacula/src/lib/rwlock.h b/bacula/src/lib/rwlock.h index 8ba9e98c41..c91e8d43d0 100644 --- a/bacula/src/lib/rwlock.h +++ b/bacula/src/lib/rwlock.h @@ -1,12 +1,14 @@ /* * Bacula Thread Read/Write locking code. It permits - * multiple readers but only one writer. + * multiple readers but only one writer. * * Kern Sibbald, January MMI * * This code adapted from "Programming with POSIX Threads", by * David R. Butenhof * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -33,13 +35,13 @@ typedef struct rwlock_tag { pthread_mutex_t mutex; - pthread_cond_t read; /* wait for read */ - pthread_cond_t write; /* wait for write */ - int valid; /* set when valid */ - int r_active; /* readers active */ - int w_active; /* writers active */ - int r_wait; /* readers waiting */ - int w_wait; /* writers waiting */ + pthread_cond_t read; /* wait for read */ + pthread_cond_t write; /* wait for write */ + int valid; /* set when valid */ + int r_active; /* readers active */ + int w_active; /* writers active */ + int r_wait; /* readers waiting */ + int w_wait; /* writers waiting */ } rwlock_t; #define RWLOCK_VALID 0xfacade diff --git a/bacula/src/lib/serial.c b/bacula/src/lib/serial.c index c1e5c3f73e..1b2b021937 100644 --- a/bacula/src/lib/serial.c +++ b/bacula/src/lib/serial.c @@ -3,6 +3,8 @@ Serialisation Support Functions John Walker + + Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/lib/serial.h b/bacula/src/lib/serial.h index 7066e776b8..f3adaab0d8 100644 --- a/bacula/src/lib/serial.h +++ b/bacula/src/lib/serial.h @@ -1,4 +1,7 @@ - +/* + * + * Version $Id$ + */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -41,7 +44,7 @@ extern int unserial_string(uint8_t * ptr, char * str); /* - Serialisation Macros + Serialisation Macros These macros use a uint8_t pointer, ser_ptr, which must be defined by the code which uses them. @@ -52,83 +55,83 @@ extern int unserial_string(uint8_t * ptr, char * str); #define __SERIAL_H_ 1 /* ser_declare -- Declare ser_ptr locally within a function. */ -#define ser_declare uint8_t *ser_ptr -#define unser_declare uint8_t *ser_ptr +#define ser_declare uint8_t *ser_ptr +#define unser_declare uint8_t *ser_ptr /* ser_begin(x, s) -- Begin serialisation into a buffer x of size s. */ #define ser_begin(x, s) ser_ptr = ((uint8_t *)(x)) #define unser_begin(x, s) ser_ptr = ((uint8_t *)(x)) -/* ser_length -- Determine length in bytes of serialised into a - buffer x. */ +/* ser_length -- Determine length in bytes of serialised into a + buffer x. */ #define ser_length(x) (ser_ptr - (uint8_t *)(x)) #define unser_length(x) (ser_ptr - (uint8_t *)(x)) /* ser_end(x, s) -- End serialisation into a buffer x of size s. */ -#define ser_end(x, s) ASSERT(ser_length(x) <= (s)) +#define ser_end(x, s) ASSERT(ser_length(x) <= (s)) #define unser_end(x, s) ASSERT(ser_length(x) <= (s)) /* ser_check(x, s) -- Verify length of serialised data in buffer x is - expected length s. */ + expected length s. */ #define ser_check(x, s) ASSERT(ser_length(x) == (s)) -/* Serialisation */ +/* Serialisation */ /* 8 bit signed integer */ -#define ser_int8(x) *ser_ptr++ = (x) +#define ser_int8(x) *ser_ptr++ = (x) /* 8 bit unsigned integer */ -#define ser_uint8(x) *ser_ptr++ = (x) +#define ser_uint8(x) *ser_ptr++ = (x) /* 16 bit signed integer */ -#define ser_int16(x) serial_int16(&ser_ptr, x) +#define ser_int16(x) serial_int16(&ser_ptr, x) /* 16 bit unsigned integer */ -#define ser_uint16(x) serial_uint16(&ser_ptr, x) +#define ser_uint16(x) serial_uint16(&ser_ptr, x) /* 32 bit signed integer */ -#define ser_int32(x) serial_int32(&ser_ptr, x) +#define ser_int32(x) serial_int32(&ser_ptr, x) /* 32 bit unsigned integer */ -#define ser_uint32(x) serial_uint32(&ser_ptr, x) +#define ser_uint32(x) serial_uint32(&ser_ptr, x) /* 64 bit signed integer */ -#define ser_int64(x) serial_int64(&ser_ptr, x) +#define ser_int64(x) serial_int64(&ser_ptr, x) /* 64 bit unsigned integer */ -#define ser_uint64(x) serial_uint64(&ser_ptr, x) +#define ser_uint64(x) serial_uint64(&ser_ptr, x) /* 64 bit IEEE floating point number */ -#define ser_float64(x) serial_float64(&ser_ptr, x) +#define ser_float64(x) serial_float64(&ser_ptr, x) /* 128 bit signed integer */ -#define ser_int128(x) memcpy(ser_ptr, x, sizeof(int128_t)), ser_ptr += sizeof(int128_t) +#define ser_int128(x) memcpy(ser_ptr, x, sizeof(int128_t)), ser_ptr += sizeof(int128_t) /* Binary byte stream len bytes not requiring serialisation */ #define ser_bytes(x, len) memcpy(ser_ptr, (x), (len)), ser_ptr += (len) -/* Binary byte stream not requiring serialisation (length obtained by sizeof) */ -#define ser_buffer(x) ser_bytes((x), (sizeof (x))) +/* Binary byte stream not requiring serialisation (length obtained by sizeof) */ +#define ser_buffer(x) ser_bytes((x), (sizeof (x))) /* Binary string not requiring serialization */ -#define ser_string(x) ser_ptr += serial_string(ser_ptr, (x)) +#define ser_string(x) ser_ptr += serial_string(ser_ptr, (x)) -/* Unserialisation */ +/* Unserialisation */ /* 8 bit signed integer */ -#define unser_int8(x) (x) = *ser_ptr++ +#define unser_int8(x) (x) = *ser_ptr++ /* 8 bit unsigned integer */ -#define unser_uint8(x) (x) = *ser_ptr++ +#define unser_uint8(x) (x) = *ser_ptr++ /* 16 bit signed integer */ -#define unser_int16(x) (x) = unserial_int16(&ser_ptr) +#define unser_int16(x) (x) = unserial_int16(&ser_ptr) /* 16 bit unsigned integer */ #define unser_uint16(x) (x) = unserial_uint16(&ser_ptr) /* 32 bit signed integer */ -#define unser_int32(x) (x) = unserial_int32(&ser_ptr) +#define unser_int32(x) (x) = unserial_int32(&ser_ptr) /* 32 bit unsigned integer */ #define unser_uint32(x) (x) = unserial_uint32(&ser_ptr) /* 64 bit signed integer */ -#define unser_int64(x) (x) = unserial_int64(&ser_ptr) +#define unser_int64(x) (x) = unserial_int64(&ser_ptr) /* 64 bit unsigned integer */ #define unser_uint64(x) (x) = unserial_uint64(&ser_ptr) @@ -141,7 +144,7 @@ extern int unserial_string(uint8_t * ptr, char * str); /* Binary byte stream len bytes not requiring serialisation */ #define unser_bytes(x, len) memcpy((x), ser_ptr, (len)), ser_ptr += (len) -/* Binary byte stream not requiring serialisation (length obtained by sizeof) */ +/* Binary byte stream not requiring serialisation (length obtained by sizeof) */ #define unser_buffer(x) unser_bytes((x), (sizeof (x))) /* Binary string not requiring serialization */ diff --git a/bacula/src/lib/signal.c b/bacula/src/lib/signal.c index 5cb3c147be..0b9fe5bc79 100644 --- a/bacula/src/lib/signal.c +++ b/bacula/src/lib/signal.c @@ -2,6 +2,8 @@ * Signal handlers for Bacula daemons * * Kern Sibbald, April 2000 + * + * Version $Id$ * * Note, we probably should do a core dump for the serious * signals such as SIGBUS, SIGPFE, ... diff --git a/bacula/src/lib/smartall.c b/bacula/src/lib/smartall.c index dfc822c4d6..c5596e5d2c 100644 --- a/bacula/src/lib/smartall.c +++ b/bacula/src/lib/smartall.c @@ -13,6 +13,9 @@ http://www.fourmilab.ch/smartall/ + + Version $Id$ + */ /* diff --git a/bacula/src/lib/smartall.h b/bacula/src/lib/smartall.h index 13acdf002a..5405aa2e5c 100644 --- a/bacula/src/lib/smartall.h +++ b/bacula/src/lib/smartall.h @@ -1,6 +1,8 @@ /* - Definitions for the smart memory allocator + Definitions for the smart memory allocator + + Version $Id$ */ @@ -30,15 +32,15 @@ typedef enum {False = 0, True = 1} Boolean; extern void *sm_malloc(char *fname, int lineno, unsigned int nbytes), - *sm_calloc(char *fname, int lineno, - unsigned int nelem, unsigned int elsize), - *sm_realloc(char *fname, int lineno, void *ptr, unsigned int size), - *actuallymalloc(unsigned int size), - *actuallycalloc(unsigned int nelem, unsigned int elsize), - *actuallyrealloc(void *ptr, unsigned int size); + *sm_calloc(char *fname, int lineno, + unsigned int nelem, unsigned int elsize), + *sm_realloc(char *fname, int lineno, void *ptr, unsigned int size), + *actuallymalloc(unsigned int size), + *actuallycalloc(unsigned int nelem, unsigned int elsize), + *actuallyrealloc(void *ptr, unsigned int size); extern void sm_free(char *fname, int lineno, void *fp); extern void actuallyfree(void *cp), - sm_dump(Boolean bufdump), sm_static(int mode); + sm_dump(Boolean bufdump), sm_static(int mode); extern void sm_new_owner(char *fname, int lineno, char *buf); #ifdef SMCHECK @@ -77,7 +79,7 @@ extern int sm_check_rtn(char *fname, int lineno, Boolean bufdump); #define sm_check_rtn(f, l, fl) 1 extern void *b_malloc(); -#define malloc(x) b_malloc(__FILE__, __LINE__, (x)) +#define malloc(x) b_malloc(__FILE__, __LINE__, (x)) #endif diff --git a/bacula/src/lib/util.c b/bacula/src/lib/util.c index 1235e7ffb1..b8e5803378 100644 --- a/bacula/src/lib/util.c +++ b/bacula/src/lib/util.c @@ -2,6 +2,8 @@ * util.c miscellaneous utility subroutines for Bacula * * Kern Sibbald, MM + * + * Version $Id$ */ /* diff --git a/bacula/src/lib/waitq.h b/bacula/src/lib/waitq.h index 152b66e3af..0691f455df 100644 --- a/bacula/src/lib/waitq.h +++ b/bacula/src/lib/waitq.h @@ -7,6 +7,8 @@ * This code inspired from "Programming with POSIX Threads", by * David R. Butenhof * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -36,20 +38,20 @@ */ typedef struct waitq_ele_tag { struct waitq_ele_tag *next; - int done_flag; /* predicate for wait */ - pthread_cont_t done; /* wait for completion */ - void *msg; /* message to be passed */ + int done_flag; /* predicate for wait */ + pthread_cont_t done; /* wait for completion */ + void *msg; /* message to be passed */ } waitq_ele_t; /* * Structure describing a wait queue */ typedef struct workq_tag { - pthread_mutex_t mutex; /* queue access control */ - pthread_cond_t wait_req; /* wait for OK */ - int num_msgs; /* number of waiters */ - waitq_ele_t *first; /* wait queue first item */ - waitq_ele_t *last; /* wait queue last item */ + pthread_mutex_t mutex; /* queue access control */ + pthread_cond_t wait_req; /* wait for OK */ + int num_msgs; /* number of waiters */ + waitq_ele_t *first; /* wait queue first item */ + waitq_ele_t *last; /* wait queue last item */ } workq_t; extern int waitq_init(waitq_t *wq); diff --git a/bacula/src/lib/workq.c b/bacula/src/lib/workq.c index 2a5d512755..f8b01065bb 100755 --- a/bacula/src/lib/workq.c +++ b/bacula/src/lib/workq.c @@ -4,6 +4,8 @@ * * Kern Sibbald, January MMI * + * Version $Id$ + * * This code adapted from "Programming with POSIX Threads", by * David R. Butenhof * diff --git a/bacula/src/lib/workq.h b/bacula/src/lib/workq.h index a0226f2847..92c66e1f50 100644 --- a/bacula/src/lib/workq.h +++ b/bacula/src/lib/workq.h @@ -7,6 +7,7 @@ * This code adapted from "Programming with POSIX Threads", by * David R. Butenhof * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -36,32 +37,32 @@ */ typedef struct workq_ele_tag { struct workq_ele_tag *next; - void *data; + void *data; } workq_ele_t; /* * Structure describing a work queue */ typedef struct workq_tag { - pthread_mutex_t mutex; /* queue access control */ - pthread_cond_t work; /* wait for work */ - pthread_attr_t attr; /* create detached threads */ - workq_ele_t *first, *last; /* work queue */ - int valid; /* queue initialized */ - int quit; /* workq should quit */ - int max_workers; /* max threads */ - int num_workers; /* current threads */ - int idle_workers; /* idle threads */ - void (*engine)(void *arg); /* user engine */ + pthread_mutex_t mutex; /* queue access control */ + pthread_cond_t work; /* wait for work */ + pthread_attr_t attr; /* create detached threads */ + workq_ele_t *first, *last; /* work queue */ + int valid; /* queue initialized */ + int quit; /* workq should quit */ + int max_workers; /* max threads */ + int num_workers; /* current threads */ + int idle_workers; /* idle threads */ + void (*engine)(void *arg); /* user engine */ } workq_t; #define WORKQ_VALID 0xdec1992 extern int workq_init( - workq_t *wq, - int threads, /* maximum threads */ - void (*engine)(void *) /* engine routine */ - ); + workq_t *wq, + int threads, /* maximum threads */ + void (*engine)(void *) /* engine routine */ + ); extern int workq_destroy(workq_t *wq); extern int workq_add(workq_t *wq, void *data); diff --git a/bacula/src/stored/append.c b/bacula/src/stored/append.c index 83f95674df..35a78771dc 100644 --- a/bacula/src/stored/append.c +++ b/bacula/src/stored/append.c @@ -1,6 +1,8 @@ /* * Append code for Storage daemon * Kern Sibbald, May MM + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index b064dd9070..d0f13a4b7a 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -3,7 +3,8 @@ * Reqests/commands from the Director are handled in dircmd.c * * Kern Sibbald, December 2000 - * + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/stored/authenticate.c b/bacula/src/stored/authenticate.c index dd76c767b5..77a41a9703 100644 --- a/bacula/src/stored/authenticate.c +++ b/bacula/src/stored/authenticate.c @@ -2,6 +2,8 @@ * Authenticate caller * * Kern Sibbald, October 2000 + * + * Version $Id$ * */ /* diff --git a/bacula/src/stored/bextract.c b/bacula/src/stored/bextract.c index 0ef4c84b27..40da3c4006 100644 --- a/bacula/src/stored/bextract.c +++ b/bacula/src/stored/bextract.c @@ -4,7 +4,7 @@ * * Kern E. Sibbald * - * $Id$ + * Version $Id$ * */ /* diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 9b648a6a6f..f36d742159 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -4,6 +4,8 @@ * * Kern Sibbald, March MMI * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/stored/block.h b/bacula/src/stored/block.h index b376f3b492..b1b51e77a6 100644 --- a/bacula/src/stored/block.h +++ b/bacula/src/stored/block.h @@ -3,6 +3,8 @@ * * Kern Sibbald * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -28,14 +30,14 @@ #ifndef __BLOCK_H #define __BLOCK_H 1 -#define MAX_BLOCK_LENGTH 500001 /* this is a sort of sanity check */ -#define DEFAULT_BLOCK_SIZE (512 * 126) /* 64,512 N.B. do not use 65,636 here */ +#define MAX_BLOCK_LENGTH 500001 /* this is a sort of sanity check */ +#define DEFAULT_BLOCK_SIZE (512 * 126) /* 64,512 N.B. do not use 65,636 here */ /* Block Header definitions. */ #define BLKHDR_ID "BB01" #define BLKHDR_ID_LENGTH 4 -#define BLKHDR_CS_LENGTH 4 /* checksum length */ -#define BLKHDR_LENGTH 16 /* Total length */ +#define BLKHDR_CS_LENGTH 4 /* checksum length */ +#define BLKHDR_LENGTH 16 /* Total length */ /* * This is the Media structure for a block header @@ -58,21 +60,21 @@ typedef struct s_block_hdr { * This is the memory structure for a device block. */ typedef struct s_dev_block { - struct s_dev_block *next; /* pointer to next one */ + struct s_dev_block *next; /* pointer to next one */ /* binbuf is the number of bytes remaining * in the buffer. For writes, it is bytes not yet written. * For reads, it is remaining bytes not yet read. */ - uint32_t binbuf; /* bytes in buffer */ - uint32_t block_len; /* length of current block read */ - uint32_t buf_len; /* max/default block length */ - uint32_t BlockNumber; /* sequential block number */ - uint32_t read_len; /* bytes read into buffer */ - int failed_write; /* set if write failed */ - char *bufp; /* pointer into buffer */ - char *buf; /* actual data buffer. This is a - * Pool buffer! - */ + uint32_t binbuf; /* bytes in buffer */ + uint32_t block_len; /* length of current block read */ + uint32_t buf_len; /* max/default block length */ + uint32_t BlockNumber; /* sequential block number */ + uint32_t read_len; /* bytes read into buffer */ + int failed_write; /* set if write failed */ + char *bufp; /* pointer into buffer */ + char *buf; /* actual data buffer. This is a + * Pool buffer! + */ } DEV_BLOCK; #endif diff --git a/bacula/src/stored/bls.c b/bacula/src/stored/bls.c index fbbdb52a52..d8c3cefeb5 100644 --- a/bacula/src/stored/bls.c +++ b/bacula/src/stored/bls.c @@ -2,7 +2,7 @@ * * Dumb program to do an "ls" of a Bacula 1.0 mortal file. * - * $Id$ + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index b3483fbe99..c8f26b3a34 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -7,7 +7,7 @@ * Kern E. Sibbald, December 2001 * * - * $Id$ + * Version $Id$ */ /* Copyright (C) 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index 9dcb553dd9..53cd5f8aa4 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -10,7 +10,7 @@ * Note, this program reads stored.conf, and will only * talk to devices that are configured. * - * $Id$ + * Version $Id$ * */ /* diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index a5fa9399a1..32cd48dec7 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -25,6 +25,8 @@ * a consequence has lead to something more contored than is * really necessary -- KES. Note, this contortion has been * corrected to a large extent by a rewrite (Apr MMI). + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index f71b77f83f..cb9845b5fa 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -2,6 +2,8 @@ * Definitions for using the Device functions in Bacula * Tape and File storage access * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -32,49 +34,49 @@ #define READ_ONLY 1 /* Generic status bits returned from status_dev() */ -#define MT_TAPE (1<<0) /* is tape device */ -#define MT_EOF (1<<1) /* just read EOF */ -#define MT_BOT (1<<2) /* at beginning of tape */ -#define MT_EOT (1<<3) /* end of tape reached */ -#define MT_SM (1<<4) /* DDS setmark */ -#define MT_EOD (1<<5) /* DDS at end of data */ -#define MT_WR_PROT (1<<6) /* tape write protected */ -#define MT_ONLINE (1<<7) /* tape online */ -#define MT_DR_OPEN (1<<8) /* tape door open */ -#define MT_IM_REP_EN (1<<9) /* immediate report enabled */ +#define MT_TAPE (1<<0) /* is tape device */ +#define MT_EOF (1<<1) /* just read EOF */ +#define MT_BOT (1<<2) /* at beginning of tape */ +#define MT_EOT (1<<3) /* end of tape reached */ +#define MT_SM (1<<4) /* DDS setmark */ +#define MT_EOD (1<<5) /* DDS at end of data */ +#define MT_WR_PROT (1<<6) /* tape write protected */ +#define MT_ONLINE (1<<7) /* tape online */ +#define MT_DR_OPEN (1<<8) /* tape door open */ +#define MT_IM_REP_EN (1<<9) /* immediate report enabled */ /* Bits for device capabilities */ -#define CAP_EOF 0x001 /* has MTWEOF */ -#define CAP_BSR 0x002 /* has MTBSR */ -#define CAP_BSF 0x004 /* has MTBSF */ -#define CAP_FSR 0x008 /* has MTFSR */ -#define CAP_FSF 0x010 /* has MTFSF */ -#define CAP_EOM 0x020 /* has MTEOM */ -#define CAP_REM 0x040 /* is removable media */ -#define CAP_RACCESS 0x080 /* is random access device */ -#define CAP_AUTOMOUNT 0x100 /* Read device at start to see what is there */ -#define CAP_LABEL 0x200 /* Label blank tapes */ -#define CAP_ANONVOLS 0x400 /* Mount without knowing volume name */ -#define CAP_ALWAYSOPEN 0x800 /* always keep device open */ +#define CAP_EOF 0x001 /* has MTWEOF */ +#define CAP_BSR 0x002 /* has MTBSR */ +#define CAP_BSF 0x004 /* has MTBSF */ +#define CAP_FSR 0x008 /* has MTFSR */ +#define CAP_FSF 0x010 /* has MTFSF */ +#define CAP_EOM 0x020 /* has MTEOM */ +#define CAP_REM 0x040 /* is removable media */ +#define CAP_RACCESS 0x080 /* is random access device */ +#define CAP_AUTOMOUNT 0x100 /* Read device at start to see what is there */ +#define CAP_LABEL 0x200 /* Label blank tapes */ +#define CAP_ANONVOLS 0x400 /* Mount without knowing volume name */ +#define CAP_ALWAYSOPEN 0x800 /* always keep device open */ /* Tape state bits */ -#define ST_OPENED 0x001 /* set when device opened */ -#define ST_TAPE 0x002 /* is a tape device */ -#define ST_LABEL 0x004 /* label found */ +#define ST_OPENED 0x001 /* set when device opened */ +#define ST_TAPE 0x002 /* is a tape device */ +#define ST_LABEL 0x004 /* label found */ #define ST_MALLOC 0x008 /* dev packet malloc'ed in init_dev() */ -#define ST_APPEND 0x010 /* ready for Bacula append */ -#define ST_READ 0x020 /* ready for Bacula read */ -#define ST_EOT 0x040 /* at end of tape */ -#define ST_WEOT 0x080 /* Got EOT on write */ -#define ST_EOF 0x100 /* Read EOF i.e. zero bytes */ -#define ST_NEXTVOL 0x200 /* Start writing on next volume */ -#define ST_SHORT 0x400 /* Short block read */ +#define ST_APPEND 0x010 /* ready for Bacula append */ +#define ST_READ 0x020 /* ready for Bacula read */ +#define ST_EOT 0x040 /* at end of tape */ +#define ST_WEOT 0x080 /* Got EOT on write */ +#define ST_EOF 0x100 /* Read EOF i.e. zero bytes */ +#define ST_NEXTVOL 0x200 /* Start writing on next volume */ +#define ST_SHORT 0x400 /* Short block read */ /* dev_blocked states (mutually exclusive) */ #define BST_NOT_BLOCKED 0 /* not blocked */ -#define BST_UNMOUNTED 1 /* User unmounted device */ +#define BST_UNMOUNTED 1 /* User unmounted device */ #define BST_WAITING_FOR_SYSOP 2 /* Waiting for operator to mount tape */ #define BST_DOING_ACQUIRE 3 /* Opening/validating/moving tape */ #define BST_WRITING_LABEL 4 /* Labeling a tape */ @@ -83,55 +85,55 @@ /* Volume Catalog Information structure definition */ typedef struct s_volume_catalog_info { /* Media info for the current Volume */ - uint32_t VolCatJobs; /* number of jobs on this Volume */ - uint32_t VolCatFiles; /* Number of files */ - uint32_t VolCatBlocks; /* Number of blocks */ - uint64_t VolCatBytes; /* Number of bytes written */ - uint32_t VolCatMounts; /* Number of mounts this volume */ - uint32_t VolCatErrors; /* Number of errors this volume */ - uint32_t VolCatWrites; /* Number of writes this volume */ - uint32_t VolCatReads; /* Number of reads this volume */ - uint32_t VolCatRecycles; /* Number of recycles this volume */ - uint64_t VolCatMaxBytes; /* max bytes to write */ + uint32_t VolCatJobs; /* number of jobs on this Volume */ + uint32_t VolCatFiles; /* Number of files */ + uint32_t VolCatBlocks; /* Number of blocks */ + uint64_t VolCatBytes; /* Number of bytes written */ + uint32_t VolCatMounts; /* Number of mounts this volume */ + uint32_t VolCatErrors; /* Number of errors this volume */ + uint32_t VolCatWrites; /* Number of writes this volume */ + uint32_t VolCatReads; /* Number of reads this volume */ + uint32_t VolCatRecycles; /* Number of recycles this volume */ + uint64_t VolCatMaxBytes; /* max bytes to write */ uint64_t VolCatCapacityBytes; /* capacity estimate */ - char VolCatStatus[20]; /* Volume status */ + char VolCatStatus[20]; /* Volume status */ char VolCatName[MAX_NAME_LENGTH]; /* Desired volume to mount */ } VOLUME_CAT_INFO; /* Device structure definition */ typedef struct s_device { - struct s_device *next; /* pointer to next open device */ - pthread_mutex_t mutex; /* access control */ - pthread_cond_t wait; /* thread wait variable */ + struct s_device *next; /* pointer to next open device */ + pthread_mutex_t mutex; /* access control */ + pthread_cond_t wait; /* thread wait variable */ pthread_cond_t wait_next_vol; /* wait for tape to be mounted */ - pthread_t no_wait_id; /* this thread must not wait */ - int dev_blocked; /* set if we must wait (i.e. change tape) */ - int num_waiting; /* number of threads waiting */ - int num_writers; /* number of writing threads */ - int use_count; /* usage count on this device */ - int fd; /* file descriptor */ - int capabilities; /* capabilities mask */ - int state; /* state mask */ - int dev_errno; /* Our own errno */ - int mode; /* read/write modes */ - char *dev_name; /* device name */ - char *errmsg; /* nicely edited error message */ - uint32_t block_num; /* current block number base 0 */ - uint32_t file; /* current file number base 0 */ + pthread_t no_wait_id; /* this thread must not wait */ + int dev_blocked; /* set if we must wait (i.e. change tape) */ + int num_waiting; /* number of threads waiting */ + int num_writers; /* number of writing threads */ + int use_count; /* usage count on this device */ + int fd; /* file descriptor */ + int capabilities; /* capabilities mask */ + int state; /* state mask */ + int dev_errno; /* Our own errno */ + int mode; /* read/write modes */ + char *dev_name; /* device name */ + char *errmsg; /* nicely edited error message */ + uint32_t block_num; /* current block number base 0 */ + uint32_t file; /* current file number base 0 */ uint32_t LastBlockNumWritten; /* last block written */ - uint32_t min_block_size; /* min block size */ - uint32_t max_block_size; /* max block size */ - uint32_t max_volume_jobs; /* max jobs to put on one volume */ - int64_t max_volume_files; /* max files to put on one volume */ - int64_t max_volume_size; /* max bytes to put on one volume */ - int64_t max_file_size; /* max file size in bytes */ - int64_t volume_capacity; /* advisory capacity */ - uint32_t max_rewind_wait; /* max secs to allow for rewind */ - void *device; /* pointer to Device Resource */ - - VOLUME_CAT_INFO VolCatInfo; /* Volume Catalog Information */ - struct Volume_Label VolHdr; /* Actual volume label */ + uint32_t min_block_size; /* min block size */ + uint32_t max_block_size; /* max block size */ + uint32_t max_volume_jobs; /* max jobs to put on one volume */ + int64_t max_volume_files; /* max files to put on one volume */ + int64_t max_volume_size; /* max bytes to put on one volume */ + int64_t max_file_size; /* max file size in bytes */ + int64_t volume_capacity; /* advisory capacity */ + uint32_t max_rewind_wait; /* max secs to allow for rewind */ + void *device; /* pointer to Device Resource */ + + VOLUME_CAT_INFO VolCatInfo; /* Volume Catalog Information */ + struct Volume_Label VolHdr; /* Actual volume label */ } DEVICE; @@ -170,7 +172,7 @@ typedef struct s_device { * dependent. Arrgggg! */ #ifndef MTEOM -#ifdef MTSEOD +#ifdef MTSEOD #define MTEOM MTSEOD #endif #ifdef MTEOD diff --git a/bacula/src/stored/device.c b/bacula/src/stored/device.c index 629fff8515..9eb02c702a 100644 --- a/bacula/src/stored/device.c +++ b/bacula/src/stored/device.c @@ -26,6 +26,7 @@ * * Kern Sibbald, MM, MMI * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -460,7 +461,7 @@ mount_next_vol: } /* *****FIXME**** we might do some checking for files too */ if (dev_is_tape(dev)) { - Jmsg(jcr, M_INFO, 0, _("Ready to write at EOM File=%d\n"), dev_file(dev)); + Jmsg(jcr, M_INFO, 0, _("Ready to append at EOM File=%d.\n"), dev_file(dev)); if (dev->VolCatInfo.VolCatFiles != dev_file(dev) + 1) { /* ****FIXME**** this should refuse to write on tape */ Jmsg(jcr, M_INFO, 0, _("Hey! Num files mismatch! Catalog Files=%d\n"), dev->VolCatInfo.VolCatFiles); diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index 4b81b14369..97b66a0c52 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -9,6 +9,8 @@ * File daemon commands are handled in fdcmd.c * * Kern Sibbald, May MMI + * + * Version $Id$ * */ /* diff --git a/bacula/src/stored/fd_cmds.c b/bacula/src/stored/fd_cmds.c index 1e4a3ece20..6280a8a12f 100644 --- a/bacula/src/stored/fd_cmds.c +++ b/bacula/src/stored/fd_cmds.c @@ -6,6 +6,8 @@ * then when the Storage daemon receives a proper connection from * the File daemon, control is passed here to handle the * subsequent File daemon commands. + * + * Version $Id$ * */ /* diff --git a/bacula/src/stored/job.c b/bacula/src/stored/job.c index 2866a1f259..9533f702ee 100644 --- a/bacula/src/stored/job.c +++ b/bacula/src/stored/job.c @@ -1,6 +1,8 @@ /* * Job control and execution for Storage Daemon * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index 8287cdffe2..f1d85154d5 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -4,6 +4,8 @@ * * Kern Sibbald, MM * + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/stored/protos.h b/bacula/src/stored/protos.h index f76b898c9a..e83494a21e 100644 --- a/bacula/src/stored/protos.h +++ b/bacula/src/stored/protos.h @@ -1,5 +1,7 @@ /* * Protypes for stored + * + * Version $Id$ */ /* diff --git a/bacula/src/stored/read.c b/bacula/src/stored/read.c index 8309a6558b..8d3c719de8 100644 --- a/bacula/src/stored/read.c +++ b/bacula/src/stored/read.c @@ -1,6 +1,8 @@ /* * Read code for Storage daemon * Kern Sibbald, November MM + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/stored/record.c b/bacula/src/stored/record.c index 92a8ea1536..382cb54792 100644 --- a/bacula/src/stored/record.c +++ b/bacula/src/stored/record.c @@ -4,6 +4,8 @@ * * Kern Sibbald, April MMI * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/stored/record.h b/bacula/src/stored/record.h index 6cf5c1f7d7..19a195807f 100644 --- a/bacula/src/stored/record.h +++ b/bacula/src/stored/record.h @@ -2,6 +2,8 @@ * Record, and label definitions for Bacula * media data format. * + * Version $Id$ + * */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -28,14 +30,14 @@ #define __RECORD_H 1 /* Return codes from read_device_volume_label() */ -#define VOL_NOT_READ 0 /* Volume label not read */ -#define VOL_OK 1 /* volume name OK */ -#define VOL_NO_LABEL 2 /* volume not labeled */ -#define VOL_IO_ERROR 3 /* volume I/O error */ -#define VOL_NAME_ERROR 4 /* Volume name mismatch */ -#define VOL_CREATE_ERROR 5 /* Error creating label */ -#define VOL_VERSION_ERROR 6 /* Bacula version error */ -#define VOL_LABEL_ERROR 7 /* Bad label type */ +#define VOL_NOT_READ 0 /* Volume label not read */ +#define VOL_OK 1 /* volume name OK */ +#define VOL_NO_LABEL 2 /* volume not labeled */ +#define VOL_IO_ERROR 3 /* volume I/O error */ +#define VOL_NAME_ERROR 4 /* Volume name mismatch */ +#define VOL_CREATE_ERROR 5 /* Error creating label */ +#define VOL_VERSION_ERROR 6 /* Bacula version error */ +#define VOL_LABEL_ERROR 7 /* Bad label type */ /* Length of Record Header (5 * 4 bytes) */ @@ -60,17 +62,17 @@ typedef struct s_record_hdr { * This is the memory structure for the record header. */ typedef struct s_dev_rec { - int sync; /* synchronous */ - uint32_t File; /* File number, returned if sync set */ - uint32_t Block; /* Block number, returned if sync set */ - uint32_t VolSessionId; /* sequential id within this session */ - uint32_t VolSessionTime; /* session start time */ - int32_t FileIndex; /* sequential file number */ - int32_t Stream; /* stream number */ - uint32_t data_len; /* current record length */ - uint32_t remainder; /* remaining bytes to read/write */ + int sync; /* synchronous */ + uint32_t File; /* File number, returned if sync set */ + uint32_t Block; /* Block number, returned if sync set */ + uint32_t VolSessionId; /* sequential id within this session */ + uint32_t VolSessionTime; /* session start time */ + int32_t FileIndex; /* sequential file number */ + int32_t Stream; /* stream number */ + uint32_t data_len; /* current record length */ + uint32_t remainder; /* remaining bytes to read/write */ uint8_t ser_buf[RECHDR_LENGTH]; /* serialized record header goes here */ - char *data; /* Record data. This MUST be a memory pool item */ + char *data; /* Record data. This MUST be a memory pool item */ } DEV_RECORD; @@ -79,11 +81,11 @@ typedef struct s_dev_rec { * Note, these values are negative to distinguish them * from user records where the FileIndex is forced positive. */ -#define PRE_LABEL -1 /* Vol label on unwritten tape */ -#define VOL_LABEL -2 /* Volume label first file */ -#define EOM_LABEL -3 /* Writen at end of tape */ -#define SOS_LABEL -4 /* Start of Session */ -#define EOS_LABEL -5 /* End of Session */ +#define PRE_LABEL -1 /* Vol label on unwritten tape */ +#define VOL_LABEL -2 /* Volume label first file */ +#define EOM_LABEL -3 /* Writen at end of tape */ +#define SOS_LABEL -4 /* Start of Session */ +#define EOS_LABEL -5 /* End of Session */ /* @@ -95,20 +97,20 @@ struct Volume_Label { * in the DEVICE buffer, but are not actually written * to the tape. */ - int32_t LabelType; /* This is written in header only */ - uint32_t LabelSize; /* length of serialized label */ + int32_t LabelType; /* This is written in header only */ + uint32_t LabelSize; /* length of serialized label */ /* * The items below this line are stored on * the tape */ - char Id[32]; /* Bacula Immortal ... */ + char Id[32]; /* Bacula Immortal ... */ - uint32_t VerNum; /* Label version number */ + uint32_t VerNum; /* Label version number */ - float64_t label_date; /* Date tape labeled */ - float64_t label_time; /* Time tape labeled */ - float64_t write_date; /* Date this label written */ - float64_t write_time; /* Time this label written */ + float64_t label_date; /* Date tape labeled */ + float64_t label_time; /* Time tape labeled */ + float64_t write_date; /* Date this label written */ + float64_t write_time; /* Time this label written */ char VolName[MAX_NAME_LENGTH]; /* Volume name */ char PrevVolName[MAX_NAME_LENGTH]; /* Previous Volume Name */ @@ -117,9 +119,9 @@ struct Volume_Label { char MediaType[MAX_NAME_LENGTH]; /* Type of this media */ char HostName[MAX_NAME_LENGTH]; /* Host name of writing computer */ - char LabelProg[32]; /* Label program name */ - char ProgVersion[32]; /* Program version */ - char ProgDate[32]; /* Program build date/time */ + char LabelProg[32]; /* Label program name */ + char ProgVersion[32]; /* Program version */ + char ProgDate[32]; /* Program build date/time */ }; #define SER_LENGTH_Volume_Label 1024 /* max serialised length of volume label */ @@ -132,15 +134,15 @@ typedef struct Volume_Label VOLUME_LABEL; * This record is at the beginning and end of each session */ struct Session_Label { - char Id[32]; /* Bacula Immortal ... */ + char Id[32]; /* Bacula Immortal ... */ - uint32_t VerNum; /* Label version number */ + uint32_t VerNum; /* Label version number */ - uint32_t JobId; /* Job id */ - uint32_t VolumeIndex; /* Sequence no of volume for this job */ + uint32_t JobId; /* Job id */ + uint32_t VolumeIndex; /* Sequence no of volume for this job */ - float64_t write_date; /* Date this label written */ - float64_t write_time; /* Time this label written */ + float64_t write_date; /* Date this label written */ + float64_t write_time; /* Time this label written */ char PoolName[MAX_NAME_LENGTH]; /* Pool name */ char PoolType[MAX_NAME_LENGTH]; /* Pool type */ @@ -157,6 +159,6 @@ struct Session_Label { }; typedef struct Session_Label SESSION_LABEL; -#define SERIAL_BUFSIZE 1024 /* volume serialisation buffer size */ +#define SERIAL_BUFSIZE 1024 /* volume serialisation buffer size */ #endif diff --git a/bacula/src/stored/stored.c b/bacula/src/stored/stored.c index 8164dd0491..9b151b0fd7 100644 --- a/bacula/src/stored/stored.c +++ b/bacula/src/stored/stored.c @@ -5,6 +5,8 @@ * and acts on them. When a request to append data is made, * it opens a data channel and accepts data from the * File daemon. + * + * Version $Id$ * */ /* diff --git a/bacula/src/stored/stored.h b/bacula/src/stored/stored.h index baa0b40f6e..7744daff6a 100644 --- a/bacula/src/stored/stored.h +++ b/bacula/src/stored/stored.h @@ -1,5 +1,7 @@ /* * Storage daemon specific defines and includes + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker @@ -45,6 +47,6 @@ struct s_shm { DEVICE dev[MAX_DEVICES]; }; -extern char errmsg[]; /* general error message */ +extern char errmsg[]; /* general error message */ #endif /* __STORED_H_ */ diff --git a/bacula/src/stored/stored_conf.c b/bacula/src/stored/stored_conf.c index 1c97cff4bb..43e86213b7 100644 --- a/bacula/src/stored/stored_conf.c +++ b/bacula/src/stored/stored_conf.c @@ -2,6 +2,8 @@ * Configuration file parser for Bacula Storage daemon * * Kern Sibbald, March MM + * + * Version $Id$ */ /* diff --git a/bacula/src/stored/stored_conf.h b/bacula/src/stored/stored_conf.h index dcbc813396..6c2f946107 100644 --- a/bacula/src/stored/stored_conf.h +++ b/bacula/src/stored/stored_conf.h @@ -1,5 +1,7 @@ /* * Resource codes -- they must be sequential for indexing + * + * Version $Id$ */ /* Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker diff --git a/bacula/src/version.h b/bacula/src/version.h index a9e51fb515..3297fe005f 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #define VERSION "1.20" #define VSTRING "1" -#define DATE "16 May 2002" -#define LSMDATE "16May02" +#define DATE "19 May 2002" +#define LSMDATE "19May02" /* Debug flags */ #define DEBUG 1