aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* directory: added directory_lookup_song()Max Kellermann2009-04-011-0/+10
| | | | Moved code from db_get_song().
* directory: renamed directory_get_directory()Max Kellermann2009-04-011-1/+8
| | | | | Renamed directory_get_directory() to directory_lookup_directory(). Added API documentation.
* all: Update copyright header.Avuton Olrich2009-03-131-6/+7
| | | | | | | | This updates the copyright header to all be the same, which is pretty much an update of where to mail request for a copy of the GPL and the years of the MPD project. This also puts all committers under 'The Music Player Project' umbrella. These entries should go individually in the AUTHORS file, for consistancy.
* decoder_plugin: added method container_scan()Jochen Keil2009-03-091-0/+1
| | | | | [mk: fixed whitespace errors; use delete_song() instead of songvec_delete()]
* directory: added "mtime" propertyMax Kellermann2009-02-281-0/+1
| | | | | | Remember the modification time of each directory. This is important for archives (which are virtual directories right now), but may also be useful for an automatic update mechanism.
* directory: moved DIRECTORY_* string constantsMax Kellermann2009-02-271-7/+0
| | | | Moved some of them to to directory_save.c, and others to database.c.
* directory: added directory_is_root()Max Kellermann2009-01-041-0/+9
| | | | | directory_is_root() is cheaper than isRootDirectory(directory_get_path()).
* song: adding support for songs in archivesViliam Mateicka2008-12-161-0/+2
|
* added prefix to header macrosMax Kellermann2008-10-311-2/+2
| | | | | | | "LOG_H" is a macro which is also used by ffmpeg/log.h. This is ffmpeg's fault, because short macros should be reserved for applications, but since it's always a good idea to choose prefixed macro names, even for applications, we are going to do that in MPD.
* directory: added directory_get_name()Max Kellermann2008-10-131-0/+6
| | | | directory_get_name() returns the base name of the directory.
* directory: pass const pointers to inline functionsMax Kellermann2008-10-131-2/+2
| | | | | The inline functions directory_is_empty() and directory_get_path() don't modify the object - pass constant object pointers to them.
* directory: use mpd_sizeof_str_flex_array for path, tooEric Wong2008-10-131-1/+1
| | | | This way we avoid unnecessary heap allocations.
* directory: added inline wrappers for accessing childrenMax Kellermann2008-10-091-0/+14
| | | | | Some tiny utilities... wrappers like these may become helpful when we introduce locking.
* directory: moved dirvec struct declaration to dirvec.hMax Kellermann2008-10-091-5/+1
| | | | | No idea why it was created in directory.h, but it should be in dirvec.h.
* diretory: moved code to directory_save.c, directory_print.cMax Kellermann2008-10-091-13/+0
| | | | | | Remove clutter from directory.c. Everything which saves or loads to/from the hard disk goes to directory_save.c, and code which sends directory information to the client is moved into directory_print.c.
* directory: include sys/types.hMax Kellermann2008-10-081-1/+1
| | | | ino_t and dev_t are declared in sys/types.h, not sys/stat.h.
* directory: path must not be NULLMax Kellermann2008-10-081-2/+0
| | | | | For the root directory, let's set path to an empty string. This saves a few checks.
* directory: directory_get_path(NULL) is not allowedMax Kellermann2008-10-081-2/+8
| | | | | Also convert directory_get_path() to an inline function, which returns a constant string.
* directory: eliminate CamelCaseMax Kellermann2008-10-081-12/+13
| | | | CamelCase is ugly, rename the functions.
* directory: moved code to database.cMax Kellermann2008-10-081-23/+26
| | | | | | Taming the directory.c monster, part II: move the database management stuff to database. directory.c should only contain code which works on directory objects.
* directory: converted isRootDirectory() to an inline functionMax Kellermann2008-10-081-1/+5
| | | | | The function isRootDirectory() is tiny and can be converted to an inline function. Don't allow name==NULL.
* don't include os_compat.hMax Kellermann2008-10-081-0/+1
| | | | | When there are standardized headers, use these instead of the bloated os_compat.h.
* song: converted typedef Song to struct songMax Kellermann2008-10-081-3/+5
| | | | Again, a data type which can be forward-declared.
* directory: converted typedef Directory to struct directoryMax Kellermann2008-10-081-12/+12
| | | | | The struct can be forward-declared by other headers, which relaxes the header dependencies.
* directory: added directory_is_empty()Max Kellermann2008-10-081-0/+8
| | | | | directory_is_empty() is a tiny inline function which determine if a directory has any child objects (sub directories or songs).
* directory: moved code to update.cMax Kellermann2008-10-081-11/+15
| | | | | | 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.
* directory: simplify list update handling logicEric Wong2008-10-061-5/+5
| | | | | | | | | | | | | | Now the "update" command can be issued multiple times regardless of whether the client is in list mode or not. We serialize the update tasks to prevent updates from trampling over each other and will spawn another update task once the current one is finished updating and reaped. Right now we cap the queue size to 32 which is probably enough (I bet most people usually run update with no argument anyways); but we can make it grow/shrink dynamically if needed. There'll still be a hard-coded limit to prevent DoS attacks, though.
* directory: remove "Mp3" referencesEric Wong2008-09-291-2/+2
| | | | | MPD has supported more audio formats than just MP3 for over five years...
* directory.h: remove directory_sigChldHandler declEric Wong2008-09-291-2/+0
| | | | | We no longer fork for directory updates, so we no longer have children to reap.
* directory: replace DirectoryList with dirvecEric Wong2008-09-291-2/+5
| | | | | Small memory reduction compared to songvec since most users have much fewer dirs than songs, but still nice to have.
* song: removed type SongListMax Kellermann2008-09-261-0/+1
| | | | SongList has been superseded by struct songvec.
* directory: update do its work inside a threadEric Wong2008-09-231-1/+1
| | | | | | | | | A lot of the preparation was needed (and done in previous months) in making update thread-safe, but here it is. This was the first thing I made work inside a thread when I started mpd-uclinux many years ago, and also the last thing I've done in mainline mpd to work inside a thread, go figure.
* Replace SongList with struct songvecEric Wong2008-09-231-1/+2
| | | | | | | Our linked-list implementation is wasteful and the SongList isn't modified enough to benefit from being a linked list. So use a more compact array of song pointers which saves ~200K on a library with ~9K songs (on x86-32).
* directory: remove unused updateMp3Directory() functionEric Wong2008-09-231-2/+0
| | | | | | | | | | | | It hasn't been used in many years commit 3a89afdd80f228139554372a83a9d74486acf691 Author: Warren Dukes <warren.dukes@gmail.com> Date: Sat Nov 20 20:28:32 2004 +0000 remove --update-db option (SVN r2719)
* Directory: don't allocate stat information dynamicallyEric Wong2008-09-231-6/+3
| | | | | | | This should save a few thousand ops. Not worth it to malloc for such a small (3-words on 32-bit ARM and x86) structures. Signed-off-by: Eric Wong <normalperson@yhbt.net>
* pass "struct client" to dbUtils.c, song.c, tag_print.cMax Kellermann2008-09-071-1/+1
| | | | | | Don't pass the raw file descriptor around. This migration patch is rather large, because all of the sources have inter dependencies - we have to change all of them at the same time.
* directory: don't pass "fd" to updateInit()Max Kellermann2008-09-071-1/+6
| | | | Again, move error handling to command.c.
* directory: don't pass fd to traverseAllIn()Max Kellermann2008-09-071-1/+1
| | | | | | | | This patch continues the work of the previous patch: don't pass a file descriptor at all to traverseAllIn(). Since this fd was only used to report "directory not found" errors, we can easily move that check to the caller. This is a great relief, since it removes the dependency on a client connection from a lot of enumeration functions.
* directory: don't pass fd to traverseAllIn() callbacksMax Kellermann2008-09-071-2/+2
| | | | | | | | | | Database traversal should be generic, and not bound to a client connection. This is the first step: no file descriptor for the callback functions forEachSong() and forEachDir(). If a callback needs the file descriptor, it has to be passed in the void*data pointer somehow; some callbacks might need a new struct for passing more than one parameter. This might look a bit cumbersome right now, but our goal is to have a clean API.
* dbUtils, playlist, directory: pass constant pointersMax Kellermann2008-09-061-2/+2
| | | | The usual bunch of const pointer conversions.
* clean up CPP includesMax Kellermann2008-04-121-3/+0
| | | | | | | | | Try to only include headers which are really needed. We should particularly check all "headers including other headers". The long-term goal is to have a manageable, small API for plugins (decoders, output) without so many mpd internals cluttering the namespace. git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix -Wconst warningsMax Kellermann2008-02-051-2/+2
| | | | | | [ew: cleaned up the dirty union hack a bit] Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7180 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Don't list playlists in lsinfo if the path isn't the root directory (theyJ. Alexander Treuman2007-05-241-0/+2
| | | | | can't be loaded anyway). git-svn-id: https://svn.musicpd.org/mpd/trunk@6244 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* The massive copyright updateAvuton Olrich2007-04-051-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix warnings for -Wmissing-prototypesAvuton Olrich2006-08-201-9/+9
| | | | | | Add -Wmissing-prototypes if compiling with gcc Static where possible git-svn-id: https://svn.musicpd.org/mpd/trunk@4657 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* interface/connection malloc reductions from mpd-keEric Wong2006-07-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch massively reduces the amount of heap allocations at the interface/command layer. Most commands with minimal output should not allocate memory from the heap at all. Things like repeatedly polling status, currentsong, and volume changes should be faster as a result, and more importantly, not a source of memory fragmentation. These changes should be safe in that there's no way for a remote-client to corrupt memory or otherwise do bad stuff to MPD, but an extra set of eyes to review would be good. Of course there's never any warranty :) No longer do we use FILE * structures in the interface, which means we don't have to allocate any new memory for most connections. Now, before you go on about losing the buffering that FILE * +implies+, remember that myfprintf() never took advantage of any of the stdio buffering features. To reduce the diff and make bugs easier to spot in the diff, I've kept myfprintf in places where we write to files (and not network interfaces). Expect myfprintf to go away entirely soon (we'll use fprintf for writing regular files). git-svn-id: https://svn.musicpd.org/mpd/trunk@4483 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add mpd-indent.shAvuton Olrich2006-07-201-11/+10
| | | | | | Indent the entire tree, hopefully we can keep it indented. git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Change shank's email addressJ. Alexander Treuman2006-07-141-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* [CLEANUP] Remove unused functions from the headerAvuton Olrich2006-07-141-10/+0
| | | | | | | Convert some spaces to tabs Static what makes sense Remove unused includes git-svn-id: https://svn.musicpd.org/mpd/trunk@4328 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Huge header update, update the copyright and addAvuton Olrich2006-07-131-1/+1
| | | | | the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f