本文整理汇总了C++中sd_err函数的典型用法代码示例。如果您正苦于以下问题:C++ sd_err函数的具体用法?C++ sd_err怎么用?C++ sd_err使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sd_err函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: prealloc
/* Preallocate the whole object to get a better filesystem layout. */
int prealloc(int fd, uint32_t size)
{
int ret = xfallocate(fd, 0, 0, size);
if (ret < 0) {
if (errno != ENOSYS && errno != EOPNOTSUPP) {
sd_err("failed to preallocate space, %m");
return ret;
}
return xftruncate(fd, size);
}
return 0;
}
开发者ID:babarnazmi,项目名称:sheepdog,代码行数:15,代码来源:plain_store.c
示例2: sd_out_new_until
SD_API struct sd_out *
sd_out_new_until(double time)
{
struct data *data, zero = {0};
if ((data = sd_malloc(sizeof(struct data))) == NULL)
{
sd_err("alloc out until failed.");
return NULL;
}
data->time = time;
data->sd_out = sd_out_defaults;
data->sd_out.data = data;
return &(data->sd_out);
}
开发者ID:Vio8023,项目名称:sddekit,代码行数:14,代码来源:until.c
示例3: modify_event
int modify_event(int fd, unsigned int new_events)
{
int ret;
struct epoll_event ev;
struct event_info *ei;
ei = lookup_event(fd);
if (!ei) {
sd_err("event info for fd %d not found", fd);
return 1;
}
memset(&ev, 0, sizeof(ev));
ev.events = new_events;
ev.data.ptr = ei;
ret = epoll_ctl(efd, EPOLL_CTL_MOD, fd, &ev);
if (ret) {
sd_err("failed to modify epoll event for fd %d: %m", fd);
return 1;
}
return 0;
}
开发者ID:FrankYu,项目名称:sheepdog,代码行数:23,代码来源:event.c
示例4: sd_write_object
/* Write data to both local object cache (if enabled) and backends */
int sd_write_object(uint64_t oid, char *data, unsigned int datalen,
uint64_t offset, bool create)
{
struct sd_req hdr;
int ret;
if (sys->enable_object_cache && object_is_cached(oid)) {
ret = object_cache_write(oid, data, datalen, offset,
create);
if (ret == SD_RES_NO_CACHE)
goto forward_write;
if (ret != 0) {
sd_err("write cache failed %" PRIx64 " %" PRIx32, oid,
ret);
return ret;
}
}
forward_write:
if (create)
sd_init_req(&hdr, SD_OP_CREATE_AND_WRITE_OBJ);
else
sd_init_req(&hdr, SD_OP_WRITE_OBJ);
hdr.flags = SD_FLAG_CMD_WRITE;
hdr.data_length = datalen;
hdr.obj.oid = oid;
hdr.obj.offset = offset;
ret = exec_local_req(&hdr, data);
if (ret != SD_RES_SUCCESS)
sd_err("failed to write object %" PRIx64 ", %s", oid,
sd_strerror(ret));
return ret;
}
开发者ID:Taejun,项目名称:sheepdog,代码行数:38,代码来源:store.c
示例5: create_unix_domain_socket
int create_unix_domain_socket(const char *unix_path,
int (*callback)(int, void *), void *data)
{
int fd, ret;
struct sockaddr_un addr;
addr.sun_family = AF_UNIX;
pstrcpy(addr.sun_path, sizeof(addr.sun_path), unix_path);
fd = socket(addr.sun_family, SOCK_STREAM, 0);
if (fd < 0) {
sd_err("failed to create socket, %m");
return -1;
}
ret = bind(fd, &addr, sizeof(addr));
if (ret) {
sd_err("failed to bind socket: %m");
goto err;
}
ret = listen(fd, SOMAXCONN);
if (ret) {
sd_err("failed to listen on socket: %m");
goto err;
}
ret = callback(fd, data);
if (ret)
goto err;
return 0;
err:
close(fd);
return -1;
}
开发者ID:Seagate,项目名称:kinetic-sheepdog,代码行数:37,代码来源:net.c
示例6: init_journal_arg
static void init_journal_arg(char *arg)
{
const char *d = "dir=", *sz = "size=", *sp = "skip";
int dl = strlen(d), szl = strlen(sz), spl = strlen(sp);
if (!strncmp(d, arg, dl)) {
arg += dl;
snprintf(jpath, sizeof(jpath), "%s", arg);
} else if (!strncmp(sz, arg, szl)) {
arg += szl;
jsize = strtoll(arg, NULL, 10);
if (jsize < MIN_JOURNAL_SIZE || jsize == LLONG_MAX) {
sd_err("invalid size %s, must be bigger than %u(M)",
arg,
MIN_JOURNAL_SIZE);
exit(1);
}
} else if (!strncmp(sp, arg, spl)) {
jskip = true;
} else {
sd_err("invalid paramters %s", arg);
exit(1);
}
}
开发者ID:SongWuCloud,项目名称:ACStor,代码行数:24,代码来源:sheep.c
示例7: sd_discard_object
int sd_discard_object(uint64_t oid)
{
int ret;
struct sd_req hdr;
sd_init_req(&hdr, SD_OP_DISCARD_OBJ);
hdr.obj.oid = oid;
ret = exec_local_req(&hdr, NULL);
if (ret != SD_RES_SUCCESS)
sd_err("Failed to discard data obj %"PRIu64" %s", oid,
sd_strerror(ret));
return ret;
}
开发者ID:Taejun,项目名称:sheepdog,代码行数:15,代码来源:store.c
示例8: bnode_do_create
static int bnode_do_create(struct kv_bnode *bnode, struct sd_inode *inode,
uint32_t idx)
{
uint32_t vid = inode->vdi_id;
uint64_t oid = vid_to_data_oid(vid, idx);
int ret;
bnode->oid = oid;
ret = sd_write_object(oid, (char *)bnode, sizeof(*bnode), 0, true);
if (ret != SD_RES_SUCCESS) {
sd_err("failed to create object, %" PRIx64, oid);
goto out;
}
INODE_SET_VID(inode, idx, vid);
ret = sd_inode_write_vid(sheep_bnode_writer, inode, idx,
vid, vid, 0, false, false);
if (ret != SD_RES_SUCCESS) {
sd_err("failed to update inode, %" PRIx64,
vid_to_vdi_oid(vid));
goto out;
}
out:
return ret;
}
开发者ID:skuanr,项目名称:sheepdog,代码行数:24,代码来源:kv.c
示例9: sd_rng_new_mt
struct sd_rng *
sd_rng_new_mt(uint32_t seed)
{
struct data *data;
if ((data = sd_malloc(sizeof(struct data))) == NULL)
{
sd_err("alloc rng failed.");
return NULL;
}
data->seed = seed;
data->sd_rng = sd_rng_defaults;
data->sd_rng.data = data;
sd_rng_mt_seed(seed, &data->rks);
return &data->sd_rng;
}
开发者ID:AbheekG,项目名称:sddekit,代码行数:15,代码来源:rng.c
示例10: set_delay_scale
static enum sd_stat set_delay_scale(
struct sd_conn *sd_conn, double new_delay_scale)
{
if (new_delay_scale <= 0.0)
{
sd_err("delay_scale <= 0");
return SD_ERR;
}
struct conn *conn = (struct conn*) sd_conn->data;
double rescaler = conn->delay_scale / new_delay_scale;
for (uint32_t i=0; i<conn->nnz; i++)
conn->delays[i] *= rescaler;
conn->delay_scale = new_delay_scale;
return SD_OK;
}
开发者ID:AbheekG,项目名称:sddekit,代码行数:15,代码来源:conn.c
示例11: send_light_req
/* Light request only contains header, without body content. */
int send_light_req(const struct node_id *nid, struct sd_req *hdr)
{
int ret = dog_exec_req(nid, hdr, NULL);
struct sd_rsp *rsp = (struct sd_rsp *)hdr;
if (ret == -1)
return -1;
if (rsp->result != SD_RES_SUCCESS) {
sd_err("Response's result: %s", sd_strerror(rsp->result));
return -1;
}
return 0;
}
开发者ID:hadrienk,项目名称:sheepdog,代码行数:16,代码来源:common.c
示例12: send_light_req
/* Light request only contains header, without body content. */
int send_light_req(struct sd_req *hdr, const uint8_t *addr, int port)
{
int ret = dog_exec_req(addr, port, hdr, NULL);
struct sd_rsp *rsp = (struct sd_rsp *)hdr;
if (ret == -1)
return -1;
if (rsp->result != SD_RES_SUCCESS) {
sd_err("Response's result: %s", sd_strerror(rsp->result));
return -1;
}
return 0;
}
开发者ID:sglwlb,项目名称:sheepdog,代码行数:16,代码来源:common.c
示例13: sdstd_isr
/* Interrupt handler */
static irqreturn_t
sdstd_isr(int irq, void *dev_id
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
, struct pt_regs *ptregs
#endif
)
{
sdioh_info_t *sd;
struct sdos_info *sdos;
bool ours;
unsigned long flags;
sd = (sdioh_info_t *)dev_id;
sdos = (struct sdos_info *)sd->sdos_info;
if (!sd->card_init_done) {
sd_err(("%s: Hey Bogus intr...not even initted: irq %d\n", __FUNCTION__, irq));
return IRQ_RETVAL(FALSE);
} else {
if (sdstd_3_is_retuning_int_set(sd)) {
/* for 3.0 host, retuning request might come in this path */
/* * disable ISR's */
local_irq_save(flags);
if (sdstd_3_check_and_set_retuning(sd))
tasklet_schedule(&sdos->tuning_tasklet);
/* * enable back ISR's */
local_irq_restore(flags);
/* * disable tuning isr signaling */
sdstd_3_disable_retuning_int(sd);
/* * note: check_client_intr() checks for intmask also to
wakeup. so be careful to use sd->intmask to disable
re-tuning ISR.
*/
}
ours = check_client_intr(sd);
/* For local interrupts, wake the waiting process */
if (ours && sd->got_hcint) {
sd_trace(("INTR->WAKE\n"));
/* sdos = (struct sdos_info *)sd->sdos_info; */
wake_up_interruptible(&sdos->intr_wait_queue);
}
return IRQ_RETVAL(ours);
}
}
开发者ID:Pesach85,项目名称:lge-kernel-omap4,代码行数:49,代码来源:bcmsdstd_linux.c
示例14: default_remove_object
int default_remove_object(uint64_t oid, uint8_t ec_index)
{
char path[PATH_MAX];
get_store_path(oid, ec_index, path);
if (unlink(path) < 0) {
if (errno == ENOENT)
return SD_RES_NO_OBJ;
sd_err("failed, %s, %m", path);
return SD_RES_EIO;
}
return SD_RES_SUCCESS;
}
开发者ID:kolmoshen,项目名称:sheepdog-ng,代码行数:16,代码来源:plain_store.c
示例15: bcmsdh_sdmmc_resume
static int bcmsdh_sdmmc_resume(struct device *pdev)
{
#if defined(OOB_INTR_ONLY)
struct sdio_func *func = dev_to_sdio_func(pdev);
#endif
if (func->num == 2)
sd_err(("%s Enter\n", __FUNCTION__));
dhd_mmc_suspend = FALSE;
#if defined(OOB_INTR_ONLY)
if ((func->num == 2) && dhd_os_check_if_up(bcmsdh_get_drvdata()))
bcmsdh_oob_intr_set(1);
#endif /* (OOB_INTR_ONLY) */
smp_mb();
return 0;
}
开发者ID:1yankeedt,项目名称:D710BST_FL24_Kernel,代码行数:16,代码来源:bcmsdh_sdmmc_linux.c
示例16: sdioh_remove
static void sdioh_remove(struct sdio_func *func)
{
sdioh_info_t *sdioh;
osl_t *osh;
sdioh = sdio_get_drvdata(func);
if (sdioh == NULL) {
sd_err(("%s: error, no sdioh handler found\n", __FUNCTION__));
return;
}
osh = sdioh->osh;
bcmsdh_remove(sdioh->bcmsdh);
sdioh_detach(osh, sdioh);
osl_detach(osh);
}
开发者ID:CM13-HI6210SFT,项目名称:hisi_kernel_3.10.86_hi6210sft,代码行数:16,代码来源:bcmsdh_sdmmc_linux.c
示例17: bcmsdh_sdmmc_remove
static void bcmsdh_sdmmc_remove(struct sdio_func *func)
{
if (func == NULL) {
sd_err(("%s is called with NULL SDIO function pointer\n", __FUNCTION__));
return;
}
sd_trace(("bcmsdh_sdmmc: %s Enter\n", __FUNCTION__));
sd_info(("sdio_bcmsdh: func->class=%x\n", func->class));
sd_info(("sdio_vendor: 0x%04x\n", func->vendor));
sd_info(("sdio_device: 0x%04x\n", func->device));
sd_info(("Function#: 0x%04x\n", func->num));
if ((func->num == 2) || (func->num == 1 && func->device == 0x4))
sdioh_remove(func);
}
开发者ID:CM13-HI6210SFT,项目名称:hisi_kernel_3.10.86_hi6210sft,代码行数:16,代码来源:bcmsdh_sdmmc_linux.c
示例18: crash_handler
static void crash_handler(int signo)
{
sd_err("dog exits unexpectedly (%s).", strsignal(signo));
sd_backtrace();
/*
* OOM raises SIGABRT in xmalloc but the administrator expects
* that dog exits with EXIT_SYSFAIL. We have to give up
* dumping a core file in this case.
*/
if (signo == SIGABRT)
exit(EXIT_SYSFAIL);
reraise_crash_signal(signo, EXIT_SYSFAIL);
}
开发者ID:Taejun,项目名称:sheepdog,代码行数:16,代码来源:dog.c
示例19: write_config
static int write_config(void)
{
int ret;
if( (!sys->gateway_only) && (sys->store & STORE_FLAG_KINETIC))
return kinetic_write_config( (char *)&config, sizeof(config),
true);
ret = atomic_create_and_write(config_path, (char *)&config,
sizeof(config), true);
if (ret < 0) {
sd_err("atomic_create_and_write() failed");
return SD_RES_EIO;
}
return SD_RES_SUCCESS;
}
开发者ID:Seagate,项目名称:kinetic-sheepdog,代码行数:16,代码来源:config.c
示例20: onode_create
static int onode_create(struct kv_onode *onode, uint32_t bucket_vid)
{
struct sd_inode *inode = xmalloc(sizeof(struct sd_inode));
uint32_t tmp_vid, idx;
uint64_t hval, i;
int ret;
bool create = true;
sys->cdrv->lock(bucket_vid);
ret = sd_read_object(vid_to_vdi_oid(bucket_vid), (char *)inode,
sizeof(*inode), 0);
if (ret != SD_RES_SUCCESS) {
sd_err("failed to read %" PRIx32 " %s", bucket_vid,
sd_strerror(ret));
goto out;
}
hval = sd_hash(onode->name, strlen(onode->name));
for (i = 0; i < MAX_DATA_OBJS; i++) {
idx = (hval + i) % MAX_DATA_OBJS;
tmp_vid = INODE_GET_VID(inode, idx);
if (tmp_vid) {
uint64_t oid = vid_to_data_oid(bucket_vid, idx);
char name[SD_MAX_OBJECT_NAME] = { };
ret = sd_read_object(oid, name, sizeof(name), 0);
if (ret != SD_RES_SUCCESS)
goto out;
if (name[0] == 0) {
create = false;
goto create;
}
} else
break;
}
if (i == MAX_DATA_OBJS) {
ret = SD_RES_NO_SPACE;
goto out;
}
create:
ret = onode_do_create(onode, inode, idx, create);
out:
free(inode);
sys->cdrv->unlock(bucket_vid);
return ret;
}
开发者ID:skuanr,项目名称:sheepdog,代码行数:46,代码来源:kv.c
注:本文中的sd_err函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论