18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  coda_fs_i.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (C) 1998 Carnegie Mellon University
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef _LINUX_CODA_FS_I
108c2ecf20Sopenharmony_ci#define _LINUX_CODA_FS_I
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/types.h>
138c2ecf20Sopenharmony_ci#include <linux/list.h>
148c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
158c2ecf20Sopenharmony_ci#include <linux/coda.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/*
188c2ecf20Sopenharmony_ci * coda fs inode data
198c2ecf20Sopenharmony_ci * c_lock protects accesses to c_flags, c_mapcount, c_cached_epoch, c_uid and
208c2ecf20Sopenharmony_ci * c_cached_perm.
218c2ecf20Sopenharmony_ci * vfs_inode is set only when the inode is created and never changes.
228c2ecf20Sopenharmony_ci * c_fid is set when the inode is created and should be considered immutable.
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_cistruct coda_inode_info {
258c2ecf20Sopenharmony_ci	struct CodaFid	   c_fid;	/* Coda identifier */
268c2ecf20Sopenharmony_ci	u_short	           c_flags;     /* flags (see below) */
278c2ecf20Sopenharmony_ci	unsigned int	   c_mapcount;  /* nr of times this inode is mapped */
288c2ecf20Sopenharmony_ci	unsigned int	   c_cached_epoch; /* epoch for cached permissions */
298c2ecf20Sopenharmony_ci	kuid_t		   c_uid;	/* fsuid for cached permissions */
308c2ecf20Sopenharmony_ci	unsigned int       c_cached_perm; /* cached access permissions */
318c2ecf20Sopenharmony_ci	spinlock_t	   c_lock;
328c2ecf20Sopenharmony_ci	struct inode	   vfs_inode;
338c2ecf20Sopenharmony_ci};
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci/*
368c2ecf20Sopenharmony_ci * coda fs file private data
378c2ecf20Sopenharmony_ci */
388c2ecf20Sopenharmony_ci#define CODA_MAGIC 0xC0DAC0DA
398c2ecf20Sopenharmony_cistruct coda_file_info {
408c2ecf20Sopenharmony_ci	int		   cfi_magic;	  /* magic number */
418c2ecf20Sopenharmony_ci	struct file	  *cfi_container; /* container file for this cnode */
428c2ecf20Sopenharmony_ci	unsigned int	   cfi_mapcount;  /* nr of times this file is mapped */
438c2ecf20Sopenharmony_ci	bool		   cfi_access_intent; /* is access intent supported */
448c2ecf20Sopenharmony_ci};
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/* flags */
478c2ecf20Sopenharmony_ci#define C_VATTR       0x1   /* Validity of vattr in inode */
488c2ecf20Sopenharmony_ci#define C_FLUSH       0x2   /* used after a flush */
498c2ecf20Sopenharmony_ci#define C_DYING       0x4   /* from venus (which died) */
508c2ecf20Sopenharmony_ci#define C_PURGE       0x8
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cistruct inode *coda_cnode_make(struct CodaFid *, struct super_block *);
538c2ecf20Sopenharmony_cistruct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr);
548c2ecf20Sopenharmony_cistruct inode *coda_cnode_makectl(struct super_block *sb);
558c2ecf20Sopenharmony_cistruct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb);
568c2ecf20Sopenharmony_cistruct coda_file_info *coda_ftoc(struct file *file);
578c2ecf20Sopenharmony_civoid coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *);
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#endif
60