utils: rename the sources close behavior for extra clarity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-08-05 21:07:06 +10:00
parent 8a0bec7b87
commit 261f8c910b

View file

@ -40,9 +40,9 @@ struct sink {
};
enum source_close_behavior {
SOURCE_CLOSE_ON_REMOVE = 1, /* default */
SOURCE_CLOSE_ON_DESTROY,
SOURCE_CLOSE_NEVER,
SOURCE_CLOSE_FD_ON_REMOVE = 1, /* default */
SOURCE_CLOSE_FD_ON_DESTROY,
SOURCE_CLOSE_FD_NEVER,
};
struct source {
@ -70,7 +70,7 @@ source_remove(struct source *source)
{
if (source->fd != -1) {
epoll_ctl(source->sink->epollfd, EPOLL_CTL_DEL, source->fd, NULL);
if (source->close_behavior == SOURCE_CLOSE_ON_REMOVE)
if (source->close_behavior == SOURCE_CLOSE_FD_ON_REMOVE)
source->fd = xclose(source->fd);
}
/* Note: epollfd was the owner of the source, new owner is the removed
@ -85,7 +85,7 @@ source_destroy(struct source *source)
{
if (source->fd != -1) {
source_remove(source);
if (source->close_behavior == SOURCE_CLOSE_ON_DESTROY)
if (source->close_behavior == SOURCE_CLOSE_FD_ON_DESTROY)
source->fd = xclose(source->fd);
}
}
@ -126,7 +126,7 @@ source_add_autoclose(struct sink *sink, int sourcefd,
source_dispatch_t dispatch,
void *user_data)
{
return source_add(sink, sourcefd, dispatch, user_data, SOURCE_CLOSE_ON_REMOVE);
return source_add(sink, sourcefd, dispatch, user_data, SOURCE_CLOSE_FD_ON_REMOVE);
}
static void