diff options
-rw-r--r-- | HISTORY | 9 | ||||
-rw-r--r-- | UPDATE-1.6.0 | 13 | ||||
-rw-r--r-- | recording.c | 46 | ||||
-rw-r--r-- | tools.c | 17 | ||||
-rw-r--r-- | tools.h | 3 | ||||
-rw-r--r-- | videodir.c | 11 | ||||
-rw-r--r-- | videodir.h | 3 |
7 files changed, 74 insertions, 28 deletions
@@ -5579,7 +5579,7 @@ Video Disk Recorder Revision History is not available, in order to allow staying on an encrypted channel that takes a while for the CAM to start decrypting. -2008-02-10: Version 1.5.15 +2008-02-16: Version 1.5.15 - Updated the Italian OSD texts (thanks to Diego Pierotto). - Added option -i to the pictures plugin's pic2mpg to ignore unknown file types. @@ -5624,3 +5624,10 @@ Video Disk Recorder Revision History stopped immediately (thanks to Mikko Matilainen for reporting a possible crash if the Info key is pressed after deleting the currently replayed recording). - Updated the Russian OSD texts (thanks to Oleg Roitburd). +- When determining the amount of free disk space, any deleted (but not yet removed) + recordings on different file systems (that are mounted under the video directory) + are no longer taken into account. +- When running out of disk space during a recording, only such deleted or old + recordings are removed, that actually are on the video directory file system(s). + This prevents VDR from accidentally deleting recordings on other file systems, + which would not add any free space to the video directory. diff --git a/UPDATE-1.6.0 b/UPDATE-1.6.0 index 39f8073c..1a79e517 100644 --- a/UPDATE-1.6.0 +++ b/UPDATE-1.6.0 @@ -63,9 +63,18 @@ Channels: parameter to 0 turns off the automatic channel switching, and the user will have to confirm the entry by pressing the "Ok" key. -Recording: +Recordings: - The info.vdr file now also stores the name of the channel. +- When deleting the recording that is currently replayed, the replay is now + stopped immediately. +- When determining the amount of free disk space, any deleted (but not yet removed) + recordings on different file systems (that are mounted under the video directory) + are no longer taken into account. +- When running out of disk space during a recording, only such deleted or old + recordings are removed, that actually are on the video directory file system(s). + This prevents VDR from accidentally deleting recordings on other file systems, + which would not add any free space to the video directory. SVDRP: @@ -128,3 +137,5 @@ Misc: menu. - Changed the message "Upcoming VPS recording!" to "Upcoming recording!" because it applies to non-VPS recordings as well. +- Limiting the length of the recording name in timers in case VDR is run with + --vfat, in order to avoid names that are too long for Windows. diff --git a/recording.c b/recording.c index 894757c7..4ecf4a96 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 1.160 2008/02/15 15:50:06 kls Exp $ + * $Id: recording.c 1.161 2008/02/16 13:31:39 kls Exp $ */ #include "recording.h" @@ -144,10 +144,12 @@ void AssertFreeDiskSpace(int Priority, bool Force) cThreadLock DeletedRecordingsLock(&DeletedRecordings); if (DeletedRecordings.Count()) { cRecording *r = DeletedRecordings.First(); - cRecording *r0 = r; + cRecording *r0 = NULL; while (r) { - if (r->start < r0->start) - r0 = r; + if (IsOnVideoDirectoryFileSystem(r->FileName())) { // only remove recordings that will actually increase the free video disk space + if (!r0 || r->start < r0->start) + r0 = r; + } r = DeletedRecordings.Next(r); } if (r0 && r0->Remove()) { @@ -156,11 +158,13 @@ void AssertFreeDiskSpace(int Priority, bool Force) return; } } - // DeletedRecordings was empty, so to be absolutely sure there are no - // deleted recordings we need to double check: - DeletedRecordings.Update(true); - if (DeletedRecordings.Count()) - return; // the next call will actually remove it + else { + // DeletedRecordings was empty, so to be absolutely sure there are no + // deleted recordings we need to double check: + DeletedRecordings.Update(true); + if (DeletedRecordings.Count()) + return; // the next call will actually remove it + } // No "deleted" files to remove, so let's see if we can delete a recording: isyslog("...no deleted recording found, trying to delete an old recording..."); cThreadLock RecordingsLock(&Recordings); @@ -168,15 +172,17 @@ void AssertFreeDiskSpace(int Priority, bool Force) cRecording *r = Recordings.First(); cRecording *r0 = NULL; while (r) { - if (!r->IsEdited() && r->lifetime < MAXLIFETIME) { // edited recordings and recordings with MAXLIFETIME live forever - if ((r->lifetime == 0 && Priority > r->priority) || // the recording has no guaranteed lifetime and the new recording has higher priority - (r->lifetime > 0 && (time(NULL) - r->start) / SECSINDAY >= r->lifetime)) { // the recording's guaranteed lifetime has expired - if (r0) { - if (r->priority < r0->priority || (r->priority == r0->priority && r->start < r0->start)) - r0 = r; // in any case we delete the one with the lowest priority (or the older one in case of equal priorities) + if (IsOnVideoDirectoryFileSystem(r->FileName())) { // only delete recordings that will actually increase the free video disk space + if (!r->IsEdited() && r->lifetime < MAXLIFETIME) { // edited recordings and recordings with MAXLIFETIME live forever + if ((r->lifetime == 0 && Priority > r->priority) || // the recording has no guaranteed lifetime and the new recording has higher priority + (r->lifetime > 0 && (time(NULL) - r->start) / SECSINDAY >= r->lifetime)) { // the recording's guaranteed lifetime has expired + if (r0) { + if (r->priority < r0->priority || (r->priority == r0->priority && r->start < r0->start)) + r0 = r; // in any case we delete the one with the lowest priority (or the older one in case of equal priorities) + } + else + r0 = r; } - else - r0 = r; } } r = Recordings.Next(r); @@ -1035,7 +1041,7 @@ int cRecordings::TotalFileSizeMB(void) int size = 0; LOCK_THREAD; for (cRecording *recording = First(); recording; recording = Next(recording)) { - if (recording->fileSizeMB > 0) + if (recording->fileSizeMB > 0 && IsOnVideoDirectoryFileSystem(recording->FileName())) size += recording->fileSizeMB; } return size; @@ -1401,10 +1407,6 @@ bool cIndexFile::IsStillRecording() // --- cFileName ------------------------------------------------------------- -#include <errno.h> -#include <unistd.h> -#include "videodir.h" - #define MAXFILESPERRECORDING 255 #define RECORDFILESUFFIX "/%03d.vdr" #define RECORDFILESUFFIXLEN 20 // some additional bytes for safety... @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 1.142 2008/02/15 14:45:05 kls Exp $ + * $Id: tools.c 1.143 2008/02/16 13:38:22 kls Exp $ */ #include "tools.h" @@ -277,6 +277,21 @@ cString itoa(int n) return buf; } +bool EntriesOnSameFileSystem(const char *File1, const char *File2) +{ + struct statfs statFs; + if (statfs(File1, &statFs) == 0) { + fsid_t fsid1 = statFs.f_fsid; + if (statfs(File2, &statFs) == 0) + return memcmp(&statFs.f_fsid, &fsid1, sizeof(fsid1)) == 0; + else + LOG_ERROR_STR(File2); + } + else + LOG_ERROR_STR(File1); + return false; +} + int FreeDiskSpaceMB(const char *Directory, int *UsedMB) { if (UsedMB) @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 1.111 2008/02/15 14:10:11 kls Exp $ + * $Id: tools.h 1.112 2008/02/16 13:00:16 kls Exp $ */ #ifndef __TOOLS_H @@ -193,6 +193,7 @@ int numdigits(int n); bool isnumber(const char *s); cString itoa(int n); cString AddDirectory(const char *DirName, const char *FileName); +bool EntriesOnSameFileSystem(const char *File1, const char *File2); int FreeDiskSpaceMB(const char *Directory, int *UsedMB = NULL); bool DirectoryOk(const char *DirName, bool LogErrors = false); bool MakeDirs(const char *FileName, bool IsDirectory = false); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: videodir.c 1.14 2005/12/18 10:33:20 kls Exp $ + * $Id: videodir.c 1.15 2008/02/16 13:00:03 kls Exp $ */ #include "videodir.h" @@ -232,3 +232,12 @@ void RemoveEmptyVideoDirectories(void) } while (Dir.Next()); } +bool IsOnVideoDirectoryFileSystem(const char *FileName) +{ + cVideoDirectory Dir; + do { + if (EntriesOnSameFileSystem(Dir.Name(), FileName)) + return true; + } while (Dir.Next()); + return false; +} @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: videodir.h 1.6 2005/10/31 11:50:23 kls Exp $ + * $Id: videodir.h 1.7 2008/02/16 12:53:11 kls Exp $ */ #ifndef __VIDEODIR_H @@ -23,5 +23,6 @@ bool VideoFileSpaceAvailable(int SizeMB); int VideoDiskSpace(int *FreeMB = NULL, int *UsedMB = NULL); // returns the used disk space in percent cString PrefixVideoFileName(const char *FileName, char Prefix); void RemoveEmptyVideoDirectories(void); +bool IsOnVideoDirectoryFileSystem(const char *FileName); #endif //__VIDEODIR_H |