2 * Copyright 2000, International Business Machines Corporation and others.
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
13 Institution: The Information Technology Center, Carnegie-Mellon University
17 #include <afs/param.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"
26 #define AFS_DSKDEV "/dev"
27 #define AFS_RDSKDEV "/dev/r"
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)
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.
40 #define VICE_ALWAYSATTACH_FILE "AlwaysAttach"
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.
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
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 */
79 int f_files; /* total number of files in this partition */
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.
88 #include <WINNT/vptab.h>
89 extern int VValidVPTEntry(struct vptab *vptp);
93 struct Volume; /* Potentially forward definition */
95 extern struct DiskPartition *DiskPartitionList;
96 extern struct DiskPartition *VGetPartition();
97 extern int VAttachPartitions(void);
98 extern void VLockPartition(char *name);
99 extern void VLockPartition_r(char *name);
100 extern void VUnlockPartition(char *name);
101 extern void VUnlockPartition_r(char *name);
102 extern void VResetDiskUsage(void);
103 extern void VResetDiskUsage_r(void);
104 extern void VSetPartitionDiskUsage(register struct DiskPartition *dp);
105 extern void VSetPartitionDiskUsage_r(register struct DiskPartition *dp);
106 extern char *VPartitionPath(struct DiskPartition *p);
107 extern void VAdjustDiskUsage(Error * ec, struct Volume *vp,
108 afs_sfsize_t blocks, afs_sfsize_t checkBlocks);
109 extern int VDiskUsage(struct Volume *vp, afs_sfsize_t blocks);
110 extern void VPrintDiskStats(void);