Solved

Minix(Unix) recover blocks

Posted on 2003-11-16
6
347 Views
Last Modified: 2012-06-27
I am developing a C code to run on Minix(unix version) that recovers an unused block and guves it a name, the block number should be passed as a argument.

can any one find me a breif example of this being done.
0
Comment
Question by:thegameskeeper
  • 2
  • 2
6 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9777149
>that recovers an unused block and guves it a name
not very sure what you mean by this ? What sort of name ?
0
 

Author Comment

by:thegameskeeper
ID: 9782501
>that recovers an unused block and guves it a name
not very sure what you mean by this ? What sort of name ?

ILL get back to you on this, but on my last question, i have read the superblock and it doesnt do what i wanted, instead of read the file and lseek to the superblock, i think its best to lseek to the zonebitmap, but after i do this what does the information represent there and once again how can i use that for loop
0
 

Author Comment

by:thegameskeeper
ID: 9797911
>that recovers an unused block and guves it a name
not very sure what you mean by this ? What sort of name ?

a regular char *, provided by user, so it can be used as alias
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 total points
ID: 9802698
sorry for the late reply ....
>instead of read the file and lseek to the superblock, i think its best to lseek to the zonebitmap
either way is fine ... you should be able to read them in .. thats all that matters

>what does the information represent there
check the documents to confirm that but I think they should be the bitmaps ... and that was what I assumed when I provided the code

>and once again how can i use that for loop
that loop reads in the bitmap 4 bytes at a time ... (use memcpy for this) ... it checks each bit in those 4 bytes and detrmines the status of the block accordingly ...

If the zonemap is not a bitvector, post the format here and I'll help with it

>a regular char *, provided by user, so it can be used as alias
that means you need to maintain a mapping of block number and names ... if the mapping is going to be bid, I would suggest keeping it sorted by block name and use binary search to locate the appropriate block number... you can keep this data in memory if it is not too voluminous ... else you may need to keep this table in a file ...

something like

char * name;
int num;

struct info
{
          char * alias;
          unsigned long block_number;
};

struct info array[MAX_NUMBER_OF_BLOCKS];
...
scanf ( " %s ", name );
scanf ( " %d ", num );
...
/* store sorted */

here you will face a tradeoff --- if you use array, buliding the database of indices will be resource consuming as inserting in the middle of an array will take longer ... If you use linked lists instead, inserting in place will be cheaper (atleast intially ) but later all searches will be sequential ...
you may consider using BST or B trees as alternatives depending on your application and your objectives...

Cheers!
Sunny:o)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Often we come across situations wherein our batch files would be needing to reboot Windows for a variety of reasons. A few of them would be like: (1) Setup files have been updated whose changes can take effect only after a reboot …
Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question