本文整理汇总了C++中put32bit函数的典型用法代码示例。如果您正苦于以下问题:C++ put32bit函数的具体用法?C++ put32bit怎么用?C++ put32bit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了put32bit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: client_statfs
int client_statfs(struct statvfs *outstat)
{
int iSendLeng = 8 ;
uint8_t *szCommand = (uint8_t *)def_calloc(iSendLeng, sizeof(char));
char *curr = (char *)szCommand;
put32bit(&szCommand, CLTODI_STATFS);
put32bit(&szCommand, 0);
char *szOutBuf = NULL ;
int iOutLength = 0;
int ret = net_client_rpc(p_cn_client->p_client,
p_cn_client->namenode_info[0].namenode_ip,
p_cn_client->namenode_info[0].namenode_port,
curr, iSendLeng, &szOutBuf, &iOutLength);
def_free(curr);
if (ret != 0)
{
if(szOutBuf)
def_free(szOutBuf);
return EIO;
}
else
{
// 解析数据
buf_to_statvfs((const uint8_t *)szOutBuf, iOutLength, outstat);
def_free (szOutBuf);
return STATUS_OK;
}
}
开发者ID:franklyhuan,项目名称:filesystem,代码行数:32,代码来源:client.c
示例2: masterconn_download_next
void masterconn_download_next(masterconn *eptr) {
uint8_t *ptr;
uint8_t filenum;
int64_t dltime;
if (eptr->dloffset>=eptr->filesize) { // end of file
filenum = eptr->downloading;
if (masterconn_download_end(eptr)<0) {
return;
}
dltime = main_utime()-eptr->dlstartuts;
if (dltime<=0) {
dltime=1;
}
syslog(LOG_NOTICE,"%s downloaded %"PRIu64"B/%"PRIu64".%06"PRIu32"s (%.3lf MB/s)",(filenum==1)?"metadata":(filenum==2)?"sessions":(filenum==11)?"changelog_0":(filenum==12)?"changelog_1":"???",eptr->filesize,dltime/1000000,(uint32_t)(dltime%1000000),(double)(eptr->filesize)/(double)(dltime));
if (filenum==1) {
if (masterconn_metadata_check("metadata_ml.tmp")==0) {
if (BackMetaCopies>0) {
char metaname1[100],metaname2[100];
int i;
for (i=BackMetaCopies-1 ; i>0 ; i--) {
snprintf(metaname1,100,"metadata_ml.mfs.back.%"PRIu32,i+1);
snprintf(metaname2,100,"metadata_ml.mfs.back.%"PRIu32,i);
rename(metaname2,metaname1);
}
rename("metadata_ml.mfs.back","metadata_ml.mfs.back.1");
}
if (rename("metadata_ml.tmp","metadata_ml.mfs.back")<0) {
syslog(LOG_NOTICE,"can't rename downloaded metadata - do it manually before next download");
}
}
if (eptr->oldmode==0) {
masterconn_download_init(eptr,11);
} else {
masterconn_download_init(eptr,2);
}
} else if (filenum==11) {
if (rename("changelog_ml.tmp","changelog_ml_back.0.mfs")<0) {
syslog(LOG_NOTICE,"can't rename downloaded changelog - do it manually before next download");
}
masterconn_download_init(eptr,12);
} else if (filenum==12) {
if (rename("changelog_ml.tmp","changelog_ml_back.1.mfs")<0) {
syslog(LOG_NOTICE,"can't rename downloaded changelog - do it manually before next download");
}
masterconn_download_init(eptr,2);
} else if (filenum==2) {
if (rename("sessions_ml.tmp","sessions_ml.mfs")<0) {
syslog(LOG_NOTICE,"can't rename downloaded sessions - do it manually before next download");
}
}
} else { // send request for next data packet
ptr = masterconn_createpacket(eptr,MLTOMA_DOWNLOAD_DATA,12);
put64bit(&ptr,eptr->dloffset);
if (eptr->filesize-eptr->dloffset>META_DL_BLOCK) {
put32bit(&ptr,META_DL_BLOCK);
} else {
put32bit(&ptr,eptr->filesize-eptr->dloffset);
}
}
}
开发者ID:qqqxing,项目名称:jmfs,代码行数:60,代码来源:masterconn.c
示例3: client_unlink
int client_unlink(uint64_t parent, uint32_t nleng, const uint8_t* name, uint32_t uid, uint32_t gid)
{
int iSendLeng = 8 + 20 + nleng ;
uint8_t *szCommand = (uint8_t *)def_calloc(iSendLeng, sizeof(uint8_t));
char *curr = (char *)szCommand;
put32bit(&szCommand, CLTODI_UNLINK);
put32bit(&szCommand, 20 + nleng);
put64bit(&szCommand, parent);
put32bit(&szCommand, uid);
put32bit(&szCommand, gid);
put32bit(&szCommand, nleng);
memcpy(szCommand, name, nleng);
char *szOutBuf = NULL;
int iOutLength = 0;
int ret = net_client_rpc(p_cn_client->p_client,
p_cn_client->namenode_info[0].namenode_ip,
p_cn_client->namenode_info[0].namenode_port,
curr, iSendLeng, &szOutBuf, &iOutLength);
def_free(curr);
int ret2 = rpc_result_check(ret, szOutBuf, iOutLength);
return ret2;
}
开发者ID:franklyhuan,项目名称:filesystem,代码行数:26,代码来源:client.c
示例4: masterconn_chunk_checksum
//读取Master的packet,读取chunk校验和
//调用:masterconn_gotpacket()
void masterconn_chunk_checksum(masterconn *eptr,const uint8_t *data,uint32_t length) {
uint64_t chunkid;
uint32_t version;
uint8_t *ptr;
uint8_t status;
uint32_t checksum;
if (length!=8+4) {
syslog(LOG_NOTICE,"ANTOCS_CHUNK_CHECKSUM - wrong size (%"PRIu32"/12)",length);
eptr->mode = KILL;
return;
}
chunkid = get64bit(&data);
version = get32bit(&data);
status = hdd_get_checksum(chunkid,version,&checksum);
if (status!=STATUS_OK) {
ptr = masterconn_create_attached_packet(eptr,CSTOAN_CHUNK_CHECKSUM,8+4+1);
} else {
ptr = masterconn_create_attached_packet(eptr,CSTOAN_CHUNK_CHECKSUM,8+4+4);
}
if (ptr==NULL) {
eptr->mode=KILL;
return;
}
put64bit(&ptr,chunkid);
put32bit(&ptr,version);
if (status!=STATUS_OK) {
put8bit(&ptr,status);
} else {
put32bit(&ptr,checksum);
}
}
开发者ID:andyqzb,项目名称:shadow-mfs,代码行数:34,代码来源:masterconn.c
示例5: ppfs_chmod
int ppfs_chmod (const char *path, mode_t mt){
fprintf(stderr, "ppfs_chmod path : %s\n", path);
ppacket *s = createpacket_s(4+strlen(path)+4, CLTOMD_CHMOD,-1);
uint8_t* ptr = s->startptr+HEADER_LEN;
put32bit(&ptr, strlen(path));
memcpy(ptr, path, strlen(path));
ptr+=strlen(path);
put32bit(&ptr, mt);
sendpacket(fd, s);
free(s);
s = receivepacket(fd);
const uint8_t* ptr2 = s->startptr;
int status = get32bit(&ptr2);
if(status == 0){
print_attr((const attr*)ptr2);
attr_cache* ac;
if(lookup_attr_cache(path,&ac) == 0){
ac->a.mode = mt;
}
}
free(s);
return status;
}
开发者ID:twonly,项目名称:mis,代码行数:31,代码来源:client.c
示例6: ppfs_chown
int ppfs_chown (const char *path, uid_t uid, gid_t gid){
fprintf(stderr, "ppfs_chown path : %s\n", path);
ppacket *s = createpacket_s(4+strlen(path)+8, CLTOMD_CHOWN, -1);
uint8_t* ptr = s->startptr+HEADER_LEN;
put32bit(&ptr, strlen(path));
memcpy(ptr, path, strlen(path));
ptr+=strlen(path);
put32bit(&ptr, uid);
put32bit(&ptr, gid);
sendpacket(fd, s);
free(s);
s = receivepacket(fd);
const uint8_t* ptr2 = s->startptr;
int status = get32bit(&ptr2);
if(status == 0){
print_attr((const attr*)ptr2);
attr_cache* ac;
if(lookup_attr_cache(path,&ac) == 0){
ac->a.uid = uid;
ac->a.gid = gid;
}
}
free(s);
return status;
}
开发者ID:twonly,项目名称:mis,代码行数:33,代码来源:client.c
示例7: ppfs_utimens
int ppfs_utimens(const char* path,const struct timespec tv[2]){ //tv[0]: atime, tv[1] mtime
ppacket* p = createpacket_s(4+strlen(path)+4+4,CLTOMD_UTIMENS,-1);
uint8_t* ptr = p->startptr + HEADER_LEN;
int len = strlen(path);
put32bit(&ptr,len);
memcpy(ptr,path,len);
ptr += len;
put32bit(&ptr,tv[0].tv_sec);
put32bit(&ptr,tv[1].tv_sec);
sendpacket(fd,p);
free(p);
p = receivepacket(fd);
const uint8_t* ptr2 = p->startptr;
int status = get32bit(&ptr2);
if(status == 0){
attr_cache* ac;
if(lookup_attr_cache(path,&ac) == 0){
ac->a.atime = tv[0].tv_sec;
ac->a.ctime = tv[1].tv_sec;
}
}
free(p);
return status;
}
开发者ID:twonly,项目名称:mis,代码行数:30,代码来源:client.c
示例8: masterconn_chunkop
void masterconn_chunkop(masterconn *eptr,const uint8_t *data,uint32_t length) {
uint64_t chunkid;
uint32_t version,newversion;
uint64_t copychunkid;
uint32_t copyversion;
uint32_t leng;
uint8_t *ptr;
void *packet;
if (length!=8+4+8+4+4+4) {
syslog(LOG_NOTICE,"MATOCS_CHUNKOP - wrong size (%"PRIu32"/32)",length);
eptr->mode = KILL;
return;
}
chunkid = get64bit(&data);
version = get32bit(&data);
newversion = get32bit(&data);
copychunkid = get64bit(&data);
copyversion = get32bit(&data);
leng = get32bit(&data);
packet = masterconn_create_detached_packet(eptr,CSTOMA_CHUNKOP,8+4+4+8+4+4+1);
ptr = masterconn_get_packet_data(packet);
put64bit(&ptr,chunkid);
put32bit(&ptr,version);
put32bit(&ptr,newversion);
put64bit(&ptr,copychunkid);
put32bit(&ptr,copyversion);
put32bit(&ptr,leng);
job_chunkop(masterconn_chunkopfinished,packet,chunkid,version,newversion,copychunkid,copyversion,leng);
}
开发者ID:jacklicn,项目名称:moosefs,代码行数:30,代码来源:masterconn.c
示例9: masterconn_createpacket
uint8_t* masterconn_createpacket(serventry *eptr,uint32_t type,uint32_t size) {
packetstruct *outpacket;
uint8_t *ptr;
uint32_t psize;
outpacket=(packetstruct*)malloc(sizeof(packetstruct));
if (outpacket==NULL) {
return NULL;
}
psize = size+8;
outpacket->packet=malloc(psize);
outpacket->bytesleft = psize;
if (outpacket->packet==NULL) {
free(outpacket);
return NULL;
}
ptr = outpacket->packet;
put32bit(&ptr,type);
put32bit(&ptr,size);
outpacket->startptr = (uint8_t*)(outpacket->packet);
outpacket->next = NULL;
*(eptr->outputtail) = outpacket;
eptr->outputtail = &(outpacket->next);
return ptr;
}
开发者ID:andyqzb,项目名称:shadow-mfs,代码行数:25,代码来源:masterconn.c
示例10: flock_list
uint32_t flock_list(uint32_t inode,uint8_t *buff) {
inodelocks *il;
lock *l;
uint32_t h;
uint32_t ret=0;
if (inode==0) {
for (h=0 ; h<FLOCK_INODE_HASHSIZE ; h++) {
for (il = inodehash[h] ; il ; il=il->next) {
for (l=il->active ; l ; l=l->next) {
if (buff==NULL) {
ret+=37;
} else {
put32bit(&buff,il->inode);
put32bit(&buff,l->sessionid);
put64bit(&buff,l->owner);
memset(buff,0,20); // pid,start,end
buff+=20;
switch (l->ltype) {
case LTYPE_READER:
put8bit(&buff,1);
break;
case LTYPE_WRITER:
put8bit(&buff,2);
break;
default:
put8bit(&buff,0);
}
}
}
}
}
} else {
il = flock_inode_find(inode);
if (il!=NULL) {
for (l=il->active ; l ; l=l->next) {
if (buff==NULL) {
ret+=33;
} else {
put32bit(&buff,l->sessionid);
put64bit(&buff,l->owner);
memset(buff,0,20); // pid,start,end
buff+=20;
switch (l->ltype) {
case LTYPE_READER:
put8bit(&buff,1);
break;
case LTYPE_WRITER:
put8bit(&buff,2);
break;
default:
put8bit(&buff,0);
}
}
}
}
}
return ret;
}
开发者ID:JoeTime17,项目名称:moosefs,代码行数:59,代码来源:flocklocks.c
示例11: sclass_store
uint8_t sclass_store(bio *fd) {
uint8_t databuff[10+MAXSCLASSNLENG+3*(1+9*4*MASKORGROUP)];
uint8_t *ptr;
uint16_t i,j,k;
int32_t wsize;
if (fd==NULL) {
return 0x16;
}
ptr = databuff;
put8bit(&ptr,MASKORGROUP);
if (bio_write(fd,databuff,1)!=1) {
syslog(LOG_NOTICE,"write error");
return 0xFF;
}
for (i=1 ; i<firstneverused ; i++) {
if ((sclasstab[i].nleng)>0) {
ptr = databuff;
put16bit(&ptr,i);
put8bit(&ptr,sclasstab[i].nleng);
put8bit(&ptr,sclasstab[i].admin_only);
put8bit(&ptr,sclasstab[i].create_mode);
put16bit(&ptr,sclasstab[i].arch_delay);
put8bit(&ptr,sclasstab[i].create_labelscnt);
put8bit(&ptr,sclasstab[i].keep_labelscnt);
put8bit(&ptr,sclasstab[i].arch_labelscnt);
memcpy(ptr,sclasstab[i].name,sclasstab[i].nleng);
ptr+=sclasstab[i].nleng;
for (j=0 ; j<sclasstab[i].create_labelscnt ; j++) {
for (k=0 ; k<MASKORGROUP ; k++) {
put32bit(&ptr,sclasstab[i].create_labelmasks[j][k]);
}
}
for (j=0 ; j<sclasstab[i].keep_labelscnt ; j++) {
for (k=0 ; k<MASKORGROUP ; k++) {
put32bit(&ptr,sclasstab[i].keep_labelmasks[j][k]);
}
}
for (j=0 ; j<sclasstab[i].arch_labelscnt ; j++) {
for (k=0 ; k<MASKORGROUP ; k++) {
put32bit(&ptr,sclasstab[i].arch_labelmasks[j][k]);
}
}
wsize = 10+sclasstab[i].nleng+(sclasstab[i].create_labelscnt+sclasstab[i].keep_labelscnt+sclasstab[i].arch_labelscnt)*4*MASKORGROUP;
if (bio_write(fd,databuff,wsize)!=wsize) {
syslog(LOG_NOTICE,"write error");
return 0xFF;
}
}
}
memset(databuff,0,10);
if (bio_write(fd,databuff,10)!=10) {
syslog(LOG_NOTICE,"write error");
return 0xFF;
}
return 0;
}
开发者ID:onlyjob,项目名称:moosefs,代码行数:57,代码来源:storageclass.c
示例12: matomlserv_mloglist_data
void matomlserv_mloglist_data(uint8_t *ptr) {
matomlserventry *eptr;
for (eptr = matomlservhead ; eptr ; eptr=eptr->next) {
if (eptr->mode!=KILL) {
put32bit(&ptr,eptr->version);
put32bit(&ptr,eptr->servip);
}
}
}
开发者ID:windreamer,项目名称:moosefs,代码行数:9,代码来源:matomlserv.c
示例13: matoslaserv_mloglist_data
void matoslaserv_mloglist_data(uint8_t *ptr) {
serventry *eptr;
for (eptr = matoslaservhead ; eptr ; eptr=eptr->next) {
if (eptr->mode!=KILL && eptr->listen_sock==0) {
put32bit(&ptr,eptr->version);
put32bit(&ptr,eptr->servip);
}
}
}
开发者ID:andyqzb,项目名称:shadow-mfs,代码行数:9,代码来源:matoslaserv.c
示例14: mainserv_create_packet
uint8_t* mainserv_create_packet(uint8_t **wptr,uint32_t cmd,uint32_t leng) {
uint8_t *ptr;
ptr = malloc(leng+8);
passert(ptr);
*wptr = ptr;
put32bit(wptr,cmd);
put32bit(wptr,leng);
return ptr;
}
开发者ID:JoeTime17,项目名称:moosefs,代码行数:9,代码来源:mainserv.c
示例15: csserv_idlejob_finished
void csserv_idlejob_finished(uint8_t status,void *ijp) {
idlejob *ij = (idlejob*)ijp;
csserventry *eptr = ij->eptr;
uint8_t *ptr;
if (eptr) {
switch (ij->op) {
case IJ_GET_CHUNK_BLOCKS:
ptr = csserv_create_packet(eptr,CSTOAN_CHUNK_BLOCKS,8+4+2+1);
put64bit(&ptr,ij->chunkid);
put32bit(&ptr,ij->version);
if (status==MFS_STATUS_OK) {
memcpy(ptr,ij->buff,2);
ptr+=2;
} else {
put16bit(&ptr,0);
}
put8bit(&ptr,status);
break;
case IJ_GET_CHUNK_CHECKSUM:
if (status!=MFS_STATUS_OK) {
ptr = csserv_create_packet(eptr,CSTOAN_CHUNK_CHECKSUM,8+4+1);
} else {
ptr = csserv_create_packet(eptr,CSTOAN_CHUNK_CHECKSUM,8+4+4);
}
put64bit(&ptr,ij->chunkid);
put32bit(&ptr,ij->version);
if (status!=MFS_STATUS_OK) {
put8bit(&ptr,status);
} else {
memcpy(ptr,ij->buff,4);
}
break;
case IJ_GET_CHUNK_CHECKSUM_TAB:
if (status!=MFS_STATUS_OK) {
ptr = csserv_create_packet(eptr,CSTOAN_CHUNK_CHECKSUM_TAB,8+4+1);
} else {
ptr = csserv_create_packet(eptr,CSTOAN_CHUNK_CHECKSUM_TAB,8+4+4096);
}
put64bit(&ptr,ij->chunkid);
put32bit(&ptr,ij->version);
if (status!=MFS_STATUS_OK) {
put8bit(&ptr,status);
} else {
memcpy(ptr,ij->buff,4096);
}
break;
}
*(ij->prev) = ij->next;
if (ij->next) {
ij->next->prev = ij->prev;
}
}
free(ij);
}
开发者ID:JoeTime17,项目名称:moosefs,代码行数:55,代码来源:csserv.c
示例16: client_lookup
int client_lookup(uint64_t parent, uint8_t nleng, const uint8_t *name, uint32_t uid, uint32_t gid,
uint64_t *inode, uint8_t attr[FILE_ATTR_LEN])
{
int iSendLeng = 8 + 20 + nleng;
uint8_t *szCommand = (uint8_t *)def_calloc(iSendLeng, sizeof(char));
char *curr = (char *)szCommand;
put32bit(&szCommand, CLTODI_FUSE_LOOKUP);
put32bit(&szCommand, 20 + nleng);
put64bit(&szCommand, parent);
put32bit(&szCommand, nleng);
memcpy(szCommand, name, nleng);
szCommand += nleng;
put32bit(&szCommand, uid);
put32bit(&szCommand, gid);
char *szOutBuf = NULL;
int iOutLength = 0;
int ret = net_client_rpc(p_cn_client->p_client,
p_cn_client->namenode_info[0].namenode_ip,
p_cn_client->namenode_info[0].namenode_port,
curr, iSendLeng, &szOutBuf, &iOutLength);
def_free(curr);
if (ret != 0)
{
nb_log("client lookup", NB_LOG_ERROR, "nn --->cli rpc is error.");
if(szOutBuf)
def_free(szOutBuf);
ret = EIO;
}
else
{
if(iOutLength == 4)
{
const uint8_t * result = (const uint8_t *) szOutBuf;
ret = get32bit(&result);
}
else if (iOutLength != FILE_ATTR_LEN + 8)
{
ret = EIO;
}
else
{
const uint8_t *out = (const uint8_t *) szOutBuf;
*inode = get64bit(&out);
memcpy(attr, out, FILE_ATTR_LEN);
ret = STATUS_OK;
}
def_free(szOutBuf);
}
return ret;
}
开发者ID:franklyhuan,项目名称:filesystem,代码行数:55,代码来源:client.c
示例17: masterconn_download_next
void masterconn_download_next(serventry *eptr) {
uint8_t *ptr;
uint8_t filenum;
uint64_t dltime;
uint64_t starttime;
if (eptr->dloffset>=eptr->filesize) { // end of file
filenum = eptr->downloading;
dltime = main_utime()-eptr->dlstartuts;
MFSLOG(LOG_NOTICE,"%s downloaded %"PRIu64"B/%"PRIu64".%06"PRIu32"s (%.3lf MB/s)",(filenum==1)?"metadata":(filenum==2)?"changelog.0":"???",eptr->filesize,dltime/1000000,(uint32_t)(dltime%1000000),(double)(eptr->filesize)/(double)(dltime));
if (filenum==1) {
if (rename("metadata.tmp","metadata.mfs")<0) {
MFSLOG(LOG_NOTICE,"can't rename downloaded metadata - do it manually before next download");
} else {
MFSLOG(LOG_NOTICE,"loading metadata ...");
fs_strinit();
chunk_strinit();
starttime = get_current_time();
if (fs_loadall(NULL)<0) {
return;
MFSLOG(LOG_NOTICE,"fs init failed");
}
MFSLOG(LOG_NOTICE,"metadata file has been loaded");
}
} else if (filenum==2) {
if (rename("changelog.0.tmp","changelog.0.mfs")<0) {
MFSLOG(LOG_NOTICE,"can't rename downloaded changelog.0.mfs - do it manually before next download");
} else {
if (restore() < 0) {
MFSLOG(LOG_ERR,"restore failed");
} else {
meta_ready = 0;
}
}
}
//filenum:1,metadata finish ;2,changelog.0 finish
if (masterconn_download_end(eptr,filenum)<0) {
return;
}
} else { // send request for next data packet
ptr = masterconn_createpacket(eptr,SLATOMA_DOWNLOAD_DATA,12);
if (ptr==NULL) {
eptr->mode=KILL;
return;
}
put64bit(&ptr,eptr->dloffset);
if (eptr->filesize-eptr->dloffset>META_DL_BLOCK) {
put32bit(&ptr,META_DL_BLOCK);
} else {
put32bit(&ptr,eptr->filesize-eptr->dloffset);
}
}
}
开发者ID:andyqzb,项目名称:shadow-mfs,代码行数:54,代码来源:masterconn.c
示例18: masterconn_idlejob_finished
void masterconn_idlejob_finished(uint8_t status,void *ijp) {
idlejob *ij = (idlejob*)ijp;
masterconn *eptr = masterconnsingleton;
uint8_t *ptr;
if (eptr && eptr->mode == DATA && ij->valid) {
switch (ij->op) {
case IJ_GET_CHUNK_BLOCKS:
ptr = masterconn_create_attached_packet(eptr,CSTOAN_CHUNK_BLOCKS,8+4+2+1);
put64bit(&ptr,ij->chunkid);
put32bit(&ptr,ij->version);
memcpy(ptr,ij->buff,2);
ptr+=2;
put8bit(&ptr,status);
break;
case IJ_GET_CHUNK_CHECKSUM:
if (status!=MFS_STATUS_OK) {
ptr = masterconn_create_attached_packet(eptr,CSTOAN_CHUNK_CHECKSUM,8+4+1);
} else {
ptr = masterconn_create_attached_packet(eptr,CSTOAN_CHUNK_CHECKSUM,8+4+4);
}
put64bit(&ptr,ij->chunkid);
put32bit(&ptr,ij->version);
if (status!=MFS_STATUS_OK) {
put8bit(&ptr,status);
} else {
memcpy(ptr,ij->buff,4);
}
break;
case IJ_GET_CHUNK_CHECKSUM_TAB:
if (status!=MFS_STATUS_OK) {
ptr = masterconn_create_attached_packet(eptr,CSTOAN_CHUNK_CHECKSUM_TAB,8+4+1);
} else {
ptr = masterconn_create_attached_packet(eptr,CSTOAN_CHUNK_CHECKSUM_TAB,8+4+4096);
}
put64bit(&ptr,ij->chunkid);
put32bit(&ptr,ij->version);
if (status!=MFS_STATUS_OK) {
put8bit(&ptr,status);
} else {
memcpy(ptr,ij->buff,4096);
}
break;
}
}
if (ij->valid) {
*(ij->prev) = ij->next;
if (ij->next) {
ij->next->prev = ij->prev;
}
}
free(ij);
}
开发者ID:jacklicn,项目名称:moosefs,代码行数:53,代码来源:masterconn.c
示例19: rep_create_packet
static uint8_t* rep_create_packet(repsrc *rs,uint32_t type,uint32_t size) {
uint8_t *ptr;
if (rs->packet) {
free(rs->packet);
}
rs->packet = malloc(size+8);
passert(rs->packet);
ptr = rs->packet;
put32bit(&ptr,type);
put32bit(&ptr,size);
rs->startptr = rs->packet;
rs->bytesleft = 8+size;
return ptr;
}
开发者ID:chengyishi,项目名称:moosefs,代码行数:14,代码来源:replicator.c
示例20: masterconn_check_hdd_reports
void masterconn_check_hdd_reports() {
masterconn *eptr = masterconnsingleton;
uint32_t errorcounter;
uint32_t chunkcounter;
uint8_t *buff;
if (eptr->mode==DATA || eptr->mode==HEADER) {
if (hdd_spacechanged()) {
uint64_t usedspace,totalspace,tdusedspace,tdtotalspace;
uint32_t chunkcount,tdchunkcount;
buff = masterconn_create_attached_packet(eptr,CSTOMA_SPACE,8+8+4+8+8+4);
if (buff) {
hdd_get_space(&usedspace,&totalspace,&chunkcount,&tdusedspace,&tdtotalspace,&tdchunkcount);
put64bit(&buff,usedspace);
put64bit(&buff,totalspace);
put32bit(&buff,chunkcount);
put64bit(&buff,tdusedspace);
put64bit(&buff,tdtotalspace);
put32bit(&buff,tdchunkcount);
}
}
errorcounter = hdd_errorcounter();
while (errorcounter) {
masterconn_create_attached_packet(eptr,CSTOMA_ERROR_OCCURRED,0);
errorcounter--;
}
chunkcounter = hdd_get_damaged_chunk_count(); // lock
if (chunkcounter) {
buff = masterconn_create_attached_packet(eptr,CSTOMA_CHUNK_DAMAGED,8*chunkcounter);
if (buff) {
hdd_get_damaged_chunk_data(buff); // unlock
} else {
hdd_get_damaged_chunk_data(NULL); // unlock
}
} else {
hdd_get_damaged_chunk_data(NULL);
}
chunkcounter = hdd_get_lost_chunk_count(); // lock
if (chunkcounter) {
buff = masterconn_create_attached_packet(eptr,CSTOMA_CHUNK_LOST,8*chunkcounter);
if (buff) {
hdd_get_lost_chunk_data(buff); // unlock
} else {
hdd_get_lost_chunk_data(NULL); // unlock
}
} else {
hdd_get_lost_chunk_data(NULL);
}
}
}
开发者ID:andyqzb,项目名称:shadow-mfs,代码行数:49,代码来源:masterconn.c
注:本文中的put32bit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论