blob: 52d0752265b8a4f4bc120be164f6a75d93963ecf [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
David Howells00d3b7a2007-04-26 15:57:07 -070017#define AFS_MAXCELLNAME 64 /* maximum length of a cell name */
18#define AFS_MAXVOLNAME 64 /* maximum length of a volume name */
19
Linus Torvalds1da177e2005-04-16 15:20:36 -070020typedef unsigned afs_volid_t;
21typedef unsigned afs_vnodeid_t;
22typedef unsigned long long afs_dataversion_t;
23
24typedef enum {
25 AFSVL_RWVOL, /* read/write volume */
26 AFSVL_ROVOL, /* read-only volume */
27 AFSVL_BACKVOL, /* backup volume */
28} __attribute__((packed)) afs_voltype_t;
29
30typedef enum {
31 AFS_FTYPE_INVALID = 0,
32 AFS_FTYPE_FILE = 1,
33 AFS_FTYPE_DIR = 2,
34 AFS_FTYPE_SYMLINK = 3,
35} afs_file_type_t;
36
Linus Torvalds1da177e2005-04-16 15:20:36 -070037/*
38 * AFS file identifier
39 */
David Howellsec268152007-04-26 15:49:28 -070040struct afs_fid {
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 afs_volid_t vid; /* volume ID */
42 afs_vnodeid_t vnode; /* file index within volume */
43 unsigned unique; /* unique ID number (file index version) */
44};
45
Linus Torvalds1da177e2005-04-16 15:20:36 -070046/*
47 * AFS callback notification
48 */
49typedef enum {
50 AFSCM_CB_UNTYPED = 0, /* no type set on CB break */
51 AFSCM_CB_EXCLUSIVE = 1, /* CB exclusive to CM [not implemented] */
52 AFSCM_CB_SHARED = 2, /* CB shared by other CM's */
53 AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */
54} afs_callback_type_t;
55
David Howellsec268152007-04-26 15:49:28 -070056struct afs_callback {
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 struct afs_fid fid; /* file identifier */
58 unsigned version; /* callback version */
59 unsigned expiry; /* time at which expires */
60 afs_callback_type_t type; /* type of callback */
61};
62
David Howells08e0e7c2007-04-26 15:55:03 -070063#define AFSCBMAX 50 /* maximum callbacks transferred per bulk op */
Linus Torvalds1da177e2005-04-16 15:20:36 -070064
Linus Torvalds1da177e2005-04-16 15:20:36 -070065/*
66 * AFS volume information
67 */
David Howellsec268152007-04-26 15:49:28 -070068struct afs_volume_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 afs_volid_t vid; /* volume ID */
70 afs_voltype_t type; /* type of this volume */
71 afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */
David Howells08e0e7c2007-04-26 15:55:03 -070072
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 /* list of fileservers serving this volume */
74 size_t nservers; /* number of entries used in servers[] */
75 struct {
76 struct in_addr addr; /* fileserver address */
77 } servers[8];
78};
79
Linus Torvalds1da177e2005-04-16 15:20:36 -070080/*
David Howells00d3b7a2007-04-26 15:57:07 -070081 * AFS security ACE access mask
82 */
83typedef u32 afs_access_t;
84#define AFS_ACE_READ 0x00000001U /* - permission to read a file/dir */
85#define AFS_ACE_WRITE 0x00000002U /* - permission to write/chmod a file */
86#define AFS_ACE_INSERT 0x00000004U /* - permission to create dirent in a dir */
87#define AFS_ACE_LOOKUP 0x00000008U /* - permission to lookup a file/dir in a dir */
88#define AFS_ACE_DELETE 0x00000010U /* - permission to delete a dirent from a dir */
89#define AFS_ACE_LOCK 0x00000020U /* - permission to lock a file */
90#define AFS_ACE_ADMINISTER 0x00000040U /* - permission to change ACL */
91#define AFS_ACE_USER_A 0x01000000U /* - 'A' user-defined permission */
92#define AFS_ACE_USER_B 0x02000000U /* - 'B' user-defined permission */
93#define AFS_ACE_USER_C 0x04000000U /* - 'C' user-defined permission */
94#define AFS_ACE_USER_D 0x08000000U /* - 'D' user-defined permission */
95#define AFS_ACE_USER_E 0x10000000U /* - 'E' user-defined permission */
96#define AFS_ACE_USER_F 0x20000000U /* - 'F' user-defined permission */
97#define AFS_ACE_USER_G 0x40000000U /* - 'G' user-defined permission */
98#define AFS_ACE_USER_H 0x80000000U /* - 'H' user-defined permission */
99
100/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 * AFS file status information
102 */
David Howellsec268152007-04-26 15:49:28 -0700103struct afs_file_status {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 unsigned if_version; /* interface version */
105#define AFS_FSTATUS_VERSION 1
106
107 afs_file_type_t type; /* file type */
108 unsigned nlink; /* link count */
David Howells260a9802007-04-26 15:59:35 -0700109 u64 size; /* file size */
David Howells08e0e7c2007-04-26 15:55:03 -0700110 afs_dataversion_t data_version; /* current data version */
David Howells260a9802007-04-26 15:59:35 -0700111 u32 author; /* author ID */
112 u32 owner; /* owner ID */
113 u32 group; /* group ID */
David Howells00d3b7a2007-04-26 15:57:07 -0700114 afs_access_t caller_access; /* access rights for authenticated caller */
115 afs_access_t anon_access; /* access rights for unauthenticated caller */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 umode_t mode; /* UNIX mode */
David Howells260a9802007-04-26 15:59:35 -0700117 struct afs_fid parent; /* parent dir ID for non-dirs only */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 time_t mtime_client; /* last time client changed data */
119 time_t mtime_server; /* last time server changed data */
120};
121
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122/*
David Howells260a9802007-04-26 15:59:35 -0700123 * AFS file status change request
124 */
125struct afs_store_status {
126 u32 mask; /* which bits of the struct are set */
127 u32 mtime_client; /* last time client changed data */
128 u32 owner; /* owner ID */
129 u32 group; /* group ID */
130 umode_t mode; /* UNIX mode */
131};
132
133#define AFS_SET_MTIME 0x01 /* set the mtime */
134#define AFS_SET_OWNER 0x02 /* set the owner ID */
135#define AFS_SET_GROUP 0x04 /* set the group ID (unsupported?) */
136#define AFS_SET_MODE 0x08 /* set the UNIX mode */
137#define AFS_SET_SEG_SIZE 0x10 /* set the segment size (unsupported) */
138
139/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140 * AFS volume synchronisation information
141 */
David Howellsec268152007-04-26 15:49:28 -0700142struct afs_volsync {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 time_t creation; /* volume creation time */
144};
145
David Howells08e0e7c2007-04-26 15:55:03 -0700146#endif /* AFS_H */