Formatting cleanup plus change from tvhlog to tvhtrace as per @perexg comments

This commit is contained in:
Ian 2014-05-20 21:28:14 +01:00
parent 2e66b0e1b7
commit 5bb95e2698
6 changed files with 20 additions and 12 deletions

View file

@ -1090,7 +1090,7 @@ dvr_init(void)
struct stat st;
uint32_t u32;
dvr_config_t *cfg;
dvr_iov_max = sysconf(_SC_IOV_MAX);
/* Default settings */
@ -1134,8 +1134,10 @@ dvr_init(void)
htsmsg_get_u32(m, "retention-days", &cfg->dvr_retention_days);
tvh_str_set(&cfg->dvr_storage, htsmsg_get_str(m, "storage"));
// Convert 0xxx format permission strings to integer for internal use
// Note no checking that strtol won't overflow int - this should never happen with three-digit numbers
/*
* Convert 0xxx format permission strings to integer for internal use
* Note no checking that strtol won't overflow int - this should never happen with three-digit numbers
*/
if ((s = htsmsg_get_str(m, "file-permissions")))
cfg->dvr_muxcnf.m_file_permissions = (int)strtol(s,NULL,0);
@ -1371,7 +1373,7 @@ dvr_save(dvr_config_t *cfg)
htsmsg_add_str(m, "config_name", cfg->dvr_config_name);
htsmsg_add_str(m, "storage", cfg->dvr_storage);
// Convert permissions to 0xxx octal format and output
/* Convert permissions to 0xxx octal format and output */
snprintf(buffer,sizeof(buffer),"%04o",cfg->dvr_muxcnf.m_file_permissions);
htsmsg_add_str(m, "file-permissions", buffer);

View file

@ -47,8 +47,12 @@ typedef enum {
typedef struct muxer_config {
int m_flags;
muxer_cache_type_t m_cache;
// directory_permissions should really be in dvr.h as it's not really needed for the muxer
// but it's kept with file_permissions for neatness
/*
* directory_permissions should really be in dvr.h as it's not really needed for the muxer
* but it's kept with file_permissions for neatness
*/
int m_file_permissions;
int m_directory_permissions;
} muxer_config_t;

View file

@ -378,7 +378,7 @@ pass_muxer_open_file(muxer_t *m, const char *filename)
int fd;
pass_muxer_t *pm = (pass_muxer_t*)m;
tvhlog(LOG_DEBUG, "pass", "Creating file \"%s\" with file permissions \"%o\"", filename, pm->m_config.m_file_permissions);
tvhtrace("pass", "Creating file \"%s\" with file permissions \"%o\"", filename, pm->m_config.m_file_permissions);
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, pm->m_config.m_file_permissions);

View file

@ -1050,7 +1050,7 @@ mk_mux_open_file(mk_mux_t *mkm, const char *filename, int permissions)
{
int fd;
tvhlog(LOG_DEBUG, "mkv", "Creating file \"%s\" with file permissions \"%o\"", filename, permissions);
tvhtrace("mkv", "Creating file \"%s\" with file permissions \"%o\"", filename, permissions);
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, permissions);

View file

@ -397,7 +397,7 @@ makedirs ( const char *inpath, int mode )
path[x] = 0;
if (stat(path, &st)) {
err = mkdir(path, mode);
tvhlog(LOG_DEBUG, "settings", "Creating directory \"%s\" with octal permissions \"%o\"", path, mode);
tvhtrace("settings", "Creating directory \"%s\" with octal permissions \"%o\"", path, mode);
} else {
err = S_ISDIR(st.st_mode) ? 0 : 1;
errno = ENOTDIR;

View file

@ -1128,7 +1128,7 @@ extjs_dvr(http_connection_t *hc, const char *remain, void *opaque)
htsmsg_add_str(r, "storage", cfg->dvr_storage);
htsmsg_add_str(r, "container", muxer_container_type2txt(cfg->dvr_mc));
// Convert integer permissions to an octal-format 0xxx string and store it in the config file
/* Convert integer permissions to an octal-format 0xxx string and store it in the config file */
snprintf(buffer,sizeof(buffer),"%04o",cfg->dvr_muxcnf.m_file_permissions);
htsmsg_add_str(r, "filePermissions", buffer);
@ -1176,8 +1176,10 @@ extjs_dvr(http_connection_t *hc, const char *remain, void *opaque)
if((s = http_arg_get(&hc->hc_req_args, "container")) != NULL)
dvr_container_set(cfg,s);
// Convert 0xxx format permission strings to integer for internal use
// Note no checking that strtol won't overflow int - this should never happen with three-digit numbers
/*
* Convert 0xxx format permission strings to integer for internal use
* Note no checking that strtol won't overflow int - this should never happen with three-digit numbers
*/
if((s = http_arg_get(&hc->hc_req_args, "filePermissions")) != NULL)
dvr_file_permissions_set(cfg,(int)strtol(s,NULL,0));