本文整理汇总了C++中do_warn函数的典型用法代码示例。如果您正苦于以下问题:C++ do_warn函数的具体用法?C++ do_warn怎么用?C++ do_warn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_warn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_da_freemap
/*
* Set the he range [start, stop) in the directory freemap.
*
* Returns 1 if there is a conflict or 0 if everything's good.
*
* Within a char, the lowest bit of the char represents the byte with
* the smallest address
*/
static int
set_da_freemap(xfs_mount_t *mp, da_freemap_t *map, int start, int stop)
{
const da_freemap_t mask = 0x1;
int i;
if (start > stop) {
/*
* allow == relation since [x, x) claims 1 byte
*/
do_warn(_("bad range claimed [%d, %d) in da block\n"),
start, stop);
return(1);
}
if (stop > mp->m_sb.sb_blocksize) {
do_warn(
_("byte range end [%d %d) in da block larger than blocksize %d\n"),
start, stop, mp->m_sb.sb_blocksize);
return(1);
}
for (i = start; i < stop; i ++) {
if (map[i / NBBY] & (mask << i % NBBY)) {
do_warn(_("multiply claimed byte %d in da block\n"), i);
return(1);
}
map[i / NBBY] |= (mask << i % NBBY);
}
return(0);
}
示例2: no_sb
void
no_sb(void)
{
do_warn(_("Sorry, could not find valid secondary superblock\n"));
do_warn(_("Exiting now.\n"));
exit(1);
}
示例3: read_wbuf
void
read_wbuf(int fd, wbuf *buf, xfs_mount_t *mp)
{
int res = 0;
xfs_off_t lres = 0;
xfs_off_t newpos;
size_t diff;
newpos = rounddown(buf->position, (xfs_off_t) buf->min_io_size);
if (newpos != buf->position) {
diff = buf->position - newpos;
buf->position = newpos;
buf->length += diff;
}
if (source_position != buf->position) {
lres = lseek64(fd, buf->position, SEEK_SET);
if (lres < 0LL) {
do_warn(_("%s: lseek64 failure at offset %lld\n"),
progname, source_position);
die_perror();
}
source_position = buf->position;
}
ASSERT(source_position % source_sectorsize == 0);
/* round up length for direct I/O if necessary */
if (buf->length % buf->min_io_size != 0)
buf->length = roundup(buf->length, buf->min_io_size);
if (buf->length > buf->size) {
do_warn(_("assert error: buf->length = %d, buf->size = %d\n"),
buf->length, buf->size);
killall();
abort();
}
if ((res = read(fd, buf->data, buf->length)) < 0) {
do_warn(_("%s: read failure at offset %lld\n"),
progname, source_position);
die_perror();
}
if (res < buf->length &&
source_position + res == mp->m_sb.sb_dblocks * source_blocksize)
res = buf->length;
else
ASSERT(res == buf->length);
source_position += res;
buf->length = res;
}
示例4: process_leaf_attr_local
static int
process_leaf_attr_local(
struct xfs_mount *mp,
xfs_attr_leafblock_t *leaf,
int i,
xfs_attr_leaf_entry_t *entry,
xfs_dahash_t last_hashval,
xfs_dablk_t da_bno,
xfs_ino_t ino)
{
xfs_attr_leaf_name_local_t *local;
local = xfs_attr3_leaf_name_local(leaf, i);
if (local->namelen == 0 || namecheck((char *)&local->nameval[0],
local->namelen)) {
do_warn(
_("attribute entry %d in attr block %u, inode %" PRIu64 " has bad name (namelen = %d)\n"),
i, da_bno, ino, local->namelen);
return -1;
}
/* Check on the hash value. Checking order of values
* is not necessary, since one wrong clears the whole
* fork. If the ordering's wrong, it's caught here or
* the kernel code has a bug with transaction logging
* or attributes itself. Being paranoid, let's check
* ordering anyway in case both the name value and the
* hashvalue were wrong but matched. Unlikely, however.
*/
if (be32_to_cpu(entry->hashval) != libxfs_da_hashname(
&local->nameval[0], local->namelen) ||
be32_to_cpu(entry->hashval) < last_hashval) {
do_warn(
_("bad hashvalue for attribute entry %d in attr block %u, inode %" PRIu64 "\n"),
i, da_bno, ino);
return -1;
}
/* Only check values for root security attributes */
if (entry->flags & XFS_ATTR_ROOT) {
if (valuecheck(mp, (char *)&local->nameval[0], NULL,
local->namelen, be16_to_cpu(local->valuelen))) {
do_warn(
_("bad security value for attribute entry %d in attr block %u, inode %" PRIu64 "\n"),
i, da_bno, ino);
return -1;
}
}
return xfs_attr_leaf_entsize_local(local->namelen,
be16_to_cpu(local->valuelen));
}
示例5: rmtval_get
/* This routine brings in blocks from disk one by one and assembles them
* in the value buffer. If get_bmapi gets smarter later to return an extent
* or list of extents, that would be great. For now, we don't expect too
* many blocks per remote value, so one by one is sufficient.
*/
static int
rmtval_get(xfs_mount_t *mp, xfs_ino_t ino, blkmap_t *blkmap,
xfs_dablk_t blocknum, int valuelen, char* value)
{
xfs_fsblock_t bno;
xfs_buf_t *bp;
int clearit = 0, i = 0, length = 0, amountdone = 0;
int hdrsize = 0;
if (xfs_sb_version_hascrc(&mp->m_sb))
hdrsize = sizeof(struct xfs_attr3_rmt_hdr);
/* ASSUMPTION: valuelen is a valid number, so use it for looping */
/* Note that valuelen is not a multiple of blocksize */
while (amountdone < valuelen) {
bno = blkmap_get(blkmap, blocknum + i);
if (bno == NULLFSBLOCK) {
do_warn(
_("remote block for attributes of inode %" PRIu64 " is missing\n"), ino);
clearit = 1;
break;
}
bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno),
XFS_FSB_TO_BB(mp, 1), 0,
&xfs_attr3_rmt_buf_ops);
if (!bp) {
do_warn(
_("can't read remote block for attributes of inode %" PRIu64 "\n"), ino);
clearit = 1;
break;
}
if (bp->b_error == -EFSBADCRC || bp->b_error == -EFSCORRUPTED) {
do_warn(
_("Corrupt remote block for attributes of inode %" PRIu64 "\n"), ino);
clearit = 1;
break;
}
ASSERT(mp->m_sb.sb_blocksize == XFS_BUF_COUNT(bp));
length = MIN(XFS_BUF_COUNT(bp) - hdrsize, valuelen - amountdone);
memmove(value, bp->b_addr + hdrsize, length);
amountdone += length;
value += length;
i++;
libxfs_putbuf(bp);
}
return (clearit);
}
示例6: verify_set_agheader
int
verify_set_agheader(xfs_mount_t *mp, xfs_buf_t *sbuf, xfs_sb_t *sb,
xfs_agf_t *agf, xfs_agi_t *agi, xfs_agnumber_t i)
{
int rval = 0;
int status = XR_OK;
int status_sb = XR_OK;
status = verify_sb(sb, (i == 0));
if (status != XR_OK) {
do_warn(_("bad on-disk superblock %d - %s\n"),
i, err_string(status));
}
status_sb = compare_sb(mp, sb);
if (status_sb != XR_OK) {
do_warn(_("primary/secondary superblock %d conflict - %s\n"),
i, err_string(status_sb));
}
if (status != XR_OK || status_sb != XR_OK) {
if (!no_modify) {
*sb = mp->m_sb;
/*
* clear the more transient fields
*/
sb->sb_inprogress = 1;
sb->sb_icount = 0;
sb->sb_ifree = 0;
sb->sb_fdblocks = 0;
sb->sb_frextents = 0;
sb->sb_qflags = 0;
}
rval |= XR_AG_SB;
}
rval |= secondary_sb_wack(mp, sbuf, sb, i);
rval |= verify_set_agf(mp, agf, i);
rval |= verify_set_agi(mp, agi, i);
return(rval);
}
示例7: process_attributes
/*
* returns 1 if attributes got cleared
* and 0 if things are ok.
*/
int
process_attributes(
xfs_mount_t *mp,
xfs_ino_t ino,
xfs_dinode_t *dip,
blkmap_t *blkmap,
int *repair) /* returned if we did repair */
{
int err;
__u8 aformat = dip->di_aformat;
#ifdef DEBUG
xfs_attr_shortform_t *asf;
asf = (xfs_attr_shortform_t *) XFS_DFORK_APTR(dip);
#endif
if (aformat == XFS_DINODE_FMT_LOCAL) {
ASSERT(be16_to_cpu(asf->hdr.totsize) <=
XFS_DFORK_ASIZE(dip, mp));
err = process_shortform_attr(mp, ino, dip, repair);
} else if (aformat == XFS_DINODE_FMT_EXTENTS ||
aformat == XFS_DINODE_FMT_BTREE) {
err = process_longform_attr(mp, ino, dip, blkmap,
repair);
/* if err, convert this to shortform and clear it */
/* if repair and no error, it's taken care of */
} else {
do_warn(_("illegal attribute format %d, ino %" PRIu64 "\n"),
aformat, ino);
err = 1;
}
return (err); /* and repair */
}
示例8: warn
void warn(const char *file,int line,const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
do_warn("WARNINGS", file, line, fmt, args);
va_end(args);
}
示例9: warning
void warning(struct position pos, const char * fmt, ...)
{
va_list args;
if (Wsparse_error) {
va_start(args, fmt);
do_error(pos, fmt, args);
va_end(args);
return;
}
if (!max_warnings) {
show_info = 0;
return;
}
if (!--max_warnings) {
show_info = 0;
fmt = "too many warnings";
}
va_start(args, fmt);
do_warn("warning: ", pos, fmt, args);
va_end(args);
}
示例10: warn_doc_error
void warn_doc_error(const char *file,int line,const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
do_warn("WARN_IF_DOC_ERROR", file, line, fmt, args);
va_end(args);
}
示例11: warn_undoc
void warn_undoc(const char *file,int line,const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
do_warn("WARN_IF_UNDOCUMENTED", file, line, fmt, args);
va_end(args);
}
示例12: error_die
void error_die(struct position pos, const char * fmt, ...)
{
va_list args;
va_start(args, fmt);
do_warn("error: ", pos, fmt, args);
va_end(args);
exit(1);
}
示例13: info
void info(struct position pos, const char * fmt, ...)
{
va_list args;
if (!show_info)
return;
va_start(args, fmt);
do_warn("", pos, fmt, args);
va_end(args);
}
示例14: warnings_warn_impl
static PyObject *
warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category,
Py_ssize_t stacklevel, PyObject *source)
/*[clinic end generated code: output=31ed5ab7d8d760b2 input=bfdf5cf99f6c4edd]*/
{
category = get_category(message, category);
if (category == NULL)
return NULL;
return do_warn(message, category, stacklevel, source);
}
示例15: xfs_acl_from_disk
static int
xfs_acl_from_disk(
struct xfs_mount *mp,
struct xfs_icacl **aclp,
struct xfs_acl *dacl)
{
struct xfs_icacl *acl;
struct xfs_icacl_entry *ace;
struct xfs_acl_entry *dace;
int count;
int i;
count = be32_to_cpu(dacl->acl_cnt);
if (count > XFS_ACL_MAX_ENTRIES(mp)) {
do_warn(_("Too many ACL entries, count %d\n"), count);
*aclp = NULL;
return EINVAL;
}
acl = malloc(sizeof(struct xfs_icacl) +
count * sizeof(struct xfs_icacl_entry));
if (!acl) {
do_warn(_("cannot malloc enough for ACL attribute\n"));
do_warn(_("SKIPPING this ACL\n"));
*aclp = NULL;
return ENOMEM;
}
acl->acl_cnt = count;
for (i = 0; i < count; i++) {
ace = &acl->acl_entry[i];
dace = &dacl->acl_entry[i];
ace->ae_tag = be32_to_cpu(dace->ae_tag);
ace->ae_id = be32_to_cpu(dace->ae_id);
ace->ae_perm = be16_to_cpu(dace->ae_perm);
}
*aclp = acl;
return 0;
}