linux/block/partitions/sgi.c
<<
>>
Prefs
   1/*
   2 *  fs/partitions/sgi.c
   3 *
   4 *  Code extracted from drivers/block/genhd.c
   5 */
   6
   7#include "check.h"
   8#include "sgi.h"
   9
  10struct sgi_disklabel {
  11        __be32 magic_mushroom;          /* Big fat spliff... */
  12        __be16 root_part_num;           /* Root partition number */
  13        __be16 swap_part_num;           /* Swap partition number */
  14        s8 boot_file[16];               /* Name of boot file for ARCS */
  15        u8 _unused0[48];                /* Device parameter useless crapola.. */
  16        struct sgi_volume {
  17                s8 name[8];             /* Name of volume */
  18                __be32 block_num;               /* Logical block number */
  19                __be32 num_bytes;               /* How big, in bytes */
  20        } volume[15];
  21        struct sgi_partition {
  22                __be32 num_blocks;              /* Size in logical blocks */
  23                __be32 first_block;     /* First logical block */
  24                __be32 type;            /* Type of this partition */
  25        } partitions[16];
  26        __be32 csum;                    /* Disk label checksum */
  27        __be32 _unused1;                        /* Padding */
  28};
  29
  30int sgi_partition(struct parsed_partitions *state)
  31{
  32        int i, csum;
  33        __be32 magic;
  34        int slot = 1;
  35        unsigned int start, blocks;
  36        __be32 *ui, cs;
  37        Sector sect;
  38        struct sgi_disklabel *label;
  39        struct sgi_partition *p;
  40        char b[BDEVNAME_SIZE];
  41
  42        label = read_part_sector(state, 0, &sect);
  43        if (!label)
  44                return -1;
  45        p = &label->partitions[0];
  46        magic = label->magic_mushroom;
  47        if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) {
  48                /*printk("Dev %s SGI disklabel: bad magic %08x\n",
  49                       bdevname(bdev, b), be32_to_cpu(magic));*/
  50                put_dev_sector(sect);
  51                return 0;
  52        }
  53        ui = ((__be32 *) (label + 1)) - 1;
  54        fo40c));*ic.c#L53" id="L53" class="line" name="L5="v2.6.25.10"
	  >
  v2.6.25.10__be32 *) (a href="+code=label" class="sref">label)
; {
  455/a>                cs;L5=ui,--
  456/a>                be32_to_cpu(cs;;
  457/a>        }
  458/a>        if(  45                puintk(/a>(pKERN_WARNING/a> quot;Dev %s SGI disklabel: b" nabad ,label chorruptedn",/span>
,  56                <      beevname(/a>(state,>beevn/a>, b[);
  56                ra href="+code=put_dev_sector" class="sref">put_dev_sector(sect);
  56                  563/a>        }
  56        /* PAllSGI diskllabel s have 16partition s,diskls under Lnux+ only/span>
  46 ********** have 15 minor#379;s.  Luckily there are always a few zero length/span>
  466/a> ********** artitions/ which we don#379;t care about so we never overflow the/span>
  467/a> ********** currnt"_minor./span>
  468/a> **********
  46         o40c));*ic.c#L53" i" class="sref">i,L5="v2.6.25.10"
	  >
" class="sref">i,L< 16v2.6.25.10"
	  >
" class="sref">i,++ p ++ {
  57                blocks;= be32_to_cpu(p >num_blocks;;
  57                ra href="+code=ptart" class="sref">start, = be32_to_cpu(p >first_block;;
  57                blocks; {
  57                <       ra href="+code=put_dartition" class="sref">sut_dartition"/a>(state, 0a href="+code=slot" class="sref">slot  0a href="+code=slart" class="sref">start, blocks;;
  57                r       be32_to_cpu(p >type;) = tLINUX_RAID_PARTITION/a>)
  475/a>                <               ra href="+code=ptare" class="sref">state,>partis/a>[slot ].a href="+code=milag" class="sref">pilag"/a>;= pADDPART_FLAG_RAID/a>;
  476/a>                <
  47                slot ++
  478/a>        i
  47         a href="+code=ptarlca" class="sref">starlca"/a>(state,>pap_buf/a>, quot;Dn",/span>
, a href="+code=pPAG_SIZE" class="sref">BPAG_SIZE"/a>;;
  580/a>         a href="+code=put_dev_sector" class="sref">put_dev_sector(sect);
  58         eturn 0;
  58 
  58
 

/div>

The original LXR software by the a href="+http://sourceo40ge.net/projctLXR ommeunity/a>, lxr@inux+.no/a>,. /div> div ilass="lsubfooter"> lxr.inux+.no kindly hosed fby a href="+http://www.redpill-inupro.no">Redpill Lnupro AS/a>,