My favorites
▼
|
Sign in
fscops
OHSM - Online Hierarchical Storage Manager
Project Home
Downloads
Wiki
Issues
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
9
attachment: user.c
(6.6 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*The program takes input the mount point of any file system and prints the superblock information
Copyright (C) <2008> <rishi bhushan agrawal>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/stat.h>
#include<fcntl.h>
#include <linux/ext2_fs.h>
#define MNTPNT_LEN 30
struct ext2_super_block;
struct print_super_info
{
char mntpnt[MNTPNT_LEN];
struct ext2_super_block sb;
int error;
};
int
main ()
{
int fd;
struct print_super_info input;
input.error = 0;
void *ptr = NULL;
fd = open ("/dev/ohsm_meta", O_RDWR);
if (fd == 0)
{
printf ("\nError opening device");
return 1;
}
printf ("\n\nEnter the Mount Point of the File System : ");
scanf ("%s", input.mntpnt);
ptr = &input;
ioctl(fd,1,ptr);
printf ("\n\nDisplaying the Super Block data : \n\n");
printf("\n\nUSER: 11111******************************************************\n\n");
if (input.error == 0)
{
printf ("\nInodes Count %-15u", (input.sb).s_inodes_count); /* Inodes count */
printf ("\nBlocks Count %-15u", (input.sb).s_blocks_count); /* Blocks count */
printf ("\nReserved blocks count %-15u", (input.sb).s_r_blocks_count); /* Reserved blocks count */
printf ("\nFree blocks Count %-15u", (input.sb).s_free_blocks_count); /* Free blocks count */
printf ("\nFree Inodes Count %-15u",(input.sb).s_free_inodes_count); /* Free inodes count */
printf ("\nFirst Data Block %-15u", (input.sb).s_first_data_block); /* First Data Block */
printf ("\nBlock Size %-15u", 1<<(10+((input.sb).s_log_block_size))); /* Block size */
printf ("\nFragment Size %-15u", (input.sb).s_log_frag_size); /* Fragment size */
printf ("\nBlocks Per Group %-15u", (input.sb).s_blocks_per_group); /* # Blocks per group */
printf ("\nFragments Per Group %-15u", (input.sb).s_frags_per_group); /* # Fragments per group */
printf ("\nInodes Per Group %-15u", (input.sb).s_inodes_per_group); /* # Inodes per group */
printf ("\nMount Time %-15u", (input.sb).s_mtime); /* Mount time */
printf ("\nWrite Time %-15u", (input.sb).s_wtime); /* Write time */
printf ("\nMount Count %-15u", (input.sb).s_mnt_count); /* Mount count */
printf ("\nMaximal Mount Count %-15u", (input.sb).s_max_mnt_count); /* Maximal mount count */
printf ("\nMagic Signature %-15x", (input.sb).s_magic); /* Magic signature */
printf ("\nFile System State %-15u", (input.sb).s_state); /* File system state */
printf ("\nBehaviour when detecting errors %-15u",(input.sb).s_errors); /* Behaviour when detecting errors */
printf ("\nMinor revison Level %-15u", (input.sb).s_minor_rev_level); /* minor revision level */
printf ("\nTime Of Last Check %-15u", (input.sb).s_lastcheck); /* time of last check */
printf ("\nmax time between checks %-15u", (input.sb).s_checkinterval); /* max. time between checks */
printf ("\nOS %-15u", (input.sb).s_creator_os); /* OS */
printf ("\nRevison Level %-15u", (input.sb).s_rev_level); /* Revision level */
printf ("\nDefault uid for reserved blocks %-15u", (input.sb).s_def_resuid); /* Default uid for reserved blocks */
printf ("\nDefault gid for reserved blocks %-15u", (input.sb).s_def_resgid); /* Default gid for reserved blocks */
/*
* These fields are for EXT2_DYNAMIC_REV superblocks only.
*
* Note: the difference between the compatible feature set and
* the incompatible feature set is that if there is a bit set
* in the incompatible feature set that the kernel doesn't
* know about, it should refuse to mount the filesystem.
*
* e2fsck's requirements are more strict; if it doesn't know
* about a feature in either the compatible or incompatible
* feature set, it must abort and not try to meddle with
* things it doesn't understand...
*/
//__le32 s_first_ino; /* First non-reserved inode */
printf ("\nInode Size %-15u", (input.sb).s_inode_size); /* size of inode structure */
printf ("\nBlock Group Number of this superblock %-15u", (input.sb).s_block_group_nr); /* block group # of this superblock */
//__le32 s_feature_compat; /* compatible feature set */
//__le32 s_feature_incompat; /* incompatible feature set */
//__le32 s_feature_ro_compat; /* readonly-compatible feature set */
//__u8 s_uuid[16]; /* 128-bit uuid for volume */
// char s_volume_name[16]; /* volume name */
// char s_last_mounted[64]; /* directory where last mounted */
// __le32 s_algorithm_usage_bitmap; /* For compression */
/*
* Performance hints. Directory preallocation should only
* happen if the EXT2_COMPAT_PREALLOC flag is on.
*/
// __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
// __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
// __u16 s_padding1;
/*
* Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
*/
// __u8 s_journal_uuid[16]; /* uuid of journal superblock */
// __u32 s_journal_inum; /* inode number of journal file */
// __u32 s_journal_dev; /* device number of journal file */
// __u32 s_last_orphan; /* start of list of inodes to delete */
// __u32 s_hash_seed[4]; /* HTREE hash seed */
// __u8 s_def_hash_version; /* Default hash version to use */
// __u8 s_reserved_char_pad;
// __u16 s_reserved_word_pad;
// __le32 s_default_mount_opts;
// __le32 s_first_meta_bg; /* First metablock block group *//
// __u32 s_reserved[190]; /* Padding to the end of the block */
/******************/
//printf("\n%s", ptr);
}
else
{
printf ("\n\nSome Error : Error Codes Will Be Done Later");
}
return 0;
}
Powered by
Google Project Hosting