xref: /onnv-gate/usr/src/uts/common/smbsrv/smb_vops.h (revision 9231:152b6e0d9b1a)
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>
445331Samw #include <smbsrv/smb_i18n.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 */
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
945331Samw #define	SMB_AT_SMB	0x00300000
955331Samw 
965331Samw #define	SMB_AT_ALL	(SMB_AT_TYPE|SMB_AT_MODE|SMB_AT_UID|SMB_AT_GID|\
975331Samw 			SMB_AT_FSID|SMB_AT_NODEID|SMB_AT_NLINK|SMB_AT_SIZE|\
985331Samw 			SMB_AT_ATIME|SMB_AT_MTIME|SMB_AT_CTIME|SMB_AT_RDEV|\
995331Samw 			SMB_AT_BLKSIZE|SMB_AT_NBLOCKS|SMB_AT_SEQ|SMB_AT_SMB)
1005331Samw 
1015331Samw int fhopen(const struct smb_node *, int);
1025331Samw 
1036139Sjb150015 int smb_vop_init(void);
1046139Sjb150015 void smb_vop_fini(void);
1056139Sjb150015 void smb_vop_start(void);
1066139Sjb150015 int smb_vop_open(vnode_t **, int, cred_t *);
1077348SJose.Borrego@Sun.COM void smb_vop_close(vnode_t *, int, cred_t *);
1086139Sjb150015 int smb_vop_read(vnode_t *, uio_t *, cred_t *);
1097052Samw int smb_vop_write(vnode_t *, uio_t *, int, uint32_t *, cred_t *);
1106139Sjb150015 int smb_vop_getattr(vnode_t *, vnode_t *, smb_attr_t *, int, cred_t *);
1117757SJanice.Chang@Sun.COM int smb_vop_setattr(vnode_t *, vnode_t *, smb_attr_t *, int, cred_t *);
1126139Sjb150015 int smb_vop_access(vnode_t *, int, int, vnode_t *, cred_t *);
1136139Sjb150015 void smb_vop_eaccess(vnode_t *, int *, int, vnode_t *, cred_t *);
114*9231SAfshin.Ardakani@Sun.COM int smb_vop_lookup(vnode_t *, char *, vnode_t **, char *, int, int *, vnode_t *,
1155772Sas200622     cred_t *);
1166139Sjb150015 int smb_vop_create(vnode_t *, char *, smb_attr_t *, vnode_t **, int, cred_t *,
1176139Sjb150015     vsecattr_t *);
1186139Sjb150015 int smb_vop_remove(vnode_t *, char *, int, cred_t *);
1196139Sjb150015 int smb_vop_rename(vnode_t *, char *, vnode_t *, char *, int, cred_t *);
1206139Sjb150015 int smb_vop_mkdir(vnode_t *, char *, smb_attr_t *, vnode_t **, int, cred_t *,
1216139Sjb150015     vsecattr_t *);
1226139Sjb150015 int smb_vop_rmdir(vnode_t *, char *, int, cred_t *);
1238670SJose.Borrego@Sun.COM int smb_vop_readdir(vnode_t *, uint32_t, void *, int *, int *, cred_t *);
1246139Sjb150015 int smb_vop_commit(vnode_t *, cred_t *);
1256139Sjb150015 int smb_vop_statfs(vnode_t *, struct statvfs64 *, cred_t *);
1266139Sjb150015 int smb_vop_stream_lookup(vnode_t *, char *, vnode_t **, char *, vnode_t **,
1276139Sjb150015     int, vnode_t *, cred_t *);
1286139Sjb150015 int smb_vop_stream_create(vnode_t *, char *, smb_attr_t *, vnode_t **,
1296139Sjb150015     vnode_t **, int, cred_t *);
1306139Sjb150015 int smb_vop_stream_remove(vnode_t *, char *, int, cred_t *);
1316139Sjb150015 int smb_vop_lookup_xattrdir(vnode_t *, vnode_t **, int, cred_t *);
1326139Sjb150015 int smb_vop_traverse_check(vnode_t **);
1335331Samw 
1345772Sas200622 int smb_vop_acl_read(vnode_t *, acl_t **, int, acl_type_t, cred_t *);
1355772Sas200622 int smb_vop_acl_write(vnode_t *, acl_t *, int, cred_t *);
1365772Sas200622 acl_type_t smb_vop_acl_type(vnode_t *);
1375772Sas200622 
1385772Sas200622 int smb_vop_shrlock(vnode_t *, uint32_t, uint32_t, uint32_t, cred_t *);
1395772Sas200622 int smb_vop_unshrlock(vnode_t *, uint32_t, cred_t *);
1405331Samw 
1416600Sas200622 int smb_vop_frlock(vnode_t *, cred_t *, int, flock64_t *);
1426600Sas200622 
143*9231SAfshin.Ardakani@Sun.COM void smb_vop_catia_v4tov5(char *, char *, int);
144*9231SAfshin.Ardakani@Sun.COM char *smb_vop_catia_v5tov4(char *, char *, int);
145*9231SAfshin.Ardakani@Sun.COM 
1465331Samw #ifdef __cplusplus
1475331Samw }
1485331Samw #endif
1495331Samw 
1505331Samw #endif /* _SMBSRV_SMB_VOPS_H */
151