Beispiel #1
0
void superblock2()
{
	char			*arg;
	int			is_primary = 1;
	struct superblock	super;

	if ((arg = strtok(0, " 	")) != 0) {	/* space & tab	*/
		if (strcmp(arg, "p") == 0)
			is_primary = 1;
		else if (strcmp(arg, "s") == 0)
			is_primary = 0;
		else {
			fprintf(stderr, "superblock: invalid parameter '%s'\n\n", arg);
			return;
		}
	}
	else if (strtok(0, " 	")) {
		fputs("superblock: too many arguments.\n\n", stderr);
		return;
	}

	if (ujfs_get_superblk(fd, &super, is_primary)) {
		fputs("superblock: error returned from ujfs_get_superblk\n\n",stderr);
		return;
	}
	if (display_super2(&super) == XPEEK_CHANGED)
		if (ujfs_put_superblk(fd, &super, (short)is_primary))
			fputs("superblock: error returned from ujfs_put_superblk\n\n",stderr);
	return;
}
Beispiel #2
0
int32 read_super( int device )
{
    int32 rc;

    rc = ujfs_get_superblk( device, &sb, TRUE );
    if( rc != 0 ) {
	printf("Failed reading primary superblock, will try secondary.\n");

	rc = ujfs_get_superblk( device, &sb, FALSE );
	if( rc != 0 ) {
	    printf("Failed reading secondary superblock.\n");
	    return(rc);
	}
    }

    rc = ujfs_validate_super( &sb );

    if( rc != 0 ) {
	printf("Not a recognized XJFS filesystem.\n");
    }
    return(rc);
}