From 8488cf7d03366ea9d65c9628802f1c56ec208c3a Mon Sep 17 00:00:00 2001 Message-Id: <8488cf7d03366ea9d65c9628802f1c56ec208c3a.1711655980.git.mdw@distorted.org.uk> From: Mark Wooding Date: Tue, 8 Jun 2010 23:09:54 +0100 Subject: [PATCH] Add a config option to suppres rescan on (un)mount. Organization: Straylight/Edgeware From: Richard Kettlewell --- CHANGES.html | 3 ++- doc/disorder_config.5.in | 5 ++++- lib/configuration.c | 2 ++ lib/configuration.h | 5 ++++- server/mount.c | 2 ++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGES.html b/CHANGES.html index 0f78a56..53c9fa0 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -77,7 +77,8 @@ span.command {

The server will now automatically initiate a rescan when a filesystem is - mounted or unmounted.

+ mounted or unmounted. (Use the mount_rescan option if you want to + suppress this behavior.)

The server takes care not to hold audio files open unnecessarily, so that devices can be unmounted even if tracks from them are currently being diff --git a/doc/disorder_config.5.in b/doc/disorder_config.5.in index a5b55ba..0c8f7c8 100644 --- a/doc/disorder_config.5.in +++ b/doc/disorder_config.5.in @@ -325,7 +325,6 @@ For \fBapi oss\fR the possible values are: .RS .TP 8 .B pcm - Output level for the audio device. This is probably what you want and is the default. .TP @@ -457,6 +456,10 @@ The default is 0. .IP For \fBapi coreaudio\fR, volume setting is not currently supported. .TP +.B mount_rescan yes\fR|\fBno +Determines whether mounts and unmounts will cause an automatic rescan. +The default is \fByes\fR. +.TP .B multicast_loop yes\fR|\fBno Determines whether multicast packets are loop backed to the sending host. The default is \fByes\fR. diff --git a/lib/configuration.c b/lib/configuration.c index 45f2329..0b173d4 100644 --- a/lib/configuration.c +++ b/lib/configuration.c @@ -1080,6 +1080,7 @@ static const struct conf conf[] = { { C(lock), &type_boolean, validate_any }, { C(mail_sender), &type_string, validate_any }, { C(mixer), &type_string, validate_any }, + { C(mount_rescan), &type_boolean, validate_any }, { C(multicast_loop), &type_boolean, validate_any }, { C(multicast_ttl), &type_integer, validate_non_negative }, { C(namepart), &type_namepart, validate_any }, @@ -1373,6 +1374,7 @@ static struct config *config_default(void) { c->sox_generation = DEFAULT_SOX_GENERATION; c->playlist_max = INT_MAX; /* effectively no limit */ c->playlist_lock_timeout = 10; /* 10s */ + c->mount_rescan = 1; /* Default stopwords */ if(config_set(&cs, (int)NDEFAULT_STOPWORDS, (char **)default_stopwords)) exit(1); diff --git a/lib/configuration.h b/lib/configuration.h index 617d929..22e107d 100644 --- a/lib/configuration.h +++ b/lib/configuration.h @@ -290,7 +290,10 @@ struct config { /** @brief Maximum bias */ long new_bias; - + + /** @brief Rescan on (un)mount */ + int mount_rescan; + /* derived values: */ int nparts; /* number of distinct name parts */ char **parts; /* name part list */ diff --git a/server/mount.c b/server/mount.c index 506b663..8b1c602 100644 --- a/server/mount.c +++ b/server/mount.c @@ -41,6 +41,8 @@ static int compare_fsstat(const void *av, const void *bv) { #endif void periodic_mount_check(ev_source *ev_) { + if(!config->mount_rescan) + return; #if HAVE_GETFSSTAT /* On OS X, we keep track of the hash of the kernel's mounted * filesystem list */ -- [mdw]