Skip to content

Commit

Permalink
Second Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MohsenKoohi committed Dec 25, 2012
1 parent 4e08aeb commit dfac83f
Show file tree
Hide file tree
Showing 30 changed files with 23,771 additions and 0 deletions.
25 changes: 25 additions & 0 deletions 1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include<fcntl.h>
#include<sys/stat.h>
#include <sys/types.h>
#include <string.h>
void main(){
int size=40*1024*1024;
char* ad=malloc(size);
char* ap=ad;
for(int i=0;i<size/4096;i++){
char a[20];
sprintf(a,"*%d*",i);
int al=strlen(a);
for(int j=0;j<4096/al;j++){
sprintf(ad,a);
ad+=al;
}
for(int j=0;j<4096%al;j++)
sprintf(ad++,"*");
}
ap[size]=0;
printf(ap);
}
60 changes: 60 additions & 0 deletions 2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include<fcntl.h>
#include<sys/stat.h>
#include <sys/types.h>
#include <string.h>
#include <dirent.h>
#include <sys/syscall.h>
struct aa{
union{
unsigned int reg_inode_security_block;
struct {
unsigned int data_hash_block,
metadata_hash_block;
} dir_inode_security_block;
} aas;
};

struct linux_dirent {
unsigned long d_ino; /* Inode number */
unsigned long d_off; /* Offset to next linux_dirent */
unsigned short d_reclen; /* Length of this linux_dirent */
char d_name[]; /* Filename (null-terminated) */
/* length is actually (d_reclen - 2 -
offsetof(struct linux_dirent, d_name) */
/*
char pad; // Zero padding byte
char d_type; // File type (only since Linux 2.6.4;
// offset is (d_reclen - 1))
*/

};

//#define ww4
#ifdef ww4
#define ww(mes) mes
#else
#define ww(mes)
#endif

void main(){
ww(int i=213;)
int fd=open(".",O_RDONLY|O_DIRECTORY);
void* buf=malloc(1024);
int n;
do{
n=syscall(SYS_getdents,fd,buf,1024);
printf("%d \n",n);
int pos=0;
while(pos<n){
struct linux_dirent* d=(struct linux_dirent*)(buf+pos);
printf("%d %30s %10d %10d %d \n",d->d_ino,d->d_name,pos,d->d_off,buf);
pos+=d->d_reclen;
}
}while(n);
return;
}
24 changes: 24 additions & 0 deletions 3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include<fcntl.h>
#include<sys/stat.h>
#include <sys/types.h>
#include <string.h>
void main(){
int size=64*1024*1024;
char abc[27],
p[35];
for(int i=0;i<26;i++)
abc[i]='A'+i;
abc[26]=0;
for(int i=0;i<size/4096;i++){
for(int j=0;j<4096/32;j++){
sprintf(p,"*%d*%i*%s***\n",i,j,abc);
p[31]='\n';
p[32]=0;
printf("%s",p);
}
}
return;
}
61 changes: 61 additions & 0 deletions 4.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include<fcntl.h>
#include<sys/stat.h>
#include <sys/types.h>
#include <string.h>
int min(int a,int b){
if(a<b)
return a;
return b;
}
char* getmealpha(char* array,int size){

char* ap=array;
char abc[27],
p[35];
for(int i=0;i<26;i++)
abc[i]='A'+i;
abc[26]=0;
int len=0;
int i=0;
while(size-len>0){
int llen=min(4096,size-len);
//printf("%d\n",size-len);
for(int j=0;j<=
llen/32;j++){
sprintf(p,"*%d*M%i*%s****\n",i,j,abc);
p[31]='\n';
p[32]=0;
sprintf(ap,"%s",p);
ap+=32;
//printf("1\n");
}
len+=llen;
i++;
}
array[size]=0;
return array;
}

void main(){
int size=4096;
char *array=malloc(size+32);
getmealpha(array,size);
int fd=open("/media/fs1/1",O_CREAT|O_RDWR);

int s=lseek(fd,64,SEEK_SET);
printf("%d %d %lx\n",fd,s,array);
s=write(fd,array,54);
printf("%d\n",s);

s=lseek(fd,9432,SEEK_SET);
printf("%d %d %lx\n",fd,s,array);
s=write(fd,array,480);
printf("%d\n",s);

close(fd);

return;
}
32 changes: 32 additions & 0 deletions 5.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include<fcntl.h>
#include<sys/stat.h>
#include <sys/types.h>
#include <string.h>
struct users{
int k[20];
};

void main(){

struct users u;
struct users* up=&u;
struct users** uu,**uu2;

*uu=up;
printf("up:%lx\n",up);
printf("uu:%lx *uu:%lx\n",uu,*uu);

uu2=malloc(8);
printf("uu2:%lx *uu2:%lx\n",uu2,*uu2);
*uu2=*uu;
printf("uu2:%lx *uu2:%lx\n",uu2,*uu2);
//root=add_event_to_atn(root,5,6,uu,8,0);

struct users* d;
memcpy(&d, uu2, 8);
printf("d:%lx &d:%lx\n",d,&d);
return;
}
133 changes: 133 additions & 0 deletions GSFS.mod.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>

MODULE_INFO(vermagic, VERMAGIC_STRING);

struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};

