Commit e032b1b0 authored by npzacs's avatar npzacs
Browse files

DEBUG -> BD_DEBUG

parent cd6b9a7a
......@@ -45,7 +45,7 @@ char *file_get_config_home(void)
return str_printf("%s/%s", user_home, USER_CFG_DIR);
}
DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
return NULL;
}
......@@ -56,7 +56,7 @@ char *file_get_data_home(void)
return str_printf("%s/%s", user_home, USER_DATA_DIR);
}
DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
return NULL;
}
......@@ -67,7 +67,7 @@ char *file_get_cache_home(void)
return str_printf("%s/%s", user_home, USER_CACHE_DIR);
}
DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
return NULL;
}
......
......@@ -60,7 +60,7 @@ char *file_get_data_home(void)
return appdir;
}
DEBUG(DBG_FILE, "Can't find user configuration directory !\n");
BD_DEBUG(DBG_FILE, "Can't find user configuration directory !\n");
return NULL;
}
......@@ -88,7 +88,7 @@ const char *file_get_config_system(const char *dir)
WideCharToMultiByte (CP_UTF8, 0, wdir, -1, appdir, len, NULL, NULL);
return appdir;
} else {
DEBUG(DBG_FILE, "Can't find common configuration directory !\n");
BD_DEBUG(DBG_FILE, "Can't find common configuration directory !\n");
return NULL;
}
} else {
......
......@@ -53,7 +53,7 @@ char *file_get_config_home(void)
return str_printf("%s/%s", user_home, USER_CFG_DIR);
}
DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
return NULL;
}
......@@ -69,7 +69,7 @@ char *file_get_data_home(void)
return str_printf("%s/%s", user_home, USER_DATA_DIR);
}
DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
return NULL;
}
......@@ -85,7 +85,7 @@ char *file_get_cache_home(void)
return str_printf("%s/%s", user_home, USER_CACHE_DIR);
}
DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
return NULL;
}
......
......@@ -38,7 +38,7 @@ static void file_close_linux(AACS_FILE_H *file)
if (file) {
fclose((FILE *)file->internal);
DEBUG(DBG_FILE, "Closed LINUX file (%p)\n", (void*)file);
BD_DEBUG(DBG_FILE, "Closed LINUX file (%p)\n", (void*)file);
X_FREE(file);
}
......@@ -72,7 +72,7 @@ static AACS_FILE_H *file_open_linux(const char* filename, const char *mode)
FILE *fp = NULL;
AACS_FILE_H *file = calloc(1, sizeof(AACS_FILE_H));
DEBUG(DBG_FILE, "Opening LINUX file %s... (%p)\n", filename, (void*)file);
BD_DEBUG(DBG_FILE, "Opening LINUX file %s... (%p)\n", filename, (void*)file);
file->close = file_close_linux;
file->seek = file_seek_linux;
file->read = file_read_linux;
......@@ -84,7 +84,7 @@ static AACS_FILE_H *file_open_linux(const char* filename, const char *mode)
return file;
}
DEBUG(DBG_FILE, "Error opening file %s ! (%p)\n", filename, (void*)file);
BD_DEBUG(DBG_FILE, "Error opening file %s ! (%p)\n", filename, (void*)file);
X_FREE(file);
......
......@@ -64,10 +64,10 @@ static int _mkpath(const char *path)
*end = 0;
if (stat(dir, &s) != 0 || !S_ISDIR(s.st_mode)) {
DEBUG(DBG_FILE, "Creating directory %s\n", dir);
BD_DEBUG(DBG_FILE, "Creating directory %s\n", dir);
if (mkdir(dir, S_IRWXU|S_IRWXG|S_IRWXO) == -1) {
DEBUG(DBG_FILE | DBG_CRIT, "Error creating directory %s\n", dir);
BD_DEBUG(DBG_FILE | DBG_CRIT, "Error creating directory %s\n", dir);
result = 0;
break;
}
......@@ -91,7 +91,7 @@ static char *_load_file(FILE *fp)
fseek(fp, 0, SEEK_SET);
if (file_size < MIN_FILE_SIZE || file_size > MAX_FILE_SIZE) {
DEBUG(DBG_FILE, "Invalid file size\n");
BD_DEBUG(DBG_FILE, "Invalid file size\n");
return NULL;
}
......@@ -99,7 +99,7 @@ static char *_load_file(FILE *fp)
read_size = fread(data, 1, file_size, fp);
if (read_size != file_size) {
DEBUG(DBG_FILE, "Error reading file\n");
BD_DEBUG(DBG_FILE, "Error reading file\n");
X_FREE(data);
return NULL;
}
......@@ -140,7 +140,7 @@ static FILE *_open_cfg_file_user(const char *file_name, char **path, const char
FILE *fp = fopen(cfg_file, mode);
DEBUG(DBG_FILE, fp ? "Opened %s for %s\n" : "%s not found\n", cfg_file, mode);
BD_DEBUG(DBG_FILE, fp ? "Opened %s for %s\n" : "%s not found\n", cfg_file, mode);
if (fp && path) {
*path = cfg_file;
......@@ -161,7 +161,7 @@ static FILE *_open_cfg_file_system(const char *file_name, char **path)
FILE *fp = fopen(cfg_file, "r");
if (fp) {
DEBUG(DBG_FILE, "Reading %s\n", cfg_file);
BD_DEBUG(DBG_FILE, "Reading %s\n", cfg_file);
if (path) {
*path = cfg_file;
......@@ -172,7 +172,7 @@ static FILE *_open_cfg_file_system(const char *file_name, char **path)
return fp;
}
DEBUG(DBG_FILE, "%s not found\n", cfg_file);
BD_DEBUG(DBG_FILE, "%s not found\n", cfg_file);
X_FREE(cfg_file);
}
......@@ -203,14 +203,14 @@ static int _parse_pk_file(config_file *cf, FILE *fp)
char *str = str_get_hex_string(p, 2*16);
if (str) {
DEBUG(DBG_FILE, "Found processing key %s\n", str);
BD_DEBUG(DBG_FILE, "Found processing key %s\n", str);
pk_list *e = calloc(1, sizeof(pk_list));
hexstring_to_hex_array(e->key, 16, str);
if (_is_duplicate_pk(cf->pkl, e->key)) {
DEBUG(DBG_FILE, "Skipping duplicate processing key %s\n", str);
BD_DEBUG(DBG_FILE, "Skipping duplicate processing key %s\n", str);
X_FREE(e);
} else {
e->next = cf->pkl;
......@@ -260,17 +260,17 @@ static int _parse_cert_file(config_file *cf, FILE *fp)
X_FREE(data);
if (!host_priv_key || !host_cert) {
DEBUG(DBG_FILE, "Invalid file\n");
BD_DEBUG(DBG_FILE, "Invalid file\n");
} else {
DEBUG(DBG_FILE, "Found certificate: %s %s\n", host_priv_key, host_cert);
BD_DEBUG(DBG_FILE, "Found certificate: %s %s\n", host_priv_key, host_cert);
cert_list *e = calloc(1, sizeof(cert_list));
hexstring_to_hex_array(e->host_priv_key, 20, host_priv_key);
hexstring_to_hex_array(e->host_cert, 92, host_cert);
if (_is_duplicate_cert(cf->host_cert_list, e)) {
DEBUG(DBG_FILE, "Skipping duplicate certificate entry %s %s\n", host_priv_key, host_cert);
BD_DEBUG(DBG_FILE, "Skipping duplicate certificate entry %s %s\n", host_priv_key, host_cert);
X_FREE(e);
} else {
e->next = cf->host_cert_list;
......@@ -370,11 +370,11 @@ int keycache_save(const char *type, const uint8_t *disc_id, const uint8_t *key,
hex_array_to_hexstring(key_str, key, len);
if (fwrite(key_str, 1, len*2, fp) == len*2) {
DEBUG(DBG_FILE, "Wrote %s to %s\n", type, file);
BD_DEBUG(DBG_FILE, "Wrote %s to %s\n", type, file);
result = 1;
} else {
DEBUG(DBG_FILE, "Error writing to %s\n", file);
BD_DEBUG(DBG_FILE, "Error writing to %s\n", file);
}
free(key_str);
......@@ -400,17 +400,17 @@ int keycache_find(const char *type, const uint8_t *disc_id, uint8_t *key, unsign
if (fp) {
char *key_str = malloc(len*2);
DEBUG(DBG_FILE, "Reading %s\n", file);
BD_DEBUG(DBG_FILE, "Reading %s\n", file);
if (fread(key_str, 1, len*2, fp) == len*2) {
result = hexstring_to_hex_array(key, len, key_str);
if (!result) {
DEBUG(DBG_FILE, "Error converting %s\n", file);
BD_DEBUG(DBG_FILE, "Error converting %s\n", file);
}
} else {
DEBUG(DBG_FILE, "Error reading from %s\n", file);
BD_DEBUG(DBG_FILE, "Error reading from %s\n", file);
}
free(key_str);
......@@ -418,7 +418,7 @@ int keycache_find(const char *type, const uint8_t *disc_id, uint8_t *key, unsign
fclose(fp);
} else {
DEBUG(DBG_FILE, "%s not found\n", file);
BD_DEBUG(DBG_FILE, "%s not found\n", file);
}
X_FREE(file);
......@@ -454,11 +454,11 @@ int cache_save(const char *name, uint32_t version, const void *data, uint32_t le
if (fwrite(&version, 1, 4, fp) == 4 &&
fwrite(&len, 1, 4, fp) == 4 &&
fwrite(data, 1, len, fp) == len) {
DEBUG(DBG_FILE, "Wrote %d bytes to %s\n", len + 8, file);
BD_DEBUG(DBG_FILE, "Wrote %d bytes to %s\n", len + 8, file);
result = 1;
} else {
DEBUG(DBG_FILE, "Error writing to %s\n", file);
BD_DEBUG(DBG_FILE, "Error writing to %s\n", file);
}
fclose(fp);
......@@ -485,23 +485,23 @@ int cache_get(const char *name, uint32_t *version, uint32_t *len, void *buf)
FILE *fp = fopen(file, "r");
if (fp) {
DEBUG(DBG_FILE, "Reading %s\n", file);
BD_DEBUG(DBG_FILE, "Reading %s\n", file);
if (fread(version, 1, 4, fp) == 4 &&
(!len || fread(len, 1, 4, fp) == 4) &&
(!buf || fread(buf, 1, *len, fp) == *len)) {
DEBUG(DBG_FILE, "Read %d bytes from %s, version %d\n", 4 + (len ? 4 : 0) + (buf ? *len : 0), file, *version);
BD_DEBUG(DBG_FILE, "Read %d bytes from %s, version %d\n", 4 + (len ? 4 : 0) + (buf ? *len : 0), file, *version);
result = 1;
} else {
DEBUG(DBG_FILE, "Error reading from %s\n", file);
BD_DEBUG(DBG_FILE, "Error reading from %s\n", file);
}
fclose(fp);
} else {
DEBUG(DBG_FILE, "%s not found\n", file);
BD_DEBUG(DBG_FILE, "%s not found\n", file);
}
X_FREE(file);
......@@ -515,7 +515,7 @@ int cache_remove(const char *name)
char *file = _cache_file(name);
int result = !remove(file);
if (!result) {
DEBUG(DBG_FILE, "Error removing %s\n", file);
BD_DEBUG(DBG_FILE, "Error removing %s\n", file);
}
X_FREE(file);
return result;
......@@ -534,7 +534,7 @@ void *cache_get_or_update(const char *type, const void *data, uint32_t *len, uin
cache_data = malloc(cache_len);
if (cache_get(type, &cache_version, &cache_len, cache_data)) {
DEBUG(DBG_AACS, "Using cached %s. Version: %d\n", type, cache_version);
BD_DEBUG(DBG_AACS, "Using cached %s. Version: %d\n", type, cache_version);
*len = cache_len;
return cache_data;
}
......@@ -550,7 +550,7 @@ void *cache_get_or_update(const char *type, const void *data, uint32_t *len, uin
/* cached data is older, update cache */
if (cache_version < version) {
cache_save(type, version, data, *len);
DEBUG(DBG_AACS, "Updated cached %s. Version: %d\n", type, version);
BD_DEBUG(DBG_AACS, "Updated cached %s. Version: %d\n", type, version);
}
}
......@@ -566,11 +566,11 @@ int config_save(const char *name, const void *data, uint32_t len)
if (fp) {
if (fwrite(&len, 1, 4, fp) == 4 &&
fwrite(data, 1, len, fp) == len) {
DEBUG(DBG_FILE, "Wrote %d bytes to %s\n", len + 4, path);
BD_DEBUG(DBG_FILE, "Wrote %d bytes to %s\n", len + 4, path);
result = 1;
} else {
DEBUG(DBG_FILE | DBG_CRIT, "Error writing to %s\n", path);
BD_DEBUG(DBG_FILE | DBG_CRIT, "Error writing to %s\n", path);
}
fclose(fp);
......@@ -591,16 +591,16 @@ int config_get(const char *name, uint32_t *len, void *buf)
*len = 0;
if (fp) {
DEBUG(DBG_FILE, "Reading %s\n", path);
BD_DEBUG(DBG_FILE, "Reading %s\n", path);
if (fread(len, 1, 4, fp) == 4 && (size <= *len) &&
(!buf || fread(buf, 1, *len, fp) == *len)) {
DEBUG(DBG_FILE, "Read %d bytes from %s\n", 4 + (buf ? *len : 0), path);
BD_DEBUG(DBG_FILE, "Read %d bytes from %s\n", 4 + (buf ? *len : 0), path);
result = 1;
} else {
DEBUG(DBG_FILE | DBG_CRIT, "Error reading from %s\n", path);
BD_DEBUG(DBG_FILE | DBG_CRIT, "Error reading from %s\n", path);
}
fclose(fp);
......@@ -625,7 +625,7 @@ static char *_find_config_file(void)
}
if (fp) {
DEBUG(DBG_FILE, "found config file: %s\n", cfg_file);
BD_DEBUG(DBG_FILE, "found config file: %s\n", cfg_file);
fclose(fp);
}
......@@ -721,7 +721,7 @@ config_file *keydbcfg_config_load(const char *configfile_path)
config_ok = _parse_embedded(cf) || config_ok;
if (!config_ok) {
DEBUG(DBG_AACS | DBG_CRIT, "No valid AACS configuration files found\n");
BD_DEBUG(DBG_AACS | DBG_CRIT, "No valid AACS configuration files found\n");
keydbcfg_config_file_close(cf);
return NULL;
}
......
......@@ -101,7 +101,7 @@ int device_send_cmd(MMCDEV *mmc, const uint8_t *cmd, uint8_t *buf, size_t tx, si
do {
task = (*mmc->taskInterface)->CreateSCSITask (mmc->taskInterface);
if (NULL == task) {
DEBUG(DBG_MMC, "Could not create SCSI Task\n");
BD_DEBUG(DBG_MMC, "Could not create SCSI Task\n");
break;
}
......@@ -117,19 +117,19 @@ int device_send_cmd(MMCDEV *mmc, const uint8_t *cmd, uint8_t *buf, size_t tx, si
rc = (*task)->SetCommandDescriptorBlock (task, cmd, 16);
if (kIOReturnSuccess != rc) {
DEBUG(DBG_MMC, "Error setting SCSI command\n");
BD_DEBUG(DBG_MMC, "Error setting SCSI command\n");
break;
}
rc = (*task)->SetScatterGatherEntries (task, &iov, 1, iov.length, direction);
if (kIOReturnSuccess != rc) {
DEBUG(DBG_MMC, "Error setting SCSI scatter gather entries\n");
BD_DEBUG(DBG_MMC, "Error setting SCSI scatter gather entries\n");
break;
}
rc = (*task)->SetTimeoutDuration (task, 5000000);
if (kIOReturnSuccess != rc) {
DEBUG(DBG_MMC, "Error setting SCSI command timeout\n");
BD_DEBUG(DBG_MMC, "Error setting SCSI command timeout\n");
break;
}
......@@ -138,18 +138,18 @@ int device_send_cmd(MMCDEV *mmc, const uint8_t *cmd, uint8_t *buf, size_t tx, si
rc = (*task)->ExecuteTaskSync (task, &sense, &status, &sent);
char str[512];
DEBUG(DBG_MMC, "Send SCSI MMC cmd %s:\n", print_hex(str, cmd, 16));
BD_DEBUG(DBG_MMC, "Send SCSI MMC cmd %s:\n", print_hex(str, cmd, 16));
if (tx) {
DEBUG(DBG_MMC, " Buffer: %s ->\n", print_hex(str, buf, tx>255?255:tx));
BD_DEBUG(DBG_MMC, " Buffer: %s ->\n", print_hex(str, buf, tx>255?255:tx));
} else {
DEBUG(DBG_MMC, " Buffer: %s <-\n", print_hex(str, buf, rx>255?255:rx));
BD_DEBUG(DBG_MMC, " Buffer: %s <-\n", print_hex(str, buf, rx>255?255:rx));
}
if (kIOReturnSuccess != rc || status != 0) {
DEBUG(DBG_MMC, " Send failed!\n");
BD_DEBUG(DBG_MMC, " Send failed!\n");
break;
} else {
DEBUG(DBG_MMC, " Send succeeded! sent = %lld status = %u. response = %x\n",
BD_DEBUG(DBG_MMC, " Send succeeded! sent = %lld status = %u. response = %x\n",
(unsigned long long) sent, status, sense.VALID_RESPONSE_CODE);
}
......@@ -184,9 +184,9 @@ static void iokit_unmount_complete (DADiskRef disk, DADissenterRef dissenter,
(void)disk; /* suppress warning */
if (dissenter) {
DEBUG(DBG_MMC, "Could not unmount the disc\n");
BD_DEBUG(DBG_MMC, "Could not unmount the disc\n");
} else {
DEBUG(DBG_MMC, "Disc unmounted\n");
BD_DEBUG(DBG_MMC, "Disc unmounted\n");
((MMCDEV *)context)->is_mounted = 0;
}
}
......@@ -197,7 +197,7 @@ static void iokit_mount_complete (DADiskRef disk, DADissenterRef dissenter,
(void) dissenter; /* suppress warning */
/* the disc mounts despite whether there is a dessenter */
DEBUG(DBG_MMC, "Disc mounted\n");
BD_DEBUG(DBG_MMC, "Disc mounted\n");
((MMCDEV *)context)->is_mounted = 1;
}
......@@ -206,17 +206,17 @@ static int iokit_unmount (MMCDEV *mmc) {
return 0; /* nothing to do */
}
DEBUG(DBG_MMC, "Unmounting disk\n");
BD_DEBUG(DBG_MMC, "Unmounting disk\n");
mmc->session = DASessionCreate (kCFAllocatorDefault);
if (NULL == mmc->session) {
DEBUG(DBG_MMC, "Could not create a disc arbitration session\n");
BD_DEBUG(DBG_MMC, "Could not create a disc arbitration session\n");
return -1;
}
mmc->disk = DADiskCreateFromBSDName (kCFAllocatorDefault, mmc->session, mmc->bsd_name);
if (NULL == mmc->disk) {
DEBUG(DBG_MMC, "Could not create a disc arbitration disc for the device\n");
BD_DEBUG(DBG_MMC, "Could not create a disc arbitration disc for the device\n");
CFRelease (mmc->session);
mmc->session = NULL;
return -1;
......@@ -268,14 +268,14 @@ static int iokit_find_service_matching (MMCDEV *mmc, io_service_t *servp) {
*servp = 0;
if (!matchingDict) {
DEBUG(DBG_MMC, "Could not create a matching dictionary for IOBDServices\n");
BD_DEBUG(DBG_MMC, "Could not create a matching dictionary for IOBDServices\n");
return -1;
}
/* this call consumes the reference to the matchingDict. we do not need to release it */
rc = IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDict, &deviceIterator);
if (kIOReturnSuccess != rc) {
DEBUG(DBG_MMC, "Could not create device iterator\n");
BD_DEBUG(DBG_MMC, "Could not create device iterator\n");
return -1;
}
......@@ -316,7 +316,7 @@ static int iokit_find_interfaces (MMCDEV *mmc, io_service_t service) {
return -1;
}
DEBUG(DBG_MMC, "Getting MMC interface\n");
BD_DEBUG(DBG_MMC, "Getting MMC interface\n");
rc = (*plugInInterface)->QueryInterface(plugInInterface,
CFUUIDGetUUIDBytes(kIOMMCDeviceInterfaceID),
......@@ -324,15 +324,15 @@ static int iokit_find_interfaces (MMCDEV *mmc, io_service_t service) {
/* call release instead of IODestroyPlugInInterface to avoid stopping IOBDServices */
(*plugInInterface)->Release(plugInInterface);
if (kIOReturnSuccess != rc || NULL == mmc->mmcInterface) {
DEBUG(DBG_MMC, "Could not get multimedia commands (MMC) interface\n");
BD_DEBUG(DBG_MMC, "Could not get multimedia commands (MMC) interface\n");
return -1;
}
DEBUG(DBG_MMC, "Have an MMC interface (%p). Getting a SCSI task interface...\n", (void*)mmc->mmcInterface);
BD_DEBUG(DBG_MMC, "Have an MMC interface (%p). Getting a SCSI task interface...\n", (void*)mmc->mmcInterface);
mmc->taskInterface = (*mmc->mmcInterface)->GetSCSITaskDeviceInterface (mmc->mmcInterface);
if (NULL == mmc->taskInterface) {
DEBUG(DBG_MMC, "Could not get SCSI task device interface\n");
BD_DEBUG(DBG_MMC, "Could not get SCSI task device interface\n");
return -1;
}
......@@ -352,14 +352,14 @@ static int mmc_open_iokit (const char *path, MMCDEV *mmc) {
/* get the bsd name associated with this mount */
rc = get_mounted_device_from_path (mmc, path);
if (0 != rc) {
DEBUG(DBG_MMC, "Could not locate mounted device associated with %s\n", path);
BD_DEBUG(DBG_MMC, "Could not locate mounted device associated with %s\n", path);
return rc;
}
/* find a matching io service (IOBDServices) */
rc = iokit_find_service_matching (mmc, &service);
if (0 != rc) {
DEBUG(DBG_MMC, "Could not find matching IOBDServices mounted @ %s\n", path);
BD_DEBUG(DBG_MMC, "Could not find matching IOBDServices mounted @ %s\n", path);
return rc;
}
......@@ -383,11 +383,11 @@ static int mmc_open_iokit (const char *path, MMCDEV *mmc) {
/* finally, obtain exclusive access */
rc = (*mmc->taskInterface)->ObtainExclusiveAccess (mmc->taskInterface);
if (kIOReturnSuccess != rc) {
DEBUG(DBG_MMC, "Failed to obtain exclusive access. rc = %x\n", rc);
BD_DEBUG(DBG_MMC, "Failed to obtain exclusive access. rc = %x\n", rc);
return -1;
}
DEBUG(DBG_MMC, "MMC Open complete\n");
BD_DEBUG(DBG_MMC, "MMC Open complete\n");
return 0;
}
......
......@@ -86,22 +86,22 @@ int device_send_cmd(MMCDEV *dev, const uint8_t *cmd, uint8_t *buf, size_t tx, si
result = ioctl(dev->fd, CDROM_SEND_PACKET, &cgc);
DEBUG(DBG_MMC, "Send LINUX MMC cmd %s:\n", print_hex(str, cmd, 16));
BD_DEBUG(DBG_MMC, "Send LINUX MMC cmd %s:\n", print_hex(str, cmd, 16));
if (tx) {
DEBUG(DBG_MMC, " Buffer: %s ->\n", print_hex(str, buf, tx>255?255:tx));
BD_DEBUG(DBG_MMC, " Buffer: %s ->\n", print_hex(str, buf, tx>255?255:tx));
} else {
DEBUG(DBG_MMC, " Buffer: %s <-\n", print_hex(str, buf, rx>255?255:rx));
BD_DEBUG(DBG_MMC, " Buffer: %s <-\n", print_hex(str, buf, rx>255?255:rx));
}
if (result >= 0) {
DEBUG(DBG_MMC, " Send succeeded! [%d]\n", result);
BD_DEBUG(DBG_MMC, " Send succeeded! [%d]\n", result);
return 1;
}
DEBUG(DBG_MMC, " Send failed! [%d] %s\n", result, strerror(errno));
BD_DEBUG(DBG_MMC, " Send failed! [%d] %s\n", result, strerror(errno));
#else
#warning no MMC drive support
DEBUG(DBG_MMC | DBG_CRIT, "No MMC drive support\n");
BD_DEBUG(DBG_MMC | DBG_CRIT, "No MMC drive support\n");
#endif
return 0;
......@@ -118,7 +118,7 @@ MMCDEV *device_open(const char *path)
/* resolve path */
if (!aacs_resolve_path(path, resolved_path)) {
DEBUG(DBG_MMC | DBG_CRIT, "Failed resolving path %s\n", path);
BD_DEBUG(DBG_MMC | DBG_CRIT, "Failed resolving path %s\n", path);
return NULL;
}
......@@ -129,7 +129,7 @@ MMCDEV *device_open(const char *path)
}
if (stat(resolved_path, &st)) {
DEBUG(DBG_MMC | DBG_CRIT, "stat(%s) failed\n", resolved_path);
BD_DEBUG(DBG_MMC | DBG_CRIT, "stat(%s) failed\n", resolved_path);
return NULL;
}
......@@ -137,14 +137,14 @@ MMCDEV *device_open(const char *path)
if (S_ISBLK(st.st_mode)) {
/* opening device */
DEBUG(DBG_MMC, "Opening block device %s\n", resolved_path);
BD_DEBUG(DBG_MMC, "Opening block device %s\n", resolved_path);
fd = open(resolved_path, O_RDONLY | O_NONBLOCK);
if (fd < 0) {
DEBUG(DBG_MMC | DBG_CRIT, "Error opening block device %s\n", resolved_path);
BD_DEBUG(DBG_MMC | DBG_CRIT, "Error opening block device %s\n", resolved_path);
}
} else {
#if !defined(HAVE_MNTENT_H)
DEBUG(DBG_MMC | DBG_CRIT, "Only block devices supported\n");
BD_DEBUG(DBG_MMC | DBG_CRIT, "Only block devices supported\n");
return NULL;
#endif
}
......@@ -155,17 +155,17 @@ MMCDEV *device_open(const char *path)
if ((proc_mounts = setmntent("/proc/mounts", "r"))) {
struct mntent* mount_entry;
DEBUG(DBG_MMC, "Opening LINUX MMC drive mounted to %s...\n", resolved_path);
BD_DEBUG(DBG_MMC, "Opening LINUX MMC drive mounted to %s...\n", resolved_path);
while ((mount_entry = getmntent(proc_mounts)) != NULL) {
if (strcmp(mount_entry->mnt_dir, resolved_path) == 0) {
fd = open(mount_entry->mnt_fsname, O_RDONLY | O_NONBLOCK);
if (fd >= 0) {
DEBUG(DBG_MMC, "LINUX MMC drive %s opened - fd: %d\n",
BD_DEBUG(DBG_MMC, "LINUX MMC drive %s opened - fd: %d\n",
mount_entry->mnt_fsname, fd);
break;
}
DEBUG(DBG_MMC | DBG_CRIT, "Failed opening MMC drive %s mounted to %s\n",
BD_DEBUG(DBG_MMC | DBG_CRIT, "Failed opening MMC drive %s mounted to %s\n",
mount_entry->mnt_fsname, resolved_path);
}
}
......@@ -173,11 +173,11 @@ MMCDEV *device_open(const char *path)
endmntent(proc_mounts);
if (fd < 0) {
DEBUG(DBG_MMC | DBG_CRIT, "No MMC drive mounted to %s\n", resolved_path);
BD_DEBUG(DBG_MMC | DBG_CRIT, "No MMC drive mounted to %s\n", resolved_path);
}
} else {
DEBUG(DBG_MMC | DBG_CRIT, "Error opening /proc/mounts\n");
BD_DEBUG(DBG_MMC | DBG_CRIT, "Error opening /proc/mounts\n");
}
#endif