size_t sbbuf_len; /* size of data in superblock buffer */
unsigned char *buf; /* seek buffer */
- off_t buf_off; /* offset of seek buffer */
+ blkid_loff_t buf_off; /* offset of seek buffer */
size_t buf_len; /* size of data in seek buffer */
size_t buf_max; /* allocated size of seek buffer */
/* probe.c */
unsigned char *blkid_probe_get_buffer(blkid_probe pr,
blkid_loff_t off, blkid_loff_t len);
+
+#define blkid_probe_get_sb(_pr, _mag, type) \
+ ((type *) blkid_probe_get_buffer((_pr),\
+ (_mag)->kboff << 10, sizeof(type)))
+
extern int blkid_probe_set_value(blkid_probe pr, const char *name,
unsigned char *data, size_t len);
extern int blkid_probe_vsprintf_value(blkid_probe pr, const char *name,
{
struct cramfs_super *cs;
- cs = (struct cramfs_super *) blkid_probe_get_buffer(pr, 0, 0x200);
- if (cs == NULL)
+ cs = blkid_probe_get_sb(pr, mag, struct cramfs_super);
+ if (!cs)
return -1;
blkid_probe_set_label(pr, cs->name, sizeof(cs->name));
{
struct jfs_super_block *js;
- js = (struct jfs_super_block *) blkid_probe_get_buffer(pr, 0x8000, 0x200);
+ js = blkid_probe_get_sb(pr, mag, struct jfs_super_block);
+ if (!js)
+ return -1;
if (le32_to_cpu(js->js_bsize) != (1 << le16_to_cpu(js->js_l2bsize)))
return 1;