Ejemplo n.º 1
0
int do_undel(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t inode;
	EAT(ptr,filename,lv,'(');
	GETU32(inode,ptr);
	EAT(ptr,filename,lv,')');
	return fs_log_undel(ts,inode);
}
Ejemplo n.º 2
0
static attribute *parse_attr_cleanup(symtable *scope, const char *ident)
{
    char *sp;
    where ident_loc;
    attribute *attr = NULL;
    struct symtab_entry ent;

    (void)ident;

    EAT(token_open_paren);

    if(curtok != token_identifier)
        die_at(NULL, "identifier expected for cleanup function");

    where_cc1_current(&ident_loc);
    sp = token_current_spel();
    EAT(token_identifier);

    if(symtab_search(scope, sp, NULL, &ent) && ent.type == SYMTAB_ENT_DECL) {
        attr = attribute_new(attr_cleanup);
        attr->bits.cleanup = ent.bits.decl;
    } else {
        warn_at_print_error(&ident_loc, "function '%s' not found", sp);
        fold_had_error = 1;
    }

    EAT(token_close_paren);

    return attr;
}
Ejemplo n.º 3
0
static attribute *parse_attr_section(symtable *symtab, const char *ident)
{
    /* __attribute__((section ("sectionname"))) */
    attribute *da;
    char *func;
    size_t len, i;

    (void)symtab;
    (void)ident;

    EAT(token_open_paren);

    if(curtok != token_string)
        die_at(NULL, "string expected for section");

    token_get_current_str(&func, &len, NULL, NULL);
    EAT(token_string);

    for(i = 0; i < len; i++)
        if(!isprint(func[i])) {
            if(i < len - 1 || func[i] != '\0')
                cc1_warn_at(NULL, attr_section_badchar,
                            "character 0x%x detected in section", func[i]);
            break;
        }

    da = attribute_new(attr_section);

    da->bits.section = func;

    EAT(token_close_paren);

    return da;
}
Ejemplo n.º 4
0
uint8_t do_purge(uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t inode;
	EAT(ptr,lv,'(');
	GETU32(inode,ptr);
	EAT(ptr,lv,')');
	return fs_purge(ts,inode);
}
Ejemplo n.º 5
0
uint8_t do_undel(uint64_t lv,uint32_t ts,char *ptr) {
        uint32_t inode;
        EAT(ptr,lv,'(');
        GETU32(inode,ptr);
        EAT(ptr,lv,')');
        return shadow_fs_undel(ts,inode);
}
Ejemplo n.º 6
0
int do_freeinodes(const char *filename,uint64_t lv,uint32_t ts,char* ptr) {
	uint32_t freeinodes;
	EAT(ptr,filename,lv,'(');
	EAT(ptr,filename,lv,')');
	EAT(ptr,filename,lv,':');
	GETU32(freeinodes,ptr);
	return fs_log_freeinodes(ts,freeinodes);
}
Ejemplo n.º 7
0
uint8_t do_freeinodes(uint64_t lv,uint32_t ts,char* ptr) {
        uint32_t freeinodes;
        EAT(ptr,lv,'(');
        EAT(ptr,lv,')');
        EAT(ptr,lv,':');
        GETU32(freeinodes,ptr);
        return shadow_fs_freeinodes(ts,freeinodes);
}
Ejemplo n.º 8
0
int do_unlock(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint64_t chunkid;
	(void)ts;
	EAT(ptr,filename,lv,'(');
	GETU64(chunkid,ptr);
	EAT(ptr,filename,lv,')');
	return fs_log_unlock(chunkid);
}
Ejemplo n.º 9
0
uint8_t do_incversion(uint64_t lv,uint32_t ts,char *ptr) {
	uint64_t chunkid;
	(void)ts;
	EAT(ptr,lv,'(');
	GETU64(chunkid,ptr);
	EAT(ptr,lv,')');
	return fs_incversion(chunkid);
}
Ejemplo n.º 10
0
uint8_t do_emptyreserved(uint64_t lv,uint32_t ts,char* ptr) {
	uint32_t freeinodes;
	EAT(ptr,lv,'(');
	EAT(ptr,lv,')');
	EAT(ptr,lv,':');
	GETU32(freeinodes,ptr);
	return fs_emptyreserved(ts,freeinodes);
}
Ejemplo n.º 11
0
uint8_t do_unlock(uint64_t lv,uint32_t ts,char *ptr) {
        uint64_t chunkid;
        (void)ts;
        EAT(ptr,lv,'(');
        GETU64(chunkid,ptr);
        EAT(ptr,lv,')');
        return shadow_fs_unlock(chunkid);
}
Ejemplo n.º 12
0
uint8_t do_session(uint64_t lv,uint32_t ts,char *ptr) {
        uint32_t cuid;
        (void)ts;
        EAT(ptr,lv,'(');
        EAT(ptr,lv,')');
        EAT(ptr,lv,':');
        GETU32(cuid,ptr);
        return shadow_fs_session(cuid);
}
Ejemplo n.º 13
0
uint8_t do_append(uint64_t lv,uint32_t ts,char *ptr) {
        uint32_t inode,inode_src;
        EAT(ptr,lv,'(');
        GETU32(inode,ptr);
        EAT(ptr,lv,',');
        GETU32(inode_src,ptr);
        EAT(ptr,lv,')');
        return shadow_fs_append(ts,inode,inode_src);
}
Ejemplo n.º 14
0
static void parse_test_init_expr(stmt *t, struct stmt_ctx *ctx)
{
	where here;

	where_cc1_current(&here);

	EAT(token_open_paren);

	/* if C99, we create a new scope here, for e.g.
	 * if(5 > (enum { a, b })a){ return a; } return b;
	 * "return b" can't see 'b' since its scope is only the if
	 *
	 * C90 drags the scope of the enum up to the enclosing block
	 */
	if(cc1_std >= STD_C99){
		ctx->scope = t->symtab = symtab_new(t->symtab, &here);
	}

  if(parse_at_decl(ctx->scope, 1)){
		decl *d;

		/* if we are at a type, push a scope for it, for
		 * for(int i ...), if(int i = ...) etc
		 */
		symtable *init_scope = symtab_new(t->symtab, &here);

		t->flow = stmt_flow_new(init_scope);

		d = parse_decl(
				DECL_SPEL_NEED, 0,
				init_scope, init_scope);

		UCC_ASSERT(d, "at decl, but no decl?");

		UCC_ASSERT(
				t->flow->for_init_symtab == init_scope,
				"wrong scope for stmt-init");

		flow_fold(t->flow, &t->symtab);
		ctx->scope = t->symtab;

		/* `d' is added to the scope implicitly */

		if(accept(token_comma)){
			/* if(int i = 5, i > f()){ ... } */
			t->expr = parse_expr_exp(ctx->scope, 0);
		}else{
			/* if(int i = 5) -> if(i) */
			t->expr = expr_new_identifier(d->spel);
		}
	}else{
		t->expr = parse_expr_exp(t->symtab, 0);
	}
	FOLD_EXPR(t->expr, t->symtab);

	EAT(token_close_paren);
}
Ejemplo n.º 15
0
int do_session(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t cuid;
	(void)ts;
	EAT(ptr,filename,lv,'(');
	EAT(ptr,filename,lv,')');
	EAT(ptr,filename,lv,':');
	GETU32(cuid,ptr);
	return fs_log_session(cuid);
}
Ejemplo n.º 16
0
int do_append(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t inode,inode_src;
	EAT(ptr,filename,lv,'(');
	GETU32(inode,ptr);
	EAT(ptr,filename,lv,',');
	GETU32(inode_src,ptr);
	EAT(ptr,filename,lv,')');
	return fs_log_append(ts,inode,inode_src);
}
Ejemplo n.º 17
0
uint8_t do_emptytrash(uint64_t lv,uint32_t ts,char *ptr) {
        uint32_t reservedinodes,freeinodes;
        EAT(ptr,lv,'(');
        EAT(ptr,lv,')');
        EAT(ptr,lv,':');
        GETU32(freeinodes,ptr);
        EAT(ptr,lv,',');
        GETU32(reservedinodes,ptr);
        return shadow_fs_emptytrash(ts,freeinodes,reservedinodes);
}
Ejemplo n.º 18
0
uint8_t do_length(uint64_t lv,uint32_t ts,char *ptr) {
        uint32_t inode;
        uint64_t length;
        EAT(ptr,lv,'(');
        GETU32(inode,ptr);
        EAT(ptr,lv,',');
        GETU64(length,ptr);
        EAT(ptr,lv,')');
        return shadow_fs_length(ts,inode,length);
}
Ejemplo n.º 19
0
/*
int do_reinit(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t inode,indx;
	uint64_t chunkid;
	EAT(ptr,filename,lv,'(');
	GETU32(inode,ptr);
	EAT(ptr,filename,lv,',');
	GETU32(indx,ptr);
	EAT(ptr,filename,lv,')');
	EAT(ptr,filename,lv,':');
	GETU64(chunkid,ptr);
	return fs_log_reinit(ts,inode,indx,chunkid);
}
*/
int do_release(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t inode,cuid;
	(void)ts;
	EAT(ptr,filename,lv,'(');
	GETU32(inode,ptr);
	EAT(ptr,filename,lv,',');
	GETU32(cuid,ptr);
	EAT(ptr,filename,lv,')');
	return fs_log_release(inode,cuid);
}
Ejemplo n.º 20
0
int do_length(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t inode;
	uint64_t length;
	EAT(ptr,filename,lv,'(');
	GETU32(inode,ptr);
	EAT(ptr,filename,lv,',');
	GETU64(length,ptr);
	EAT(ptr,filename,lv,')');
	return fs_log_length(ts,inode,length);
}
Ejemplo n.º 21
0
uint8_t do_release(uint64_t lv,uint32_t ts,char *ptr) {
        uint32_t inode,cuid;
        (void)ts;
        EAT(ptr,lv,'(');
        GETU32(inode,ptr);
        EAT(ptr,lv,',');
        GETU32(cuid,ptr);
        EAT(ptr,lv,')');
        return shadow_fs_release(inode,cuid);
}
Ejemplo n.º 22
0
int do_emptytrash(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t reservedinodes,freeinodes;
	EAT(ptr,filename,lv,'(');
	EAT(ptr,filename,lv,')');
	EAT(ptr,filename,lv,':');
	GETU32(freeinodes,ptr);
	EAT(ptr,filename,lv,',');
	GETU32(reservedinodes,ptr);
	return fs_log_emptytrash(ts,freeinodes,reservedinodes);
}
Ejemplo n.º 23
0
uint8_t do_aquire(uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t inode,cuid;
	(void)ts;
	EAT(ptr,lv,'(');
	GETU32(inode,ptr);
	EAT(ptr,lv,',');
	GETU32(cuid,ptr);
	EAT(ptr,lv,')');
	return fs_aquire(inode,cuid);
}
Ejemplo n.º 24
0
int do_setgoal(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
#if VERSHEX>=0x010700
	uint32_t inode,uid,ci,nci,npi,qei;
#else
	uint32_t inode,uid,ci,nci,npi;
#endif
	uint8_t goal,smode;
	EAT(ptr,filename,lv,'(');
	GETU32(inode,ptr);
	EAT(ptr,filename,lv,',');
	GETU32(uid,ptr);
	EAT(ptr,filename,lv,',');
	GETU32(goal,ptr);
	EAT(ptr,filename,lv,',');
	GETU32(smode,ptr);
	EAT(ptr,filename,lv,')');
	EAT(ptr,filename,lv,':');
	GETU32(ci,ptr);
	EAT(ptr,filename,lv,',');
	GETU32(nci,ptr);
	EAT(ptr,filename,lv,',');
	GETU32(npi,ptr);
#if VERSHEX>=0x010700
	if (*ptr==',') {
		EAT(ptr,filename,lv,',');
		GETU32(qei,ptr);
	} else {
		qei = UINT32_C(0xFFFFFFFF);
	}
	return fs_log_setgoal(ts,inode,uid,goal,smode,ci,nci,npi,qei);
#else
	return fs_log_setgoal(ts,inode,uid,goal,smode,ci,nci,npi);
#endif
}
Ejemplo n.º 25
0
int do_trunc(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t inode,indx;
	uint64_t chunkid;
	EAT(ptr,filename,lv,'(');
	GETU32(inode,ptr);
	EAT(ptr,filename,lv,',');
	GETU32(indx,ptr);
	EAT(ptr,filename,lv,')');
	EAT(ptr,filename,lv,':');
	GETU64(chunkid,ptr);
	return fs_log_trunc(ts,inode,indx,chunkid);
}
Ejemplo n.º 26
0
int do_unlink(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t inode,parent;
	uint8_t name[256];
	EAT(ptr,filename,lv,'(');
	GETU32(parent,ptr);
	EAT(ptr,filename,lv,',');
	GETNAME(name,ptr,filename,lv,')');
	EAT(ptr,filename,lv,')');
	EAT(ptr,filename,lv,':');
	GETU32(inode,ptr);
	return fs_log_unlink(ts,parent,strlen((char*)name),name,inode);
}
Ejemplo n.º 27
0
int do_setpath(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t inode;
	static uint8_t *path = NULL;
	static uint32_t pathsize = 0;
	(void)ts;
	EAT(ptr,filename,lv,'(');
	GETU32(inode,ptr);
	EAT(ptr,filename,lv,',');
	GETPATH(path,pathsize,ptr,filename,lv,')');
	EAT(ptr,filename,lv,')');
	return fs_log_setpath(inode,path);
}
Ejemplo n.º 28
0
int do_repair(const char *filename,uint64_t lv,uint32_t ts,char *ptr) {
	uint32_t inode,indx;
	uint32_t version;
	EAT(ptr,filename,lv,'(');
	GETU32(inode,ptr);
	EAT(ptr,filename,lv,',');
	GETU32(indx,ptr);
	EAT(ptr,filename,lv,')');
	EAT(ptr,filename,lv,':');
	GETU32(version,ptr);
	return fs_log_repair(ts,inode,indx,version);
}
Ejemplo n.º 29
0
uint8_t do_trunc(uint64_t lv,uint32_t ts,char *ptr) {
        uint32_t inode,indx;
        uint64_t chunkid;
        EAT(ptr,lv,'(');
        GETU32(inode,ptr);
        EAT(ptr,lv,',');
        GETU32(indx,ptr);
        EAT(ptr,lv,')');
        EAT(ptr,lv,':');
        GETU64(chunkid,ptr);
        return shadow_fs_trunc(ts,inode,indx,chunkid);
}
Ejemplo n.º 30
0
uint8_t do_unlink(uint64_t lv,uint32_t ts,char *ptr) {
        uint32_t inode,parent;
        uint8_t name[256];
        EAT(ptr,lv,'(');
        GETU32(parent,ptr);
        EAT(ptr,lv,',');
        GETNAME(name,ptr,lv,')');
        EAT(ptr,lv,')');
        EAT(ptr,lv,':');
        GETU32(inode,ptr);
        return shadow_fs_unlink(ts,parent,strlen((char*)name),name,inode);
}