1 /* $Id: cnfs-private.h 5975 2002-12-11 04:51:43Z rra $
3 ** CNFS disk/file mode header file.
7 #define CNFS_PRIVATE_H 1
12 #define _PATH_CYCBUFFCONFIG "cycbuff.conf"
14 /* Page boundary on which to mmap() the CNFS article usage header. Should be
15 a multiple of the pagesize for all the architectures you expect might need
16 access to your CNFS buffer. If you don't expect to share your buffer
17 across several platforms, you can use 'pagesize' here. */
18 #define CNFS_HDR_PAGESIZE 16384
20 #define CNFS_MAGICV1 "Cycbuff" /* CNFSMASIZ bytes */
21 #define CNFS_MAGICV2 "CBuf1" /* CNFSMASIZ bytes */
22 #define CNFS_MAGICV3 "CBuf3" /* CNFSMASIZ bytes */
23 #define CNFS_BLOCKSIZE 512 /* Unit block size we'll work with */
25 /* Amount of data stored at beginning of CYCBUFF before the bitfield */
26 #define CNFS_BEFOREBITF (1 * CNFS_BLOCKSIZE)
28 struct metacycbuff; /* Definition comes below */
30 #define CNFSMAXCYCBUFFNAME 8
32 #define CNFSNASIZ 16 /* Effective size is 9, not 16 */
34 #define CNFSLASIZ 16 /* Match length of ASCII hex off_t
37 typedef struct _CYCBUFF {
38 char name[CNFSNASIZ];/* Symbolic name */
39 char path[CNFSPASIZ];/* Path to file */
40 off_t len; /* Length of writable area, in bytes */
41 off_t free; /* Offset (relative to byte 0 of file) to first
42 freely available byte */
43 time_t updated; /* Time of last update to header */
44 int fd; /* file descriptor for this cycbuff */
45 uint32_t cyclenum; /* Number of current cycle, 0 = invalid */
46 int magicver; /* Magic version number */
47 void * bitfield; /* Bitfield for article in use */
48 off_t minartoffset; /* The minimum offset allowed for article
50 bool needflush; /* true if CYCBUFFEXTERN is needed to be
52 struct _CYCBUFF *next;
53 bool currentbuff; /* true if this cycbuff is currently used */
54 char metaname[CNFSNASIZ];/* Symbolic name of meta */
55 int order; /* Order in meta, start from 1 not 0 */
59 ** A structure suitable for thwapping onto disk in a quasi-portable way.
60 ** We assume that sizeof(CYCBUFFEXTERN) < CNFS_BLOCKSIZE.
63 char magic[CNFSMASIZ];
66 char lena[CNFSLASIZ]; /* ASCII version of len */
67 char freea[CNFSLASIZ]; /* ASCII version of free */
68 char updateda[CNFSLASIZ]; /* ASCII version of updated */
69 char cyclenuma[CNFSLASIZ]; /* ASCII version of cyclenum */
70 char metaname[CNFSNASIZ];
71 char orderinmeta[CNFSLASIZ];
72 char currentbuff[CNFSMASIZ];
75 #define METACYCBUFF_UPDATE 25
76 #define REFRESH_INTERVAL 30
78 typedef enum {INTERLEAVE, SEQUENTIAL} METAMODE;
80 typedef struct metacycbuff {
81 char *name; /* Symbolic name of the pool */
82 int count; /* Number of files/devs in this pool */
83 CYCBUFF **members; /* Member cycbuffs */
84 int memb_next; /* Index to next member to write onto */
85 unsigned long write_count; /* Number of writes since last header flush */
86 struct metacycbuff *next;
90 typedef struct _CNFSEXPIRERULES {
93 struct _CNFSEXPIRERULES *next;
97 long size; /* Size of the article */
98 time_t arrived; /* This is the time when article arrived */
99 STORAGECLASS class; /* storage class */
102 /* uncomment below for old cnfs spool */
103 /* #ifdef OLD_CNFS */
105 long zottf; /* This should always be 0x01234*/
106 long size; /* Size of the article */
107 char m_id[64]; /* We'll only store up to 63 bytes of the
108 Message-ID, that should be good enough */
111 #endif /* !CNFS_PRIVATE_H */