3 * unfs3 Windows compatibility
4 * Copyright 2006 Peter Åstrand <astrand@cendio.se> for Cendio AB
5 * see file LICENSE for license details
9 #ifndef UNFS3_WINSUPPORT_H
10 #define UNFS3_WINSUPPORT_H
17 #define LOG_EMERG 0 /* system is unusable */
18 #define LOG_ALERT 1 /* action must be taken immediately */
19 #define LOG_CRIT 2 /* critical conditions */
20 #define LOG_ERR 3 /* error conditions */
21 #define LOG_WARNING 4 /* warning conditions */
22 #define LOG_NOTICE 5 /* normal but significant condition */
23 #define LOG_INFO 6 /* informational */
24 #define LOG_DEBUG 7 /* debug-level messages */
28 #define closelog() do { } while (0)
31 #define ELOOP ENAMETOOLONG
34 #define S_IXGRP S_IRGRP
39 #define S_IXOTH S_IROTH
46 typedef int socklen_t;
50 typedef struct _backend_statstruct
67 typedef struct _backend_passwdstruct
71 } backend_passwdstruct;
73 /* Only includes fields actually used by unfs3 */
74 typedef struct _backend_statvfsstruct
76 unsigned long f_bsize; /* file system block size */
77 uint64 f_blocks; /* size of fs in f_frsize units */
78 uint64 f_bfree; /* # free blocks */
79 uint64 f_bavail; /* # free blocks for non-root */
80 uint64 f_files; /* # inodes */
81 uint64 f_ffree; /* # free inodes */
82 } backend_statvfsstruct;
84 typedef struct _UNFS3_WIN_DIR
86 _WDIR *stream; /* Windows DIR stream. NULL means root emulation */
87 uint32 currentdrive; /* Next drive to check/return */
92 int inet_aton(const char *cp, struct in_addr *addr);
93 ssize_t pread(int fd, void *buf, size_t count, off_t offset);
94 ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
95 void syslog(int priority, const char *format, ...);
97 int win_seteuid(uid_t euid);
98 int win_setegid(gid_t egid);
99 int win_truncate(const char *path, off_t length);
100 int win_chown(const char *path, uid_t owner, gid_t group);
101 int win_fchown(int fd, uid_t owner, gid_t group);
102 int win_fchmod(int fildes, mode_t mode);
103 int win_stat(const char *file_name, backend_statstruct *buf);
104 int win_fstat(int fd, backend_statstruct *buf);
105 int win_open(const char *pathname, int flags, ...);
106 int win_close(int fd);
107 UNFS3_WIN_DIR *win_opendir(const char *name);
108 struct dirent *win_readdir(UNFS3_WIN_DIR *dir);
109 int win_closedir(UNFS3_WIN_DIR *dir);
111 void openlog(const char *ident, int option, int facility);
112 char *win_realpath(const char *path, char *resolved_path);
113 int win_readlink(const char *path, char *buf, size_t bufsiz);
114 int win_mkdir(const char *pathname, mode_t mode);
115 int win_symlink(const char *oldpath, const char *newpath);
116 int win_mknod(const char *pathname, mode_t mode, dev_t dev);
117 int win_mkfifo(const char *pathname, mode_t mode);
118 int win_link(const char *oldpath, const char *newpath);
119 int win_statvfs(const char *path, backend_statvfsstruct *buf);
120 int win_remove(const char *pathname);
121 int win_chmod(const char *path, mode_t mode);
122 int win_utime(const char *path, const struct utimbuf *times);
123 int win_rmdir(const char *path);
124 int win_rename(const char *oldpath, const char *newpath);
125 int win_gen_nonce(char *nonce);
126 int win_utf8ncasecmp(const char *s1, const char *s2, size_t n);
127 int win_store_create_verifier(char *obj, createverf3 verf);
128 int win_check_create_verifier(backend_statstruct * buf, createverf3 verf);
130 #endif /* UNFS3_WINSUPPORT_H */