blob: b9d2d2ceaf437f62944ec6f0067949f6b1e8d37a [file] [log] [blame]
David Howells08e0e7c2007-04-26 15:55:03 -07001/* AFS common types
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 *
David Howells08e0e7c2007-04-26 15:55:03 -07003 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
David Howells08e0e7c2007-04-26 15:55:03 -070012#ifndef AFS_H
13#define AFS_H
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
David Howells08e0e7c2007-04-26 15:55:03 -070015#include <linux/in.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
17typedef unsigned afs_volid_t;
18typedef unsigned afs_vnodeid_t;
19typedef unsigned long long afs_dataversion_t;
20
21typedef enum {
22 AFSVL_RWVOL, /* read/write volume */
23 AFSVL_ROVOL, /* read-only volume */
24 AFSVL_BACKVOL, /* backup volume */
25} __attribute__((packed)) afs_voltype_t;
26
27typedef enum {
28 AFS_FTYPE_INVALID = 0,
29 AFS_FTYPE_FILE = 1,
30 AFS_FTYPE_DIR = 2,
31 AFS_FTYPE_SYMLINK = 3,
32} afs_file_type_t;
33
Linus Torvalds1da177e2005-04-16 15:20:36 -070034/*
35 * AFS file identifier
36 */
David Howellsec268152007-04-26 15:49:28 -070037struct afs_fid {
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 afs_volid_t vid; /* volume ID */
39 afs_vnodeid_t vnode; /* file index within volume */
40 unsigned unique; /* unique ID number (file index version) */
41};
42
Linus Torvalds1da177e2005-04-16 15:20:36 -070043/*
44 * AFS callback notification
45 */
46typedef enum {
47 AFSCM_CB_UNTYPED = 0, /* no type set on CB break */
48 AFSCM_CB_EXCLUSIVE = 1, /* CB exclusive to CM [not implemented] */
49 AFSCM_CB_SHARED = 2, /* CB shared by other CM's */
50 AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */
51} afs_callback_type_t;
52
David Howellsec268152007-04-26 15:49:28 -070053struct afs_callback {
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 struct afs_fid fid; /* file identifier */
55 unsigned version; /* callback version */
56 unsigned expiry; /* time at which expires */
57 afs_callback_type_t type; /* type of callback */
58};
59
David Howells08e0e7c2007-04-26 15:55:03 -070060#define AFSCBMAX 50 /* maximum callbacks transferred per bulk op */
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
Linus Torvalds1da177e2005-04-16 15:20:36 -070062/*
63 * AFS volume information
64 */
David Howellsec268152007-04-26 15:49:28 -070065struct afs_volume_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 afs_volid_t vid; /* volume ID */
67 afs_voltype_t type; /* type of this volume */
68 afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */
David Howells08e0e7c2007-04-26 15:55:03 -070069
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 /* list of fileservers serving this volume */
71 size_t nservers; /* number of entries used in servers[] */
72 struct {
73 struct in_addr addr; /* fileserver address */
74 } servers[8];
75};
76
Linus Torvalds1da177e2005-04-16 15:20:36 -070077/*
78 * AFS file status information
79 */
David Howellsec268152007-04-26 15:49:28 -070080struct afs_file_status {
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 unsigned if_version; /* interface version */
82#define AFS_FSTATUS_VERSION 1
83
84 afs_file_type_t type; /* file type */
85 unsigned nlink; /* link count */
86 size_t size; /* file size */
David Howells08e0e7c2007-04-26 15:55:03 -070087 afs_dataversion_t data_version; /* current data version */
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 unsigned author; /* author ID */
89 unsigned owner; /* owner ID */
90 unsigned caller_access; /* access rights for authenticated caller */
91 unsigned anon_access; /* access rights for unauthenticated caller */
92 umode_t mode; /* UNIX mode */
93 struct afs_fid parent; /* parent file ID */
94 time_t mtime_client; /* last time client changed data */
95 time_t mtime_server; /* last time server changed data */
96};
97
Linus Torvalds1da177e2005-04-16 15:20:36 -070098/*
99 * AFS volume synchronisation information
100 */
David Howellsec268152007-04-26 15:49:28 -0700101struct afs_volsync {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102 time_t creation; /* volume creation time */
103};
104
David Howells08e0e7c2007-04-26 15:55:03 -0700105#endif /* AFS_H */