File: f2fs.c

package info (click to toggle)
disktype 9-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 452 kB
  • sloc: ansic: 5,252; makefile: 150
file content (36 lines) | stat: -rw-r--r-- 768 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * f2fs.c
 * Detection of f2fs file system
 *
 * Superblock details are from Github project f2fs-tools,
 * file f2fs-tools-1.11.0\include\f2fs_fs.h
 */

#include "global.h"

void detect_f2fs(SECTION *section, int level)
{
  // Superblock in sector 2
  //
  unsigned char *buf;
  if (get_buffer(section, 1024, 512, (void **)&buf) < 512)
    return;

  if (get_le_long(buf+0) != 0xF2F52010)
    return;

  u2 major = get_le_short(buf+4);
  u2 minor = get_le_short(buf+6);

  print_line(level, "F2FS file system (version %d.%d)", major, minor);


  char volume_name[512];
  format_utf16_le(buf+124, 512, volume_name);
  print_line(level, "Volume name: %s", volume_name);


  char uuid[40];
  format_uuid(buf+108, uuid);
  print_line(level, "Volume uuid: %s", uuid);
}