* Properly skip sorting on UPnPSearches of very large containers on sparc-based ReadyNAS processors.

This commit is contained in:
Justin Maggard 2009-04-30 23:58:27 +00:00
parent 226cf8bb66
commit a67c054ef7
3 changed files with 25 additions and 15 deletions

View File

@ -1,6 +1,6 @@
MiniDLNA is distributed under version 2 of the General Public License (included MiniDLNA is distributed under version 2 of the General Public License (included
in its entirety, below). Version 2 is the only version of this license which in its entirety, below). Version 2 is the only version of this license which
this version of BusyBox (or modified versions derived from this one) may be this version of MiniDLNA (or modified versions derived from this one) may be
distributed under. distributed under.
------------------------------------------------------------------------ ------------------------------------------------------------------------

View File

@ -16,6 +16,8 @@ DB_PATH="/tmp/minidlna"
# detecting the OS name and version # detecting the OS name and version
OS_NAME=`uname -s` OS_NAME=`uname -s`
OS_VERSION=`uname -r` OS_VERSION=`uname -r`
TIVO="/*#define TIVO_SUPPORT*/"
READYNAS="/*#define READYNAS*/"
${RM} ${CONFIGFILE} ${RM} ${CONFIGFILE}
@ -34,7 +36,7 @@ ${RM} ${CONFIGFILE}
! -e "/usr/include/ffmpeg/libavutil/avutil.h" ] && MISSING="libavutil $MISSING" ! -e "/usr/include/ffmpeg/libavutil/avutil.h" ] && MISSING="libavutil $MISSING"
[ ! -e "/usr/include/ffmpeg/avformat.h" -a \ [ ! -e "/usr/include/ffmpeg/avformat.h" -a \
! -e "/usr/include/libavformat/avformat.h" -a \ ! -e "/usr/include/libavformat/avformat.h" -a \
! -e "/usr/include/ffmpeg/libavformat/avformat.h" ] && MISSING="libformat $MISSING" ! -e "/usr/include/ffmpeg/libavformat/avformat.h" ] && MISSING="libavformat $MISSING"
[ ! -e "/usr/include/ffmpeg/avcodec.h" -a \ [ ! -e "/usr/include/ffmpeg/avcodec.h" -a \
! -e "/usr/include/libavcodec/avcodec.h" -a \ ! -e "/usr/include/libavcodec/avcodec.h" -a \
! -e "/usr/include/ffmpeg/libavcodec/avcodec.h" ] && MISSING="libavcodec $MISSING" ! -e "/usr/include/ffmpeg/libavcodec/avcodec.h" ] && MISSING="libavcodec $MISSING"
@ -100,8 +102,16 @@ case $OS_NAME in
KERNVERC=`echo $OS_VERSION | awk -F. '{print $3}'` KERNVERC=`echo $OS_VERSION | awk -F. '{print $3}'`
KERNVERD=`echo $OS_VERSION | awk -F. '{print $4}'` KERNVERD=`echo $OS_VERSION | awk -F. '{print $4}'`
#echo "$KERNVERA.$KERNVERB.$KERNVERC.$KERNVERD" #echo "$KERNVERA.$KERNVERB.$KERNVERC.$KERNVERD"
# NETGEAR ReadyNAS special case
if [ -f /etc/raidiator_version ]; then
OS_NAME=$(awk -F'!!|=' '{ print $1 }' /etc/raidiator_version)
OS_VERSION=$(awk -F'!!|[=,]' '{ print $3 }' /etc/raidiator_version)
OS_URL=http://www.readynas.com/
DB_PATH="/var/cache/minidlna"
TIVO="#define TIVO_SUPPORT"
READYNAS="#define READYNAS"
# Debian GNU/Linux special case # Debian GNU/Linux special case
if [ -f /etc/debian_version ]; then elif [ -f /etc/debian_version ]; then
OS_NAME=Debian OS_NAME=Debian
OS_VERSION=`cat /etc/debian_version` OS_VERSION=`cat /etc/debian_version`
OS_URL=http://www.debian.org/ OS_URL=http://www.debian.org/
@ -112,11 +122,9 @@ case $OS_NAME in
OS_NAME=`${LSB_RELEASE} -i -s` OS_NAME=`${LSB_RELEASE} -i -s`
OS_VERSION=`${LSB_RELEASE} -r -s` OS_VERSION=`${LSB_RELEASE} -r -s`
fi fi
echo "#define USE_NETFILTER 1" >> ${CONFIGFILE}
;; ;;
*) *)
echo "Unknown OS : $OS_NAME" echo "Unknown OS : $OS_NAME"
echo "Please contact the author at http://miniupnp.free.fr/"
exit 1 exit 1
;; ;;
esac esac
@ -144,7 +152,9 @@ fi
echo "" >> ${CONFIGFILE} echo "" >> ${CONFIGFILE}
echo "/* Enable NETGEAR ReadyNAS-specific tweaks. */" >> ${CONFIGFILE} echo "/* Enable NETGEAR ReadyNAS-specific tweaks. */" >> ${CONFIGFILE}
echo "/*#define READYNAS*/" >> ${CONFIGFILE} echo "${READYNAS}" >> ${CONFIGFILE}
echo "/* Compile in TiVo support. */" >> ${CONFIGFILE}
echo "${TIVO}" >> ${CONFIGFILE}
echo "" >> ${CONFIGFILE} echo "" >> ${CONFIGFILE}
echo "#endif" >> ${CONFIGFILE} echo "#endif" >> ${CONFIGFILE}

