blob: b1a2367c7587f821e881d02d78296eeb31035b70 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* types.h: AFS types
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * 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
12#ifndef _LINUX_AFS_TYPES_H
13#define _LINUX_AFS_TYPES_H
14
15#ifdef __KERNEL__
16#include <rxrpc/types.h>
17#endif /* __KERNEL__ */
18
19typedef unsigned afs_volid_t;
20typedef unsigned afs_vnodeid_t;
21typedef unsigned long long afs_dataversion_t;
22
23typedef enum {
24 AFSVL_RWVOL, /* read/write volume */
25 AFSVL_ROVOL, /* read-only volume */
26 AFSVL_BACKVOL, /* backup volume */
27} __attribute__((packed)) afs_voltype_t;
28
29typedef enum {
30 AFS_FTYPE_INVALID = 0,
31 AFS_FTYPE_FILE = 1,
32 AFS_FTYPE_DIR = 2,
33 AFS_FTYPE_SYMLINK = 3,
34} afs_file_type_t;
35
36#ifdef __KERNEL__
37
38struct afs_cell;
39struct afs_vnode;
40
41/*****************************************************************************/
42/*
43 * AFS file identifier
44 */
45struct afs_fid
46{
47 afs_volid_t vid; /* volume ID */
48 afs_vnodeid_t vnode; /* file index within volume */
49 unsigned unique; /* unique ID number (file index version) */
50};
51
52/*****************************************************************************/
53/*
54 * AFS callback notification
55 */
56typedef enum {
57 AFSCM_CB_UNTYPED = 0, /* no type set on CB break */
58 AFSCM_CB_EXCLUSIVE = 1, /* CB exclusive to CM [not implemented] */
59 AFSCM_CB_SHARED = 2, /* CB shared by other CM's */
60 AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */
61} afs_callback_type_t;
62
63struct afs_callback
64{
65 struct afs_server *server; /* server that made the promise */
66 struct afs_fid fid; /* file identifier */
67 unsigned version; /* callback version */
68 unsigned expiry; /* time at which expires */
69 afs_callback_type_t type; /* type of callback */
70};
71
72#define AFSCBMAX 50
73
74/*****************************************************************************/
75/*
76 * AFS volume information
77 */
78struct afs_volume_info
79{
80 afs_volid_t vid; /* volume ID */
81 afs_voltype_t type; /* type of this volume */
82 afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */
83
84 /* list of fileservers serving this volume */
85 size_t nservers; /* number of entries used in servers[] */
86 struct {
87 struct in_addr addr; /* fileserver address */
88 } servers[8];
89};
90
91/*****************************************************************************/
92/*
93 * AFS file status information
94 */
95struct afs_file_status
96{
97 unsigned if_version; /* interface version */
98#define AFS_FSTATUS_VERSION 1
99
100 afs_file_type_t type; /* file type */
101 unsigned nlink; /* link count */
102 size_t size; /* file size */
103 afs_dataversion_t version; /* current data version */
104 unsigned author; /* author ID */
105 unsigned owner; /* owner ID */
106 unsigned caller_access; /* access rights for authenticated caller */
107 unsigned anon_access; /* access rights for unauthenticated caller */
108 umode_t mode; /* UNIX mode */
109 struct afs_fid parent; /* parent file ID */
110 time_t mtime_client; /* last time client changed data */
111 time_t mtime_server; /* last time server changed data */
112};
113
114/*****************************************************************************/
115/*
116 * AFS volume synchronisation information
117 */
118struct afs_volsync
119{
120 time_t creation; /* volume creation time */
121};
122
123#endif /* __KERNEL__ */
124
125#endif /* _LINUX_AFS_TYPES_H */