xref: /onnv-gate/usr/src/uts/common/smbsrv/smb_vops.h (revision 12890:16985853e3aa)
15331Samw /*
25331Samw  * CDDL HEADER START
35331Samw  *
45331Samw  * The contents of this file are subject to the terms of the
55331Samw  * Common Development and Distribution License (the "License").
65331Samw  * You may not use this file except in compliance with the License.
75331Samw  *
85331Samw  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
95331Samw  * or http://www.opensolaris.org/os/licensing.
105331Samw  * See the License for the specific language governing permissions
115331Samw  * and limitations under the License.
125331Samw  *
135331Samw  * When distributing Covered Code, include this CDDL HEADER in each
145331Samw  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
155331Samw  * If applicable, add the following below this CDDL HEADER, with the
165331Samw  * fields enclosed by brackets "[]" replaced with your own identifying
175331Samw  * information: Portions Copyright [yyyy] [name of copyright owner]
185331Samw  *
195331Samw  * CDDL HEADER END
205331Samw  */
215331Samw /*
22*12890SJoyce.McIntosh@Sun.COM  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
235331Samw  */
245331Samw 
255331Samw #ifndef _SMBSRV_SMB_VOPS_H
265331Samw #define	_SMBSRV_SMB_VOPS_H
275331Samw 
285331Samw /*
295331Samw  * Common file system interfaces and definitions.
305331Samw  */
315331Samw 
325331Samw #include <sys/types.h>
335331Samw #include <sys/param.h>
345331Samw #include <sys/file.h>
355331Samw #include <sys/time.h>
365331Samw #include <sys/mntent.h>
375331Samw #include <sys/uio.h>
385331Samw #include <sys/vnode.h>
395331Samw #include <sys/vfs.h>
405331Samw #include <sys/refstr.h>
415331Samw #include <sys/acl.h>
426600Sas200622 #include <sys/fcntl.h>
4310966SJordan.Brown@Sun.COM #include <smbsrv/string.h>
445331Samw 
455331Samw #ifdef __cplusplus
465331Samw extern "C" {
475331Samw #endif
485331Samw 
495331Samw #define	ROOTVOL ""
505331Samw #define	XATTR_DIR "xattr_dir"
515331Samw 
525331Samw #define	SMB_STREAM_PREFIX "SUNWsmb"
535331Samw #define	SMB_STREAM_PREFIX_LEN (sizeof (SMB_STREAM_PREFIX) - 1)
545331Samw 
557348SJose.Borrego@Sun.COM #define	SMB_SHORTNAMELEN 14
568670SJose.Borrego@Sun.COM #define	SMB_MAXDIRSIZE	0x7FFFFFFF
575331Samw 
585331Samw struct smb_node;
595331Samw struct smb_request;
605331Samw 
615331Samw /*
625331Samw  * Note: When specifying the mask for an smb_attr_t,
635331Samw  * the sa_mask, and not the sa_vattr.va_mask, should be
645331Samw  * filled in.  The #define's that should be used are those
655331Samw  * prefixed with SMB_AT_*.  Only FSIL routines should
665331Samw  * manipulate the sa_vattr.va_mask field.
675331Samw  */
685331Samw typedef struct smb_attr {
695331Samw 	uint_t		sa_mask;	/* For both vattr and CIFS attr's */
705331Samw 	vattr_t		sa_vattr;	/* Legacy vattr */
715331Samw 	uint32_t	sa_dosattr;	/* DOS attributes */
725331Samw 	timestruc_t	sa_crtime;	/* Creation time */
7310504SKeyur.Desai@Sun.COM 	u_offset_t	sa_allocsz;	/* File allocation size in bytes */
745331Samw } smb_attr_t;
755331Samw 
765331Samw #define	SMB_AT_TYPE	0x00001
775331Samw #define	SMB_AT_MODE	0x00002
785331Samw #define	SMB_AT_UID	0x00004
795331Samw #define	SMB_AT_GID	0x00008
805331Samw #define	SMB_AT_FSID	0x00010
815331Samw #define	SMB_AT_NODEID	0x00020
825331Samw #define	SMB_AT_NLINK	0x00040
835331Samw #define	SMB_AT_SIZE	0x00080
845331Samw #define	SMB_AT_ATIME	0x00100
855331Samw #define	SMB_AT_MTIME	0x00200
865331Samw #define	SMB_AT_CTIME	0x00400
875331Samw #define	SMB_AT_RDEV	0x00800
885331Samw #define	SMB_AT_BLKSIZE	0x01000
895331Samw #define	SMB_AT_NBLOCKS	0x02000
905331Samw #define	SMB_AT_SEQ	0x08000
915331Samw 
925331Samw #define	SMB_AT_DOSATTR	0x00100000
935331Samw #define	SMB_AT_CRTIME	0x00200000
9410504SKeyur.Desai@Sun.COM #define	SMB_AT_ALLOCSZ	0x00400000
9510504SKeyur.Desai@Sun.COM 
9610504SKeyur.Desai@Sun.COM #define	SMB_AT_SMB	(SMB_AT_DOSATTR|SMB_AT_CRTIME|SMB_AT_ALLOCSZ)
975331Samw 
985331Samw #define	SMB_AT_ALL	(SMB_AT_TYPE|SMB_AT_MODE|SMB_AT_UID|SMB_AT_GID|\
995331Samw 			SMB_AT_FSID|SMB_AT_NODEID|SMB_AT_NLINK|SMB_AT_SIZE|\
1005331Samw 			SMB_AT_ATIME|SMB_AT_MTIME|SMB_AT_CTIME|SMB_AT_RDEV|\
1015331Samw 			SMB_AT_BLKSIZE|SMB_AT_NBLOCKS|SMB_AT_SEQ|SMB_AT_SMB)
10210504SKeyur.Desai@Sun.COM 
10310001SJoyce.McIntosh@Sun.COM #define	SMB_AT_TIMES	(SMB_AT_ATIME | SMB_AT_MTIME |\
10410001SJoyce.McIntosh@Sun.COM 			SMB_AT_CTIME | SMB_AT_CRTIME)
1055331Samw 
1065331Samw int fhopen(const struct smb_node *, int);
1075331Samw 
1086139Sjb150015 int smb_vop_init(void);
1096139Sjb150015 void smb_vop_fini(void);
1106139Sjb150015 void smb_vop_start(void);
1116139Sjb150015 int smb_vop_open(vnode_t **, int, cred_t *);
1127348SJose.Borrego@Sun.COM void smb_vop_close(vnode_t *, int, cred_t *);
1136139Sjb150015 int smb_vop_read(vnode_t *, uio_t *, cred_t *);
1147052Samw int smb_vop_write(vnode_t *, uio_t *, int, uint32_t *, cred_t *);
1156139Sjb150015 int smb_vop_getattr(vnode_t *, vnode_t *, smb_attr_t *, int, cred_t *);
1167757SJanice.Chang@Sun.COM int smb_vop_setattr(vnode_t *, vnode_t *, smb_attr_t *, int, cred_t *);
1176139Sjb150015 int smb_vop_access(vnode_t *, int, int, vnode_t *, cred_t *);
1186139Sjb150015 void smb_vop_eaccess(vnode_t *, int *, int, vnode_t *, cred_t *);
1199231SAfshin.Ardakani@Sun.COM int smb_vop_lookup(vnode_t *, char *, vnode_t **, char *, int, int *, vnode_t *,
12011963SAfshin.Ardakani@Sun.COM     smb_attr_t *, cred_t *);
1216139Sjb150015 int smb_vop_create(vnode_t *, char *, smb_attr_t *, vnode_t **, int, cred_t *,
1226139Sjb150015     vsecattr_t *);
1239914Samw@Sun.COM int smb_vop_link(vnode_t *, vnode_t *, char *, int, cred_t *);
1246139Sjb150015 int smb_vop_remove(vnode_t *, char *, int, cred_t *);
1256139Sjb150015 int smb_vop_rename(vnode_t *, char *, vnode_t *, char *, int, cred_t *);
1266139Sjb150015 int smb_vop_mkdir(vnode_t *, char *, smb_attr_t *, vnode_t **, int, cred_t *,
1276139Sjb150015     vsecattr_t *);
1286139Sjb150015 int smb_vop_rmdir(vnode_t *, char *, int, cred_t *);
12910504SKeyur.Desai@Sun.COM int smb_vop_readdir(vnode_t *, uint32_t, void *, int *, int *,
13010504SKeyur.Desai@Sun.COM     uint32_t, cred_t *);
1316139Sjb150015 int smb_vop_commit(vnode_t *, cred_t *);
1326139Sjb150015 int smb_vop_statfs(vnode_t *, struct statvfs64 *, cred_t *);
1336139Sjb150015 int smb_vop_stream_lookup(vnode_t *, char *, vnode_t **, char *, vnode_t **,
1346139Sjb150015     int, vnode_t *, cred_t *);
1356139Sjb150015 int smb_vop_stream_create(vnode_t *, char *, smb_attr_t *, vnode_t **,
1366139Sjb150015     vnode_t **, int, cred_t *);
1376139Sjb150015 int smb_vop_stream_remove(vnode_t *, char *, int, cred_t *);
1386139Sjb150015 int smb_vop_lookup_xattrdir(vnode_t *, vnode_t **, int, cred_t *);
1396139Sjb150015 int smb_vop_traverse_check(vnode_t **);
1405331Samw 
1415772Sas200622 int smb_vop_acl_read(vnode_t *, acl_t **, int, acl_type_t, cred_t *);
1425772Sas200622 int smb_vop_acl_write(vnode_t *, acl_t *, int, cred_t *);
1435772Sas200622 acl_type_t smb_vop_acl_type(vnode_t *);
1445772Sas200622 
1455772Sas200622 int smb_vop_shrlock(vnode_t *, uint32_t, uint32_t, uint32_t, cred_t *);
1465772Sas200622 int smb_vop_unshrlock(vnode_t *, uint32_t, cred_t *);
1475331Samw 
1486600Sas200622 int smb_vop_frlock(vnode_t *, cred_t *, int, flock64_t *);
1496600Sas200622 
150*12890SJoyce.McIntosh@Sun.COM int smb_vop_other_opens(vnode_t *, int);
151*12890SJoyce.McIntosh@Sun.COM 
1529231SAfshin.Ardakani@Sun.COM void smb_vop_catia_v4tov5(char *, char *, int);
1539231SAfshin.Ardakani@Sun.COM char *smb_vop_catia_v5tov4(char *, char *, int);
1549231SAfshin.Ardakani@Sun.COM 
1555331Samw #ifdef __cplusplus
1565331Samw }
1575331Samw #endif
1585331Samw 
1595331Samw #endif /* _SMBSRV_SMB_VOPS_H */
160