Disp_Obj *open_display(QSP_ARG_DECL const char *name,int desired_depth) { Disp_Obj *dop; static int siz_done=0; dop = new_disp_obj(QSP_ARG name); if( dop == NO_DISP_OBJ ){ sprintf(ERROR_STRING, "Couldn't create object for display %s", name); NWARN(ERROR_STRING); return(NO_DISP_OBJ); } if( dop_open(QSP_ARG dop) < 0 ){ return(NO_DISP_OBJ); } if( dop_setup(QSP_ARG dop,desired_depth) < 0 ){ /* Bug - XCloseDisplay?? */ /* need to destroy object here */ del_disp_obj(QSP_ARG dop); rls_str((char *)dop->do_name); return(NO_DISP_OBJ); } set_display(dop); if( ! siz_done ){ siz_done++; add_sizable(QSP_ARG disp_obj_itp,&dpy_sf, NULL ); } return(dop); }
/* * Called for each open(). * * We reject O_CREAT | O_TRUNC | O_EXCL | O_APPEND */ static int dev_open(struct inode *node, uint32_t open_flags) { if (open_flags & (O_CREAT | O_TRUNC | O_EXCL | O_APPEND)) { return -E_INVAL; } struct device *dev = vop_info(node, device); return dop_open(dev, open_flags); }
/* * Called for each open(). * * We reject O_CREAT | O_TRUNC | O_EXCL | O_APPEND */ static int dev_open(struct inode *node, struct file *filp) { if (filp->open_flags & (O_CREAT | O_TRUNC | O_EXCL | O_APPEND)) { return -E_INVAL; } struct device *dev = vop_info(node, device); return dop_open(dev, node, filp); }
static int yaffs_ucore_device_wrapper_initialise(struct yaffs_dev *dev) { struct device *ucore_dev = (struct device*)dev->os_context; int ret = dop_open(ucore_dev, 0) == 0; return ret; }