本文整理汇总了C++中LOG_BUF函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_BUF函数的具体用法?C++ LOG_BUF怎么用?C++ LOG_BUF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOG_BUF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __call_console_drivers
/*
* Call the console drivers on a range of log_buf
*/
static void __call_console_drivers(unsigned start, unsigned end)
{
struct console *con;
for_each_console(con) {
if (exclusive_console && con != exclusive_console)
continue;
if ((con->flags & CON_ENABLED) && con->write &&
(cpu_online(smp_processor_id()) ||
(con->flags & CON_ANYTIME)))
con->write(con, &LOG_BUF(start), end - start);
}
}
示例2: emit_log_char
static void emit_log_char(char c)
{
LOG_BUF(log_end) = c;
log_end++;
if (log_end - log_start > log_buf_len)
log_start = log_end - log_buf_len;
if (log_end - con_start > log_buf_len)
con_start = log_end - log_buf_len;
if (logged_chars < log_buf_len)
logged_chars++;
emit_sec_log_char(c);
}
示例3: emit_log_char
static void emit_log_char(char c)
{
LOG_BUF(log_end) = c;
log_end++;
if (log_end - log_start > log_buf_len)
log_start = log_end - log_buf_len;
if (log_end - con_start > log_buf_len)
con_start = log_end - log_buf_len;
if (logged_chars < log_buf_len)
logged_chars++;
#ifdef CONFIG_DUMP_PREV_OOPS_MSG
copy_char_to_oopsbuf(c);
#endif
}
示例4: BufferData
PureOmxBufferData::PureOmxBufferData(const PureOmxPlatformLayer& aPlatformLayer,
const OMX_PARAM_PORTDEFINITIONTYPE& aPortDef)
: BufferData(nullptr)
, mPlatformLayer(aPlatformLayer)
, mPortDef(aPortDef)
{
LOG_BUF("");
if (ShouldUseEGLImage()) {
// TODO
LOG_BUF("OMX_UseEGLImage() seems available but using it isn't implemented yet.");
}
OMX_ERRORTYPE err;
err = OMX_AllocateBuffer(mPlatformLayer.GetComponent(),
&mBuffer,
mPortDef.nPortIndex,
this,
mPortDef.nBufferSize);
if (err != OMX_ErrorNone) {
LOG_BUF("Failed to allocate the buffer!: 0x%08x", err);
}
}
示例5: emit_log_char
static void emit_log_char(char c)
{
LOG_BUF(log_end) = c;
#ifdef CONFIG_HAS_EARLYSUSPEND
if(suspend_process_going)
IRAM_LOG_BUF(log_end) = c;
#endif
log_end++;
if (log_end - log_start > log_buf_len)
log_start = log_end - log_buf_len;
if (log_end - con_start > log_buf_len)
con_start = log_end - log_buf_len;
if (logged_chars < log_buf_len)
logged_chars++;
}
示例6: writeChunkOnLogBlockDuringGC
UINT8 writeChunkOnLogBlockDuringGC(const UINT32 dataLpn, const UINT32 dataChunkOffset, const UINT32 chunkOffsetInBuf, const UINT32 bufAddr)
{
/* Need this function because during GC can't use the global variables, because those might be related to an outstanding write (which triggered the GC) */
UINT32 bank = chooseNewBank();
uart_print("writeChunkOnLogBlockDuringGC, bank="); uart_print_int(bank); uart_print(" dataLpn="); uart_print_int(dataLpn);
uart_print(", dataChunkOffset="); uart_print_int(dataChunkOffset); uart_print("\r\n");
int sectOffset = dataChunkOffset * SECTORS_PER_CHUNK;
UINT32 src = bufAddr + (chunkOffsetInBuf * BYTES_PER_CHUNK);
UINT32 dst = LOG_BUF(bank) + (chunkPtr[bank] * BYTES_PER_CHUNK); // base address of the destination chunk
waitBusyBank(bank);
mem_copy(dst, src, BYTES_PER_CHUNK);
updateDramBufMetadataDuringGc(bank, dataLpn, sectOffset);
updateChunkPtrDuringGC(bank);
return 0;
}
示例7: writePartialChunkWhenOldIsInOWBuf
static void writePartialChunkWhenOldIsInOWBuf(UINT32 nSectsToWrite, UINT32 oldChunkAddr)
{
uart_print("writePartialChunkWhenOldIsInOWBuf\r\n");
// Old Chunk Location
UINT32 oldBank = ChunkToBank(oldChunkAddr);
UINT32 oldSectOffset = ChunkToSectOffset(oldChunkAddr);
// Buffers
UINT32 dstWBufStart = LOG_BUF(bank_) + (chunkPtr[bank_] * BYTES_PER_CHUNK); // base address of the destination chunk
UINT32 srcOWBufStart = OW_LOG_BUF(oldBank)+(oldSectOffset*BYTES_PER_SECTOR); // location of old chunk
// Sizes
waitBusyBank(bank_);
mem_copy(dstWBufStart, srcOWBufStart, BYTES_PER_CHUNK); // First copy old data from OW Buf
UINT32 startOffsetWrite = (sectOffset_ % SECTORS_PER_CHUNK) * BYTES_PER_SECTOR;
UINT32 srcSataBufStart = WR_BUF_PTR(g_ftl_write_buf_id)+((sectOffset_ / SECTORS_PER_CHUNK)*BYTES_PER_CHUNK);
mem_copy(dstWBufStart+startOffsetWrite, srcSataBufStart+startOffsetWrite, nSectsToWrite*BYTES_PER_SECTOR); // Then copy new data from SATA Buf
}
示例8: writePartialChunkWhenOldIsInWBuf
static void writePartialChunkWhenOldIsInWBuf(UINT32 nSectsToWrite, UINT32 oldChunkAddr) {
uart_print("writePartialChunkWhenOldIsInWBuf\r\n");
// Old Chunk Location
UINT32 oldBank = ChunkToBank(oldChunkAddr);
UINT32 oldSectOffset = ChunkToSectOffset(oldChunkAddr);
// Buffers
UINT32 dstWBufStart = LOG_BUF(oldBank)+(oldSectOffset*BYTES_PER_SECTOR); // location of old chunk
UINT32 srcSataBufStart = WR_BUF_PTR(g_ftl_write_buf_id)+((sectOffset_ / SECTORS_PER_CHUNK)*BYTES_PER_CHUNK);
// Sizes
UINT32 startOffsetWrite = (sectOffset_ % SECTORS_PER_CHUNK) * BYTES_PER_SECTOR;
//waitBusyBank(bank_);
waitBusyBank(oldBank);
mem_copy(dstWBufStart+startOffsetWrite, srcSataBufStart+startOffsetWrite, nSectsToWrite*BYTES_PER_SECTOR);
#if MeasureDramAbsorb
uart_print_level_1("WRDRAM "); uart_print_level_1_int(nSectsToWrite); uart_print_level_1("\r\n");
#endif
}
示例9: emit_log_char
static void emit_log_char(char c,int prt_to_con)
{
LOG_BUF(log_end) = c;
log_end++;
if (log_end - log_start > log_buf_len)
log_start = log_end - log_buf_len;
if (log_end - con_start > log_buf_len)
con_start = log_end - log_buf_len;
if (logged_chars < log_buf_len)
logged_chars++;
#if defined(CONFIG_PRINTK) || defined(CONFIG_PANIC_PRINTK)
if (prt_to_con) {
PRT_BUF(prt_end) = c;
prt_end++;
if (prt_end - prt_start > __LOG_BUF_LEN)
prt_start = prt_end - __LOG_BUF_LEN;
}
#endif
}
示例10: call_console_drivers
/*
* Call the console drivers, asking them to write out
* log_buf[start] to log_buf[end - 1].
* The console_sem must be held.
*/
static void call_console_drivers(unsigned long start, unsigned long end)
{
unsigned long cur_index, start_print;
static int msg_level = -1;
if (((long)(start - end)) > 0)
BUG();
cur_index = start;
start_print = start;
while (cur_index != end) {
if ( msg_level < 0 &&
((end - cur_index) > 2) &&
LOG_BUF(cur_index + 0) == '<' &&
LOG_BUF(cur_index + 1) >= '0' &&
LOG_BUF(cur_index + 1) <= '7' &&
LOG_BUF(cur_index + 2) == '>')
{
msg_level = LOG_BUF(cur_index + 1) - '0';
cur_index += 3;
start_print = cur_index;
}
while (cur_index != end) {
char c = LOG_BUF(cur_index);
cur_index++;
if (c == '\n') {
if (msg_level < 0) {
/*
* printk() has already given us loglevel tags in
* the buffer. This code is here in case the
* log buffer has wrapped right round and scribbled
* on those tags
*/
msg_level = default_message_loglevel;
}
_call_console_drivers(start_print, cur_index, msg_level);
msg_level = -1;
start_print = cur_index;
break;
}
}
}
_call_console_drivers(start_print, end, msg_level);
}
示例11: overwriteChunkOldInWBuf
static void overwriteChunkOldInWBuf(UINT32 chunkAddr) {
//uart_print_level_1("23 ");
/* Question: is it better to copy the ow buf or to overwrite in place in w buf?
* Current implementation: copy to the ow buf, because probably will be overwritten again in the future.
*/
uart_print("overwriteChunkOldInWBuf\r\n");
chooseNewBank_();
UINT32 nSectsToWrite = (((sectOffset_ % SECTORS_PER_CHUNK) + remainingSects_) < SECTORS_PER_CHUNK) ? remainingSects_ :
(SECTORS_PER_CHUNK - (sectOffset_ % SECTORS_PER_CHUNK));
UINT32 srcBank = ChunkToBank(chunkAddr);
UINT32 srcChunkIdx = ChunkToChunkOffset(chunkAddr);
UINT32 startOffsetOverwrite = (sectOffset_ % SECTORS_PER_CHUNK) * BYTES_PER_SECTOR;
UINT32 endOffsetOverwrite = ((sectOffset_ % SECTORS_PER_CHUNK) + nSectsToWrite) * BYTES_PER_SECTOR;
UINT32 wBufAddr = LOG_BUF(srcBank) + srcChunkIdx*BYTES_PER_CHUNK;
UINT32 owBufAddr = OW_LOG_BUF(bank_) + owChunkPtr[bank_] * BYTES_PER_CHUNK;
UINT32 sataBufAddr = WR_BUF_PTR(g_ftl_write_buf_id)+(sectOffset_*BYTES_PER_SECTOR);
UINT32 leftHoleSize = startOffsetOverwrite;
UINT32 rightHoleSize = BYTES_PER_CHUNK - endOffsetOverwrite;
waitBusyBank(bank_); // (Fabio) probably should wait. In contrast to overwriteChunkOldInOwBuf, here we are writing to a new chunk in ow buf, thus it might be that a previous operation involving ow buf is in flight
mem_copy(owBufAddr + leftHoleSize, sataBufAddr, nSectsToWrite*BYTES_PER_SECTOR);
if(leftHoleSize > 0) {
uart_print("copy left hole\r\n");
mem_copy(owBufAddr, wBufAddr, leftHoleSize); // copy left hole
}
if(rightHoleSize > 0) {
uart_print("copy right hole\r\n");
mem_copy(owBufAddr+endOffsetOverwrite, wBufAddr+endOffsetOverwrite, rightHoleSize); // copy right hole
}
logBufMeta[srcBank].dataLpn[srcChunkIdx]=INVALID; // invalidate in w buf
updateOwDramBufMetadata();
updateOwChunkPtr();
sectOffset_ += nSectsToWrite;
remainingSects_ -= nSectsToWrite;
#if MeasureDramAbsorb
uart_print_level_1("OWDRAM "); uart_print_level_1_int(nSectsToWrite); uart_print_level_1("\r\n");
#endif
}
示例12: dev_read_kmsg
int dev_read_kmsg(char __user *buf, int len)
{
int error = -EINVAL;
unsigned i;
char c;
if (!buf || len < 0)
goto out;
error = 0;
if (!len)
goto out;
if (!access_ok(VERIFY_WRITE, buf, len)) {
error = -EFAULT;
goto out;
}
error = wait_event_interruptible(dev_wait,
(dev_start - log_end));
if (error)
goto out;
i = 0;
raw_spin_lock_irq(&logbuf_lock);
while (!error && (dev_start != log_end) && i < len) {
c = LOG_BUF(dev_start);
dev_start++;
raw_spin_unlock_irq(&logbuf_lock);
error = __put_user(c,buf);
buf++;
i++;
cond_resched();
raw_spin_lock_irq(&logbuf_lock);
}
raw_spin_unlock_irq(&logbuf_lock);
if (!error)
error = i;
out:
return error;
}
示例13: do_syslog
int do_syslog(int type, char __user *buf, int len, bool from_file)
{
unsigned i, j, limit, count;
int do_clear = 0;
char c;
int error;
error = check_syslog_permissions(type, from_file);
if (error)
goto out;
error = security_syslog(type);
if (error)
return error;
switch (type) {
case SYSLOG_ACTION_CLOSE:
break;
case SYSLOG_ACTION_OPEN:
break;
case SYSLOG_ACTION_READ:
error = -EINVAL;
if (!buf || len < 0)
goto out;
error = 0;
if (!len)
goto out;
if (!access_ok(VERIFY_WRITE, buf, len)) {
error = -EFAULT;
goto out;
}
error = wait_event_interruptible(log_wait,
(log_start - log_end));
if (error)
goto out;
i = 0;
raw_spin_lock_irq(&logbuf_lock);
while (!error && (log_start != log_end) && i < len) {
c = LOG_BUF(log_start);
log_start++;
raw_spin_unlock_irq(&logbuf_lock);
error = __put_user(c,buf);
buf++;
i++;
cond_resched();
raw_spin_lock_irq(&logbuf_lock);
}
raw_spin_unlock_irq(&logbuf_lock);
if (!error)
error = i;
break;
case SYSLOG_ACTION_READ_CLEAR:
do_clear = 1;
case SYSLOG_ACTION_READ_ALL:
error = -EINVAL;
if (!buf || len < 0)
goto out;
error = 0;
if (!len)
goto out;
if (!access_ok(VERIFY_WRITE, buf, len)) {
error = -EFAULT;
goto out;
}
count = len;
if (count > log_buf_len)
count = log_buf_len;
raw_spin_lock_irq(&logbuf_lock);
if (count > logged_chars)
count = logged_chars;
if (do_clear)
logged_chars = 0;
limit = log_end;
for (i = 0; i < count && !error; i++) {
j = limit-1-i;
if (j + log_buf_len < log_end)
break;
c = LOG_BUF(j);
raw_spin_unlock_irq(&logbuf_lock);
error = __put_user(c,&buf[count-1-i]);
cond_resched();
raw_spin_lock_irq(&logbuf_lock);
}
raw_spin_unlock_irq(&logbuf_lock);
if (error)
break;
error = i;
if (i != count) {
int offset = count-error;
for (i = 0; i < error; i++) {
if (__get_user(c,&buf[i+offset]) ||
__put_user(c,&buf[i])) {
error = -EFAULT;
break;
}
cond_resched();
//.........这里部分代码省略.........
示例14: do_syslog
/*
* Commands to do_syslog:
*
* 0 -- Close the log. Currently a NOP.
* 1 -- Open the log. Currently a NOP.
* 2 -- Read from the log.
* 3 -- Read all messages remaining in the ring buffer.
* 4 -- Read and clear all messages remaining in the ring buffer
* 5 -- Clear ring buffer.
* 6 -- Disable printk's to console
* 7 -- Enable printk's to console
* 8 -- Set level of messages printed to console
* 9 -- Return number of unread characters in the log buffer
*/
int do_syslog(int type, char * buf, int len)
{
unsigned long i, j, limit, count;
int do_clear = 0;
char c;
int error = 0;
switch (type) {
case 0: /* Close log */
break;
case 1: /* Open log */
break;
case 2: /* Read from log */
error = -EINVAL;
if (!buf || len < 0)
goto out;
error = 0;
if (!len)
goto out;
error = verify_area(VERIFY_WRITE,buf,len);
if (error)
goto out;
error = wait_event_interruptible(log_wait, (log_start - log_end));
if (error)
goto out;
i = 0;
spin_lock_irq(&logbuf_lock);
while ((log_start != log_end) && i < len) {
c = LOG_BUF(log_start);
log_start++;
spin_unlock_irq(&logbuf_lock);
__put_user(c,buf);
buf++;
i++;
spin_lock_irq(&logbuf_lock);
}
spin_unlock_irq(&logbuf_lock);
error = i;
break;
case 4: /* Read/clear last kernel messages */
do_clear = 1;
/* FALL THRU */
case 3: /* Read last kernel messages */
error = -EINVAL;
if (!buf || len < 0)
goto out;
error = 0;
if (!len)
goto out;
error = verify_area(VERIFY_WRITE,buf,len);
if (error)
goto out;
count = len;
if (count > LOG_BUF_LEN)
count = LOG_BUF_LEN;
spin_lock_irq(&logbuf_lock);
if (count > logged_chars)
count = logged_chars;
if (do_clear)
logged_chars = 0;
limit = log_end;
/*
* __put_user() could sleep, and while we sleep
* printk() could overwrite the messages
* we try to copy to user space. Therefore
* the messages are copied in reverse. <manfreds>
*/
for(i=0;i < count;i++) {
j = limit-1-i;
if (j+LOG_BUF_LEN < log_end)
break;
c = LOG_BUF(j);
spin_unlock_irq(&logbuf_lock);
__put_user(c,&buf[count-1-i]);
spin_lock_irq(&logbuf_lock);
}
spin_unlock_irq(&logbuf_lock);
error = i;
if(i != count) {
int offset = count-error;
/* buffer overflow during copy, correct user buffer. */
for(i=0;i<error;i++) {
__get_user(c,&buf[i+offset]);
__put_user(c,&buf[i]);
}
}
//.........这里部分代码省略.........
示例15: LOG_BUF
PureOmxBufferData::~PureOmxBufferData()
{
LOG_BUF("");
ReleaseBuffer();
}