Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails to compile on FreeBSD (113.33.00) #8

Closed
hannesm opened this issue Apr 19, 2016 · 4 comments
Closed

fails to compile on FreeBSD (113.33.00) #8

hannesm opened this issue Apr 19, 2016 · 4 comments

Comments

@hannesm
Copy link

hannesm commented Apr 19, 2016

# src/extended_unix_stubs.c:150:55: error: no member named 'dqb_curbytes' in 'struct dqblk64'
# [...]
#                                                       ^~~~~~~~~~~~~~~~~~~~~~~
# src/extended_unix_stubs.c:100:44: note: expanded from macro 'QUOTA_SPACE_USED'
# #  define QUOTA_SPACE_USED(quota) ((quota).dqb_curbytes)
#                                    ~~~~~~~ ^
#1 error generated.
@ghost
Copy link

ghost commented Apr 19, 2016

If you have a patch, I can integrate it in the next minor release. Hopefully for the next major release we'll have freebsd builds on our side

@magv
Copy link

magv commented Jun 22, 2016

Here's a patch that fixes compilation for me (on FreeBSD 10.1), and to my knowledge is correct, but is completely untested, since I don't use quotas. In fact, I don't even know if quotactl works on ZFS (or NFS), since it's declaration lies under <ufs/ufs/quota.h>.

--- src/extended_unix_stubs.c.orig  2016-04-28 12:46:22.000000000 +0300
+++ src/extended_unix_stubs.c   2016-06-23 01:58:03.000000000 +0300
@@ -92,7 +92,16 @@
   CAMLreturn(v_ret);
 }

-#if !(defined _LINUX_QUOTA_VERSION) /* BSD, Mac OS */
+#if defined (__FreeBSD__) || defined (__OpenBSD__)
+
+#  define quota_control(device, cmd, id, parg)  \
+     quotactl((device), (cmd), (id), (parg))
+#  define QUOTA_BYTES_PER_SPACE_UNIT DEV_BSIZE
+#  define QUOTA_SPACE_USED(quota) ((quota).dqb_curblocks)
+#  define QUOTA_MODIFY_COMMAND Q_SETQUOTA
+#  define QUOTA_SET_VALID_FIELDS(quota) ((void)quota)
+
+#elif !(defined _LINUX_QUOTA_VERSION) /* Mac OS */

 #  define quota_control(device, cmd, id, parg)  \
      quotactl((device), (cmd), (id), (parg))

@seliopou
Copy link
Member

Fixed by e3ba689

@ghost ghost closed this as completed Jul 20, 2016
@magv
Copy link

magv commented Jul 20, 2016

Why did you set QUOTA_BYTES_PER_SPACE_UNIT to 1 though? As far as I'm
aware dqb_curblocks field is expressed in number of blocks, where one
block is DEV_BSIZE (=512) bytes.

Now, dqb_curblocks is not really mentioned in any man page I know of,
but you can infer it's intended usage by searching for it in quota(1)
sources at [1], edquota(1) at [2], or directly look at "dbtob" macro,
which is used to convert dqb_curblocks to bytes over at [3](dbtob%28x%29
is x<<DEV_BSHIFT = x*DEV_BSIZE).

[1] http://svnweb.freebsd.org/base/release/10.2.0/usr.bin/quota/quota.c?revision=286717&view=markup
[2] http://svnweb.freebsd.org/base/release/10.2.0/usr.sbin/edquota/edquota.c?revision=286717&view=markup
[3] http://svnweb.freebsd.org/base/release/10.2.0/sys/sys/param.h?revision=286717&view=markup#l209

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants