/* AFS common types1*2* Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public License7* as published by the Free Software Foundation; either version8* 2 of the License, or (at your option) any later version.9*/1011#ifndef AFS_H12#define AFS_H1314#include <linux/in.h>1516#define AFS_MAXCELLNAME 64 /* maximum length of a cell name */17#define AFS_MAXVOLNAME 64 /* maximum length of a volume name */18#define AFSNAMEMAX 256 /* maximum length of a filename plus NUL */19#define AFSPATHMAX 1024 /* maximum length of a pathname plus NUL */20#define AFSOPAQUEMAX 1024 /* maximum length of an opaque field */2122typedef unsigned afs_volid_t;23typedef unsigned afs_vnodeid_t;24typedef unsigned long long afs_dataversion_t;2526typedef enum {27AFSVL_RWVOL, /* read/write volume */28AFSVL_ROVOL, /* read-only volume */29AFSVL_BACKVOL, /* backup volume */30} __attribute__((packed)) afs_voltype_t;3132typedef enum {33AFS_FTYPE_INVALID = 0,34AFS_FTYPE_FILE = 1,35AFS_FTYPE_DIR = 2,36AFS_FTYPE_SYMLINK = 3,37} afs_file_type_t;3839typedef enum {40AFS_LOCK_READ = 0, /* read lock request */41AFS_LOCK_WRITE = 1, /* write lock request */42} afs_lock_type_t;4344#define AFS_LOCKWAIT (5 * 60) /* time until a lock times out (seconds) */4546/*47* AFS file identifier48*/49struct afs_fid {50afs_volid_t vid; /* volume ID */51afs_vnodeid_t vnode; /* file index within volume */52unsigned unique; /* unique ID number (file index version) */53};5455/*56* AFS callback notification57*/58typedef enum {59AFSCM_CB_UNTYPED = 0, /* no type set on CB break */60AFSCM_CB_EXCLUSIVE = 1, /* CB exclusive to CM [not implemented] */61AFSCM_CB_SHARED = 2, /* CB shared by other CM's */62AFSCM_CB_DROPPED = 3, /* CB promise cancelled by file server */63} afs_callback_type_t;6465struct afs_callback {66struct afs_fid fid; /* file identifier */67unsigned version; /* callback version */68unsigned expiry; /* time at which expires */69afs_callback_type_t type; /* type of callback */70};7172#define AFSCBMAX 50 /* maximum callbacks transferred per bulk op */7374/*75* AFS volume information76*/77struct afs_volume_info {78afs_volid_t vid; /* volume ID */79afs_voltype_t type; /* type of this volume */80afs_volid_t type_vids[5]; /* volume ID's for possible types for this vol */8182/* list of fileservers serving this volume */83size_t nservers; /* number of entries used in servers[] */84struct {85struct in_addr addr; /* fileserver address */86} servers[8];87};8889/*90* AFS security ACE access mask91*/92typedef u32 afs_access_t;93#define AFS_ACE_READ 0x00000001U /* - permission to read a file/dir */94#define AFS_ACE_WRITE 0x00000002U /* - permission to write/chmod a file */95#define AFS_ACE_INSERT 0x00000004U /* - permission to create dirent in a dir */96#define AFS_ACE_LOOKUP 0x00000008U /* - permission to lookup a file/dir in a dir */97#define AFS_ACE_DELETE 0x00000010U /* - permission to delete a dirent from a dir */98#define AFS_ACE_LOCK 0x00000020U /* - permission to lock a file */99#define AFS_ACE_ADMINISTER 0x00000040U /* - permission to change ACL */100#define AFS_ACE_USER_A 0x01000000U /* - 'A' user-defined permission */101#define AFS_ACE_USER_B 0x02000000U /* - 'B' user-defined permission */102#define AFS_ACE_USER_C 0x04000000U /* - 'C' user-defined permission */103#define AFS_ACE_USER_D 0x08000000U /* - 'D' user-defined permission */104#define AFS_ACE_USER_E 0x10000000U /* - 'E' user-defined permission */105#define AFS_ACE_USER_F 0x20000000U /* - 'F' user-defined permission */106#define AFS_ACE_USER_G 0x40000000U /* - 'G' user-defined permission */107#define AFS_ACE_USER_H 0x80000000U /* - 'H' user-defined permission */108109/*110* AFS file status information111*/112struct afs_file_status {113unsigned if_version; /* interface version */114#define AFS_FSTATUS_VERSION 1115116afs_file_type_t type; /* file type */117unsigned nlink; /* link count */118u64 size; /* file size */119afs_dataversion_t data_version; /* current data version */120u32 author; /* author ID */121u32 owner; /* owner ID */122u32 group; /* group ID */123afs_access_t caller_access; /* access rights for authenticated caller */124afs_access_t anon_access; /* access rights for unauthenticated caller */125umode_t mode; /* UNIX mode */126struct afs_fid parent; /* parent dir ID for non-dirs only */127time_t mtime_client; /* last time client changed data */128time_t mtime_server; /* last time server changed data */129s32 lock_count; /* file lock count (0=UNLK -1=WRLCK +ve=#RDLCK */130};131132/*133* AFS file status change request134*/135struct afs_store_status {136u32 mask; /* which bits of the struct are set */137u32 mtime_client; /* last time client changed data */138u32 owner; /* owner ID */139u32 group; /* group ID */140umode_t mode; /* UNIX mode */141};142143#define AFS_SET_MTIME 0x01 /* set the mtime */144#define AFS_SET_OWNER 0x02 /* set the owner ID */145#define AFS_SET_GROUP 0x04 /* set the group ID (unsupported?) */146#define AFS_SET_MODE 0x08 /* set the UNIX mode */147#define AFS_SET_SEG_SIZE 0x10 /* set the segment size (unsupported) */148149/*150* AFS volume synchronisation information151*/152struct afs_volsync {153time_t creation; /* volume creation time */154};155156/*157* AFS volume status record158*/159struct afs_volume_status {160u32 vid; /* volume ID */161u32 parent_id; /* parent volume ID */162u8 online; /* true if volume currently online and available */163u8 in_service; /* true if volume currently in service */164u8 blessed; /* same as in_service */165u8 needs_salvage; /* true if consistency checking required */166u32 type; /* volume type (afs_voltype_t) */167u32 min_quota; /* minimum space set aside (blocks) */168u32 max_quota; /* maximum space this volume may occupy (blocks) */169u32 blocks_in_use; /* space this volume currently occupies (blocks) */170u32 part_blocks_avail; /* space available in volume's partition */171u32 part_max_blocks; /* size of volume's partition */172};173174#define AFS_BLOCK_SIZE 1024175176#endif /* AFS_H */177178179