Coda Distributed File System
partition.h
Go to the documentation of this file.
1/* BLURB gpl
2
3 Coda File System
4 Release 6
5
6 Copyright (c) 1987-2003 Carnegie Mellon University
7 Additional copyrights listed below
8
9This code is distributed "AS IS" without warranty of any kind under
10the terms of the GNU General Public Licence Version 2, as shown in the
11file LICENSE. The technical and financial contributors to Coda are
12listed in the file CREDITS.
13
14 Additional copyrights
15 none currently
16
17#*/
18
19#ifndef PARTITION_INCLUDED
20#define PARTITION_INCLUDED 1
21#include <sys/types.h>
22#include <sys/stat.h>
23#include <sys/param.h>
24#include <fcntl.h>
25#include <dirent.h>
26
27#include <dllist.h>
28#include <vcrcommon.h>
29#include <voltypes.h>
30#include <lwp/lwp.h>
31#include <lwp/lock.h>
32#include <vicetab.h>
33#include <viceinode.h>
34
35/* exported variables */
36extern struct dllist_head DiskPartitionList;
37
39
42 char name[MAXPATHLEN]; /* Directory where partition can be found */
43 char devName[MAXPATHLEN]; /* Device mounted on name */
44 Device device; /* device number MUST be unique */
45 int lock_fd; /* lock fd if locked; otherwise -1;
46 Not used by the file server */
47 unsigned long free; /* Total number of blocks (1K) presumed
48 available on this partition (accounting
49 for the minfree parameter for the
50 partition). This is adjusted
51 approximately by the sizes of files
52 and directories read/written, and
53 periodically the superblock is read and
54 this is recomputed. */
55 unsigned long totalUsable; /* Total number of blocks available on this
56 partition, taking into account the minfree
57 parameter for the partition The
58 superblock is re-read periodically by
59 VSetPartitionDiskUsage().) */
60 unsigned int minFree; /* Percentage to be kept free, as last read
61 from the superblock (not used?) */
62 struct inodeops *ops; /* methods to access partition */
63 union PartitionData *d; /* private data stored with the partition */
64};
65
66void DP_Init(const char *tabfile, const char *hostname);
67void DP_LockPartition(char *name);
68void DP_UnlockPartition(char *name);
69
70struct DiskPartition *DP_Find(Device devno);
71struct DiskPartition *DP_Get(char *name);
72void DP_SetUsage(struct DiskPartition *dp);
73void DP_ResetUsage();
74void DP_PrintStats(FILE *fp);
75
76#include <simpleifs.h>
77#include <ftreeifs.h>
78
82 /* struct part_linuxext2_opts ext2; */
83};
84
85struct inodeops {
86 Inode (*icreate)(struct DiskPartition *, u_long, u_long, u_long, u_long);
87 int (*iopen)(struct DiskPartition *, Inode, int);
88 int (*iread)(struct DiskPartition *, Inode inode_number, Inode parent_vol,
89 int offset, char *buf, int count);
90 int (*iwrite)(struct DiskPartition *, Inode inode_number, Inode parent_vol,
91 int offset, char *buf, int count);
92 int (*iinc)(struct DiskPartition *, Inode inode_number, Inode parent_vol);
93 int (*idec)(struct DiskPartition *, Inode inode_number, Inode parent_vol);
94 int (*get_header)(struct DiskPartition *, struct i_header *header,
95 Inode ino);
96 int (*put_header)(struct DiskPartition *, struct i_header *header,
97 Inode ino);
98 int (*init)(union PartitionData **data, Partent partent, Device *dev);
99 int (*magic)();
100 int (*ListCodaInodes)(struct DiskPartition *, char *resultFile,
101 int (*judgeInode)(struct ViceInodeInfo *, VolumeId),
102 int judgeParam);
103};
104
105extern struct inodeops inodeops_simple;
106extern struct inodeops inodeops_ftree;
107extern struct inodeops inodeops_backup;
108
109#endif /* PARTITION_INCLUDED */
char * hostname(char *name)
Definition: util.c:212
#define MAXPATHLEN
struct direct * dp
Definition: dir.cc:38
name
Definition: pwdtopdbtool.py:40
void DP_LockPartition(char *name)
Definition: partition.c:272
struct inodeops inodeops_backup
Definition: backupifs.c:45
struct DiskPartition * DP_Get(char *name)
Definition: partition.c:181
void DP_SetUsage(struct DiskPartition *dp)
Definition: partition.c:202
void DP_ResetUsage()
Definition: partition.c:246
struct inodeops inodeops_ftree
Definition: ftreeifs.c:76
struct DiskPartition * DP_Find(Device devno)
Definition: partition.c:164
void DP_PrintStats(FILE *fp)
Definition: partition.c:259
void DP_UnlockPartition(char *name)
Definition: partition.c:286
struct dllist_head DiskPartitionList
Definition: partition.c:60
struct inodeops inodeops_simple
Definition: simpleifs.c:92
void DP_Init(const char *tabfile, const char *hostname)
Definition: partition.c:68
Definition: partition.h:40
struct inodeops * ops
Definition: partition.h:62
unsigned long free
Definition: partition.h:47
char name[MAXPATHLEN]
Definition: partition.h:42
union PartitionData * d
Definition: partition.h:63
char devName[MAXPATHLEN]
Definition: partition.h:43
int lock_fd
Definition: partition.h:45
Device device
Definition: partition.h:44
unsigned long totalUsable
Definition: partition.h:55
struct dllist_head dp_chain
Definition: partition.h:41
unsigned int minFree
Definition: partition.h:60
Definition: vicetab.c:28
Definition: viceinode.h:59
Definition: dllist.h:30
Definition: viceinode.h:46
Definition: partition.h:85
int(* put_header)(struct DiskPartition *, struct i_header *header, Inode ino)
Definition: partition.h:96
int(* iread)(struct DiskPartition *, Inode inode_number, Inode parent_vol, int offset, char *buf, int count)
Definition: partition.h:88
int(* idec)(struct DiskPartition *, Inode inode_number, Inode parent_vol)
Definition: partition.h:93
int(* magic)()
Definition: partition.h:99
int(* iopen)(struct DiskPartition *, Inode, int)
Definition: partition.h:87
int(* init)(union PartitionData **data, Partent partent, Device *dev)
Definition: partition.h:98
int(* ListCodaInodes)(struct DiskPartition *, char *resultFile, int(*judgeInode)(struct ViceInodeInfo *, VolumeId), int judgeParam)
Definition: partition.h:100
int(* get_header)(struct DiskPartition *, struct i_header *header, Inode ino)
Definition: partition.h:94
int(* iwrite)(struct DiskPartition *, Inode inode_number, Inode parent_vol, int offset, char *buf, int count)
Definition: partition.h:90
int(* iinc)(struct DiskPartition *, Inode inode_number, Inode parent_vol)
Definition: partition.h:92
Inode(* icreate)(struct DiskPartition *, u_long, u_long, u_long, u_long)
Definition: partition.h:86
Definition: ftreeifs.h:23
Definition: simpleifs.h:34
Definition: partition.h:79
struct part_simple_opts simple
Definition: partition.h:81
struct part_ftree_opts ftree
Definition: partition.h:80
bit32 Device
Definition: voltypes.h:60
bit32 Inode
Definition: voltypes.h:61