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
9 * Portions Copyright (c) 2006 Sine Nomine Associates
15 Institution: The Information Technology Center, Carnegie-Mellon University
19 #include <afs/param.h>
21 #if defined(AFS_HPUX_ENV)
22 #define AFS_DSKDEV "/dev/dsk"
23 #define AFS_RDSKDEV "/dev/rdsk/"
24 #define AFS_LVOLDEV "/dev/vg0"
25 #define AFS_ACVOLDEV "/dev/ac"
26 #define AFS_RACVOLDEV "/dev/ac/r"
28 #define AFS_DSKDEV "/dev"
29 #define AFS_RDSKDEV "/dev/r"
33 /* All Vice partitions on a server will have the following name prefix */
34 #define VICE_PARTITION_PREFIX "/vicep"
35 #define VICE_PREFIX_SIZE (sizeof(VICE_PARTITION_PREFIX)-1)
37 /* If a file by this name exists in a /vicepX directory, it means that
38 * this directory should be used as an AFS partition even if it's not
39 * on a separate partition (for instance if it's part of a large /).
40 * This feature only works with the NAMEI fileserver.
43 #define VICE_ALWAYSATTACH_FILE "AlwaysAttach"
46 /* For NT, the roles of "name" and "devName" are reversed. That is, "name"
47 * refers to the drive letter name and "devName" refers to the /vicep style
48 * or name. The reason for this is that a lot of places assume that "name"
49 * is the right thing to use to access the partition. Silly of them isn't it?
50 * The NT version of VInitPartition does the intial setup. There is an NT
51 * variant for VGetPartition as well. Also, the VolPartitionInfo RPC does
52 * a swap before sending the data out on the wire.
54 struct DiskPartition64 {
55 struct DiskPartition64 *next;
56 char *name; /* Mounted partition name */
57 char *devName; /* Device mounted on */
58 Device device; /* device number */
59 afs_int32 index; /* partition index (0<=x<=VOLMAXPARTS) */
60 int lock_fd; /* File descriptor of this partition if locked; otherwise -1;
61 * Not used by the file server */
62 afs_int64 free; /* Total number of blocks (1K) presumed
63 * available on this partition (accounting
64 * for the minfree parameter for the
65 * partition). This is adjusted
66 * approximately by the sizes of files
67 * and directories read/written, and
68 * periodically the superblock is read and
69 * this is recomputed. This number can
70 * be negative, if the partition starts
72 afs_int64 totalUsable; /* Total number of blocks available on this
73 * partition, taking into account the minfree
74 * parameter for the partition (see the
75 * 4.2bsd command tunefs, but note that the
76 * bug mentioned there--that the superblock
77 * is not reread--does not apply here. The
78 * superblock is re-read periodically by
79 * VSetPartitionDiskUsage().) */
80 afs_int64 minFree; /* Number blocks to be kept free, as last read
81 * from the superblock */
83 afs_int64 f_files; /* total number of files in this partition */
84 #ifdef AFS_DEMAND_ATTACH_FS
86 struct rx_queue head; /* list of volumes on this partition (VByPList) */
87 afs_uint32 len; /* length of volume list */
88 int busy; /* asynch vol list op in progress */
89 pthread_cond_t cv; /* vol_list.busy change cond var */
91 #endif /* AFS_DEMAND_ATTACH_FS */
94 struct DiskPartitionStats64 {
96 afs_int64 totalUsable;
99 #ifdef AFS_DEMAND_ATTACH_FS
100 afs_int32 vol_list_len;
104 #define PART_DONTUPDATE 1
105 #define PART_DUPLICATE 2 /* NT - used if we find more than one partition
106 * using the same drive. Will be dumped before
107 * all partitions attached.
111 #include <WINNT/vptab.h>
112 extern int VValidVPTEntry(struct vptab *vptp);
116 struct Volume; /* Potentially forward definition */
118 extern struct DiskPartition64 *DiskPartitionList;
119 extern struct DiskPartition64 *VGetPartition(char * name, int abortp);
120 extern struct DiskPartition64 *VGetPartition_r(char * name, int abortp);
121 #ifdef AFS_DEMAND_ATTACH_FS
122 extern struct DiskPartition64 *VGetPartitionById(afs_int32 index, int abortp);
123 extern struct DiskPartition64 *VGetPartitionById_r(afs_int32 index, int abortp);
125 extern int VAttachPartitions(void);
126 extern void VLockPartition(char *name);
127 extern void VLockPartition_r(char *name);
128 extern void VUnlockPartition(char *name);
129 extern void VUnlockPartition_r(char *name);
130 extern void VResetDiskUsage(void);
131 extern void VResetDiskUsage_r(void);
132 extern void VSetPartitionDiskUsage(register struct DiskPartition64 *dp);
133 extern void VSetPartitionDiskUsage_r(register struct DiskPartition64 *dp);
134 extern char *VPartitionPath(struct DiskPartition64 *p);
135 extern void VAdjustDiskUsage(Error * ec, struct Volume *vp,
136 afs_sfsize_t blocks, afs_sfsize_t checkBlocks);
137 extern int VDiskUsage(struct Volume *vp, afs_sfsize_t blocks);
138 extern void VPrintDiskStats(void);
139 extern int VInitPartitionPackage(void);