void simply_ui_set_style(SimplyUi *self, int style_index) { if (self->ui_layer.custom_body_font) { fonts_unload_custom_font(self->ui_layer.custom_body_font); self->ui_layer.custom_body_font = NULL; } self->ui_layer.style = &STYLES[style_index]; if (self->ui_layer.style->custom_body_font_id) { self->ui_layer.custom_body_font = fonts_load_custom_font( resource_get_handle(self->ui_layer.style->custom_body_font_id)); } mark_dirty(self); }
static int ntfs_remount_fs(struct super_block *s, int *flags, char *data) { kuid_t uid; kgid_t gid; umode_t umask; int lowercase, eas, chk, errs, chkdsk, timeshift; int o; struct ntfs_sb_info *sbi = ntfs_sb(s); char *new_opts = kstrdup(data, GFP_KERNEL); *flags |= MS_NOATIME; ntfs_lock(s); uid = sbi->sb_uid; gid = sbi->sb_gid; umask = 0777 & ~sbi->sb_mode; lowercase = sbi->sb_lowercase; eas = sbi->sb_eas; chk = sbi->sb_chk; chkdsk = sbi->sb_chkdsk; errs = sbi->sb_err; timeshift = sbi->sb_timeshift; if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, &eas, &chk, &errs, &chkdsk, ×hift))) { printk("NTFS: bad mount options.\n"); goto out_err; } if (o == 2) { ntfs_help(); goto out_err; } if (timeshift != sbi->sb_timeshift) { printk("NTFS: timeshift can't be changed using remount.\n"); goto out_err; } unmark_dirty(s); sbi->sb_uid = uid; sbi->sb_gid = gid; sbi->sb_mode = 0777 & ~umask; sbi->sb_lowercase = lowercase; sbi->sb_eas = eas; sbi->sb_chk = chk; sbi->sb_chkdsk = chkdsk; sbi->sb_err = errs; sbi->sb_timeshift = timeshift; if (!(*flags & MS_RDONLY)) mark_dirty(s, 1); replace_mount_options(s, new_opts); ntfs_unlock(s); return 0; out_err: ntfs_unlock(s); kfree(new_opts); return -EINVAL; }
gboolean uservinfo_free(UserVInfo *in_info) { if (in_info == NULL) { return FALSE; } mark_dirty(in_info); rra_free_type(UserVInfo, in_info); return TRUE; }
gboolean sam_info_free(SamInfo *in_info) { if (in_info == NULL) { return FALSE; } mark_dirty(in_info); rra_free_type(SamInfo, in_info); return TRUE; }
gboolean aclist_set_rev(ACList *in_aclist, aclist_rev in_rev) { if (in_aclist == NULL) { return FALSE; } mark_dirty(in_aclist); in_aclist->rev = in_rev; return TRUE; }
int chmod(fs_context& fs, const char* path, mode_t mode) { if (ffsp::is_debug_path(fs, path)) return -EPERM; inode* ino; int rc = ffsp::lookup(fs, &ino, path); if (rc < 0) return rc; ino->i_mode = put_be32(mode); mark_dirty(fs, *ino); flush_inodes(fs, false); return 0; }
gboolean aclist_push_acentry(ACList *in_aclist, ACEntry *in_entry) { if (in_aclist == NULL || in_entry == NULL) { return FALSE; } mark_dirty(in_aclist); g_ptr_array_add(in_aclist->entries, in_entry); return TRUE; }
static void oil_backend_opengl_draw_triangles(OILImage *im, OILMatrix *matrix, OILImage *tex, OILVertex *vertices, unsigned int vertices_length, unsigned int *indices, unsigned int indices_length, OILTriangleFlags flags) { unsigned int i; load_matrix(matrix); bind_framebuffer(im); bind_colorbuffer(tex); mark_dirty(im); /* if we need to, re-generate the tex mipmaps */ if (tex) { OpenGLPriv *tex_priv = tex->backend_data; if (tex_priv->dirty_mipmaps) { /* tex colorbuffer is already bound */ glGenerateMipmap(GL_TEXTURE_2D); tex_priv->dirty_mipmaps = 0; } } /* set up any drawing flags */ if (!(flags & OIL_DEPTH_TEST)) { glDisable(GL_DEPTH_TEST); } glBegin(GL_TRIANGLES); for (i = 0; i < indices_length; i += 3) { OILVertex v0 = vertices[indices[i]]; OILVertex v1 = vertices[indices[i + 1]]; OILVertex v2 = vertices[indices[i + 2]]; glTexCoord2f(v0.s, v0.t); glColor4f(v0.color.r / 255.0, v0.color.g / 255.0, v0.color.b / 255.0, v0.color.a / 255.0); glVertex3f(v0.x, v0.y, v0.z); glTexCoord2f(v1.s, v1.t); glColor4f(v1.color.r / 255.0, v1.color.g / 255.0, v1.color.b / 255.0, v1.color.a / 255.0); glVertex3f(v1.x, v1.y, v1.z); glTexCoord2f(v2.s, v2.t); glColor4f(v2.color.r / 255.0, v2.color.g / 255.0, v2.color.b / 255.0, v2.color.a / 255.0); glVertex3f(v2.x, v2.y, v2.z); } glEnd(); /* undo our drawing flags */ if (!(flags & OIL_DEPTH_TEST)) { glEnable(GL_DEPTH_TEST); } }
int chown(fs_context& fs, const char* path, uid_t uid, gid_t gid) { if (ffsp::is_debug_path(fs, path)) return -EPERM; inode* ino; int rc = ffsp::lookup(fs, &ino, path); if (rc < 0) return rc; ino->i_uid = put_be32(uid); ino->i_gid = put_be32(gid); mark_dirty(fs, *ino); flush_inodes(fs, false); return 0; }
/* * This is the function that sensor classes call to update their values. There are numerous inlines * in the header file for the sake of eliminating the need to type-cast to void*. * Marks the datum (and the sensor) dirty with timestamp. * Returns an error code. */ SensorError SensorWrapper::updateDatum(uint8_t dat, void *reading) { SensorDatum* current = get_datum(dat); if (current) { if (current->target_mem == nullptr) { current->target_mem = malloc(current->length()); if (current->target_mem == nullptr) { return SensorError::OUT_OF_MEMORY; } } memcpy(current->target_mem, reading, current->length()); } else { return SensorError::INVALID_DATUM; } return mark_dirty(dat); // If we've come this far, mark this datum as dirty. }
void Info::on_state_change() { File* file = state->file_under_mouse; if(file == NULL) { filepath->set_text(""); filesize->set_text(""); } else { filepath->set_text(file->get_path()); filesize->set_text(pretty_print_file_size(file->get_size())); } mark_dirty(); }
static int xdf_write(Stream_t *Stream, char *buf, mt_off_t where, size_t len) { off_t begin, end; size_t len2; DeclareThis(Xdf_t); decompose(This, truncBytes32(where), len, &begin, &end, 0); len2 = load_bounds(This, begin, end); if(len2 < 0) return len2; maximize(end, len2); len2 -= begin; maximize(len, len2); memcpy(This->buffer + begin, buf, len); mark_dirty(This, begin, end); return end - begin; }
static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) { uid_t uid; gid_t gid; umode_t umask; int lowercase, conv, eas, chk, errs, chkdsk, timeshift; int o; struct hpfs_sb_info *sbi = hpfs_sb(s); *flags |= MS_NOATIME; uid = sbi->sb_uid; gid = sbi->sb_gid; umask = 0777 & ~sbi->sb_mode; lowercase = sbi->sb_lowercase; conv = sbi->sb_conv; eas = sbi->sb_eas; chk = sbi->sb_chk; chkdsk = sbi->sb_chkdsk; errs = sbi->sb_err; timeshift = sbi->sb_timeshift; if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, &conv, &eas, &chk, &errs, &chkdsk, ×hift))) { printk("HPFS: bad mount options.\n"); return 1; } if (o == 2) { hpfs_help(); return 1; } if (timeshift != sbi->sb_timeshift) { printk("HPFS: timeshift can't be changed using remount.\n"); return 1; } unmark_dirty(s); sbi->sb_uid = uid; sbi->sb_gid = gid; sbi->sb_mode = 0777 & ~umask; sbi->sb_lowercase = lowercase; sbi->sb_conv = conv; sbi->sb_eas = eas; sbi->sb_chk = chk; sbi->sb_chkdsk = chkdsk; sbi->sb_err = errs; sbi->sb_timeshift = timeshift; if (!(*flags & MS_RDONLY)) mark_dirty(s); return 0; }
gboolean aclist_pop_acentry(ACList *in_aclist) { if (in_aclist == NULL) { return FALSE; } if (in_aclist->entries->len == 0) { return FALSE; } int rm_index = in_aclist->entries->len - 1; mark_dirty(in_aclist); ACEntry *entry = (ACEntry*)g_ptr_array_index(in_aclist->entries, rm_index); g_ptr_array_remove_index(in_aclist->entries, rm_index); acentry_free(entry); return TRUE; }
void simply_ui_set_text_color(SimplyUi *self, SimplyUiTextfieldId textfield_id, GColor8 color) { SimplyUiTextfield *textfield = &self->ui_layer.textfields[textfield_id]; textfield->color = color; mark_dirty(self); }
void simply_ui_set_text(SimplyUi *self, SimplyUiTextfieldId textfield_id, const char *str) { SimplyUiTextfield *textfield = &self->ui_layer.textfields[textfield_id]; char **str_field = &textfield->text; strset(str_field, str); mark_dirty(self); }
struct super_block *hpfs_read_super(struct super_block *s, void *options, int silent) { kdev_t dev; struct buffer_head *bh0, *bh1, *bh2; struct hpfs_boot_block *bootblock; struct hpfs_super_block *superblock; struct hpfs_spare_block *spareblock; uid_t uid; gid_t gid; umode_t umask; int lowercase, conv, eas, chk, errs, chkdsk, timeshift; dnode_secno root_dno; struct hpfs_dirent *de = NULL; struct quad_buffer_head qbh; int o; s->s_hpfs_bmp_dir = NULL; s->s_hpfs_cp_table = NULL; s->s_hpfs_creation_de_lock = s->s_hpfs_rd_inode = 0; init_waitqueue_head(&s->s_hpfs_creation_de); init_waitqueue_head(&s->s_hpfs_iget_q); uid = current->uid; gid = current->gid; umask = current->fs->umask; lowercase = 0; conv = CONV_BINARY; eas = 2; chk = 1; errs = 1; chkdsk = 1; timeshift = 0; if (!(o = parse_opts(options, &uid, &gid, &umask, &lowercase, &conv, &eas, &chk, &errs, &chkdsk, ×hift))) { printk("HPFS: bad mount options.\n"); goto bail0; } if (o==2) { hpfs_help(); goto bail0; } /*s->s_hpfs_mounting = 1;*/ dev = s->s_dev; set_blocksize(dev, 512); s->s_hpfs_fs_size = -1; if (!(bootblock = hpfs_map_sector(s, 0, &bh0, 0))) goto bail1; if (!(superblock = hpfs_map_sector(s, 16, &bh1, 1))) goto bail2; if (!(spareblock = hpfs_map_sector(s, 17, &bh2, 0))) goto bail3; /* Check magics */ if (/*bootblock->magic != BB_MAGIC ||*/ superblock->magic != SB_MAGIC || spareblock->magic != SP_MAGIC) { if (!silent) printk("HPFS: Bad magic ... probably not HPFS\n"); goto bail4; } /* Check version */ if (!(s->s_flags & MS_RDONLY) && superblock->funcversion != 2 && superblock->funcversion != 3) { printk("HPFS: Bad version %d,%d. Mount readonly to go around\n", (int)superblock->version, (int)superblock->funcversion); printk("HPFS: please try recent version of HPFS driver at http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi and if it still can't understand this format, contact author - [email protected]\n"); goto bail4; } s->s_flags |= MS_NOATIME; /* Fill superblock stuff */ s->s_magic = HPFS_SUPER_MAGIC; s->s_blocksize = 512; s->s_blocksize_bits = 9; s->s_op = &hpfs_sops; s->s_hpfs_root = superblock->root; s->s_hpfs_fs_size = superblock->n_sectors; s->s_hpfs_bitmaps = superblock->bitmaps; s->s_hpfs_dirband_start = superblock->dir_band_start; s->s_hpfs_dirband_size = superblock->n_dir_band; s->s_hpfs_dmap = superblock->dir_band_bitmap; s->s_hpfs_uid = uid; s->s_hpfs_gid = gid; s->s_hpfs_mode = 0777 & ~umask; s->s_hpfs_n_free = -1; s->s_hpfs_n_free_dnodes = -1; s->s_hpfs_lowercase = lowercase; s->s_hpfs_conv = conv; s->s_hpfs_eas = eas; s->s_hpfs_chk = chk; s->s_hpfs_chkdsk = chkdsk; s->s_hpfs_err = errs; s->s_hpfs_timeshift = timeshift; s->s_hpfs_was_error = 0; s->s_hpfs_cp_table = NULL; s->s_hpfs_c_bitmap = -1; /* Load bitmap directory */ if (!(s->s_hpfs_bmp_dir = hpfs_load_bitmap_directory(s, superblock->bitmaps))) goto bail4; /* Check for general fs errors*/ if (spareblock->dirty && !spareblock->old_wrote) { if (errs == 2) { printk("HPFS: Improperly stopped, not mounted\n"); goto bail4; } hpfs_error(s, "improperly stopped"); } if (!(s->s_flags & MS_RDONLY)) { spareblock->dirty = 1; spareblock->old_wrote = 0; mark_buffer_dirty(bh2); } if (spareblock->hotfixes_used || spareblock->n_spares_used) { if (errs >= 2) { printk("HPFS: Hotfixes not supported here, try chkdsk\n"); mark_dirty(s); goto bail4; } hpfs_error(s, "hotfixes not supported here, try chkdsk"); if (errs == 0) printk("HPFS: Proceeding, but your filesystem will be probably corrupted by this driver...\n"); else printk("HPFS: This driver may read bad files or crash when operating on disk with hotfixes.\n"); } if (spareblock->n_dnode_spares != spareblock->n_dnode_spares_free) { if (errs >= 2) { printk("HPFS: Spare dnodes used, try chkdsk\n"); mark_dirty(s); goto bail4; } hpfs_error(s, "warning: spare dnodes used, try chkdsk"); if (errs == 0) printk("HPFS: Proceeding, but your filesystem could be corrupted if you delete files or directories\n"); } if (chk) { unsigned a; if (superblock->dir_band_end - superblock->dir_band_start + 1 != superblock->n_dir_band || superblock->dir_band_end < superblock->dir_band_start || superblock->n_dir_band > 0x4000) { hpfs_error(s, "dir band size mismatch: dir_band_start==%08x, dir_band_end==%08x, n_dir_band==%08x", superblock->dir_band_start, superblock->dir_band_end, superblock->n_dir_band); goto bail4; } a = s->s_hpfs_dirband_size; s->s_hpfs_dirband_size = 0; if (hpfs_chk_sectors(s, superblock->dir_band_start, superblock->n_dir_band, "dir_band") || hpfs_chk_sectors(s, superblock->dir_band_bitmap, 4, "dir_band_bitmap") || hpfs_chk_sectors(s, superblock->bitmaps, 4, "bitmaps")) { mark_dirty(s); goto bail4; } s->s_hpfs_dirband_size = a; } else printk("HPFS: You really don't want any checks? You are crazy...\n"); /* Load code page table */ if (spareblock->n_code_pages) if (!(s->s_hpfs_cp_table = hpfs_load_code_page(s, spareblock->code_page_dir))) printk("HPFS: Warning: code page support is disabled\n"); brelse(bh2); brelse(bh1); brelse(bh0); hpfs_lock_iget(s, 1); s->s_root = d_alloc_root(iget(s, s->s_hpfs_root)); hpfs_unlock_iget(s); if (!s->s_root || !s->s_root->d_inode) { printk("HPFS: iget failed. Why???\n"); goto bail0; } hpfs_set_dentry_operations(s->s_root); /* * find the root directory's . pointer & finish filling in the inode */ root_dno = hpfs_fnode_dno(s, s->s_hpfs_root); if (root_dno) de = map_dirent(s->s_root->d_inode, root_dno, "\001\001", 2, NULL, &qbh); if (!root_dno || !de) hpfs_error(s, "unable to find root dir"); else { s->s_root->d_inode->i_atime = local_to_gmt(s, de->read_date); s->s_root->d_inode->i_mtime = local_to_gmt(s, de->write_date); s->s_root->d_inode->i_ctime = local_to_gmt(s, de->creation_date); s->s_root->d_inode->i_hpfs_ea_size = de->ea_size; s->s_root->d_inode->i_hpfs_parent_dir = s->s_root->d_inode->i_ino; if (s->s_root->d_inode->i_size == -1) s->s_root->d_inode->i_size = 2048; if (s->s_root->d_inode->i_blocks == -1) s->s_root->d_inode->i_blocks = 5; } if (de) hpfs_brelse4(&qbh); return s; bail4: brelse(bh2); bail3: brelse(bh1); bail2: brelse(bh0); bail1: bail0: if (s->s_hpfs_bmp_dir) kfree(s->s_hpfs_bmp_dir); if (s->s_hpfs_cp_table) kfree(s->s_hpfs_cp_table); return NULL; }
int mydisk_write_block(int block_id, void *buffer) { /* TODO: this one is similar to read_block() except that * you need to mark it dirty */ printf("\n--- Start write block ---\n"); // printf("block id = %d\n", block_id); if (block_id >= max_blocks) { printf("ERROR: block id greater than max blocks"); return 1; } if (cache_enabled) { printf("cache enabled for write\n"); int i; // char tmp[BLOCK_SIZE]; // char *x; // x = &tmp; // char *x = malloc(BLOCK_SIZE); // print(); // *x = get_cached_block(block_id); char *y[BLOCK_SIZE]; *y = get_cached_block(block_id); if (*y == NULL) { printf("cache miss for write\n"); mark_dirty(block_id); memcpy(create_cached_block(block_id), buffer, BLOCK_SIZE); printf("_______________\n"); char *z = get_cached_block(block_id); for(i=0; i<BLOCK_SIZE; i++) { printf("%c", z[i]); } printf("________________\n"); return 0; } else { printf("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"); printf("cache hit for write\n"); printf("+++++++++ write this ++++++++\n"); for(i=0; i<BLOCK_SIZE; i++) { printf("%c", ((char*)buffer)[i]); } printf("\n+++++++++++++++++\n"); memcpy(get_cached_block(block_id), buffer, BLOCK_SIZE); printf("_______ should be same as top ________\n"); get_cached_block(block_id); printf("\n________________\n"); return -1; } } else { int i; char ch; fseek(thefile, block_id * BLOCK_SIZE, SEEK_SET); if(fwrite(buffer, BLOCK_SIZE, 1, thefile) != 1) { printf("ERROR\n"); return 1; } else { return 0; } } // fseek(thefile, 0, SEEK_SET); // i = 0; // while( ( ch = fgetc(thefile) ) != EOF ) { // printf("%c",ch); // if (i % BLOCK_SIZE == 0 && (i!=0)) { // printf("\n"); // } // i++; // } // printf("\n--- End write block ---\n"); return 0; }
static int hpfs_fill_super(struct super_block *s, void *options, int silent) { struct buffer_head *bh0, *bh1, *bh2; struct hpfs_boot_block *bootblock; struct hpfs_super_block *superblock; struct hpfs_spare_block *spareblock; struct hpfs_sb_info *sbi; struct inode *root; uid_t uid; gid_t gid; umode_t umask; int lowercase, eas, chk, errs, chkdsk, timeshift; dnode_secno root_dno; struct hpfs_dirent *de = NULL; struct quad_buffer_head qbh; int o; save_mount_options(s, options); sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) { return -ENOMEM; } s->s_fs_info = sbi; sbi->sb_bmp_dir = NULL; sbi->sb_cp_table = NULL; mutex_init(&sbi->hpfs_mutex); hpfs_lock(s); uid = current_uid(); gid = current_gid(); umask = current_umask(); lowercase = 0; eas = 2; chk = 1; errs = 1; chkdsk = 1; timeshift = 0; if (!(o = parse_opts(options, &uid, &gid, &umask, &lowercase, &eas, &chk, &errs, &chkdsk, ×hift))) { printk("HPFS: bad mount options.\n"); goto bail0; } if (o==2) { hpfs_help(); goto bail0; } /*sbi->sb_mounting = 1;*/ sb_set_blocksize(s, 512); sbi->sb_fs_size = -1; if (!(bootblock = hpfs_map_sector(s, 0, &bh0, 0))) goto bail1; if (!(superblock = hpfs_map_sector(s, 16, &bh1, 1))) goto bail2; if (!(spareblock = hpfs_map_sector(s, 17, &bh2, 0))) goto bail3; /* Check magics */ if (/*le16_to_cpu(bootblock->magic) != BB_MAGIC ||*/ le32_to_cpu(superblock->magic) != SB_MAGIC || le32_to_cpu(spareblock->magic) != SP_MAGIC) { if (!silent) printk("HPFS: Bad magic ... probably not HPFS\n"); goto bail4; } /* Check version */ if (!(s->s_flags & MS_RDONLY) && superblock->funcversion != 2 && superblock->funcversion != 3) { printk("HPFS: Bad version %d,%d. Mount readonly to go around\n", (int)superblock->version, (int)superblock->funcversion); printk("HPFS: please try recent version of HPFS driver at http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi and if it still can't understand this format, contact author - [email protected]\n"); goto bail4; } s->s_flags |= MS_NOATIME; /* Fill superblock stuff */ s->s_magic = HPFS_SUPER_MAGIC; s->s_op = &hpfs_sops; s->s_d_op = &hpfs_dentry_operations; sbi->sb_root = le32_to_cpu(superblock->root); sbi->sb_fs_size = le32_to_cpu(superblock->n_sectors); sbi->sb_bitmaps = le32_to_cpu(superblock->bitmaps); sbi->sb_dirband_start = le32_to_cpu(superblock->dir_band_start); sbi->sb_dirband_size = le32_to_cpu(superblock->n_dir_band); sbi->sb_dmap = le32_to_cpu(superblock->dir_band_bitmap); sbi->sb_uid = uid; sbi->sb_gid = gid; sbi->sb_mode = 0777 & ~umask; sbi->sb_n_free = -1; sbi->sb_n_free_dnodes = -1; sbi->sb_lowercase = lowercase; sbi->sb_eas = eas; sbi->sb_chk = chk; sbi->sb_chkdsk = chkdsk; sbi->sb_err = errs; sbi->sb_timeshift = timeshift; sbi->sb_was_error = 0; sbi->sb_cp_table = NULL; sbi->sb_c_bitmap = -1; sbi->sb_max_fwd_alloc = 0xffffff; if (sbi->sb_fs_size >= 0x80000000) { hpfs_error(s, "invalid size in superblock: %08x", (unsigned)sbi->sb_fs_size); goto bail4; } /* Load bitmap directory */ if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps)))) goto bail4; /* Check for general fs errors*/ if (spareblock->dirty && !spareblock->old_wrote) { if (errs == 2) { printk("HPFS: Improperly stopped, not mounted\n"); goto bail4; } hpfs_error(s, "improperly stopped"); } if (!(s->s_flags & MS_RDONLY)) { spareblock->dirty = 1; spareblock->old_wrote = 0; mark_buffer_dirty(bh2); } if (le32_to_cpu(spareblock->hotfixes_used) || le32_to_cpu(spareblock->n_spares_used)) { if (errs >= 2) { printk("HPFS: Hotfixes not supported here, try chkdsk\n"); mark_dirty(s, 0); goto bail4; } hpfs_error(s, "hotfixes not supported here, try chkdsk"); if (errs == 0) printk("HPFS: Proceeding, but your filesystem will be probably corrupted by this driver...\n"); else printk("HPFS: This driver may read bad files or crash when operating on disk with hotfixes.\n"); } if (le32_to_cpu(spareblock->n_dnode_spares) != le32_to_cpu(spareblock->n_dnode_spares_free)) { if (errs >= 2) { printk("HPFS: Spare dnodes used, try chkdsk\n"); mark_dirty(s, 0); goto bail4; } hpfs_error(s, "warning: spare dnodes used, try chkdsk"); if (errs == 0) printk("HPFS: Proceeding, but your filesystem could be corrupted if you delete files or directories\n"); } if (chk) { unsigned a; if (le32_to_cpu(superblock->dir_band_end) - le32_to_cpu(superblock->dir_band_start) + 1 != le32_to_cpu(superblock->n_dir_band) || le32_to_cpu(superblock->dir_band_end) < le32_to_cpu(superblock->dir_band_start) || le32_to_cpu(superblock->n_dir_band) > 0x4000) { hpfs_error(s, "dir band size mismatch: dir_band_start==%08x, dir_band_end==%08x, n_dir_band==%08x", le32_to_cpu(superblock->dir_band_start), le32_to_cpu(superblock->dir_band_end), le32_to_cpu(superblock->n_dir_band)); goto bail4; } a = sbi->sb_dirband_size; sbi->sb_dirband_size = 0; if (hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_start), le32_to_cpu(superblock->n_dir_band), "dir_band") || hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_bitmap), 4, "dir_band_bitmap") || hpfs_chk_sectors(s, le32_to_cpu(superblock->bitmaps), 4, "bitmaps")) { mark_dirty(s, 0); goto bail4; } sbi->sb_dirband_size = a; } else printk("HPFS: You really don't want any checks? You are crazy...\n"); /* Load code page table */ if (le32_to_cpu(spareblock->n_code_pages)) if (!(sbi->sb_cp_table = hpfs_load_code_page(s, le32_to_cpu(spareblock->code_page_dir)))) printk("HPFS: Warning: code page support is disabled\n"); brelse(bh2); brelse(bh1); brelse(bh0); root = iget_locked(s, sbi->sb_root); if (!root) goto bail0; hpfs_init_inode(root); hpfs_read_inode(root); unlock_new_inode(root); s->s_root = d_alloc_root(root); if (!s->s_root) { iput(root); goto bail0; } /* * find the root directory's . pointer & finish filling in the inode */ root_dno = hpfs_fnode_dno(s, sbi->sb_root); if (root_dno) de = map_dirent(root, root_dno, "\001\001", 2, NULL, &qbh); if (!de) hpfs_error(s, "unable to find root dir"); else { root->i_atime.tv_sec = local_to_gmt(s, le32_to_cpu(de->read_date)); root->i_atime.tv_nsec = 0; root->i_mtime.tv_sec = local_to_gmt(s, le32_to_cpu(de->write_date)); root->i_mtime.tv_nsec = 0; root->i_ctime.tv_sec = local_to_gmt(s, le32_to_cpu(de->creation_date)); root->i_ctime.tv_nsec = 0; hpfs_i(root)->i_ea_size = le16_to_cpu(de->ea_size); hpfs_i(root)->i_parent_dir = root->i_ino; if (root->i_size == -1) root->i_size = 2048; if (root->i_blocks == -1) root->i_blocks = 5; hpfs_brelse4(&qbh); } hpfs_unlock(s); return 0; bail4: brelse(bh2); bail3: brelse(bh1); bail2: brelse(bh0); bail1: bail0: hpfs_unlock(s); kfree(sbi->sb_bmp_dir); kfree(sbi->sb_cp_table); s->s_fs_info = NULL; kfree(sbi); return -EINVAL; }
static void oil_backend_opengl_save(OILImage *im) { bind_colorbuffer(im); mark_dirty(im); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, im->width, im->height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, im->data); }
static void game_tick(int paint) { int i, j, k; int yoff, xoff; int bx, by; SDL_Rect rect; SDL_Rect rect2; xoff = 30, yoff = 40; p.angle += p.right * 90 * time_step; if(p.angle < -85) p.angle = -85; else if(p.angle > 85) p.angle = 85; if(level == 255) { k = 0; for(i = 0; i < field_height; ++i) { for(j = 0; j < WIDTH(i); ++j) { if(p.field[i][j]) ++k; } } for(i = 0; i < sizeof(p.mbubbles) / sizeof(p.mbubbles[0]); ++i) { if(p.mbubbles[i].color && !p.mbubbles[i].falling) ++k; } k += p.evil_bubble_count; if(k < 20) { for(i = 0; i < 5; ++i) p.evil_bubbles[p.evil_bubble_count++] = (rand() % 8) + 1; } } for(k = 0; k < sizeof(p.mbubbles) / sizeof(p.mbubbles[0]); ++k) { struct moving_bubble* b = &p.mbubbles[k]; if(!b->color) continue; if(b->y > 480) b->color = 0; if(!b->falling) { b->x += b->velx * time_step; b->y += b->vely * time_step; if(level < sizeof(levels) / sizeof(levels[0])) { if(levels[level].mode == GM_GRAVITY) b->vely += 1; else if(levels[level].mode == GM_INV_GRAVITY) b->vely -= 3; } if(b->x < 0) { b->x = -b->x; b->velx = -b->velx; if(sound_enable) sounds[2].pos = 0; } else if(b->x > max_x) { b->x = 2 * max_x - b->x; b->velx = -b->velx; if(sound_enable) sounds[2].pos = 0; } for(i = -1; i < field_height; ++i) { for(j = 0; j < WIDTH(i); ++j) { float posx, posy; float dirx, diry; if(i != -1 && !p.field[i][j]) continue; posx = j * 32.0f + ((i & 1) ? 32.0f : 16.0f); posy = i * 28.0f + 16.0f; dirx = posx - (b->x + 16.0f); diry = posy - (b->y + 16.0f); float minrage = 784.0f; if(level < sizeof(levels) / sizeof(levels[0]) && levels[level].mode == GM_GRAVITY) minrage = 32 * 32; if(dirx * dirx + diry * diry < minrage) { if(fabs(dirx) > fabs(diry)) { by = i; if(dirx > 0) bx = j - 1; else bx = j + 1; } else // fabs(dirx) <= fabs(diry) { if(diry > 0) by = i - 1; else by = i + 1; if(by & 1) { if(dirx > 0) bx = j - 1; else bx = j; } else { if(dirx > 0) bx = j; else bx = j + 1; } } if(by > 11) { int a, b; for(a = 0; a < field_height; ++a) for(b = 0; b < WIDTH(a); ++b) remove_bubble(&p, b, a, 0); state = GS_PINK; for(a = 0; a < sizeof(p.mbubbles) / sizeof(p.mbubbles[0]); ++a) p.mbubbles[a].falling = 1; } else { if(stick(&p, bx, by, b->color)) { int a; if(level != 255) state = GS_SHINE_GET; for(a = 0; a < sizeof(p.mbubbles) / sizeof(p.mbubbles[0]); ++a) p.mbubbles[a].falling = 1; } b->color = 0; } goto collide; } } } collide:; } else { b->vely += 1500.0f * time_step; b->x += b->velx * time_step; b->y += b->vely * time_step; } } if(paint) { int draw_anyway = 0; if(p.bubble > 7 || p.next_bubble > 7) draw_anyway = 1; if(p.dirty_minx < p.dirty_maxx) { SET_RECT(rect, xoff + p.dirty_minx, yoff + p.dirty_miny, p.dirty_maxx - p.dirty_minx, p.dirty_maxy - p.dirty_miny); SDL_BlitSurface(spbg, &rect, screen, &rect); } for(i = 0; i < sizeof(p.mbubbles) / sizeof(p.mbubbles[0]); ++i) { if(p.mbubbles[i].lastpaintx == INT_MIN) continue; SET_RECT(rect, p.mbubbles[i].lastpaintx + xoff, p.mbubbles[i].lastpainty + yoff, 32, 32); SDL_BlitSurface(spbg, &rect, screen, &rect); mark_dirty(&p, p.mbubbles[i].lastpaintx, p.mbubbles[i].lastpainty, 32, 32); p.mbubbles[i].lastpaintx = INT_MIN; } if(p.dirty_minx < p.dirty_maxx || (level < sizeof(levels) / sizeof(levels[0]) && levels[level].has_joker)) { for(i = 0; i < 10; ++i) { for(j = 0; j < WIDTH(i); ++j) { if(!p.field[i][j]) continue; rect.x = xoff + j * 32 + ((i & 1) ? 16 : 0); rect.y = yoff + i * 28; rect.w = 32; rect.h = 32; int color = p.field[i][j] - 1; if(color < 8) cond_blit(&p, bubbles[color], 0, screen, &rect); else { mark_dirty(&p, rect.x - xoff, rect.y - yoff, rect.w, rect.h); cond_blit(&p, bubbles[(now / 100) % 8], 0, screen, &rect); } } } } if(p.last_angle != p.angle || ( 78 <= p.dirty_maxx && 178 >= p.dirty_minx && 316 <= p.dirty_maxy && 432 >= p.dirty_miny)) { mark_dirty(&p, 78, 316, 100, 100); p.last_angle = p.angle; } if(p.dirty_minx < p.dirty_maxx || draw_anyway) { rect.x = xoff + 78; rect.y = yoff + 316; rect.w = 100; rect.h = 100; if(draw_anyway) mark_dirty(&p, rect.x - xoff, rect.y - yoff, 100, 100); cond_blit(&p, spbg, &rect, screen, &rect); for(i = 10; i < field_height; ++i) { for(j = 0; j < WIDTH(i); ++j) { if(!p.field[i][j]) continue; rect2.x = xoff + j * 32 + ((i & 1) ? 16 : 0); rect2.y = yoff + i * 28; rect2.w = 32; rect2.h = 32; int color = p.field[i][j] - 1; if(color < 8) cond_blit(&p, bubbles[color], 0, screen, &rect2); else cond_blit(&p, bubbles[(now / 100) % 8], 0, screen, &rect2); } } if((78 <= p.dirty_maxx && 178 >= p.dirty_minx && 316 <= p.dirty_maxy && 432 >= p.dirty_miny) || draw_anyway) { rect2.x = xoff + 112; rect2.y = yoff + 350; rect2.w = 32; rect2.h = 32; if(p.bubble < 8) SDL_BlitSurface(bubbles[p.bubble], 0, screen, &rect2); else SDL_BlitSurface(bubbles[(now / 100) % 8], 0, screen, &rect2); SDL_BlitSurface(base[(int) ((p.angle + 90.0f) * 128 / 180.0f)], 0, screen, &rect); rect2.x = xoff + 112; rect2.y = yoff + 400; if(p.next_bubble < 8) SDL_BlitSurface(bubbles[p.next_bubble], 0, screen, &rect2); else SDL_BlitSurface(bubbles[(now / 100) % 8], 0, screen, &rect2); } } p.dirty_minx = max_field_width * 32; p.dirty_miny = 440; p.dirty_maxx = 0; p.dirty_maxy = 0; for(i = 0; i < sizeof(p.mbubbles) / sizeof(p.mbubbles[0]); ++i) { if(!p.mbubbles[i].color) continue; SET_RECT(rect, (int) p.mbubbles[i].x + xoff, (int) p.mbubbles[i].y + yoff, 32, 32); int color = p.mbubbles[i].color - 1; if(color < 8) SDL_BlitSurface(bubbles[color], 0, screen, &rect); else { mark_dirty(&p, rect.x - xoff, rect.y - yoff, rect.w, rect.h); SDL_BlitSurface(bubbles[(now / 100) % 8], 0, screen, &rect); } p.mbubbles[i].lastpaintx = rect.x - xoff; p.mbubbles[i].lastpainty = rect.y - yoff; } if(level < sizeof(levels) / sizeof(levels[0]) && levels[level].mode == GM_TIME_ATTACK) { wchar_t buf[256]; int remaining = levels[level].time - (now - first_tick) / 1000 + bonus; if(remaining <= 0) { if(levels[level].shoot_bonus) { bonus += levels[level].shoot_bonus; shoot(&p, random_bubble(&p), -1); remaining = bonus; } else { state = GS_PINK; remaining = 0; } } #ifndef WIN32 swprintf(buf, sizeof(buf), L"%u", remaining); #else swprintf(buf, L"%u", remaining); #endif SET_RECT(rect, 355, 104, 256, 128); SDL_BlitSurface(spbg, &rect, screen, &rect); print_string(0, 483, 144, L"Time remaining", 1); print_string(0, 483, 184, buf, 1); } else if(level < sizeof(levels) / sizeof(levels[0]) && levels[level].mode == GM_AVALANCHE) { if(now - last_avalanche > levels[level].time * 1000) { p.evil_bubbles[p.evil_bubble_count++] = random_bubble(&p) + 1; last_avalanche = now; } } { wchar_t buf[256]; SET_RECT(rect, 355, 232, 256, 80); SDL_BlitSurface(spbg, &rect, screen, &rect); if(level != 255) { #ifndef WIN32 swprintf(buf, sizeof(buf), L"Level %u", level + 1); #else swprintf(buf, L"Level %u", level + 1); #endif print_string(0, 483, 264, buf, 1); } else { print_string(0, 483, 264, L"Infinity", 1); } } } }