*/
+#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
{
unsigned long entry_num;
char *ptr,buffer [80];
-
-
-
+
+
+
ptr=parse_word (command_line,buffer); /* Get the requested entry */
if (*ptr==0) {
wprintw (command_win,"Error - No argument specified\n");
entry_num=atol (buffer);
-
+
if (entry_num >= file_system_info.super_block.s_blocks_per_group) { /* Check if it is a valid entry number */
wprintw (command_win,"Error - Entry number out of bounds\n");
refresh_command_win ();return;
}
-
-
-
+
+
+
block_bitmap_info.entry_num=entry_num; /* If it is, just change entry_num and */
strcpy (buffer,"show");dispatch (buffer); /* dispatch a show command */
}
{
long entry_offset=1;
char *ptr,buffer [80];
-
+
ptr=parse_word (command_line,buffer);
if (*ptr!=0) {
ptr=parse_word (ptr,buffer);
{
long entry_offset=1;
char *ptr,buffer [80];
-
+
ptr=parse_word (command_line,buffer);
if (*ptr!=0) {
ptr=parse_word (ptr,buffer);
{
long entry_num,num=1;
char *ptr,buffer [80];
-
+
ptr=parse_word (command_line,buffer); /* Get the number of blocks to allocate */
if (*ptr!=0) {
ptr=parse_word (ptr,buffer);
num=atol (buffer);
}
-
+
entry_num=block_bitmap_info.entry_num;
/* Check for limits */
if (num > file_system_info.super_block.s_blocks_per_group-entry_num) {
- wprintw (command_win,"Error - There aren't that much blocks in the group\n");
- refresh_command_win ();return;
+ wprintw (command_win,"Error - There aren't that much blocks in the group\n");
+ refresh_command_win ();return;
}
-
+
while (num) { /* And call allocate_block */
allocate_block (entry_num); /* for each block */
num--;entry_num++;
}
-
+
dispatch ("show"); /* Show the result */
}
{
long entry_num,num=1;
char *ptr,buffer [80];
-
+
ptr=parse_word (command_line,buffer);
if (*ptr!=0) {
ptr=parse_word (ptr,buffer);
num=atol (buffer);
}
-
+
entry_num=block_bitmap_info.entry_num;
if (num > file_system_info.super_block.s_blocks_per_group-entry_num) {
- wprintw (command_win,"Error - There aren't that much blocks in the group\n");
- refresh_command_win ();return;
+ wprintw (command_win,"Error - There aren't that much blocks in the group\n");
+ refresh_command_win ();return;
}
-
+
while (num) {
deallocate_block (entry_num);
num--;entry_num++;
}
-
+
dispatch ("show");
}
{
unsigned char bit_mask=1;
int byte_offset,j;
-
+
byte_offset=entry_num/8; /* Find the correct byte - entry_num/8 */
/* The position inside the byte is entry_num %8 */
for (j=0;j<entry_num%8;j++)
{
unsigned char bit_mask=1;
int byte_offset,j;
-
+
byte_offset=entry_num/8;
for (j=0;j<entry_num%8;j++)
bit_mask*=2;
bit_mask^=0xff;
-
+
type_data.u.buffer [byte_offset] &= bit_mask;
}
ptr=type_data.u.buffer;
show_pad_info.line=0;show_pad_info.max_line=-1;
-
+
wmove (show_pad,0,0);
for (i=0,entry_num=0;i<file_system_info.super_block.s_blocks_per_group/8;i++,ptr++) {
for (j=1;j<=128;j*=2) { /* j contains the and bit mask */
show_pad_info.max_line++;
}
}
-
- refresh_show_pad ();
+
+ refresh_show_pad ();
show_info (); /* Show the usual information */
/* Show the group number */
wmove (show_win,1,0);
wprintw (show_win,"Block bitmap of block group %ld\n",block_bitmap_info.group_num);
/* Show the block number */
-
+
block_num=block_bitmap_info.entry_num+block_bitmap_info.group_num*file_system_info.super_block.s_blocks_per_group;
- block_num+=file_system_info.super_block.s_first_data_block;
+ block_num+=file_system_info.super_block.s_first_data_block;
wprintw (show_win,"Status of block %ld - ",block_num); /* and the allocation status */
ptr=type_data.u.buffer+block_bitmap_info.entry_num/8;
j=1;
for (i=block_bitmap_info.entry_num % 8;i>0;i--)
j*=2;
- if ((*ptr) & j)
+ if ((*ptr) & j)
wprintw (show_win,"Allocated\n");
else
wprintw (show_win,"Free\n");