Commit 7b9bed83 authored by Max Kellermann's avatar Max Kellermann

directory: moved code to update.c

The source directory.c mixes several libraries: directory object management, database management and database update, resulting in a 1000+ line monster. Move the whole database update code to update.c.
parent 4cfd356e
......@@ -54,6 +54,7 @@ mpd_headers = \
decoder_api.h \
decoder_internal.h \
directory.h \
update.h \
dirvec.h \
gcc.h \
decoder_list.h \
......@@ -133,6 +134,7 @@ mpd_SOURCES = \
decoder_api.c \
directory.c \
dirvec.c \
update.c \
decoder_list.c \
inputStream.c \
inputStream_file.c \
......
......@@ -21,6 +21,7 @@
#include "playlist.h"
#include "ls.h"
#include "directory.h"
#include "update.h"
#include "volume.h"
#include "stats.h"
#include "list.h"
......
......@@ -38,23 +38,27 @@ typedef struct _Directory {
unsigned stat; /* not needed if ino_t == dev_t == 0 is impossible */
} Directory;
void reap_update_task(void);
int isUpdatingDB(void);
/*
* returns the non-negative update job ID on success,
* returns -1 if busy
* @path will be freed by this function and should not be reused
*/
int directory_update_init(char *path);
void directory_init(void);
void directory_finish(void);
int isRootDirectory(const char *name);
Directory *
directory_get_root(void);
Directory *
newDirectory(const char *dirname, Directory * parent);
void
freeDirectory(Directory * directory);
Directory *
getDirectory(const char *name);
void
sortDirectory(Directory * directory);
int printDirectoryInfo(struct client *client, const char *dirname);
int checkDirectoryDB(void);
......
......@@ -20,6 +20,7 @@
#include "command.h"
#include "playlist.h"
#include "directory.h"
#include "update.h"
#include "player_thread.h"
#include "listen.h"
#include "conf.h"
......
......@@ -20,6 +20,7 @@
#include "sig_handlers.h"
#include "playlist.h"
#include "directory.h"
#include "update.h"
#include "command.h"
#include "signal_check.h"
#include "log.h"
......
This diff is collapsed. Click to expand it.
/* the Music Player Daemon (MPD)
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
* Copyright (C) 2008 Max Kellermann <max@duempel.org>
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef UPDATE_H
#define UPDATE_H
#include "directory.h"
enum update_return {
UPDATE_RETURN_ERROR = -1,
UPDATE_RETURN_NOUPDATE = 0,
UPDATE_RETURN_UPDATED = 1
};
int isUpdatingDB(void);
enum update_return
exploreDirectory(Directory * directory);
/*
* returns the non-negative update job ID on success,
* returns -1 if busy
* @path will be freed by this function and should not be reused
*/
int directory_update_init(char *path);
void reap_update_task(void);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment