xmlnode * _h_elim_image ( const char *name , const char *id , SEXP_VALUE *args , gpointer data ) { ASSERT_ALISTP( args, id, name ); xmlnode *rval = xnode_new( "alist" ); int image_id = (int)ALIST_VAL_INT( args, "image-id" ); if( image_id <= 0 ) { sexp_val_free( args ); return response_error( EINVAL, id, name, "bad image ID" ); } fprintf( stderr, "searching for image id %d\n", image_id ); PurpleStoredImage *image = purple_imgstore_find_by_id( image_id ); if( !image ) { sexp_val_free( args ); return response_error( ENOENT, id, name, "image ID not found" ); } size_t size = IGET( image , size ); AL_INT ( rval, "image-id" , image_id ); AL_INT ( rval, "image-size", size ); AL_STR ( rval, "image-file", IGET( image, filename ) ); AL_STR ( rval, "image-type", IGET( image, extension ) ); AL_DATA( rval, "image-data", IGET( image, data ) , size ); sexp_val_free( args ); return response_value( 0, id, name, rval ); }
/* ** sst1InitDacDetect(): ** Detect type of on-board DAC ** NOTE: sst1InitDacDetect() resets the PCI fifo and the graphics subsystem ** of FBI ** */ FX_EXPORT FxBool FX_CSTYLE sst1InitDacDetect(FxU32 * sstbase) { FxU32 n; FxU32 fbiInit1_save; FxU32 fbiInit2_save; volatile Sstregs *sst = (Sstregs *) sstbase; FxBool retVal = FXFALSE; int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0; if(!sst) return(FXFALSE); if(helper) INIT_PRINTF(("sst1InitDacDetect(): Entered...\n")); sst1InitIdleFBINoNOP(sstbase); /* Save init register states before overwriting them */ fbiInit1_save = IGET(sst->fbiInit1); fbiInit2_save = IGET(sst->fbiInit2); /* Reset video unit to guarantee no contentions on the memory bus */ ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET); /* Turn off dram refresh to guarantee no contentions on the memory bus */ ISET(sst->fbiInit2, IGET(sst->fbiInit2) & ~SST_EN_DRAM_REFRESH); sst1InitIdleFBINoNOP(sstbase); /* Enable reads from the DAC (multiplexed on the fbiInit2 address) */ /* Disallow writes to pass through the PCI FIFO */ PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_FBIINIT23_REMAP); sst1InitIdleFBINoNOP(sstbase); if(sst1InitUseVoodooFile == FXTRUE) { retVal = sst1InitDacDetectINI(sstbase); } else { if((retVal = sst1InitDacDetectICS(sstbase)) == FXTRUE) goto done; if((retVal = sst1InitDacDetectATT(sstbase)) == FXTRUE) goto done; retVal = sst1InitDacDetectTI(sstbase); } done: /* Disable fbiinit23 address remapping */ PCICFG_WR(SST1_PCI_INIT_ENABLE, SST_INITWR_EN | SST_PCI_FIFOWR_EN); /* Restore init register states */ sst1InitIdleFBINoNOP(sstbase); ISET(sst->fbiInit1, fbiInit1_save); ISET(sst->fbiInit2, fbiInit2_save); sst1InitIdleFBINoNOP(sstbase); return(retVal); }
/* ** sst1InitDacRd(): ** Read external DAC registers ** NOTE: The video unit of FBI must be in reset before calling this routine. ** The rendering engines of FBI and TREX must be idle before calling ** this routine. ** fbiInit23 register remapping (PCI config. initEnable[2]=1) must be ** enabled before calling this routine ** ** Valid addresses are 0 <= addr <= 3 ** */ FX_EXPORT FxU32 FX_CSTYLE sst1InitDacRd(FxU32 *sstbase, FxU32 addr) { volatile Sstregs *sst = (Sstregs *) sstbase; FxU32 retVal; static FxBool firstPass = FXTRUE; static int helper; if(firstPass == FXTRUE) { firstPass = FXFALSE; helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0; } ISET(sst->dacData, ((addr) << SST_DACDATA_ADDR_SHIFT) | SST_DACDATA_RD); sst1InitIdleFBINoNOP(sstbase); retVal = IGET(sst->fbiInit2) & SST_DACDATA_DATA; if(helper) INIT_PRINTF(("dacRd(0x%x,0x%x)\n", addr, retVal)); return(retVal); }
/* sb we pass is unionfs's super_block */ int unionfs_interpose(struct dentry *dentry, struct super_block *sb, int flag) { struct inode *hidden_inode; struct dentry *hidden_dentry; int err = 0; struct inode *inode; int is_negative_dentry = 1; int bindex, bstart, bend; print_entry("flag = %d", flag); verify_locked(dentry); fist_print_dentry("In unionfs_interpose", dentry); bstart = dbstart(dentry); bend = dbend(dentry); /* Make sure that we didn't get a negative dentry. */ for (bindex = bstart; bindex <= bend; bindex++) { if (dtohd_index(dentry, bindex) && dtohd_index(dentry, bindex)->d_inode) { is_negative_dentry = 0; break; } } BUG_ON(is_negative_dentry); /* We allocate our new inode below, by calling iget. * iget will call our read_inode which will initialize some * of the new inode's fields */ /* On revalidate we've already got our own inode and just need * to fix it up. */ if (flag == INTERPOSE_REVAL) { inode = dentry->d_inode; itopd(inode)->b_start = -1; itopd(inode)->b_end = -1; atomic_set(&itopd(inode)->uii_generation, atomic_read(&stopd(sb)->usi_generation)); itohi_ptr(inode) = KZALLOC(sbmax(sb) * sizeof(struct inode *), GFP_KERNEL); if (!itohi_ptr(inode)) { err = -ENOMEM; goto out; } } else { ino_t ino; /* get unique inode number for unionfs */ #ifdef UNIONFS_IMAP if (stopd(sb)->usi_persistent) { err = read_uin(sb, bindex, dtohd_index(dentry, bindex)->d_inode->i_ino, O_CREAT, &ino); if (err) goto out; } else #endif ino = iunique(sb, UNIONFS_ROOT_INO); inode = IGET(sb, ino); if (!inode) { err = -EACCES; /* should be impossible??? */ goto out; } } down(&inode->i_sem); if (atomic_read(&inode->i_count) > 1) goto skip; for (bindex = bstart; bindex <= bend; bindex++) { hidden_dentry = dtohd_index(dentry, bindex); if (!hidden_dentry) { set_itohi_index(inode, bindex, NULL); continue; } /* Initialize the hidden inode to the new hidden inode. */ if (!hidden_dentry->d_inode) continue; set_itohi_index(inode, bindex, IGRAB(hidden_dentry->d_inode)); } ibstart(inode) = dbstart(dentry); ibend(inode) = dbend(dentry); /* Use attributes from the first branch. */ hidden_inode = itohi(inode); /* Use different set of inode ops for symlinks & directories */ if (S_ISLNK(hidden_inode->i_mode)) inode->i_op = &unionfs_symlink_iops; else if (S_ISDIR(hidden_inode->i_mode)) inode->i_op = &unionfs_dir_iops; /* Use different set of file ops for directories */ if (S_ISDIR(hidden_inode->i_mode)) inode->i_fop = &unionfs_dir_fops; /* properly initialize special inodes */ if (S_ISBLK(hidden_inode->i_mode) || S_ISCHR(hidden_inode->i_mode) || S_ISFIFO(hidden_inode->i_mode) || S_ISSOCK(hidden_inode->i_mode)) init_special_inode(inode, hidden_inode->i_mode, hidden_inode->i_rdev); /* Fix our inode's address operations to that of the lower inode (Unionfs is FiST-Lite) */ if (inode->i_mapping->a_ops != hidden_inode->i_mapping->a_ops) { fist_dprint(7, "fixing inode 0x%p a_ops (0x%p -> 0x%p)\n", inode, inode->i_mapping->a_ops, hidden_inode->i_mapping->a_ops); inode->i_mapping->a_ops = hidden_inode->i_mapping->a_ops; } /* all well, copy inode attributes */ fist_copy_attr_all(inode, hidden_inode); skip: /* only (our) lookup wants to do a d_add */ switch (flag) { case INTERPOSE_DEFAULT: case INTERPOSE_REVAL_NEG: d_instantiate(dentry, inode); break; case INTERPOSE_LOOKUP: err = PTR_ERR(d_splice_alias(inode, dentry)); break; case INTERPOSE_REVAL: /* Do nothing. */ break; default: printk(KERN_ERR "Invalid interpose flag passed!"); BUG(); } fist_print_dentry("Leaving unionfs_interpose", dentry); fist_print_inode("Leaving unionfs_interpose", inode); up(&inode->i_sem); out: print_exit_status(err); return err; }