/** Get file attributes. * * Similar to stat(). The 'st_dev' and 'st_blksize' fields are * ignored. The 'st_ino' field is ignored except if the 'use_ino' * mount option is given. */ int bb_getattr(const char *path, struct stat *statbuf) { int retstat = 0; char fpath[PATH_MAX]; log_msg("\nbb_getattr(path=\"%s\", statbuf=0x%08x)\n", path, statbuf); bb_fullpath(fpath, path); retstat = lstat(fpath, statbuf); if (retstat != 0) retstat = bb_error("bb_getattr lstat"); log_stat(statbuf); return retstat; }
// Since it's currently only called after bb_create(), and bb_create() // opens the file, I ought to be able to just use the fd and ignore // the path... int bb_fgetattr(const char *path, struct stat *statbuf, struct fuse_file_info *fi) { int retstat = 0; log_msg("\nbb_fgetattr(path=\"%s\", statbuf=0x%08x, fi=0x%08x)\n", path, statbuf, fi); log_fi(fi); retstat = fstat(fi->fh, statbuf); if (retstat < 0) retstat = bb_error("bb_fgetattr fstat"); log_stat(statbuf); return retstat; }
void CallManager::handle_InitiateCallRequest( const simple_voip::ForwardObject * rreq ) { auto * req = dynamic_cast< const simple_voip::InitiateCallRequest *>( rreq ); // private: no mutex lock log_stat(); if( get_num_of_activities() >= cfg_.max_active_calls ) { request_queue_.push_back( req ); dummy_log_debug( log_id_, "insert_job: inserted job %u", req->req_id ); log_stat(); return; } process( req ); }
int bb_fgetattr(const char *path, struct stat *statbuf, struct fuse_file_info *fi) { int retstat = 0; log_msg("\nbb_fgetattr(path=\"%s\", statbuf=0x%08x, fi=0x%08x)\n", path, statbuf, fi); log_fi(fi); return bb_getattr(path, statbuf); log_stat(statbuf); return retstat; }
/** Get file attributes. * * Similar to stat(). The 'st_dev' and 'st_blksize' fields are * ignored. The 'st_ino' field is ignored except if the 'use_ino' * mount option is given. */ int bb_getattr(const char *path, struct stat *statbuf) { int retstat; char fpath[PATH_MAX]; log_msg("\nbb_getattr(path=\"%s\", statbuf=0x%08x)\n", path, statbuf); bb_fullpath(fpath, path); retstat = log_syscall("lstat", lstat(fpath, statbuf), 0); log_stat(statbuf); return retstat; }
/** Get file attributes. * * Similar to stat(). The 'st_dev' and 'st_blksize' fields are * ignored. The 'st_ino' field is ignored except if the 'use_ino' * mount option is given. */ int sfs_getattr(const char *path, struct stat *statbuf) { int retstat = 0; char fpath[PATH_MAX]; log_msg("Testing- in sfs_getattr()\n"); log_msg("\nsfs_getattr(path=\"%s\", statbuf=0x%08x)\n", path, statbuf); retstat=lstat(path,statbuf);//takes care of the symbolic link as well unlike stat() log_stat(statbuf); char *fullpath=realpath(path, NULL); log_msg("Full path is %s\n", fullpath); log_msg("Testing- exiting sfs_getattr()\n"); return retstat; }
void recv_td(sio2_transfer_data_t *td) { int i; #ifndef XSIO2MAN log_default(LOG_TRR); #endif td->stat6c = sio2_stat6c_get(); td->stat70 = sio2_stat70_get(); td->stat74 = sio2_stat74_get(); #ifndef XSIO2MAN log_stat(td->stat6c, td->stat70, td->stat74); #endif if (td->out_size) { for (i = 0; i < td->out_size; i++) td->out[i] = sio2_data_in(); #ifndef XSIO2MAN log_data(LOG_TRR_DATA, td->out, td->out_size); #endif } }
int bb_getattr(const char *path, struct stat *statbuf) { int retstat = 0; log_msg("\nbb_getattr(path=\"%s\", statbuf=0x%08x)\n", path, statbuf); inode_t inode; inumber_t inumber; inumber = get_inode_from_path(path, &inode); log_msg("inumber = %d\n", inumber); if (inumber == 0 || inumber == INODE_COUNT + 1) { return -ENOENT; } if (inode.attr.type == DIR_T) { statbuf->st_mode = S_IFDIR | 0755; } else if (inode.attr.type == FILE_T) { statbuf->st_mode = S_IFREG | 0644; statbuf->st_size = inode.attr.size; } statbuf->st_ino = inode.inumber; statbuf->st_uid = getuid(); statbuf->st_gid = getgid(); statbuf->st_atime = inode.attr.creation_time; statbuf->st_ctime = inode.attr.creation_time; statbuf->st_mtime = inode.attr.creation_time; log_stat(statbuf); return retstat; }
/** * Get attributes from an open file * * This method is called instead of the getattr() method if the * file information is available. * * Currently this is only called after the create() method if that * is implemented (see above). Later it may be called for * invocations of fstat() too. * * Introduced in version 2.5 */ int bb_fgetattr(const char *path, struct stat *statbuf, struct fuse_file_info *fi) { int retstat = 0; log_msg("\nbb_fgetattr(path=\"%s\", statbuf=0x%08x, fi=0x%08x)\n", path, statbuf, fi); log_fi(fi); // On FreeBSD, trying to do anything with the mountpoint ends up // opening it, and then using the FD for an fgetattr. So in the // special case of a path of "/", I need to do a getattr on the // underlying root directory instead of doing the fgetattr(). if (!strcmp(path, "/")) return bb_getattr(path, statbuf); retstat = fstat(fi->fh, statbuf); if (retstat < 0) retstat = log_error("bb_fgetattr fstat"); log_stat(statbuf); return retstat; }
int board_early_init_f (void) { #if defined(CONFIG_W7OLMG) /* * Setup GPIO pins - reset devices. */ out32 (IBM405GP_GPIO0_ODR, 0x10000000); /* one open drain pin */ out32 (IBM405GP_GPIO0_OR, 0x3E000000); /* set output pins to default */ out32 (IBM405GP_GPIO0_TCR, 0x7f800000); /* setup for output */ /* * IRQ 0-15 405GP internally generated; active high; level sensitive * IRQ 16 405GP internally generated; active low; level sensitive * IRQ 17-24 RESERVED * IRQ 25 (EXT IRQ 0) XILINX; active low; level sensitive * IRQ 26 (EXT IRQ 1) PCI INT A; active low; level sensitive * IRQ 27 (EXT IRQ 2) PCI INT B; active low; level sensitive * IRQ 28 (EXT IRQ 3) SAM 2; active low; level sensitive * IRQ 29 (EXT IRQ 4) Battery Bad; active low; level sensitive * IRQ 30 (EXT IRQ 5) Level One PHY; active low; level sensitive * IRQ 31 (EXT IRQ 6) SAM 1; active high; level sensitive */ mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */ mtdcr (uicer, 0x00000000); /* disable all ints */ mtdcr (uiccr, 0x00000000); /* set all to be non-critical */ mtdcr (uicpr, 0xFFFFFF80); /* set int polarities */ mtdcr (uictr, 0x10000000); /* set int trigger levels */ mtdcr (uicvcr, 0x00000001); /* set vect base=0, INT0 highest priority */ mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */ #elif defined(CONFIG_W7OLMC) /* * Setup GPIO pins */ out32 (IBM405GP_GPIO0_ODR, 0x01800000); /* XCV Done Open Drain */ out32 (IBM405GP_GPIO0_OR, 0x03800000); /* set out pins to default */ out32 (IBM405GP_GPIO0_TCR, 0x66C00000); /* setup for output */ /* * IRQ 0-15 405GP internally generated; active high; level sensitive * IRQ 16 405GP internally generated; active low; level sensitive * IRQ 17-24 RESERVED * IRQ 25 (EXT IRQ 0) DBE 0; active low; level sensitive * IRQ 26 (EXT IRQ 1) DBE 1; active low; level sensitive * IRQ 27 (EXT IRQ 2) DBE 2; active low; level sensitive * IRQ 28 (EXT IRQ 3) DBE Common; active low; level sensitive * IRQ 29 (EXT IRQ 4) PCI; active low; level sensitive * IRQ 30 (EXT IRQ 5) RCMM Reset; active low; level sensitive * IRQ 31 (EXT IRQ 6) PHY; active high; level sensitive */ mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */ mtdcr (uicer, 0x00000000); /* disable all ints */ mtdcr (uiccr, 0x00000000); /* set all to be non-critical */ mtdcr (uicpr, 0xFFFFFF80); /* set int polarities */ mtdcr (uictr, 0x10000000); /* set int trigger levels */ mtdcr (uicvcr, 0x00000001); /* set vect base=0, INT0 highest priority */ mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */ #else /* Unknown */ # error "Unknown W7O board configuration" #endif WATCHDOG_RESET (); /* Reset the watchdog */ temp_uart_init (); /* init the uart for debug */ WATCHDOG_RESET (); /* Reset the watchdog */ test_led (); /* test the LEDs */ test_sdram (get_dram_size ()); /* test the dram */ log_stat (ERR_POST1); /* log status,post1 complete */ return 0; }
/** Get file attributes. * * Similar to stat(). The 'st_dev' and 'st_blksize' fields are * ignored. The 'st_ino' field is ignored except if the 'use_ino' * mount option is given. * * DFZ: This is the first function to be called whenever the user tries to * get access to any file, even if only to its meta data. Two cases: * 1) if the file exists, i.e. it's stored in ZHT, then this file is * transfered to the local node first and 'lstat' the local copy * 2) if the file doesn't exist, FUSE will pass the control to * _create() */ int fusion_getattr(const char *path, struct stat *statbuf) { int retstat = 0; char fpath[PATH_MAX] = {0}; log_msg("\nfusion_getattr(path=\"%s\", statbuf=0x%08x)\n", path, statbuf); fusion_fullpath(fpath, path); char res[ZHT_MAX_BUFF] = {0}; int status = zht_lookup(path, res); char myaddr[PATH_MAX] = {0}; net_getmyip(myaddr); bool is_transfer = false; log_msg("\n ===========CSHOU debug: _getattr() the local IP got: %s \n\n", myaddr); if (ZHT_LOOKUP_FAIL == status) { /* if not found in ZHT */ log_msg("\n ===========DFZ debug: _getattr() %s does not exist \n\n", path); /*if path is an existing directory*/ char dirname[PATH_MAX] = {0}; strcpy(dirname, path); strcat(dirname, "/"); log_msg("\n ===========DFZ debug: _getattr() dirname = %s. \n\n", dirname); char res[ZHT_MAX_BUFF] = {0}; int stat = zht_lookup(dirname, res); if (ZHT_LOOKUP_FAIL != stat) { log_msg("\n ===========DFZ debug: _getattr() res = %s. \n\n", res); mkdir(fpath, 0755); char cmd_mkdir[PATH_MAX] = {0}; strcpy(cmd_mkdir, "mkdir -p "); strcat(cmd_mkdir, fpath); system(cmd_mkdir); log_msg("\n ===========DFZ debug: _getattr() new directory %s/ created \n\n", fpath); } } else { /* if file exists in ZHT */ log_msg("\n ===========DFZ debug: _getattr() zht_lookup() = %s. \n\n", res); if (access(fpath, F_OK)) { /*if it isn't on this node, copy it over*/ ffs_recvfile_c("udt", res, "9000", fpath, fpath); // ADDED BY CSHOU //if (strcmp(res, myaddr) != 0 && strcmp(res, "") != 0) //if (strcmp(res, myaddr) != 0 && res && strlen(res) != 0) //is_transfer = true; //spade_receivefile(fpath, res, fpath, statbuf->st_size, statbuf->st_mtime); log_msg("\n ===========DFZ debug: _getattr() %s transferred from %s. \n\n", fpath, res); } else if (strcmp("/", path) /*even it's in local node, it could be outdated.*/ && strcmp(res, myaddr)) { ffs_recvfile_c("udt", res, "9000", fpath, fpath); // ADDED BY CSHOU //if (strcmp(res, myaddr) != 0 && res && strlen(res) != 0) //is_transfer = true; //spade_receivefile(fpath, res, fpath, statbuf->st_size, statbuf->st_mtime); log_msg("\n ===========DFZ debug: _getattr() %s transferred from %s because local copy might be outdated. \n\n", fpath, res); } else { /* let it be */ log_msg("\n ===========DFZ debug: _getattr() %s exists in local. \n\n", fpath); } } retstat = lstat(fpath, statbuf); if (retstat != 0) retstat = fusion_error("fusion_getattr lstat"); log_stat(statbuf); /* if (is_transfer) { char s_size[20]; sprintf(s_size, "%zd", statbuf->st_size); spade_receivefile(fpath, res, fpath, s_size, ctime(&statbuf->st_mtime)); }*/ return retstat; }
static VALUE bdb_env_log_stat(int argc, VALUE *argv, VALUE obj) { DB_LOG_STAT *bdb_stat; bdb_ENV *envst; VALUE res, b; int flags; GetEnvDB(obj, envst); #if HAVE_ST_DB_ENV_LG_INFO if (!envst->envp->lg_info) { rb_raise(bdb_eFatal, "log region not open"); } if (argc != 0) { rb_raise(rb_eArgError, "invalid number of arguments (%d for 0)", argc); } bdb_test_error(log_stat(envst->envp->lg_info, &bdb_stat, 0)); #elif HAVE_ST_DB_ENV_LOG_STAT flags = 0; if (rb_scan_args(argc, argv, "01", &b) == 1) { flags = NUM2INT(b); } bdb_test_error(envst->envp->log_stat(envst->envp, &bdb_stat, flags)); #else if (argc != 0) { rb_raise(rb_eArgError, "invalid number of arguments (%d for 0)", argc); } #if HAVE_DB_LOG_STAT_3 bdb_test_error(log_stat(envst->envp, &bdb_stat, 0)); #else bdb_test_error(log_stat(envst->envp, &bdb_stat)); #endif #endif res = rb_hash_new(); rb_hash_aset(res, rb_tainted_str_new2("st_magic"), INT2NUM(bdb_stat->st_magic)); rb_hash_aset(res, rb_tainted_str_new2("st_version"), INT2NUM(bdb_stat->st_version)); rb_hash_aset(res, rb_tainted_str_new2("st_regsize"), INT2NUM(bdb_stat->st_regsize)); rb_hash_aset(res, rb_tainted_str_new2("st_mode"), INT2NUM(bdb_stat->st_mode)); #if HAVE_ST_DB_LOG_STAT_ST_REFCNT rb_hash_aset(res, rb_tainted_str_new2("st_refcnt"), INT2NUM(bdb_stat->st_refcnt)); #endif #if HAVE_ST_DB_LOG_STAT_ST_LG_BSIZE rb_hash_aset(res, rb_tainted_str_new2("st_lg_bsize"), INT2NUM(bdb_stat->st_lg_bsize)); #endif #if HAVE_ST_DB_LOG_STAT_ST_LG_SIZE rb_hash_aset(res, rb_tainted_str_new2("st_lg_size"), INT2NUM(bdb_stat->st_lg_size)); rb_hash_aset(res, rb_tainted_str_new2("st_lg_max"), INT2NUM(bdb_stat->st_lg_size)); #else rb_hash_aset(res, rb_tainted_str_new2("st_lg_max"), INT2NUM(bdb_stat->st_lg_max)); #endif rb_hash_aset(res, rb_tainted_str_new2("st_w_mbytes"), INT2NUM(bdb_stat->st_w_mbytes)); rb_hash_aset(res, rb_tainted_str_new2("st_w_bytes"), INT2NUM(bdb_stat->st_w_bytes)); rb_hash_aset(res, rb_tainted_str_new2("st_wc_mbytes"), INT2NUM(bdb_stat->st_wc_mbytes)); rb_hash_aset(res, rb_tainted_str_new2("st_wc_bytes"), INT2NUM(bdb_stat->st_wc_bytes)); rb_hash_aset(res, rb_tainted_str_new2("st_wcount"), INT2NUM(bdb_stat->st_wcount)); #if HAVE_ST_DB_LOG_STAT_ST_WCOUNT_FILL rb_hash_aset(res, rb_tainted_str_new2("st_wcount_fill"), INT2NUM(bdb_stat->st_wcount_fill)); #endif rb_hash_aset(res, rb_tainted_str_new2("st_scount"), INT2NUM(bdb_stat->st_scount)); rb_hash_aset(res, rb_tainted_str_new2("st_cur_file"), INT2NUM(bdb_stat->st_cur_file)); rb_hash_aset(res, rb_tainted_str_new2("st_cur_offset"), INT2NUM(bdb_stat->st_cur_offset)); rb_hash_aset(res, rb_tainted_str_new2("st_region_wait"), INT2NUM(bdb_stat->st_region_wait)); rb_hash_aset(res, rb_tainted_str_new2("st_region_nowait"), INT2NUM(bdb_stat->st_region_nowait)); #if HAVE_ST_DB_LOG_STAT_ST_DISK_FILE rb_hash_aset(res, rb_tainted_str_new2("st_disk_file"), INT2NUM(bdb_stat->st_disk_file)); #endif #if HAVE_ST_DB_LOG_STAT_ST_DISK_OFFSET rb_hash_aset(res, rb_tainted_str_new2("st_disk_offset"), INT2NUM(bdb_stat->st_disk_offset)); #if HAVE_ST_DB_LOG_STAT_ST_FLUSHCOMMIT rb_hash_aset(res, rb_tainted_str_new2("st_flushcommit"), INT2NUM(bdb_stat->st_flushcommit)); #endif #if HAVE_ST_DB_LOG_STAT_ST_MAXCOMMITPERFLUSH rb_hash_aset(res, rb_tainted_str_new2("st_maxcommitperflush"), INT2NUM(bdb_stat->st_maxcommitperflush)); #endif #if HAVE_ST_DB_LOG_STAT_ST_MINCOMMITPERFLUSH rb_hash_aset(res, rb_tainted_str_new2("st_mincommitperflush"), INT2NUM(bdb_stat->st_mincommitperflush)); #endif #endif free(bdb_stat); return res; }
/** Get file attributes. * * Similar to stat(). The 'st_dev' and 'st_blksize' fields are * ignored. The 'st_ino' field is ignored except if the 'use_ino' * mount option is given. * * DFZ: This is the first function to be called whenever the user tries to * get access to any file, even if only to its meta data. Two cases: * 1) if the file exists, i.e. it's stored in ZHT, then this file is * transfered to the local node first and 'lstat' the local copy * 2) if the file doesn't exist, FUSE will pass the control to * _create() */ int fusion_getattr(const char *path, struct stat *statbuf) { int retstat = 0; char fpath[PATH_MAX] = {0}; log_msg("\nfusion_getattr(path=\"%s\", statbuf=0x%08x)\n", path, statbuf); fusion_fullpath(fpath, path); char res[ZHT_MAX_BUFF] = {0}; log_msg("\n =====DFZ debug: file %s line %d \n\n", __FILE__, __LINE__); int status = zht_lookup(path, res); log_msg("\n =====DFZ debug: file %s line %d \n\n", __FILE__, __LINE__); char myaddr[PATH_MAX] = {0}; net_getmyip(myaddr); log_msg("\n =====DFZ debug: file %s line %d \n\n", __FILE__, __LINE__); if (ZHT_LOOKUP_FAIL == status) { /* if not found in ZHT */ log_msg("\n ===========DFZ debug: _getattr() %s does not exist \n\n", path); /*DFZ: uncomment this for metadata benchmark*/ return -1; /*if path is an existing directory*/ char dirname[PATH_MAX] = {0}; strcpy(dirname, path); strcat(dirname, "/"); log_msg("\n ===========DFZ debug: _getattr() dirname = %s. \n\n", dirname); char res[ZHT_MAX_BUFF] = {0}; int stat = zht_lookup(dirname, res); if (ZHT_LOOKUP_FAIL != stat) { log_msg("\n ===========DFZ debug: _getattr() res = %s. \n\n", res); mkdir(fpath, 0755); char cmd_mkdir[PATH_MAX] = {0}; strcpy(cmd_mkdir, "mkdir -p "); strcat(cmd_mkdir, fpath); system(cmd_mkdir); log_msg("\n ===========DFZ debug: _getattr() new directory %s/ created \n\n", fpath); } } else { /* if file exists in ZHT */ log_msg("\n ===========DFZ debug: _getattr() zht_lookup() = %s. \n\n", res); /*DFZ: uncomment this for metadata benchmark*/ return 0; if (access(fpath, F_OK)) { /*if it isn't on this node, copy it over*/ ffs_recvfile_c("udt", res, "9000", fpath, fpath); log_msg("\n ===========DFZ debug: _getattr() %s transferred from %s. \n\n", fpath, res); } else if (strcmp("/", path) /*even it's in local node, it could be outdated.*/ && strcmp(res, myaddr)) { ffs_recvfile_c("udt", res, "9000", fpath, fpath); log_msg("\n ===========DFZ debug: _getattr() %s transferred from %s because local copy might be outdated. \n\n", fpath, res); } else { /* let it be */ log_msg("\n ===========DFZ debug: _getattr() %s exists in local. \n\n", fpath); } } retstat = lstat(fpath, statbuf); if (retstat != 0) retstat = fusion_error("fusion_getattr lstat"); log_stat(statbuf); return retstat; }