[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Minix(Unix) recover blocks

Posted on 2003-11-16
6
Medium Priority
?
355 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
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.

650 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