xref: /onnv-gate/usr/src/uts/common/smbsrv/smb_vops.h (revision 10966:37e5dcdf36d3)
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 /*
228670SJose.Borrego@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
235331Samw  * Use is subject to license terms.
245331Samw  */
255331Samw 
265331Samw #ifndef _SMBSRV_SMB_VOPS_H
275331Samw #define	_SMBSRV_SMB_VOPS_H
285331Samw 
295331Samw /*
305331Samw  * Common file system interfaces and definitions.
315331Samw  */
325331Samw 
335331Samw #include <sys/types.h>
345331Samw #include <sys/param.h>
355331Samw #include <sys/file.h>
365331Samw #include <sys/time.h>
375331Samw #include <sys/mntent.h>
385331Samw #include <sys/uio.h>
395331Samw #include <sys/vnode.h>
405331Samw #include <sys/vfs.h>
415331Samw #include <sys/refstr.h>
425331Samw #include <sys/acl.h>
436600Sas200622 #include <sys/fcntl.h>
44*10966SJordan.Brown@Sun.COM #include <smbsrv/string.h>
455331Samw 
465331Samw #ifdef __cplusplus
475331Samw extern "C" {
485331Samw #endif
495331Samw 
505331Samw #define	ROOTVOL ""
515331Samw #define	XATTR_DIR "xattr_dir"
525331Samw 
535331Samw #define	SMB_STREAM_PREFIX "SUNWsmb"
545331Samw #define	SMB_STREAM_PREFIX_LEN (sizeof (SMB_STREAM_PREFIX) - 1)
555331Samw 
567348SJose.Borrego@Sun.COM #define	SMB_SHORTNAMELEN 14
578670SJose.Borrego@Sun.COM #define	SMB_MAXDIRSIZE	0x7FFFFFFF
585331Samw 
595331Samw struct smb_node;
605331Samw struct smb_request;
615331Samw 
625331Samw /*
635331Samw  * Note: When specifying the mask for an smb_attr_t,
645331Samw  * the sa_mask, and not the sa_vattr.va_mask, should be
655331Samw  * filled in.  The #define's that should be used are those
665331Samw  * prefixed with SMB_AT_*.  Only FSIL routines should
675331Samw  * manipulate the sa_vattr.va_mask field.
685331Samw  */
695331Samw typedef struct smb_attr {
705331Samw 	uint_t		sa_mask;	/* For both vattr and CIFS attr's */
715331Samw 	vattr_t		sa_vattr;	/* Legacy vattr */
725331Samw 	uint32_t	sa_dosattr;	/* DOS attributes */
735331Samw 	timestruc_t	sa_crtime;	/* Creation time */
7410504SKeyur.Desai@Sun.COM 	u_offset_t	sa_allocsz;	/* File allocation size in bytes */
755331Samw } smb_attr_t;
765331Samw 
775331Samw #define	SMB_AT_TYPE	0x00001
785331Samw #define	SMB_AT_MODE	0x00002
795331Samw #define	SMB_AT_UID	0x00004
805331Samw #define	SMB_AT_GID	0x00008
815331Samw #define	SMB_AT_FSID	0x00010
825331Samw #define	SMB_AT_NODEID	0x00020
835331Samw #define	SMB_AT_NLINK	0x00040
845331Samw #define	SMB_AT_SIZE	0x00080
855331Samw #define	SMB_AT_ATIME	0x00100
865331Samw #define	SMB_AT_MTIME	0x00200
875331Samw #define	SMB_AT_CTIME	0x00400
885331Samw #define	SMB_AT_RDEV	0x00800
895331Samw #define	SMB_AT_BLKSIZE	0x01000
905331Samw #define	SMB_AT_NBLOCKS	0x02000
915331Samw #define	SMB_AT_SEQ	0x08000
925331Samw 
935331Samw #define	SMB_AT_DOSATTR	0x00100000
945331Samw #define	SMB_AT_CRTIME	0x00200000
9510504SKeyur.Desai@Sun.COM #define	SMB_AT_ALLOCSZ	0x00400000
9610504SKeyur.Desai@Sun.COM 
9710504SKeyur.Desai@Sun.COM #define	SMB_AT_SMB	(SMB_AT_DOSATTR|SMB_AT_CRTIME|SMB_AT_ALLOCSZ)
985331Samw 
995331Samw #define	SMB_AT_ALL	(SMB_AT_TYPE|SMB_AT_MODE|SMB_AT_UID|SMB_AT_GID|\
1005331Samw 			SMB_AT_FSID|SMB_AT_NODEID|SMB_AT_NLINK|SMB_AT_SIZE|\
1015331Samw 			SMB_AT_ATIME|SMB_AT_MTIME|SMB_AT_CTIME|SMB_AT_RDEV|\
1025331Samw 			SMB_AT_BLKSIZE|SMB_AT_NBLOCKS|SMB_AT_SEQ|SMB_AT_SMB)
10310504SKeyur.Desai@Sun.COM 
10410001SJoyce.McIntosh@Sun.COM #define	SMB_AT_TIMES	(SMB_AT_ATIME | SMB_AT_MTIME |\
10510001SJoyce.McIntosh@Sun.COM 			SMB_AT_CTIME | SMB_AT_CRTIME)
1065331Samw 
1075331Samw int fhopen(const struct smb_node *, int);
1085331Samw 
1096139Sjb150015 int smb_vop_init(void);
1106139Sjb150015 void smb_vop_fini(void);
1116139Sjb150015 void smb_vop_start(void);
1126139Sjb150015 int smb_vop_open(vnode_t **, int, cred_t *);
1137348SJose.Borrego@Sun.COM void smb_vop_close(vnode_t *, int, cred_t *);
1146139Sjb150015 int smb_vop_read(vnode_t *, uio_t *, cred_t *);
1157052Samw int smb_vop_write(vnode_t *, uio_t *, int, uint32_t *, cred_t *);
1166139Sjb150015 int smb_vop_getattr(vnode_t *, vnode_t *, smb_attr_t *, int, cred_t *);
1177757SJanice.Chang@Sun.COM int smb_vop_setattr(vnode_t *, vnode_t *, smb_attr_t *, int, cred_t *);
1186139Sjb150015 int smb_vop_access(vnode_t *, int, int, vnode_t *, cred_t *);
1196139Sjb150015 void smb_vop_eaccess(vnode_t *, int *, int, vnode_t *, cred_t *);
1209231SAfshin.Ardakani@Sun.COM int smb_vop_lookup(vnode_t *, char *, vnode_t **, char *, int, int *, vnode_t *,
1215772Sas200622     cred_t *);
1226139Sjb150015 int smb_vop_create(vnode_t *, char *, smb_attr_t *, vnode_t **, int, cred_t *,
1236139Sjb150015     vsecattr_t *);
1249914Samw@Sun.COM int smb_vop_link(vnode_t *, vnode_t *, char *, int, cred_t *);
1256139Sjb150015 int smb_vop_remove(vnode_t *, char *, int, cred_t *);
1266139Sjb150015 int smb_vop_rename(vnode_t *, char *, vnode_t *, char *, int, cred_t *);
1276139Sjb150015 int smb_vop_mkdir(vnode_t *, char *, smb_attr_t *, vnode_t **, int, cred_t *,
1286139Sjb150015     vsecattr_t *);
1296139Sjb150015 int smb_vop_rmdir(vnode_t *, char *, int, cred_t *);
13010504SKeyur.Desai@Sun.COM int smb_vop_readdir(vnode_t *, uint32_t, void *, int *, int *,
13110504SKeyur.Desai@Sun.COM     uint32_t, cred_t *);
1326139Sjb150015 int smb_vop_commit(vnode_t *, cred_t *);
1336139Sjb150015 int smb_vop_statfs(vnode_t *, struct statvfs64 *, cred_t *);
1346139Sjb150015 int smb_vop_stream_lookup(vnode_t *, char *, vnode_t **, char *, vnode_t **,
1356139Sjb150015     int, vnode_t *, cred_t *);
1366139Sjb150015 int smb_vop_stream_create(vnode_t *, char *, smb_attr_t *, vnode_t **,
1376139Sjb150015     vnode_t **, int, cred_t *);
1386139Sjb150015 int smb_vop_stream_remove(vnode_t *, char *, int, cred_t *);
1396139Sjb150015 int smb_vop_lookup_xattrdir(vnode_t *, vnode_t **, int, cred_t *);
1406139Sjb150015 int smb_vop_traverse_check(vnode_t **);
1415331Samw 
1425772Sas200622 int smb_vop_acl_read(vnode_t *, acl_t **, int, acl_type_t, cred_t *);
1435772Sas200622 int smb_vop_acl_write(vnode_t *, acl_t *, int, cred_t *);
1445772Sas200622 acl_type_t smb_vop_acl_type(vnode_t *);
1455772Sas200622 
1465772Sas200622 int smb_vop_shrlock(vnode_t *, uint32_t, uint32_t, uint32_t, cred_t *);
1475772Sas200622 int smb_vop_unshrlock(vnode_t *, uint32_t, cred_t *);
1485331Samw 
1496600Sas200622 int smb_vop_frlock(vnode_t *, cred_t *, int, flock64_t *);
1506600Sas200622 
1519231SAfshin.Ardakani@Sun.COM void smb_vop_catia_v4tov5(char *, char *, int);
1529231SAfshin.Ardakani@Sun.COM char *smb_vop_catia_v5tov4(char *, char *, int);
1539231SAfshin.Ardakani@Sun.COM 
1545331Samw #ifdef __cplusplus
1555331Samw }
1565331Samw #endif
1575331Samw 
1585331Samw #endif /* _SMBSRV_SMB_VOPS_H */
159