static const struct modversion_info ____versions[]
__used
__attribute__((section("__versions"))) = {
{ 0x6186d134, "module_layout" },
{ 0x34eb1fef, "alloc_pages_current" },
{ 0x92b328e7, "cdev_alloc" },
{ 0xb104aef6, "remove_from_page_cache" },
{ 0xdb49c188, "iget_failed" },
{ 0xe55e6baf, "cdev_del" },
{ 0x5a34a45c, "__kmalloc" },
{ 0xd6147ae2, "up_read" },
{ 0x8337f629, "__bread" },
{ 0x492dd887, "kernel_stack" },
{ 0x2b200864, "_raw_spin_unlock" },
{ 0x926ac063, "__mark_inode_dirty" },
{ 0xcecedd89, "bio_alloc" },
{ 0x25ec1b28, "strlen" },
{ 0x6e787f7c, "slab_buffer_size" },
{ 0x58af5fa3, "end_buffer_write_sync" },
{ 0x6fff393f, "time_to_tm" },
{ 0x79aa04a2, "get_random_bytes" },
{ 0xac971704, "malloc_sizes" },
{ 0xfc1ce527, "test_set_page_writeback" },
{ 0x16da8da5, "__lock_page" },
{ 0xc3cdc97b, "__lock_buffer" },
{ 0x105e2727, "__tracepoint_kmalloc" },
{ 0xa26032d3, "dput" },
{ 0x5b011518, "d_find_alias" },
{ 0x8dbc48f8, "add_to_page_cache_lru" },
{ 0xaba7f34f, "mutex_unlock" },
{ 0x7485e15e, "unregister_chrdev_region" },
{ 0x29a66802, "unlock_buffer" },
{ 0x3c2c5af5, "sprintf" },
{ 0x7ba1937b, "set_page_dirty" },
{ 0x592b9cd7, "down_read" },
{ 0x19702df, "end_page_writeback" },
{ 0xe24d3a97, "jiffies_64" },
{ 0xde0bdcff, "memset" },
{ 0xb3dd40, "kmem_cache_alloc_notrace" },
{ 0xbae023d, "current_task" },
{ 0xcc53fe54, "down_trylock" },
{ 0x1f2f3d1e, "current_fs_time" },
{ 0xea147363, "printk" },
{ 0xc1297a80, "find_lock_page" },
{ 0x2fa5a500, "memcmp" },
{ 0xcd46eb3d, "write_inode_now" },
{ 0xaef17f9f, "bio_add_page" },
{ 0xe5772d4a, "copy_user_generic_string" },
{ 0xf2059df, "d_alloc_root" },
{ 0xa1c76e0a, "_cond_resched" },
{ 0x85abc85f, "strncmp" },
{ 0xf2aefa4e, "mutex_lock" },
{ 0xb0eefdab, "file_remove_suid" },
{ 0x591d492e, "__wait_on_buffer" },
{ 0x24bdadfe, "file_update_time" },
{ 0x1a925a66, "down" },
{ 0x48c13475, "wait_on_page_bit" },
{ 0x43b0c9c3, "preempt_schedule" },
{ 0xbd1caa3a, "unlock_page" },
{ 0x9ca95a0e, "sort" },
{ 0x420a6ab8, "up_write" },
{ 0x1436917d, "down_write" },
{ 0xd8de29b7, "__brelse" },
{ 0x7e56c33b, "bio_put" },
{ 0x5038e5e2, "vm_insert_page" },
{ 0xd83d06fe, "mark_page_accessed" },
{ 0xe446e584, "cdev_add" },
{ 0xdcc3a419, "copy_user_generic_unrolled" },
{ 0x667817dc, "find_vma" },
{ 0x22f0aa41, "submit_bio" },
{ 0x19473d48, "ilookup" },
{ 0xfb7f5579, "__free_pages" },
{ 0x8631f188, "radix_tree_tag_set" },
{ 0xbd324228, "path_lookup" },
{ 0xd5bf958b, "generic_file_mmap" },
{ 0x1d786c80, "find_get_pages_tag" },
{ 0x876b5f62, "unlock_new_inode" },
{ 0x2c450757, "kill_block_super" },
{ 0x7b231487, "crypto_destroy_tfm" },
{ 0xca1c1047, "shrink_dcache_parent" },
{ 0xe2dc8259, "clear_page_dirty_for_io" },
{ 0x1a935b63, "submit_bh" },
{ 0x9c66d993, "path_put" },
{ 0x6443d74d, "_raw_spin_lock" },
{ 0xf5edc9b4, "register_filesystem" },
{ 0x1d2e87c6, "do_gettimeofday" },
{ 0xb6244511, "sg_init_one" },
{ 0x14c9cc6e, "iput" },
{ 0x37a0cba, "kfree" },
{ 0x236c8c64, "memcpy" },
{ 0xf6bcfa33, "d_splice_alias" },
{ 0x86661200, "end_buffer_read_sync" },
{ 0x65893c60, "get_sb_bdev" },
{ 0x57b09822, "up" },
{ 0x27353620, "put_page" },
{ 0x3b945115, "mark_buffer_dirty" },
{ 0xb436a00c, "unregister_filesystem" },
{ 0x479ce6d9, "find_get_page" },
{ 0xa5843ffe, "__getblk" },
{ 0x855897b, "set_blocksize" },
{ 0x1f723bc9, "crypto_alloc_base" },
{ 0x77e2f33, "_copy_from_user" },
{ 0xe0b6b443, "d_instantiate" },
{ 0xe456d99a, "__init_rwsem" },
{ 0x29537c9e, "alloc_chrdev_region" },
{ 0x85659cb1, "vm_insert_pfn" },
{ 0x760a0f4f, "yield" },
{ 0x7a6e333d, "iget_locked" },
};

static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";


MODULE_INFO(srcversion, "F2805267BB3DD98BBC2E258");
Loading

0 comments on commit dfac83f

Please sign in to comment.