void print_pix_info(int nRun , int module , int row , int col , TString f_str = ""){ ostringstream cfg_str(""); cfg_str << "Run_" << nRun << "/config"; CFG cfg(cfg_str.str()); //cfg.print(); int fed; TString dir; get_module_info(module , fed , dir); cout << "Module " << module << " is in FED " << fed << " and dir " << dir << endl; TFile* f ; if(f_str == "") f = TFile::Open("rfio://"+cfg.storedir+"/GainCalibration.root","READ"); else f = TFile::Open(f_str,"READ"); assert(f); ostringstream full_dir(""); full_dir << "/DQMData/Run " << nRun << "/Pixel/Run summary/" << dir; PIX<TH2F*> h; h.getFromDir(f , full_dir.str().c_str()); PIX<double> pix; pix.fill(h , col+1 , row+1); pix.print(); f->Close(); }
/* The guts of "find_loader" and "find_module". Return values: -1: error 0: no loader or namespace portions found 1: module/package found 2: namespace portion found: *namespace_portion will point to the name */ static find_loader_result find_loader(ZipImporter *self, PyObject *fullname, PyObject **namespace_portion) { enum zi_module_info mi; *namespace_portion = NULL; mi = get_module_info(self, fullname); if (mi == MI_ERROR) return FL_ERROR; if (mi == MI_NOT_FOUND) { /* Not a module or regular package. See if this is a directory, and therefore possibly a portion of a namespace package. */ int is_dir = check_is_directory(self, self->prefix, fullname); if (is_dir < 0) return -1; if (is_dir) { /* This is possibly a portion of a namespace package. Return the string representing its path, without a trailing separator. */ *namespace_portion = PyUnicode_FromFormat("%U%c%U%U", self->archive, SEP, self->prefix, fullname); if (*namespace_portion == NULL) return FL_ERROR; return FL_NS_FOUND; } return FL_NOT_FOUND; } /* This is a module or package. */ return FL_MODULE_FOUND; }
void module_tracker::load(const void *in_image_address) { mt::lock_guard<mt::mutex> l(_mtx); mapped_module_ex::instance_id_t id = _next_instance_id++; shared_ptr<mapped_module_ex> m(new mapped_module_ex(id, get_module_info(in_image_address))); _modules_registry.insert(make_pair(id, m)); _lqueue.push_back(id); }
static PyObject * zipimporter_get_source(PyObject *obj, PyObject *args) { ZipImporter *self = (ZipImporter *)obj; PyObject *toc_entry; PyObject *fullname, *subname, *path, *fullpath; enum zi_module_info mi; if (!PyArg_ParseTuple(args, "U:zipimporter.get_source", &fullname)) return NULL; mi = get_module_info(self, fullname); if (mi == MI_ERROR) return NULL; if (mi == MI_NOT_FOUND) { PyErr_Format(ZipImportError, "can't find module %R", fullname); return NULL; } subname = get_subname(fullname); if (subname == NULL) return NULL; path = make_filename(self->prefix, subname); Py_DECREF(subname); if (path == NULL) return NULL; if (mi == MI_PACKAGE) fullpath = PyUnicode_FromFormat("%U%c__init__.py", path, SEP); else fullpath = PyUnicode_FromFormat("%U.py", path); Py_DECREF(path); if (fullpath == NULL) return NULL; toc_entry = PyDict_GetItem(self->files, fullpath); Py_DECREF(fullpath); if (toc_entry != NULL) { PyObject *res, *bytes; bytes = get_data(self->archive, toc_entry); if (bytes == NULL) return NULL; res = PyUnicode_FromStringAndSize(PyBytes_AS_STRING(bytes), PyBytes_GET_SIZE(bytes)); Py_DECREF(bytes); return res; } /* we have the module, but no source */ Py_INCREF(Py_None); return Py_None; }
void module_tracker::unload(const void *in_image_address) { mt::lock_guard<mt::mutex> l(_mtx); const byte *base = get_module_info(in_image_address).base; for (modules_registry_t::iterator i = _modules_registry.begin(); i != _modules_registry.end(); ++i) if (base == i->second->base) { _uqueue.push_back(i->first); break; } }
int dcc_ncpus(int *ncpus) { short int code; module_info mi; char_varying(66) module_name; strcpy_vstr_nstr (&module_name, ""); mi.version = MODULE_INFO_VERSION_1; s$get_module_info ((char_varying *)&module_name, (void *)&mi, &code); if (code != 0) *ncpus = 1; /* safe guess... */ else *ncpus = mi.n_user_cpus; return 0; }
static PyObject * zipimport_zipimporter_get_source_impl(ZipImporter *self, PyObject *fullname) /*[clinic end generated code: output=bc059301b0c33729 input=4e4b186f2e690716]*/ { PyObject *toc_entry; PyObject *subname, *path, *fullpath; enum zi_module_info mi; mi = get_module_info(self, fullname); if (mi == MI_ERROR) return NULL; if (mi == MI_NOT_FOUND) { PyErr_Format(ZipImportError, "can't find module %R", fullname); return NULL; } subname = get_subname(fullname); if (subname == NULL) return NULL; path = make_filename(self->prefix, subname); Py_DECREF(subname); if (path == NULL) return NULL; if (mi == MI_PACKAGE) fullpath = PyUnicode_FromFormat("%U%c__init__.py", path, SEP); else fullpath = PyUnicode_FromFormat("%U.py", path); Py_DECREF(path); if (fullpath == NULL) return NULL; toc_entry = PyDict_GetItem(self->files, fullpath); Py_DECREF(fullpath); if (toc_entry != NULL) { PyObject *res, *bytes; bytes = get_data(self->archive, toc_entry); if (bytes == NULL) return NULL; res = PyUnicode_FromStringAndSize(PyBytes_AS_STRING(bytes), PyBytes_GET_SIZE(bytes)); Py_DECREF(bytes); return res; } /* we have the module, but no source */ Py_RETURN_NONE; }
static PyObject * zipimport_zipimporter_is_package_impl(ZipImporter *self, PyObject *fullname) /*[clinic end generated code: output=c32958c2a5216ae6 input=a7ba752f64345062]*/ { enum zi_module_info mi; mi = get_module_info(self, fullname); if (mi == MI_ERROR) return NULL; if (mi == MI_NOT_FOUND) { PyErr_Format(ZipImportError, "can't find module %R", fullname); return NULL; } return PyBool_FromLong(mi == MI_PACKAGE); }
/* The guts of "find_loader" and "find_module". */ static find_loader_result find_loader(ZipImporter *self, PyObject *fullname, PyObject **namespace_portion) { enum zi_module_info mi; *namespace_portion = NULL; mi = get_module_info(self, fullname); if (mi == MI_ERROR) return FL_ERROR; if (mi == MI_NOT_FOUND) { /* Not a module or regular package. See if this is a directory, and therefore possibly a portion of a namespace package. */ find_loader_result result = FL_NOT_FOUND; PyObject *subname; int is_dir; /* We're only interested in the last path component of fullname; earlier components are recorded in self->prefix. */ subname = get_subname(fullname); if (subname == NULL) { return FL_ERROR; } is_dir = check_is_directory(self, self->prefix, subname); if (is_dir < 0) result = FL_ERROR; else if (is_dir) { /* This is possibly a portion of a namespace package. Return the string representing its path, without a trailing separator. */ *namespace_portion = PyUnicode_FromFormat("%U%c%U%U", self->archive, SEP, self->prefix, subname); if (*namespace_portion == NULL) result = FL_ERROR; else result = FL_NS_FOUND; } Py_DECREF(subname); return result; } /* This is a module or package. */ return FL_MODULE_FOUND; }
void module_info(int nRun , int module){ ostringstream cfg_str(""); cfg_str << "Run_" << nRun << "/config"; CFG cfg(cfg_str.str()); cfg.print(); int FED ; TString dir; get_module_info(module , FED , dir); cout << "Looking at module " << module << " in FED " << FED << " and dir " << dir << endl; TFile* f = TFile::Open("rfio://"+cfg.storedir+"/GainCalibration.root","READ"); assert(f); ostringstream full_dir(""); full_dir << "/DQMData/Run " << nRun << "/Pixel/Run summary/" << dir; //TDirectory* ddir = f->GetDirectory(full_dir.str().c_str()); //assert(ddir); ostringstream h_str(""); h_str << full_dir.str() << "/Gain2d_siPixelCalibDigis_" << module; cout << h_str.str() << endl; TH2F* h_gain = (TH2F*) f->Get(h_str.str().c_str()); assert(h_gain); h_str.str("") ; h_str << full_dir.str() << "/Pedestal2d_siPixelCalibDigis_" << module; TH2F* h_pedestal = (TH2F*) f->Get(h_str.str().c_str()); assert(h_pedestal); h_str.str("") ; h_str << full_dir.str() << "/GainFitResult2d_siPixelCalibDigis_" << module; TH2F* h_fitresult = (TH2F*) f->Get(h_str.str().c_str()); assert(h_fitresult); h_gain->Draw("colz"); gPad->WaitPrimitive(); h_pedestal->Draw("colz"); gPad->WaitPrimitive(); h_fitresult->Draw("colz"); gPad->WaitPrimitive(); }
/* Return a bool signifying whether the module is a package or not. */ static PyObject * zipimporter_is_package(PyObject *obj, PyObject *args) { ZipImporter *self = (ZipImporter *)obj; PyObject *fullname; enum zi_module_info mi; if (!PyArg_ParseTuple(args, "U:zipimporter.is_package", &fullname)) return NULL; mi = get_module_info(self, fullname); if (mi == MI_ERROR) return NULL; if (mi == MI_NOT_FOUND) { PyErr_Format(ZipImportError, "can't find module %R", fullname); return NULL; } return PyBool_FromLong(mi == MI_PACKAGE); }
static PyObject * zipimporter_get_source(PyObject *obj, PyObject *args) { ZipImporter *self = (ZipImporter *)obj; PyObject *toc_entry; char *fullname, *subname, path[MAXPATHLEN+1]; int len; enum zi_module_info mi; if (!PyArg_ParseTuple(args, "s:zipimporter.get_source", &fullname)) return NULL; mi = get_module_info(self, fullname); if (mi == MI_ERROR) return NULL; if (mi == MI_NOT_FOUND) { PyErr_Format(ZipImportError, "can't find module '%.200s'", fullname); return NULL; } subname = get_subname(fullname); len = make_filename(PyString_AsString(self->prefix), subname, path); if (len < 0) return NULL; if (mi == MI_PACKAGE) { path[len] = SEP; strcpy(path + len + 1, "__init__.py"); } else strcpy(path + len, ".py"); toc_entry = PyDict_GetItemString(self->files, path); if (toc_entry != NULL) return get_data(PyString_AsString(self->archive), toc_entry); /* we have the module, but no source */ Py_INCREF(Py_None); return Py_None; }
/* Check whether we can satisfy the import of the module named by 'fullname'. Return self if we can, None if we can't. */ static PyObject * zipimporter_find_module(PyObject *obj, PyObject *args) { ZipImporter *self = (ZipImporter *)obj; PyObject *path = NULL; char *fullname; enum zi_module_info mi; if (!PyArg_ParseTuple(args, "s|O:zipimporter.find_module", &fullname, &path)) return NULL; mi = get_module_info(self, fullname); if (mi == MI_ERROR) return NULL; if (mi == MI_NOT_FOUND) { Py_INCREF(Py_None); return Py_None; } Py_INCREF(self); return (PyObject *)self; }
void print_module_info(int module){ int fed; TString dir; get_module_info(module , fed , dir); cout << "Module " << module << " is in FED " << fed << " and dir " << dir << endl; }
static long ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct iscsi_target *target = NULL; long err; u32 id; err = down_interruptible(&ioctl_sem); if (err < 0) return err; if (cmd == GET_MODULE_INFO) { err = get_module_info(arg); goto done; } if (cmd == ADD_TARGET) { err = add_target(arg); goto done; } err = get_user(id, (u32 *) arg); if (err < 0) goto done; /* locking handled in target_del */ if (cmd == DEL_TARGET) { err = target_del(id); goto done; } target = target_lookup_by_id(id); if (!target) { err = -ENOENT; goto done; } err = target_lock(target, 1); if (err < 0) goto done; switch (cmd) { case ADD_VOLUME: err = add_volume(target, arg); break; case DEL_VOLUME: err = del_volume(target, arg); break; case ADD_SESSION: err = add_session(target, arg); break; case DEL_SESSION: err = del_session(target, arg); break; case GET_SESSION_INFO: err = get_session_info(target, arg); break; case ISCSI_PARAM_SET: err = iscsi_param_config(target, arg, 1); break; case ISCSI_PARAM_GET: err = iscsi_param_config(target, arg, 0); break; case ADD_CONN: err = add_conn(target, arg); break; case DEL_CONN: err = del_conn(target, arg); break; case GET_CONN_INFO: err = get_conn_info(target, arg); break; default: eprintk("invalid ioctl cmd %x\n", cmd); err = -EINVAL; } target_unlock(target); done: up(&ioctl_sem); return err; }
int iet_ioctl(struct cdev *dev, unsigned long cmd, caddr_t iarg, int fflag, struct thread *td) #endif { struct iscsi_target *target = NULL; long err; u32 id; #ifdef FREEBSD unsigned long arg = (unsigned long)(iarg); /* Avoid make warnings */ #endif err = mutex_lock_interruptible(&ioctl_mutex); if (err != 0) return err; if (cmd == GET_MODULE_INFO) { err = get_module_info(arg); goto done; } if (cmd == ADD_TARGET) { err = add_target(arg); goto done; } err = copy_from_user(&id, (u32 *) (unsigned long)arg, sizeof(u32)); if (err < 0) goto done; /* locking handled in target_del */ if (cmd == DEL_TARGET) { err = target_del(id); goto done; } target = target_lookup_by_id(id); if (!target) { err = -ENOENT; goto done; } err = target_lock(target, 1); if (err < 0) goto done; switch (cmd) { case ADD_VOLUME: err = add_volume(target, arg); break; case DEL_VOLUME: err = del_volume(target, arg); break; case ADD_SESSION: err = add_session(target, arg); break; case DEL_SESSION: err = del_session(target, arg); break; case GET_SESSION_INFO: err = get_session_info(target, arg); break; case ISCSI_PARAM_SET: err = iscsi_param_config(target, arg, 1); break; case ISCSI_PARAM_GET: err = iscsi_param_config(target, arg, 0); break; case ADD_CONN: err = add_conn(target, arg); break; case DEL_CONN: err = del_conn(target, arg); break; case GET_CONN_INFO: err = get_conn_info(target, arg); break; default: eprintk("invalid ioctl cmd %lx\n", (unsigned long)cmd); err = -EINVAL; } target_unlock(target); done: mutex_unlock(&ioctl_mutex); #ifdef FREEBSD if (err < 0) err = -(err); #endif return err; }