write a c program showblock which displays the disk blocks of a file in an ext2 file system

the website link

https://www.eecs.wsu.edu/~cs360/LAB6.html

 
 Write a C program, showblock, which displays the disk blocks of a file 
 in an EXT2 file system. The program runs as follows

       showblock  DEVICE    PATHNAME
       ---------  -------   ----------
e.g.   showblock  diskimage  /a/b/c/d  (diskimage contains an EXT2 FS)

 It locates the file named PATHNAME and prints the disk blocks (direct, 
 indirect, double-indirect) of the file.
**************************************************************************/ 

               HOWTO Traverse EXT2 File System Tree

1. How to traverse the EXT2 FS tree:

   Given a device, mydisk, containing an ext2 FS, and a pathname, e.g.
                   /cs360/is/fun
   of a file, find the file.

   NOTE!!! To find a file amounts to finding its INODE. 
           From its inode, you have ALL the information of a file.
  
2. ALGORITHM:

(1). Open disk for READ ==> file descriptor fd as dev number
          You already have a    get_block(fd, blk, buf[  ]) function.
 
(2). Tokenize pathname into components, e.g. /cs360/is/fun ==>

     char *name[0]  name[1]  name[2];  with n = 3
            |        |        |
           "cs360"  "is"     "fun"

(3). The following C code prints the entries of a DIRectory INODE:

   INODE *ip -> INODE structure of a DIRectory

   char dbuf[BLKSIZE], temp[256];
   DIR *dp;
   char *cp;
   int i;
   int dev = opened fd of disk

   for (i=0; i < 12; i++){  // assume at most 12 direct blocks
       if (ip->i_block[i] == 0)
          break;
       get_block(dev, ip->i_block[i], dbuf);
       dp = (DIR *)dbuf;
       cp = dbuf;

       while (cp < dbuf + BLKSIZE){
          strncpy(temp, dp->name, dp->name_len);
          temp[dp->name_len] = 0;
          printf("%4d %4d %4d %sn", 
	          dp->inode, dp->rec_len, dp->name_len, temp);

          cp += dp->rec_len;
          dp = (DIR *)cp;
       }
   }

   Modify it to wrtie a search() function

          int search(INODE *ip, char *name)
  
   which searches the DIrectory's data blocks for a name string; 
         return its inode number if found; 0 if not.

(4). Start from the root inode #2: (YOU should already know HOW to do this) 

         INODE *ip->root inode;

         int ino, blk, offset;
         int iblk = inodes_start_block number (YOU should also know HOW)
         char ibuf[BLKSIZE];

         for (i=0; i < n; i++){
             ino = search(ip, name[i]);
             if (ino==0){
                printf("can't find %sn", name[i]); exit(1);
             }
  
             // Mailman's algorithm: Convert (dev, ino) to inode pointer
             blk    = (ino - 1) / 8 + iblk;  // disk block contain this INODE 
             offset = (ino - 1) % 8;         // offset of INODE in this block
             get_block(dev, blk, ibuf[ ]);
             ip = (INODE *)ibuf + offset;    // ip -> new INODE
         }
  
(5). When the above for loop ends, ip MUST point at the INODE of pathname.

(6). Extract information from ip-> as required:

       Print direct block numbers;
       Print indirect block numbers; 
       Print double indirect block numbers, if any

     Pat yourself on the back and say: Good Job!
(7). SAMPLES SOLUTION in samples/LAB6/:
             showblock.bin  diskimage

 

Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code “Newclient” for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.

The post write a c program showblock which displays the disk blocks of a file in an ext2 file system appeared first on My Nursing Experts.

Epidemiology Please Do Early

  • What are the ethical issues surrounding this study at the beginning and when the decision was made to terminate the study?

When you discuss the ethical issues of the STEP study think in terms of the four major Principles of Ethics which are listed below:

Respect for Persons (autonomy)

Beneficence,

Nonmaleficence and

Justice

Please refer to your textbook for information about The Belmont Report and about these principles.

Please also refer below where I have provided a link to more information about the four major Principles of Ethics.

Please remember to write a response that is specific to context of the scenario presented (i.e. in terms of The STEP Study).  Use your research to inform your discussion.

Regards,

Dr. Chodaesessie Irene Morgan

Reply to ThreadFilter by:All Posts|Clear filtersShow:Threaded Newest First Oldest First Author First Name A-Z Author First Name Z-A Author Last Name A-Z Author Last Name Z-A Subject A-Z Subject Z-A Attachments First

 

Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code “Newclient” for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.

The post Epidemiology Please Do Early appeared first on Essay Writers.

450 words no cover page

Take a moment to write job descriptions for a hypothetical director of a non-profit family service agency as it might have appeared in 1908 and one as it might appear today. Specifically, speculate on how the expectations for persons in management have evolved in the following areas: personal characteristics (e.g., gender, race), leadership, fundraising, inter-organizational relations, personnel management, and accountability. In comparing these job descriptions, consider how ideological, theoretical, fiscal, environmental, technical, and professional developments have shaped and changed management practice over the last 100 years. Then write a 450 word paper reflecting on the ways in which the management of human services agencies has changed over the last century. Be sure to apply the Saint Leo University core value of community in your discussion.

450 words…. no cover page. References page is required. APA format

 

Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code “Newclient” for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.

The post 450 words no cover page appeared first on My Nursing Experts.

Write a 350- to 525-word article that evaluates the cost of the health care workforce

Write a 350- to 525-word article that evaluates the cost of the health care workforce

Assignment Content Write a 350- to 525-word article that evaluates the cost of the health care workforce. Your article should: Identify three key drivers of labor costs within a specific health care service, facility, or other health sector-related occupation (e.g., labor supply, productivity improvement, technology, or personnel benefit design) Evaluate current industry solutions or remediation activities to address the identified labor costs Predict future changes (e.g., policy, funding, or public support) that might exacerbate or accelerate the solutions


 


The post Write a 350- to 525-word article that evaluates the cost of the health care workforce appeared first on nursing assignment tutor.