Subversion Repositories HelenOS

Rev

Rev 2000 | Rev 2005 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2000 Rev 2002
Line 36... Line 36...
36
 *
36
 *
37
 * Support for RAM disk images.
37
 * Support for RAM disk images.
38
 */
38
 */
39
 
39
 
40
#include <lib/rd.h>
40
#include <lib/rd.h>
-
 
41
#include <arch/byteorder.h>
41
 
42
 
42
bool init_rd(void * addr)
43
int init_rd(rd_header * header)
43
{
44
{
-
 
45
    /* Identify RAM disk */
-
 
46
    if ((header->magic[0] != RD_MAG0) || (header->magic[1] != RD_MAG1) || (header->magic[2] != RD_MAG2) || (header->magic[3] != RD_MAG3))
-
 
47
        return RE_INVALID;
-
 
48
   
-
 
49
    /* Identify version */ 
-
 
50
    if (header->version != RD_VERSION)
-
 
51
        return RE_UNSUPPORTED;
-
 
52
   
-
 
53
    uint64_t hsize;
-
 
54
    switch (header->data_type) {
-
 
55
    case RD_DATA_LSB:
-
 
56
        hsize = uint64_t_le2host(header->header_size);
-
 
57
        break;
-
 
58
//  case RD_DATA_MSB:
-
 
59
//      hsize = uint64_t_be2host(header->header_size);
-
 
60
//      break;
-
 
61
    default:
-
 
62
        return RE_UNSUPPORTED;
-
 
63
    }
-
 
64
       
-
 
65
 
44
    return false;
66
    return RE_OK;
45
}
67
}
46
 
68
 
47
/** @}
69
/** @}
48
 */
70
 */