reindent-20030715
[openafs.git] / src / vol / partition.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /*
11         System:         VICE-TWO
12         Module:         partition.h
13         Institution:    The Information Technology Center, Carnegie-Mellon University
14
15  */
16
17 #include <afs/param.h>
18 #include "nfs.h"
19 #if     defined(AFS_HPUX_ENV)
20 #define AFS_DSKDEV      "/dev/dsk"
21 #define AFS_RDSKDEV     "/dev/rdsk/"
22 #define AFS_LVOLDEV     "/dev/vg0"
23 #define AFS_ACVOLDEV    "/dev/ac"
24 #define AFS_RACVOLDEV   "/dev/ac/r"
25 #else
26 #define AFS_DSKDEV      "/dev"
27 #define AFS_RDSKDEV     "/dev/r"
28 #endif
29
30 /* All Vice partitions on a server will have the following name prefix */
31 #define VICE_PARTITION_PREFIX   "/vicep"
32 #define VICE_PREFIX_SIZE        (sizeof(VICE_PARTITION_PREFIX)-1)
33
34 /* If a file by this name exists in a /vicepX directory, it means that
35  * this directory should be used as an AFS partition even if it's not
36  * on a separate partition (for instance if it's part of a large /).
37  * This feature only works with the NAMEI fileserver.
38  */
39 #ifdef AFS_NAMEI_ENV
40 #define VICE_ALWAYSATTACH_FILE  "AlwaysAttach"
41 #endif
42
43 /* For NT, the roles of "name" and "devName" are reversed. That is, "name"
44  * refers to the drive letter name and "devName" refers to the /vicep style
45  * or name. The reason for this is that a lot of places assume that "name"
46  * is the right thing to use to access the partition. Silly of them isn't it?
47  * The NT version of VInitPartition does the intial setup. There is an NT
48  * variant for VGetPartition as well. Also, the VolPartitionInfo RPC does
49  * a swap before sending the data out on the wire.
50  */
51 struct DiskPartition {
52     struct DiskPartition *next;
53     char *name;                 /* Mounted partition name */
54     char *devName;              /* Device mounted on */
55     Device device;              /* device number */
56     int lock_fd;                /* File descriptor of this partition if locked; otherwise -1;
57                                  * Not used by the file server */
58     int free;                   /* Total number of blocks (1K) presumed
59                                  * available on this partition (accounting
60                                  * for the minfree parameter for the
61                                  * partition).  This is adjusted
62                                  * approximately by the sizes of files
63                                  * and directories read/written, and
64                                  * periodically the superblock is read and
65                                  * this is recomputed.  This number can
66                                  * be negative, if the partition starts
67                                  * out too full */
68     int totalUsable;            /* Total number of blocks available on this
69                                  * partition, taking into account the minfree
70                                  * parameter for the partition (see the
71                                  * 4.2bsd command tunefs, but note that the
72                                  * bug mentioned there--that the superblock
73                                  * is not reread--does not apply here.  The
74                                  * superblock is re-read periodically by
75                                  * VSetPartitionDiskUsage().) */
76     int minFree;                /* Number blocks to be kept free, as last read
77                                  * from the superblock */
78     int flags;
79     int f_files;                /* total number of files in this partition */
80 };
81 #define PART_DONTUPDATE 1
82 #define PART_DUPLICATE  2       /* NT - used if we find more than one partition 
83                                  * using the same drive. Will be dumped before
84                                  * all partitions attached.
85                                  */
86
87 #ifdef AFS_NT40_ENV
88 #include <WINNT/vptab.h>
89 extern int VValidVPTEntry(struct vptab *vptp);
90 #endif
91
92
93 extern struct DiskPartition *DiskPartitionList;
94 extern struct DiskPartition *VGetPartition();
95 extern int VAttachPartitions(void);
96 extern void VLockPartition(char *name);
97 extern void VLockPartition_r(char *name);
98 extern void VUnlockPartition(char *name);
99 extern void VUnlockPartition_r(char *name);
100 extern void VResetDiskUsage(void);
101 extern void VResetDiskUsage_r(void);
102 extern void VSetPartitionDiskUsage(register struct DiskPartition *dp);
103 extern void VSetPartitionDiskUsage_r(register struct DiskPartition *dp);
104 extern char *VPartitionPath(struct DiskPartition *p);
105 /*extern void VAdjustDiskUsage(Error *ec, Volume *vp, afs_int32 blocks,
106                              afs_int32 checkBlocks); */
107 extern void VPrintDiskStats(void);