Skip to content

Commit

Permalink
Proclikefs compiles on Linux 3.13.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Oct 15, 2015
1 parent fce8384 commit 046462a
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 17 deletions.
3 changes: 3 additions & 0 deletions config-linuxmodule.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
/* Define if you have the d_make_root function. */
#undef HAVE_LINUX_D_MAKE_ROOT

/* Define if 'struct dentry' has a 'd_child' member. */
#undef HAVE_LINUX_DENTRY_D_CHILD

/* Define if your Linux kernel has dev_ioctl. */
#undef HAVE_LINUX_DEV_IOCTL

Expand Down
70 changes: 57 additions & 13 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,6 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -906,7 +905,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
Expand Down Expand Up @@ -1159,15 +1157,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;

-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;

-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1305,7 +1294,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1458,7 +1447,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand Down Expand Up @@ -12673,6 +12661,62 @@ $as_echo "#define HAVE_LINUX_D_MAKE_ROOT 1" >>confdefs.h

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct dentry has a d_child member" >&5
$as_echo_n "checking whether struct dentry has a d_child member... " >&6; }
if ${ac_cv_linuxmodule_dentry_d_child+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu

cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define KBUILD_STR(s) #s
#define KBUILD_BASENAME KBUILD_STR(click)
#define KBUILD_MODNAME KBUILD_STR(click)
#define new linux_new
#define this linux_this
#define delete linux_delete
#define class linux_class
#define virtual linux_virtual
#define typename linux_typename
#define private linux_private
#define protected linux_protected
#define public linux_public
#define namespace linux_namespace
#define false linux_false
#define true linux_true
#define CLICK_CXX_PROTECTED 1
$linux_autoconf_include
#include <asm/types.h>
#include <linux/fs.h>
#include <linux/dcache.h>
int
main ()
{
extern struct dentry* de; de->d_child.next = 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_linuxmodule_dentry_d_child=yes
else
ac_cv_linuxmodule_dentry_d_child=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_linuxmodule_dentry_d_child" >&5
$as_echo "$ac_cv_linuxmodule_dentry_d_child" >&6; }
if test $ac_cv_linuxmodule_dentry_d_child = yes; then

$as_echo "#define HAVE_LINUX_DENTRY_D_CHILD 1" >>confdefs.h

fi

fi
CC="$save_cc"
CXX="$save_cxx"
Expand Down
11 changes: 11 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,17 @@ CFLAGS="$save_cflags"
AC_DEFINE([HAVE_LINUX_D_MAKE_ROOT], [1], [Define if you have the d_make_root function.])
fi

AC_CACHE_CHECK([whether struct dentry has a d_child member], [ac_cv_linuxmodule_dentry_d_child],
[AC_LANG_C
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([CLICK_LINUXMODULE_PROLOGUE()[
#include <linux/fs.h>
#include <linux/dcache.h>]],
[[extern struct dentry* de; de->d_child.next = 0;]])],
[ac_cv_linuxmodule_dentry_d_child=yes], [ac_cv_linuxmodule_dentry_d_child=no])])
if test $ac_cv_linuxmodule_dentry_d_child = yes; then
AC_DEFINE([HAVE_LINUX_DENTRY_D_CHILD], [1], [Define if 'struct dentry' has a 'd_child' member.])
fi

fi dnl ac_cv_cxx_aware_system

CC="$save_cc"
Expand Down
8 changes: 4 additions & 4 deletions linuxmodule/proclikefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,14 @@ proclikefs_kill_super(struct super_block *sb)
struct dentry *active = dentry_tree;
/* Process this dentry, move to next */
active->d_op = &proclikefs_null_dentry_operations;
dentry_tree = (struct dentry *)active->d_fsdata;
dentry_tree = (struct dentry*) active->d_fsdata;
/* Prepend children to dentry_tree */
next = active->d_subdirs.next;
while (next != &active->d_subdirs) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
struct dentry *child = list_entry(next, struct dentry, d_u.d_child);
#if HAVE_LINUX_DENTRY_D_CHILD
struct dentry* child = list_entry(next, struct dentry, d_child);
#else
struct dentry *child = list_entry(next, struct dentry, d_child);
struct dentry* child = list_entry(next, struct dentry, d_u.d_child);
#endif
next = next->next;
d_drop(child);
Expand Down

0 comments on commit 046462a

Please sign in to comment.