return -E_BAD_PATH;
}
+/** The on-disk layout of a afhi struct. */
enum afhi_offsets {
+ /** Where the number of seconds is stored. */
AFHI_SECONDS_TOTAL_OFFSET = 0,
+ /** Position of the bitrate. */
AFHI_BITRATE_OFFSET = 4,
+ /** Position of the frequency. */
AFHI_FREQUENCY_OFFSET = 8,
+ /** Number of channels is stored here. */
AFHI_CHANNELS_OFFSET = 12,
+ /** The tag info position. */
AFHI_INFO_STRING_OFFSET = 13,
+ /** Minimal on-disk size of a valid afhi struct. */
MIN_AFHI_SIZE = 14
};
return 1;
}
+/** Compute the number of (decimal) digits of a number. */
#define GET_NUM_DIGITS(x, num) { \
typeof((x)) _tmp = PARA_ABS(x); \
*num = 1; \
*/
-
-#define ADD_FLAG_LAZY 1
-#define ADD_FLAG_FORCE 2
-#define ADD_FLAG_VERBOSE 4
-#define ADD_FLAG_ALL 8
-
-/* TODO: change log messages so that they get written to the result buffer */
+/** Flags passed to the add command. */
+enum com_add_flags {
+ /** Skip paths that exist already. */
+ ADD_FLAG_LAZY = 1,
+ /** Force adding. */
+ ADD_FLAG_FORCE = 2,
+ /** Print what is being done. */
+ ADD_FLAG_VERBOSE = 4,
+ /** Try to add files with unknown suffixes. */
+ ADD_FLAG_ALL = 8,
+};
static int com_add_callback(const struct osl_object *query,
struct osl_object *result)
}
+/**
+ * Flags used by the touch command.
+ *
+ * \sa com_touch().
+ */
enum touch_flags {
+ /** Whether the \p FNM_PATHNAME flag should be passed to fnmatch(). */
TOUCH_FLAG_FNM_PATHNAME = 1,
+ /** Activates verbose mode. */
TOUCH_FLAG_VERBOSE = 2
};
return ret;
}
+/**
+ * Flags used by the cpsi command.
+ *
+ * \sa com_cpsi().
+ */
enum cpsi_flags {
+ /** Whether the lyrics id should be copied. */
CPSI_FLAG_COPY_LYRICS_ID = 1,
+ /** Whether the image id should be copied. */
CPSI_FLAG_COPY_IMAGE_ID = 2,
+ /** Whether the lastplayed time should be copied. */
CPSI_FLAG_COPY_LASTPLAYED = 4,
+ /** Whether the numplayed count should be copied. */
CPSI_FLAG_COPY_NUMPLAYED = 8,
+ /** Whether the attributes should be copied. */
CPSI_FLAG_COPY_ATTRIBUTES = 16,
+ /** Activates verbose mode. */
CPSI_FLAG_VERBOSE = 32,
};
return 1;
}
+/**
+ * Check the audio file table for inconsistencies.
+ *
+ * \param query Unused.
+ * \param result Contains message string upon return.
+ *
+ * This function always succeeds.
+ *
+ * \sa com_check().
+ */
int aft_check_callback(__a_unused const struct osl_object *query, struct osl_object *result)
{
struct para_buffer pb = {.buf = NULL};
}
-
-
/**
* Close the audio file table.
*
}
PARA_INFO_LOG("failed to open audio file table\n");
audio_file_table = NULL;
- return ret == -E_NOENT? 1 : ret;
+ if (ret >= 0 || is_errno(-ret, ENOENT))
+ return 1;
+ return ret;
}