xref: /openbmc/linux/fs/coda/coda_psdev.h (revision 0898782247ae533d1f4e47a06bc5d4870931b284)
18fc8b9dfSDavid Howells /* SPDX-License-Identifier: GPL-2.0 */
28fc8b9dfSDavid Howells #ifndef __CODA_PSDEV_H
38fc8b9dfSDavid Howells #define __CODA_PSDEV_H
48fc8b9dfSDavid Howells 
58fc8b9dfSDavid Howells #include <linux/backing-dev.h>
66dc280ebSJan Harkes #include <linux/magic.h>
78fc8b9dfSDavid Howells #include <linux/mutex.h>
86dc280ebSJan Harkes 
96dc280ebSJan Harkes #define CODA_PSDEV_MAJOR 67
106dc280ebSJan Harkes #define MAX_CODADEVS  5	   /* how many do we allow */
118fc8b9dfSDavid Howells 
128fc8b9dfSDavid Howells struct kstatfs;
138fc8b9dfSDavid Howells 
148fc8b9dfSDavid Howells /* messages between coda filesystem in kernel and Venus */
158fc8b9dfSDavid Howells struct upc_req {
168fc8b9dfSDavid Howells 	struct list_head	uc_chain;
178fc8b9dfSDavid Howells 	caddr_t			uc_data;
188fc8b9dfSDavid Howells 	u_short			uc_flags;
198fc8b9dfSDavid Howells 	u_short			uc_inSize;  /* Size is at most 5000 bytes */
208fc8b9dfSDavid Howells 	u_short			uc_outSize;
218fc8b9dfSDavid Howells 	u_short			uc_opcode;  /* copied from data to save lookup */
228fc8b9dfSDavid Howells 	int			uc_unique;
238fc8b9dfSDavid Howells 	wait_queue_head_t	uc_sleep;   /* process' wait queue */
248fc8b9dfSDavid Howells };
258fc8b9dfSDavid Howells 
268fc8b9dfSDavid Howells #define CODA_REQ_ASYNC  0x1
278fc8b9dfSDavid Howells #define CODA_REQ_READ   0x2
288fc8b9dfSDavid Howells #define CODA_REQ_WRITE  0x4
298fc8b9dfSDavid Howells #define CODA_REQ_ABORT  0x8
308fc8b9dfSDavid Howells 
318fc8b9dfSDavid Howells /* communication pending/processing queues */
328fc8b9dfSDavid Howells struct venus_comm {
338fc8b9dfSDavid Howells 	u_long		    vc_seq;
348fc8b9dfSDavid Howells 	wait_queue_head_t   vc_waitq; /* Venus wait queue */
358fc8b9dfSDavid Howells 	struct list_head    vc_pending;
368fc8b9dfSDavid Howells 	struct list_head    vc_processing;
378fc8b9dfSDavid Howells 	int                 vc_inuse;
388fc8b9dfSDavid Howells 	struct super_block *vc_sb;
398fc8b9dfSDavid Howells 	struct mutex	    vc_mutex;
408fc8b9dfSDavid Howells };
418fc8b9dfSDavid Howells 
coda_vcp(struct super_block * sb)428fc8b9dfSDavid Howells static inline struct venus_comm *coda_vcp(struct super_block *sb)
438fc8b9dfSDavid Howells {
448fc8b9dfSDavid Howells 	return (struct venus_comm *)((sb)->s_fs_info);
458fc8b9dfSDavid Howells }
468fc8b9dfSDavid Howells 
478fc8b9dfSDavid Howells /* upcalls */
488fc8b9dfSDavid Howells int venus_rootfid(struct super_block *sb, struct CodaFid *fidp);
498fc8b9dfSDavid Howells int venus_getattr(struct super_block *sb, struct CodaFid *fid,
508fc8b9dfSDavid Howells 		  struct coda_vattr *attr);
518fc8b9dfSDavid Howells int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *);
528fc8b9dfSDavid Howells int venus_lookup(struct super_block *sb, struct CodaFid *fid,
538fc8b9dfSDavid Howells 		 const char *name, int length, int *type,
548fc8b9dfSDavid Howells 		 struct CodaFid *resfid);
558fc8b9dfSDavid Howells int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
568fc8b9dfSDavid Howells 		kuid_t uid);
578fc8b9dfSDavid Howells int venus_open(struct super_block *sb, struct CodaFid *fid, int flags,
588fc8b9dfSDavid Howells 	       struct file **f);
598fc8b9dfSDavid Howells int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid,
608fc8b9dfSDavid Howells 		const char *name, int length,
618fc8b9dfSDavid Howells 		struct CodaFid *newfid, struct coda_vattr *attrs);
628fc8b9dfSDavid Howells int venus_create(struct super_block *sb, struct CodaFid *dirfid,
638fc8b9dfSDavid Howells 		 const char *name, int length, int excl, int mode,
648fc8b9dfSDavid Howells 		 struct CodaFid *newfid, struct coda_vattr *attrs);
658fc8b9dfSDavid Howells int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid,
668fc8b9dfSDavid Howells 		const char *name, int length);
678fc8b9dfSDavid Howells int venus_remove(struct super_block *sb, struct CodaFid *dirfid,
688fc8b9dfSDavid Howells 		 const char *name, int length);
698fc8b9dfSDavid Howells int venus_readlink(struct super_block *sb, struct CodaFid *fid,
708fc8b9dfSDavid Howells 		   char *buffer, int *length);
718fc8b9dfSDavid Howells int venus_rename(struct super_block *sb, struct CodaFid *new_fid,
728fc8b9dfSDavid Howells 		 struct CodaFid *old_fid, size_t old_length,
738fc8b9dfSDavid Howells 		 size_t new_length, const char *old_name,
748fc8b9dfSDavid Howells 		 const char *new_name);
758fc8b9dfSDavid Howells int venus_link(struct super_block *sb, struct CodaFid *fid,
768fc8b9dfSDavid Howells 		  struct CodaFid *dirfid, const char *name, int len );
778fc8b9dfSDavid Howells int venus_symlink(struct super_block *sb, struct CodaFid *fid,
788fc8b9dfSDavid Howells 		  const char *name, int len, const char *symname, int symlen);
798fc8b9dfSDavid Howells int venus_access(struct super_block *sb, struct CodaFid *fid, int mask);
808fc8b9dfSDavid Howells int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
818fc8b9dfSDavid Howells 		 unsigned int cmd, struct PioctlData *data);
828fc8b9dfSDavid Howells int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out,
838fc8b9dfSDavid Howells 		  size_t nbytes);
848fc8b9dfSDavid Howells int venus_fsync(struct super_block *sb, struct CodaFid *fid);
858fc8b9dfSDavid Howells int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
86*a9fba24cSPedro Cuadra int venus_access_intent(struct super_block *sb, struct CodaFid *fid,
87*a9fba24cSPedro Cuadra 			bool *access_intent_supported,
88*a9fba24cSPedro Cuadra 			size_t count, loff_t ppos, int type);
898fc8b9dfSDavid Howells 
908fc8b9dfSDavid Howells /*
918fc8b9dfSDavid Howells  * Statistics
928fc8b9dfSDavid Howells  */
938fc8b9dfSDavid Howells 
948fc8b9dfSDavid Howells extern struct venus_comm coda_comms[];
958fc8b9dfSDavid Howells #endif
96