aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2009-04-01directory: added directory_lookup_song()Max Kellermann1-0/+10
Moved code from db_get_song().
2009-04-01directory: renamed directory_get_directory()Max Kellermann1-1/+8
Renamed directory_get_directory() to directory_lookup_directory(). Added API documentation.
2009-03-13all: Update copyright header.Avuton Olrich1-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.
2009-03-09decoder_plugin: added method container_scan()Jochen Keil1-0/+1
[mk: fixed whitespace errors; use delete_song() instead of songvec_delete()]
2009-02-28directory: added "mtime" propertyMax Kellermann1-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.
2009-02-27directory: moved DIRECTORY_* string constantsMax Kellermann1-7/+0
Moved some of them to to directory_save.c, and others to database.c.
2009-01-04directory: added directory_is_root()Max Kellermann1-0/+9
directory_is_root() is cheaper than isRootDirectory(directory_get_path()).
2008-12-16song: adding support for songs in archivesViliam Mateicka1-0/+2
2008-10-31added prefix to header macrosMax Kellermann1-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.
2008-10-13directory: added directory_get_name()Max Kellermann1-0/+6
directory_get_name() returns the base name of the directory.
2008-10-13directory: pass const pointers to inline functionsMax Kellermann1-2/+2
The inline functions directory_is_empty() and directory_get_path() don't modify the object - pass constant object pointers to them.
2008-10-13directory: use mpd_sizeof_str_flex_array for path, tooEric Wong1-1/+1
This way we avoid unnecessary heap allocations.
2008-10-09directory: added inline wrappers for accessing childrenMax Kellermann1-0/+14
Some tiny utilities... wrappers like these may become helpful when we introduce locking.
2008-10-09directory: moved dirvec struct declaration to dirvec.hMax Kellermann1-5/+1
No idea why it was created in directory.h, but it should be in dirvec.h.
2008-10-09diretory: moved code to directory_save.c, directory_print.cMax Kellermann1-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.
2008-10-08directory: include sys/types.hMax Kellermann1-1/+1
ino_t and dev_t are declared in sys/types.h, not sys/stat.h.
2008-10-08directory: path must not be NULLMax Kellermann1-2/+0
For the root directory, let's set path to an empty string. This saves a few checks.
2008-10-08directory: directory_get_path(NULL) is not allowedMax Kellermann1-2/+8
Also convert directory_get_path() to an inline function, which returns a constant string.
2008-10-08directory: eliminate CamelCaseMax Kellermann1-12/+13
CamelCase is ugly, rename the functions.
2008-10-08directory: moved code to database.cMax Kellermann1-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.
2008-10-08directory: converted isRootDirectory() to an inline functionMax Kellermann1-1/+5
The function isRootDirectory() is tiny and can be converted to an inline function. Don't allow name==NULL.
2008-10-08don't include os_compat.hMax Kellermann1-0/+1
When there are standardized headers, use these instead of the bloated os_compat.h.
2008-10-08song: converted typedef Song to struct songMax Kellermann1-3/+5
Again, a data type which can be forward-declared.
2008-10-08directory: converted typedef Directory to struct directoryMax Kellermann1-12/+12
The struct can be forward-declared by other headers, which relaxes the header dependencies.
2008-10-08directory: added directory_is_empty()Max Kellermann1-0/+8
directory_is_empty() is a tiny inline function which determine if a directory has any child objects (sub directories or songs).
2008-10-08directory: moved code to update.cMax Kellermann1-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.
2008-10-06directory: simplify list update handling logicEric Wong1-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.
2008-09-29directory: remove "Mp3" referencesEric Wong1-2/+2
MPD has supported more audio formats than just MP3 for over five years...
2008-09-29directory.h: remove directory_sigChldHandler declEric Wong1-2/+0
We no longer fork for directory updates, so we no longer have children to reap.
2008-09-29directory: replace DirectoryList with dirvecEric Wong1-2/+5
Small memory reduction compared to songvec since most users have much fewer dirs than songs, but still nice to have.
2008-09-26song: removed type SongListMax Kellermann1-0/+1
SongList has been superseded by struct songvec.
2008-09-23directory: update do its work inside a threadEric Wong1-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.
2008-09-23Replace SongList with struct songvecEric Wong1-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).
2008-09-23directory: remove unused updateMp3Directory() functionEric Wong1-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)
2008-09-23Directory: don't allocate stat information dynamicallyEric Wong1-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>
2008-09-07pass "struct client" to dbUtils.c, song.c, tag_print.cMax Kellermann1-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.
2008-09-07directory: don't pass "fd" to updateInit()Max Kellermann1-1/+6
Again, move error handling to command.c.
2008-09-07directory: don't pass fd to traverseAllIn()Max Kellermann1-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.
2008-09-07directory: don't pass fd to traverseAllIn() callbacksMax Kellermann1-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.
2008-09-06dbUtils, playlist, directory: pass constant pointersMax Kellermann1-2/+2
The usual bunch of const pointer conversions.
2008-04-12clean up CPP includesMax Kellermann1-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
2008-02-05fix -Wconst warningsMax Kellermann1-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
2007-05-24Don't list playlists in lsinfo if the path isn't the root directory (theyJ. Alexander Treuman1-0/+2
can't be loaded anyway). git-svn-id: https://svn.musicpd.org/mpd/trunk@6244 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05The massive copyright updateAvuton Olrich1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-20Fix warnings for -Wmissing-prototypesAvuton Olrich1-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
2006-07-30interface/connection malloc reductions from mpd-keEric Wong1-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
2006-07-20Add mpd-indent.shAvuton Olrich1-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
2006-07-14Change shank's email addressJ. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14[CLEANUP] Remove unused functions from the headerAvuton Olrich1-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
2006-07-13Huge header update, update the copyright and addAvuton Olrich1-1/+1
the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f