Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[droid] Support building for android

These are the changes necessary to build for android. Working status is yet
untested.
  • Loading branch information...
commit 252aa90dc87de7a4f6cdaff5a71edc74b9f8bad1 1 parent db0c9f4
Cory Fields authored
View
3  include/libnfs.h
@@ -18,6 +18,9 @@
* This is the highlevel interface to access NFS resources using a posix-like interface
*/
#include <stdint.h>
+#if defined(ANDROID)
@Memphiz
Memphiz added a note

Test compiling libnfs 1.6 on osx/ios i stumbled over that. We have a patch in xbmc removing the ifdef for android here since other platforms need sys/time.h aswell. Not sure if it is available on windows too.

But for beeing able to compile we need to include . Something to be considered for next version of libnfs so we can get rid of that patch ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+#include <sys/time.h>
+#endif
struct nfs_context;
struct rpc_context;
View
6 lib/libnfs-sync.c
@@ -23,7 +23,13 @@
#else
#include <strings.h>
#include <unistd.h>
+#ifndef ANDROID
#include <sys/statvfs.h>
+#else
+#include <netinet/in.h>
+#include <sys/vfs.h>
+#define statvfs statfs
+#endif
#include <poll.h>
#include <sys/ioctl.h>
#include <netdb.h>
View
7 lib/libnfs.c
@@ -22,7 +22,12 @@
#define DllExport
#else
#include <strings.h>
+#ifndef ANDROID
#include <sys/statvfs.h>
+#else
+#include <sys/vfs.h>
+#define statvfs statfs
+#endif
#include <utime.h>
#include <unistd.h>
#endif/*WIN32*/
@@ -2414,10 +2419,12 @@ static void nfs_statvfs_1_cb(struct rpc_context *rpc, int status, void *command_
svfs.f_bavail = res->FSSTAT3res_u.resok.abytes/4096;
svfs.f_files = res->FSSTAT3res_u.resok.tfiles;
svfs.f_ffree = res->FSSTAT3res_u.resok.ffiles;
+#if !defined(ANDROID)
svfs.f_favail = res->FSSTAT3res_u.resok.afiles;
svfs.f_fsid = 0;
svfs.f_flag = 0;
svfs.f_namemax = 256;
+#endif
data->cb(0, nfs, &svfs, data->private_data);
free_nfs_cb_data(data);
View
5 nfs/libnfs-raw-nfs.h
@@ -18,6 +18,11 @@ extern "C" {
#define NFS3_CREATEVERFSIZE 8
#define NFS3_COOKIEVERFSIZE 8
+#if defined(ANDROID)
+typedef long long int quad_t;
+typedef long long unsigned u_quad_t;
+#endif
+
typedef char cookieverf3[NFS3_COOKIEVERFSIZE];
typedef u_quad_t uint64;
View
4 nlm/libnfs-raw-nlm.h
@@ -13,6 +13,10 @@
extern "C" {
#endif
+#if defined(ANDROID)
+typedef long long int quad_t;
+typedef long long unsigned u_quad_t;
+#endif
struct nlm_fh4 {
struct {

2 comments on commit 252aa90

@Memphiz

Test compiling libnfs 1.6 on osx/ios i stumbled over that. We have a patch in xbmc removing the ifdef for android here since other platforms need sys/time.h aswell. Not sure if it is available on windows too.

But for beeing able to compile we need to include . Something to be considered for next version of libnfs so we can get rid of that patch ;).

@sahlberg
Owner

Does androind use configure ?
If so the right thing to clean up the ifdef-include mess is probably to put
both sys/time.h and netinet/in.h inside
HAVE_XXX_YYY

@sahlberg
Owner

The ifdef-include has been a mess for a while but i have cleaned some of it up.

You shouldnt need
#if defined(ANDROID)
#include
#endif
anymore.

You should be able to use
#ifdef HAVE_SYS_TIME_H
#include
#endif

in those .c files where you need it.

You can also get rid of this line
+#include 
since it is now included via a #ifdef HAVE_NETINET_IN_H in the files where needed.

Could you update the patch and then I will merge it into master for next release.

Please sign in to comment.
Something went wrong with that request. Please try again.