Example #1
0
void
vld_free (volume_handle *vol)
{
    if (--vol->ref == 0) {
	VOLOP_FREE(vol);
	if (vol->flags.voldbp) {
	    voldb_close (VLD_VOLH_DIR(vol));
	    voldb_close (VLD_VOLH_FILE(vol));
	    vol->flags.voldbp = FALSE;
	} else {
	    assert (VLD_VOLH_DIR(vol) == NULL);
	    assert (VLD_VOLH_FILE(vol) == NULL);
	}
	dp_free (vol->dp);
	free (vol);
    }    
}
Example #2
0
int
VOLSER_AFSVolSetDate(struct rx_call *call,
		     const int32_t transid,
		     const int32_t newDate)
{
    int ret = 0;
    struct trans *trans;
    struct dp_part *dp;
    volume_handle *vh;

    mlog_log(MDEBVOLDB, "VOLSER_AFSVolSetDate");

    if (!sec_is_superuser(call)) {
	ret = VOLSERBAD_ACCESS;
	goto out;
    }

    ret = vld_verify_trans(transid);
    if (ret)
	goto out;

    ret = vld_get_trans(transid, &trans);
    if (ret)
	goto out;
    
    ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh);
    if (ret) {
	vld_put_trans(trans);
	goto out;
    }

    vh->info.creationDate = newDate;

    vld_info_write(vh);

    vld_free (vh);
    dp_free (dp);

    vld_put_trans(trans);

 out:
    VOLSER_EXIT;
    
    return ret;
}
Example #3
0
static inline void
nfa_closure_destroy(s_fa_closure_t **closure)
{
    s_fa_closure_t *closure_tmp;

    assert_exit(closure && *closure);

    closure_tmp = *closure;

    bitmap_destroy(&closure_tmp->bitmap);
    array_queue_destroy(&closure_tmp->path_queue);
    array_queue_destroy(&closure_tmp->collection);

    nfa_closure_match_dp_destroy(&closure_tmp->match_dp);
    dp_free(closure_tmp);

    *closure = NULL;
}
Example #4
0
void
trie_tree_string_remove(s_trie_tree_t *trie, char *string)
{
    uint32 len;
    uint32 *sequence;

    if (!trie_tree_structure_legal_ip(trie)) {
        return;
    } else if (!trie_tree_root_node_p(trie)) {
        return;
    } else if (complain_null_string_p(string)) {
        return;
    } else {
        sequence = convert_string_to_uint32_array(string, &len);
        assert_exit(sequence != PTR_INVALID);

        trie_tree_sequence_remove_i(trie, sequence, len);
        dp_free(sequence);
    }
}
Example #5
0
int
VOLSER_AFSVolTransCreate(struct rx_call *call,
			 const int32_t volume,
			 const int32_t partition,
			 const int32_t flags,
			 int32_t *trans)
{
    int ret = 0;
    struct dp_part *dp;
    volume_handle *vh;

    mlog_log(MDEBVOLDB, "VOLSER_AFSVolTransCreate");

    if (!sec_is_superuser(call)) {
	ret = VOLSERBAD_ACCESS;
	goto out;
    }

    ret = volser_fetch_vh (partition, volume, &dp, &vh);
    if (ret)
	goto out;

    vld_free (vh);
    dp_free (dp);

    ret = vld_create_trans(partition, volume, trans);
    if (ret)
	goto out;

    ret = vld_trans_set_iflags(*trans, flags);
    if (ret) {
	vld_end_trans (*trans, NULL);
	goto out;
    }

 out:
    VOLSER_EXIT;
    
    return ret;
}
Example #6
0
int
vld_init (void)
{
    struct dp_part *dp;
    int ret, partnum, i;
    

    db_lru = listnew();
    if (db_lru == NULL)
	errx (1, "vld_init: db_lru == NULL");

    for (i = 0; i < 100 /* XXX */ ; i++)
	listaddhead (db_lru, NULL);

    vol_list = listnew();
    if (vol_list == NULL)
	errx (1, "vld_init: vol_list == NULL");

    volume_htab = hashtabnew(volume_htab_sz, volume_cmp, volume_hash);
    if (volume_htab == NULL)
	errx (1, "vld_init: volume_htab == NULL");

    for (partnum = 0; partnum < 'z'-'a'; partnum++) {

	ret = dp_create (partnum , &dp);
	if (ret) {
	    warnx ("vld_init: dp_create(%d) returned %d", partnum, ret);
	    continue;
	}
	
	ret = dp_findvol (dp, register_vols_cb, dp);
	if (ret)
	    warnx ("vld_init: dp_findvol returned: %d", ret);

	dp_free (dp);
    }	
    return 0;
}
Example #7
0
int
VOLSER_AFSVolSetInfo(struct rx_call *call,
		     const int32_t transid,
		     const struct volintInfo *volinfo)
{
    volume_handle *vh;
    int ret = 0;
    struct dp_part *dp;
    struct trans *trans;

    mlog_log(MDEBVOLDB, "VOLSER_AFSVolSetInfo"
	     " trans %d name %s type %d parent %d volid %d backup %d",
	     transid, volinfo->name, volinfo->type, volinfo->parentID,
	     volinfo->volid, volinfo->backupID);

    if (!sec_is_superuser(call)) {
	ret = VOLSERBAD_ACCESS;
	goto out;
    }

    ret = vld_verify_trans(transid);
    if (ret)
	goto out;

    ret = vld_get_trans(transid, &trans);
    if (ret)
	goto out;
    
    ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh);
    if (ret) {
	vld_put_trans(trans);
	goto out;
    }

    if (volinfo->name[0])
	strlcpy(vh->info.name, volinfo->name, VNAMESIZE);

    if (volinfo->volid)
	vh->info.volid = volinfo->volid;
    if (volinfo->type)
	vh->info.type = volinfo->type;
    if (volinfo->backupID)
	vh->info.backupID = volinfo->backupID;
    if (volinfo->parentID)
	vh->info.parentID = volinfo->parentID;
    if (volinfo->cloneID)
	vh->info.cloneID = volinfo->cloneID;
    if (volinfo->status)
	vh->info.status = volinfo->status;
    if (volinfo->copyDate)
	vh->info.copyDate = volinfo->copyDate;
    if (volinfo->inUse)
	vh->info.inUse = volinfo->inUse;
    if (volinfo->creationDate)
	vh->info.creationDate = volinfo->creationDate;
    if (volinfo->backupDate)
	vh->info.backupDate = volinfo->backupDate;
    if (volinfo->dayUse != -1)
	vh->info.dayUse = volinfo->dayUse;
    if (volinfo->filecount)
	vh->info.filecount = volinfo->filecount;
    if (volinfo->maxquota != -1)
	vh->info.maxquota = volinfo->maxquota;
    if (volinfo->size)
	vh->info.size = volinfo->size;

    vld_info_write(vh);

    vld_free (vh);
    dp_free (dp);
    vld_put_trans(trans);

 out:
    VOLSER_EXIT;
    
    return ret;
}