View File

@ -639,11 +639,6 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
if( !RequestedCount ) if( !RequestedCount )
RequestedCount = -1; RequestedCount = -1;
#ifdef __sparc__ /* Sorting takes too long on slow processors with very large containers */
if( totalMatches < 10000 )
#endif
orderBy = parse_sort_criteria(SortCriteria);
args.resp = resp; args.resp = resp;
args.size = sprintf(resp, "%s", resp0); args.size = sprintf(resp, "%s", resp0);
@ -699,6 +694,11 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
totalMatches = atoi(result[1]); totalMatches = atoi(result[1]);
sqlite3_free_table(result); sqlite3_free_table(result);
} }
#ifdef __sparc__ /* Sorting takes too long on slow processors with very large containers */
if( totalMatches < 10000 )
#endif
orderBy = parse_sort_criteria(SortCriteria);
sql = sqlite3_mprintf( SELECT_COLUMNS sql = sqlite3_mprintf( SELECT_COLUMNS
"from OBJECTS o left join DETAILS d on (d.ID = o.DETAIL_ID)" "from OBJECTS o left join DETAILS d on (d.ID = o.DETAIL_ID)"
" where PARENT_ID = '%s' %s limit %d, %d;", " where PARENT_ID = '%s' %s limit %d, %d;",
@ -767,10 +767,6 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
if( !RequestedCount ) if( !RequestedCount )
RequestedCount = -1; RequestedCount = -1;
#ifdef __sparc__ /* Sorting takes too long on slow processors with very large containers */
if( totalMatches < 10000 )
#endif
orderBy = parse_sort_criteria(SortCriteria);
args.resp = resp; args.resp = resp;
args.size = sprintf(resp, "%s", resp0); args.size = sprintf(resp, "%s", resp0);
@ -872,6 +868,10 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
totalMatches = atoi(result[1]); totalMatches = atoi(result[1]);
sqlite3_free_table(result); sqlite3_free_table(result);
} }
#ifdef __sparc__ /* Sorting takes too long on slow processors with very large containers */
if( totalMatches < 10000 )
#endif
orderBy = parse_sort_criteria(SortCriteria);
sql = sqlite3_mprintf( SELECT_COLUMNS sql = sqlite3_mprintf( SELECT_COLUMNS
"from OBJECTS o left join DETAILS d on (d.ID = o.DETAIL_ID)" "from OBJECTS o left join DETAILS d on (d.ID = o.DETAIL_ID)"