Herb's warning fixes. Also the POSIX locking fix.
[samba.git] / source / include / vfs.h
index 1b4e57f2ac14d98ee09adfce1057f4e4cb7e869e..3624311c301389a516ae598e80cdd55b894b7424 100644 (file)
 #ifndef _VFS_H
 #define _VFS_H
 
-/* Types used in the definition of VFS operations.  These are included
-   here so the vfs.h file can be included by VFS modules without
-   having to pull in unnecessary amounts of other stuff.  Note to VFS
-   writers: you must include config.h before including this file.
-   The following type definitions reference the HAVE_* symbols which
-   are defined in config.h */
-
-#ifndef SMB_OFF_T
-#  ifdef HAVE_OFF64_T
-#    define SMB_OFF_T off64_t
-#  else
-#    define SMB_OFF_T off_t
-#  endif
-#endif
-
-#ifndef SMB_STRUCT_STAT
-#  if defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
-#    define SMB_STRUCT_STAT struct stat64
-#  else
-#    define SMB_STRUCT_STAT struct stat
-#  endif
-#endif
-
-#ifndef _BOOL
-typedef int BOOL;
-#endif
-
-#ifndef _PSTRING
-#define PSTRING_LEN 1024
-#define FSTRING_LEN 128
-
-typedef char pstring[PSTRING_LEN];
-typedef char fstring[FSTRING_LEN];
-#define _PSTRING
-#endif
-
-#if defined(HAVE_LONGLONG)
-#define SMB_BIG_UINT unsigned long long
-#else
-#define SMB_BIG_UINT unsigned long
-#endif
-
-/* Information from the connection_struct passed to the vfs layer */
-
-struct vfs_connection_struct {
-
-    /* Connection information */
-
-    BOOL printer;
-    BOOL ipc;
-    BOOL read_only;
-    BOOL admin_user;
-
-    /* Handle on dlopen() call */
-
-    void *dl_handle;
-
-    /* Paths */
-
-    pstring dirpath;
-    pstring connectpath;
-    pstring origpath;
-    pstring service;
-    
-    /* Information on user who *opened* this connection */
-
-    pstring user;
-    uid_t uid;
-    gid_t gid;
-    int ngroups;
-    gid_t *groups;
-};
-
 /* Avoid conflict with an AIX include file */
 
 #ifdef vfs_ops
 #undef vfs_ops
 #endif
 
+/*
+ * As we're now (thanks Andrew ! :-) using file_structs and connection
+ * structs in the vfs - then anyone writing a vfs must include includes.h...
+ */
+
 /* VFS operations structure */
 
+struct connection_struct;
+struct files_struct;
+struct security_descriptor_info;
+
 struct vfs_ops {
 
     /* Disk operations */
     
-    int (*connect)(struct vfs_connection_struct *conn, char *service, 
-                  char *user);
-    void (*disconnect)(void);
-    SMB_BIG_UINT (*disk_free)(char *path, BOOL small_query, SMB_BIG_UINT *bsize, 
+    int (*connect)(struct connection_struct *conn, char *service, char *user);
+    void (*disconnect)(struct connection_struct *conn);
+    SMB_BIG_UINT (*disk_free)(struct connection_struct *conn, char *path, BOOL small_query, SMB_BIG_UINT *bsize, 
                              SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
     
     /* Directory operations */
 
-    DIR *(*opendir)(char *fname);
-    struct dirent *(*readdir)(DIR *dirp);
-    int (*mkdir)(char *path, mode_t mode);
-    int (*rmdir)(char *path);
-    int (*closedir)(DIR *dir);
+    DIR *(*opendir)(struct connection_struct *conn, char *fname);
+    struct dirent *(*readdir)(struct connection_struct *conn, DIR *dirp);
+    int (*mkdir)(struct connection_struct *conn, char *path, mode_t mode);
+    int (*rmdir)(struct connection_struct *conn, char *path);
+    int (*closedir)(struct connection_struct *conn, DIR *dir);
     
     /* File operations */
     
-    int (*open)(char *fname, int flags, mode_t mode);
-    int (*close)(int fd);
-    ssize_t (*read)(int fd, char *data, size_t n);
-    ssize_t (*write)(int fd, char *data, size_t n);
-    SMB_OFF_T (*lseek)(int filedes, SMB_OFF_T offset, int whence);
-    int (*rename)(char *old, char *new);
-    int (*fsync)(int fd);
-    int (*stat)(char *fname, SMB_STRUCT_STAT *sbuf);
-    int (*fstat)(int fd, SMB_STRUCT_STAT *sbuf);
-    int (*lstat)(char *path, SMB_STRUCT_STAT *sbuf);
-    int (*unlink)(char *path);
-    int (*chmod)(char *path, mode_t mode);
-    int (*utime)(char *path, struct utimbuf *times);
-       int (*ftruncate)(int fd, SMB_OFF_T offset);
-       BOOL (*lock)(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
+    int (*open)(struct connection_struct *conn, char *fname, int flags, mode_t mode);
+    int (*close)(struct files_struct *fsp, int fd);
+    ssize_t (*read)(struct files_struct *fsp, int fd, char *data, size_t n);
+    ssize_t (*write)(struct files_struct *fsp, int fd, char *data, size_t n);
+    SMB_OFF_T (*lseek)(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence);
+    int (*rename)(struct connection_struct *conn, char *old, char *new);
+    int (*fsync)(struct files_struct *fsp, int fd);
+    int (*stat)(struct connection_struct *conn, char *fname, SMB_STRUCT_STAT *sbuf);
+    int (*fstat)(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf);
+    int (*lstat)(struct connection_struct *conn, char *path, SMB_STRUCT_STAT *sbuf);
+    int (*unlink)(struct connection_struct *conn, char *path);
+    int (*chmod)(struct connection_struct *conn, char *path, mode_t mode);
+       int (*chown)(struct connection_struct *conn, char *path, uid_t uid, gid_t gid);
+       int (*chdir)(struct connection_struct *conn, char *path);
+       char *(*getwd)(struct connection_struct *conn, char *buf);
+    int (*utime)(struct connection_struct *conn, char *path, struct utimbuf *times);
+       int (*ftruncate)(struct files_struct *fsp, int fd, SMB_OFF_T offset);
+       BOOL (*lock)(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
+
+       size_t (*fget_nt_acl)(struct files_struct *fsp, int fd, struct security_descriptor_info **ppdesc);
+       size_t (*get_nt_acl)(struct files_struct *fsp, char *name, struct security_descriptor_info **ppdesc);
+       BOOL (*fset_nt_acl)(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd);
+       BOOL (*set_nt_acl)(struct files_struct *fsp, char *name, uint32 security_info_sent, struct security_descriptor_info *psd);
 };
 
 struct vfs_options {