/* Example program using the highlevel async interface.
*/
-
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <poll.h>
+#endif
+
#define SERVER "10.1.1.27"
#define EXPORT "/VIRTUAL"
#define NFSFILE "/BOOKS/Classics/Dracula.djvu"
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
-#include <sys/stat.h>
#include <unistd.h>
-#include <fcntl.h>
-#include <poll.h>
#include "libnfs.h"
#include "libnfs-raw.h"
#include "libnfs-raw-mount.h"
* This allow accurate control of the exact commands that are being used.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <poll.h>
+#endif
#define SERVER "10.1.1.27"
#define EXPORT "/shared"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <poll.h>
#include "libnfs.h"
#include "libnfs-raw.h"
#include "libnfs-raw-mount.h"
/* Example program using the highlevel sync interface
*/
-
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/statvfs.h>
+#endif
+
#define SERVER "10.1.1.27"
#define EXPORT "/VIRTUAL"
#define NFSFILE "/BOOKS/Classics/Dracula.djvu.truncated"
#define _GNU_SOURCE
#if defined(WIN32)
-#include <winsock2.h>
-typedef int off_t;
#pragma comment(lib, "ws2_32.lib")
WSADATA wsaData;
#else
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#define _GNU_SOURCE
-
-#if defined(WIN32)
-#include <winsock2.h>
+#ifdef WIN32
+#include "win32_compat.h"
#else
#include <unistd.h>
#include <strings.h>
-#endif
+#endif/*WIN32*/
+#define _GNU_SOURCE
#include <stdio.h>
#include <stdarg.h>
/*
* High level api to nfs filesystems
*/
-
-#if defined (WIN32)
-#include <winsock2.h>
+#ifdef WIN32
+#include "win32_compat.h"
#define DllExport
#else
#include <strings.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
+
#ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#endif
+
+#include <fcntl.h>
+#include <errno.h>
#include "libnfs.h"
#include "libnfs-raw.h"
#include "libnfs-raw-mount.h"
nfs_set_error(nfs, "statvfs call failed with \"%s\"", (char *)data);
return;
}
-
+#ifndef WIN32
memcpy(cb_data->return_data, data, sizeof(struct statvfs));
+#else
+ cb_data->return_data=NULL;
+#endif/**/
}
int nfs_statvfs(struct nfs_context *nfs, const char *path, struct statvfs *svfs)
srv_data->srvrs = srvr;
}
+#ifndef WIN32
static int send_nfsd_probes(struct rpc_context *rpc, struct ifconf *ifc, struct nfs_list_data *data)
{
char *ptr;
return 0;
}
+#endif/*WIN32 TODO implement this with win32api FIXME*/
struct nfs_server_list *nfs_find_local_servers(void)
{
struct rpc_context *rpc;
struct nfs_list_data data = {0, NULL};
+#ifndef WIN32
struct timeval tv_start, tv_current;
struct ifconf ifc;
int size, loop;
free_nfs_srvr_list(data.srvrs);
return NULL;
}
-
+#endif/*WIN32 - FIXME redef it when send_nfsd_probes is implemented for win32*/
return data.srvrs;
}
#endif
/*
* High level api to nfs filesystems
*/
-
-#define _GNU_SOURCE
-
-#if defined(WIN32)
-#include <winsock2.h>
+#ifdef WIN32
+#include "win32_compat.h"
#define DllExport
-#define O_SYNC 0
-typedef int uid_t;
-typedef int gid_t;
#else
#include <strings.h>
#include <sys/statvfs.h>
#include <utime.h>
#include <unistd.h>
-#endif
+#endif/*WIN32*/
+
+#define _GNU_SOURCE
#include <stdio.h>
#include <stdarg.h>
st.st_gid = res->GETATTR3res_u.resok.obj_attributes.gid;
st.st_rdev = 0;
st.st_size = res->GETATTR3res_u.resok.obj_attributes.size;
-#if !defined(WIN32)
+#ifndef WIN32
st.st_blksize = 4096;
st.st_blocks = res->GETATTR3res_u.resok.obj_attributes.size / 4096;
-#endif
+#endif//WIN32
st.st_atime = res->GETATTR3res_u.resok.obj_attributes.atime.seconds;
st.st_mtime = res->GETATTR3res_u.resok.obj_attributes.mtime.seconds;
st.st_ctime = res->GETATTR3res_u.resok.obj_attributes.ctime.seconds;
FSSTAT3res *res;
struct nfs_cb_data *data = private_data;
struct nfs_context *nfs = data->nfs;
+#ifndef WIN32
struct statvfs svfs;
+#endif/*WIN32*/
if (status == RPC_STATUS_ERROR) {
data->cb(-EFAULT, nfs, command_data, data->private_data);
return;
}
+#ifndef WIN32
svfs.f_bsize = 4096;
svfs.f_frsize = 4096;
svfs.f_blocks = res->FSSTAT3res_u.resok.tbytes/4096;
svfs.f_namemax = 256;
data->cb(0, nfs, &svfs, data->private_data);
+#else
+ data->cb(0, nfs,NULL, data->private_data);
+#endif/*WIN32*/
free_nfs_cb_data(data);
}
free(nfs->rpc->error_string);
}
nfs->rpc->error_string = str;
- va_end(ap);
+ va_end(ap);
}
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-
-#if defined(WIN32)
-#include <winsock2.h>
+#ifdef WIN32
+#include "win32_compat.h"
+#ifndef MSG_DONTWAIT
#define MSG_DONTWAIT 0
+#endif
#else
#include <strings.h>
-#endif
+#endif/*WIN32*/
#include <stdio.h>
#include <stdlib.h>
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <unistd.h>
+#include <poll.h>
+#include <arpa/inet.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#endif/*WIN32*/
#if defined(WIN32)
#include <winsock2.h>
unsigned v;
v = fcntl(fd, F_GETFL, 0);
fcntl(fd, F_SETFL, v | O_NONBLOCK);
-#endif
+#endif //FIXME
}
int rpc_get_fd(struct rpc_context *rpc)
rpc_set_error(rpc, "Ioctl FIONREAD returned error : %d. Closing socket.", errno);
return -1;
}
+
if (available == 0) {
rpc_set_error(rpc, "Socket has been closed");
return -1;
int rpc_service(struct rpc_context *rpc, int revents)
{
if (revents & POLLERR) {
- int err = 0;
+ char err = 0;
socklen_t err_size = sizeof(err);
if (getsockopt(rpc->fd, SOL_SOCKET, SO_ERROR,
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#if defined(WIN32)
-#include <winsock2.h>
-#endif
+#ifdef WIN32
+#include "win32_compat.h"
+#endif/*WIN32*/
#include <stdio.h>
#include <errno.h>
#include "libnfs-private.h"
#include "libnfs-raw-mount.h"
-
int rpc_mount_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#if defined(WIN32)
-#include <winsock2.h>
-#define S_IRUSR 0000400
-#define S_IWUSR 0000200
-#define S_IXUSR 0000100
-#define S_IRGRP 0000040
-#define S_IWGRP 0000020
-#define S_IXGRP 0000010
-#define S_IROTH 0000004
-#define S_IWOTH 0000002
-#define S_IXOTH 0000001
-#endif
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <sys/stat.h>
+#endif/*WIN32*/
#include <stdio.h>
#include <errno.h>
-#include <sys/stat.h>
#include <string.h>
#include <rpc/rpc.h>
#include <rpc/xdr.h>
#include "libnfs-private.h"
#include "libnfs-raw-nfs.h"
-
+#ifdef WIN32
+#define bzero(a,b) memset((a),(0),(b))
+#endif/*WIN32*/
char *nfsstat3_to_str(int error)
{
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#else
+#include <sys/stat.h>
+#endif/*WIN32*/
#if defined(WIN32)
#include <winsock2.h>
#include <stdio.h>
#include <errno.h>
-#include <sys/stat.h>
#include <string.h>
#include <rpc/rpc.h>
#include <rpc/xdr.h>
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#endif/*WIN32*/
#if defined(WIN32)
#include <winsock2.h>
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef WIN32
+#include "win32_compat.h"
+#endif/*WIN32*/
#if defined(WIN32)
#include <winsock2.h>