From 2c01eef4d7ea9ed57ea5f68a0e75559e101fd26f Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 14 May 2003 14:38:11 +0000 Subject: Evolve quotas configure check more. Patch from Stefan (metze) Metzemacher. Now we are defaulting to --with-quotas=no but anyway trying to test them in configure. This is done to get information about as much quota API variations as possible -- when --with-quotas=no this does not affect build but provides us with more detailed information on build farm. (This used to be commit 3786695c72e6ff6a52a527382ac77142e236971b) --- source3/configure.in | 79 +++++++++++++++++++++++++++++++++++++-------- source3/include/sysquotas.h | 5 +++ source3/lib/sysquotas.c | 7 ++++ source3/smbd/ntquotas.c | 5 +-- source3/smbd/nttrans.c | 12 +++---- source3/smbd/quotas.c | 5 +++ source3/smbd/trans2.c | 10 +++--- source3/smbd/vfs-wrap.c | 14 ++++++-- 8 files changed, 107 insertions(+), 30 deletions(-) diff --git a/source3/configure.in b/source3/configure.in index 28b3a3a26b..8b9a6b8252 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -2579,41 +2579,71 @@ AC_ARG_WITH(profiling-data, ################################################# # check for experimental disk-quotas support +samba_cv_WITH_QUOTAS=auto samba_cv_TRY_QUOTAS=no +samba_cv_RUN_QUOTA_TESTS=auto +samba_cv_WITH_SYS_QUOTAS=auto +samba_cv_TRY_SYS_QUOTAS=no + AC_MSG_CHECKING(whether to try disk-quotas support) AC_ARG_WITH(quotas, [ --with-quotas Include disk-quota support (default=no)], [ case "$withval" in yes) AC_MSG_RESULT(yes) + samba_cv_WITH_QUOTAS=yes samba_cv_TRY_QUOTAS=yes + samba_cv_RUN_QUOTA_TESTS=yes + #set sys quotas to auto in this case + samba_cv_TRY_SYS_QUOTAS=auto ;; - *) + auto) + AC_MSG_RESULT(auto) + samba_cv_WITH_QUOTAS=auto + samba_cv_TRY_QUOTAS=auto + samba_cv_RUN_QUOTA_TESTS=auto + #set sys quotas to auto in this case + samba_cv_TRY_SYS_QUOTAS=auto + ;; + no) AC_MSG_RESULT(no) + samba_cv_WITH_QUOTAS=no + samba_cv_TRY_QUOTAS=no + samba_cv_RUN_QUOTA_TESTS=no + ;; + *) + AC_MSG_RESULT(${samba_cv_TRY_QUOTAS}) ;; esac ], - AC_MSG_RESULT(no) + AC_MSG_RESULT(${samba_cv_TRY_QUOTAS}) ) -samba_cv_TRY_SYS_QUOTAS=auto AC_MSG_CHECKING(whether to try the new lib/sysquotas.c interface) AC_ARG_WITH(sys-quotas, [ --with-sys-quotas Include lib/sysquotas.c support (default=auto)], [ case "$withval" in yes) AC_MSG_RESULT(yes) - samba_cv_TRY_QUOTAS=yes + samba_cv_WITH_SYS_QUOTAS=yes samba_cv_TRY_SYS_QUOTAS=yes + samba_cv_RUN_QUOTA_TESTS=yes + ;; + auto) + AC_MSG_RESULT(auto) + samba_cv_WITH_SYS_QUOTAS=auto + samba_cv_TRY_SYS_QUOTAS=auto + samba_cv_RUN_QUOTA_TESTS=auto ;; no) AC_MSG_RESULT(no) + samba_cv_WITH_SYS_QUOTAS=no samba_cv_TRY_SYS_QUOTAS=no ;; *) - AC_MSG_RESULT(auto) + AC_MSG_RESULT(${samba_cv_TRY_SYS_QUOTAS}) ;; esac ], - AC_MSG_RESULT(auto) + AC_MSG_RESULT(${samba_cv_TRY_SYS_QUOTAS}) ) if test x"$samba_cv_TRY_SYS_QUOTAS" = x"auto"; then @@ -2621,18 +2651,19 @@ AC_MSG_CHECKING(whether to try the lib/sysquotas.c interface on ${host_os}) case "$host_os" in *linux*) AC_MSG_RESULT(yes) - samba_cv_TRY_SYS_QUOTAS=yes + samba_cv_TRY_SYS_QUOTAS=yes + samba_cv_RUN_QUOTA_TESTS=yes ;; *) AC_MSG_RESULT(no) - samba_cv_TRY_SYS_QUOTAS=no + samba_cv_TRY_SYS_QUOTAS=no ;; esac fi ############################################# # only check for quota stuff if --with-quotas -if test x"$samba_cv_TRY_QUOTAS" = x"yes"; then +if test x"$samba_cv_RUN_QUOTA_TESTS" != x"no"; then # For quotas on Veritas VxFS filesystems AC_CHECK_HEADERS(sys/fs/vx_quota.h) @@ -2755,8 +2786,22 @@ AC_CHECK_HEADERS(devnm.h) # check for devnm AC_CHECK_FUNCS(devnm) +if test x"$samba_cv_WITH_SYS_QUOTAS" = x"yes"; then + if test x"$samba_cv_SYSQUOTA_FOUND" != x"yes"; then + # if --with-sys-quotas=yes then build it + # you have can use the get/set quota command smb.conf + # options then + samba_cv_SYSQUOTA_FOUND=auto + fi + if test x"$samba_cv_TRY_SYS_QUOTAS" != x"yes"; then + # if --with-sys-quotas=yes then build it + # you have can use the get/set quota command smb.conf + # options then + samba_cv_TRY_SYS_QUOTAS=auto + fi +fi -if test x"$samba_cv_SYSQUOTA_FOUND" = x"yes"; then +if test x"$samba_cv_SYSQUOTA_FOUND" != x"no"; then AC_CACHE_CHECK([whether the sys_quota interface works],samba_cv_SYSQUOTA_WORKS,[ SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I. -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/popt -I${srcdir-.}/smbwrapper -I${srcdir-.}/nsswitch" @@ -2771,7 +2816,7 @@ CPPFLAGS="$SAVE_CPPFLAGS" ]) if test x"$samba_cv_SYSQUOTA_WORKS" = x"yes"; then AC_MSG_CHECKING(whether to use the new lib/sysquotas.c interface) - if test x"$samba_cv_TRY_SYS_QUOTAS" = x"yes"; then + if test x"$samba_cv_TRY_SYS_QUOTAS" != x"no"; then AC_DEFINE(WITH_QUOTAS,1,[Whether to use disk quota support]) AC_DEFINE(HAVE_SYS_QUOTAS,1,[Whether the new lib/sysquotas.c interface can be used]) samba_cv_WE_USE_SYS_QUOTAS=yes @@ -2794,13 +2839,21 @@ AC_TRY_COMPILE([ CPPFLAGS="$SAVE_CPPFLAGS" ]) if test x"$samba_cv_QUOTA_WORKS" = x"yes"; then +AC_MSG_CHECKING(whether to use the old quota support) if test x"$samba_cv_WE_USE_SYS_QUOTAS" != x"yes"; then - AC_DEFINE(WITH_QUOTAS,1,[Whether to use disk quota support]) + if test x"$samba_cv_TRY_QUOTAS" != x"no"; then + AC_DEFINE(WITH_QUOTAS,1,[Whether to use disk quota support]) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + else + AC_MSG_RESULT(no) fi fi #################### -# End of quota check +# End of quota check samba_cv_RUN_QUOTA_TESTS fi ################################################# diff --git a/source3/include/sysquotas.h b/source3/include/sysquotas.h index 46a265ed17..cfdac0609a 100644 --- a/source3/include/sysquotas.h +++ b/source3/include/sysquotas.h @@ -177,6 +177,11 @@ #endif /* HAVE_SYS_QUOTAS */ + +#ifndef QUOTABLOCK_SIZE +#define QUOTABLOCK_SIZE 1024 +#endif + /************************************************** Some stuff for the sys_quota api. **************************************************/ diff --git a/source3/lib/sysquotas.c b/source3/lib/sysquotas.c index ba58e87896..efc9e65b9d 100644 --- a/source3/lib/sysquotas.c +++ b/source3/lib/sysquotas.c @@ -23,6 +23,7 @@ #include "includes.h" +#ifdef HAVE_SYS_QUOTAS #if defined(HAVE_QUOTACTL_4A) /* long quotactl(int cmd, char *special, qid_t id, caddr_t addr) */ @@ -857,6 +858,12 @@ int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DI return ret; } +#else /* HAVE_SYS_QUOTAS */ + void dummy_sysquotas_c(void) +{ + return; +} +#endif /* HAVE_SYS_QUOTAS */ #else /* ! AUTOCONF_TEST */ /* this is the autoconf driver to test witch quota system we should use */ diff --git a/source3/smbd/ntquotas.c b/source3/smbd/ntquotas.c index f6f1479481..8685560897 100644 --- a/source3/smbd/ntquotas.c +++ b/source3/smbd/ntquotas.c @@ -119,11 +119,8 @@ int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, DOM_SID *psid, id.uid = -1; -#if defined(QUOTABLOCK_SIZE) D.bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE; -#else - D.bsize = (SMB_BIG_UINT)1024; -#endif + D.softlimit = limit_nt2unix(qt->softlim,D.bsize); D.hardlimit = limit_nt2unix(qt->hardlim,D.bsize); D.qflags = qt->qflags; diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 3ddf191ef6..3bf162f763 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -691,7 +691,7 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib if( strchr_m(fname, ':')) { -#ifdef WITH_QUOTAS +#ifdef HAVE_SYS_QUOTAS if ((fake_file_type=is_fake_file(fname))!=0) { /* * here we go! support for changing the disk quotas --metze @@ -706,7 +706,7 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib #endif END_PROFILE(SMBntcreateX); return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND); -#ifdef WITH_QUOTAS +#ifdef HAVE_SYS_QUOTAS } #endif } @@ -1830,7 +1830,7 @@ static int call_nt_transact_ioctl(connection_struct *conn, } -#ifdef WITH_QUOTAS +#ifdef HAVE_SYS_QUOTAS /**************************************************************************** Reply to get user quota ****************************************************************************/ @@ -2200,7 +2200,7 @@ static int call_nt_transact_set_user_quota(connection_struct *conn, return -1; } -#endif /* WITH_QUOTAS */ +#endif /* HAVE_SYS_QUOTAS */ /**************************************************************************** Reply to a SMBNTtrans. @@ -2445,7 +2445,7 @@ due to being in oplock break state.\n", (unsigned int)function_code )); &setup, ¶ms, &data); END_PROFILE_NESTED(NT_transact_query_security_desc); break; -#ifdef WITH_QUOTAS +#ifdef HAVE_SYS_QUOTAS case NT_TRANSACT_GET_USER_QUOTA: START_PROFILE_NESTED(NT_transact_get_user_quota); outsize = call_nt_transact_get_user_quota(conn, inbuf, outbuf, @@ -2464,7 +2464,7 @@ due to being in oplock break state.\n", (unsigned int)function_code )); &data, data_count); END_PROFILE_NESTED(NT_transact_set_user_quota); break; -#endif /* WITH_QUOTAS */ +#endif /* HAVE_SYS_QUOTAS */ default: /* Error in request */ DEBUG(0,("reply_nttrans: Unknown request %d in nttrans call\n", function_code)); diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c index 0163120ee5..91c952aa90 100644 --- a/source3/smbd/quotas.c +++ b/source3/smbd/quotas.c @@ -29,6 +29,11 @@ #ifndef HAVE_SYS_QUOTAS +/* just a quick hack because sysquotas.h is included before linux/quota.h */ +#ifdef QUOTABLOCK_SIZE +#undef QUOTABLOCK_SIZE +#endif + #ifdef WITH_QUOTAS #if defined(VXFS_QUOTA) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 731fb9643b..0bf9580798 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1480,7 +1480,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned SIVAL(pdata,4,0); /* characteristics */ break; -#ifdef WITH_QUOTAS +#ifdef HAVE_SYS_QUOTAS case SMB_FS_QUOTA_INFORMATION: /* * what we have to send --metze: @@ -1551,7 +1551,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned break; } -#endif /* WITH_QUOTAS */ +#endif /* HAVE_SYS_QUOTAS */ case SMB_FS_OBJECTID_INFORMATION: data_len = 64; break; @@ -1593,7 +1593,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned return -1; } -#ifdef WITH_QUOTAS +#ifdef HAVE_SYS_QUOTAS /**************************************************************************** Reply to a TRANS2_SETFSINFO (set filesystem info). ****************************************************************************/ @@ -1705,7 +1705,7 @@ static int call_trans2setfsinfo(connection_struct *conn, return outsize; } -#endif /* WITH_QUOTAS */ +#endif /* HAVE_SYS_QUOTAS */ /**************************************************************************** * Utility function to set bad path error. @@ -3492,7 +3492,7 @@ int reply_trans2(connection_struct *conn, END_PROFILE_NESTED(Trans2_qfsinfo); break; -#ifdef WITH_QUOTAS +#ifdef HAVE_SYS_QUOTAS case TRANSACT2_SETFSINFO: START_PROFILE_NESTED(Trans2_setfsinfo); outsize = call_trans2setfsinfo(conn, inbuf, outbuf, length, bufsize, diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c index 64e29bbe43..2160bca9f7 100644 --- a/source3/smbd/vfs-wrap.c +++ b/source3/smbd/vfs-wrap.c @@ -758,20 +758,30 @@ int vfswrap_sys_acl_free_qualifier(vfs_handle_struct *handle, connection_struct int vfswrap_get_quota(struct vfs_handle_struct *handle, struct connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt) { +#ifdef HAVE_SYS_QUOTAS int result; START_PROFILE(syscall_get_quota); result = sys_get_quota(conn->connectpath, qtype, id, qt); END_PROFILE(syscall_get_quota); - return result; + return result; +#else + errno = ENOSYS; + return -1; +#endif } int vfswrap_set_quota(struct vfs_handle_struct *handle, struct connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt) { +#ifdef HAVE_SYS_QUOTAS int result; START_PROFILE(syscall_set_quota); result = sys_set_quota(conn->connectpath, qtype, id, qt); END_PROFILE(syscall_set_quota); - return result; + return result; +#else + errno = ENOSYS; + return -1; +#endif } -- cgit