Initial IBM OpenAFS 1.0 tree
[openafs.git] / src / vol / partition.h
1
2 #if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS)
3 #endif
4
5 /*
6  * (C) COPYRIGHT IBM CORPORATION 1987
7  * LICENSED MATERIALS - PROPERTY OF IBM
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 /* For NT, the roles of "name" and "devName" are reversed. That is, "name"
35  * refers to the drive letter name and "devName" refers to the /vicep style
36  * or name. The reason for this is that a lot of places assume that "name"
37  * is the right thing to use to access the partition. Silly of them isn't it?
38  * The NT version of VInitPartition does the intial setup. There is an NT
39  * variant for VGetPartition as well. Also, the VolPartitionInfo RPC does
40  * a swap before sending the data out on the wire.
41  */
42 struct DiskPartition {
43     struct DiskPartition *next;
44     char        name[32];       /* Mounted partition name */
45     char        devName[32];    /* Device mounted on */
46     Device      device;         /* device number */
47     int         lock_fd;        /* File descriptor of this partition if locked; otherwise -1;
48                                    Not used by the file server */
49     int         free;           /* Total number of blocks (1K) presumed
50                                    available on this partition (accounting
51                                    for the minfree parameter for the
52                                    partition).  This is adjusted
53                                    approximately by the sizes of files
54                                    and directories read/written, and
55                                    periodically the superblock is read and
56                                    this is recomputed.  This number can
57                                    be negative, if the partition starts
58                                    out too full */
59     int         totalUsable;    /* Total number of blocks available on this
60                                    partition, taking into account the minfree
61                                    parameter for the partition (see the
62                                    4.2bsd command tunefs, but note that the
63                                    bug mentioned there--that the superblock
64                                    is not reread--does not apply here.  The
65                                    superblock is re-read periodically by
66                                    VSetPartitionDiskUsage().) */
67     int         minFree;        /* Number blocks to be kept free, as last read
68                                    from the superblock */
69     int         flags;
70     int         f_files;        /* total number of files in this partition */
71 };
72 #define PART_DONTUPDATE 1
73 #define PART_DUPLICATE  2 /* NT - used if we find more than one partition 
74                            * using the same drive. Will be dumped before
75                            * all partitions attached.
76                            */
77
78 #ifdef AFS_NT40_ENV
79 #include <WINNT/vptab.h>
80 extern int VValidVPTEntry(struct vptab *vptp);
81 #endif
82
83
84 extern struct DiskPartition *DiskPartitionList;
85 extern struct DiskPartition *VGetPartition();
86 extern int VAttachPartitions(void);
87 extern void VLockPartition(char *name);
88 extern void VLockPartition_r(char *name);
89 extern void VUnlockPartition(char *name);
90 extern void VUnlockPartition_r(char *name);
91 extern void VResetDiskUsage(void);
92 extern void VResetDiskUsage_r(void);
93 extern void VSetPartitionDiskUsage(register struct DiskPartition *dp);
94 extern void VSetPartitionDiskUsage_r(register struct DiskPartition *dp);
95 extern char *VPartitionPath(struct DiskPartition *p);
96 /*extern void VAdjustDiskUsage(Error *ec, Volume *vp, afs_int32 blocks,
97                              afs_int32 checkBlocks); */
98 extern void VPrintDiskStats(void);
99