Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / afs / afs_dynroot.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 * Vnode numbers in dynroot are composed of a type field (upper 8 bits)
12 * and a type-specific identifier in the lower 24 bits.
13 */
14 #define VN_TYPE_CELL 0x01 /* Corresponds to a struct cell */
15 #define VN_TYPE_ALIAS 0x02 /* Corresponds to a struct cell_alias */
16 #define VN_TYPE_SYMLINK 0x03 /* User-created symlink in /afs */
17 #define VN_TYPE_MOUNT 0x04 /* Mount point by volume ID */
18
19 #define VNUM_TO_VNTYPE(vnum) ((vnum) >> 24)
20 #define VNUM_TO_VNID(vnum) ((vnum) & 0x00ffffff)
21 #define VNUM_FROM_TYPEID(type, id) \
22 ((type) << 24 | (id))
23 #define VNUM_TO_CIDX(vnum) (VNUM_TO_VNID(vnum) >> 2)
24 #define VNUM_TO_RW(vnum) (VNUM_TO_VNID(vnum) >> 1 & 1)
25 #define VNUM_FROM_CIDX_RW(cidx, rw) \
26 VNUM_FROM_TYPEID(VN_TYPE_CELL, \
27 ((cidx) << 2 | (rw) << 1))
28 #define VNUM_FROM_CAIDX_RW(caidx, rw) \
29 VNUM_FROM_TYPEID(VN_TYPE_ALIAS, \
30 ((caidx) << 2 | (rw) << 1))
31
32 #define AFS_DYNROOT_MOUNTNAME ".:mount"