162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef __CODA_PSDEV_H 362306a36Sopenharmony_ci#define __CODA_PSDEV_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <linux/backing-dev.h> 662306a36Sopenharmony_ci#include <linux/magic.h> 762306a36Sopenharmony_ci#include <linux/mutex.h> 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#define CODA_PSDEV_MAJOR 67 1062306a36Sopenharmony_ci#define MAX_CODADEVS 5 /* how many do we allow */ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_cistruct kstatfs; 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci/* messages between coda filesystem in kernel and Venus */ 1562306a36Sopenharmony_cistruct upc_req { 1662306a36Sopenharmony_ci struct list_head uc_chain; 1762306a36Sopenharmony_ci caddr_t uc_data; 1862306a36Sopenharmony_ci u_short uc_flags; 1962306a36Sopenharmony_ci u_short uc_inSize; /* Size is at most 5000 bytes */ 2062306a36Sopenharmony_ci u_short uc_outSize; 2162306a36Sopenharmony_ci u_short uc_opcode; /* copied from data to save lookup */ 2262306a36Sopenharmony_ci int uc_unique; 2362306a36Sopenharmony_ci wait_queue_head_t uc_sleep; /* process' wait queue */ 2462306a36Sopenharmony_ci}; 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci#define CODA_REQ_ASYNC 0x1 2762306a36Sopenharmony_ci#define CODA_REQ_READ 0x2 2862306a36Sopenharmony_ci#define CODA_REQ_WRITE 0x4 2962306a36Sopenharmony_ci#define CODA_REQ_ABORT 0x8 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci/* communication pending/processing queues */ 3262306a36Sopenharmony_cistruct venus_comm { 3362306a36Sopenharmony_ci u_long vc_seq; 3462306a36Sopenharmony_ci wait_queue_head_t vc_waitq; /* Venus wait queue */ 3562306a36Sopenharmony_ci struct list_head vc_pending; 3662306a36Sopenharmony_ci struct list_head vc_processing; 3762306a36Sopenharmony_ci int vc_inuse; 3862306a36Sopenharmony_ci struct super_block *vc_sb; 3962306a36Sopenharmony_ci struct mutex vc_mutex; 4062306a36Sopenharmony_ci}; 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_cistatic inline struct venus_comm *coda_vcp(struct super_block *sb) 4362306a36Sopenharmony_ci{ 4462306a36Sopenharmony_ci return (struct venus_comm *)((sb)->s_fs_info); 4562306a36Sopenharmony_ci} 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci/* upcalls */ 4862306a36Sopenharmony_ciint venus_rootfid(struct super_block *sb, struct CodaFid *fidp); 4962306a36Sopenharmony_ciint venus_getattr(struct super_block *sb, struct CodaFid *fid, 5062306a36Sopenharmony_ci struct coda_vattr *attr); 5162306a36Sopenharmony_ciint venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *); 5262306a36Sopenharmony_ciint venus_lookup(struct super_block *sb, struct CodaFid *fid, 5362306a36Sopenharmony_ci const char *name, int length, int *type, 5462306a36Sopenharmony_ci struct CodaFid *resfid); 5562306a36Sopenharmony_ciint venus_close(struct super_block *sb, struct CodaFid *fid, int flags, 5662306a36Sopenharmony_ci kuid_t uid); 5762306a36Sopenharmony_ciint venus_open(struct super_block *sb, struct CodaFid *fid, int flags, 5862306a36Sopenharmony_ci struct file **f); 5962306a36Sopenharmony_ciint venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, 6062306a36Sopenharmony_ci const char *name, int length, 6162306a36Sopenharmony_ci struct CodaFid *newfid, struct coda_vattr *attrs); 6262306a36Sopenharmony_ciint venus_create(struct super_block *sb, struct CodaFid *dirfid, 6362306a36Sopenharmony_ci const char *name, int length, int excl, int mode, 6462306a36Sopenharmony_ci struct CodaFid *newfid, struct coda_vattr *attrs); 6562306a36Sopenharmony_ciint venus_rmdir(struct super_block *sb, struct CodaFid *dirfid, 6662306a36Sopenharmony_ci const char *name, int length); 6762306a36Sopenharmony_ciint venus_remove(struct super_block *sb, struct CodaFid *dirfid, 6862306a36Sopenharmony_ci const char *name, int length); 6962306a36Sopenharmony_ciint venus_readlink(struct super_block *sb, struct CodaFid *fid, 7062306a36Sopenharmony_ci char *buffer, int *length); 7162306a36Sopenharmony_ciint venus_rename(struct super_block *sb, struct CodaFid *new_fid, 7262306a36Sopenharmony_ci struct CodaFid *old_fid, size_t old_length, 7362306a36Sopenharmony_ci size_t new_length, const char *old_name, 7462306a36Sopenharmony_ci const char *new_name); 7562306a36Sopenharmony_ciint venus_link(struct super_block *sb, struct CodaFid *fid, 7662306a36Sopenharmony_ci struct CodaFid *dirfid, const char *name, int len ); 7762306a36Sopenharmony_ciint venus_symlink(struct super_block *sb, struct CodaFid *fid, 7862306a36Sopenharmony_ci const char *name, int len, const char *symname, int symlen); 7962306a36Sopenharmony_ciint venus_access(struct super_block *sb, struct CodaFid *fid, int mask); 8062306a36Sopenharmony_ciint venus_pioctl(struct super_block *sb, struct CodaFid *fid, 8162306a36Sopenharmony_ci unsigned int cmd, struct PioctlData *data); 8262306a36Sopenharmony_ciint coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out, 8362306a36Sopenharmony_ci size_t nbytes); 8462306a36Sopenharmony_ciint venus_fsync(struct super_block *sb, struct CodaFid *fid); 8562306a36Sopenharmony_ciint venus_statfs(struct dentry *dentry, struct kstatfs *sfs); 8662306a36Sopenharmony_ciint venus_access_intent(struct super_block *sb, struct CodaFid *fid, 8762306a36Sopenharmony_ci bool *access_intent_supported, 8862306a36Sopenharmony_ci size_t count, loff_t ppos, int type); 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci/* 9162306a36Sopenharmony_ci * Statistics 9262306a36Sopenharmony_ci */ 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ciextern struct venus_comm coda_comms[]; 9562306a36Sopenharmony_ci#endif 96